9951 explained code solutions for 126 technologies

ffmpegHow to use filter_complex to apply filters to videos

When you have multiple inputs or you need to apply multiple filters, you can use filter_complex. This example resizes given image to 50x50 and places it (overlays) over given video:

ffmpeg -i in.mp4 -i in.png -filter_complex "[1]scale=50:50[in2];[0][in2]overlay" out.mp4ctrl + c
-i in.mp4

first input (can be referred as [0])

-i in.png

second input (can be referred as [1])


applies specified video/audio complex filter


applies scale filter to input [1] (in.png image) and name the result as [in2] (so it can be referred later)


applies overlay filter with inputs [0] (in.mp4) and [in2] (result of previous filtering)


resulting video file