Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFMPEG loop video overlay

Tags:

ffmpeg

I have two videos, one of which is overlaid onto the other.The one that is overlaid is only a few seconds long, and I want it to keep looping whilst the main video plays. Ive tried everything I can think of , but nothing seems to work in ffmpeg

 ffmpeg -i mainVideo.MTS -vf " movie=overlaid.wmv  [overlay];[in][overlay] overlay=1000:500 [out]" output.mp4

overlays one on top of the other , but with no looping. Changing movie=overlaid.wmv to movie=overlaid.wmv:loop=0

gives me an error message

[movie @ 01B19FC0] Key 'loop' not found. [movie @ 01B19F40] Error parsing options string: 'loop=0' Error initializing filter 'movie' with args 'overlaid.wmv:loop=0' Error opening filters!

According to the ffmpeg docs, loop is a valid option for movie. Ive tried 0, 1, 10 as the loop value but the result is always the same (an error)

like image 269
x1886x Avatar asked Sep 12 '12 00:09

x1886x


1 Answers

From ffmpeg docs:

Loop over the input stream. Currently it works only for image streams...

Repeatedly loop output for formats that support looping such as animated GIF...

I would recommend that you concatenate the video that you want to loop multiple times and then overlay that video, you can use the -t option to control the duration of your loop

like image 148
MauricioJuanes Avatar answered Sep 24 '22 07:09

MauricioJuanes