]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '62dcdb028cc84845fd263bb09304c4c6500bda7a'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 10 Apr 2013 13:27:40 +0000 (15:27 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 10 Apr 2013 13:37:21 +0000 (15:37 +0200)
* commit '62dcdb028cc84845fd263bb09304c4c6500bda7a':
  vf_blackframe: switch to an AVOptions-based system.
  vf_aspect: switch to an AVOptions-based system.

Conflicts:
doc/filters.texi
libavfilter/vf_aspect.c
libavfilter/vf_blackframe.c

In the aspect filter most changes are merged but not the final
switch to the libav API because that is too restrictive and has
difficulty handling the syntax.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
doc/filters.texi
libavfilter/avfilter.c
libavfilter/vf_aspect.c
libavfilter/vf_blackframe.c

index 4dba3d1d04ee08f71b9eee541f7d83ab2c2bd455,c878472c83e66eff86d32136e0148f806588df27..304a6511154e4227c8ba3b5e41920252be254b1e
@@@ -1721,4712 -793,928 +1721,4714 @@@ sine=frequency=220:beep_factor=4:durati
  
  @end itemize
  
 -@section drawbox
 +@c man end AUDIO SOURCES
  
 -Draw a colored box on the input image.
 +@chapter Audio Sinks
 +@c man begin AUDIO SINKS
  
 -It accepts the syntax:
 -@example
 -drawbox=@var{x}:@var{y}:@var{width}:@var{height}:@var{color}
 -@end example
 +Below is a description of the currently available audio sinks.
  
 -@table @option
 +@section abuffersink
  
 -@item x, y
 -Specify the top left corner coordinates of the box. Default to 0.
 +Buffer audio frames, and make them available to the end of filter chain.
  
 -@item width, height
 -Specify the width and height of the box, if 0 they are interpreted as
 -the input width and height. Default to 0.
 +This sink is mainly intended for programmatic use, in particular
 +through the interface defined in @file{libavfilter/buffersink.h}.
  
 -@item color
 -Specify the color of the box to write, it can be the name of a color
 -(case insensitive match) or a 0xRRGGBB[AA] sequence.
 -@end table
 +It requires a pointer to an AVABufferSinkContext structure, which
 +defines the incoming buffers' formats, to be passed as the opaque
 +parameter to @code{avfilter_init_filter} for initialization.
  
 -Follow some examples:
 -@example
 -# draw a black box around the edge of the input image
 -drawbox
 +@section anullsink
  
 -# draw a box with color red and an opacity of 50%
 -drawbox=10:20:200:60:red@@0.5"
 -@end example
 +Null audio sink, do absolutely nothing with the input audio. It is
 +mainly useful as a template and to be employed in analysis / debugging
 +tools.
  
 -@section drawtext
 +@section abuffersink
 +This sink is intended for programmatic use. Frames that arrive on this sink can
 +be retrieved by the calling program using the interface defined in
 +@file{libavfilter/buffersink.h}.
  
 -Draw text string or text from specified file on top of video using the
 -libfreetype library.
 +This filter accepts no parameters.
  
 -To enable compilation of this filter you need to configure Libav with
 -@code{--enable-libfreetype}.
 +@c man end AUDIO SINKS
  
 -The filter also recognizes strftime() sequences in the provided text
 -and expands them accordingly. Check the documentation of strftime().
 +@chapter Video Filters
 +@c man begin VIDEO FILTERS
  
 -The filter accepts parameters as a list of @var{key}=@var{value} pairs,
 -separated by ":".
 +When you configure your FFmpeg build, you can disable any of the
 +existing filters using @code{--disable-filters}.
 +The configure output will show the video filters included in your
 +build.
  
 -The description of the accepted parameters follows.
 +Below is a description of the currently available video filters.
  
 -@table @option
 +@section alphaextract
  
 -@item fontfile
 -The font file to be used for drawing text. Path must be included.
 -This parameter is mandatory.
 +Extract the alpha component from the input as a grayscale video. This
 +is especially useful with the @var{alphamerge} filter.
  
 -@item text
 -The text string to be drawn. The text must be a sequence of UTF-8
 -encoded characters.
 -This parameter is mandatory if no file is specified with the parameter
 -@var{textfile}.
 +@section alphamerge
  
 -@item textfile
 -A text file containing text to be drawn. The text must be a sequence
 -of UTF-8 encoded characters.
 +Add or replace the alpha component of the primary input with the
 +grayscale value of a second input. This is intended for use with
 +@var{alphaextract} to allow the transmission or storage of frame
 +sequences that have alpha in a format that doesn't support an alpha
 +channel.
  
 -This parameter is mandatory if no text string is specified with the
 -parameter @var{text}.
 +For example, to reconstruct full frames from a normal YUV-encoded video
 +and a separate video created with @var{alphaextract}, you might use:
 +@example
 +movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
 +@end example
  
 -If both text and textfile are specified, an error is thrown.
 +Since this filter is designed for reconstruction, it operates on frame
 +sequences without considering timestamps, and terminates when either
 +input reaches end of stream. This will cause problems if your encoding
 +pipeline drops frames. If you're trying to apply an image as an
 +overlay to a video stream, consider the @var{overlay} filter instead.
  
 -@item x, y
 -The offsets where text will be drawn within the video frame.
 -Relative to the top/left border of the output image.
 -They accept expressions similar to the @ref{overlay} filter:
 -@table @option
 +@section ass
  
 -@item x, y
 -the computed values for @var{x} and @var{y}. They are evaluated for
 -each new frame.
 +Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
 +and libavformat to work. On the other hand, it is limited to ASS (Advanced
 +Substation Alpha) subtitles files.
  
 -@item main_w, main_h
 -main input width and height
 +@section bbox
  
 -@item W, H
 -same as @var{main_w} and @var{main_h}
 +Compute the bounding box for the non-black pixels in the input frame
 +luminance plane.
  
 -@item text_w, text_h
 -rendered text width and height
 +This filter computes the bounding box containing all the pixels with a
 +luminance value greater than the minimum allowed value.
 +The parameters describing the bounding box are printed on the filter
 +log.
  
 -@item w, h
 -same as @var{text_w} and @var{text_h}
 +@section blackdetect
  
 -@item n
 -the number of frames processed, starting from 0
 +Detect video intervals that are (almost) completely black. Can be
 +useful to detect chapter transitions, commercials, or invalid
 +recordings. Output lines contains the time for the start, end and
 +duration of the detected black interval expressed in seconds.
  
 -@item t
 -timestamp expressed in seconds, NAN if the input timestamp is unknown
 +In order to display the output lines, you need to set the loglevel at
 +least to the AV_LOG_INFO value.
  
 -@end table
 +This filter accepts a list of options in the form of
 +@var{key}=@var{value} pairs separated by ":". A description of the
 +accepted options follows.
  
 -The default value of @var{x} and @var{y} is 0.
 +@table @option
 +@item black_min_duration, d
 +Set the minimum detected black duration expressed in seconds. It must
 +be a non-negative floating point number.
  
 -@item fontsize
 -The font size to be used for drawing text.
 -The default value of @var{fontsize} is 16.
 +Default value is 2.0.
  
 -@item fontcolor
 -The color to be used for drawing fonts.
 -Either a string (e.g. "red") or in 0xRRGGBB[AA] format
 -(e.g. "0xff000033"), possibly followed by an alpha specifier.
 -The default value of @var{fontcolor} is "black".
 +@item picture_black_ratio_th, pic_th
 +Set the threshold for considering a picture "black".
 +Express the minimum value for the ratio:
 +@example
 +@var{nb_black_pixels} / @var{nb_pixels}
 +@end example
  
 -@item boxcolor
 -The color to be used for drawing box around text.
 -Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
 -(e.g. "0xff00ff"), possibly followed by an alpha specifier.
 -The default value of @var{boxcolor} is "white".
 +for which a picture is considered black.
 +Default value is 0.98.
  
 -@item box
 -Used to draw a box around text using background color.
 -Value should be either 1 (enable) or 0 (disable).
 -The default value of @var{box} is 0.
 +@item pixel_black_th, pix_th
 +Set the threshold for considering a pixel "black".
  
 -@item shadowx, shadowy
 -The x and y offsets for the text shadow position with respect to the
 -position of the text. They can be either positive or negative
 -values. Default value for both is "0".
 +The threshold expresses the maximum pixel luminance value for which a
 +pixel is considered "black". The provided value is scaled according to
 +the following equation:
 +@example
 +@var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
 +@end example
  
 -@item shadowcolor
 -The color to be used for drawing a shadow behind the drawn text.  It
 -can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
 +@var{luminance_range_size} and @var{luminance_minimum_value} depend on
 +the input video format, the range is [0-255] for YUV full-range
 +formats and [16-235] for YUV non full-range formats.
 +
 +Default value is 0.10.
 +@end table
 +
 +The following example sets the maximum pixel threshold to the minimum
 +value, and detects only black intervals of 2 or more seconds:
 +@example
 +blackdetect=d=2:pix_th=0.00
 +@end example
 +
 +@section blackframe
 +
 +Detect frames that are (almost) completely black. Can be useful to
 +detect chapter transitions or commercials. Output lines consist of
 +the frame number of the detected frame, the percentage of blackness,
 +the position in the file if known or -1 and the timestamp in seconds.
 +
 +In order to display the output lines, you need to set the loglevel at
 +least to the AV_LOG_INFO value.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax
 +blackframe[=@var{amount}[:@var{threshold}]].
 +
- A description of the accepted options follows.
++The filter accepts the following options:
 +
 +@table @option
++
 +@item amount
- Set the percentage of pixels that have to be below the
- threshold to enable black detection. Default value is 98.
++The percentage of the pixels that have to be below the threshold, defaults to
++98.
 +
 +@item threshold
- Set the threshold below which a pixel value is considered
- black. Default value is 32.
++Threshold below which a pixel value is considered black, defaults to 32.
++
 +@end table
 +
 +@section blend
 +
 +Blend two video frames into each other.
 +
 +It takes two input streams and outputs one stream, the first input is the
 +"top" layer and second input is "bottom" layer.
 +Output terminates when shortest input terminates.
 +
 +This filter accepts a list of options in the form of @var{key}=@var{value}
 +pairs separated by ":". A description of the accepted options follows.
 +
 +@table @option
 +@item c0_mode
 +@item c1_mode
 +@item c2_mode
 +@item c3_mode
 +@item all_mode
 +Set blend mode for specific pixel component or all pixel components in case
 +of @var{all_mode}. Default value is @code{normal}.
 +
 +Available values for component modes are:
 +@table @samp
 +@item addition
 +@item and
 +@item average
 +@item burn
 +@item darken
 +@item difference
 +@item divide
 +@item dodge
 +@item exclusion
 +@item hardlight
 +@item lighten
 +@item multiply
 +@item negation
 +@item normal
 +@item or
 +@item overlay
 +@item phoenix
 +@item pinlight
 +@item reflect
 +@item screen
 +@item softlight
 +@item subtract
 +@item vividlight
 +@item xor
 +@end table
 +
 +@item c0_opacity
 +@item c1_opacity
 +@item c2_opacity
 +@item c3_opacity
 +@item all_opacity
 +Set blend opacity for specific pixel component or all pixel components in case
 +of @var{all_opacity}. Only used in combination with pixel component blend modes.
 +
 +@item c0_expr
 +@item c1_expr
 +@item c2_expr
 +@item c3_expr
 +@item all_expr
 +Set blend expression for specific pixel component or all pixel components in case
 +of @var{all_expr}. Note that related mode options will be ignored if those are set.
 +
 +The expressions can use the following variables:
 +
 +@table @option
 +@item N
 +The sequential number of the filtered frame, starting from @code{0}.
 +
 +@item X
 +@item Y
 +the coordinates of the current sample
 +
 +@item W
 +@item H
 +the width and height of currently filtered plane
 +
 +@item SW
 +@item SH
 +Width and height scale depending on the currently filtered plane. It is the
 +ratio between the corresponding luma plane number of pixels and the current
 +plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
 +@code{0.5,0.5} for chroma planes.
 +
 +@item T
 +Time of the current frame, expressed in seconds.
 +
 +@item TOP, A
 +Value of pixel component at current location for first video frame (top layer).
 +
 +@item BOTTOM, B
 +Value of pixel component at current location for second video frame (bottom layer).
 +@end table
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Apply transition from bottom layer to top layer in first 10 seconds:
 +@example
 +blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
 +@end example
 +
 +@item
 +Apply 1x1 checkerboard effect:
 +@example
 +blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
 +@end example
 +@end itemize
 +
 +@section boxblur
 +
 +Apply boxblur algorithm to the input video.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax
 +@option{luma_radius}:@option{luma_power}:@option{chroma_radius}:@option{chroma_power}:@option{alpha_radius}:@option{alpha_power}.
 +
 +A description of the accepted options follows.
 +
 +@table @option
 +@item luma_radius, lr
 +@item chroma_radius, cr
 +@item alpha_radius, ar
 +Set an expression for the box radius in pixels used for blurring the
 +corresponding input plane.
 +
 +The radius value must be a non-negative number, and must not be
 +greater than the value of the expression @code{min(w,h)/2} for the
 +luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
 +planes.
 +
 +Default value for @option{luma_radius} is "2". If not specified,
 +@option{chroma_radius} and @option{alpha_radius} default to the
 +corresponding value set for @option{luma_radius}.
 +
 +The expressions can contain the following constants:
 +@table @option
 +@item w, h
 +the input width and height in pixels
 +
 +@item cw, ch
 +the input chroma image width and height in pixels
 +
 +@item hsub, vsub
 +horizontal and vertical chroma subsample values. For example for the
 +pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
 +@end table
 +
 +@item luma_power, lp
 +@item chroma_power, cp
 +@item alpha_power, ap
 +Specify how many times the boxblur filter is applied to the
 +corresponding plane.
 +
 +Default value for @option{luma_power} is 2. If not specified,
 +@option{chroma_power} and @option{alpha_power} default to the
 +corresponding value set for @option{luma_power}.
 +
 +A value of 0 will disable the effect.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Apply a boxblur filter with luma, chroma, and alpha radius
 +set to 2:
 +@example
 +boxblur=2:1
 +@end example
 +
 +@item
 +Set luma radius to 2, alpha and chroma radius to 0:
 +@example
 +boxblur=2:1:cr=0:ar=0
 +@end example
 +
 +@item
 +Set luma and chroma radius to a fraction of the video dimension:
 +@example
 +boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
 +@end example
 +@end itemize
 +
 +@section colormatrix
 +
 +Convert color matrix.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax
 +@var{src}:@var{dst}.
 +
 +A description of the accepted options follows:
 +@table @option
 +@item src
 +@item dst
 +Specify the source and destination color matrix. Both values must be
 +specified.
 +
 +The accepted values are:
 +@table @samp
 +@item bt709
 +BT.709
 +
 +@item bt601
 +BT.601
 +
 +@item smpte240m
 +SMPTE-240M
 +
 +@item fcc
 +FCC
 +@end table
 +@end table
 +
 +For example to convert from BT.601 to SMPTE-240M, use the command:
 +@example
 +colormatrix=bt601:smpte240m
 +@end example
 +
 +@section copy
 +
 +Copy the input source unchanged to the output. Mainly useful for
 +testing purposes.
 +
 +@section crop
 +
 +Crop the input video.
 +
 +This filter accepts a list of @var{key}=@var{value} pairs as argument,
 +separated by ':'. If the key of the first options is omitted, the
 +arguments are interpreted according to the syntax
 +@var{out_w}:@var{out_h}:@var{x}:@var{y}:@var{keep_aspect}.
 +
 +A description of the accepted options follows:
 +@table @option
 +@item w, out_w
 +Set the crop area width. It defaults to @code{iw}.
 +This expression is evaluated only once during the filter
 +configuration.
 +
 +@item h, out_h
 +Set the crop area height. It defaults to @code{ih}.
 +This expression is evaluated only once during the filter
 +configuration.
 +
 +@item x
 +Set the expression for the x top-left coordinate of the cropped area.
 +It defaults to @code{(in_w-out_w)/2}.
 +This expression is evaluated per-frame.
 +
 +@item y
 +Set the expression for the y top-left coordinate of the cropped area.
 +It defaults to @code{(in_h-out_h)/2}.
 +This expression is evaluated per-frame.
 +
 +@item keep_aspect
 +If set to 1 will force the output display aspect ratio
 +to be the same of the input, by changing the output sample aspect
 +ratio. It defaults to 0.
 +@end table
 +
 +The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
 +expressions containing the following constants:
 +
 +@table @option
 +@item x, y
 +the computed values for @var{x} and @var{y}. They are evaluated for
 +each new frame.
 +
 +@item in_w, in_h
 +the input width and height
 +
 +@item iw, ih
 +same as @var{in_w} and @var{in_h}
 +
 +@item out_w, out_h
 +the output (cropped) width and height
 +
 +@item ow, oh
 +same as @var{out_w} and @var{out_h}
 +
 +@item a
 +same as @var{iw} / @var{ih}
 +
 +@item sar
 +input sample aspect ratio
 +
 +@item dar
 +input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
 +
 +@item hsub, vsub
 +horizontal and vertical chroma subsample values. For example for the
 +pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
 +
 +@item n
 +the number of input frame, starting from 0
 +
 +@item t
 +timestamp expressed in seconds, NAN if the input timestamp is unknown
 +
 +@end table
 +
 +The expression for @var{out_w} may depend on the value of @var{out_h},
 +and the expression for @var{out_h} may depend on @var{out_w}, but they
 +cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
 +evaluated after @var{out_w} and @var{out_h}.
 +
 +The @var{x} and @var{y} parameters specify the expressions for the
 +position of the top-left corner of the output (non-cropped) area. They
 +are evaluated for each frame. If the evaluated value is not valid, it
 +is approximated to the nearest valid value.
 +
 +The expression for @var{x} may depend on @var{y}, and the expression
 +for @var{y} may depend on @var{x}.
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Crop area with size 100x100 at position (12,34).
 +@example
 +crop=100:100:12:34
 +@end example
 +
 +Using named options, the example above becomes:
 +@example
 +crop=w=100:h=100:x=12:y=34
 +@end example
 +
 +@item
 +Crop the central input area with size 100x100:
 +@example
 +crop=100:100
 +@end example
 +
 +@item
 +Crop the central input area with size 2/3 of the input video:
 +@example
 +crop=2/3*in_w:2/3*in_h
 +@end example
 +
 +@item
 +Crop the input video central square:
 +@example
 +crop=in_h
 +@end example
 +
 +@item
 +Delimit the rectangle with the top-left corner placed at position
 +100:100 and the right-bottom corner corresponding to the right-bottom
 +corner of the input image:
 +@example
 +crop=in_w-100:in_h-100:100:100
 +@end example
 +
 +@item
 +Crop 10 pixels from the left and right borders, and 20 pixels from
 +the top and bottom borders
 +@example
 +crop=in_w-2*10:in_h-2*20
 +@end example
 +
 +@item
 +Keep only the bottom right quarter of the input image:
 +@example
 +crop=in_w/2:in_h/2:in_w/2:in_h/2
 +@end example
 +
 +@item
 +Crop height for getting Greek harmony:
 +@example
 +crop=in_w:1/PHI*in_w
 +@end example
 +
 +@item
 +Appply trembling effect:
 +@example
 +crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
 +@end example
 +
 +@item
 +Apply erratic camera effect depending on timestamp:
 +@example
 +crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
 +@end example
 +
 +@item
 +Set x depending on the value of y:
 +@example
 +crop=in_w/2:in_h/2:y:10+10*sin(n/10)
 +@end example
 +@end itemize
 +
 +@section cropdetect
 +
 +Auto-detect crop size.
 +
 +Calculate necessary cropping parameters and prints the recommended
 +parameters through the logging system. The detected dimensions
 +correspond to the non-black area of the input video.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax
 +[@option{limit}[:@option{round}[:@option{reset}]]].
 +
 +A description of the accepted options follows.
 +
 +@table @option
 +
 +@item limit
 +Set higher black value threshold, which can be optionally specified
 +from nothing (0) to everything (255). An intensity value greater
 +to the set value is considered non-black. Default value is 24.
 +
 +@item round
 +Set the value for which the width/height should be divisible by. The
 +offset is automatically adjusted to center the video. Use 2 to get
 +only even dimensions (needed for 4:2:2 video). 16 is best when
 +encoding to most video codecs. Default value is 16.
 +
 +@item reset
 +Set the counter that determines after how many frames cropdetect will
 +reset the previously detected largest video area and start over to
 +detect the current optimal crop area. Default value is 0.
 +
 +This can be useful when channel logos distort the video area. 0
 +indicates never reset and return the largest area encountered during
 +playback.
 +@end table
 +
 +@section curves
 +
 +Apply color adjustments using curves.
 +
 +This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
 +component (red, green and blue) has its values defined by @var{N} key points
 +tied from each other using a smooth curve. The x-axis represents the pixel
 +values from the input frame, and the y-axis the new pixel values to be set for
 +the output frame.
 +
 +By default, a component curve is defined by the two points @var{(0;0)} and
 +@var{(1;1)}. This creates a straight line where each original pixel value is
 +"adjusted" to its own value, which means no change to the image.
 +
 +The filter allows you to redefine these two points and add some more. A new
 +curve (using a natural cubic spline interpolation) will be define to pass
 +smoothly through all these new coordinates. The new defined points needs to be
 +strictly increasing over the x-axis, and their @var{x} and @var{y} values must
 +be in the @var{[0;1]} interval.  If the computed curves happened to go outside
 +the vector spaces, the values will be clipped accordingly.
 +
 +If there is no key point defined in @code{x=0}, the filter will automatically
 +insert a @var{(0;0)} point. In the same way, if there is no key point defined
 +in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax
 +curves[=@var{preset}].
 +
 +A description of the accepted parameters follows.
 +
 +@table @option
 +@item red, r
 +Set the key points for the red component.
 +@item green, g
 +Set the key points for the green component.
 +@item blue, b
 +Set the key points for the blue component.
 +@item preset
 +Select one of the available color presets. This option can not be used in
 +addition to the @option{r}, @option{g}, @option{b} parameters.
 +Available presets are:
 +@table @samp
 +@item color_negative
 +@item cross_process
 +@item darker
 +@item increase_contrast
 +@item lighter
 +@item linear_contrast
 +@item medium_contrast
 +@item negative
 +@item strong_contrast
 +@item vintage
 +@end table
 +Default is unset.
 +@end table
 +
 +To avoid some filtergraph syntax conflicts, each key points list need to be
 +defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Increase slightly the middle level of blue:
 +@example
 +curves=blue='0.5/0.58'
 +@end example
 +
 +@item
 +Vintage effect:
 +@example
 +curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
 +@end example
 +Here we obtain the following coordinates for each components:
 +@table @var
 +@item red
 +@code{(0;0.11) (0.42;0.51) (1;0.95)}
 +@item green
 +@code{(0;0) (0.50;0.48) (1;1)}
 +@item blue
 +@code{(0;0.22) (0.49;0.44) (1;0.80)}
 +@end table
 +
 +@item
 +The previous example can also be achieved with the associated built-in preset:
 +@example
 +curves=preset=vintage
 +@end example
 +
 +@item
 +Or simply:
 +@example
 +curves=vintage
 +@end example
 +@end itemize
 +
 +@section decimate
 +
 +Drop frames that do not differ greatly from the previous frame in
 +order to reduce frame rate.
 +
 +The main use of this filter is for very-low-bitrate encoding
 +(e.g. streaming over dialup modem), but it could in theory be used for
 +fixing movies that were inverse-telecined incorrectly.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax:
 +@option{max}:@option{hi}:@option{lo}:@option{frac}.
 +
 +A description of the accepted options follows.
 +
 +@table @option
 +@item max
 +Set the maximum number of consecutive frames which can be dropped (if
 +positive), or the minimum interval between dropped frames (if
 +negative). If the value is 0, the frame is dropped unregarding the
 +number of previous sequentially dropped frames.
 +
 +Default value is 0.
 +
 +@item hi
 +@item lo
 +@item frac
 +Set the dropping threshold values.
 +
 +Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
 +represent actual pixel value differences, so a threshold of 64
 +corresponds to 1 unit of difference for each pixel, or the same spread
 +out differently over the block.
 +
 +A frame is a candidate for dropping if no 8x8 blocks differ by more
 +than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
 +meaning the whole image) differ by more than a threshold of @option{lo}.
 +
 +Default value for @option{hi} is 64*12, default value for @option{lo} is
 +64*5, and default value for @option{frac} is 0.33.
 +@end table
 +
 +@section delogo
 +
 +Suppress a TV station logo by a simple interpolation of the surrounding
 +pixels. Just set a rectangle covering the logo and watch it disappear
 +(and sometimes something even uglier appear - your mileage may vary).
 +
 +The filter accepts parameters as a string of the form
 +"@var{x}:@var{y}:@var{w}:@var{h}:@var{band}", or as a list of
 +@var{key}=@var{value} pairs, separated by ":".
 +
 +The description of the accepted parameters follows.
 +
 +@table @option
 +
 +@item x, y
 +Specify the top left corner coordinates of the logo. They must be
 +specified.
 +
 +@item w, h
 +Specify the width and height of the logo to clear. They must be
 +specified.
 +
 +@item band, t
 +Specify the thickness of the fuzzy edge of the rectangle (added to
 +@var{w} and @var{h}). The default value is 4.
 +
 +@item show
 +When set to 1, a green rectangle is drawn on the screen to simplify
 +finding the right @var{x}, @var{y}, @var{w}, @var{h} parameters, and
 +@var{band} is set to 4. The default value is 0.
 +
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Set a rectangle covering the area with top left corner coordinates 0,0
 +and size 100x77, setting a band of size 10:
 +@example
 +delogo=0:0:100:77:10
 +@end example
 +
 +@item
 +As the previous example, but use named options:
 +@example
 +delogo=x=0:y=0:w=100:h=77:band=10
 +@end example
 +
 +@end itemize
 +
 +@section deshake
 +
 +Attempt to fix small changes in horizontal and/or vertical shift. This
 +filter helps remove camera shake from hand-holding a camera, bumping a
 +tripod, moving on a vehicle, etc.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax
 +@var{x}:@var{y}:@var{w}:@var{h}:@var{rx}:@var{ry}:@var{edge}:@var{blocksize}:@var{contrast}:@var{search}:@var{filename}:@var{opencl}.
 +
 +A description of the accepted parameters follows.
 +
 +@table @option
 +
 +@item x, y, w, h
 +Specify a rectangular area where to limit the search for motion
 +vectors.
 +If desired the search for motion vectors can be limited to a
 +rectangular area of the frame defined by its top left corner, width
 +and height. These parameters have the same meaning as the drawbox
 +filter which can be used to visualise the position of the bounding
 +box.
 +
 +This is useful when simultaneous movement of subjects within the frame
 +might be confused for camera motion by the motion vector search.
 +
 +If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
 +then the full frame is used. This allows later options to be set
 +without specifying the bounding box for the motion vector search.
 +
 +Default - search the whole frame.
 +
 +@item rx, ry
 +Specify the maximum extent of movement in x and y directions in the
 +range 0-64 pixels. Default 16.
 +
 +@item edge
 +Specify how to generate pixels to fill blanks at the edge of the
 +frame. Available values are:
 +@table @samp
 +@item blank, 0
 +Fill zeroes at blank locations
 +@item original, 1
 +Original image at blank locations
 +@item clamp, 2
 +Extruded edge value at blank locations
 +@item mirror, 3
 +Mirrored edge at blank locations
 +@end table
 +Default value is @samp{mirror}.
 +
 +@item blocksize
 +Specify the blocksize to use for motion search. Range 4-128 pixels,
 +default 8.
 +
 +@item contrast
 +Specify the contrast threshold for blocks. Only blocks with more than
 +the specified contrast (difference between darkest and lightest
 +pixels) will be considered. Range 1-255, default 125.
 +
 +@item search
 +Specify the search strategy. Available values are:
 +@table @samp
 +@item exhaustive, 0
 +Set exhaustive search
 +@item less, 1
 +Set less exhaustive search.
 +@end table
 +Default value is @samp{exhaustive}.
 +
 +@item filename
 +If set then a detailed log of the motion search is written to the
 +specified file.
 +
 +@item opencl
 +If set to 1, specify using OpenCL capabilities, only available if
 +FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
 +
 +@end table
 +
 +@section drawbox
 +
 +Draw a colored box on the input image.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax
 +@option{x}:@option{y}:@option{width}:@option{height}:@option{color}:@option{thickness}.
 +
 +A description of the accepted options follows.
 +
 +@table @option
 +@item x, y
 +Specify the top left corner coordinates of the box. Default to 0.
 +
 +@item width, w
 +@item height, h
 +Specify the width and height of the box, if 0 they are interpreted as
 +the input width and height. Default to 0.
 +
 +@item color, c
 +Specify the color of the box to write, it can be the name of a color
 +(case insensitive match) or a 0xRRGGBB[AA] sequence. If the special
 +value @code{invert} is used, the box edge color is the same as the
 +video with inverted luma.
 +
 +@item thickness, t
 +Set the thickness of the box edge. Default value is @code{4}.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Draw a black box around the edge of the input image:
 +@example
 +drawbox
 +@end example
 +
 +@item
 +Draw a box with color red and an opacity of 50%:
 +@example
 +drawbox=10:20:200:60:red@@0.5
 +@end example
 +
 +The previous example can be specified as:
 +@example
 +drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
 +@end example
 +
 +@item
 +Fill the box with pink color:
 +@example
 +drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
 +@end example
 +@end itemize
 +
 +@anchor{drawtext}
 +@section drawtext
 +
 +Draw text string or text from specified file on top of video using the
 +libfreetype library.
 +
 +To enable compilation of this filter you need to configure FFmpeg with
 +@code{--enable-libfreetype}.
 +
 +@subsection Syntax
 +
 +The filter accepts parameters as a list of @var{key}=@var{value} pairs,
 +separated by ":".
 +
 +The description of the accepted parameters follows.
 +
 +@table @option
 +
 +@item box
 +Used to draw a box around text using background color.
 +Value should be either 1 (enable) or 0 (disable).
 +The default value of @var{box} is 0.
 +
 +@item boxcolor
 +The color to be used for drawing box around text.
 +Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
 +(e.g. "0xff00ff"), possibly followed by an alpha specifier.
 +The default value of @var{boxcolor} is "white".
 +
 +@item draw
 +Set an expression which specifies if the text should be drawn. If the
 +expression evaluates to 0, the text is not drawn. This is useful for
 +specifying that the text should be drawn only when specific conditions
 +are met.
 +
 +Default value is "1".
 +
 +See below for the list of accepted constants and functions.
 +
 +@item expansion
 +Select how the @var{text} is expanded. Can be either @code{none},
 +@code{strftime} (deprecated) or
 +@code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
 +below for details.
 +
 +@item fix_bounds
 +If true, check and fix text coords to avoid clipping.
 +
 +@item fontcolor
 +The color to be used for drawing fonts.
 +Either a string (e.g. "red") or in 0xRRGGBB[AA] format
 +(e.g. "0xff000033"), possibly followed by an alpha specifier.
 +The default value of @var{fontcolor} is "black".
 +
 +@item fontfile
 +The font file to be used for drawing text. Path must be included.
 +This parameter is mandatory.
 +
 +@item fontsize
 +The font size to be used for drawing text.
 +The default value of @var{fontsize} is 16.
 +
 +@item ft_load_flags
 +Flags to be used for loading the fonts.
 +
 +The flags map the corresponding flags supported by libfreetype, and are
 +a combination of the following values:
 +@table @var
 +@item default
 +@item no_scale
 +@item no_hinting
 +@item render
 +@item no_bitmap
 +@item vertical_layout
 +@item force_autohint
 +@item crop_bitmap
 +@item pedantic
 +@item ignore_global_advance_width
 +@item no_recurse
 +@item ignore_transform
 +@item monochrome
 +@item linear_design
 +@item no_autohint
 +@item end table
 +@end table
 +
 +Default value is "render".
 +
 +For more information consult the documentation for the FT_LOAD_*
 +libfreetype flags.
 +
 +@item shadowcolor
 +The color to be used for drawing a shadow behind the drawn text.  It
 +can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
  form (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  The default value of @var{shadowcolor} is "black".
  
 -@item ft_load_flags
 -Flags to be used for loading the fonts.
 +@item shadowx, shadowy
 +The x and y offsets for the text shadow position with respect to the
 +position of the text. They can be either positive or negative
 +values. Default value for both is "0".
 +
 +@item tabsize
 +The size in number of spaces to use for rendering the tab.
 +Default value is 4.
 +
 +@item timecode
 +Set the initial timecode representation in "hh:mm:ss[:;.]ff"
 +format. It can be used with or without text parameter. @var{timecode_rate}
 +option must be specified.
 +
 +@item timecode_rate, rate, r
 +Set the timecode frame rate (timecode only).
 +
 +@item text
 +The text string to be drawn. The text must be a sequence of UTF-8
 +encoded characters.
 +This parameter is mandatory if no file is specified with the parameter
 +@var{textfile}.
 +
 +@item textfile
 +A text file containing text to be drawn. The text must be a sequence
 +of UTF-8 encoded characters.
 +
 +This parameter is mandatory if no text string is specified with the
 +parameter @var{text}.
 +
 +If both @var{text} and @var{textfile} are specified, an error is thrown.
 +
 +@item reload
 +If set to 1, the @var{textfile} will be reloaded before each frame.
 +Be sure to update it atomically, or it may be read partially, or even fail.
 +
 +@item x, y
 +The expressions which specify the offsets where text will be drawn
 +within the video frame. They are relative to the top/left border of the
 +output image.
 +
 +The default value of @var{x} and @var{y} is "0".
 +
 +See below for the list of accepted constants and functions.
 +@end table
 +
 +The parameters for @var{x} and @var{y} are expressions containing the
 +following constants and functions:
 +
 +@table @option
 +@item dar
 +input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
 +
 +@item hsub, vsub
 +horizontal and vertical chroma subsample values. For example for the
 +pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
 +
 +@item line_h, lh
 +the height of each text line
 +
 +@item main_h, h, H
 +the input height
 +
 +@item main_w, w, W
 +the input width
 +
 +@item max_glyph_a, ascent
 +the maximum distance from the baseline to the highest/upper grid
 +coordinate used to place a glyph outline point, for all the rendered
 +glyphs.
 +It is a positive value, due to the grid's orientation with the Y axis
 +upwards.
 +
 +@item max_glyph_d, descent
 +the maximum distance from the baseline to the lowest grid coordinate
 +used to place a glyph outline point, for all the rendered glyphs.
 +This is a negative value, due to the grid's orientation, with the Y axis
 +upwards.
 +
 +@item max_glyph_h
 +maximum glyph height, that is the maximum height for all the glyphs
 +contained in the rendered text, it is equivalent to @var{ascent} -
 +@var{descent}.
 +
 +@item max_glyph_w
 +maximum glyph width, that is the maximum width for all the glyphs
 +contained in the rendered text
 +
 +@item n
 +the number of input frame, starting from 0
 +
 +@item rand(min, max)
 +return a random number included between @var{min} and @var{max}
 +
 +@item sar
 +input sample aspect ratio
 +
 +@item t
 +timestamp expressed in seconds, NAN if the input timestamp is unknown
 +
 +@item text_h, th
 +the height of the rendered text
 +
 +@item text_w, tw
 +the width of the rendered text
 +
 +@item x, y
 +the x and y offset coordinates where the text is drawn.
 +
 +These parameters allow the @var{x} and @var{y} expressions to refer
 +each other, so you can for example specify @code{y=x/dar}.
 +@end table
 +
 +If libavfilter was built with @code{--enable-fontconfig}, then
 +@option{fontfile} can be a fontconfig pattern or omitted.
 +
 +@anchor{drawtext_expansion}
 +@subsection Text expansion
 +
 +If @option{expansion} is set to @code{strftime},
 +the filter recognizes strftime() sequences in the provided text and
 +expands them accordingly. Check the documentation of strftime(). This
 +feature is deprecated.
 +
 +If @option{expansion} is set to @code{none}, the text is printed verbatim.
 +
 +If @option{expansion} is set to @code{normal} (which is the default),
 +the following expansion mechanism is used.
 +
 +The backslash character '\', followed by any character, always expands to
 +the second character.
 +
 +Sequence of the form @code{%@{...@}} are expanded. The text between the
 +braces is a function name, possibly followed by arguments separated by ':'.
 +If the arguments contain special characters or delimiters (':' or '@}'),
 +they should be escaped.
 +
 +Note that they probably must also be escaped as the value for the
 +@option{text} option in the filter argument string and as the filter
 +argument in the filtergraph description, and possibly also for the shell,
 +that makes up to four levels of escaping; using a text file avoids these
 +problems.
 +
 +The following functions are available:
 +
 +@table @command
 +
 +@item expr, e
 +The expression evaluation result.
 +
 +It must take one argument specifying the expression to be evaluated,
 +which accepts the same constants and functions as the @var{x} and
 +@var{y} values. Note that not all constants should be used, for
 +example the text size is not known when evaluating the expression, so
 +the constants @var{text_w} and @var{text_h} will have an undefined
 +value.
 +
 +@item gmtime
 +The time at which the filter is running, expressed in UTC.
 +It can accept an argument: a strftime() format string.
 +
 +@item localtime
 +The time at which the filter is running, expressed in the local time zone.
 +It can accept an argument: a strftime() format string.
 +
 +@item n, frame_num
 +The frame number, starting from 0.
 +
 +@item pts
 +The timestamp of the current frame, in seconds, with microsecond accuracy.
 +
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Draw "Test Text" with font FreeSerif, using the default values for the
 +optional parameters.
 +
 +@example
 +drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
 +@end example
 +
 +@item
 +Draw 'Test Text' with font FreeSerif of size 24 at position x=100
 +and y=50 (counting from the top-left corner of the screen), text is
 +yellow with a red box around it. Both the text and the box have an
 +opacity of 20%.
 +
 +@example
 +drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
 +          x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
 +@end example
 +
 +Note that the double quotes are not necessary if spaces are not used
 +within the parameter list.
 +
 +@item
 +Show the text at the center of the video frame:
 +@example
 +drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
 +@end example
 +
 +@item
 +Show a text line sliding from right to left in the last row of the video
 +frame. The file @file{LONG_LINE} is assumed to contain a single line
 +with no newlines.
 +@example
 +drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
 +@end example
 +
 +@item
 +Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
 +@example
 +drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
 +@end example
 +
 +@item
 +Draw a single green letter "g", at the center of the input video.
 +The glyph baseline is placed at half screen height.
 +@example
 +drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
 +@end example
 +
 +@item
 +Show text for 1 second every 3 seconds:
 +@example
 +drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:draw=lt(mod(t\,3)\,1):text='blink'"
 +@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
 +
 +@item
 +Print the date of a real-time encoding (see strftime(3)):
 +@example
 +drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
 +@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 edgedetect
 +
 +Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
 +
 +This filter accepts the following optional named parameters:
 +
 +@table @option
 +@item low, high
 +Set low and high threshold values used by the Canny thresholding
 +algorithm.
 +
 +The high threshold selects the "strong" edge pixels, which are then
 +connected through 8-connectivity with the "weak" edge pixels selected
 +by the low threshold.
 +
 +@var{low} and @var{high} threshold values must be choosen in the range
 +[0,1], and @var{low} should be lesser or equal to @var{high}.
 +
 +Default value for @var{low} is @code{20/255}, and default value for @var{high}
 +is @code{50/255}.
 +@end table
 +
 +Example:
 +@example
 +edgedetect=low=0.1:high=0.4
 +@end example
 +
 +@section fade
 +
 +Apply fade-in/out effect to input video.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax
 +@var{type}:@var{start_frame}:@var{nb_frames}.
 +
 +A description of the accepted parameters follows.
 +
 +@table @option
 +@item type, t
 +Specify if the effect type, can be either @code{in} for fade-in, or
 +@code{out} for a fade-out effect. Default is @code{in}.
 +
 +@item start_frame, s
 +Specify the number of the start frame for starting to apply the fade
 +effect. Default is 0.
 +
 +@item nb_frames, n
 +Specify the number of frames for which the fade effect has to last. At
 +the end of the fade-in effect the output video will have the same
 +intensity as the input video, at the end of the fade-out transition
 +the output video will be completely black. Default is 25.
 +
 +@item alpha
 +If set to 1, fade only alpha channel, if one exists on the input.
 +Default value is 0.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Fade in first 30 frames of video:
 +@example
 +fade=in:0:30
 +@end example
 +
 +The command above is equivalent to:
 +@example
 +fade=t=in:s=0:n=30
 +@end example
 +
 +@item
 +Fade out last 45 frames of a 200-frame video:
 +@example
 +fade=out:155:45
 +@end example
 +
 +@item
 +Fade in first 25 frames and fade out last 25 frames of a 1000-frame video:
 +@example
 +fade=in:0:25, fade=out:975:25
 +@end example
 +
 +@item
 +Make first 5 frames black, then fade in from frame 5-24:
 +@example
 +fade=in:5:20
 +@end example
 +
 +@item
 +Fade in alpha over first 25 frames of video:
 +@example
 +fade=in:0:25:alpha=1
 +@end example
 +@end itemize
 +
 +@section field
 +
 +Extract a single field from an interlaced image using stride
 +arithmetic to avoid wasting CPU time. The output frames are marked as
 +non-interlaced.
 +
 +This filter accepts the following named options:
 +@table @option
 +@item type
 +Specify whether to extract the top (if the value is @code{0} or
 +@code{top}) or the bottom field (if the value is @code{1} or
 +@code{bottom}).
 +@end table
 +
 +If the option key is not specified, the first value sets the @var{type}
 +option. For example:
 +@example
 +field=bottom
 +@end example
 +
 +is equivalent to:
 +@example
 +field=type=bottom
 +@end example
 +
 +@section fieldorder
 +
 +Transform the field order of the input video.
 +
 +This filter accepts the named option @option{order} which
 +specifies the required field order that the input interlaced video
 +will be transformed to. The option name can be omitted.
 +
 +The option @option{order} can assume one of the following values:
 +@table @samp
 +@item bff
 +output bottom field first
 +@item tff
 +output top field first
 +@end table
 +
 +Default value is @samp{tff}.
 +
 +Transformation is achieved by shifting the picture content up or down
 +by one line, and filling the remaining line with appropriate picture content.
 +This method is consistent with most broadcast field order converters.
 +
 +If the input video is not flagged as being interlaced, or it is already
 +flagged as being of the required output field order then this filter does
 +not alter the incoming video.
 +
 +This filter is very useful when converting to or from PAL DV material,
 +which is bottom field first.
 +
 +For example:
 +@example
 +ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
 +@end example
 +
 +@section fifo
 +
 +Buffer input images and send them when they are requested.
 +
 +This filter is mainly useful when auto-inserted by the libavfilter
 +framework.
 +
 +The filter does not take parameters.
 +
 +@anchor{format}
 +@section format
 +
 +Convert the input video to one of the specified pixel formats.
 +Libavfilter will try to pick one that is supported for the input to
 +the next filter.
 +
 +This filter accepts the following parameters:
 +@table @option
 +
 +@item pix_fmts
 +A '|'-separated list of pixel format names, for example
 +"pix_fmts=yuv420p|monow|rgb24".
 +
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Convert the input video to the format @var{yuv420p}
 +@example
 +format=pix_fmts=yuv420p
 +@end example
 +
 +Convert the input video to any of the formats in the list
 +@example
 +format=pix_fmts=yuv420p|yuv444p|yuv410p
 +@end example
 +@end itemize
 +
 +@section fps
 +
 +Convert the video to specified constant frame rate by duplicating or dropping
 +frames as necessary.
 +
 +This filter accepts the following named parameters:
 +@table @option
 +
 +@item fps
 +Desired output frame rate. The default is @code{25}.
 +
 +@item round
 +Rounding method.
 +
 +Possible values are:
 +@table @option
 +@item zero
 +zero round towards 0
 +@item inf
 +round away from 0
 +@item down
 +round towards -infinity
 +@item up
 +round towards +infinity
 +@item near
 +round to nearest
 +@end table
 +The default is @code{near}.
 +
 +@end table
 +
 +Alternatively, the options can be specified as a flat string:
 +@var{fps}[:@var{round}].
 +
 +See also the @ref{setpts} filter.
 +
 +@section framestep
 +
 +Select one frame every N.
 +
 +This filter accepts in input a string representing a positive
 +integer. Default argument is @code{1}.
 +
 +@anchor{frei0r}
 +@section frei0r
 +
 +Apply a frei0r effect to the input video.
 +
 +To enable compilation of this filter you need to install the frei0r
 +header and configure FFmpeg with @code{--enable-frei0r}.
 +
 +The filter supports the syntax:
 +@example
 +@var{filter_name}[@{:|=@}@var{param1}:@var{param2}:...:@var{paramN}]
 +@end example
 +
 +@var{filter_name} is the name of the frei0r effect to load. If the
 +environment variable @env{FREI0R_PATH} is defined, the frei0r effect
 +is searched in each one of the directories specified by the colon (or
 +semicolon on Windows platforms) separated list in @env{FREIOR_PATH},
 +otherwise in the standard frei0r paths, which are in this order:
 +@file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
 +@file{/usr/lib/frei0r-1/}.
 +
 +@var{param1}, @var{param2}, ... , @var{paramN} specify the parameters
 +for the frei0r effect.
 +
 +A frei0r effect parameter can be a boolean (whose values are specified
 +with "y" and "n"), a double, a color (specified by the syntax
 +@var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float
 +numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color
 +description), a position (specified by the syntax @var{X}/@var{Y},
 +@var{X} and @var{Y} being float numbers) and a string.
 +
 +The number and kind of parameters depend on the loaded effect. If an
 +effect parameter is not specified the default value is set.
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Apply the distort0r effect, set the first two double parameters:
 +@example
 +frei0r=distort0r:0.5:0.01
 +@end example
 +
 +@item
 +Apply the colordistance effect, take a color as first parameter:
 +@example
 +frei0r=colordistance:0.2/0.3/0.4
 +frei0r=colordistance:violet
 +frei0r=colordistance:0x112233
 +@end example
 +
 +@item
 +Apply the perspective effect, specify the top left and top right image
 +positions:
 +@example
 +frei0r=perspective:0.2/0.2:0.8/0.2
 +@end example
 +@end itemize
 +
 +For more information see:
 +@url{http://frei0r.dyne.org}
 +
 +@section geq
 +
 +The filter takes one, two, three or four equations as parameter, separated by ':'.
 +The first equation is mandatory and applies to the luma plane. The two
 +following are respectively for chroma blue and chroma red planes.
 +
 +The filter syntax allows named parameters:
 +
 +@table @option
 +@item lum_expr
 +the luminance expression
 +@item cb_expr
 +the chrominance blue expression
 +@item cr_expr
 +the chrominance red expression
 +@item alpha_expr
 +the alpha expression
 +@end table
 +
 +If one of the chrominance expression is not defined, it falls back on the other
 +one. If no alpha expression is specified it will evaluate to opaque value.
 +If none of chrominance expressions are
 +specified, they will evaluate the luminance expression.
 +
 +The expressions can use the following variables and functions:
 +
 +@table @option
 +@item N
 +The sequential number of the filtered frame, starting from @code{0}.
 +
 +@item X
 +@item Y
 +The coordinates of the current sample.
 +
 +@item W
 +@item H
 +The width and height of the image.
 +
 +@item SW
 +@item SH
 +Width and height scale depending on the currently filtered plane. It is the
 +ratio between the corresponding luma plane number of pixels and the current
 +plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
 +@code{0.5,0.5} for chroma planes.
 +
 +@item T
 +Time of the current frame, expressed in seconds.
 +
 +@item p(x, y)
 +Return the value of the pixel at location (@var{x},@var{y}) of the current
 +plane.
 +
 +@item lum(x, y)
 +Return the value of the pixel at location (@var{x},@var{y}) of the luminance
 +plane.
 +
 +@item cb(x, y)
 +Return the value of the pixel at location (@var{x},@var{y}) of the
 +blue-difference chroma plane. Returns 0 if there is no such plane.
 +
 +@item cr(x, y)
 +Return the value of the pixel at location (@var{x},@var{y}) of the
 +red-difference chroma plane. Returns 0 if there is no such plane.
 +
 +@item alpha(x, y)
 +Return the value of the pixel at location (@var{x},@var{y}) of the alpha
 +plane. Returns 0 if there is no such plane.
 +@end table
 +
 +For functions, if @var{x} and @var{y} are outside the area, the value will be
 +automatically clipped to the closer edge.
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Flip the image horizontally:
 +@example
 +geq=p(W-X\,Y)
 +@end example
 +
 +@item
 +Generate a bidimensional sine wave, with angle @code{PI/3} and a
 +wavelength of 100 pixels:
 +@example
 +geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
 +@end example
 +
 +@item
 +Generate a fancy enigmatic moving light:
 +@example
 +nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
 +@end example
 +@end itemize
 +
 +@section gradfun
 +
 +Fix the banding artifacts that are sometimes introduced into nearly flat
 +regions by truncation to 8bit color depth.
 +Interpolate the gradients that should go where the bands are, and
 +dither them.
 +
 +This filter is designed for playback only.  Do not use it prior to
 +lossy compression, because compression tends to lose the dither and
 +bring back the bands.
 +
 +The filter accepts a list of options in the form of @var{key}=@var{value} pairs
 +separated by ":". A description of the accepted options follows.
 +
 +@table @option
 +
 +@item strength
 +The maximum amount by which the filter will change
 +any one pixel. Also the threshold for detecting nearly flat
 +regions. Acceptable values range from @code{0.51} to @code{64}, default value
 +is @code{1.2}.
 +
 +@item radius
 +The neighborhood to fit the gradient to. A larger
 +radius makes for smoother gradients, but also prevents the filter from
 +modifying the pixels near detailed regions. Acceptable values are
 +@code{8-32}, default value is @code{16}.
 +
 +@end table
 +
 +Alternatively, the options can be specified as a flat string:
 +@var{strength}[:@var{radius}]
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Apply the filter with a @code{3.5} strength and radius of @code{8}:
 +@example
 +gradfun=3.5:8
 +@end example
 +
 +@item
 +Specify radius, omitting the strength (which will fall-back to the default
 +value):
 +@example
 +gradfun=radius=8
 +@end example
 +
 +@end itemize
 +
 +@section hflip
 +
 +Flip the input video horizontally.
 +
 +For example to horizontally flip the input video with @command{ffmpeg}:
 +@example
 +ffmpeg -i in.avi -vf "hflip" out.avi
 +@end example
 +
 +@section histeq
 +This filter applies a global color histogram equalization on a
 +per-frame basis.
 +
 +It can be used to correct video that has a compressed range of pixel
 +intensities.  The filter redistributes the pixel intensities to
 +equalize their distribution across the intensity range. It may be
 +viewed as an "automatically adjusting contrast filter". This filter is
 +useful only for correcting degraded or poorly captured source
 +video.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to syntax
 +@var{strength}:@var{intensity}:@var{antibanding}.
 +
 +This filter accepts the following named options:
 +
 +@table @option
 +@item strength
 +Determine the amount of equalization to be applied.  As the strength
 +is reduced, the distribution of pixel intensities more-and-more
 +approaches that of the input frame. The value must be a float number
 +in the range [0,1] and defaults to 0.200.
 +
 +@item intensity
 +Set the maximum intensity that can generated and scale the output
 +values appropriately.  The strength should be set as desired and then
 +the intensity can be limited if needed to avoid washing-out. The value
 +must be a float number in the range [0,1] and defaults to 0.210.
 +
 +@item antibanding
 +Set the antibanding level. If enabled the filter will randomly vary
 +the luminance of output pixels by a small amount to avoid banding of
 +the histogram. Possible values are @code{none}, @code{weak} or
 +@code{strong}. It defaults to @code{none}.
 +@end table
 +
 +@section histogram
 +
 +Compute and draw a color distribution histogram for the input video.
 +
 +The computed histogram is a representation of distribution of color components
 +in an image.
 +
 +The filter accepts the following named parameters:
 +
 +@table @option
 +@item mode
 +Set histogram mode.
 +
 +It accepts the following values:
 +@table @samp
 +@item levels
 +standard histogram that display color components distribution in an image.
 +Displays color graph for each color component. Shows distribution
 +of the Y, U, V, A or G, B, R components, depending on input format,
 +in current frame. Bellow each graph is color component scale meter.
 +
 +@item color
 +chroma values in vectorscope, if brighter more such chroma values are
 +distributed in an image.
 +Displays chroma values (U/V color placement) in two dimensional graph
 +(which is called a vectorscope). It can be used to read of the hue and
 +saturation of the current frame. At a same time it is a histogram.
 +The whiter a pixel in the vectorscope, the more pixels of the input frame
 +correspond to that pixel (that is the more pixels have this chroma value).
 +The V component is displayed on the horizontal (X) axis, with the leftmost
 +side being V = 0 and the rightmost side being V = 255.
 +The U component is displayed on the vertical (Y) axis, with the top
 +representing U = 0 and the bottom representing U = 255.
 +
 +The position of a white pixel in the graph corresponds to the chroma value
 +of a pixel of the input clip. So the graph can be used to read of the
 +hue (color flavor) and the saturation (the dominance of the hue in the color).
 +As the hue of a color changes, it moves around the square. At the center of
 +the square, the saturation is zero, which means that the corresponding pixel
 +has no color. If you increase the amount of a specific color, while leaving
 +the other colors unchanged, the saturation increases, and you move towards
 +the edge of the square.
 +
 +@item color2
 +chroma values in vectorscope, similar as @code{color} but actual chroma values
 +are displayed.
 +
 +@item waveform
 +per row/column color component graph. In row mode graph in the left side represents
 +color component value 0 and right side represents value = 255. In column mode top
 +side represents color component value = 0 and bottom side represents value = 255.
 +@end table
 +Default value is @code{levels}.
 +
 +@item level_height
 +Set height of level in @code{levels}. Default value is @code{200}.
 +Allowed range is [50, 2048].
 +
 +@item scale_height
 +Set height of color scale in @code{levels}. Default value is @code{12}.
 +Allowed range is [0, 40].
 +
 +@item step
 +Set step for @code{waveform} mode. Smaller values are useful to find out how much
 +of same luminance values across input rows/columns are distributed.
 +Default value is @code{10}. Allowed range is [1, 255].
 +
 +@item waveform_mode
 +Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
 +Default is @code{row}.
 +
 +@item display_mode
 +Set display mode for @code{waveform} and @code{levels}.
 +It accepts the following values:
 +@table @samp
 +@item parade
 +Display separate graph for the color components side by side in
 +@code{row} waveform mode or one below other in @code{column} waveform mode
 +for @code{waveform} histogram mode. For @code{levels} histogram mode
 +per color component graphs are placed one bellow other.
 +
 +This display mode in @code{waveform} histogram mode makes it easy to spot
 +color casts in the highlights and shadows of an image, by comparing the
 +contours of the top and the bottom of each waveform.
 +Since whites, grays, and blacks are characterized by
 +exactly equal amounts of red, green, and blue, neutral areas of the
 +picture should display three waveforms of roughly equal width/height.
 +If not, the correction is easy to make by making adjustments to level the
 +three waveforms.
 +
 +@item overlay
 +Presents information that's identical to that in the @code{parade}, except
 +that the graphs representing color components are superimposed directly
 +over one another.
 +
 +This display mode in @code{waveform} histogram mode can make it easier to spot
 +the relative differences or similarities in overlapping areas of the color
 +components that are supposed to be identical, such as neutral whites, grays,
 +or blacks.
 +@end table
 +Default is @code{parade}.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +
 +@item
 +Calculate and draw histogram:
 +@example
 +ffplay -i input -vf histogram
 +@end example
 +
 +@end itemize
 +
 +@section hqdn3d
 +
 +High precision/quality 3d denoise filter. This filter aims to reduce
 +image noise producing smooth images and making still images really
 +still. It should enhance compressibility.
 +
 +It accepts the following optional parameters:
 +@var{luma_spatial}:@var{chroma_spatial}:@var{luma_tmp}:@var{chroma_tmp}
 +
 +@table @option
 +@item luma_spatial
 +a non-negative float number which specifies spatial luma strength,
 +defaults to 4.0
 +
 +@item chroma_spatial
 +a non-negative float number which specifies spatial chroma strength,
 +defaults to 3.0*@var{luma_spatial}/4.0
 +
 +@item luma_tmp
 +a float number which specifies luma temporal strength, defaults to
 +6.0*@var{luma_spatial}/4.0
 +
 +@item chroma_tmp
 +a float number which specifies chroma temporal strength, defaults to
 +@var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
 +@end table
 +
 +@section hue
 +
 +Modify the hue and/or the saturation of the input.
 +
 +This filter accepts the following optional named options:
 +
 +@table @option
 +@item h
 +Specify the hue angle as a number of degrees. It accepts a float
 +number or an expression, and defaults to 0.0.
 +
 +@item H
 +Specify the hue angle as a number of radians. It accepts a float
 +number or an expression, and defaults to 0.0.
 +
 +@item s
 +Specify the saturation in the [-10,10] range. It accepts a float number and
 +defaults to 1.0.
 +@end table
 +
 +The @var{h}, @var{H} and @var{s} parameters are expressions containing the
 +following constants:
 +
 +@table @option
 +@item n
 +frame count of the input frame starting from 0
 +
 +@item pts
 +presentation timestamp of the input frame expressed in time base units
 +
 +@item r
 +frame rate of the input video, NAN if the input frame rate is unknown
 +
 +@item t
 +timestamp expressed in seconds, NAN if the input timestamp is unknown
 +
 +@item tb
 +time base of the input video
 +@end table
 +
 +The options can also be set using the syntax: @var{hue}:@var{saturation}
 +
 +In this case @var{hue} is expressed in degrees.
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Set the hue to 90 degrees and the saturation to 1.0:
 +@example
 +hue=h=90:s=1
 +@end example
 +
 +@item
 +Same command but expressing the hue in radians:
 +@example
 +hue=H=PI/2:s=1
 +@end example
 +
 +@item
 +Same command without named options, hue must be expressed in degrees:
 +@example
 +hue=90:1
 +@end example
 +
 +@item
 +Note that "h:s" syntax does not support expressions for the values of
 +h and s, so the following example will issue an error:
 +@example
 +hue=PI/2:1
 +@end example
 +
 +@item
 +Rotate hue and make the saturation swing between 0
 +and 2 over a period of 1 second:
 +@example
 +hue="H=2*PI*t: s=sin(2*PI*t)+1"
 +@end example
 +
 +@item
 +Apply a 3 seconds saturation fade-in effect starting at 0:
 +@example
 +hue="s=min(t/3\,1)"
 +@end example
 +
 +The general fade-in expression can be written as:
 +@example
 +hue="s=min(0\, max((t-START)/DURATION\, 1))"
 +@end example
 +
 +@item
 +Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
 +@example
 +hue="s=max(0\, min(1\, (8-t)/3))"
 +@end example
 +
 +The general fade-out expression can be written as:
 +@example
 +hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
 +@end example
 +
 +@end itemize
 +
 +@subsection Commands
 +
 +This filter supports the following command:
 +@table @option
 +@item reinit
 +Modify the hue and/or the saturation of the input video.
 +The command accepts the same named options and syntax than when calling the
 +filter from the command-line.
 +
 +If a parameter is omitted, it is kept at its current value.
 +@end table
 +
 +@section idet
 +
 +Detect video interlacing type.
 +
 +This filter tries to detect if the input is interlaced or progressive,
 +top or bottom field first.
 +
 +@section il
 +
 +Deinterleave or interleave fields.
 +
 +This filter allows to process interlaced images fields without
 +deinterlacing them. Deinterleaving splits the input frame into 2
 +fields (so called half pictures). Odd lines are moved to the top
 +half of the output image, even lines to the bottom half.
 +You can process (filter) them independently and then re-interleave them.
 +
 +It accepts a list of options in the form of @var{key}=@var{value} pairs
 +separated by ":". A description of the accepted options follows.
 +
 +@table @option
 +@item luma_mode, l
 +@item chroma_mode, s
 +@item alpha_mode, a
 +Available values for @var{luma_mode}, @var{chroma_mode} and
 +@var{alpha_mode} are:
 +
 +@table @samp
 +@item none
 +Do nothing.
 +
 +@item deinterleave, d
 +Deinterleave fields, placing one above the other.
 +
 +@item interleave, i
 +Interleave fields. Reverse the effect of deinterleaving.
 +@end table
 +Default value is @code{none}.
 +
 +@item luma_swap, ls
 +@item chroma_swap, cs
 +@item alpha_swap, as
 +Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
 +@end table
 +
 +@section kerndeint
 +
 +Deinterlace input video by applying Donald Graft's adaptive kernel
 +deinterling. Work on interlaced parts of a video to produce
 +progressive frames.
 +
 +This filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the following syntax:
 +@var{thresh}:@var{map}:@var{order}:@var{sharp}:@var{twoway}.
 +
 +The description of the accepted parameters follows.
 +
 +@table @option
 +@item thresh
 +Set the threshold which affects the filter's tolerance when
 +determining if a pixel line must be processed. It must be an integer
 +in the range [0,255] and defaults to 10. A value of 0 will result in
 +applying the process on every pixels.
 +
 +@item map
 +Paint pixels exceeding the threshold value to white if set to 1.
 +Default is 0.
 +
 +@item order
 +Set the fields order. Swap fields if set to 1, leave fields alone if
 +0. Default is 0.
 +
 +@item sharp
 +Enable additional sharpening if set to 1. Default is 0.
 +
 +@item twoway
 +Enable twoway sharpening if set to 1. Default is 0.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Apply default values:
 +@example
 +kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
 +@end example
 +
 +@item
 +Enable additional sharpening:
 +@example
 +kerndeint=sharp=1
 +@end example
 +
 +@item
 +Paint processed pixels in white:
 +@example
 +kerndeint=map=1
 +@end example
 +@end itemize
 +
 +@section lut, lutrgb, lutyuv
 +
 +Compute a look-up table for binding each pixel component input value
 +to an output value, and apply it to input video.
 +
 +@var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
 +to an RGB input video.
 +
 +These filters accept in input a ":"-separated list of options, which
 +specify the expressions used for computing the lookup table for the
 +corresponding pixel component values.
 +
 +The @var{lut} filter requires either YUV or RGB pixel formats in
 +input, and accepts the options:
 +@table @option
 +@item c0
 +set first pixel component expression
 +@item c1
 +set second pixel component expression
 +@item c2
 +set third pixel component expression
 +@item c3
 +set fourth pixel component expression, corresponds to the alpha component
 +@end table
 +
 +The exact component associated to each option depends on the format in
 +input.
 +
 +The @var{lutrgb} filter requires RGB pixel formats in input, and
 +accepts the options:
 +@table @option
 +@item r
 +set red component expression
 +@item g
 +set green component expression
 +@item b
 +set blue component expression
 +@item a
 +alpha component expression
 +@end table
 +
 +The @var{lutyuv} filter requires YUV pixel formats in input, and
 +accepts the options:
 +@table @option
 +@item y
 +set Y/luminance component expression
 +@item u
 +set U/Cb component expression
 +@item v
 +set V/Cr component expression
 +@item a
 +set alpha component expression
 +@end table
 +
 +The expressions can contain the following constants and functions:
 +
 +@table @option
 +@item w, h
 +the input width and height
 +
 +@item val
 +input value for the pixel component
 +
 +@item clipval
 +the input value clipped in the @var{minval}-@var{maxval} range
 +
 +@item maxval
 +maximum value for the pixel component
 +
 +@item minval
 +minimum value for the pixel component
 +
 +@item negval
 +the negated value for the pixel component value clipped in the
 +@var{minval}-@var{maxval} range , it corresponds to the expression
 +"maxval-clipval+minval"
 +
 +@item clip(val)
 +the computed value in @var{val} clipped in the
 +@var{minval}-@var{maxval} range
 +
 +@item gammaval(gamma)
 +the computed gamma correction value of the pixel component value
 +clipped in the @var{minval}-@var{maxval} range, corresponds to the
 +expression
 +"pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
 +
 +@end table
 +
 +All expressions default to "val".
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Negate input video:
 +@example
 +lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
 +lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
 +@end example
 +
 +The above is the same as:
 +@example
 +lutrgb="r=negval:g=negval:b=negval"
 +lutyuv="y=negval:u=negval:v=negval"
 +@end example
 +
 +@item
 +Negate luminance:
 +@example
 +lutyuv=y=negval
 +@end example
 +
 +@item
 +Remove chroma components, turns the video into a graytone image:
 +@example
 +lutyuv="u=128:v=128"
 +@end example
 +
 +@item
 +Apply a luma burning effect:
 +@example
 +lutyuv="y=2*val"
 +@end example
 +
 +@item
 +Remove green and blue components:
 +@example
 +lutrgb="g=0:b=0"
 +@end example
 +
 +@item
 +Set a constant alpha channel value on input:
 +@example
 +format=rgba,lutrgb=a="maxval-minval/2"
 +@end example
 +
 +@item
 +Correct luminance gamma by a 0.5 factor:
 +@example
 +lutyuv=y=gammaval(0.5)
 +@end example
 +
 +@item
 +Discard least significant bits of luma:
 +@example
 +lutyuv=y='bitand(val, 128+64+32)'
 +@end example
 +@end itemize
 +
 +@section mp
 +
 +Apply an MPlayer filter to the input video.
 +
 +This filter provides a wrapper around most of the filters of
 +MPlayer/MEncoder.
 +
 +This wrapper is considered experimental. Some of the wrapped filters
 +may not work properly and we may drop support for them, as they will
 +be implemented natively into FFmpeg. Thus you should avoid
 +depending on them when writing portable scripts.
 +
 +The filters accepts the parameters:
 +@var{filter_name}[:=]@var{filter_params}
 +
 +@var{filter_name} is the name of a supported MPlayer filter,
 +@var{filter_params} is a string containing the parameters accepted by
 +the named filter.
 +
 +The list of the currently supported filters follows:
 +@table @var
 +@item detc
 +@item dint
 +@item divtc
 +@item down3dright
 +@item eq2
 +@item eq
 +@item fil
 +@item fspp
 +@item ilpack
 +@item ivtc
 +@item mcdeint
 +@item ow
 +@item perspective
 +@item phase
 +@item pp7
 +@item pullup
 +@item qp
 +@item sab
 +@item softpulldown
 +@item spp
 +@item telecine
 +@item tinterlace
 +@item uspp
 +@end table
 +
 +The parameter syntax and behavior for the listed filters are the same
 +of the corresponding MPlayer filters. For detailed instructions check
 +the "VIDEO FILTERS" section in the MPlayer manual.
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Adjust gamma, brightness, contrast:
 +@example
 +mp=eq2=1.0:2:0.5
 +@end example
 +@end itemize
 +
 +See also mplayer(1), @url{http://www.mplayerhq.hu/}.
 +
 +@section negate
 +
 +Negate input video.
 +
 +This filter accepts an integer in input, if non-zero it negates the
 +alpha component (if available). The default value in input is 0.
 +
 +@section noformat
 +
 +Force libavfilter not to use any of the specified pixel formats for the
 +input to the next filter.
 +
 +This filter accepts the following parameters:
 +@table @option
 +
 +@item pix_fmts
 +A '|'-separated list of pixel format names, for example
 +"pix_fmts=yuv420p|monow|rgb24".
 +
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Force libavfilter to use a format different from @var{yuv420p} for the
 +input to the vflip filter:
 +@example
 +noformat=pix_fmts=yuv420p,vflip
 +@end example
 +
 +@item
 +Convert the input video to any of the formats not contained in the list:
 +@example
 +noformat=yuv420p|yuv444p|yuv410p
 +@end example
 +@end itemize
 +
 +@section noise
 +
 +Add noise on video input frame.
 +
 +This filter accepts a list of options in the form of @var{key}=@var{value}
 +pairs separated by ":". A description of the accepted options follows.
 +
 +@table @option
 +@item all_seed
 +@item c0_seed
 +@item c1_seed
 +@item c2_seed
 +@item c3_seed
 +Set noise seed for specific pixel component or all pixel components in case
 +of @var{all_seed}. Default value is @code{123457}.
 +
 +@item all_strength, alls
 +@item c0_strength, c0s
 +@item c1_strength, c1s
 +@item c2_strength, c2s
 +@item c3_strength, c3s
 +Set noise strength for specific pixel component or all pixel components in case
 +@var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
 +
 +@item all_flags, allf
 +@item c0_flags, c0f
 +@item c1_flags, c1f
 +@item c2_flags, c2f
 +@item c3_flags, c3f
 +Set pixel component flags or set flags for all components if @var{all_flags}.
 +Available values for component flags are:
 +@table @samp
 +@item a
 +averaged temporal noise (smoother)
 +@item p
 +mix random noise with a (semi)regular pattern
 +@item q
 +higher quality (slightly better looking, slightly slower)
 +@item t
 +temporal noise (noise pattern changes between frames)
 +@item u
 +uniform noise (gaussian otherwise)
 +@end table
 +@end table
 +
 +@subsection Examples
 +
 +Add temporal and uniform noise to input video:
 +@example
 +noise=alls=20:allf=t+u
 +@end example
 +
 +@section null
 +
 +Pass the video source unchanged to the output.
 +
 +@section ocv
 +
 +Apply video transform using libopencv.
 +
 +To enable this filter install libopencv library and headers and
 +configure FFmpeg with @code{--enable-libopencv}.
 +
 +The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}.
 +
 +@var{filter_name} is the name of the libopencv filter to apply.
 +
 +@var{filter_params} specifies the parameters to pass to the libopencv
 +filter. If not specified the default values are assumed.
 +
 +Refer to the official libopencv documentation for more precise
 +information:
 +@url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
 +
 +Follows the list of supported libopencv filters.
 +
 +@anchor{dilate}
 +@subsection dilate
 +
 +Dilate an image by using a specific structuring element.
 +This filter corresponds to the libopencv function @code{cvDilate}.
 +
 +It accepts the parameters: @var{struct_el}:@var{nb_iterations}.
 +
 +@var{struct_el} represents a structuring element, and has the syntax:
 +@var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
 +
 +@var{cols} and @var{rows} represent the number of columns and rows of
 +the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
 +point, and @var{shape} the shape for the structuring element, and
 +can be one of the values "rect", "cross", "ellipse", "custom".
 +
 +If the value for @var{shape} is "custom", it must be followed by a
 +string of the form "=@var{filename}". The file with name
 +@var{filename} is assumed to represent a binary image, with each
 +printable character corresponding to a bright pixel. When a custom
 +@var{shape} is used, @var{cols} and @var{rows} are ignored, the number
 +or columns and rows of the read file are assumed instead.
 +
 +The default value for @var{struct_el} is "3x3+0x0/rect".
 +
 +@var{nb_iterations} specifies the number of times the transform is
 +applied to the image, and defaults to 1.
 +
 +Follow some example:
 +@example
 +# use the default values
 +ocv=dilate
 +
 +# dilate using a structuring element with a 5x5 cross, iterate two times
 +ocv=dilate=5x5+2x2/cross:2
 +
 +# read the shape from the file diamond.shape, iterate two times
 +# the file diamond.shape may contain a pattern of characters like this:
 +#   *
 +#  ***
 +# *****
 +#  ***
 +#   *
 +# the specified cols and rows are ignored (but not the anchor point coordinates)
 +ocv=0x0+2x2/custom=diamond.shape:2
 +@end example
 +
 +@subsection erode
 +
 +Erode an image by using a specific structuring element.
 +This filter corresponds to the libopencv function @code{cvErode}.
 +
 +The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
 +with the same syntax and semantics as the @ref{dilate} filter.
 +
 +@subsection smooth
 +
 +Smooth the input video.
 +
 +The filter takes the following parameters:
 +@var{type}:@var{param1}:@var{param2}:@var{param3}:@var{param4}.
 +
 +@var{type} is the type of smooth filter to apply, and can be one of
 +the following values: "blur", "blur_no_scale", "median", "gaussian",
 +"bilateral". The default value is "gaussian".
 +
 +@var{param1}, @var{param2}, @var{param3}, and @var{param4} are
 +parameters whose meanings depend on smooth type. @var{param1} and
 +@var{param2} accept integer positive values or 0, @var{param3} and
 +@var{param4} accept float values.
 +
 +The default value for @var{param1} is 3, the default value for the
 +other parameters is 0.
 +
 +These parameters correspond to the parameters assigned to the
 +libopencv function @code{cvSmooth}.
 +
 +@anchor{overlay}
 +@section overlay
 +
 +Overlay one video on top of another.
 +
 +It takes two inputs and one output, the first input is the "main"
 +video on which the second input is overlayed.
 +
 +This filter accepts a list of @var{key}=@var{value} pairs as argument,
 +separated by ":". If the key of the first options is omitted, the
 +arguments are interpreted according to the syntax @var{x}:@var{y}.
 +
 +A description of the accepted options follows.
 +
 +@table @option
 +@item x
 +@item y
 +Set the expression for the x and y coordinates of the overlayed video
 +on the main video. Default value is "0" for both expressions. In case
 +the expression is invalid, it is set to a huge value (meaning that the
 +overlay will not be displayed within the output visible area).
 +
 +@item enable
 +Set the expression which enables the overlay. If the evaluation is
 +different from 0, the overlay is displayed on top of the input
 +frame. By default it is "1".
 +
 +@item eval
 +Set when the expressions for @option{x}, @option{y}, and
 +@option{enable} are evaluated.
 +
 +It accepts the following values:
 +@table @samp
 +@item init
 +only evaluate expressions once during the filter initialization or
 +when a command is processed
 +
 +@item frame
 +evaluate expressions for each incoming frame
 +@end table
 +
 +Default value is @samp{frame}.
 +
 +@item shortest
 +If set to 1, force the output to terminate when the shortest input
 +terminates. Default value is 0.
 +
 +@item format
 +Set the format for the output video.
 +
 +It accepts the following values:
 +@table @samp
 +@item yuv420
 +force YUV420 output
 +
 +@item yuv444
 +force YUV444 output
 +
 +@item rgb
 +force RGB output
 +@end table
 +
 +Default value is @samp{yuv420}.
 +
 +@item rgb @emph{(deprecated)}
 +If set to 1, force the filter to accept inputs in the RGB
 +color space. Default value is 0. This option is deprecated, use
 +@option{format} instead.
 +@end table
 +
 +The @option{x}, @option{y}, and @option{enable} expressions can
 +contain the following parameters.
 +
 +@table @option
 +@item main_w, W
 +@item main_h, H
 +main input width and height
 +
 +@item overlay_w, w
 +@item overlay_h, h
 +overlay input width and height
 +
 +@item x
 +@item y
 +the computed values for @var{x} and @var{y}. They are evaluated for
 +each new frame.
 +
 +@item hsub
 +@item vsub
 +horizontal and vertical chroma subsample values of the output
 +format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
 +@var{vsub} is 1.
 +
 +@item n
 +the number of input frame, starting from 0
 +
 +@item pos
 +the position in the file of the input frame, NAN if unknown
 +
 +@item t
 +timestamp expressed in seconds, NAN if the input timestamp is unknown
 +@end table
 +
 +Note that the @var{n}, @var{pos}, @var{t} variables are available only
 +when evaluation is done @emph{per frame}, and will evaluate to NAN
 +when @option{eval} is set to @samp{init}.
 +
 +Be aware that frames are taken from each input video in timestamp
 +order, hence, if their initial timestamps differ, it is a a good idea
 +to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
 +have them begin in the same zero timestamp, as it does the example for
 +the @var{movie} filter.
 +
 +You can chain together more overlays but you should test the
 +efficiency of such approach.
 +
 +@subsection Commands
 +
 +This filter supports the following command:
 +@table @option
 +@item x
 +Set the @option{x} option expression.
 +
 +@item y
 +Set the @option{y} option expression.
 +
 +@item enable
 +Set the @option{enable} option expression.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Draw the overlay at 10 pixels from the bottom right corner of the main
 +video:
 +@example
 +overlay=main_w-overlay_w-10:main_h-overlay_h-10
 +@end example
 +
 +Using named options the example above becomes:
 +@example
 +overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
 +@end example
 +
 +@item
 +Insert a transparent PNG logo in the bottom left corner of the input,
 +using the @command{ffmpeg} tool with the @code{-filter_complex} option:
 +@example
 +ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
 +@end example
 +
 +@item
 +Insert 2 different transparent PNG logos (second logo on bottom
 +right corner) using the @command{ffmpeg} tool:
 +@example
 +ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=10:H-h-10,overlay=W-w-10:H-h-10' output
 +@end example
 +
 +@item
 +Add a transparent color layer on top of the main video, @code{WxH}
 +must specify the size of the main input to the overlay filter:
 +@example
 +color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
 +@end example
 +
 +@item
 +Play an original video and a filtered version (here with the deshake
 +filter) side by side using the @command{ffplay} tool:
 +@example
 +ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
 +@end example
 +
 +The above command is the same as:
 +@example
 +ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
 +@end example
 +
 +@item
 +Make a sliding overlay appearing from the left to the right top part of the
 +screen starting since time 2:
 +@example
 +overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
 +@end example
 +
 +@item
 +Compose output by putting two input videos side to side:
 +@example
 +ffmpeg -i left.avi -i right.avi -filter_complex "
 +nullsrc=size=200x100 [background];
 +[0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
 +[1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
 +[background][left]       overlay=shortest=1       [background+left];
 +[background+left][right] overlay=shortest=1:x=100 [left+right]
 +"
 +@end example
 +
 +@item
 +Chain several overlays in cascade:
 +@example
 +nullsrc=s=200x200 [bg];
 +testsrc=s=100x100, split=4 [in0][in1][in2][in3];
 +[in0] lutrgb=r=0, [bg]   overlay=0:0     [mid0];
 +[in1] lutrgb=g=0, [mid0] overlay=100:0   [mid1];
 +[in2] lutrgb=b=0, [mid1] overlay=0:100   [mid2];
 +[in3] null,       [mid2] overlay=100:100 [out0]
 +@end example
 +
 +@end itemize
 +
 +@section pad
 +
 +Add paddings to the input image, and place the original input at the
 +given coordinates @var{x}, @var{y}.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value} pairs,
 +separated by ":".
 +
 +If the key of the first options is omitted, the arguments are
 +interpreted according to the syntax
 +@var{width}:@var{height}:@var{x}:@var{y}:@var{color}.
 +
 +A description of the accepted options follows.
 +
 +@table @option
 +@item width, w
 +@item height, h
 +Specify an expression for the size of the output image with the
 +paddings added. If the value for @var{width} or @var{height} is 0, the
 +corresponding input size is used for the output.
 +
 +The @var{width} expression can reference the value set by the
 +@var{height} expression, and vice versa.
 +
 +The default value of @var{width} and @var{height} is 0.
 +
 +@item x
 +@item y
 +Specify an expression for the offsets where to place the input image
 +in the padded area with respect to the top/left border of the output
 +image.
 +
 +The @var{x} expression can reference the value set by the @var{y}
 +expression, and vice versa.
 +
 +The default value of @var{x} and @var{y} is 0.
 +
 +@item color
 +Specify the color of the padded area, it can be the name of a color
 +(case insensitive match) or a 0xRRGGBB[AA] sequence.
 +
 +The default value of @var{color} is "black".
 +@end table
 +
 +The value for the @var{width}, @var{height}, @var{x}, and @var{y}
 +options are expressions containing the following constants:
 +
 +@table @option
 +@item in_w, in_h
 +the input video width and height
 +
 +@item iw, ih
 +same as @var{in_w} and @var{in_h}
 +
 +@item out_w, out_h
 +the output width and height, that is the size of the padded area as
 +specified by the @var{width} and @var{height} expressions
 +
 +@item ow, oh
 +same as @var{out_w} and @var{out_h}
 +
 +@item x, y
 +x and y offsets as specified by the @var{x} and @var{y}
 +expressions, or NAN if not yet specified
 +
 +@item a
 +same as @var{iw} / @var{ih}
 +
 +@item sar
 +input sample aspect ratio
 +
 +@item dar
 +input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
 +
 +@item hsub, vsub
 +horizontal and vertical chroma subsample values. For example for the
 +pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Add paddings with color "violet" to the input video. Output video
 +size is 640x480, the top-left corner of the input video is placed at
 +column 0, row 40:
 +@example
 +pad=640:480:0:40:violet
 +@end example
 +
 +The example above is equivalent to the following command:
 +@example
 +pad=width=640:height=480:x=0:y=40:color=violet
 +@end example
 +
 +@item
 +Pad the input to get an output with dimensions increased by 3/2,
 +and put the input video at the center of the padded area:
 +@example
 +pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
 +@end example
 +
 +@item
 +Pad the input to get a squared output with size equal to the maximum
 +value between the input width and height, and put the input video at
 +the center of the padded area:
 +@example
 +pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
 +@end example
 +
 +@item
 +Pad the input to get a final w/h ratio of 16:9:
 +@example
 +pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
 +@end example
 +
 +@item
 +In case of anamorphic video, in order to set the output display aspect
 +correctly, it is necessary to use @var{sar} in the expression,
 +according to the relation:
 +@example
 +(ih * X / ih) * sar = output_dar
 +X = output_dar / sar
 +@end example
 +
 +Thus the previous example needs to be modified to:
 +@example
 +pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
 +@end example
 +
 +@item
 +Double output size and put the input video in the bottom-right
 +corner of the output padded area:
 +@example
 +pad="2*iw:2*ih:ow-iw:oh-ih"
 +@end example
 +@end itemize
 +
 +@section pixdesctest
 +
 +Pixel format descriptor test filter, mainly useful for internal
 +testing. The output video should be equal to the input video.
 +
 +For example:
 +@example
 +format=monow, pixdesctest
 +@end example
 +
 +can be used to test the monowhite pixel format descriptor definition.
 +
 +@section pp
 +
 +Enable the specified chain of postprocessing subfilters using libpostproc. This
 +library should be automatically selected with a GPL build (@code{--enable-gpl}).
 +Subfilters must be separated by '/' and can be disabled by prepending a '-'.
 +Each subfilter and some options have a short and a long name that can be used
 +interchangeably, i.e. dr/dering are the same.
 +
 +All subfilters share common options to determine their scope:
 +
 +@table @option
 +@item a/autoq
 +Honor the quality commands for this subfilter.
 +
 +@item c/chrom
 +Do chrominance filtering, too (default).
 +
 +@item y/nochrom
 +Do luminance filtering only (no chrominance).
 +
 +@item n/noluma
 +Do chrominance filtering only (no luminance).
 +@end table
 +
 +These options can be appended after the subfilter name, separated by a ':'.
 +
 +Available subfilters are:
 +
 +@table @option
 +@item hb/hdeblock[:difference[:flatness]]
 +Horizontal deblocking filter
 +@table @option
 +@item difference
 +Difference factor where higher values mean more deblocking (default: @code{32}).
 +@item flatness
 +Flatness threshold where lower values mean more deblocking (default: @code{39}).
 +@end table
 +
 +@item vb/vdeblock[:difference[:flatness]]
 +Vertical deblocking filter
 +@table @option
 +@item difference
 +Difference factor where higher values mean more deblocking (default: @code{32}).
 +@item flatness
 +Flatness threshold where lower values mean more deblocking (default: @code{39}).
 +@end table
 +
 +@item ha/hadeblock[:difference[:flatness]]
 +Accurate horizontal deblocking filter
 +@table @option
 +@item difference
 +Difference factor where higher values mean more deblocking (default: @code{32}).
 +@item flatness
 +Flatness threshold where lower values mean more deblocking (default: @code{39}).
 +@end table
 +
 +@item va/vadeblock[:difference[:flatness]]
 +Accurate vertical deblocking filter
 +@table @option
 +@item difference
 +Difference factor where higher values mean more deblocking (default: @code{32}).
 +@item flatness
 +Flatness threshold where lower values mean more deblocking (default: @code{39}).
 +@end table
 +@end table
 +
 +The horizontal and vertical deblocking filters share the difference and
 +flatness values so you cannot set different horizontal and vertical
 +thresholds.
 +
 +@table @option
 +@item h1/x1hdeblock
 +Experimental horizontal deblocking filter
 +
 +@item v1/x1vdeblock
 +Experimental vertical deblocking filter
 +
 +@item dr/dering
 +Deringing filter
 +
 +@item tn/tmpnoise[:threshold1[:threshold2[:threshold3]]], temporal noise reducer
 +@table @option
 +@item threshold1
 +larger -> stronger filtering
 +@item threshold2
 +larger -> stronger filtering
 +@item threshold3
 +larger -> stronger filtering
 +@end table
 +
 +@item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
 +@table @option
 +@item f/fullyrange
 +Stretch luminance to @code{0-255}.
 +@end table
 +
 +@item lb/linblenddeint
 +Linear blend deinterlacing filter that deinterlaces the given block by
 +filtering all lines with a @code{(1 2 1)} filter.
 +
 +@item li/linipoldeint
 +Linear interpolating deinterlacing filter that deinterlaces the given block by
 +linearly interpolating every second line.
 +
 +@item ci/cubicipoldeint
 +Cubic interpolating deinterlacing filter deinterlaces the given block by
 +cubically interpolating every second line.
 +
 +@item md/mediandeint
 +Median deinterlacing filter that deinterlaces the given block by applying a
 +median filter to every second line.
 +
 +@item fd/ffmpegdeint
 +FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
 +second line with a @code{(-1 4 2 4 -1)} filter.
 +
 +@item l5/lowpass5
 +Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
 +block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
 +
 +@item fq/forceQuant[:quantizer]
 +Overrides the quantizer table from the input with the constant quantizer you
 +specify.
 +@table @option
 +@item quantizer
 +Quantizer to use
 +@end table
 +
 +@item de/default
 +Default pp filter combination (@code{hb:a,vb:a,dr:a})
 +
 +@item fa/fast
 +Fast pp filter combination (@code{h1:a,v1:a,dr:a})
 +
 +@item ac
 +High quality pp filter combination (@code{ha:a:128:7,va:a,dr:a})
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Apply horizontal and vertical deblocking, deringing and automatic
 +brightness/contrast:
 +@example
 +pp=hb/vb/dr/al
 +@end example
 +
 +@item
 +Apply default filters without brightness/contrast correction:
 +@example
 +pp=de/-al
 +@end example
 +
 +@item
 +Apply default filters and temporal denoiser:
 +@example
 +pp=default/tmpnoise:1:2:3
 +@end example
 +
 +@item
 +Apply deblocking on luminance only, and switch vertical deblocking on or off
 +automatically depending on available CPU time:
 +@example
 +pp=hb:y/vb:a
 +@end example
 +@end itemize
 +
 +@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 (resize) the input video, using the libswscale library.
 +
 +The scale filter forces the output display aspect ratio to be the same
 +of the input, by changing the output sample aspect ratio.
 +
 +This filter accepts a list of named options in the form of
 +@var{key}=@var{value} pairs separated by ":". If the key for the first
 +two options is not specified, the assumed keys for the first two
 +values are @code{w} and @code{h}. If the first option has no key and
 +can be interpreted like a video size specification, it will be used
 +to set the video size.
 +
 +A description of the accepted options follows.
 +
 +@table @option
 +@item width, w
 +Set the video width expression, default value is @code{iw}. See below
 +for the list of accepted constants.
 +
 +@item height, h
 +Set the video heiht expression, default value is @code{ih}.
 +See below for the list of accepted constants.
 +
 +@item interl
 +Set the interlacing. It accepts the following values:
 +
 +@table @option
 +@item 1
 +force interlaced aware scaling
 +
 +@item 0
 +do not apply interlaced scaling
 +
 +@item -1
 +select interlaced aware scaling depending on whether the source frames
 +are flagged as interlaced or not
 +@end table
 +
 +Default value is @code{0}.
 +
 +@item flags
 +Set libswscale scaling flags. If not explictly specified the filter
 +applies a bilinear scaling algorithm.
 +
 +@item size, s
 +Set the video size, the value must be a valid abbreviation or in the
 +form @var{width}x@var{height}.
 +@end table
 +
 +The values of the @var{w} and @var{h} options are expressions
 +containing the following constants:
 +
 +@table @option
 +@item in_w, in_h
 +the input width and height
 +
 +@item iw, ih
 +same as @var{in_w} and @var{in_h}
 +
 +@item out_w, out_h
 +the output (cropped) width and height
 +
 +@item ow, oh
 +same as @var{out_w} and @var{out_h}
 +
 +@item a
 +same as @var{iw} / @var{ih}
 +
 +@item sar
 +input sample aspect ratio
 +
 +@item dar
 +input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
 +
 +@item hsub, vsub
 +horizontal and vertical chroma subsample values. For example for the
 +pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
 +@end table
 +
 +If the input image format is different from the format requested by
 +the next filter, the scale filter will convert the input to the
 +requested format.
 +
 +If the value for @var{width} or @var{height} is 0, the respective input
 +size is used for the output.
 +
 +If the value for @var{width} or @var{height} is -1, the scale filter will
 +use, for the respective output size, a value that maintains the aspect
 +ratio of the input image.
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Scale the input video to a size of 200x100:
 +@example
 +scale=200:100
 +@end example
 +
 +This is equivalent to:
 +@example
 +scale=w=200:h=100
 +@end example
 +
 +or:
 +@example
 +scale=200x100
 +@end example
 +
 +@item
 +Specify a size abbreviation for the output size:
 +@example
 +scale=qcif
 +@end example
 +
 +which can also be written as:
 +@example
 +scale=size=qcif
 +@end example
 +
 +@item
 +Scale the input to 2x:
 +@example
 +scale=2*iw:2*ih
 +@end example
 +
 +@item
 +The above is the same as:
 +@example
 +scale=2*in_w:2*in_h
 +@end example
 +
 +@item
 +Scale the input to 2x with forced interlaced scaling:
 +@example
 +scale=2*iw:2*ih:interl=1
 +@end example
 +
 +@item
 +Scale the input to half size:
 +@example
 +scale=iw/2:ih/2
 +@end example
 +
 +@item
 +Increase the width, and set the height to the same size:
 +@example
 +scale=3/2*iw:ow
 +@end example
 +
 +@item
 +Seek for Greek harmony:
 +@example
 +scale=iw:1/PHI*iw
 +scale=ih*PHI:ih
 +@end example
 +
 +@item
 +Increase the height, and set the width to 3/2 of the height:
 +@example
 +scale=3/2*oh:3/5*ih
 +@end example
 +
 +@item
 +Increase the size, but make the size a multiple of the chroma
 +subsample values:
 +@example
 +scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
 +@end example
 +
 +@item
 +Increase the width to a maximum of 500 pixels, keep the same input
 +aspect ratio:
 +@example
 +scale='min(500\, iw*3/2):-1'
 +@end example
 +@end itemize
 +
 +@section separatefields
 +
 +The @code{separatefields} takes a frame-based video input and splits
 +each frame into its components fields, producing a new half height clip
 +with twice the frame rate and twice the frame count.
 +
 +This filter use field-dominance information in frame to decide which
 +of each pair of fields to place first in the output.
 +If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
 +
 +@section setdar, setsar
 +
 +The @code{setdar} filter sets the Display Aspect Ratio for the filter
 +output video.
 +
 +This is done by changing the specified Sample (aka Pixel) Aspect
 +Ratio, according to the following equation:
 +@example
 +@var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
 +@end example
 +
 +Keep in mind that the @code{setdar} filter does not modify the pixel
 +dimensions of the video frame. Also the display aspect ratio set by
 +this filter may be changed by later filters in the filterchain,
 +e.g. in case of scaling or if another "setdar" or a "setsar" filter is
 +applied.
 +
 +The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
 +the filter output video.
 +
 +Note that as a consequence of the application of this filter, the
 +output display aspect ratio will change according to the equation
 +above.
 +
 +Keep in mind that the sample aspect ratio set by the @code{setsar}
 +filter may be changed by later filters in the filterchain, e.g. if
 +another "setsar" or a "setdar" filter is applied.
 +
 +The @code{setdar} and @code{setsar} filters accept a string in the
 +form @var{num}:@var{den} expressing an aspect ratio, or the following
 +named options, expressed as a sequence of @var{key}=@var{value} pairs,
 +separated by ":".
 +
 +@table @option
 +@item max
 +Set the maximum integer value to use for expressing numerator and
 +denominator when reducing the expressed aspect ratio to a rational.
 +Default value is @code{100}.
 +
- @item r, ratio:
++@item r, ratio, dar, sar:
 +Set the aspect ratio used by the filter.
 +
 +The parameter can be a floating point number string, an expression, or
 +a string of the form @var{num}:@var{den}, where @var{num} and
 +@var{den} are the numerator and denominator of the aspect ratio. If
 +the parameter is not specified, it is assumed the value "0".
 +In case the form "@var{num}:@var{den}" the @code{:} character should
 +be escaped.
 +@end table
 +
 +If the keys are omitted in the named options list, the specifed values
 +are assumed to be @var{ratio} and @var{max} in that order.
 +
 +For example to change the display aspect ratio to 16:9, specify:
 +@example
 +setdar='16:9'
- @end example
- The example above is equivalent to:
- @example
++# the above is equivalent to
 +setdar=1.77777
++setdar=dar=16/9
++setdar=dar=1.77777
 +@end example
 +
 +To change the sample aspect ratio to 10:11, specify:
 +@example
 +setsar='10:11'
++# the above is equivalent to
++setsar='sar=10/11'
 +@end example
 +
 +To set a display aspect ratio of 16:9, and specify a maximum integer value of
 +1000 in the aspect ratio reduction, use the command:
 +@example
 +setdar=ratio='16:9':max=1000
 +@end example
 +
 +@anchor{setfield}
 +@section setfield
 +
 +Force field for the output video frame.
 +
 +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
 +following filters (e.g. @code{fieldorder} or @code{yadif}).
  
 -The flags map the corresponding flags supported by libfreetype, and are
 -a combination of the following values:
 -@table @var
 -@item default
 -@item no_scale
 -@item no_hinting
 -@item render
 -@item no_bitmap
 -@item vertical_layout
 -@item force_autohint
 -@item crop_bitmap
 -@item pedantic
 -@item ignore_global_advance_width
 -@item no_recurse
 -@item ignore_transform
 -@item monochrome
 -@item linear_design
 -@item no_autohint
 -@item end table
 +This filter accepts a single option @option{mode}, which can be
 +specified either by setting @code{mode=VALUE} or setting the value
 +alone. Available values are:
 +
 +@table @samp
 +@item auto
 +Keep the same field property.
 +
 +@item bff
 +Mark the frame as bottom-field-first.
 +
 +@item tff
 +Mark the frame as top-field-first.
 +
 +@item prog
 +Mark the frame as progressive.
  @end table
  
 -Default value is "render".
 +@section showinfo
  
 -For more information consult the documentation for the FT_LOAD_*
 -libfreetype flags.
 +Show a line containing various information for each input video frame.
 +The input video is not modified.
  
 -@item tabsize
 -The size in number of spaces to use for rendering the tab.
 -Default value is 4.
 +The shown line contains a sequence of key/value pairs of the form
 +@var{key}:@var{value}.
  
 -@item fix_bounds
 -If true, check and fix text coords to avoid clipping.
 +A description of each shown parameter follows:
 +
 +@table @option
 +@item n
 +sequential number of the input frame, starting from 0
 +
 +@item pts
 +Presentation TimeStamp of the input frame, expressed as a number of
 +time base units. The time base unit depends on the filter input pad.
 +
 +@item pts_time
 +Presentation TimeStamp of the input frame, expressed as a number of
 +seconds
 +
 +@item pos
 +position of the frame in the input stream, -1 if this information in
 +unavailable and/or meaningless (for example in case of synthetic video)
 +
 +@item fmt
 +pixel format name
 +
 +@item sar
 +sample aspect ratio of the input frame, expressed in the form
 +@var{num}/@var{den}
 +
 +@item s
 +size of the input frame, expressed in the form
 +@var{width}x@var{height}
 +
 +@item i
 +interlaced mode ("P" for "progressive", "T" for top field first, "B"
 +for bottom field first)
 +
 +@item iskey
 +1 if the frame is a key frame, 0 otherwise
 +
 +@item type
 +picture type of the input frame ("I" for an I-frame, "P" for a
 +P-frame, "B" for a B-frame, "?" for unknown type).
 +Check also the documentation of the @code{AVPictureType} enum and of
 +the @code{av_get_picture_type_char} function defined in
 +@file{libavutil/avutil.h}.
 +
 +@item checksum
 +Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
 +
 +@item plane_checksum
 +Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
 +expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]"
 +@end table
 +
 +@section smartblur
 +
 +Blur the input video without impacting the outlines.
 +
 +This filter accepts parameters as a list of @var{key}=@var{value} pairs,
 +separated by ":".
 +
 +If the key of the first options is omitted, the arguments are
 +interpreted according to the syntax:
 +@var{luma_radius}:@var{luma_strength}:@var{luma_threshold}[:@var{chroma_radius}:@var{chroma_strength}:@var{chroma_threshold}]
 +
 +A description of the accepted options follows.
 +
 +@table @option
 +@item luma_radius, lr
 +@item chroma_radius, cr
 +Set the luma/chroma radius. The option value must be a float number in
 +the range [0.1,5.0] that specifies the variance of the gaussian filter
 +used to blur the image (slower if larger). Default value is 1.0.
 +
 +@item luma_strength, ls
 +@item chroma_strength, cs
 +Set the luma/chroma strength. The option value must be a float number
 +in the range [-1.0,1.0] that configures the blurring. A value included
 +in [0.0,1.0] will blur the image whereas a value included in
 +[-1.0,0.0] will sharpen the image. Default value is 1.0.
 +
 +@item luma_threshold, lt
 +@item chroma_threshold, ct
 +Set the luma/chroma threshold used as a coefficient to determine
 +whether a pixel should be blurred or not. The option value must be an
 +integer in the range [-30,30]. A value of 0 will filter all the image,
 +a value included in [0,30] will filter flat areas and a value included
 +in [-30,0] will filter edges. Default value is 0.
 +@end table
 +
 +If a chroma option is not explicitly set, the corresponding luma value
 +is set.
 +
 +@section stereo3d
 +
 +Convert between different stereoscopic image formats.
 +
 +This filter accepts the following named options, expressed as a
 +sequence of @var{key}=@var{value} pairs, separated by ":".
 +
 +@table @option
 +@item in
 +Set stereoscopic image format of input.
 +
 +Available values for input image formats are:
 +@table @samp
 +@item sbsl
 +side by side parallel (left eye left, right eye right)
 +
 +@item sbsr
 +side by side crosseye (right eye left, left eye right)
 +
 +@item sbs2l
 +side by side parallel with half width resolution
 +(left eye left, right eye right)
 +
 +@item sbs2r
 +side by side crosseye with half width resolution
 +(right eye left, left eye right)
 +
 +@item abl
 +above-below (left eye above, right eye below)
 +
 +@item abr
 +above-below (right eye above, left eye below)
 +
 +@item ab2l
 +above-below with half height resolution
 +(left eye above, right eye below)
 +
 +@item ab2r
 +above-below with half height resolution
 +(right eye above, left eye below)
 +
 +Default value is @samp{sbsl}.
 +@end table
 +
 +@item out
 +Set stereoscopic image format of output.
 +
 +Available values for output image formats are all the input formats as well as:
 +@table @samp
 +@item arbg
 +anaglyph red/blue gray
 +(red filter on left eye, blue filter on right eye)
 +
 +@item argg
 +anaglyph red/green gray
 +(red filter on left eye, green filter on right eye)
 +
 +@item arcg
 +anaglyph red/cyan gray
 +(red filter on left eye, cyan filter on right eye)
 +
 +@item arch
 +anaglyph red/cyan half colored
 +(red filter on left eye, cyan filter on right eye)
 +
 +@item arcc
 +anaglyph red/cyan color
 +(red filter on left eye, cyan filter on right eye)
 +
 +@item arcd
 +anaglyph red/cyan color optimized with the least squares projection of dubois
 +(red filter on left eye, cyan filter on right eye)
 +
 +@item agmg
 +anaglyph green/magenta gray
 +(green filter on left eye, magenta filter on right eye)
 +
 +@item agmh
 +anaglyph green/magenta half colored
 +(green filter on left eye, magenta filter on right eye)
 +
 +@item agmc
 +anaglyph green/magenta colored
 +(green filter on left eye, magenta filter on right eye)
 +
 +@item agmd
 +anaglyph green/magenta color optimized with the least squares projection of dubois
 +(green filter on left eye, magenta filter on right eye)
 +
 +@item aybg
 +anaglyph yellow/blue gray
 +(yellow filter on left eye, blue filter on right eye)
 +
 +@item aybh
 +anaglyph yellow/blue half colored
 +(yellow filter on left eye, blue filter on right eye)
 +
 +@item aybc
 +anaglyph yellow/blue colored
 +(yellow filter on left eye, blue filter on right eye)
 +
 +@item aybd
 +anaglyph yellow/blue color optimized with the least squares projection of dubois
 +(yellow filter on left eye, blue filter on right eye)
 +
 +@item irl
 +interleaved rows (left eye has top row, right eye starts on next row)
 +
 +@item irr
 +interleaved rows (right eye has top row, left eye starts on next row)
 +
 +@item ml
 +mono output (left eye only)
 +
 +@item mr
 +mono output (right eye only)
 +@end table
 +
 +Default value is @samp{arcd}.
 +@end table
 +
 +@anchor{subtitles}
 +@section subtitles
 +
 +Draw subtitles on top of input video using the libass library.
 +
 +To enable compilation of this filter you need to configure FFmpeg with
 +@code{--enable-libass}. This filter also requires a build with libavcodec and
 +libavformat to convert the passed subtitles file to ASS (Advanced Substation
 +Alpha) subtitles format.
 +
 +This filter accepts the following named options, expressed as a
 +sequence of @var{key}=@var{value} pairs, separated by ":".
 +
 +@table @option
 +@item filename, f
 +Set the filename of the subtitle file to read. It must be specified.
 +
 +@item original_size
 +Specify 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.
 +
 +@item charenc
 +Set subtitles input character encoding. @code{subtitles} filter only. Only
 +useful if not UTF-8.
  @end table
  
 -For example the command:
 +If the first key is not specified, it is assumed that the first value
 +specifies the @option{filename}.
 +
 +For example, to render the file @file{sub.srt} on top of the input
 +video, use the command:
  @example
 -drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
 +subtitles=sub.srt
 +@end example
 +
 +which is equivalent to:
 +@example
 +subtitles=filename=sub.srt
  @end example
  
 -will draw "Test Text" with font FreeSerif, using the default values
 -for the optional parameters.
 +@section split
 +
 +Split input video into several identical outputs.
 +
 +The filter accepts a single parameter which specifies the number of outputs. If
 +unspecified, it defaults to 2.
  
 -The command:
 +For example
  @example
 -drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
 -          x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
 +ffmpeg -i INPUT -filter_complex split=5 OUTPUT
  @end example
 +will create 5 copies of the input video.
  
 -will draw 'Test Text' with font FreeSerif of size 24 at position x=100
 -and y=50 (counting from the top-left corner of the screen), text is
 -yellow with a red box around it. Both the text and the box have an
 -opacity of 20%.
 +For example:
 +@example
 +[in] split [splitout1][splitout2];
 +[splitout1] crop=100:100:0:0    [cropout];
 +[splitout2] pad=200:200:100:100 [padout];
 +@end example
  
 -Note that the double quotes are not necessary if spaces are not used
 -within the parameter list.
 +will create two separate outputs from the same input, one cropped and
 +one padded.
  
 -For more information about libfreetype, check:
 -@url{http://www.freetype.org/}.
 +@section super2xsai
  
 -@section fade
 +Scale the input by 2x and smooth using the Super2xSaI (Scale and
 +Interpolate) pixel art scaling algorithm.
  
 -Apply fade-in/out effect to input video.
 +Useful for enlarging pixel art images without reducing sharpness.
 +
 +@section swapuv
 +Swap U & V plane.
 +
 +@section thumbnail
 +Select the most representative frame in a given sequence of consecutive frames.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax
 +thumbnail[=@var{n}].
 +
 +@table @option
 +@item n
 +Set the frames batch size to analyze; in a set of @var{n} frames, the filter
 +will pick one of them, and then handle the next batch of @var{n} frames until
 +the end. Default is @code{100}.
 +@end table
 +
 +Since the filter keeps track of the whole frames sequence, a bigger @var{n}
 +value will result in a higher memory usage, so a high value is not recommended.
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Extract one picture each 50 frames:
 +@example
 +thumbnail=50
 +@end example
 +
 +@item
 +Complete example of a thumbnail creation with @command{ffmpeg}:
 +@example
 +ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
 +@end example
 +@end itemize
 +
 +@section tile
 +
 +Tile several successive frames together.
 +
 +It accepts a list of options in the form of @var{key}=@var{value} pairs
 +separated by ":". A description of the accepted options follows.
 +
 +@table @option
 +
 +@item layout
 +Set the grid size (i.e. the number of lines and columns) in the form
 +"@var{w}x@var{h}".
 +
 +@item margin
 +Set the outer border margin in pixels.
 +
 +@item padding
 +Set the inner border thickness (i.e. the number of pixels between frames). For
 +more advanced padding options (such as having different values for the edges),
 +refer to the pad video filter.
 +
 +@item nb_frames
 +Set the maximum number of frames to render in the given area. It must be less
 +than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
 +the area will be used.
 +
 +@end table
 +
 +Alternatively, the options can be specified as a flat string:
 +
 +@var{layout}[:@var{nb_frames}[:@var{margin}[:@var{padding}]]]
 +
 +For example, produce 8x8 PNG tiles of all keyframes (@option{-skip_frame
 +nokey}) in a movie:
 +@example
 +ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
 +@end example
 +The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
 +duplicating each output frame to accomodate the originally detected frame
 +rate.
 +
 +Another example to display @code{5} pictures in an area of @code{3x2} frames,
 +with @code{7} pixels between them, and @code{2} pixels of initial margin, using
 +mixed flat and named options:
 +@example
 +tile=3x2:nb_frames=5:padding=7:margin=2
 +@end example
 +
 +@section tinterlace
 +
 +Perform various types of temporal field interlacing.
 +
 +Frames are counted starting from 1, so the first input frame is
 +considered odd.
 +
 +This filter accepts options in the form of @var{key}=@var{value} pairs
 +separated by ":".
 +Alternatively, the @var{mode} option can be specified as a value alone,
 +optionally followed by a ":" and further ":" separated @var{key}=@var{value}
 +pairs.
 +
 +A description of the accepted options follows.
 +
 +@table @option
 +
 +@item mode
 +Specify the mode of the interlacing. This option can also be specified
 +as a value alone. See below for a list of values for this option.
 +
 +Available values are:
 +
 +@table @samp
 +@item merge, 0
 +Move odd frames into the upper field, even into the lower field,
 +generating a double height frame at half frame rate.
 +
 +@item drop_odd, 1
 +Only output even frames, odd frames are dropped, generating a frame with
 +unchanged height at half frame rate.
 +
 +@item drop_even, 2
 +Only output odd frames, even frames are dropped, generating a frame with
 +unchanged height at half frame rate.
 +
 +@item pad, 3
 +Expand each frame to full height, but pad alternate lines with black,
 +generating a frame with double height at the same input frame rate.
 +
 +@item interleave_top, 4
 +Interleave the upper field from odd frames with the lower field from
 +even frames, generating a frame with unchanged height at half frame rate.
 +
 +@item interleave_bottom, 5
 +Interleave the lower field from odd frames with the upper field from
 +even frames, generating a frame with unchanged height at half frame rate.
 +
 +@item interlacex2, 6
 +Double frame rate with unchanged height. Frames are inserted each
 +containing the second temporal field from the previous input frame and
 +the first temporal field from the next input frame. This mode relies on
 +the top_field_first flag. Useful for interlaced video displays with no
 +field synchronisation.
 +@end table
 +
 +Numeric values are deprecated but are accepted for backward
 +compatibility reasons.
 +
 +Default mode is @code{merge}.
 +
 +@item flags
 +Specify flags influencing the filter process.
 +
 +Available value for @var{flags} is:
 +
 +@table @option
 +@item low_pass_filter, vlfp
 +Enable vertical low-pass filtering in the filter.
 +Vertical low-pass filtering is required when creating an interlaced
 +destination from a progressive source which contains high-frequency
 +vertical detail. Filtering will reduce interlace 'twitter' and Moire
 +patterning.
 +
 +Vertical low-pass filtering can only be enabled for @option{mode}
 +@var{interleave_top} and @var{interleave_bottom}.
 +
 +@end table
 +@end table
 +
 +@section transpose
 +
 +Transpose rows with columns in the input video and optionally flip it.
 +
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ':'. If the key of the first options is omitted,
 +the arguments are interpreted according to the syntax
 +@var{dir}:@var{passthrough}.
 +
 +@table @option
 +@item dir
 +Specify the transposition direction. Can assume the following values:
 +
 +@table @samp
 +@item 0, 4
 +Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
 +@example
 +L.R     L.l
 +. . ->  . .
 +l.r     R.r
 +@end example
 +
 +@item 1, 5
 +Rotate by 90 degrees clockwise, that is:
 +@example
 +L.R     l.L
 +. . ->  . .
 +l.r     r.R
 +@end example
 +
 +@item 2, 6
 +Rotate by 90 degrees counterclockwise, that is:
 +@example
 +L.R     R.r
 +. . ->  . .
 +l.r     L.l
 +@end example
  
 -It accepts the parameters:
 -@var{type}:@var{start_frame}:@var{nb_frames}
 +@item 3, 7
 +Rotate by 90 degrees clockwise and vertically flip, that is:
 +@example
 +L.R     r.R
 +. . ->  . .
 +l.r     l.L
 +@end example
 +@end table
  
 -@var{type} specifies if the effect type, can be either "in" for
 -fade-in, or "out" for a fade-out effect.
 +For values between 4-7, the transposition is only done if the input
 +video geometry is portrait and not landscape. These values are
 +deprecated, the @code{passthrough} option should be used instead.
  
 -@var{start_frame} specifies the number of the start frame for starting
 -to apply the fade effect.
 +@item passthrough
 +Do not apply the transposition if the input geometry matches the one
 +specified by the specified value. It accepts the following values:
 +@table @samp
 +@item none
 +Always apply transposition.
 +@item portrait
 +Preserve portrait geometry (when @var{height} >= @var{width}).
 +@item landscape
 +Preserve landscape geometry (when @var{width} >= @var{height}).
 +@end table
  
 -@var{nb_frames} specifies the number of frames for which the fade
 -effect has to last. At the end of the fade-in effect the output video
 -will have the same intensity as the input video, at the end of the
 -fade-out transition the output video will be completely black.
 +Default value is @code{none}.
 +@end table
  
 -A few usage examples follow, usable too as test scenarios.
 +For example to rotate by 90 degrees clockwise and preserve portrait
 +layout:
  @example
 -# fade in first 30 frames of video
 -fade=in:0:30
 +transpose=dir=1:passthrough=portrait
 +@end example
  
 -# fade out last 45 frames of a 200-frame video
 -fade=out:155:45
 +The command above can also be specified as:
 +@example
 +transpose=1:portrait
 +@end example
  
 -# fade in first 25 frames and fade out last 25 frames of a 1000-frame video
 -fade=in:0:25, fade=out:975:25
 +@section unsharp
  
 -# make first 5 frames black, then fade in from frame 5-24
 -fade=in:5:20
 -@end example
 +Sharpen or blur the input video.
  
 -@section fieldorder
 +This filter accepts parameters as a list of @var{key}=@var{value} pairs,
 +separated by ":".
  
 -Transform the field order of the input video.
 +If the key of the first options is omitted, the arguments are
 +interpreted according to the syntax:
 +@var{luma_msize_x}:@var{luma_msize_y}:@var{luma_amount}:@var{chroma_msize_x}:@var{chroma_msize_y}:@var{chroma_amount}
  
 -It accepts one parameter which specifies the required field order that
 -the input interlaced video will be transformed to. The parameter can
 -assume one of the following values:
 +A description of the accepted options follows.
  
  @table @option
 -@item 0 or bff
 -output bottom field first
 -@item 1 or tff
 -output top field first
 +@item luma_msize_x, lx
 +@item chroma_msize_x, cx
 +Set the luma/chroma matrix horizontal size. It must be an odd integer
 +between 3 and 63, default value is 5.
 +
 +@item luma_msize_y, ly
 +@item chroma_msize_y, cy
 +Set the luma/chroma matrix vertical size. It must be an odd integer
 +between 3 and 63, default value is 5.
 +
 +@item luma_amount, la
 +@item chroma_amount, ca
 +Set the luma/chroma effect strength. It can be a float number,
 +reasonable values lay between -1.5 and 1.5.
 +
 +Negative values will blur the input video, while positive values will
 +sharpen it, a value of zero will disable the effect.
 +
 +Default value is 1.0 for @option{luma_amount}, 0.0 for
 +@option{chroma_amount}.
  @end table
  
 -Default value is "tff".
 -
 -Transformation is achieved by shifting the picture content up or down
 -by one line, and filling the remaining line with appropriate picture content.
 -This method is consistent with most broadcast field order converters.
 -
 -If the input video is not flagged as being interlaced, or it is already
 -flagged as being of the required output field order then this filter does
 -not alter the incoming video.
 +@subsection Examples
  
 -This filter is very useful when converting to or from PAL DV material,
 -which is bottom field first.
 +@itemize
 +@item
 +Apply strong luma sharpen effect:
 +@example
 +unsharp=7:7:2.5
 +@end example
  
 -For example:
 +@item
 +Apply strong blur of both luma and chroma parameters:
  @example
 -./avconv -i in.vob -vf "fieldorder=bff" out.dv
 +unsharp=7:7:-2:7:7:-2
  @end example
 +@end itemize
  
 -@section fifo
 +@section vflip
  
 -Buffer input images and send them when they are requested.
 +Flip the input video vertically.
  
 -This filter is mainly useful when auto-inserted by the libavfilter
 -framework.
 +@example
 +ffmpeg -i in.avi -vf "vflip" out.avi
 +@end example
  
 -The filter does not take parameters.
 +@section yadif
  
 -@section format
 +Deinterlace the input video ("yadif" means "yet another deinterlacing
 +filter").
  
 -Convert the input video to one of the specified pixel formats.
 -Libavfilter will try to pick one that is supported for the input to
 -the next filter.
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":". If the key of the first options is omitted,
 +the arguments are interpreted according to syntax
 +@var{mode}:@var{parity}:@var{deint}.
  
 -This filter accepts the following parameters:
 -@table @option
 +The description of the accepted parameters follows.
  
 -@item pix_fmts
 -A '|'-separated list of pixel format names, for example
 -"pix_fmts=yuv420p|monow|rgb24".
 +@table @option
 +@item mode
 +Specify the interlacing mode to adopt. Accept one of the following
 +values:
  
 +@table @option
 +@item 0, send_frame
 +output 1 frame for each frame
 +@item 1, send_field
 +output 1 frame for each field
 +@item 2, send_frame_nospatial
 +like @code{send_frame} but skip spatial interlacing check
 +@item 3, send_field_nospatial
 +like @code{send_field} but skip spatial interlacing check
  @end table
  
 -Some examples follow:
 -@example
 -# convert the input video to the format "yuv420p"
 -format=pix_fmts=yuv420p
 -
 -# convert the input video to any of the formats in the list
 -format=pix_fmts=yuv420p|yuv444p|yuv410p
 -@end example
 -
 -@section fps
 +Default value is @code{send_frame}.
  
 -Convert the video to specified constant framerate by duplicating or dropping
 -frames as necessary.
 +@item parity
 +Specify the picture field parity assumed for the input interlaced
 +video. Accept one of the following values:
  
 -This filter accepts the following named parameters:
  @table @option
 -
 -@item fps
 -Desired output framerate.
 -
 +@item 0, tff
 +assume top field first
 +@item 1, bff
 +assume bottom field first
 +@item -1, auto
 +enable automatic detection
  @end table
  
 -@anchor{frei0r}
 -@section frei0r
 +Default value is @code{auto}.
 +If interlacing is unknown or decoder does not export this information,
 +top field first will be assumed.
  
 -Apply a frei0r effect to the input video.
 +@item deint
 +Specify which frames to deinterlace. Accept one of the following
 +values:
  
 -To enable compilation of this filter you need to install the frei0r
 -header and configure Libav with --enable-frei0r.
 +@table @option
 +@item 0, all
 +deinterlace all frames
 +@item 1, interlaced
 +only deinterlace frames marked as interlaced
 +@end table
  
 -The filter supports the syntax:
 -@example
 -@var{filter_name}[@{:|=@}@var{param1}:@var{param2}:...:@var{paramN}]
 -@end example
 +Default value is @code{all}.
 +@end table
  
 -@var{filter_name} is the name to the frei0r effect to load. If the
 -environment variable @env{FREI0R_PATH} is defined, the frei0r effect
 -is searched in each one of the directories specified by the colon
 -separated list in @env{FREIOR_PATH}, otherwise in the standard frei0r
 -paths, which are in this order: @file{HOME/.frei0r-1/lib/},
 -@file{/usr/local/lib/frei0r-1/}, @file{/usr/lib/frei0r-1/}.
 +@c man end VIDEO FILTERS
  
 -@var{param1}, @var{param2}, ... , @var{paramN} specify the parameters
 -for the frei0r effect.
 +@chapter Video Sources
 +@c man begin VIDEO SOURCES
  
 -A frei0r effect parameter can be a boolean (whose values are specified
 -with "y" and "n"), a double, a color (specified by the syntax
 -@var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float
 -numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color
 -description), a position (specified by the syntax @var{X}/@var{Y},
 -@var{X} and @var{Y} being float numbers) and a string.
 +Below is a description of the currently available video sources.
  
 -The number and kind of parameters depend on the loaded effect. If an
 -effect parameter is not specified the default value is set.
 +@section buffer
  
 -Some examples follow:
 -@example
 -# apply the distort0r effect, set the first two double parameters
 -frei0r=distort0r:0.5:0.01
 +Buffer video frames, and make them available to the filter chain.
  
 -# apply the colordistance effect, takes a color as first parameter
 -frei0r=colordistance:0.2/0.3/0.4
 -frei0r=colordistance:violet
 -frei0r=colordistance:0x112233
 +This source is mainly intended for a programmatic use, in particular
 +through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  
 -# apply the perspective effect, specify the top left and top right
 -# image positions
 -frei0r=perspective:0.2/0.2:0.8/0.2
 -@end example
 +It accepts a list of options in the form of @var{key}=@var{value} pairs
 +separated by ":". A description of the accepted options follows.
  
 -For more information see:
 -@url{http://piksel.org/frei0r}
 +@table @option
  
 -@section gradfun
 +@item video_size
 +Specify the size (width and height) of the buffered video frames.
  
 -Fix the banding artifacts that are sometimes introduced into nearly flat
 -regions by truncation to 8bit colordepth.
 -Interpolate the gradients that should go where the bands are, and
 -dither them.
 +@item pix_fmt
 +A string representing the pixel format of the buffered video frames.
 +It may be a number corresponding to a pixel format, or a pixel format
 +name.
  
 -This filter is designed for playback only.  Do not use it prior to
 -lossy compression, because compression tends to lose the dither and
 -bring back the bands.
 +@item time_base
 +Specify the timebase assumed by the timestamps of the buffered frames.
  
 -The filter takes two optional parameters, separated by ':':
 -@var{strength}:@var{radius}
 +@item time_base
 +Specify the frame rate expected for the video stream.
  
 -@var{strength} is the maximum amount by which the filter will change
 -any one pixel. Also the threshold for detecting nearly flat
 -regions. Acceptable values range from .51 to 64, default value is
 -1.2, out-of-range values will be clipped to the valid range.
 +@item pixel_aspect
 +Specify the sample aspect ratio assumed by the video frames.
  
 -@var{radius} is the neighborhood to fit the gradient to. A larger
 -radius makes for smoother gradients, but also prevents the filter from
 -modifying the pixels near detailed regions. Acceptable values are
 -8-32, default value is 16, out-of-range values will be clipped to the
 -valid range.
 +@item sws_param
 +Specify the optional parameters to be used for the scale filter which
 +is automatically inserted when an input change is detected in the
 +input size or format.
 +@end table
  
 +For example:
  @example
 -# default parameters
 -gradfun=1.2:16
 -
 -# omitting radius
 -gradfun=1.2
 +buffer=size=320x240:pix_fmt=yuv410p:time_base=1/24:pixel_aspect=1/1
  @end example
  
 -@section hflip
 -
 -Flip the input video horizontally.
 -
 -For example to horizontally flip the input video with @command{avconv}:
 +will instruct the source to accept video frames with size 320x240 and
 +with format "yuv410p", assuming 1/24 as the timestamps timebase and
 +square pixels (1:1 sample aspect ratio).
 +Since the pixel format with name "yuv410p" corresponds to the number 6
 +(check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
 +this example corresponds to:
  @example
 -avconv -i in.avi -vf "hflip" out.avi
 +buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  @end example
  
 -@section hqdn3d
 -
 -High precision/quality 3d denoise filter. This filter aims to reduce
 -image noise producing smooth images and making still images really
 -still. It should enhance compressibility.
 -
 -It accepts the following optional parameters:
 -@var{luma_spatial}:@var{chroma_spatial}:@var{luma_tmp}:@var{chroma_tmp}
 -
 -@table @option
 -@item luma_spatial
 -a non-negative float number which specifies spatial luma strength,
 -defaults to 4.0
 -
 -@item chroma_spatial
 -a non-negative float number which specifies spatial chroma strength,
 -defaults to 3.0*@var{luma_spatial}/4.0
 +Alternatively, the options can be specified as a flat string, but this
 +syntax is deprecated:
  
 -@item luma_tmp
 -a float number which specifies luma temporal strength, defaults to
 -6.0*@var{luma_spatial}/4.0
 +@var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  
 -@item chroma_tmp
 -a float number which specifies chroma temporal strength, defaults to
 -@var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
 -@end table
 +@section cellauto
  
 -@section lut, lutrgb, lutyuv
 +Create a pattern generated by an elementary cellular automaton.
  
 -Compute a look-up table for binding each pixel component input value
 -to an output value, and apply it to input video.
 +The initial state of the cellular automaton can be defined through the
 +@option{filename}, and @option{pattern} options. If such options are
 +not specified an initial state is created randomly.
  
 -@var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
 -to an RGB input video.
 +At each new frame a new row in the video is filled with the result of
 +the cellular automaton next generation. The behavior when the whole
 +frame is filled is defined by the @option{scroll} option.
  
 -These filters accept in input a ":"-separated list of options, which
 -specify the expressions used for computing the lookup table for the
 -corresponding pixel component values.
 +This source accepts a list of options in the form of
 +@var{key}=@var{value} pairs separated by ":". A description of the
 +accepted options follows.
  
 -The @var{lut} filter requires either YUV or RGB pixel formats in
 -input, and accepts the options:
  @table @option
 -@item @var{c0} (first  pixel component)
 -@item @var{c1} (second pixel component)
 -@item @var{c2} (third  pixel component)
 -@item @var{c3} (fourth pixel component, corresponds to the alpha component)
 -@end table
 +@item filename, f
 +Read the initial cellular automaton state, i.e. the starting row, from
 +the specified file.
 +In the file, each non-whitespace character is considered an alive
 +cell, a newline will terminate the row, and further characters in the
 +file will be ignored.
  
 -The exact component associated to each option depends on the format in
 -input.
 +@item pattern, p
 +Read the initial cellular automaton state, i.e. the starting row, from
 +the specified string.
  
 -The @var{lutrgb} filter requires RGB pixel formats in input, and
 -accepts the options:
 -@table @option
 -@item @var{r} (red component)
 -@item @var{g} (green component)
 -@item @var{b} (blue component)
 -@item @var{a} (alpha component)
 -@end table
 +Each non-whitespace character in the string is considered an alive
 +cell, a newline will terminate the row, and further characters in the
 +string will be ignored.
  
 -The @var{lutyuv} filter requires YUV pixel formats in input, and
 -accepts the options:
 -@table @option
 -@item @var{y} (Y/luminance component)
 -@item @var{u} (U/Cb component)
 -@item @var{v} (V/Cr component)
 -@item @var{a} (alpha component)
 -@end table
 +@item rate, r
 +Set the video rate, that is the number of frames generated per second.
 +Default is 25.
  
 -The expressions can contain the following constants and functions:
 +@item random_fill_ratio, ratio
 +Set the random fill ratio for the initial cellular automaton row. It
 +is a floating point number value ranging from 0 to 1, defaults to
 +1/PHI.
  
 -@table @option
 -@item E, PI, PHI
 -the corresponding mathematical approximated values for e
 -(euler number), pi (greek PI), PHI (golden ratio)
 +This option is ignored when a file or a pattern is specified.
  
 -@item w, h
 -the input width and height
 +@item random_seed, seed
 +Set the seed for filling randomly the initial row, must be an integer
 +included between 0 and UINT32_MAX. If not specified, or if explicitly
 +set to -1, the filter will try to use a good random seed on a best
 +effort basis.
  
 -@item val
 -input value for the pixel component
 +@item rule
 +Set the cellular automaton rule, it is a number ranging from 0 to 255.
 +Default value is 110.
  
 -@item clipval
 -the input value clipped in the @var{minval}-@var{maxval} range
 +@item size, s
 +Set the size of the output video.
  
 -@item maxval
 -maximum value for the pixel component
 +If @option{filename} or @option{pattern} is specified, the size is set
 +by default to the width of the specified initial state row, and the
 +height is set to @var{width} * PHI.
  
 -@item minval
 -minimum value for the pixel component
 +If @option{size} is set, it must contain the width of the specified
 +pattern string, and the specified pattern will be centered in the
 +larger row.
  
 -@item negval
 -the negated value for the pixel component value clipped in the
 -@var{minval}-@var{maxval} range , it corresponds to the expression
 -"maxval-clipval+minval"
 +If a filename or a pattern string is not specified, the size value
 +defaults to "320x518" (used for a randomly generated initial state).
  
 -@item clip(val)
 -the computed value in @var{val} clipped in the
 -@var{minval}-@var{maxval} range
 +@item scroll
 +If set to 1, scroll the output upward when all the rows in the output
 +have been already filled. If set to 0, the new generated row will be
 +written over the top row just after the bottom row is filled.
 +Defaults to 1.
  
 -@item gammaval(gamma)
 -the computed gamma correction value of the pixel component value
 -clipped in the @var{minval}-@var{maxval} range, corresponds to the
 -expression
 -"pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
 +@item start_full, full
 +If set to 1, completely fill the output with generated rows before
 +outputting the first frame.
 +This is the default behavior, for disabling set the value to 0.
  
 +@item stitch
 +If set to 1, stitch the left and right row edges together.
 +This is the default behavior, for disabling set the value to 0.
  @end table
  
 -All expressions default to "val".
 +@subsection Examples
  
 -Some examples follow:
 +@itemize
 +@item
 +Read the initial state from @file{pattern}, and specify an output of
 +size 200x400.
  @example
 -# negate input video
 -lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
 -lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
 -
 -# the above is the same as
 -lutrgb="r=negval:g=negval:b=negval"
 -lutyuv="y=negval:u=negval:v=negval"
 -
 -# negate luminance
 -lutyuv=negval
 -
 -# remove chroma components, turns the video into a graytone image
 -lutyuv="u=128:v=128"
 -
 -# apply a luma burning effect
 -lutyuv="y=2*val"
 +cellauto=f=pattern:s=200x400
 +@end example
  
 -# remove green and blue components
 -lutrgb="g=0:b=0"
 +@item
 +Generate a random initial row with a width of 200 cells, with a fill
 +ratio of 2/3:
 +@example
 +cellauto=ratio=2/3:s=200x200
 +@end example
  
 -# set a constant alpha channel value on input
 -format=rgba,lutrgb=a="maxval-minval/2"
 +@item
 +Create a pattern generated by rule 18 starting by a single alive cell
 +centered on an initial row with width 100:
 +@example
 +cellauto=p=@@:s=100x400:full=0:rule=18
 +@end example
  
 -# correct luminance gamma by a 0.5 factor
 -lutyuv=y=gammaval(0.5)
 +@item
 +Specify a more elaborated initial pattern:
 +@example
 +cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  @end example
  
 -@section negate
 -
 -Negate input video.
 +@end itemize
  
 -This filter accepts an integer in input, if non-zero it negates the
 -alpha component (if available). The default value in input is 0.
 +@section mandelbrot
  
 -@section noformat
 +Generate a Mandelbrot set fractal, and progressively zoom towards the
 +point specified with @var{start_x} and @var{start_y}.
  
 -Force libavfilter not to use any of the specified pixel formats for the
 -input to the next filter.
 +This source accepts a list of options in the form of
 +@var{key}=@var{value} pairs separated by ":". A description of the
 +accepted options follows.
  
 -This filter accepts the following parameters:
  @table @option
  
 -@item pix_fmts
 -A '|'-separated list of pixel format names, for example
 -"pix_fmts=yuv420p|monow|rgb24".
 +@item end_pts
 +Set the terminal pts value. Default value is 400.
  
 -@end table
 +@item end_scale
 +Set the terminal scale value.
 +Must be a floating point value. Default value is 0.3.
  
 -Some examples follow:
 -@example
 -# force libavfilter to use a format different from "yuv420p" for the
 -# input to the vflip filter
 -noformat=pix_fmts=yuv420p,vflip
 +@item inner
 +Set the inner coloring mode, that is the algorithm used to draw the
 +Mandelbrot fractal internal region.
  
 -# convert the input video to any of the formats not contained in the list
 -noformat=yuv420p|yuv444p|yuv410p
 -@end example
 +It shall assume one of the following values:
 +@table @option
 +@item black
 +Set black mode.
 +@item convergence
 +Show time until convergence.
 +@item mincol
 +Set color based on point closest to the origin of the iterations.
 +@item period
 +Set period mode.
 +@end table
  
 -@section null
 +Default value is @var{mincol}.
  
 -Pass the video source unchanged to the output.
 +@item bailout
 +Set the bailout value. Default value is 10.0.
  
 -@section ocv
 +@item maxiter
 +Set the maximum of iterations performed by the rendering
 +algorithm. Default value is 7189.
  
 -Apply video transform using libopencv.
 +@item outer
 +Set outer coloring mode.
 +It shall assume one of following values:
 +@table @option
 +@item iteration_count
 +Set iteration cound mode.
 +@item normalized_iteration_count
 +set normalized iteration count mode.
 +@end table
 +Default value is @var{normalized_iteration_count}.
  
 -To enable this filter install libopencv library and headers and
 -configure Libav with --enable-libopencv.
 +@item rate, r
 +Set frame rate, expressed as number of frames per second. Default
 +value is "25".
  
 -The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}.
 +@item size, s
 +Set frame size. Default value is "640x480".
  
 -@var{filter_name} is the name of the libopencv filter to apply.
 +@item start_scale
 +Set the initial scale value. Default value is 3.0.
  
 -@var{filter_params} specifies the parameters to pass to the libopencv
 -filter. If not specified the default values are assumed.
 +@item start_x
 +Set the initial x position. Must be a floating point value between
 +-100 and 100. Default value is -0.743643887037158704752191506114774.
  
 -Refer to the official libopencv documentation for more precise
 -information:
 -@url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
 +@item start_y
 +Set the initial y position. Must be a floating point value between
 +-100 and 100. Default value is -0.131825904205311970493132056385139.
 +@end table
  
 -Follows the list of supported libopencv filters.
 +@section mptestsrc
  
 -@anchor{dilate}
 -@subsection dilate
 +Generate various test patterns, as generated by the MPlayer test filter.
  
 -Dilate an image by using a specific structuring element.
 -This filter corresponds to the libopencv function @code{cvDilate}.
 +The size of the generated video is fixed, and is 256x256.
 +This source is useful in particular for testing encoding features.
  
 -It accepts the parameters: @var{struct_el}:@var{nb_iterations}.
 +This source accepts an optional sequence of @var{key}=@var{value} pairs,
 +separated by ":". The description of the accepted options follows.
  
 -@var{struct_el} represents a structuring element, and has the syntax:
 -@var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
 +@table @option
  
 -@var{cols} and @var{rows} represent the number of columns and rows of
 -the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
 -point, and @var{shape} the shape for the structuring element, and
 -can be one of the values "rect", "cross", "ellipse", "custom".
 +@item rate, r
 +Specify the frame rate of the sourced video, as the number of frames
 +generated per second. It has to be a string in the format
 +@var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
 +number or a valid video frame rate abbreviation. The default value is
 +"25".
  
 -If the value for @var{shape} is "custom", it must be followed by a
 -string of the form "=@var{filename}". The file with name
 -@var{filename} is assumed to represent a binary image, with each
 -printable character corresponding to a bright pixel. When a custom
 -@var{shape} is used, @var{cols} and @var{rows} are ignored, the number
 -or columns and rows of the read file are assumed instead.
 +@item duration, d
 +Set the video duration of the sourced video. The accepted syntax is:
 +@example
 +[-]HH:MM:SS[.m...]
 +[-]S+[.m...]
 +@end example
 +See also the function @code{av_parse_time()}.
  
 -The default value for @var{struct_el} is "3x3+0x0/rect".
 +If not specified, or the expressed duration is negative, the video is
 +supposed to be generated forever.
  
 -@var{nb_iterations} specifies the number of times the transform is
 -applied to the image, and defaults to 1.
 +@item test, t
  
 -Follow some example:
 -@example
 -# use the default values
 -ocv=dilate
 +Set the number or the name of the test to perform. Supported tests are:
 +@table @option
 +@item dc_luma
 +@item dc_chroma
 +@item freq_luma
 +@item freq_chroma
 +@item amp_luma
 +@item amp_chroma
 +@item cbp
 +@item mv
 +@item ring1
 +@item ring2
 +@item all
 +@end table
  
 -# dilate using a structuring element with a 5x5 cross, iterate two times
 -ocv=dilate=5x5+2x2/cross:2
 +Default value is "all", which will cycle through the list of all tests.
 +@end table
  
 -# read the shape from the file diamond.shape, iterate two times
 -# the file diamond.shape may contain a pattern of characters like this:
 -#   *
 -#  ***
 -# *****
 -#  ***
 -#   *
 -# the specified cols and rows are ignored (but not the anchor point coordinates)
 -ocv=0x0+2x2/custom=diamond.shape:2
 +For example the following:
 +@example
 +testsrc=t=dc_luma
  @end example
  
 -@subsection erode
 -
 -Erode an image by using a specific structuring element.
 -This filter corresponds to the libopencv function @code{cvErode}.
 -
 -The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
 -with the same syntax and semantics as the @ref{dilate} filter.
 +will generate a "dc_luma" test pattern.
  
 -@subsection smooth
 +@section frei0r_src
  
 -Smooth the input video.
 +Provide a frei0r source.
  
 -The filter takes the following parameters:
 -@var{type}:@var{param1}:@var{param2}:@var{param3}:@var{param4}.
 +To enable compilation of this filter you need to install the frei0r
 +header and configure FFmpeg with @code{--enable-frei0r}.
  
 -@var{type} is the type of smooth filter to apply, and can be one of
 -the following values: "blur", "blur_no_scale", "median", "gaussian",
 -"bilateral". The default value is "gaussian".
 +The source supports the syntax:
 +@example
 +@var{size}:@var{rate}:@var{src_name}[@{=|:@}@var{param1}:@var{param2}:...:@var{paramN}]
 +@end example
  
 -@var{param1}, @var{param2}, @var{param3}, and @var{param4} are
 -parameters whose meanings depend on smooth type. @var{param1} and
 -@var{param2} accept integer positive values or 0, @var{param3} and
 -@var{param4} accept float values.
 +@var{size} is the size of the video to generate, may be a string of the
 +form @var{width}x@var{height} or a frame size abbreviation.
 +@var{rate} is the rate of the video to generate, may be a string of
 +the form @var{num}/@var{den} or a frame rate abbreviation.
 +@var{src_name} is the name to the frei0r source to load. For more
 +information regarding frei0r and how to set the parameters read the
 +section @ref{frei0r} in the description of the video filters.
  
 -The default value for @var{param1} is 3, the default value for the
 -other parameters is 0.
 +For example, to generate a frei0r partik0l source with size 200x200
 +and frame rate 10 which is overlayed on the overlay filter main input:
 +@example
 +frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
 +@end example
  
 -These parameters correspond to the parameters assigned to the
 -libopencv function @code{cvSmooth}.
 +@section life
  
 -@anchor{overlay}
 -@section overlay
 +Generate a life pattern.
  
 -Overlay one video on top of another.
 +This source is based on a generalization of John Conway's life game.
  
 -It takes two inputs and one output, the first input is the "main"
 -video on which the second input is overlayed.
 +The sourced input represents a life grid, each pixel represents a cell
 +which can be in one of two possible states, alive or dead. Every cell
 +interacts with its eight neighbours, which are the cells that are
 +horizontally, vertically, or diagonally adjacent.
  
 -It accepts the parameters: @var{x}:@var{y}.
 +At each interaction the grid evolves according to the adopted rule,
 +which specifies the number of neighbor alive cells which will make a
 +cell stay alive or born. The @option{rule} option allows to specify
 +the rule to adopt.
  
 -@var{x} is the x coordinate of the overlayed video on the main video,
 -@var{y} is the y coordinate. The parameters are expressions containing
 -the following parameters:
 +This source accepts a list of options in the form of
 +@var{key}=@var{value} pairs separated by ":". A description of the
 +accepted options follows.
  
  @table @option
 -@item main_w, main_h
 -main input width and height
 +@item filename, f
 +Set the file from which to read the initial grid state. In the file,
 +each non-whitespace character is considered an alive cell, and newline
 +is used to delimit the end of each row.
  
 -@item W, H
 -same as @var{main_w} and @var{main_h}
 +If this option is not specified, the initial grid is generated
 +randomly.
  
 -@item overlay_w, overlay_h
 -overlay input width and height
 +@item rate, r
 +Set the video rate, that is the number of frames generated per second.
 +Default is 25.
 +
 +@item random_fill_ratio, ratio
 +Set the random fill ratio for the initial random grid. It is a
 +floating point number value ranging from 0 to 1, defaults to 1/PHI.
 +It is ignored when a file is specified.
 +
 +@item random_seed, seed
 +Set the seed for filling the initial random grid, must be an integer
 +included between 0 and UINT32_MAX. If not specified, or if explicitly
 +set to -1, the filter will try to use a good random seed on a best
 +effort basis.
 +
 +@item rule
 +Set the life rule.
 +
 +A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
 +where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
 +@var{NS} specifies the number of alive neighbor cells which make a
 +live cell stay alive, and @var{NB} the number of alive neighbor cells
 +which make a dead cell to become alive (i.e. to "born").
 +"s" and "b" can be used in place of "S" and "B", respectively.
 +
 +Alternatively a rule can be specified by an 18-bits integer. The 9
 +high order bits are used to encode the next cell state if it is alive
 +for each number of neighbor alive cells, the low order bits specify
 +the rule for "borning" new cells. Higher order bits encode for an
 +higher number of neighbor cells.
 +For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
 +rule of 12 and a born rule of 9, which corresponds to "S23/B03".
 +
 +Default value is "S23/B3", which is the original Conway's game of life
 +rule, and will keep a cell alive if it has 2 or 3 neighbor alive
 +cells, and will born a new cell if there are three alive cells around
 +a dead cell.
  
 -@item w, h
 -same as @var{overlay_w} and @var{overlay_h}
 -@end table
 +@item size, s
 +Set the size of the output video.
  
 -Be aware that frames are taken from each input video in timestamp
 -order, hence, if their initial timestamps differ, it is a a good idea
 -to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
 -have them begin in the same zero timestamp, as it does the example for
 -the @var{movie} filter.
 +If @option{filename} is specified, the size is set by default to the
 +same size of the input file. If @option{size} is set, it must contain
 +the size specified in the input file, and the initial grid defined in
 +that file is centered in the larger resulting area.
  
 -Follow some examples:
 -@example
 -# draw the overlay at 10 pixels from the bottom right
 -# corner of the main video.
 -overlay=main_w-overlay_w-10:main_h-overlay_h-10
 +If a filename is not specified, the size value defaults to "320x240"
 +(used for a randomly generated initial grid).
  
 -# insert a transparent PNG logo in the bottom left corner of the input
 -avconv -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
 +@item stitch
 +If set to 1, stitch the left and right grid edges together, and the
 +top and bottom edges also. Defaults to 1.
  
 -# insert 2 different transparent PNG logos (second logo on bottom
 -# right corner):
 -avconv -i input -i logo1 -i logo2 -filter_complex
 -'overlay=10:H-h-10,overlay=W-w-10:H-h-10' output
 +@item mold
 +Set cell mold speed. If set, a dead cell will go from @option{death_color} to
 +@option{mold_color} with a step of @option{mold}. @option{mold} can have a
 +value from 0 to 255.
  
 -# add a transparent color layer on top of the main video,
 -# WxH specifies the size of the main input to the overlay filter
 -color=red@.3:WxH [over]; [in][over] overlay [out]
 -@end example
 +@item life_color
 +Set the color of living (or new born) cells.
  
 -You can chain together more overlays but the efficiency of such
 -approach is yet to be tested.
 +@item death_color
 +Set the color of dead cells. If @option{mold} is set, this is the first color
 +used to represent a dead cell.
  
 -@section pad
 +@item mold_color
 +Set mold color, for definitely dead and moldy cells.
 +@end table
  
 -Add paddings to the input image, and places the original input at the
 -given coordinates @var{x}, @var{y}.
 +@subsection Examples
  
 -It accepts the following parameters:
 -@var{width}:@var{height}:@var{x}:@var{y}:@var{color}.
 +@itemize
 +@item
 +Read a grid from @file{pattern}, and center it on a grid of size
 +300x300 pixels:
 +@example
 +life=f=pattern:s=300x300
 +@end example
  
 -The parameters @var{width}, @var{height}, @var{x}, and @var{y} are
 -expressions containing the following constants:
 +@item
 +Generate a random grid of size 200x200, with a fill ratio of 2/3:
 +@example
 +life=ratio=2/3:s=200x200
 +@end example
  
 -@table @option
 -@item E, PI, PHI
 -the corresponding mathematical approximated values for e
 -(euler number), pi (greek PI), phi (golden ratio)
 +@item
 +Specify a custom rule for evolving a randomly generated grid:
 +@example
 +life=rule=S14/B34
 +@end example
  
 -@item in_w, in_h
 -the input video width and height
 +@item
 +Full example with slow death effect (mold) using @command{ffplay}:
 +@example
 +ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
 +@end example
 +@end itemize
  
 -@item iw, ih
 -same as @var{in_w} and @var{in_h}
 +@section color, nullsrc, rgbtestsrc, smptebars, testsrc
  
 -@item out_w, out_h
 -the output width and height, that is the size of the padded area as
 -specified by the @var{width} and @var{height} expressions
 +The @code{color} source provides an uniformly colored input.
  
 -@item ow, oh
 -same as @var{out_w} and @var{out_h}
 +The @code{nullsrc} source returns unprocessed video frames. It is
 +mainly useful to be employed in analysis / debugging tools, or as the
 +source for filters which ignore the input data.
  
 -@item x, y
 -x and y offsets as specified by the @var{x} and @var{y}
 -expressions, or NAN if not yet specified
 +The @code{rgbtestsrc} source generates an RGB test pattern useful for
 +detecting RGB vs BGR issues. You should see a red, green and blue
 +stripe from top to bottom.
  
 -@item a
 -input display aspect ratio, same as @var{iw} / @var{ih}
 +The @code{smptebars} source generates a color bars pattern, based on
 +the SMPTE Engineering Guideline EG 1-1990.
  
 -@item hsub, vsub
 -horizontal and vertical chroma subsample values. For example for the
 -pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
 -@end table
 +The @code{testsrc} source generates a test video pattern, showing a
 +color pattern, a scrolling gradient and a timestamp. This is mainly
 +intended for testing purposes.
  
 -Follows the description of the accepted parameters.
 +These sources accept an optional sequence of @var{key}=@var{value} pairs,
 +separated by ":". The description of the accepted options follows.
  
  @table @option
 -@item width, height
 -
 -Specify the size of the output image with the paddings added. If the
 -value for @var{width} or @var{height} is 0, the corresponding input size
 -is used for the output.
  
 -The @var{width} expression can reference the value set by the
 -@var{height} expression, and vice versa.
 +@item color, c
 +Specify the color of the source, only used in the @code{color}
 +source. It can be the name of a color (case insensitive match) or a
 +0xRRGGBB[AA] sequence, possibly followed by an alpha specifier. The
 +default value is "black".
  
 -The default value of @var{width} and @var{height} is 0.
 +@item size, s
 +Specify the size of the sourced video, it may be a string of the form
 +@var{width}x@var{height}, or the name of a size abbreviation. The
 +default value is "320x240".
  
 -@item x, y
 +@item rate, r
 +Specify the frame rate of the sourced video, as the number of frames
 +generated per second. It has to be a string in the format
 +@var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
 +number or a valid video frame rate abbreviation. The default value is
 +"25".
  
 -Specify the offsets where to place the input image in the padded area
 -with respect to the top/left border of the output image.
 +@item sar
 +Set the sample aspect ratio of the sourced video.
  
 -The @var{x} expression can reference the value set by the @var{y}
 -expression, and vice versa.
 +@item duration, d
 +Set the video duration of the sourced video. The accepted syntax is:
 +@example
 +[-]HH[:MM[:SS[.m...]]]
 +[-]S+[.m...]
 +@end example
 +See also the function @code{av_parse_time()}.
  
 -The default value of @var{x} and @var{y} is 0.
 +If not specified, or the expressed duration is negative, the video is
 +supposed to be generated forever.
  
 -@item color
 +@item decimals, n
 +Set the number of decimals to show in the timestamp, only used in the
 +@code{testsrc} source.
  
 -Specify the color of the padded area, it can be the name of a color
 -(case insensitive match) or a 0xRRGGBB[AA] sequence.
 +The displayed timestamp value will correspond to the original
 +timestamp value multiplied by the power of 10 of the specified
 +value. Default value is 0.
 +@end table
  
 -The default value of @var{color} is "black".
 +For example the following:
 +@example
 +testsrc=duration=5.3:size=qcif:rate=10
 +@end example
  
 -@end table
 +will generate a video with a duration of 5.3 seconds, with size
 +176x144 and a frame rate of 10 frames per second.
  
 -Some examples follow:
 +The following graph description will generate a red source
 +with an opacity of 0.2, with size "qcif" and a frame rate of 10
 +frames per second.
 +@example
 +color=c=red@@0.2:s=qcif:r=10
 +@end example
  
 +If the input content is to be ignored, @code{nullsrc} can be used. The
 +following command generates noise in the luminance plane by employing
 +the @code{geq} filter:
  @example
 -# Add paddings with color "violet" to the input video. Output video
 -# size is 640x480, the top-left corner of the input video is placed at
 -# column 0, row 40.
 -pad=640:480:0:40:violet
 +nullsrc=s=256x256, geq=random(1)*255:128:128
 +@end example
  
 -# pad the input to get an output with dimensions increased bt 3/2,
 -# and put the input video at the center of the padded area
 -pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
 +@c man end VIDEO SOURCES
  
 -# pad the input to get a squared output with size equal to the maximum
 -# value between the input width and height, and put the input video at
 -# the center of the padded area
 -pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
 +@chapter Video Sinks
 +@c man begin VIDEO SINKS
  
 -# pad the input to get a final w/h ratio of 16:9
 -pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
 +Below is a description of the currently available video sinks.
  
 -# double output size and put the input video in the bottom-right
 -# corner of the output padded area
 -pad="2*iw:2*ih:ow-iw:oh-ih"
 -@end example
 +@section buffersink
  
 -@section pixdesctest
 +Buffer video frames, and make them available to the end of the filter
 +graph.
  
 -Pixel format descriptor test filter, mainly useful for internal
 -testing. The output video should be equal to the input video.
 +This sink is mainly intended for a programmatic use, in particular
 +through the interface defined in @file{libavfilter/buffersink.h}.
  
 -For example:
 -@example
 -format=monow, pixdesctest
 -@end example
 +It does not require a string parameter in input, but you need to
 +specify a pointer to a list of supported pixel formats terminated by
 +-1 in the opaque parameter provided to @code{avfilter_init_filter}
 +when initializing this sink.
  
 -can be used to test the monowhite pixel format descriptor definition.
 +@section nullsink
  
 -@section scale
 +Null video sink, do absolutely nothing with the input video. It is
 +mainly useful as a template and to be employed in analysis / debugging
 +tools.
  
 -Scale the input video to @var{width}:@var{height} and/or convert the image format.
 +@c man end VIDEO SINKS
  
 -The parameters @var{width} and @var{height} are expressions containing
 -the following constants:
 +@chapter Multimedia Filters
 +@c man begin MULTIMEDIA FILTERS
  
 -@table @option
 -@item E, PI, PHI
 -the corresponding mathematical approximated values for e
 -(euler number), pi (greek PI), phi (golden ratio)
 +Below is a description of the currently available multimedia filters.
  
 -@item in_w, in_h
 -the input width and height
 +@section aperms, perms
  
 -@item iw, ih
 -same as @var{in_w} and @var{in_h}
 +Set read/write permissions for the output frames.
  
 -@item out_w, out_h
 -the output (cropped) width and height
 +These filters are mainly aimed at developers to test direct path in the
 +following filter in the filtergraph.
  
 -@item ow, oh
 -same as @var{out_w} and @var{out_h}
 +The filters accept parameters as a list of @var{key}=@var{value} pairs,
 +separated by ":". If the key of the first options is omitted, the argument is
 +assumed to be the @var{mode}.
  
 -@item dar, a
 -input display aspect ratio, same as @var{iw} / @var{ih}
 +A description of the accepted parameters follows.
  
 -@item sar
 -input sample aspect ratio
 +@table @option
 +@item mode
 +Select the permissions mode.
  
 -@item hsub, vsub
 -horizontal and vertical chroma subsample values. For example for the
 -pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
 +It accepts the following values:
 +@table @samp
 +@item none
 +Do nothing. This is the default.
 +@item ro
 +Set all the output frames read-only.
 +@item rw
 +Set all the output frames directly writable.
 +@item toggle
 +Make the frame read-only if writable, and writable if read-only.
 +@item random
 +Set each output frame read-only or writable randomly.
  @end table
  
 -If the input image format is different from the format requested by
 -the next filter, the scale filter will convert the input to the
 -requested format.
 +@item seed
 +Set the seed for the @var{random} mode, must be an integer included between
 +@code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
 +@code{-1}, the filter will try to use a good random seed on a best effort
 +basis.
 +@end table
  
 -If the value for @var{width} or @var{height} is 0, the respective input
 -size is used for the output.
 +Note: in case of auto-inserted filter between the permission filter and the
 +following one, the permission might not be received as expected in that
 +following filter. Inserting a @ref{format} or @ref{aformat} filter before the
 +perms/aperms filter can avoid this problem.
  
 -If the value for @var{width} or @var{height} is -1, the scale filter will
 -use, for the respective output size, a value that maintains the aspect
 -ratio of the input image.
 +@section aphaser
 +Add a phasing effect to the input audio.
  
 -The default value of @var{width} and @var{height} is 0.
 +A phaser filter creates series of peaks and troughs in the frequency spectrum.
 +The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  
 -Some examples follow:
 -@example
 -# scale the input video to a size of 200x100.
 -scale=200:100
 +The filter accepts parameters as a list of @var{key}=@var{value}
 +pairs, separated by ":".
  
 -# scale the input to 2x
 -scale=2*iw:2*ih
 -# the above is the same as
 -scale=2*in_w:2*in_h
 +A description of the accepted parameters follows.
  
 -# scale the input to half size
 -scale=iw/2:ih/2
 +@table @option
 +@item in_gain
 +Set input gain. Default is 0.4.
  
 -# increase the width, and set the height to the same size
 -scale=3/2*iw:ow
 +@item out_gain
 +Set output gain. Default is 0.74
  
 -# seek for Greek harmony
 -scale=iw:1/PHI*iw
 -scale=ih*PHI:ih
 +@item delay
 +Set delay in milliseconds. Default is 3.0.
  
 -# increase the height, and set the width to 3/2 of the height
 -scale=3/2*oh:3/5*ih
 +@item decay
 +Set decay. Default is 0.4.
  
 -# increase the size, but make the size a multiple of the chroma
 -scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
 +@item speed
 +Set modulation speed in Hz. Default is 0.5.
  
 -# increase the width to a maximum of 500 pixels, keep the same input aspect ratio
 -scale='min(500\, iw*3/2):-1'
 -@end example
 +@item type
 +Set modulation type. Default is triangular.
 +
 +It accepts the following values:
 +@table @samp
 +@item triangular, t
 +@item sinusoidal, s
 +@end table
 +@end table
  
 -@section select
 +@section aselect, select
  Select frames to pass in output.
  
 -It accepts in input an expression, which is evaluated for each input
 -frame. If the expression is evaluated to a non-zero value, the frame
 -is selected and passed to the output, otherwise it is discarded.
 +These filters accept a single option @option{expr} or @option{e}
 +specifying the select expression, which can be specified either by
 +specyfing @code{expr=VALUE} or specifying the expression
 +alone.
 +
 +The select expression is evaluated for each input frame. If the
 +evaluation result is a non-zero value, the frame is selected and
 +passed to the output, otherwise it is discarded.
  
  The expression can contain the following constants:
  
index d81f672d74b37b7ddda7467ea5ef591de97a053c,e5a7f1346426dad508c402f4efefa21fdbbb4836..2fb73c009fe22e40cae62574286f3fdbbb3b8136
@@@ -653,26 -479,8 +653,27 @@@ int avfilter_init_filter(AVFilterContex
      AVDictionary *options = NULL;
      AVDictionaryEntry *e;
      int ret=0;
 +    int anton_options =
 +        !strcmp(filter->filter->name,  "aformat") ||
++        !strcmp(filter->filter->name,  "blackframe") ||
 +        !strcmp(filter->filter->name,   "format") ||
 +        !strcmp(filter->filter->name, "noformat") ||
 +        !strcmp(filter->filter->name, "resample")
 +        ;
 +
 +    if (filter->filter->shorthand) {
 +        av_assert0(filter->priv);
 +        av_assert0(filter->filter->priv_class);
 +        *(const AVClass **)filter->priv = filter->filter->priv_class;
 +        av_opt_set_defaults(filter->priv);
 +        ret = av_opt_set_from_string(filter->priv, args,
 +                                     filter->filter->shorthand, "=", ":");
 +        if (ret < 0)
 +            return ret;
 +        args = NULL;
 +    }
  
 -    if (args && *args && filter->filter->priv_class) {
 +    if (anton_options && args && *args && filter->filter->priv_class) {
          if (strchr(args, '=')) {
              /* assume a list of key1=value1:key2=value2:... */
              ret = av_dict_parse_string(&options, args, "=", ":", 0);
index 710b81f630f249966d12a0f0c2c53c46908e133d,3fe371482f371a38b5441c98b55889d2a1b9b873..ab41becf68acd19a72c26e62c51e38215a8c7fbc
   * aspect ratio modification video filters
   */
  
+ #include <float.h>
  #include "libavutil/common.h"
 +#include "libavutil/opt.h"
  #include "libavutil/mathematics.h"
+ #include "libavutil/opt.h"
 +#include "libavutil/parseutils.h"
  #include "avfilter.h"
  #include "internal.h"
  #include "video.h"
  
  typedef struct {
      const AVClass *class;
-     AVRational ratio;
+     AVRational aspect;
 +    char *ratio_str;
 +    int max;
+ #if FF_API_OLD_FILTER_OPTS
+     float aspect_num, aspect_den;
+ #endif
  } AspectContext;
  
- #define OFFSET(x) offsetof(AspectContext, x)
- #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
- static const AVOption options[] = {
-     {"max", "set max value for nominator or denominator in the ratio", OFFSET(max), AV_OPT_TYPE_INT, {.i64=100}, 1, INT_MAX, FLAGS },
-     {"ratio", "set ratio", OFFSET(ratio_str), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS },
-     {"r",     "set ratio", OFFSET(ratio_str), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS },
-     {NULL}
- };
- static av_cold int init(AVFilterContext *ctx, const char *args, const AVClass *class)
+ #if FF_API_OLD_FILTER_OPTS
+ static av_cold int init(AVFilterContext *ctx, const char *args)
  {
-     AspectContext *aspect = ctx->priv;
+     AspectContext *s = ctx->priv;
 +    static const char *shorthand[] = { "ratio", "max", NULL };
 +    char c;
 +    int ret;
 +    AVRational q;
 +
-     aspect->class = class;
-     av_opt_set_defaults(aspect);
 +    if (args && sscanf(args, "%d:%d%c", &q.num, &q.den, &c) == 2) {
-         aspect->ratio_str = av_strdup(args);
++        s->ratio_str = av_strdup(args);
 +        av_log(ctx, AV_LOG_WARNING,
 +               "num:den syntax is deprecated, please use num/den or named options instead\n");
-     } else if ((ret = av_opt_set_from_string(aspect, args, shorthand, "=", ":")) < 0) {
++    } else if ((ret = av_opt_set_from_string(s, args, shorthand, "=", ":")) < 0) {
 +        return ret;
 +    }
  
-     if (aspect->ratio_str) {
-         ret = av_parse_ratio(&aspect->ratio, aspect->ratio_str, aspect->max, 0, ctx);
-         if (ret < 0 || aspect->ratio.num < 0 || aspect->ratio.den <= 0) {
 -    if (s->aspect_num > 0 && s->aspect_den > 0) {
 -        av_log(ctx, AV_LOG_WARNING, "This syntax is deprecated, use "
 -               "dar=<number> or dar=num/den.\n");
 -        s->aspect = av_d2q(s->aspect_num / s->aspect_den, INT_MAX);
++    if (s->ratio_str) {
++        ret = av_parse_ratio(&s->aspect, s->ratio_str, s->max, 0, ctx);
++        if (ret < 0 || s->aspect.num < 0 || s->aspect.den <= 0) {
 +            av_log(ctx, AV_LOG_ERROR,
 +                   "Invalid string '%s' for aspect ratio\n", args);
 +            return AVERROR(EINVAL);
 +        }
      }
  
-     av_log(ctx, AV_LOG_VERBOSE, "a:%d/%d\n", aspect->ratio.num, aspect->ratio.den);
      return 0;
  }
+ #endif
  
  static int filter_frame(AVFilterLink *link, AVFrame *frame)
  {
      return ff_filter_frame(link->dst->outputs[0], frame);
  }
  
- static av_cold void uninit(AVFilterContext *ctx)
- {
-     AspectContext *aspect = ctx->priv;
-     av_opt_free(aspect);
- }
+ #define OFFSET(x) offsetof(AspectContext, x)
 -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
++#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
  
  #if CONFIG_SETDAR_FILTER
 -/* for setdar filter, convert from frame aspect ratio to pixel aspect ratio */
 +
- #define setdar_options options
- AVFILTER_DEFINE_CLASS(setdar);
- static av_cold int setdar_init(AVFilterContext *ctx, const char *args)
- {
-     return init(ctx, args, &setdar_class);
- }
  static int setdar_config_props(AVFilterLink *inlink)
  {
      AspectContext *aspect = inlink->dst->priv;
      return 0;
  }
  
 -#if FF_API_OLD_FILTER_OPTS
 -    { "dar_num", NULL, OFFSET(aspect_num), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
 -    { "dar_den", NULL, OFFSET(aspect_den), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
 -#endif
 -    { "dar", "display aspect ratio", OFFSET(aspect), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, FLAGS },
 -    { NULL },
+ static const AVOption setdar_options[] = {
 -static const AVClass setdar_class = {
 -    .class_name = "setdar",
 -    .item_name  = av_default_item_name,
 -    .option     = setdar_options,
 -    .version    = LIBAVUTIL_VERSION_INT,
 -};
++    {"max", "set max value for nominator or denominator in the ratio", OFFSET(max), AV_OPT_TYPE_INT, {.i64=100}, 1, INT_MAX, FLAGS },
++    {"ratio", "display aspect ratio", OFFSET(ratio_str), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS },
++    {"r",     "display aspect ratio", OFFSET(ratio_str), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS },
++    {"dar",   "display aspect ratio", OFFSET(ratio_str), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS },
++    {NULL}
+ };
++AVFILTER_DEFINE_CLASS(setdar);
  static const AVFilterPad avfilter_vf_setdar_inputs[] = {
      {
          .name             = "default",
@@@ -153,21 -140,11 +153,13 @@@ AVFilter avfilter_vf_setdar = 
      .inputs    = avfilter_vf_setdar_inputs,
  
      .outputs   = avfilter_vf_setdar_outputs,
-     .priv_class = &setdar_class,
  };
 +
  #endif /* CONFIG_SETDAR_FILTER */
  
  #if CONFIG_SETSAR_FILTER
 -/* for setdar filter, convert from frame aspect ratio to pixel aspect ratio */
 +
- #define setsar_options options
- AVFILTER_DEFINE_CLASS(setsar);
- static av_cold int setsar_init(AVFilterContext *ctx, const char *args)
- {
-     return init(ctx, args, &setsar_class);
- }
 +
  static int setsar_config_props(AVFilterLink *inlink)
  {
      AspectContext *aspect = inlink->dst->priv;
      return 0;
  }
  
 -#if FF_API_OLD_FILTER_OPTS
 -    { "sar_num", NULL, OFFSET(aspect_num), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
 -    { "sar_den", NULL, OFFSET(aspect_den), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
 -#endif
 -    { "sar", "sample (pixel) aspect ratio", OFFSET(aspect), AV_OPT_TYPE_RATIONAL, { .dbl = 1 }, 0, INT_MAX, FLAGS },
 -    { NULL },
+ static const AVOption setsar_options[] = {
 -static const AVClass setsar_class = {
 -    .class_name = "setsar",
 -    .item_name  = av_default_item_name,
 -    .option     = setsar_options,
 -    .version    = LIBAVUTIL_VERSION_INT,
 -};
++    {"max", "set max value for nominator or denominator in the ratio", OFFSET(max), AV_OPT_TYPE_INT, {.i64=100}, 1, INT_MAX, FLAGS },
++    {"ratio", "sample (pixel) aspect ratio", OFFSET(ratio_str), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS },
++    {"r",     "sample (pixel) aspect ratio", OFFSET(ratio_str), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS },
++    {"sar",   "sample (pixel) aspect ratio", OFFSET(ratio_str), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS },
++    {NULL}
+ };
++AVFILTER_DEFINE_CLASS(setsar);
  static const AVFilterPad avfilter_vf_setsar_inputs[] = {
      {
          .name             = "default",
@@@ -208,7 -203,5 +212,6 @@@ AVFilter avfilter_vf_setsar = 
      .inputs    = avfilter_vf_setsar_inputs,
  
      .outputs   = avfilter_vf_setsar_outputs,
-     .priv_class = &setsar_class,
  };
 +
  #endif /* CONFIG_SETSAR_FILTER */
index 11c8e508935bf8d93536a18ac679580463e34a33,54e75bbb035f832341dd88774486096d6829935e..968d451c6134f1c5c20b2a7b689e6f785fc7de2b
  
  typedef struct {
      const AVClass *class;
-     unsigned int bamount; ///< black amount
-     unsigned int bthresh; ///< black threshold
+     int bamount;          ///< black amount
+     int bthresh;          ///< black threshold
      unsigned int frame;   ///< frame number
      unsigned int nblack;  ///< number of black pixels counted so far
 +    unsigned int last_keyframe; ///< frame number of the last received key-frame
  } BlackFrameContext;
  
- #define OFFSET(x) offsetof(BlackFrameContext, x)
- #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
- static const AVOption blackframe_options[] = {
-     { "amount", "set least percentual amount of pixels below the black threshold enabling black detection", OFFSET(bamount), AV_OPT_TYPE_INT, {.i64=98}, 0, 100, FLAGS },
-     { "thresh", "set threshold below which a pixel value is considered black", OFFSET(bthresh), AV_OPT_TYPE_INT, {.i64=32}, 0, 255, FLAGS },
-     { NULL }
- };
- AVFILTER_DEFINE_CLASS(blackframe);
  static int query_formats(AVFilterContext *ctx)
  {
      static const enum AVPixelFormat pix_fmts[] = {
@@@ -110,6 -83,23 +89,18 @@@ static int filter_frame(AVFilterLink *i
      return ff_filter_frame(inlink->dst->outputs[0], frame);
  }
  
 -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
 -static const AVOption options[] = {
+ #define OFFSET(x) offsetof(BlackFrameContext, x)
 -                                                 OFFSET(bthresh), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, INT_MAX, FLAGS },
++#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
++static const AVOption blackframe_options[] = {
+     { "amount", "Percentage of the pixels that have to be below the threshold "
+         "for the frame to be considered black.", OFFSET(bamount), AV_OPT_TYPE_INT, { .i64 = 98 }, 0, 100,     FLAGS },
+     { "threshold", "threshold below which a pixel value is considered black",
 -static const AVClass blackframe_class = {
 -    .class_name = "blackframe",
 -    .item_name  = av_default_item_name,
 -    .option     = options,
 -    .version    = LIBAVUTIL_VERSION_INT,
 -};
++                                                 OFFSET(bthresh), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, 255,     FLAGS },
+     { NULL },
+ };
++AVFILTER_DEFINE_CLASS(blackframe);
  static const AVFilterPad avfilter_vf_blackframe_inputs[] = {
      {
          .name             = "default",
@@@ -142,7 -130,4 +131,6 @@@ AVFilter avfilter_vf_blackframe = 
      .inputs    = avfilter_vf_blackframe_inputs,
  
      .outputs   = avfilter_vf_blackframe_outputs,
-     .shorthand  = shorthand,
 +
 +    .priv_class = &blackframe_class,
  };