ffmpeg fade in and out multiple images over video

Viewed 206

I have managed to overlay an image on a video using ffmpeg with fade in & out effect:

ffmpeg -i test.mp4 -loop 1 -t 30 -i image1.jpg -filter_complex "[1:v]format=rgba,fade=in:st=2:d=0.5:alpha=1,fade=out:st=4:d=0.5:alpha=1 [v1]; [0][v1] overlay" -codec:a copy out1.mp4

What I would like to do is add more images to be faded in and out later on in the video.

I have tried adding another image and filter but am not able to combine them as the overlay command can only take 2 inputs.

ffmpeg -i test.mp4 -loop 1 -t 30 -i image1.jpg -loop 1 -t 30 -i image2.jpg -filter_complex "[1:v]format=rgba,fade=in:st=2:d=0.5:alpha=1,fade=out:st=4:d=0.5:alpha=1 [v1];[2:v]format=rgba,fade=in:st=7:d=0.5:alpha=1,fade=out:st=10:d=0.5:alpha=1 [v2]; [0][v1][v2] overlay" -codec:a copy out1.mp4

Any help is appreciated.

Also if anyone knows how to make the loop command loop to the length of the video that would be great as well. I have hardcoded 30 seconds in my example.

0 Answers
Related