How do I formate spaces in terminal for FFMPEG metadata - macos

I can't get FFMPEG to accept any spaces when I try to assign it to the metadata. Below is the command I am using in Terminal on MacOS. It gives me an error: [NULL # 0x7fce76026600] Unable to find a suitable output format for 'World' World: Invalid argument
ffmpeg -hide_banner \
-i Trolls.World.Tour.2020.Bluray-2160p.m2ts \
-ss 00:10:00 -t 00:1:00 \
-pix_fmt yuv420p10le \
-map_chapters 0 \
-metadata:s:t:0 filename="" -metadata:s:t:0 mimetype="image/jpeg" \
-metadata title=“Trolls World Tour” \
-map 0:0 -metadata:s:v:0 language=eng -metadata:s:v:0 title=“Trolls World Tour” \
-map 0:2 -metadata:s:a:0 language=eng -metadata:s:a:0 title=“Dolby TrueHD 7.1 Atmos” \
-map 0:6 -metadata:s:a:0 language=eng -metadata:s:a:1 title=“AC-3 2.0” \
-c:v libx265 -preset slow -crf 16 \
-x265-params keyint=60:bframes=3:vbv-bufsize=75000:vbv-maxrate=75000:hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display="G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,500)" \
-c:a copy \
Trolls.World.Tour.2020.2160p.BluRay.REMUX.HEVC.TrueHD.7.1.Atmos.mkv
I have tried 'title="Trolls World Tour"' title=Trolls" "World" "Tour to no luck.
Using title="Trolls\ World\ Tour" works but then the title includes the backslashes.
Any thoughts?

Replace the “smart / fancy” quotes with "normal double quotes".
Bad: “ & ”
Good: "

Related

Chaining multiple ffmpeg filters into one command [duplicate]

I can't get FFMPEG to accept any spaces when I try to assign it to the metadata. Below is the command I am using in Terminal on MacOS. It gives me an error: [NULL # 0x7fce76026600] Unable to find a suitable output format for 'World' World: Invalid argument
ffmpeg -hide_banner \
-i Trolls.World.Tour.2020.Bluray-2160p.m2ts \
-ss 00:10:00 -t 00:1:00 \
-pix_fmt yuv420p10le \
-map_chapters 0 \
-metadata:s:t:0 filename="" -metadata:s:t:0 mimetype="image/jpeg" \
-metadata title=“Trolls World Tour” \
-map 0:0 -metadata:s:v:0 language=eng -metadata:s:v:0 title=“Trolls World Tour” \
-map 0:2 -metadata:s:a:0 language=eng -metadata:s:a:0 title=“Dolby TrueHD 7.1 Atmos” \
-map 0:6 -metadata:s:a:0 language=eng -metadata:s:a:1 title=“AC-3 2.0” \
-c:v libx265 -preset slow -crf 16 \
-x265-params keyint=60:bframes=3:vbv-bufsize=75000:vbv-maxrate=75000:hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display="G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,500)" \
-c:a copy \
Trolls.World.Tour.2020.2160p.BluRay.REMUX.HEVC.TrueHD.7.1.Atmos.mkv
I have tried 'title="Trolls World Tour"' title=Trolls" "World" "Tour to no luck.
Using title="Trolls\ World\ Tour" works but then the title includes the backslashes.
Any thoughts?
Replace the “smart / fancy” quotes with "normal double quotes".
Bad: “ & ”
Good: "

Change ffmpeg input while streaming

Is there a way to change ffmpeg input while streaming to rtmp?
I have this bash script
#! /bin/bash
VBR="1500k"
FPS="24"
QUAL="superfast"
RTMP_URL="rtmp://live.live/live"
KEY="xxxxxxxxxxxxxxxxxxxxx"
VIDEO_SOURCE="video.mp4"
AUDIO_SOURCE="song.mp3"
NP_SOURCE="song.txt"
FONT="font.ttf"
ffmpeg \
-re -f lavfi -i "movie=filename=$VIDEO_SOURCE:loop=0, setpts=N/(FRAME_RATE*TB)" \
-thread_queue_size 512 -i "$AUDIO_SOURCE" \
-map 0:v:0 -map 1:a:0 \
-map_metadata:g 1:g \
-vf drawtext="fontsize=25: fontfile=$FONT: \
box=1: boxcolor=black#0.5: boxborderw=20: \
textfile=$NP_SOURCE: reload=1: fontcolor=white#0.8: x=50: y=50" \
-vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \
-acodec libmp3lame -ar 44100 -threads 6 -qscale:v 3 -b:a 320000 -bufsize 512k \
-f flv "$RTMP_URL/$KEY"
What i want to do is to be able to change VIDEO_SOURCE on the fly, i was thinking if it's possible to make the input a directory then change the video in that directory on the fly, i'm new to dealing with scripts so i don't know how to do that
This is a complete guess, based on what little I know about how ffmpeg handles interactive input:
while :; do
ffmpeg \
-re -f lavfi -i "movie=filename=$VIDEO_SOURCE:loop=0, setpts=N/(FRAME_RATE*TB)" \
-thread_queue_size 512 -i "$AUDIO_SOURCE" \
-map 0:v:0 -map 1:a:0 \
-map_metadata:g 1:g \
-vf drawtext="fontsize=25: fontfile=$FONT: \
box=1: boxcolor=black#0.5: boxborderw=20: \
textfile=$NP_SOURCE: reload=1: fontcolor=white#0.8: x=50: y=50" \
-vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \
-acodec libmp3lame -ar 44100 -threads 6 -qscale:v 3 -b:a 320000 -bufsize 512k \
-f flv "$RTMP_URL/$KEY"
read -p "Next movie?" VIDEO_SOURCE
[ "$VIDEO_SOURCE" = q ] && break
done
ffmpeg should(?) exit if you send q to standard input. Your script will then prompt you for a new value for VIDEO_SOURCE. If you type q again, the loop exits. Otherwise, it restarts ffmpeg with the new video source file.
If this works, you can perhaps adapt it for something closer to your needs.

ffmpeg no audio after filter_complex

Could someone help with the disappeared audio?
video_2.mp4 logo3.mp4 - has audio
ffmpeg -i video_2.mp4 -i logo3.mp4 -filter_complex \
"color=black:s=1920x1080:d=24 \
,format=yuv444p \
,geq='lum=X*255/W: \
cr=128: \
cb=128' \
[alpha]; \
[0:v]scale=1920x1080, setsar=1[0v]; \
[1:v]scale=1920x1080, setpts=PTS-STARTPTS+10/TB, setsar=1[1v]; \
[1v][alpha]alphamerge[1v]; \
[0v][1v]overlay=enable='between(t\,11,14)',format=yuv420p [v]" -map "[v]" -map 1:a \
-an out.mp4
In -map 1:a -an, the -an negates the mapping. Remove it.

Use filter_complex output as MKV attachment in ffmpeg

I'm trying to scale and crop an image and use it as MKV attachment in one shot, but without success.
I understand that the "-attach" command does exactly that, but the problem is that I don't have the final image as a file. Instead I'm trying to crop and scale the file on the fly, doing something like this:
ffmpeg -fflags +genpts \
-i video.h265 \
-i audio.ac3 \
-i sub.ass \
-i cover_img.jpg \
-filter_complex "[3:v]crop=in_h:in_h,scale=600:600[cover]; [3:v]crop=in_h:in_h,scale=120:120[small_cover]; [3:v]scale='-1:600'[cover_land]; [3:v]scale='-1:120'[small_cover_land]" \
-map 0:v:0 -map 1:a:0 -map 2:s:0 \
-map "[cover]" -disposition:v:1 attached_pic -metadata:s:v:1 filename="cover.jpg" -metadata:s:v:1 mimetype="image/jpeg" \
-map "[small_cover]" -disposition:v:2 attached_pic -metadata:s:v:2 filename="small_cover.jpg" -metadata:s:v:2 mimetype="image/jpeg" \
-map "[cover_land]" -disposition:v:3 attached_pic -metadata:s:v:3 filename="cover_land.jpg" -metadata:s:v:3 mimetype="image/jpeg" \
-map "[small_cover_land]" -disposition:v:4 attached_pic -metadata:s:v:4 filename="small_cover_land.jpg" -metadata:s:v:1 mimetype="image/jpeg" \
-r 24000/1001 -c:s ass -c:a copy \
-c:v mjpeg -c:v:0 libx265 \
out.mkv
But it doesn't work, because the streams are mapped as video, not attachments.
I also tried to change the "[3:v]" in filter_complex to "[3:t]", but it doesn't work, since pictures are considered as video streams.
Now I resorted to a two-step process, but I'm looking for a way to do both things at the same time:
ffmpeg -i cover_img.jpg \
-filter_complex "[0:v]crop=in_h:in_h,scale=600:600[cover]; [0:v]crop=in_h:in_h,scale=120:120[small_cover]; [0:v]scale='-1:600'[cover_land]; [0:v]scale='-1:120'[small_cover_land]" \
-c:v mjpeg \
-map "[cover]" cover.jpg \
-map "[small_cover]" small_cover.jpg \
-map "[cover_land]" cover_land.jpg \
-map "[small_cover_land]" small_cover_land.jpg
ffmpeg -fflags +genpts \
-i video.h265 \
-i audio.ac3 \
-i sub.ass \
-map 0:v:0 -map 1:a:0 -map 2:s:0 \
-attach "cover.jpg" -metadata:s:t:0 mimetype="image/jpeg" \
-attach "small_cover.jpg" -metadata:s:t:1 mimetype="image/jpeg" \
-attach "cover_land.jpg" -metadata:s:t:2 mimetype="image/jpeg" \
-attach "small_cover_land.jpg" -metadata:s:t:3 mimetype="image/jpeg" \
-r 24000/1001 -c:s ass -c:a copy \
-c:v libx265 \
out.mkv
Thank you for your help.
-attach expects an external file URL and does not work with streams sent from a filtergraph output.

How to use FFmpeg to record multiple screens on MacOS?

I wanted to record multiple screens simultaneously on MacOS and store them in a video file.Same as the screenshot below.
I found a command to do this, but need to know the size of each screen.
ffmpeg \
-f avfoundation -pix_fmt uyvy422 -i 1 \
-f avfoundation -pix_fmt uyvy422 -i 2 \
-pix_fmt yuv420p -r 30 -preset ultrafast -b:v 5000k -t 15 \
-filter_complex \
"nullsrc=size=3286x1080 [background]; \
[0:v] setpts=PTS-STARTPTS [left]; \
[1:v] setpts=PTS-STARTPTS [right]; \
[background][left] overlay=shortest=1 [background+left]; \
[background+left][right] overlay=shortest=1:x=1366 [left+right]" \
-map [left+right] out.mp4 -y
Is there a way to record a screen without knowing the size of each screen?
You can do it using the new xstack filter.
Use
ffmpeg \
-f avfoundation -pix_fmt uyvy422 -i 1 \
-f avfoundation -pix_fmt uyvy422 -i 2 \
-filter_complex \
[0:v] setpts=PTS-STARTPTS [left]; \
[1:v] setpts=PTS-STARTPTS [right]; \
[left][right] xstack=inputs=2:layout=0_0|w0_0 [left+right]" \
-map [left+right] -pix_fmt yuv420p -r 30 -preset ultrafast -b:v 5000k -t 15 \ out.mp4 -y
Get the latest dated build from https://ffmpeg.zeranoe.com/builds/macos64/static/

Resources