[FFmpeg-devel] [PATCH] documentation: Fix several documentation bugs in trac ticket #2413

Stefano Sabatini stefasab at gmail.com
Sat Apr 6 01:59:19 CEST 2013


On date Friday 2013-04-05 21:58:09 +0800, littlebat encoded:
> On Fri, 5 Apr 2013 12:40:40 +0200
> Stefano Sabatini <stefasab at gmail.com> wrote:
[...] 
> /opt/ffmpeggit/bin/ffmpeg -i in.avi -vf \
>   "movie=logo.png [logo]; [out] [logo] overlay [in_0]" out.avi
> 
> It seems the input video stream linked [out] automatically, and the
> command line works well! I suppose these two special links "[in]" and
> "[out]" have been dropped in the current ffmpeg, or they don't
> function properly if they are still designed as special labels. 

Interesting:
ffmpeg -i INPUT -vf  "movie=ffmpeg-logo.png [logo]; [foo][logo] overlay [bar]" -y OUTPUT

Looks like if there is an unconnected filter input it is connected to
the default filter output, and the unconnected filter output is
connected to the default filter input. This was the result of some
relatively recent work on -filter_complex, but seems more like an
(undocumented) glitch rather than a feature.

The equivalent command fails with ffplay:
ffplay INPUT -vf  "movie=ffmpeg-logo.png [logo]; [foo][logo] overlay [bar]"
[...]
Output pad "default" with type video of the filter instance "ffplay_buffer" of buffer not connected to any destination

> 
> > > 
> > > > >  
> > > > >  See the @ref{filter_complex_option,,-filter_complex option} if
> > > > > you want to create filtergraphs with multiple inputs and/or
> > > > > outputs. diff -Nur a/doc/ffplay.texi b/doc/ffplay.texi
> > > > > --- a/doc/ffplay.texi	2013-04-04 17:35:24.000000000 +0800
> > > > > +++ b/doc/ffplay.texi	2013-04-04 22:23:52.000000000 +0800
> > > > > @@ -79,10 +79,8 @@
> > > > >  
> > > > >  @var{filtergraph} is a description of the filtergraph to apply
> > > > > to the stream, and must have a single video input and a single
> > > > > video -output. In the filtergraph, the input is associated to
> > > > > the label - at code{in}, and the output to the label @code{out}.
> > > > > See the -ffmpeg-filters manual for more information about the
> > > > > filtergraph -syntax.
> > > > > +output. See the ffmpeg-filters manual for more information
> > > > > about the +filtergraph syntax.
> > > > 
> > > > Ditto.
> > > 
> > > Ditto.
> > > 
> > > >   
> > > > >  @item -af @var{filtergraph}
> > > > >  @var{filtergraph} is a description of the filtergraph to apply
> > > > > to diff -Nur a/doc/filters.texi b/doc/filters.texi
> > > > > --- a/doc/filters.texi	2013-04-04 17:35:24.000000000
> > > > > +0800 +++ b/doc/filters.texi	2013-04-04
> > > > > 22:23:52.000000000 +0800 @@ -3,10 +3,7 @@
> > > > >  
> > > > >  Filtering in FFmpeg is enabled through the libavfilter library.
> > > > >  
> > > > 
> > > > > -In libavfilter, it is possible for filters to have multiple
> > > > > inputs and -multiple outputs.
> > > > 
> > > > Why did you remove this sentence?
> > > > 
> > 
> > > > > -To illustrate the sorts of things that are possible, we can
> > > > > -use a complex filtergraph. For example, the following one:
> > > 
> > > The example here is talking about a simple filter and not a complex
> > > filter, "-vf" option process only one video stream in and out. The
> > > words above misguide me this example is a complex filter example.
> > > of course, we can still use option "-filter_complex" here to
> > > achieve the same needs as below, but, we have used "-vf" option
> > > here.
> > > 
> > > ffmpeg -i input -filter_complex \
> > >   "[0:v] split [split_out_0] [split_out_1]; \
> > >    [split_out_1] crop=iw:ih/2:0:0, vflip [vflip_out_0]; \
> > >    [split_out_0] [vflip_out_0] overlay=0:H/2 [out_v_0]" \
> > >    -map [out_v_0] -map 0:a output
> > > 
> > > > > +To illustrate the usage, we can use a filtergraph. For example,
> > > > > the following one: 
> > > > >  @example
> > > > >  input --> split ---------------------> overlay --> output
> > > > > @@ -20,7 +17,10 @@
> > > > >  overlaying it on top. You can use the following command to
> > > > > achieve this: 
> > > > >  @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
> > > > 
> > > > According to current doc, we have that the first unlabelled
> > > > output of split is connected to the first unlabelled output of
> > > > overlay, thus the main uncropped video is sent to the overlay
> > > > second input, and moved to lower part of the screen, while the
> > > > first half contains the lower part vflipped.
> > > > 
> > > > So we have:
> > > > +--------------+
> > > > |lower vflipped|
> > > > |higher        |
> > > > +--------------+
> > > > 
> > > > > +ffmpeg -i input -vf \
> > > > > +  "[in_0] split [split_out_0] [split_out_1];
> > > > > +   [split_out_1] crop=iw:ih/2:0:0, vflip [vflip_out_0];
> > > > > +   [split_out_0] [vflip_out_0] overlay=0:H/2 [out_0]" output
> > > > >  @end example
> > > > 
> > > > You may replace [in_0] to [in] since there is no ambiguity,
> > > > [vflip_out_0] -> [vflip_out], [out_0] -> [out].
> > > 
> > > Replace [in] to [in_0] and [out] to [out_0], it's my intent.
> > > "[in_0]" will break the misguiding me that special magic "[in]" and
> > > "[out]" label is still necessary in the recent ffmpeg. 
> > > 
> > > > 
> > > > I suggest to specify a shortest syntax for the same command:
> > > > 
> > > > ffmpeg -i input -vf "split[T1], crop=iw:ih/2:0:0, vflip, [T1]
> > > > overlay=0:H/2"
> > > > 
> > > > or even:
> > > > 
> > > > which makes minimal use of intermediate labels and is a oneliner,
> > > > so the user can easily do copy&paste on the commandline.
> > > 
> > > Yes, your command line is more tidy. But, I think the purpose of
> > > documentation is help the beginner understand the command line more
> > > easier. Seperate filters into three groups(filterchain) according to
> > > their function and label every entry and exit of filterchain is
> > > helpful for me to understand the command line. In you command line,
> > > you used the unlabelled link, this will increase the difficulty for
> > > me to understand it.
> > 
> > What about this:
> > -----8<-----------------8<--------------------------------------
> > To illustrate the sorts of things that are possible, we use
> > the following filtergraph.
> > 
> > @example
> > input --> split ---------------------> overlay --> output
> >             |                             ^
> >             |                             |
> >             +-----> crop --> vflip -------+
> > @end example
> > 
> > splits the stream in two streams, sends one stream through the crop
> > filter and the vflip filter before merging it back with the other
> > stream by overlaying it on top. You can use the following command to
> > achieve this:
> > 
> > @example
> > 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
> > 
> > The result will be that in output the top half of the video is
> > mirrored onto the bottom half.
> > 
> > Filters in the same linear chain are separated by commas, and distinct
> > linear chains are separated by semicolons. In our example, @var{crop,
> > vflip} are in one linear chain, and @var{split} and @var{overlay} are
> > in another.
> 
> Append "separately" after "and @var{split} and @var{overlay} are in
> another" maybe more accurate?
> 
> > 
> > The points where the linear chains join are labeled by names enclosed
> > in square brackets.
> > 
> > In our example, the split filter generates two outputs that are
> > associated to the lables @var{[main]} and @var{tmp}.
> 
> Typo, "lables" should be "labels"
> 
> > The stream sent to the second output of split, labelled as @var{[tm]},
> > is processed through the crop filter, which crops away the lower half
> > part of the video, and vertically flipped.
> > 
> > The 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.
[...]

Updated, now as a proper patch.
-- 
FFmpeg = Freak & Foolish Marvellous Patchable Elitist Goblin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-doc-filters-review-introductory-example-and-explanat.patch
Type: text/x-diff
Size: 3146 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130406/f8c5df93/attachment.bin>


More information about the ffmpeg-devel mailing list