Search code examples
animationvideoffmpegvideo-processing

FFmpeg: How to use multiple images for each video slide and animate / zoom in / zoom out / fade only one image of each?


I've created the video from the images using FFmpeg command. And the video slides count was the same images count ( 6 images, 6 slides )
So, I need to do something different. I have 6 images and I need to have 2 slides. 3 image on each slide. For example, each slide can be something like following

enter image description here

Besides that, I wanted to know is there any way to animate ( zoom in / zoom out / fade ) only first image ( BG image ) ?


Solution

  • Use zoompan, overlay, and concat filters:

    ffmpeg -t 5 -loop 1 -i bg0.jpg -t 5 -loop 1 -i img0a.png -t 5 -loop 1 -i img0b.jpg -t 5 -loop 1 -i bg1.jpg -t 5 -loop 1 -i img1a.png  -t 5 -loop 1 -i img1b.jpg -filter_complex "[0]zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'[bg];[bg][1]overlay[bg2];[bg2][2]overlay=W-w[v1];[3]zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'[bg];[bg][4]overlay[bg2];[bg2][5]overlay=W-w[v2];[v1][v2]concat=n=2:v=1:a=0,format=yuv420p[v]" -map "[v]" output.mp4