This is the first day of my participation in Gwen Challenge


This paper describes describes the usage of filters, sources and sinks in FFMPEG filter and FFMPEG filter

What is the ffmpeg

Ffmpeg is an audio and video streaming media processing library, can be used to support many kinds of devices, protocols and audio and video files pull stream, unpack, decode, encode, encapsulate, push stream and audio effects, video effects and other operations.

What is ffMPEG filter

Filter is the ffMPEG library used to give audio and video special effects, make video and audio present more special effects.

What can FFMPEG’s filter do

What kind of video effects and audio effects can be made? To understand this, we have to start from the implementation principle of filter

Filter processing flow

Generally, the filter process consists of one or more inputs. After the filter is processed, one or more output items can also be output. We can also use this feature to create very sophisticated filters for complex video and audio effects.

input --> split ---------------------> overlay --> output
            |                             ^
            |[tmp]                  [flip]|
            +-----> crop --> vflip -------+

Copy the code

For example

ffmpeg -i INPUT -vf “split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2” OUTPUT

The filter view splits the input stream into two streams, then adds both streams together through the cropping filter and vertical flip filter, and finally merges them into one stream for output. We don’t need to know how these two filters are used yet, as the blogger will update them in future posts

Filter Usage Description

From the above example, we have seen that you can use many filters in series to create complex video effects.

How do you combine these filters?

Filters in the same Filter chain are separated by commas, and filters in different Filter chains are separated by semicolons.

In the example above, crop, vflip are in one Filter chain, split and overlay are in another Filter chain. The points connected by the Filter chain are marked with names enclosed in square brackets. In the example above, the split filter produces two outputs associated with the labels [main] and [TMP]. The stream sent to the second output of split, labeled [TMP], is processed through a cropping filter, cropping out the bottom half of the video, and then flipped vertically. The input is in the overlay Filter, the first output of the split Filter remains unchanged (it is labeled [main]), and the vflip Filter chain of output generated through the bottom half of the overlay.

Some filter input parameter lists: they are specified after the filter name and equals sign, separated by colons.

Filter allows the existence of source filters with no audio/video input and receive filters with no audio/video output.

There are many specific filters of FFMPEG, which need to be separated and described separately.

If you think the blogger wrote good, welcome to “like, collect, pay attention to” a wave!!