Reputation: 377
I have 2 videos. I overlay one video over another with this code:
-stream_loop {LoopCount} -i 1.mp4 -c copy -y 2.mp4 -i 2.mp4 -i preresult.mp4 -filter_complex "[0:v][1:v]overlay=shortest=1[out]" -map "[out]" -y result.mp4
{LoopCount} - this is a variable that stores the value of how many times the overlay video is longer than the original video.
Please tell me how to combine these two commands in filter_complex so that ffmpeg can loop the overlay video as many times so that it matches the duration of the preresult.mp4?
Thank you all!
Upvotes: 0
Views: 623
Reputation: 92928
-stream_loop -1 -i 1.mp4 -i preresult.mp4 -filter_complex "[0:v][1:v]overlay=shortest=1[out]" -map "[out]" -y result.mp4
-1
sets stream_loop to loop indefinitely, making preresult the shorter video in overlay filter.
Upvotes: 1