FFmpeg filter Overview
The filter function in FFmpeg is implemented through the libavfilter library.
In libavfilter, a filter can have multiple inputs or outputs. To illustrate possible scenarios, let's take a look at the following.
, Input streams are circulated through split and copied to two streams ([main], [TMP]). Then, one of them is filtered by crop and vflip, and superimposed with another stream before merging. You can use the following command to achieve this goal:
ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
After this command is executed, the video image becomes the image of the upper half. For example:
Filters of the same linear chain are separated by commas, while unused linear chains are separated by semicolons.
In the preceding example, crop and vflip are in the same linear chain, while split and overlay are separated from each other.
Labels are used at the intersection of linear chains and are identified by square brackets.
In the preceding example, the split filter generates two outputs, which are identified by the [main] tag and [TMP] tag. The stream named [TMP] is first processed by crop, cut down half of the image, and then flip the image through vflip. Overlay overlays the stream labeled as [flip] (processed by crop and vflip) into the lower half of the unprocessed stream [main.
Some filters enter a parameter list: they specify the name of the filter and an equal sign, which are separated by colons.
There is a so-called source filter, there is no audio/video input, and the sink filter has no audio/video output.
FFmpeg filter Overview