[FFmpeg-user] Using multiple overlays

Cecil Westerhof Cecil at decebal.nl
Wed Jun 29 19:44:15 EEST 2022


Cecil Westerhof via ffmpeg-user <ffmpeg-user at ffmpeg.org> writes:

> To overlay a picture on a video I use at the moment:
>     ffmpeg -y                                           \
>            -ss 21:50 -to 24:30 -i input.MTS             \
>            -i Photos/Shrinked/input1.jpg                \
>            -i Photos/Shrinked/input2.jpg                \
>            -filter_complex "
>                [0:v][1:v] overlay=10:10:enable='between(t,  5,  85)',
>                           colorkey=0xFFFFFF\:0.01[ckout];[0:v][ckout]overlay[out]
>             "                                           \
>             -map '[out]' -map 0:a                       \
>             -pix_fmt yuv420p -vcodec libx264 -crf 26    \
>             -preset veryfast                            \
>             output.mp4
>
> This works great and input1.jpg is (transparently) overlaid on the
> video from 5 until 85.
> But I want to overlay input2.jpg from 85 until 155. But I cannot find
> how to do this. How can I overlay several photos (transparently) on
> the video at different time intervals?

Found it:
    ffmpeg -y                                           \
           -ss 21:50 -to 24:30 -i 00007-00010.MTS       \
           -i Photos/Shrinked/8AEsmee__Blankestijn.jpg  \
           -i Photos/Shrinked/8AEsmée_van_der_Molen.jpg \
           -filter_complex "
             [0:v] [1:v] overlay=10:10:enable='between(t,  5,  85)',
                         colorkey=0xFFFFFF\:0.01[ckout1];[0:v][ckout1]overlay[out1];
             [out1][2:v] overlay=10:10:enable='between(t, 85, 157)',
                         colorkey=0xFFFFFF\:0.01[ckout2];[0:v][ckout2]overlay[out2]
            "                                           \
            -map '[out2]' -map 0:a                      \
            -pix_fmt yuv420p -vcodec libx264 -crf 26    \
            -preset veryfast                            \
            twee.mkv

Maybe I do not understand what is happening.
The fps is significantly lower as with the previous one. (Less as
half.)
But there is at the most one overlay active. So why does it become so
much slower?


I also want to display text with the picture, but I think I found
something for that.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list