1

I'm trying to superimpose a transparent video on another video. If the original video has a longer duration than the transparent video, then the transparent video should be looped until the end of the original video. I wrote the following operation, but the transparent video does not repeat. How can I change this ffmpeg command to make the overlay video loop?

-i preresult.mp4 -c:v libvpx-vp9 -i Overlay.webm -filter_complex ""[1]loop=0,setpts=N/FRAME_RATE/TB[bg];[0][bg]overlay=shortest=1:x=(W-w)/2:y=(H-h)/2"" -preset ultrafast output.mp4
0

If you're using a recent git build, use stream_loop and drop the loop filter:

-stream_loop -1 -c:v libvpx-vp9 -i Overlay.webm -filter_complex "[0][1]overlay=...

For older builds, you'll have to supply the loop filter with full details,

[1]loop=-1:C:0,setpts=N/FRAME_RATE/TB[bg]

where C is a value greater than the frame count of the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.