Re: [FFmpeg-user] toggle between two streams
On Fri, Sep 3, 2021 at 8:54 PM Michael Koch wrote: > Am 03.09.2021 um 20:01 schrieb Reino Wijnsma: > > On 2021-09-03T16:25:50+0200, Michael Koch > wrote: > >> 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... > > 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 > > Thank you, this command line is working fine. But it's difficult to > understand. A simple task (toggle between two streams) should have a > simple solution. > Nope, it should not. > > Michael > > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] toggle between two streams
Am 03.09.2021 um 20:01 schrieb Reino Wijnsma: On 2021-09-03T16:25:50+0200, Michael Koch wrote: 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... 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 Thank you, this command line is working fine. But it's difficult to understand. A simple task (toggle between two streams) should have a simple solution. Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] toggle between two streams
On 2021-09-03T16:25:50+0200, Michael Koch wrote: > 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... 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 > ffmpeg -f lavfi -i color=yellow -vf > drawtext='text="1":fontcolor=red:fontsize=100:x=140:y=80' -frames 1 -y 1.png No need to quote the "text"-parameter, but quoting the entire filter-chain instead I would consider good practice. ffmpeg -f lavfi -i color=yellow -vf "drawtext=text='1':fontcolor=red:fontsize=100:x=140:y=80" -frames 1 -y 1.png -- Reino ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] toggle between two streams
Michael Koch (12021-09-03): > 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... You need to put the proper amount of backslashes to protect the commas. I will grant you it is not intuitive and very annoying, but it always can be made to work. -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] toggle between two streams
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 ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] toggle between two streams
On Fri, Sep 3, 2021 at 3:19 PM Michael Koch wrote: > Am 03.09.2021 um 15:09 schrieb Paul B Mahol: > > On Fri, Sep 3, 2021 at 3:07 PM Michael Koch > > > wrote: > > > >> Am 03.09.2021 um 14:21 schrieb Michael Koch: > >>> I have two video streams and want to toggle between them in 1 second > >>> intervals. I did try this command: > >>> > >>> ffmpeg -i in1.mp4 -i in2.mp4 -lavfi streamselect=map='mod(t,2)' -t 30 > >>> out.mp4 > >>> > >>> This doesn't work because streamselect doesn't accept expressions. > >>> Who has an idea for a workaround? > >> Found a workaround myself: > >> > >> blend=all_expr='if(lt(mod(T,2),1),A,B)' > >> > >> > > Slow, doesnt it supports commands? > > In this case I didn't want to use commands because I wanted it to toggle > for a very long (or infinite) time. It would be nice if streamselect > accepts expressions. > sendcmd supports expressions. > > Michael > > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] toggle between two streams
Am 03.09.2021 um 15:09 schrieb Paul B Mahol: On Fri, Sep 3, 2021 at 3:07 PM Michael Koch wrote: Am 03.09.2021 um 14:21 schrieb Michael Koch: I have two video streams and want to toggle between them in 1 second intervals. I did try this command: ffmpeg -i in1.mp4 -i in2.mp4 -lavfi streamselect=map='mod(t,2)' -t 30 out.mp4 This doesn't work because streamselect doesn't accept expressions. Who has an idea for a workaround? Found a workaround myself: blend=all_expr='if(lt(mod(T,2),1),A,B)' Slow, doesnt it supports commands? In this case I didn't want to use commands because I wanted it to toggle for a very long (or infinite) time. It would be nice if streamselect accepts expressions. Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] toggle between two streams
On Fri, Sep 3, 2021 at 3:07 PM Michael Koch wrote: > Am 03.09.2021 um 14:21 schrieb Michael Koch: > > I have two video streams and want to toggle between them in 1 second > > intervals. I did try this command: > > > > ffmpeg -i in1.mp4 -i in2.mp4 -lavfi streamselect=map='mod(t,2)' -t 30 > > out.mp4 > > > > This doesn't work because streamselect doesn't accept expressions. > > Who has an idea for a workaround? > > Found a workaround myself: > > blend=all_expr='if(lt(mod(T,2),1),A,B)' > > Slow, doesnt it supports commands? > Michael > > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] toggle between two streams
Am 03.09.2021 um 14:21 schrieb Michael Koch: I have two video streams and want to toggle between them in 1 second intervals. I did try this command: ffmpeg -i in1.mp4 -i in2.mp4 -lavfi streamselect=map='mod(t,2)' -t 30 out.mp4 This doesn't work because streamselect doesn't accept expressions. Who has an idea for a workaround? Found a workaround myself: blend=all_expr='if(lt(mod(T,2),1),A,B)' Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] toggle between two streams
I have two video streams and want to toggle between them in 1 second intervals. I did try this command: ffmpeg -i in1.mp4 -i in2.mp4 -lavfi streamselect=map='mod(t,2)' -t 30 out.mp4 This doesn't work because streamselect doesn't accept expressions. Who has an idea for a workaround? Thanks, Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".