[FFmpeg-user] toggle between two streams
Michael Koch
astroelectronic at t-online.de
Fri Sep 3 17:25:50 EEST 2021
Am 03.09.2021 um 15:30 schrieb Paul B Mahol:
>
> sendcmd supports expressions.
yes, but it's complicated and doesn't always work.
rem make two images for testing
ffmpeg -f lavfi -i color=yellow -vf
drawtext='text="1":fontcolor=red:fontsize=100:x=140:y=80' -frames 1 -y 1.png
ffmpeg -f lavfi -i color=yellow -vf
drawtext='text="2":fontcolor=red:fontsize=100:x=140:y=80' -frames 1 -y 2.png
ffmpeg -loop 1 -i 1.png -loop 1 -i 2.png -lavfi
sendcmd=f=cmd.txt,streamselect=map=0 -t 10 -y out.mp4
The file cmd.txt contains this line:
0 [expr] streamselect map 'gte(mod(T,2),1)';
The above example does work. But if I write all in the FFmpeg command
line, then it doesn't work:
ffmpeg -loop 1 -i 1.png -loop 1 -i 2.png -lavfi sendcmd=c="0 [expr]
streamselect map 'gte(mod(T,2),1)'",streamselect=map=0 -t 10 -y out.mp4
Unable to parse graph description...
Michael
More information about the ffmpeg-user
mailing list