]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit 'de203abd71baae7f120313259b45cf935c85203e'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 4 Feb 2014 13:33:33 +0000 (14:33 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 4 Feb 2014 13:33:33 +0000 (14:33 +0100)
* commit 'de203abd71baae7f120313259b45cf935c85203e':
  vf_overlay: add eof_action switch

Conflicts:
doc/filters.texi
libavfilter/vf_overlay.c

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

index bcb00e50b891d2d33c8263d0c5aeefd04349137d,8c83b4e7a2c4f6294bbea74c99ae05d70c2dd4a7..46d0a1250105a028646b95bc54841e95b03e73a7
@@@ -5714,2806 -1219,93 +5714,2828 @@@ This filter accepts the following param
  A '|'-separated list of pixel format names, for example
  "pix_fmts=yuv420p|monow|rgb24".
  
 -@end table
 +@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.
 +
 +The filter accepts the following options:
 +
 +@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 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}.
 +
 +This filter accepts the following parameters:
 +
 +@table @option
 +
 +@item filter_name
 +The name of the libopencv filter to apply.
 +
 +@item filter_params
 +The parameters to pass to the libopencv filter. If not specified the default
 +values are assumed.
 +
 +@end table
 +
 +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=filter_name=dilate:filter_params=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=dilate: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 the following parameters:
 +
 +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 eof_action
++The action to take when EOF is encountered on the secondary input, accepts one
++of the following values:
++
++@table @option
++@item repeat
++repeat the last frame (the default)
++@item endall
++end both streams
++@item pass
++pass through the main input
++@end table
++
 +@item eval
 +Set when the expressions for @option{x}, and @option{y} 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 yuv422
 +force YUV422 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.
 +
 +@item repeatlast
 +If set to 1, force the filter to draw the last overlay frame over the
 +main input until the end of the stream. A value of 0 disables this
 +behavior. Default value is 1.
 +@end table
 +
 +The @option{x}, and @option{y} 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 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 commands:
 +@table @option
 +@item x
 +@item y
 +Modify the x and y of the overlay input.
 +The command accepts the same syntax of the corresponding option.
 +
 +If the specified expression is not valid, it is kept at its current
 +value.
 +@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=x=10:y=H-h-10,overlay=x=W-w-10:y=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
++mask 10-20 seconds of a video by applying the delogo filter to a section
++@example
++ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
++-vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
++masked.avi
++@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 owdenoise
 +
 +Apply Overcomplete Wavelet denoiser.
 +
 +The filter accepts the following options:
 +
 +@table @option
 +@item depth
 +Set depth.
 +
 +Larger depth values will denoise lower frequency components more, but
 +slow down filtering.
 +
 +Must be an int in the range 8-16, default is @code{8}.
 +
 +@item luma_strength, ls
 +Set luma strength.
 +
 +Must be a double value in the range 0-1000, default is @code{1.0}.
 +
 +@item chroma_strength, cs
 +Set chroma strength.
 +
 +Must be a double value in the range 0-1000, default is @code{1.0}.
 +@end table
 +
 +@section pad
 +
 +Add paddings to the input image, and place the original input at the
 +given coordinates @var{x}, @var{y}.
 +
 +This filter accepts the following parameters:
 +
 +@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. For the syntax of this option,
 +check the "Color" section in the ffmpeg-utils manual.
 +
 +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
 +@item in_h
 +the input video width and height
 +
 +@item iw
 +@item ih
 +same as @var{in_w} and @var{in_h}
 +
 +@item out_w
 +@item 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
 +@item oh
 +same as @var{out_w} and @var{out_h}
 +
 +@item x
 +@item 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
 +@item 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 perspective
 +
 +Correct perspective of video not recorded perpendicular to the screen.
 +
 +A description of the accepted parameters follows.
 +
 +@table @option
 +@item x0
 +@item y0
 +@item x1
 +@item y1
 +@item x2
 +@item y2
 +@item x3
 +@item y3
 +Set coordinates expression for top left, top right, bottom left and bottom right corners.
 +Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
 +
 +The expressions can use the following variables:
 +
 +@table @option
 +@item W
 +@item H
 +the width and height of video frame.
 +@end table
 +
 +@item interpolation
 +Set interpolation for perspective correction.
 +
 +It accepts the following values:
 +@table @samp
 +@item linear
 +@item cubic
 +@end table
 +
 +Default value is @samp{linear}.
 +@end table
 +
 +@section phase
 +
 +Delay interlaced video by one field time so that the field order changes.
 +
 +The intended use is to fix PAL movies that have been captured with the
 +opposite field order to the film-to-video transfer.
 +
 +A description of the accepted parameters follows.
 +
 +@table @option
 +@item mode
 +Set phase mode.
 +
 +It accepts the following values:
 +@table @samp
 +@item t
 +Capture field order top-first, transfer bottom-first.
 +Filter will delay the bottom field.
 +
 +@item b
 +Capture field order bottom-first, transfer top-first.
 +Filter will delay the top field.
 +
 +@item p
 +Capture and transfer with the same field order. This mode only exists
 +for the documentation of the other options to refer to, but if you
 +actually select it, the filter will faithfully do nothing.
 +
 +@item a
 +Capture field order determined automatically by field flags, transfer
 +opposite.
 +Filter selects among @samp{t} and @samp{b} modes on a frame by frame
 +basis using field flags. If no field information is available,
 +then this works just like @samp{u}.
 +
 +@item u
 +Capture unknown or varying, transfer opposite.
 +Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
 +analyzing the images and selecting the alternative that produces best
 +match between the fields.
 +
 +@item T
 +Capture top-first, transfer unknown or varying.
 +Filter selects among @samp{t} and @samp{p} using image analysis.
 +
 +@item B
 +Capture bottom-first, transfer unknown or varying.
 +Filter selects among @samp{b} and @samp{p} using image analysis.
 +
 +@item A
 +Capture determined by field flags, transfer unknown or varying.
 +Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
 +image analysis. If no field information is available, then this works just
 +like @samp{U}. This is the default mode.
 +
 +@item U
 +Both capture and transfer unknown or varying.
 +Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
 +@end table
 +@end table
 +
 +@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.
 +
 +The filters accept the following options:
 +
 +@table @option
 +@item subfilters
 +Set postprocessing subfilters string.
 +@end table
 +
 +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 psnr
 +
 +Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
 +Ratio) between two input videos.
 +
 +This filter takes in input two input videos, the first input is
 +considered the "main" source and is passed unchanged to the
 +output. The second input is used as a "reference" video for computing
 +the PSNR.
 +
 +Both video inputs must have the same resolution and pixel format for
 +this filter to work correctly. Also it assumes that both inputs
 +have the same number of frames, which are compared one by one.
 +
 +The obtained average PSNR is printed through the logging system.
 +
 +The filter stores the accumulated MSE (mean squared error) of each
 +frame, and at the end of the processing it is averaged across all frames
 +equally, and the following formula is applied to obtain the PSNR:
 +
 +@example
 +PSNR = 10*log10(MAX^2/MSE)
 +@end example
 +
 +Where MAX is the average of the maximum values of each component of the
 +image.
 +
 +The description of the accepted parameters follows.
 +
 +@table @option
 +@item stats_file, f
 +If specified the filter will use the named file to save the PSNR of
 +each individual frame.
 +@end table
 +
 +The file printed if @var{stats_file} is selected, contains a sequence of
 +key/value pairs of the form @var{key}:@var{value} for each compared
 +couple of frames.
 +
 +A description of each shown parameter follows:
 +
 +@table @option
 +@item n
 +sequential number of the input frame, starting from 1
 +
 +@item mse_avg
 +Mean Square Error pixel-by-pixel average difference of the compared
 +frames, averaged over all the image components.
 +
 +@item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
 +Mean Square Error pixel-by-pixel average difference of the compared
 +frames for the component specified by the suffix.
 +
 +@item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
 +Peak Signal to Noise ratio of the compared frames for the component
 +specified by the suffix.
 +@end table
 +
 +For example:
 +@example
 +movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
 +[main][ref] psnr="stats_file=stats.log" [out]
 +@end example
 +
 +On this example the input file being processed is compared with the
 +reference file @file{ref_movie.mpg}. The PSNR of each individual frame
 +is stored in @file{stats.log}.
 +
 +@section pullup
 +
 +Pulldown reversal (inverse telecine) filter, capable of handling mixed
 +hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
 +content.
 +
 +The pullup filter is designed to take advantage of future context in making
 +its decisions. This filter is stateless in the sense that it does not lock
 +onto a pattern to follow, but it instead looks forward to the following
 +fields in order to identify matches and rebuild progressive frames.
 +
 +To produce content with an even framerate, insert the fps filter after
 +pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
 +@code{fps=24} for 30fps and the (rare) telecined 25fps input.
 +
 +The filter accepts the following options:
 +
 +@table @option
 +@item jl
 +@item jr
 +@item jt
 +@item jb
 +These options set the amount of "junk" to ignore at the left, right, top, and
 +bottom of the image, respectively. Left and right are in units of 8 pixels,
 +while top and bottom are in units of 2 lines.
 +The default is 8 pixels on each side.
 +
 +@item sb
 +Set the strict breaks. Setting this option to 1 will reduce the chances of
 +filter generating an occasional mismatched frame, but it may also cause an
 +excessive number of frames to be dropped during high motion sequences.
 +Conversely, setting it to -1 will make filter match fields more easily.
 +This may help processing of video where there is slight blurring between
 +the fields, but may also cause there to be interlaced frames in the output.
 +Default value is @code{0}.
 +
 +@item mp
 +Set the metric plane to use. It accepts the following values:
 +@table @samp
 +@item l
 +Use luma plane.
 +
 +@item u
 +Use chroma blue plane.
 +
 +@item v
 +Use chroma red plane.
 +@end table
 +
 +This option may be set to use chroma plane instead of the default luma plane
 +for doing filter's computations. This may improve accuracy on very clean
 +source material, but more likely will decrease accuracy, especially if there
 +is chroma noise (rainbow effect) or any grayscale video.
 +The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
 +load and make pullup usable in realtime on slow machines.
 +@end table
 +
 +For best results (without duplicated frames in the output file) it is
 +necessary to change the output frame rate. For example, to inverse
 +telecine NTSC input:
 +@example
 +ffmpeg -i input -vf pullup -r 24000/1001 ...
 +@end example
 +
 +@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.
 +
 +The filter accepts the following options:
 +
 +@table @option
 +@item filename, f
 +Set 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.
 +@end table
 +
 +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 rotate
 +
 +Rotate video by an arbitrary angle expressed in radians.
 +
 +The filter accepts the following options:
 +
 +A description of the optional parameters follows.
 +@table @option
 +@item angle, a
 +Set an expression for the angle by which to rotate the input video
 +clockwise, expressed as a number of radians. A negative value will
 +result in a counter-clockwise rotation. By default it is set to "0".
 +
 +This expression is evaluated for each frame.
 +
 +@item out_w, ow
 +Set the output width expression, default value is "iw".
 +This expression is evaluated just once during configuration.
 +
 +@item out_h, oh
 +Set the output height expression, default value is "ih".
 +This expression is evaluated just once during configuration.
 +
 +@item bilinear
 +Enable bilinear interpolation if set to 1, a value of 0 disables
 +it. Default value is 1.
 +
 +@item fillcolor, c
 +Set the color used to fill the output area not covered by the rotated
 +image. For the generalsyntax of this option, check the "Color" section in the
 +ffmpeg-utils manual. If the special value "none" is selected then no
 +background is printed (useful for example if the background is never shown).
 +
 +Default value is "black".
 +@end table
 +
 +The expressions for the angle and the output size can contain the
 +following constants and functions:
 +
 +@table @option
 +@item n
 +sequential number of the input frame, starting from 0. It is always NAN
 +before the first frame is filtered.
 +
 +@item t
 +time in seconds of the input frame, it is set to 0 when the filter is
 +configured. It is always NAN before the first frame is filtered.
 +
 +@item hsub
 +@item vsub
 +horizontal and vertical chroma subsample values. For example for the
 +pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
 +
 +@item in_w, iw
 +@item in_h, ih
 +the input video width and heigth
 +
 +@item out_w, ow
 +@item out_h, oh
 +the output width and heigth, that is the size of the padded area as
 +specified by the @var{width} and @var{height} expressions
 +
 +@item rotw(a)
 +@item roth(a)
 +the minimal width/height required for completely containing the input
 +video rotated by @var{a} radians.
 +
 +These are only available when computing the @option{out_w} and
 +@option{out_h} expressions.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Rotate the input by PI/6 radians clockwise:
 +@example
 +rotate=PI/6
 +@end example
 +
 +@item
 +Rotate the input by PI/6 radians counter-clockwise:
 +@example
 +rotate=-PI/6
 +@end example
 +
 +@item
 +Rotate the input by 45 degrees clockwise:
 +@example
 +rotate=45*PI/180
 +@end example
 +
 +@item
 +Apply a constant rotation with period T, starting from an angle of PI/3:
 +@example
 +rotate=PI/3+2*PI*t/T
 +@end example
 +
 +@item
 +Make the input video rotation oscillating with a period of T
 +seconds and an amplitude of A radians:
 +@example
 +rotate=A*sin(2*PI/T*t)
 +@end example
 +
 +@item
 +Rotate the video, output size is choosen so that the whole rotating
 +input video is always completely contained in the output:
 +@example
 +rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
 +@end example
 +
 +@item
 +Rotate the video, reduce the output size so that no background is ever
 +shown:
 +@example
 +rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
 +@end example
 +@end itemize
 +
 +@subsection Commands
 +
 +The filter supports the following commands:
 +
 +@table @option
 +@item a, angle
 +Set the angle expression.
 +The command accepts the same syntax of the corresponding option.
 +
 +If the specified expression is not valid, it is kept at its current
 +value.
 +@end table
 +
 +@section sab
 +
 +Apply Shape Adaptive Blur.
 +
 +The filter accepts the following options:
 +
 +@table @option
 +@item luma_radius, lr
 +Set luma blur filter strength, must be a value in range 0.1-4.0, default
 +value is 1.0. A greater value will result in a more blurred image, and
 +in slower processing.
 +
 +@item luma_pre_filter_radius, lpfr
 +Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
 +value is 1.0.
 +
 +@item luma_strength, ls
 +Set luma maximum difference between pixels to still be considered, must
 +be a value in the 0.1-100.0 range, default value is 1.0.
 +
 +@item chroma_radius, cr
 +Set chroma blur filter strength, must be a value in range 0.1-4.0. A
 +greater value will result in a more blurred image, and in slower
 +processing.
 +
 +@item chroma_pre_filter_radius, cpfr
 +Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
 +
 +@item chroma_strength, cs
 +Set chroma maximum difference between pixels to still be considered,
 +must be a value in the 0.1-100.0 range.
 +@end table
 +
 +Each chroma option value, if not explicitly specified, is set to the
 +corresponding luma option value.
 +
 +@anchor{scale}
 +@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.
 +
 +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.
 +
 +@subsection Options
 +The filter accepts the following options, or any of the options
 +supported by the libswscale scaler.
 +
 +See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
 +the complete list of scaler options.
 +
 +@table @option
 +@item width, w
 +@item height, h
 +Set the output video dimension expression. Default value is the input
 +dimension.
 +
 +If the value is 0, the input width is used for the output.
 +
 +If one of the values is -1, the scale filter will use a value that
 +maintains the aspect ratio of the input image, calculated from the
 +other specified dimension. If both of them are -1, the input size is
 +used
 +
 +If one of the values is -n with n > 1, the scale filter will also use a value
 +that maintains the aspect ratio of the input image, calculated from the other
 +specified dimension. After that it will, however, make sure that the calculated
 +dimension is divisible by n and adjust the value if necessary.
 +
 +See below for the list of accepted constants for use in the dimension
 +expression.
 +
 +@item interl
 +Set the interlacing mode. It accepts the following values:
 +
 +@table @samp
 +@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 @samp{0}.
 +
 +@item flags
 +Set libswscale scaling flags. See
 +@ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
 +complete list of values. If not explictly specified the filter applies
 +the default flags.
 +
 +@item size, s
 +Set the video size. For the syntax of this option, check the "Video size"
 +section in the ffmpeg-utils manual.
 +
 +@item in_color_matrix
 +@item out_color_matrix
 +Set in/output YCbCr color space type.
 +
 +This allows the autodetected value to be overridden as well as allows forcing
 +a specific value used for the output and encoder.
 +
 +If not specified, the color space type depends on the pixel format.
 +
 +Possible values:
 +
 +@table @samp
 +@item auto
 +Choose automatically.
 +
 +@item bt709
 +Format conforming to International Telecommunication Union (ITU)
 +Recommendation BT.709.
 +
 +@item fcc
 +Set color space conforming to the United States Federal Communications
 +Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
 +
 +@item bt601
 +Set color space conforming to:
 +
 +@itemize
 +@item
 +ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
 +
 +@item
 +ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
 +
 +@item
 +Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
 +
 +@end itemize
 +
 +@item smpte240m
 +Set color space conforming to SMPTE ST 240:1999.
 +@end table
 +
 +@item in_range
 +@item out_range
 +Set in/output YCbCr sample range.
 +
 +This allows the autodetected value to be overridden as well as allows forcing
 +a specific value used for the output and encoder. If not specified, the
 +range depends on the pixel format. Possible values:
 +
 +@table @samp
 +@item auto
 +Choose automatically.
 +
 +@item jpeg/full/pc
 +Set full range (0-255 in case of 8-bit luma).
 +
 +@item mpeg/tv
 +Set "MPEG" range (16-235 in case of 8-bit luma).
 +@end table
 +
 +@item force_original_aspect_ratio
 +Enable decreasing or increasing output video width or height if necessary to
 +keep the original aspect ratio. Possible values:
 +
 +@table @samp
 +@item disable
 +Scale the video as specified and disable this feature.
 +
 +@item decrease
 +The output video dimensions will automatically be decreased if needed.
 +
 +@item increase
 +The output video dimensions will automatically be increased if needed.
 +
 +@end table
 +
 +One useful instance of this option is that when you know a specific device's
 +maximum allowed resolution, you can use this to limit the output video to
 +that, while retaining the aspect ratio. For example, device A allows
 +1280x720 playback, and your video is 1920x800. Using this option (set it to
 +decrease) and specifying 1280x720 to the command line makes the output
 +1280x533.
 +
 +Please note that this is a different thing than specifying -1 for @option{w}
 +or @option{h}, you still need to specify the output resolution for this option
 +to work.
 +
 +@end table
 +
 +The values of the @option{w} and @option{h} options are expressions
 +containing the following constants:
 +
 +@table @var
 +@item in_w
 +@item in_h
 +the input width and height
 +
 +@item iw
 +@item ih
 +same as @var{in_w} and @var{in_h}
 +
 +@item out_w
 +@item out_h
 +the output (scaled) width and height
 +
 +@item ow
 +@item 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. Calculated from @code{(iw / ih) * sar}.
 +
 +@item hsub
 +@item vsub
 +horizontal and vertical input chroma subsample values. For example for the
 +pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
 +
 +@item ohsub
 +@item ovsub
 +horizontal and vertical output 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
 +Scale the input video to a size of 200x100:
 +@example
 +scale=w=200:h=100
 +@end example
 +
 +This is equivalent to:
 +@example
 +scale=200: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=w=2*iw:h=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=w=iw/2:h=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=w=3/2*oh:h=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=w='min(500\, iw*3/2):h=-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 filters accept the following options:
 +
 +@table @option
 +@item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
 +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}" is used, the @code{:} character
 +should be escaped.
 +
 +@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}.
 +
 +@end table
 +
 +The parameter @var{sar} is an expression containing
 +the following constants:
 +
 +@table @option
 +@item E, PI, PHI
 +the corresponding mathematical approximated values for e
 +(euler number), pi (greek PI), phi (golden ratio)
 +
 +@item w, h
 +the input width and height
 +
 +@item a
 +same as @var{w} / @var{h}
 +
 +@item sar
 +input sample aspect ratio
 +
 +@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.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +
 +@item
 +To change the display aspect ratio to 16:9, specify one of the following:
 +@example
 +setdar=dar=1.77777
 +setdar=dar=16/9
 +setdar=dar=1.77777
 +@end example
 +
 +@item
 +To change the sample aspect ratio to 10:11, specify:
 +@example
 +setsar=sar=10/11
 +@end example
 +
 +@item
 +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
 +
 +@end itemize
 +
 +@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 filter accepts the following options:
 +
 +@table @option
 +
 +@item mode
 +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
 +@end table
 +
 +@section showinfo
 +
 +Show a line containing various information for each input video frame.
 +The input video is not modified.
 +
 +The shown line contains a sequence of key/value pairs of the form
 +@var{key}:@var{value}.
 +
 +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. For the syntax of this option, check the "Video size"
 +section in the ffmpeg-utils manual.
 +
 +@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
 +
 +@anchor{smartblur}
 +@section smartblur
 +
 +Blur the input video without impacting the outlines.
 +
 +The filter accepts the following options:
 +
 +@table @option
 +@item luma_radius, lr
 +Set the luma 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
 +Set the luma 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
 +Set the luma 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.
 +
 +@item chroma_radius, cr
 +Set the 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 chroma_strength, cs
 +Set the 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 chroma_threshold, ct
 +Set the 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.
 +
 +The filters accept the following options:
 +
 +@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)
 +
 +@item al
 +alternating frames (left eye first, right eye second)
 +
 +@item ar
 +alternating frames (right eye first, left eye second)
 +
 +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
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Convert input video from side by side parallel to anaglyph yellow/blue dubois:
 +@example
 +stereo3d=sbsl:aybd
 +@end example
 +
 +@item
 +Convert input video from above bellow (left eye above, right eye below) to side by side crosseye.
 +@example
 +stereo3d=abl:sbsr
 +@end example
 +@end itemize
 +
 +@section spp
 +
 +Apply a simple postprocessing filter that compresses and decompresses the image
 +at several (or - in the case of @option{quality} level @code{6} - all) shifts
 +and average the results.
 +
 +The filter accepts the following options:
 +
 +@table @option
 +@item quality
 +Set quality. This option defines the number of levels for averaging. It accepts
 +an integer in the range 0-6. If set to @code{0}, the filter will have no
 +effect. A value of @code{6} means the higher quality. For each increment of
 +that value the speed drops by a factor of approximately 2.  Default value is
 +@code{3}.
 +
 +@item qp
 +Force a constant quantization parameter. If not set, the filter will use the QP
 +from the video stream (if available).
 +
 +@item mode
 +Set thresholding mode. Available modes are:
 +
 +@table @samp
 +@item hard
 +Set hard thresholding (default).
 +@item soft
 +Set soft thresholding (better de-ringing effect, but likely blurrier).
 +@end table
 +
 +@item use_bframe_qp
 +Enable the use of the QP from the B-Frames if set to @code{1}. Using this
 +option may cause flicker since the B-Frames have often larger QP. Default is
 +@code{0} (not enabled).
 +@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.
 +
 +The filter accepts the following options:
 +
 +@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. For the syntax of this option, check the "Video size" section in
 +the ffmpeg-utils manual. 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
 +
 +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
 +subtitles=sub.srt
 +@end example
 +
 +which is equivalent to:
 +@example
 +subtitles=filename=sub.srt
 +@end example
 +
 +@section super2xsai
 +
 +Scale the input by 2x and smooth using the Super2xSaI (Scale and
 +Interpolate) pixel art scaling algorithm.
 +
 +Useful for enlarging pixel art images without reducing sharpness.
 +
 +@section swapuv
 +Swap U & V plane.
 +
 +@section telecine
 +
 +Apply telecine process to the video.
 +
 +This filter accepts the following options:
 +
 +@table @option
 +@item first_field
 +@table @samp
 +@item top, t
 +top field first
 +@item bottom, b
 +bottom field first
 +The default value is @code{top}.
 +@end table
 +
 +@item pattern
 +A string of numbers representing the pulldown pattern you wish to apply.
 +The default value is @code{23}.
 +@end table
 +
 +@example
 +Some typical patterns:
 +
 +NTSC output (30i):
 +27.5p: 32222
 +24p: 23 (classic)
 +24p: 2332 (preferred)
 +20p: 33
 +18p: 334
 +16p: 3444
 +
 +PAL output (25i):
 +27.5p: 12222
 +24p: 222222222223 ("Euro pulldown")
 +16.67p: 33
 +16p: 33333334
 +@end example
 +
 +@section thumbnail
 +Select the most representative frame in a given sequence of consecutive frames.
 +
 +The filter accepts the following options:
 +
 +@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.
 +
 +The filter accepts the following options:
 +
 +@table @option
 +
 +@item layout
 +Set the grid size (i.e. the number of lines and columns). For the syntax of
 +this option, check the "Video size" section in the ffmpeg-utils manual.
 +
 +@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.
 +
 +@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 color
 +Specify the color of the unused areaFor the syntax of this option, check the
 +"Color" section in the ffmpeg-utils manual. The default value of @var{color}
 +is "black".
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +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.
 +
 +@item
 +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
 +@end itemize
 +
 +@section tinterlace
 +
 +Perform various types of temporal field interlacing.
 +
 +Frames are counted starting from 1, so the first input frame is
 +considered odd.
 +
 +The filter accepts the following options:
 +
 +@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.
 +
 +This filter accepts the following options:
 +
 +@table @option
 +
 +@item dir
 +Specify the transposition direction.
 +
 +Can assume the following values:
 +@table @samp
 +@item 0, 4, cclock_flip
 +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, clock
 +Rotate by 90 degrees clockwise, that is:
 +@example
 +L.R     l.L
 +. . ->  . .
 +l.r     r.R
 +@end example
 +
 +@item 2, 6, cclock
 +Rotate by 90 degrees counterclockwise, that is:
 +@example
 +L.R     R.r
 +. . ->  . .
 +l.r     L.l
 +@end example
 +
 +@item 3, 7, clock_flip
 +Rotate by 90 degrees clockwise and vertically flip, that is:
 +@example
 +L.R     r.R
 +. . ->  . .
 +l.r     l.L
 +@end example
 +@end table
 +
 +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.
 +
 +Numerical values are deprecated, and should be dropped in favor of
 +symbolic constants.
 +
 +@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
 +
 +Default value is @code{none}.
 +@end table
 +
 +For example to rotate by 90 degrees clockwise and preserve portrait
 +layout:
 +@example
 +transpose=dir=1:passthrough=portrait
 +@end example
 +
 +The command above can also be specified as:
 +@example
 +transpose=1:portrait
 +@end example
 +
 +@section trim
 +Trim the input so that the output contains one continuous subpart of the input.
 +
 +This filter accepts the following options:
 +@table @option
 +@item start
 +Specify time of the start of the kept section, i.e. the frame with the
 +timestamp @var{start} will be the first frame in the output.
 +
 +@item end
 +Specify time of the first frame that will be dropped, i.e. the frame
 +immediately preceding the one with the timestamp @var{end} will be the last
 +frame in the output.
 +
 +@item start_pts
 +Same as @var{start}, except this option sets the start timestamp in timebase
 +units instead of seconds.
 +
 +@item end_pts
 +Same as @var{end}, except this option sets the end timestamp in timebase units
 +instead of seconds.
 +
 +@item duration
 +Specify maximum duration of the output.
 +
 +@item start_frame
 +Number of the first frame that should be passed to output.
 +
 +@item end_frame
 +Number of the first frame that should be dropped.
 +@end table
 +
 +@option{start}, @option{end}, @option{duration} are expressed as time
 +duration specifications, check the "Time duration" section in the
 +ffmpeg-utils manual.
 +
 +Note that the first two sets of the start/end options and the @option{duration}
 +option look at the frame timestamp, while the _frame variants simply count the
 +frames that pass through the filter. Also note that this filter does not modify
 +the timestamps. If you wish that the output timestamps start at zero, insert a
 +setpts filter after the trim filter.
 +
 +If multiple start or end options are set, this filter tries to be greedy and
 +keep all the frames that match at least one of the specified constraints. To keep
 +only the part that matches all the constraints at once, chain multiple trim
 +filters.
 +
 +The defaults are such that all the input is kept. So it is possible to set e.g.
 +just the end values to keep everything before the specified time.
 +
 +Examples:
 +@itemize
 +@item
 +drop everything except the second minute of input
 +@example
 +ffmpeg -i INPUT -vf trim=60:120
 +@end example
 +
 +@item
 +keep only the first second
 +@example
 +ffmpeg -i INPUT -vf trim=duration=1
 +@end example
 +
 +@end itemize
 +
 +
 +@section unsharp
 +
 +Sharpen or blur the input video.
 +
 +It accepts the following parameters:
 +
 +@table @option
 +@item luma_msize_x, lx
 +Set the luma matrix horizontal size. It must be an odd integer between
 +3 and 63, default value is 5.
 +
 +@item luma_msize_y, ly
 +Set the luma matrix vertical size. It must be an odd integer between 3
 +and 63, default value is 5.
 +
 +@item luma_amount, la
 +Set the luma 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.
 +
 +@item chroma_msize_x, cx
 +Set the chroma matrix horizontal size. It must be an odd integer
 +between 3 and 63, default value is 5.
 +
 +@item chroma_msize_y, cy
 +Set the chroma matrix vertical size. It must be an odd integer
 +between 3 and 63, default value is 5.
 +
 +@item chroma_amount, ca
 +Set the 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 0.0.
 +
 +@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
 +
 +All parameters are optional and default to the equivalent of the
 +string '5:5:1.0:5:5:0.0'.
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Apply strong luma sharpen effect:
 +@example
 +unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
 +@end example
 +
 +@item
 +Apply strong blur of both luma and chroma parameters:
 +@example
 +unsharp=7:7:-2:7:7:-2
 +@end example
 +@end itemize
 +
 +@anchor{vidstabdetect}
 +@section vidstabdetect
 +
 +Analyze video stabilization/deshaking. Perform pass 1 of 2, see
 +@ref{vidstabtransform} for pass 2.
 +
 +This filter generates a file with relative translation and rotation
 +transform information about subsequent frames, which is then used by
 +the @ref{vidstabtransform} filter.
 +
 +To enable compilation of this filter you need to configure FFmpeg with
 +@code{--enable-libvidstab}.
 +
 +This filter accepts the following options:
 +
 +@table @option
 +@item result
 +Set the path to the file used to write the transforms information.
 +Default value is @file{transforms.trf}.
 +
 +@item shakiness
 +Set how shaky the video is and how quick the camera is. It accepts an
 +integer in the range 1-10, a value of 1 means little shakiness, a
 +value of 10 means strong shakiness. Default value is 5.
 +
 +@item accuracy
 +Set the accuracy of the detection process. It must be a value in the
 +range 1-15. A value of 1 means low accuracy, a value of 15 means high
 +accuracy. Default value is 15.
 +
 +@item stepsize
 +Set stepsize of the search process. The region around minimum is
 +scanned with 1 pixel resolution. Default value is 6.
 +
 +@item mincontrast
 +Set minimum contrast. Below this value a local measurement field is
 +discarded. Must be a floating point value in the range 0-1. Default
 +value is 0.3.
 +
 +@item tripod
 +Set reference frame number for tripod mode.
 +
 +If enabled, the motion of the frames is compared to a reference frame
 +in the filtered stream, identified by the specified number. The idea
 +is to compensate all movements in a more-or-less static scene and keep
 +the camera view absolutely still.
 +
 +If set to 0, it is disabled. The frames are counted starting from 1.
 +
 +@item show
 +Show fields and transforms in the resulting frames. It accepts an
 +integer in the range 0-2. Default value is 0, which disables any
 +visualization.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Use default values:
 +@example
 +vidstabdetect
 +@end example
 +
 +@item
 +Analyze strongly shaky movie and put the results in file
 +@file{mytransforms.trf}:
 +@example
 +vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
 +@end example
 +
 +@item
 +Visualize the result of internal transformations in the resulting
 +video:
 +@example
 +vidstabdetect=show=1
 +@end example
 +
 +@item
 +Analyze a video with medium shakiness using @command{ffmpeg}:
 +@example
 +ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
 +@end example
 +@end itemize
 +
 +@anchor{vidstabtransform}
 +@section vidstabtransform
 +
 +Video stabilization/deshaking: pass 2 of 2,
 +see @ref{vidstabdetect} for pass 1.
 +
 +Read a file with transform information for each frame and
 +apply/compensate them. Together with the @ref{vidstabdetect}
 +filter this can be used to deshake videos. See also
 +@url{http://public.hronopik.de/vid.stab}. It is important to also use
 +the unsharp filter, see below.
 +
 +To enable compilation of this filter you need to configure FFmpeg with
 +@code{--enable-libvidstab}.
 +
 +@subsection Options
 +
 +@table @option
 +@item input
 +Set path to the file used to read the transforms. Default value is
 +@file{transforms.trf}).
 +
 +@item smoothing
 +Set the number of frames (value*2 + 1) used for lowpass filtering the
 +camera movements. Default value is 10.
 +
 +For example a number of 10 means that 21 frames are used (10 in the
 +past and 10 in the future) to smoothen the motion in the video. A
 +larger values leads to a smoother video, but limits the acceleration
 +of the camera (pan/tilt movements). 0 is a special case where a
 +static camera is simulated.
 +
 +@item optalgo
 +Set the camera path optimization algorithm.
 +
 +Accepted values are:
 +@table @samp
 +@item gauss
 +gaussian kernel low-pass filter on camera motion (default)
 +@item avg
 +averaging on transformations
 +@end table
 +
 +@item maxshift
 +Set maximal number of pixels to translate frames. Default value is -1,
 +meaning no limit.
 +
 +@item maxangle
 +Set maximal angle in radians (degree*PI/180) to rotate frames. Default
 +value is -1, meaning no limit.
 +
 +@item crop
 +Specify how to deal with borders that may be visible due to movement
 +compensation.
 +
 +Available values are:
 +@table @samp
 +@item keep
 +keep image information from previous frame (default)
 +@item black
 +fill the border black
 +@end table
 +
 +@item invert
 +Invert transforms if set to 1. Default value is 0.
 +
 +@item relative
 +Consider transforms as relative to previsou frame if set to 1,
 +absolute if set to 0. Default value is 0.
 +
 +@item zoom
 +Set percentage to zoom. A positive value will result in a zoom-in
 +effect, a negative value in a zoom-out effect. Default value is 0 (no
 +zoom).
 +
 +@item optzoom
 +Set optimal zooming to avoid borders.
 +
 +Accepted values are:
 +@table @samp
 +@item 0
 +disabled
 +@item 1
 +optimal static zoom value is determined (only very strong movements
 +will lead to visible borders) (default)
 +@item 2
 +optimal adaptive zoom value is determined (no borders will be
 +visible), see @option{zoomspeed}
 +@end table
 +
 +Note that the value given at zoom is added to the one calculated here.
 +
 +@item zoomspeed
 +Set percent to zoom maximally each frame (enabled when
 +@option{optzoom} is set to 2). Range is from 0 to 5, default value is
 +0.25.
 +
 +@item interpol
 +Specify type of interpolation.
 +
 +Available values are:
 +@table @samp
 +@item no
 +no interpolation
 +@item linear
 +linear only horizontal
 +@item bilinear
 +linear in both directions (default)
 +@item bicubic
 +cubic in both directions (slow)
 +@end table
 +
 +@item tripod
 +Enable virtual tripod mode if set to 1, which is equivalent to
 +@code{relative=0:smoothing=0}. Default value is 0.
 +
 +Use also @code{tripod} option of @ref{vidstabdetect}.
 +
 +@item debug
 +Increase log verbosity if set to 1. Also the detected global motions
 +are written to the temporary file @file{global_motions.trf}. Default
 +value is 0.
 +@end table
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Use @command{ffmpeg} for a typical stabilization with default values:
 +@example
 +ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
 +@end example
 +
 +Note the use of the unsharp filter which is always recommended.
 +
 +@item
 +Zoom in a bit more and load transform data from a given file:
 +@example
 +vidstabtransform=zoom=5:input="mytransforms.trf"
 +@end example
 +
 +@item
 +Smoothen the video even more:
 +@example
 +vidstabtransform=smoothing=30
 +@end example
 +@end itemize
 +
 +@section vflip
 +
 +Flip the input video vertically.
 +
 +For example, to vertically flip a video with @command{ffmpeg}:
 +@example
 +ffmpeg -i in.avi -vf "vflip" out.avi
 +@end example
 +
 +@section vignette
 +
 +Make or reverse a natural vignetting effect.
 +
 +The filter accepts the following options:
 +
 +@table @option
 +@item angle, a
 +Set lens angle expression as a number of radians.
 +
 +The value is clipped in the @code{[0,PI/2]} range.
 +
 +Default value: @code{"PI/5"}
 +
 +@item x0
 +@item y0
 +Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
 +by default.
 +
 +@item mode
 +Set forward/backward mode.
 +
 +Available modes are:
 +@table @samp
 +@item forward
 +The larger the distance from the central point, the darker the image becomes.
 +
 +@item backward
 +The larger the distance from the central point, the brighter the image becomes.
 +This can be used to reverse a vignette effect, though there is no automatic
 +detection to extract the lens @option{angle} and other settings (yet). It can
 +also be used to create a burning effect.
 +@end table
 +
 +Default value is @samp{forward}.
 +
 +@item eval
 +Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
 +
 +It accepts the following values:
 +@table @samp
 +@item init
 +Evaluate expressions only once during the filter initialization.
 +
 +@item frame
 +Evaluate expressions for each incoming frame. This is way slower than the
 +@samp{init} mode since it requires all the scalers to be re-computed, but it
 +allows advanced dynamic expressions.
 +@end table
 +
 +Default value is @samp{init}.
 +
 +@item dither
 +Set dithering to reduce the circular banding effects. Default is @code{1}
 +(enabled).
 +
 +@item aspect
 +Set vignette aspect. This setting allows to adjust the shape of the vignette.
 +Setting this value to the SAR of the input will make a rectangular vignetting
 +following the dimensions of the video.
 +
 +Default is @code{1/1}.
 +@end table
 +
 +@subsection Expressions
 +
 +The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
 +following parameters.
 +
 +@table @option
 +@item w
 +@item h
 +input width and height
 +
 +@item n
 +the number of input frame, starting from 0
 +
 +@item pts
 +the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
 +@var{TB} units, NAN if undefined
 +
 +@item r
 +frame rate of the input video, NAN if the input frame rate is unknown
 +
 +@item t
 +the PTS (Presentation TimeStamp) of the filtered video frame,
 +expressed in seconds, NAN if undefined
 +
 +@item tb
 +time base of the input video
 +@end table
 +
 +
 +@subsection Examples
 +
 +@itemize
 +@item
 +Apply simple strong vignetting effect:
 +@example
 +vignette=PI/4
 +@end example
 +
 +@item
 +Make a flickering vignetting:
 +@example
 +vignette='PI/4+random(1)*PI/50':eval=frame
 +@end example
 +
 +@end itemize
  
 -Some examples follow:
 -@example
 -# convert the input video to the format "yuv420p"
 -format=pix_fmts=yuv420p
 +@section w3fdif
  
 -# convert the input video to any of the formats in the list
 -format=pix_fmts=yuv420p|yuv444p|yuv410p
 -@end example
 +Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
 +Deinterlacing Filter").
  
 -@anchor{fps}
 -@section fps
 +Based on the process described by Martin Weston for BBC R&D, and
 +implemented based on the de-interlace algorithm written by Jim
 +Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
 +uses filter coefficients calculated by BBC R&D.
  
 -Convert the video to specified constant framerate by duplicating or dropping
 -frames as necessary.
 +There are two sets of filter coefficients, so called "simple":
 +and "complex". Which set of filter coefficients is used can
 +be set by passing an optional parameter:
  
 -This filter accepts the following named parameters:
  @table @option
 +@item filter
 +Set the interlacing filter coefficients. Accepts one of the following values:
  
 -@item fps
 -Desired output framerate.
 +@table @samp
 +@item simple
 +Simple filter coefficient set.
 +@item complex
 +More-complex filter coefficient set.
 +@end table
 +Default value is @samp{complex}.
  
 -@item start_time
 -Assume the first PTS should be the given value, in seconds. This allows for
 -padding/trimming at the start of stream. By default, no assumption is made
 -about the first frame's expected PTS, so no padding or trimming is done.
 -For example, this could be set to 0 to pad the beginning with duplicates of
 -the first frame if a video stream starts after the audio stream or to trim any
 -frames with a negative PTS.
 +@item deint
 +Specify which frames to deinterlace. Accept one of the following values:
  
 +@table @samp
 +@item all
 +Deinterlace all frames,
 +@item interlaced
 +Only deinterlace frames marked as interlaced.
  @end table
  
 -@section framepack
 +Default value is @samp{all}.
 +@end table
 +
 +@anchor{yadif}
 +@section yadif
 +
 +Deinterlace the input video ("yadif" means "yet another deinterlacing
 +filter").
 +
 +This filter accepts the following options:
  
 -Pack two different video streams into a stereoscopic video, setting proper
 -metadata on supported codecs. The two views should have the same size and
 -framerate and processing will stop when the shorter video ends. Please note
 -that you may conveniently adjust view properties with the @ref{scale} and
 -@ref{fps} filters.
  
 -This filter accepts the following named parameters:
  @table @option
  
 -@item format
 -Desired packing format. Supported values are:
 +@item mode
 +The interlacing mode to adopt, accepts 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
  
 -@item sbs
 -Views are next to each other (default).
 +Default value is @code{send_frame}.
  
 -@item tab
 -Views are on top of each other.
 +@item parity
 +The picture field parity assumed for the input interlaced video, accepts one of
 +the following values:
  
 -@item lines
 -Views are packed by line.
 +@table @option
 +@item 0, tff
 +assume top field first
 +@item 1, bff
 +assume bottom field first
 +@item -1, auto
 +enable automatic detection
 +@end table
  
 -@item columns
 -Views are eacked by column.
 +Default value is @code{auto}.
 +If interlacing is unknown or decoder does not export this information,
 +top field first will be assumed.
  
 -@item frameseq
 -Views are temporally interleaved.
 +@item deint
 +Specify which frames to deinterlace. Accept one of the following
 +values:
  
 +@table @option
 +@item 0, all
 +deinterlace all frames
 +@item 1, interlaced
 +only deinterlace frames marked as interlaced
  @end table
  
 +Default value is @code{all}.
  @end table
  
 -Some examples follow:
 +@c man end VIDEO FILTERS
  
 -@example
 -# Convert left and right views into a frame sequential video.
 -avconv -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
 +@chapter Video Sources
 +@c man begin VIDEO SOURCES
  
 -# Convert views into a side-by-side video with the same output resolution as the input.
 -avconv -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
 -@end example
 +Below is a description of the currently available video sources.
  
 -@anchor{frei0r}
 -@section frei0r
 +@section buffer
  
 -Apply a frei0r effect to the input video.
 +Buffer video frames, and make them available to the filter chain.
  
 -To enable compilation of this filter you need to install the frei0r
 -header and configure Libav with --enable-frei0r.
 +This source is mainly intended for a programmatic use, in particular
 +through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  
 -This filter accepts the following options:
 +This source accepts the following options:
  
  @table @option
  
index 938033a77bc6cca7f1baefd4c39bdcdc56d766c8,b3591ebea1528fbba130ecac6387ea7e991976bb..56b2484da226c4fd2afcdf5656159b4229b88d7e
@@@ -85,25 -77,15 +95,28 @@@ typedef struct 
      const AVClass *class;
      int x, y;                   ///< position of overlayed picture
  
 -    int max_plane_step[4];      ///< steps per pixel for each plane
 +    int allow_packed_rgb;
 +    uint8_t main_is_packed_rgb;
 +    uint8_t main_rgba_map[4];
 +    uint8_t main_has_alpha;
 +    uint8_t overlay_is_packed_rgb;
 +    uint8_t overlay_rgba_map[4];
 +    uint8_t overlay_has_alpha;
 +    enum OverlayFormat { OVERLAY_FORMAT_YUV420, OVERLAY_FORMAT_YUV422, OVERLAY_FORMAT_YUV444, OVERLAY_FORMAT_RGB, OVERLAY_FORMAT_NB} format;
 +    enum EvalMode { EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB } eval_mode;
 +
 +    FFDualInputContext dinput;
 +
 +    int main_pix_step[4];       ///< steps per pixel for each plane of the main output
 +    int overlay_pix_step[4];    ///< steps per pixel for each plane of the overlay
      int hsub, vsub;             ///< chroma subsampling values
  
 +    double var_values[VAR_VARS_NB];
      char *x_expr, *y_expr;
 -    AVFrame *main;
 -    AVFrame *over_prev, *over_next;
+     enum EOFAction eof_action;  ///< action to take on EOF from source
 +    AVExpr *x_pexpr, *y_pexpr;
  } OverlayContext;
  
  static av_cold void uninit(AVFilterContext *ctx)
@@@ -281,40 -133,55 +294,41 @@@ static int config_input_overlay(AVFilte
  
      /* Finish the configuration by evaluating the expressions
         now when both inputs are configured. */
 -    var_values[VAR_E  ] = M_E;
 -    var_values[VAR_PHI] = M_PHI;
 -    var_values[VAR_PI ] = M_PI;
 -
 -    var_values[VAR_MAIN_W   ] = var_values[VAR_MW] = ctx->inputs[MAIN   ]->w;
 -    var_values[VAR_MAIN_H   ] = var_values[VAR_MH] = ctx->inputs[MAIN   ]->h;
 -    var_values[VAR_OVERLAY_W] = var_values[VAR_OW] = ctx->inputs[OVERLAY]->w;
 -    var_values[VAR_OVERLAY_H] = var_values[VAR_OH] = ctx->inputs[OVERLAY]->h;
 -
 -    if ((ret = av_expr_parse_and_eval(&res, (expr = s->x_expr), var_names, var_values,
 -                                      NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
 -        goto fail;
 -    s->x = res;
 -    if ((ret = av_expr_parse_and_eval(&res, (expr = s->y_expr), var_names, var_values,
 -                                      NULL, NULL, NULL, NULL, NULL, 0, ctx)))
 -        goto fail;
 -    s->y = res;
 -    /* x may depend on y */
 -    if ((ret = av_expr_parse_and_eval(&res, (expr = s->x_expr), var_names, var_values,
 -                                      NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
 -        goto fail;
 -    s->x = res;
 +    s->var_values[VAR_MAIN_W   ] = s->var_values[VAR_MW] = ctx->inputs[MAIN   ]->w;
 +    s->var_values[VAR_MAIN_H   ] = s->var_values[VAR_MH] = ctx->inputs[MAIN   ]->h;
 +    s->var_values[VAR_OVERLAY_W] = s->var_values[VAR_OW] = ctx->inputs[OVERLAY]->w;
 +    s->var_values[VAR_OVERLAY_H] = s->var_values[VAR_OH] = ctx->inputs[OVERLAY]->h;
 +    s->var_values[VAR_HSUB]  = 1<<pix_desc->log2_chroma_w;
 +    s->var_values[VAR_VSUB]  = 1<<pix_desc->log2_chroma_h;
 +    s->var_values[VAR_X]     = NAN;
 +    s->var_values[VAR_Y]     = NAN;
 +    s->var_values[VAR_N]     = 0;
 +    s->var_values[VAR_T]     = NAN;
 +    s->var_values[VAR_POS]   = NAN;
 +
 +    if ((ret = set_expr(&s->x_pexpr,      s->x_expr,      "x",      ctx)) < 0 ||
 +        (ret = set_expr(&s->y_pexpr,      s->y_expr,      "y",      ctx)) < 0)
 +        return ret;
 +
 +    s->overlay_is_packed_rgb =
 +        ff_fill_rgba_map(s->overlay_rgba_map, inlink->format) >= 0;
 +    s->overlay_has_alpha = ff_fmt_is_in(inlink->format, alpha_pix_fmts);
 +
 +    if (s->eval_mode == EVAL_MODE_INIT) {
 +        eval_expr(ctx);
 +        av_log(ctx, AV_LOG_VERBOSE, "x:%f xi:%d y:%f yi:%d\n",
 +               s->var_values[VAR_X], s->x,
 +               s->var_values[VAR_Y], s->y);
 +    }
  
      av_log(ctx, AV_LOG_VERBOSE,
-            "main w:%d h:%d fmt:%s overlay w:%d h:%d fmt:%s\n",
 -           "main w:%d h:%d fmt:%s overlay x:%d y:%d w:%d h:%d fmt:%s eof_action:%s\n",
++           "main w:%d h:%d fmt:%s overlay w:%d h:%d fmt:%s eof_action:%s\n",
             ctx->inputs[MAIN]->w, ctx->inputs[MAIN]->h,
             av_get_pix_fmt_name(ctx->inputs[MAIN]->format),
 -           s->x, s->y,
             ctx->inputs[OVERLAY]->w, ctx->inputs[OVERLAY]->h,
-            av_get_pix_fmt_name(ctx->inputs[OVERLAY]->format));
+            av_get_pix_fmt_name(ctx->inputs[OVERLAY]->format),
+            eof_action_str[s->eof_action]);
 -
 -    if (s->x < 0 || s->y < 0 ||
 -        s->x + var_values[VAR_OVERLAY_W] > var_values[VAR_MAIN_W] ||
 -        s->y + var_values[VAR_OVERLAY_H] > var_values[VAR_MAIN_H]) {
 -        av_log(ctx, AV_LOG_ERROR,
 -               "Overlay area (%d,%d)<->(%d,%d) not within the main area (0,0)<->(%d,%d) or zero-sized\n",
 -               s->x, s->y,
 -               (int)(s->x + var_values[VAR_OVERLAY_W]),
 -               (int)(s->y + var_values[VAR_OVERLAY_H]),
 -               (int)var_values[VAR_MAIN_W], (int)var_values[VAR_MAIN_H]);
 -        return AVERROR(EINVAL);
 -    }
      return 0;
 -
 -fail:
 -    av_log(NULL, AV_LOG_ERROR,
 -           "Error when evaluating the expression '%s'\n", expr);
 -    return ret;
  }
  
  static int config_output(AVFilterLink *outlink)
@@@ -534,78 -271,120 +548,93 @@@ static void blend_image(AVFilterContex
      }
  }
  
 -static int filter_frame_main(AVFilterLink *inlink, AVFrame *frame)
 +static AVFrame *do_blend(AVFilterContext *ctx, AVFrame *mainpic,
 +                         const AVFrame *second)
  {
 -    OverlayContext *s = inlink->dst->priv;
 -
 -    av_assert0(!s->main);
 -    s->main         = frame;
 +    OverlayContext *s = ctx->priv;
 +    AVFilterLink *inlink = ctx->inputs[0];
 +
 +        /* TODO: reindent */
 +        if (s->eval_mode == EVAL_MODE_FRAME) {
 +            int64_t pos = av_frame_get_pkt_pos(mainpic);
 +
 +            s->var_values[VAR_N] = inlink->frame_count;
 +            s->var_values[VAR_T] = mainpic->pts == AV_NOPTS_VALUE ?
 +                NAN : mainpic->pts * av_q2d(inlink->time_base);
 +            s->var_values[VAR_POS] = pos == -1 ? NAN : pos;
 +
 +            eval_expr(ctx);
 +            av_log(ctx, AV_LOG_DEBUG, "n:%f t:%f pos:%f x:%f xi:%d y:%f yi:%d\n",
 +                   s->var_values[VAR_N], s->var_values[VAR_T], s->var_values[VAR_POS],
 +                   s->var_values[VAR_X], s->x,
 +                   s->var_values[VAR_Y], s->y);
 +        }
  
 -    return 0;
 +    blend_image(ctx, mainpic, second, s->x, s->y);
 +    return mainpic;
  }
  
 -static int filter_frame_overlay(AVFilterLink *inlink, AVFrame *frame)
 +static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
  {
      OverlayContext *s = inlink->dst->priv;
 -
 -    av_assert0(!s->over_next);
 -    s->over_next    = frame;
 -
 -    return 0;
 +    return ff_dualinput_filter_frame(&s->dinput, inlink, inpicref);
  }
  
 -static int output_frame(AVFilterContext *ctx)
 +static int request_frame(AVFilterLink *outlink)
  {
 -    OverlayContext *s = ctx->priv;
 -    AVFilterLink *outlink = ctx->outputs[0];
 -    int ret = ff_filter_frame(outlink, s->main);
 -    s->main = NULL;
 -
 -    return ret;
 +    OverlayContext *s = outlink->src->priv;
 +    return ff_dualinput_request_frame(&s->dinput, outlink);
  }
  
 -static int handle_overlay_eof(AVFilterContext *ctx)
 +static av_cold int init(AVFilterContext *ctx)
  {
      OverlayContext *s = ctx->priv;
 -    /* Repeat previous frame on secondary input */
 -    if (s->over_prev && s->eof_action == EOF_ACTION_REPEAT)
 -        blend_frame(ctx, s->main, s->over_prev, s->x, s->y);
 -    /* End both streams */
 -    else if (s->eof_action == EOF_ACTION_ENDALL)
 -        return AVERROR_EOF;
 -    return output_frame(ctx);
 -}
  
 -static int request_frame(AVFilterLink *outlink)
 -{
 -    AVFilterContext *ctx = outlink->src;
 -    OverlayContext    *s = ctx->priv;
 -    AVRational tb_main = ctx->inputs[MAIN]->time_base;
 -    AVRational tb_over = ctx->inputs[OVERLAY]->time_base;
 -    int ret = 0;
 -
 -    /* get a frame on the main input */
 -    if (!s->main) {
 -        ret = ff_request_frame(ctx->inputs[MAIN]);
 -        if (ret < 0)
 -            return ret;
 +    if (s->allow_packed_rgb) {
 +        av_log(ctx, AV_LOG_WARNING,
 +               "The rgb option is deprecated and is overriding the format option, use format instead\n");
 +        s->format = OVERLAY_FORMAT_RGB;
      }
 -
 -    /* get a new frame on the overlay input, on EOF check setting 'eof_action' */
 -    if (!s->over_next) {
 -        ret = ff_request_frame(ctx->inputs[OVERLAY]);
 -        if (ret == AVERROR_EOF)
 -           return handle_overlay_eof(ctx);
 -        else if (ret < 0)
 -            return ret;
++    if (!s->dinput.repeatlast || s->eof_action == EOF_ACTION_PASS) {
++        s->dinput.repeatlast = 0;
++        s->eof_action = EOF_ACTION_PASS;
+     }
 -
 -    while (s->main->pts != AV_NOPTS_VALUE &&
 -           s->over_next->pts != AV_NOPTS_VALUE &&
 -           av_compare_ts(s->over_next->pts, tb_over, s->main->pts, tb_main) < 0) {
 -        av_frame_free(&s->over_prev);
 -        FFSWAP(AVFrame*, s->over_prev, s->over_next);
 -
 -        ret = ff_request_frame(ctx->inputs[OVERLAY]);
 -        if (ret == AVERROR_EOF)
 -            return handle_overlay_eof(ctx);
 -        else if (ret < 0)
 -            return ret;
++    if (s->dinput.shortest || s->eof_action == EOF_ACTION_ENDALL) {
++        s->dinput.shortest = 1;
++        s->eof_action = EOF_ACTION_ENDALL;
+     }
 -    if (s->main->pts == AV_NOPTS_VALUE ||
 -        s->over_next->pts == AV_NOPTS_VALUE ||
 -        !av_compare_ts(s->over_next->pts, tb_over, s->main->pts, tb_main)) {
 -        blend_frame(ctx, s->main, s->over_next, s->x, s->y);
 -        av_frame_free(&s->over_prev);
 -        FFSWAP(AVFrame*, s->over_prev, s->over_next);
 -    } else if (s->over_prev) {
 -        blend_frame(ctx, s->main, s->over_prev, s->x, s->y);
 -    }
 -
 -    return output_frame(ctx);
 +    s->dinput.process = do_blend;
 +    return 0;
  }
  
  #define OFFSET(x) offsetof(OverlayContext, x)
 -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
 -static const AVOption options[] = {
 -    { "x", "Horizontal position of the left edge of the overlaid video on the "
 -        "main video.",          OFFSET(x_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
 -    { "y", "Vertical position of the top edge of the overlaid video on the "
 -        "main video.",          OFFSET(y_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
 +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 +
 +static const AVOption overlay_options[] = {
 +    { "x", "set the x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str = "0"}, CHAR_MIN, CHAR_MAX, FLAGS },
 +    { "y", "set the y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str = "0"}, CHAR_MIN, CHAR_MAX, FLAGS },
+     { "eof_action", "Action to take when encountering EOF from secondary input ",
+         OFFSET(eof_action), AV_OPT_TYPE_INT, { .i64 = EOF_ACTION_REPEAT },
+         EOF_ACTION_REPEAT, EOF_ACTION_PASS, .flags = FLAGS, "eof_action" },
+         { "repeat", "Repeat the previous frame.",   0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_REPEAT }, .flags = FLAGS, "eof_action" },
+         { "endall", "End both streams.",            0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_ENDALL }, .flags = FLAGS, "eof_action" },
+         { "pass",   "Pass through the main input.", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_PASS },   .flags = FLAGS, "eof_action" },
 -    { NULL },
 +    { "eval", "specify when to evaluate expressions", OFFSET(eval_mode), AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_FRAME}, 0, EVAL_MODE_NB-1, FLAGS, "eval" },
 +         { "init",  "eval expressions once during initialization", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT},  .flags = FLAGS, .unit = "eval" },
 +         { "frame", "eval expressions per-frame",                  0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
 +    { "rgb", "force packed RGB in input and output (deprecated)", OFFSET(allow_packed_rgb), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS },
 +    { "shortest", "force termination when the shortest input terminates", OFFSET(dinput.shortest), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },
 +    { "format", "set output format", OFFSET(format), AV_OPT_TYPE_INT, {.i64=OVERLAY_FORMAT_YUV420}, 0, OVERLAY_FORMAT_NB-1, FLAGS, "format" },
 +        { "yuv420", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV420}, .flags = FLAGS, .unit = "format" },
 +        { "yuv422", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV422}, .flags = FLAGS, .unit = "format" },
 +        { "yuv444", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV444}, .flags = FLAGS, .unit = "format" },
 +        { "rgb",    "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_RGB},    .flags = FLAGS, .unit = "format" },
 +    { "repeatlast", "repeat overlay of the last overlay frame", OFFSET(dinput.repeatlast), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS },
 +    { NULL }
  };
  
 -static const AVClass overlay_class = {
 -    .class_name = "overlay",
 -    .item_name  = av_default_item_name,
 -    .option     = options,
 -    .version    = LIBAVUTIL_VERSION_INT,
 -};
 +AVFILTER_DEFINE_CLASS(overlay);
  
  static const AVFilterPad avfilter_vf_overlay_inputs[] = {
      {