(FFmpeg) How to Blend Two Videos Together?

Blending has an interesting effect when two inputs are used. The blend filter has the potential to create outstanding artistic results, so let’s try it out. 

Tip: In order to blend two files, they must contain the same resolution.


blending two videos

In this example, using the difference filter applied to both video inputs gives an interesting inverted look as seen above: 

$ ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "blend=difference" output.mp4 

The available blending modes are listed below:

addition
grainmerge
and
average
burn
darken
difference
grainextract
divide
dodge
freeze
exclusion
extremity
glow
hardlight
hardmix
heat
lighten
linearlight
multiply
multiply128
negation
normal
or
overlay
phoenix
pinlight
reflect
screen
softlight
subtract
vividlight
xor


blending with a color

A lot of these filters work better when color is applied instead of another video. For example, blending a solid color video (red.mp4) with a lighten blending, as seen above:

  $ ffmpeg -i input1.mp4 -i red.mp4 -filter_complex "blend=lighten" output.mp4  

Using colors or gradients and multiple blends, custom Instagram-like filters can easily be created. 

Love FFmpeg? Grab a copy of FFmpeg For Beginners on Kindle or Paperback to learn over 120 ways to master FFmpeg!

buy now on amazon

Related Posts