ffmpeg difference when using -lavfi or -filter_complex

10.2k views Asked by At

I've started to use ffmpeg recently. I have been using only the -filter_complex flag to apply filters. I stumbled upon this SO question:

FFmpeg: How to convert horizontal video 16:9 to vertical video 9:16, with blurred background on top and bottom sides

A ffmpeg maintainer answers it using the -lavfi flag:

ffmpeg -i input.mp4 -lavfi "[0:v]scale=iw:2*trunc(iw*16/18),boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,setsar=1" output.mp4

I tried to change -lavfi flag to -filter_complex:

ffmpeg -i input.mp4 -filter_complex "[0:v]scale=iw:2*trunc(iw*16/18),boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,setsar=1" output.mp4

The result is the same and didn't notice a perf change.

Is there a difference when using either flags?

1

There are 1 answers

0
Yaroslav Pogrebnyak On BEST ANSWER

From the FFmpeg documentation:

-lavfi filtergraph (global) Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or outputs. Equivalent to -filter_complex.