A filter with no input pads is called a "source", a filter with no
output pads is called a "sink".
+@anchor{Filtergraph syntax}
@section Filtergraph syntax
-A filtergraph can be represented using a textual representation, which
-is recognized by the @code{-vf} option of the ff*
-tools, and by the @code{avfilter_graph_parse()} function defined in
+A filtergraph can be represented using a textual representation, which is
+recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
+options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the
+@code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} function defined in
@file{libavfilter/avfiltergraph.h}.
A filterchain consists of a sequence of connected filters, each one
pads must be connected. A filtergraph is considered valid if all the
filter input and output pads of all the filterchains are connected.
+Libavfilter will automatically insert scale filters where format
+conversion is required. It is possible to specify swscale flags
+for those automatically inserted scalers by prepending
+@code{sws_flags=@var{flags};}
+to the filtergraph description.
+
Follows a BNF description for the filtergraph syntax:
@example
@var{NAME} ::= sequence of alphanumeric characters and '_'
@var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
@var{FILTER} ::= [@var{LINKNAMES}] @var{NAME} ["=" @var{ARGUMENTS}] [@var{LINKNAMES}]
@var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
-@var{FILTERGRAPH} ::= @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
+@var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
@end example
@c man end FILTERGRAPH DESCRIPTION
A description of the accepted options follows.
@table @option
-@item dar
-Specifies the display aspect ratio adopted for rendering the
-subtitles. Default value is "1.0".
+@item original_size
+Specifies the size of the original video, the video for which the ASS file
+was composed. Due to a misdesign in ASS aspect ratio arithmetic, this is
+necessary to correctly scale the fonts if the aspect ratio has been changed.
@end table
For example, to render the file @file{sub.ass} on top of the input
@end itemize
+@section colormatrix
+
+The colormatrix filter allows conversion between any of the following color
+space: BT.709 (@var{bt709}), BT.601 (@var{bt601}), SMPTE-240M (@var{smpte240m})
+and FCC (@var{fcc}).
+
+The syntax of the parameters is @var{source}:@var{destination}:
+
+@example
+colormatrix=bt601:smpte240m
+@end example
+
@section copy
Copy the input source unchanged to the output. Mainly useful for
frame rate (timecode only)
@end table
+If libavfilter was built with @code{--enable-fontconfig}, then
+@option{fontfile} can be a fontconfig pattern or omitted.
+
Some examples follow.
@itemize
drawtext=fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent
@end example
+@item
+Use fontconfig to set the font. Note that the colons need to be escaped.
+@example
+drawtext='fontfile=Linux Libertine O-40\\:style=Semibold:text=FFmpeg'
+@end example
+
@end itemize
For more information about libfreetype, check:
@url{http://www.freetype.org/}.
+For more information about fontconfig, check:
+@url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
+
@section fade
Apply fade-in/out effect to input video.
@var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
@end table
+@section idet
+
+Interlaceing detect filter. This filter tries to detect if the input is
+interlaced or progressive. Top or bottom field first.
+
@section lut, lutrgb, lutyuv
Compute a look-up table for binding each pixel component input value
The list of the currently supported filters follows:
@table @var
-@item 2xsai
@item decimate
@item denoise3d
@item detc
@item ivtc
@item kerndeint
@item mcdeint
-@item mirror
@item noise
@item ow
@item palette
@item pullup
@item qp
@item rectangle
-@item remove-logo
@item rotate
@item sab
@item screenshot
Some examples follow:
@example
-# remove a logo by interpolating the surrounding pixels
-mp=delogo=200:200:80:20:1
-
# adjust gamma, brightness, contrast
mp=eq2=1.0:2:0.5
overlay=main_w-overlay_w-10:main_h-overlay_h-10
# insert a transparent PNG logo in the bottom left corner of the input
-movie=logo.png [logo];
-[in][logo] overlay=10:main_h-overlay_h-10 [out]
+ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
# insert 2 different transparent PNG logos (second logo on bottom
# right corner):
-movie=logo1.png [logo1];
-movie=logo2.png [logo2];
-[in][logo1] overlay=10:H-h-10 [in+logo1];
-[in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
+ffmpeg -i input -i logo1 -i logo2 -filter_complex
+'overlay=10:H-h-10,overlay=W-w-10:H-h-10' output
# add a transparent color layer on top of the main video,
# WxH specifies the size of the main input to the overlay filter
can be used to test the monowhite pixel format descriptor definition.
+@section removelogo
+
+Suppress a TV station logo, using an image file to determine which
+pixels comprise the logo. It works by filling in the pixels that
+comprise the logo with neighboring pixels.
+
+This filter requires one argument which specifies the filter bitmap
+file, which can be any image format supported by libavformat. The
+width and height of the image file must match those of the video
+stream being processed.
+
+Pixels in the provided bitmap image with a value of zero are not
+considered part of the logo, non-zero pixels are considered part of
+the logo. If you use white (255) for the logo and black (0) for the
+rest, you will be safe. For making the filter bitmap, it is
+recommended to take a screen capture of a black frame with the logo
+visible, and then using a threshold filter followed by the erode
+filter once or twice.
+
+If needed, little splotches can be fixed manually. Remember that if
+logo pixels are not covered, the filter quality will be much
+reduced. Marking too many pixels as part of the logo does not hurt as
+much, but it will increase the amount of blurring needed to cover over
+the image and will destroy more information than necessary, and extra
+pixels will slow things down on a large logo.
+
@section scale
Scale the input video to @var{width}:@var{height}[:@var{interl}=@{1|-1@}] and/or convert the image format.
are flagged as interlaced or not
@end table
+Unless @var{interl} is set to one of the above options, interlaced scaling will not be used.
+
Some examples follow:
@example
# scale the input video to a size of 200x100.
# the above is the same as
scale=2*in_w:2*in_h
+# scale the input to 2x with forced interlaced scaling
+scale=2*iw:2*ih:interl=1
+
# scale the input to half size
scale=iw/2:ih/2
The @code{setfield} filter marks the interlace type field for the
output frames. It does not change the input frame, but only sets the
corresponding property, which affects how the frame is treated by
-followig filters (e.g. @code{fieldorder} or @code{yadif}).
+following filters (e.g. @code{fieldorder} or @code{yadif}).
-It accepts a parameter representing an integer or a string, which can
-assume the following values:
+It accepts a string parameter, which can assume the following values:
@table @samp
-@item -1, auto
+@item auto
Keep the same field property.
-@item 0, bff
+@item bff
Mark the frame as bottom-field-first.
-@item 1, tff
+@item tff
Mark the frame as top-field-first.
+
+@item prog
+Mark the frame as progressive.
@end table
@section setpts
will create two separate outputs from the same input, one cropped and
one padded.
+@section super2xsai
+
+Scale the input by 2x and smooth using the Super2xSaI (Scale and
+Interpolate) pixel art scaling algorithm.
+
+Useful for enlarging pixel art images without reducing sharpness.
+
@section swapuv
Swap U & V plane.