Commit 215ca864 authored by Stefano Sabatini's avatar Stefano Sabatini

doc/filters: review introductory example and explanation

In particular, fix wrong vertical mirroring command, and clarify
and extend explanation.

Based on a patch by littlebat <dashing.meng@gmail.com>.

Should fix trac ticket #2413.
parent e62fca11
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
Filtering in FFmpeg is enabled through the libavfilter library. Filtering in FFmpeg is enabled through the libavfilter library.
In libavfilter, it is possible for filters to have multiple inputs and In libavfilter, a filter can have multiple inputs and multiple
multiple outputs. outputs.
To illustrate the sorts of things that are possible, we can To illustrate the sorts of things that are possible, we consider the
use a complex filtergraph. For example, the following one: following filtergraph.
@example @example
input --> split ---------------------> overlay --> output input --> split ---------------------> overlay --> output
...@@ -15,25 +15,32 @@ input --> split ---------------------> overlay --> output ...@@ -15,25 +15,32 @@ input --> split ---------------------> overlay --> output
+-----> crop --> vflip -------+ +-----> crop --> vflip -------+
@end example @end example
splits the stream in two streams, sends one stream through the crop filter This filtergraph splits the input stream in two streams, sends one
and the vflip filter before merging it back with the other stream by stream through the crop filter and the vflip filter before merging it
overlaying it on top. You can use the following command to achieve this: back with the other stream by overlaying it on top. You can use the
following command to achieve this:
@example @example
ffmpeg -i input -vf "[in] split [T1], [T2] overlay=0:H/2 [out]; [T1] crop=iw:ih/2:0:ih/2, vflip [T2]" output ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
@end example @end example
The result will be that in output the top half of the video is mirrored The result will be that in output the top half of the video is mirrored
onto the bottom half. onto the bottom half.
Filters are loaded using the @var{-vf} or @var{-af} option passed to Filters in the same linear chain are separated by commas, and distinct
@command{ffmpeg} or to @command{ffplay}. Filters in the same linear linear chains of filters are separated by semicolons. In our example,
chain are separated by commas. In our example, @var{split, @var{crop,vflip} are in one linear chain, @var{split} and
overlay} are in one linear chain, and @var{crop, vflip} are in @var{overlay} are separately in another. The points where the linear
another. The points where the linear chains join are labeled by names chains join are labelled by names enclosed in square brackets. In the
enclosed in square brackets. In our example, that is @var{[T1]} and example, the split filter generates two outputs that are associated to
@var{[T2]}. The special labels @var{[in]} and @var{[out]} are the points the labels @var{[main]} and @var{[tmp]}.
where video is input and output.
The stream sent to the second output of @var{split}, labelled as
@var{[tmp]}, is processed through the @var{crop} filter, which crops
away the lower half part of the video, and then vertically flipped. The
@var{overlay} filter takes in input the first unchanged output of the
split filter (which was labelled as @var{[main]}), and overlay on its
lower half the output generated by the @var{crop,vflip} filterchain.
Some filters take in input a list of parameters: they are specified Some filters take in input a list of parameters: they are specified
after the filter name and an equal sign, and are separated from each other after the filter name and an equal sign, and are separated from each other
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment