FFMPEG Command to Overlay Two Videos Using Blend Filter Full Tutorial For Beginners


Well, I think I got it in the next command:


I’m going to explain in order to share what I’ve found:

  • Declaring the inputs:

ffmpeg -ss 00:00:18.300 -i music.mp3 -loop 1 -i bg.mp4 -i ac%d.png -i dust.mp4

  • Adding the filter complex. First part: [1,0] is the second element of the inputs (bg.mp4) and scaling to get the max values, and then cropping with the size I need, the result of this opperation, is in the [a] element.

[1:0]scale=1600:ih*1600/iw, crop=1600:900, setsar=1[a];

  • Second Part: Put the PNGs sequence over the resized video (bg.mp4, now [a]) and saving the resunt in the [b] element.

[a][2:0] overlay=0:0[b];

  • Scaling and cropping the fourth input (overlay.mp4) and saving in the [c] element.

[3:0]scale=1600:ih*1600/iw, crop=1600:900,setsar=1[c];

  • Mixing the first result with the overlay video with an “overlay” blending mode, and with an opacity of 0.1 because the video has gray tones and makes the result so dark.

[b][c] blend=all_mode=’overlay’:all_opacity=0.1

Leave a Reply