annotate ffmpeg/doc/filters.texi @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 @chapter Filtering Introduction
yading@10 2 @c man begin FILTERING INTRODUCTION
yading@10 3
yading@10 4 Filtering in FFmpeg is enabled through the libavfilter library.
yading@10 5
yading@10 6 In libavfilter, a filter can have multiple inputs and multiple
yading@10 7 outputs.
yading@10 8 To illustrate the sorts of things that are possible, we consider the
yading@10 9 following filtergraph.
yading@10 10
yading@10 11 @example
yading@10 12 input --> split ---------------------> overlay --> output
yading@10 13 | ^
yading@10 14 | |
yading@10 15 +-----> crop --> vflip -------+
yading@10 16 @end example
yading@10 17
yading@10 18 This filtergraph splits the input stream in two streams, sends one
yading@10 19 stream through the crop filter and the vflip filter before merging it
yading@10 20 back with the other stream by overlaying it on top. You can use the
yading@10 21 following command to achieve this:
yading@10 22
yading@10 23 @example
yading@10 24 ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
yading@10 25 @end example
yading@10 26
yading@10 27 The result will be that in output the top half of the video is mirrored
yading@10 28 onto the bottom half.
yading@10 29
yading@10 30 Filters in the same linear chain are separated by commas, and distinct
yading@10 31 linear chains of filters are separated by semicolons. In our example,
yading@10 32 @var{crop,vflip} are in one linear chain, @var{split} and
yading@10 33 @var{overlay} are separately in another. The points where the linear
yading@10 34 chains join are labelled by names enclosed in square brackets. In the
yading@10 35 example, the split filter generates two outputs that are associated to
yading@10 36 the labels @var{[main]} and @var{[tmp]}.
yading@10 37
yading@10 38 The stream sent to the second output of @var{split}, labelled as
yading@10 39 @var{[tmp]}, is processed through the @var{crop} filter, which crops
yading@10 40 away the lower half part of the video, and then vertically flipped. The
yading@10 41 @var{overlay} filter takes in input the first unchanged output of the
yading@10 42 split filter (which was labelled as @var{[main]}), and overlay on its
yading@10 43 lower half the output generated by the @var{crop,vflip} filterchain.
yading@10 44
yading@10 45 Some filters take in input a list of parameters: they are specified
yading@10 46 after the filter name and an equal sign, and are separated from each other
yading@10 47 by a colon.
yading@10 48
yading@10 49 There exist so-called @var{source filters} that do not have an
yading@10 50 audio/video input, and @var{sink filters} that will not have audio/video
yading@10 51 output.
yading@10 52
yading@10 53 @c man end FILTERING INTRODUCTION
yading@10 54
yading@10 55 @chapter graph2dot
yading@10 56 @c man begin GRAPH2DOT
yading@10 57
yading@10 58 The @file{graph2dot} program included in the FFmpeg @file{tools}
yading@10 59 directory can be used to parse a filtergraph description and issue a
yading@10 60 corresponding textual representation in the dot language.
yading@10 61
yading@10 62 Invoke the command:
yading@10 63 @example
yading@10 64 graph2dot -h
yading@10 65 @end example
yading@10 66
yading@10 67 to see how to use @file{graph2dot}.
yading@10 68
yading@10 69 You can then pass the dot description to the @file{dot} program (from
yading@10 70 the graphviz suite of programs) and obtain a graphical representation
yading@10 71 of the filtergraph.
yading@10 72
yading@10 73 For example the sequence of commands:
yading@10 74 @example
yading@10 75 echo @var{GRAPH_DESCRIPTION} | \
yading@10 76 tools/graph2dot -o graph.tmp && \
yading@10 77 dot -Tpng graph.tmp -o graph.png && \
yading@10 78 display graph.png
yading@10 79 @end example
yading@10 80
yading@10 81 can be used to create and display an image representing the graph
yading@10 82 described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
yading@10 83 a complete self-contained graph, with its inputs and outputs explicitly defined.
yading@10 84 For example if your command line is of the form:
yading@10 85 @example
yading@10 86 ffmpeg -i infile -vf scale=640:360 outfile
yading@10 87 @end example
yading@10 88 your @var{GRAPH_DESCRIPTION} string will need to be of the form:
yading@10 89 @example
yading@10 90 nullsrc,scale=640:360,nullsink
yading@10 91 @end example
yading@10 92 you may also need to set the @var{nullsrc} parameters and add a @var{format}
yading@10 93 filter in order to simulate a specific input file.
yading@10 94
yading@10 95 @c man end GRAPH2DOT
yading@10 96
yading@10 97 @chapter Filtergraph description
yading@10 98 @c man begin FILTERGRAPH DESCRIPTION
yading@10 99
yading@10 100 A filtergraph is a directed graph of connected filters. It can contain
yading@10 101 cycles, and there can be multiple links between a pair of
yading@10 102 filters. Each link has one input pad on one side connecting it to one
yading@10 103 filter from which it takes its input, and one output pad on the other
yading@10 104 side connecting it to the one filter accepting its output.
yading@10 105
yading@10 106 Each filter in a filtergraph is an instance of a filter class
yading@10 107 registered in the application, which defines the features and the
yading@10 108 number of input and output pads of the filter.
yading@10 109
yading@10 110 A filter with no input pads is called a "source", a filter with no
yading@10 111 output pads is called a "sink".
yading@10 112
yading@10 113 @anchor{Filtergraph syntax}
yading@10 114 @section Filtergraph syntax
yading@10 115
yading@10 116 A filtergraph can be represented using a textual representation, which is
yading@10 117 recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
yading@10 118 options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the
yading@10 119 @code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} function defined in
yading@10 120 @file{libavfilter/avfilter.h}.
yading@10 121
yading@10 122 A filterchain consists of a sequence of connected filters, each one
yading@10 123 connected to the previous one in the sequence. A filterchain is
yading@10 124 represented by a list of ","-separated filter descriptions.
yading@10 125
yading@10 126 A filtergraph consists of a sequence of filterchains. A sequence of
yading@10 127 filterchains is represented by a list of ";"-separated filterchain
yading@10 128 descriptions.
yading@10 129
yading@10 130 A filter is represented by a string of the form:
yading@10 131 [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
yading@10 132
yading@10 133 @var{filter_name} is the name of the filter class of which the
yading@10 134 described filter is an instance of, and has to be the name of one of
yading@10 135 the filter classes registered in the program.
yading@10 136 The name of the filter class is optionally followed by a string
yading@10 137 "=@var{arguments}".
yading@10 138
yading@10 139 @var{arguments} is a string which contains the parameters used to
yading@10 140 initialize the filter instance. It may have one of the following forms:
yading@10 141 @itemize
yading@10 142
yading@10 143 @item
yading@10 144 A ':'-separated list of @var{key=value} pairs.
yading@10 145
yading@10 146 @item
yading@10 147 A ':'-separated list of @var{value}. In this case, the keys are assumed to be
yading@10 148 the option names in the order they are declared. E.g. the @code{fade} filter
yading@10 149 declares three options in this order -- @option{type}, @option{start_frame} and
yading@10 150 @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
yading@10 151 @var{in} is assigned to the option @option{type}, @var{0} to
yading@10 152 @option{start_frame} and @var{30} to @option{nb_frames}.
yading@10 153
yading@10 154 @item
yading@10 155 A ':'-separated list of mixed direct @var{value} and long @var{key=value}
yading@10 156 pairs. The direct @var{value} must precede the @var{key=value} pairs, and
yading@10 157 follow the same constraints order of the previous point. The following
yading@10 158 @var{key=value} pairs can be set in any preferred order.
yading@10 159
yading@10 160 @end itemize
yading@10 161
yading@10 162 If the option value itself is a list of items (e.g. the @code{format} filter
yading@10 163 takes a list of pixel formats), the items in the list are usually separated by
yading@10 164 '|'.
yading@10 165
yading@10 166 The list of arguments can be quoted using the character "'" as initial
yading@10 167 and ending mark, and the character '\' for escaping the characters
yading@10 168 within the quoted text; otherwise the argument string is considered
yading@10 169 terminated when the next special character (belonging to the set
yading@10 170 "[]=;,") is encountered.
yading@10 171
yading@10 172 The name and arguments of the filter are optionally preceded and
yading@10 173 followed by a list of link labels.
yading@10 174 A link label allows to name a link and associate it to a filter output
yading@10 175 or input pad. The preceding labels @var{in_link_1}
yading@10 176 ... @var{in_link_N}, are associated to the filter input pads,
yading@10 177 the following labels @var{out_link_1} ... @var{out_link_M}, are
yading@10 178 associated to the output pads.
yading@10 179
yading@10 180 When two link labels with the same name are found in the
yading@10 181 filtergraph, a link between the corresponding input and output pad is
yading@10 182 created.
yading@10 183
yading@10 184 If an output pad is not labelled, it is linked by default to the first
yading@10 185 unlabelled input pad of the next filter in the filterchain.
yading@10 186 For example in the filterchain:
yading@10 187 @example
yading@10 188 nullsrc, split[L1], [L2]overlay, nullsink
yading@10 189 @end example
yading@10 190 the split filter instance has two output pads, and the overlay filter
yading@10 191 instance two input pads. The first output pad of split is labelled
yading@10 192 "L1", the first input pad of overlay is labelled "L2", and the second
yading@10 193 output pad of split is linked to the second input pad of overlay,
yading@10 194 which are both unlabelled.
yading@10 195
yading@10 196 In a complete filterchain all the unlabelled filter input and output
yading@10 197 pads must be connected. A filtergraph is considered valid if all the
yading@10 198 filter input and output pads of all the filterchains are connected.
yading@10 199
yading@10 200 Libavfilter will automatically insert scale filters where format
yading@10 201 conversion is required. It is possible to specify swscale flags
yading@10 202 for those automatically inserted scalers by prepending
yading@10 203 @code{sws_flags=@var{flags};}
yading@10 204 to the filtergraph description.
yading@10 205
yading@10 206 Follows a BNF description for the filtergraph syntax:
yading@10 207 @example
yading@10 208 @var{NAME} ::= sequence of alphanumeric characters and '_'
yading@10 209 @var{LINKLABEL} ::= "[" @var{NAME} "]"
yading@10 210 @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
yading@10 211 @var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
yading@10 212 @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
yading@10 213 @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
yading@10 214 @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
yading@10 215 @end example
yading@10 216
yading@10 217 @section Notes on filtergraph escaping
yading@10 218
yading@10 219 Some filter arguments require the use of special characters, typically
yading@10 220 @code{:} to separate key=value pairs in a named options list. In this
yading@10 221 case the user should perform a first level escaping when specifying
yading@10 222 the filter arguments. For example, consider the following literal
yading@10 223 string to be embedded in the @ref{drawtext} filter arguments:
yading@10 224 @example
yading@10 225 this is a 'string': may contain one, or more, special characters
yading@10 226 @end example
yading@10 227
yading@10 228 Since @code{:} is special for the filter arguments syntax, it needs to
yading@10 229 be escaped, so you get:
yading@10 230 @example
yading@10 231 text=this is a \'string\'\: may contain one, or more, special characters
yading@10 232 @end example
yading@10 233
yading@10 234 A second level of escaping is required when embedding the filter
yading@10 235 arguments in a filtergraph description, in order to escape all the
yading@10 236 filtergraph special characters. Thus the example above becomes:
yading@10 237 @example
yading@10 238 drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
yading@10 239 @end example
yading@10 240
yading@10 241 Finally an additional level of escaping may be needed when writing the
yading@10 242 filtergraph description in a shell command, which depends on the
yading@10 243 escaping rules of the adopted shell. For example, assuming that
yading@10 244 @code{\} is special and needs to be escaped with another @code{\}, the
yading@10 245 previous string will finally result in:
yading@10 246 @example
yading@10 247 -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
yading@10 248 @end example
yading@10 249
yading@10 250 Sometimes, it might be more convenient to employ quoting in place of
yading@10 251 escaping. For example the string:
yading@10 252 @example
yading@10 253 Caesar: tu quoque, Brute, fili mi
yading@10 254 @end example
yading@10 255
yading@10 256 Can be quoted in the filter arguments as:
yading@10 257 @example
yading@10 258 text='Caesar: tu quoque, Brute, fili mi'
yading@10 259 @end example
yading@10 260
yading@10 261 And finally inserted in a filtergraph like:
yading@10 262 @example
yading@10 263 drawtext=text=\'Caesar: tu quoque\, Brute\, fili mi\'
yading@10 264 @end example
yading@10 265
yading@10 266 See the ``Quoting and escaping'' section in the ffmpeg-utils manual
yading@10 267 for more information about the escaping and quoting rules adopted by
yading@10 268 FFmpeg.
yading@10 269
yading@10 270 @c man end FILTERGRAPH DESCRIPTION
yading@10 271
yading@10 272 @chapter Audio Filters
yading@10 273 @c man begin AUDIO FILTERS
yading@10 274
yading@10 275 When you configure your FFmpeg build, you can disable any of the
yading@10 276 existing filters using @code{--disable-filters}.
yading@10 277 The configure output will show the audio filters included in your
yading@10 278 build.
yading@10 279
yading@10 280 Below is a description of the currently available audio filters.
yading@10 281
yading@10 282 @section aconvert
yading@10 283
yading@10 284 Convert the input audio format to the specified formats.
yading@10 285
yading@10 286 @emph{This filter is deprecated. Use @ref{aformat} instead.}
yading@10 287
yading@10 288 The filter accepts a string of the form:
yading@10 289 "@var{sample_format}:@var{channel_layout}".
yading@10 290
yading@10 291 @var{sample_format} specifies the sample format, and can be a string or the
yading@10 292 corresponding numeric value defined in @file{libavutil/samplefmt.h}. Use 'p'
yading@10 293 suffix for a planar sample format.
yading@10 294
yading@10 295 @var{channel_layout} specifies the channel layout, and can be a string
yading@10 296 or the corresponding number value defined in @file{libavutil/channel_layout.h}.
yading@10 297
yading@10 298 The special parameter "auto", signifies that the filter will
yading@10 299 automatically select the output format depending on the output filter.
yading@10 300
yading@10 301 @subsection Examples
yading@10 302
yading@10 303 @itemize
yading@10 304 @item
yading@10 305 Convert input to float, planar, stereo:
yading@10 306 @example
yading@10 307 aconvert=fltp:stereo
yading@10 308 @end example
yading@10 309
yading@10 310 @item
yading@10 311 Convert input to unsigned 8-bit, automatically select out channel layout:
yading@10 312 @example
yading@10 313 aconvert=u8:auto
yading@10 314 @end example
yading@10 315 @end itemize
yading@10 316
yading@10 317 @section allpass
yading@10 318
yading@10 319 Apply a two-pole all-pass filter with central frequency (in Hz)
yading@10 320 @var{frequency}, and filter-width @var{width}.
yading@10 321 An all-pass filter changes the audio's frequency to phase relationship
yading@10 322 without changing its frequency to amplitude relationship.
yading@10 323
yading@10 324 The filter accepts the following options:
yading@10 325
yading@10 326 @table @option
yading@10 327 @item frequency, f
yading@10 328 Set frequency in Hz.
yading@10 329
yading@10 330 @item width_type
yading@10 331 Set method to specify band-width of filter.
yading@10 332 @table @option
yading@10 333 @item h
yading@10 334 Hz
yading@10 335 @item q
yading@10 336 Q-Factor
yading@10 337 @item o
yading@10 338 octave
yading@10 339 @item s
yading@10 340 slope
yading@10 341 @end table
yading@10 342
yading@10 343 @item width, w
yading@10 344 Specify the band-width of a filter in width_type units.
yading@10 345 @end table
yading@10 346
yading@10 347 @section highpass
yading@10 348
yading@10 349 Apply a high-pass filter with 3dB point frequency.
yading@10 350 The filter can be either single-pole, or double-pole (the default).
yading@10 351 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
yading@10 352
yading@10 353 The filter accepts the following options:
yading@10 354
yading@10 355 @table @option
yading@10 356 @item frequency, f
yading@10 357 Set frequency in Hz. Default is 3000.
yading@10 358
yading@10 359 @item poles, p
yading@10 360 Set number of poles. Default is 2.
yading@10 361
yading@10 362 @item width_type
yading@10 363 Set method to specify band-width of filter.
yading@10 364 @table @option
yading@10 365 @item h
yading@10 366 Hz
yading@10 367 @item q
yading@10 368 Q-Factor
yading@10 369 @item o
yading@10 370 octave
yading@10 371 @item s
yading@10 372 slope
yading@10 373 @end table
yading@10 374
yading@10 375 @item width, w
yading@10 376 Specify the band-width of a filter in width_type units.
yading@10 377 Applies only to double-pole filter.
yading@10 378 The default is 0.707q and gives a Butterworth response.
yading@10 379 @end table
yading@10 380
yading@10 381 @section lowpass
yading@10 382
yading@10 383 Apply a low-pass filter with 3dB point frequency.
yading@10 384 The filter can be either single-pole or double-pole (the default).
yading@10 385 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
yading@10 386
yading@10 387 The filter accepts the following options:
yading@10 388
yading@10 389 @table @option
yading@10 390 @item frequency, f
yading@10 391 Set frequency in Hz. Default is 500.
yading@10 392
yading@10 393 @item poles, p
yading@10 394 Set number of poles. Default is 2.
yading@10 395
yading@10 396 @item width_type
yading@10 397 Set method to specify band-width of filter.
yading@10 398 @table @option
yading@10 399 @item h
yading@10 400 Hz
yading@10 401 @item q
yading@10 402 Q-Factor
yading@10 403 @item o
yading@10 404 octave
yading@10 405 @item s
yading@10 406 slope
yading@10 407 @end table
yading@10 408
yading@10 409 @item width, w
yading@10 410 Specify the band-width of a filter in width_type units.
yading@10 411 Applies only to double-pole filter.
yading@10 412 The default is 0.707q and gives a Butterworth response.
yading@10 413 @end table
yading@10 414
yading@10 415 @section bass
yading@10 416
yading@10 417 Boost or cut the bass (lower) frequencies of the audio using a two-pole
yading@10 418 shelving filter with a response similar to that of a standard
yading@10 419 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
yading@10 420
yading@10 421 The filter accepts the following options:
yading@10 422
yading@10 423 @table @option
yading@10 424 @item gain, g
yading@10 425 Give the gain at 0 Hz. Its useful range is about -20
yading@10 426 (for a large cut) to +20 (for a large boost).
yading@10 427 Beware of clipping when using a positive gain.
yading@10 428
yading@10 429 @item frequency, f
yading@10 430 Set the filter's central frequency and so can be used
yading@10 431 to extend or reduce the frequency range to be boosted or cut.
yading@10 432 The default value is @code{100} Hz.
yading@10 433
yading@10 434 @item width_type
yading@10 435 Set method to specify band-width of filter.
yading@10 436 @table @option
yading@10 437 @item h
yading@10 438 Hz
yading@10 439 @item q
yading@10 440 Q-Factor
yading@10 441 @item o
yading@10 442 octave
yading@10 443 @item s
yading@10 444 slope
yading@10 445 @end table
yading@10 446
yading@10 447 @item width, w
yading@10 448 Determine how steep is the filter's shelf transition.
yading@10 449 @end table
yading@10 450
yading@10 451 @section treble
yading@10 452
yading@10 453 Boost or cut treble (upper) frequencies of the audio using a two-pole
yading@10 454 shelving filter with a response similar to that of a standard
yading@10 455 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
yading@10 456
yading@10 457 The filter accepts the following options:
yading@10 458
yading@10 459 @table @option
yading@10 460 @item gain, g
yading@10 461 Give the gain at whichever is the lower of ~22 kHz and the
yading@10 462 Nyquist frequency. Its useful range is about -20 (for a large cut)
yading@10 463 to +20 (for a large boost). Beware of clipping when using a positive gain.
yading@10 464
yading@10 465 @item frequency, f
yading@10 466 Set the filter's central frequency and so can be used
yading@10 467 to extend or reduce the frequency range to be boosted or cut.
yading@10 468 The default value is @code{3000} Hz.
yading@10 469
yading@10 470 @item width_type
yading@10 471 Set method to specify band-width of filter.
yading@10 472 @table @option
yading@10 473 @item h
yading@10 474 Hz
yading@10 475 @item q
yading@10 476 Q-Factor
yading@10 477 @item o
yading@10 478 octave
yading@10 479 @item s
yading@10 480 slope
yading@10 481 @end table
yading@10 482
yading@10 483 @item width, w
yading@10 484 Determine how steep is the filter's shelf transition.
yading@10 485 @end table
yading@10 486
yading@10 487 @section bandpass
yading@10 488
yading@10 489 Apply a two-pole Butterworth band-pass filter with central
yading@10 490 frequency @var{frequency}, and (3dB-point) band-width width.
yading@10 491 The @var{csg} option selects a constant skirt gain (peak gain = Q)
yading@10 492 instead of the default: constant 0dB peak gain.
yading@10 493 The filter roll off at 6dB per octave (20dB per decade).
yading@10 494
yading@10 495 The filter accepts the following options:
yading@10 496
yading@10 497 @table @option
yading@10 498 @item frequency, f
yading@10 499 Set the filter's central frequency. Default is @code{3000}.
yading@10 500
yading@10 501 @item csg
yading@10 502 Constant skirt gain if set to 1. Defaults to 0.
yading@10 503
yading@10 504 @item width_type
yading@10 505 Set method to specify band-width of filter.
yading@10 506 @table @option
yading@10 507 @item h
yading@10 508 Hz
yading@10 509 @item q
yading@10 510 Q-Factor
yading@10 511 @item o
yading@10 512 octave
yading@10 513 @item s
yading@10 514 slope
yading@10 515 @end table
yading@10 516
yading@10 517 @item width, w
yading@10 518 Specify the band-width of a filter in width_type units.
yading@10 519 @end table
yading@10 520
yading@10 521 @section bandreject
yading@10 522
yading@10 523 Apply a two-pole Butterworth band-reject filter with central
yading@10 524 frequency @var{frequency}, and (3dB-point) band-width @var{width}.
yading@10 525 The filter roll off at 6dB per octave (20dB per decade).
yading@10 526
yading@10 527 The filter accepts the following options:
yading@10 528
yading@10 529 @table @option
yading@10 530 @item frequency, f
yading@10 531 Set the filter's central frequency. Default is @code{3000}.
yading@10 532
yading@10 533 @item width_type
yading@10 534 Set method to specify band-width of filter.
yading@10 535 @table @option
yading@10 536 @item h
yading@10 537 Hz
yading@10 538 @item q
yading@10 539 Q-Factor
yading@10 540 @item o
yading@10 541 octave
yading@10 542 @item s
yading@10 543 slope
yading@10 544 @end table
yading@10 545
yading@10 546 @item width, w
yading@10 547 Specify the band-width of a filter in width_type units.
yading@10 548 @end table
yading@10 549
yading@10 550 @section biquad
yading@10 551
yading@10 552 Apply a biquad IIR filter with the given coefficients.
yading@10 553 Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
yading@10 554 are the numerator and denominator coefficients respectively.
yading@10 555
yading@10 556 @section equalizer
yading@10 557
yading@10 558 Apply a two-pole peaking equalisation (EQ) filter. With this
yading@10 559 filter, the signal-level at and around a selected frequency can
yading@10 560 be increased or decreased, whilst (unlike bandpass and bandreject
yading@10 561 filters) that at all other frequencies is unchanged.
yading@10 562
yading@10 563 In order to produce complex equalisation curves, this filter can
yading@10 564 be given several times, each with a different central frequency.
yading@10 565
yading@10 566 The filter accepts the following options:
yading@10 567
yading@10 568 @table @option
yading@10 569 @item frequency, f
yading@10 570 Set the filter's central frequency in Hz.
yading@10 571
yading@10 572 @item width_type
yading@10 573 Set method to specify band-width of filter.
yading@10 574 @table @option
yading@10 575 @item h
yading@10 576 Hz
yading@10 577 @item q
yading@10 578 Q-Factor
yading@10 579 @item o
yading@10 580 octave
yading@10 581 @item s
yading@10 582 slope
yading@10 583 @end table
yading@10 584
yading@10 585 @item width, w
yading@10 586 Specify the band-width of a filter in width_type units.
yading@10 587
yading@10 588 @item gain, g
yading@10 589 Set the required gain or attenuation in dB.
yading@10 590 Beware of clipping when using a positive gain.
yading@10 591 @end table
yading@10 592
yading@10 593 @section afade
yading@10 594
yading@10 595 Apply fade-in/out effect to input audio.
yading@10 596
yading@10 597 A description of the accepted parameters follows.
yading@10 598
yading@10 599 @table @option
yading@10 600 @item type, t
yading@10 601 Specify the effect type, can be either @code{in} for fade-in, or
yading@10 602 @code{out} for a fade-out effect. Default is @code{in}.
yading@10 603
yading@10 604 @item start_sample, ss
yading@10 605 Specify the number of the start sample for starting to apply the fade
yading@10 606 effect. Default is 0.
yading@10 607
yading@10 608 @item nb_samples, ns
yading@10 609 Specify the number of samples for which the fade effect has to last. At
yading@10 610 the end of the fade-in effect the output audio will have the same
yading@10 611 volume as the input audio, at the end of the fade-out transition
yading@10 612 the output audio will be silence. Default is 44100.
yading@10 613
yading@10 614 @item start_time, st
yading@10 615 Specify time for starting to apply the fade effect. Default is 0.
yading@10 616 The accepted syntax is:
yading@10 617 @example
yading@10 618 [-]HH[:MM[:SS[.m...]]]
yading@10 619 [-]S+[.m...]
yading@10 620 @end example
yading@10 621 See also the function @code{av_parse_time()}.
yading@10 622 If set this option is used instead of @var{start_sample} one.
yading@10 623
yading@10 624 @item duration, d
yading@10 625 Specify the duration for which the fade effect has to last. Default is 0.
yading@10 626 The accepted syntax is:
yading@10 627 @example
yading@10 628 [-]HH[:MM[:SS[.m...]]]
yading@10 629 [-]S+[.m...]
yading@10 630 @end example
yading@10 631 See also the function @code{av_parse_time()}.
yading@10 632 At the end of the fade-in effect the output audio will have the same
yading@10 633 volume as the input audio, at the end of the fade-out transition
yading@10 634 the output audio will be silence.
yading@10 635 If set this option is used instead of @var{nb_samples} one.
yading@10 636
yading@10 637 @item curve
yading@10 638 Set curve for fade transition.
yading@10 639
yading@10 640 It accepts the following values:
yading@10 641 @table @option
yading@10 642 @item tri
yading@10 643 select triangular, linear slope (default)
yading@10 644 @item qsin
yading@10 645 select quarter of sine wave
yading@10 646 @item hsin
yading@10 647 select half of sine wave
yading@10 648 @item esin
yading@10 649 select exponential sine wave
yading@10 650 @item log
yading@10 651 select logarithmic
yading@10 652 @item par
yading@10 653 select inverted parabola
yading@10 654 @item qua
yading@10 655 select quadratic
yading@10 656 @item cub
yading@10 657 select cubic
yading@10 658 @item squ
yading@10 659 select square root
yading@10 660 @item cbr
yading@10 661 select cubic root
yading@10 662 @end table
yading@10 663 @end table
yading@10 664
yading@10 665 @subsection Examples
yading@10 666
yading@10 667 @itemize
yading@10 668 @item
yading@10 669 Fade in first 15 seconds of audio:
yading@10 670 @example
yading@10 671 afade=t=in:ss=0:d=15
yading@10 672 @end example
yading@10 673
yading@10 674 @item
yading@10 675 Fade out last 25 seconds of a 900 seconds audio:
yading@10 676 @example
yading@10 677 afade=t=out:ss=875:d=25
yading@10 678 @end example
yading@10 679 @end itemize
yading@10 680
yading@10 681 @anchor{aformat}
yading@10 682 @section aformat
yading@10 683
yading@10 684 Set output format constraints for the input audio. The framework will
yading@10 685 negotiate the most appropriate format to minimize conversions.
yading@10 686
yading@10 687 The filter accepts the following named parameters:
yading@10 688 @table @option
yading@10 689
yading@10 690 @item sample_fmts
yading@10 691 A '|'-separated list of requested sample formats.
yading@10 692
yading@10 693 @item sample_rates
yading@10 694 A '|'-separated list of requested sample rates.
yading@10 695
yading@10 696 @item channel_layouts
yading@10 697 A '|'-separated list of requested channel layouts.
yading@10 698
yading@10 699 @end table
yading@10 700
yading@10 701 If a parameter is omitted, all values are allowed.
yading@10 702
yading@10 703 For example to force the output to either unsigned 8-bit or signed 16-bit stereo:
yading@10 704 @example
yading@10 705 aformat=sample_fmts=u8|s16:channel_layouts=stereo
yading@10 706 @end example
yading@10 707
yading@10 708 @section amerge
yading@10 709
yading@10 710 Merge two or more audio streams into a single multi-channel stream.
yading@10 711
yading@10 712 The filter accepts the following options:
yading@10 713
yading@10 714 @table @option
yading@10 715
yading@10 716 @item inputs
yading@10 717 Set the number of inputs. Default is 2.
yading@10 718
yading@10 719 @end table
yading@10 720
yading@10 721 If the channel layouts of the inputs are disjoint, and therefore compatible,
yading@10 722 the channel layout of the output will be set accordingly and the channels
yading@10 723 will be reordered as necessary. If the channel layouts of the inputs are not
yading@10 724 disjoint, the output will have all the channels of the first input then all
yading@10 725 the channels of the second input, in that order, and the channel layout of
yading@10 726 the output will be the default value corresponding to the total number of
yading@10 727 channels.
yading@10 728
yading@10 729 For example, if the first input is in 2.1 (FL+FR+LF) and the second input
yading@10 730 is FC+BL+BR, then the output will be in 5.1, with the channels in the
yading@10 731 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
yading@10 732 first input, b1 is the first channel of the second input).
yading@10 733
yading@10 734 On the other hand, if both input are in stereo, the output channels will be
yading@10 735 in the default order: a1, a2, b1, b2, and the channel layout will be
yading@10 736 arbitrarily set to 4.0, which may or may not be the expected value.
yading@10 737
yading@10 738 All inputs must have the same sample rate, and format.
yading@10 739
yading@10 740 If inputs do not have the same duration, the output will stop with the
yading@10 741 shortest.
yading@10 742
yading@10 743 @subsection Examples
yading@10 744
yading@10 745 @itemize
yading@10 746 @item
yading@10 747 Merge two mono files into a stereo stream:
yading@10 748 @example
yading@10 749 amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
yading@10 750 @end example
yading@10 751
yading@10 752 @item
yading@10 753 Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
yading@10 754 @example
yading@10 755 ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
yading@10 756 @end example
yading@10 757 @end itemize
yading@10 758
yading@10 759 @section amix
yading@10 760
yading@10 761 Mixes multiple audio inputs into a single output.
yading@10 762
yading@10 763 For example
yading@10 764 @example
yading@10 765 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
yading@10 766 @end example
yading@10 767 will mix 3 input audio streams to a single output with the same duration as the
yading@10 768 first input and a dropout transition time of 3 seconds.
yading@10 769
yading@10 770 The filter accepts the following named parameters:
yading@10 771 @table @option
yading@10 772
yading@10 773 @item inputs
yading@10 774 Number of inputs. If unspecified, it defaults to 2.
yading@10 775
yading@10 776 @item duration
yading@10 777 How to determine the end-of-stream.
yading@10 778 @table @option
yading@10 779
yading@10 780 @item longest
yading@10 781 Duration of longest input. (default)
yading@10 782
yading@10 783 @item shortest
yading@10 784 Duration of shortest input.
yading@10 785
yading@10 786 @item first
yading@10 787 Duration of first input.
yading@10 788
yading@10 789 @end table
yading@10 790
yading@10 791 @item dropout_transition
yading@10 792 Transition time, in seconds, for volume renormalization when an input
yading@10 793 stream ends. The default value is 2 seconds.
yading@10 794
yading@10 795 @end table
yading@10 796
yading@10 797 @section anull
yading@10 798
yading@10 799 Pass the audio source unchanged to the output.
yading@10 800
yading@10 801 @section apad
yading@10 802
yading@10 803 Pad the end of a audio stream with silence, this can be used together with
yading@10 804 -shortest to extend audio streams to the same length as the video stream.
yading@10 805
yading@10 806 @section aphaser
yading@10 807 Add a phasing effect to the input audio.
yading@10 808
yading@10 809 A phaser filter creates series of peaks and troughs in the frequency spectrum.
yading@10 810 The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
yading@10 811
yading@10 812 A description of the accepted parameters follows.
yading@10 813
yading@10 814 @table @option
yading@10 815 @item in_gain
yading@10 816 Set input gain. Default is 0.4.
yading@10 817
yading@10 818 @item out_gain
yading@10 819 Set output gain. Default is 0.74
yading@10 820
yading@10 821 @item delay
yading@10 822 Set delay in milliseconds. Default is 3.0.
yading@10 823
yading@10 824 @item decay
yading@10 825 Set decay. Default is 0.4.
yading@10 826
yading@10 827 @item speed
yading@10 828 Set modulation speed in Hz. Default is 0.5.
yading@10 829
yading@10 830 @item type
yading@10 831 Set modulation type. Default is triangular.
yading@10 832
yading@10 833 It accepts the following values:
yading@10 834 @table @samp
yading@10 835 @item triangular, t
yading@10 836 @item sinusoidal, s
yading@10 837 @end table
yading@10 838 @end table
yading@10 839
yading@10 840 @anchor{aresample}
yading@10 841 @section aresample
yading@10 842
yading@10 843 Resample the input audio to the specified parameters, using the
yading@10 844 libswresample library. If none are specified then the filter will
yading@10 845 automatically convert between its input and output.
yading@10 846
yading@10 847 This filter is also able to stretch/squeeze the audio data to make it match
yading@10 848 the timestamps or to inject silence / cut out audio to make it match the
yading@10 849 timestamps, do a combination of both or do neither.
yading@10 850
yading@10 851 The filter accepts the syntax
yading@10 852 [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
yading@10 853 expresses a sample rate and @var{resampler_options} is a list of
yading@10 854 @var{key}=@var{value} pairs, separated by ":". See the
yading@10 855 ffmpeg-resampler manual for the complete list of supported options.
yading@10 856
yading@10 857 @subsection Examples
yading@10 858
yading@10 859 @itemize
yading@10 860 @item
yading@10 861 Resample the input audio to 44100Hz:
yading@10 862 @example
yading@10 863 aresample=44100
yading@10 864 @end example
yading@10 865
yading@10 866 @item
yading@10 867 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
yading@10 868 samples per second compensation:
yading@10 869 @example
yading@10 870 aresample=async=1000
yading@10 871 @end example
yading@10 872 @end itemize
yading@10 873
yading@10 874 @section asetnsamples
yading@10 875
yading@10 876 Set the number of samples per each output audio frame.
yading@10 877
yading@10 878 The last output packet may contain a different number of samples, as
yading@10 879 the filter will flush all the remaining samples when the input audio
yading@10 880 signal its end.
yading@10 881
yading@10 882 The filter accepts the following options:
yading@10 883
yading@10 884 @table @option
yading@10 885
yading@10 886 @item nb_out_samples, n
yading@10 887 Set the number of frames per each output audio frame. The number is
yading@10 888 intended as the number of samples @emph{per each channel}.
yading@10 889 Default value is 1024.
yading@10 890
yading@10 891 @item pad, p
yading@10 892 If set to 1, the filter will pad the last audio frame with zeroes, so
yading@10 893 that the last frame will contain the same number of samples as the
yading@10 894 previous ones. Default value is 1.
yading@10 895 @end table
yading@10 896
yading@10 897 For example, to set the number of per-frame samples to 1234 and
yading@10 898 disable padding for the last frame, use:
yading@10 899 @example
yading@10 900 asetnsamples=n=1234:p=0
yading@10 901 @end example
yading@10 902
yading@10 903 @section ashowinfo
yading@10 904
yading@10 905 Show a line containing various information for each input audio frame.
yading@10 906 The input audio is not modified.
yading@10 907
yading@10 908 The shown line contains a sequence of key/value pairs of the form
yading@10 909 @var{key}:@var{value}.
yading@10 910
yading@10 911 A description of each shown parameter follows:
yading@10 912
yading@10 913 @table @option
yading@10 914 @item n
yading@10 915 sequential number of the input frame, starting from 0
yading@10 916
yading@10 917 @item pts
yading@10 918 Presentation timestamp of the input frame, in time base units; the time base
yading@10 919 depends on the filter input pad, and is usually 1/@var{sample_rate}.
yading@10 920
yading@10 921 @item pts_time
yading@10 922 presentation timestamp of the input frame in seconds
yading@10 923
yading@10 924 @item pos
yading@10 925 position of the frame in the input stream, -1 if this information in
yading@10 926 unavailable and/or meaningless (for example in case of synthetic audio)
yading@10 927
yading@10 928 @item fmt
yading@10 929 sample format
yading@10 930
yading@10 931 @item chlayout
yading@10 932 channel layout
yading@10 933
yading@10 934 @item rate
yading@10 935 sample rate for the audio frame
yading@10 936
yading@10 937 @item nb_samples
yading@10 938 number of samples (per channel) in the frame
yading@10 939
yading@10 940 @item checksum
yading@10 941 Adler-32 checksum (printed in hexadecimal) of the audio data. For planar audio
yading@10 942 the data is treated as if all the planes were concatenated.
yading@10 943
yading@10 944 @item plane_checksums
yading@10 945 A list of Adler-32 checksums for each data plane.
yading@10 946 @end table
yading@10 947
yading@10 948 @section astreamsync
yading@10 949
yading@10 950 Forward two audio streams and control the order the buffers are forwarded.
yading@10 951
yading@10 952 The filter accepts the following options:
yading@10 953
yading@10 954 @table @option
yading@10 955 @item expr, e
yading@10 956 Set the expression deciding which stream should be
yading@10 957 forwarded next: if the result is negative, the first stream is forwarded; if
yading@10 958 the result is positive or zero, the second stream is forwarded. It can use
yading@10 959 the following variables:
yading@10 960
yading@10 961 @table @var
yading@10 962 @item b1 b2
yading@10 963 number of buffers forwarded so far on each stream
yading@10 964 @item s1 s2
yading@10 965 number of samples forwarded so far on each stream
yading@10 966 @item t1 t2
yading@10 967 current timestamp of each stream
yading@10 968 @end table
yading@10 969
yading@10 970 The default value is @code{t1-t2}, which means to always forward the stream
yading@10 971 that has a smaller timestamp.
yading@10 972 @end table
yading@10 973
yading@10 974 @subsection Examples
yading@10 975
yading@10 976 Stress-test @code{amerge} by randomly sending buffers on the wrong
yading@10 977 input, while avoiding too much of a desynchronization:
yading@10 978 @example
yading@10 979 amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
yading@10 980 [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
yading@10 981 [a2] [b2] amerge
yading@10 982 @end example
yading@10 983
yading@10 984 @section atempo
yading@10 985
yading@10 986 Adjust audio tempo.
yading@10 987
yading@10 988 The filter accepts exactly one parameter, the audio tempo. If not
yading@10 989 specified then the filter will assume nominal 1.0 tempo. Tempo must
yading@10 990 be in the [0.5, 2.0] range.
yading@10 991
yading@10 992 @subsection Examples
yading@10 993
yading@10 994 @itemize
yading@10 995 @item
yading@10 996 Slow down audio to 80% tempo:
yading@10 997 @example
yading@10 998 atempo=0.8
yading@10 999 @end example
yading@10 1000
yading@10 1001 @item
yading@10 1002 To speed up audio to 125% tempo:
yading@10 1003 @example
yading@10 1004 atempo=1.25
yading@10 1005 @end example
yading@10 1006 @end itemize
yading@10 1007
yading@10 1008 @section earwax
yading@10 1009
yading@10 1010 Make audio easier to listen to on headphones.
yading@10 1011
yading@10 1012 This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
yading@10 1013 so that when listened to on headphones the stereo image is moved from
yading@10 1014 inside your head (standard for headphones) to outside and in front of
yading@10 1015 the listener (standard for speakers).
yading@10 1016
yading@10 1017 Ported from SoX.
yading@10 1018
yading@10 1019 @section pan
yading@10 1020
yading@10 1021 Mix channels with specific gain levels. The filter accepts the output
yading@10 1022 channel layout followed by a set of channels definitions.
yading@10 1023
yading@10 1024 This filter is also designed to remap efficiently the channels of an audio
yading@10 1025 stream.
yading@10 1026
yading@10 1027 The filter accepts parameters of the form:
yading@10 1028 "@var{l}:@var{outdef}:@var{outdef}:..."
yading@10 1029
yading@10 1030 @table @option
yading@10 1031 @item l
yading@10 1032 output channel layout or number of channels
yading@10 1033
yading@10 1034 @item outdef
yading@10 1035 output channel specification, of the form:
yading@10 1036 "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
yading@10 1037
yading@10 1038 @item out_name
yading@10 1039 output channel to define, either a channel name (FL, FR, etc.) or a channel
yading@10 1040 number (c0, c1, etc.)
yading@10 1041
yading@10 1042 @item gain
yading@10 1043 multiplicative coefficient for the channel, 1 leaving the volume unchanged
yading@10 1044
yading@10 1045 @item in_name
yading@10 1046 input channel to use, see out_name for details; it is not possible to mix
yading@10 1047 named and numbered input channels
yading@10 1048 @end table
yading@10 1049
yading@10 1050 If the `=' in a channel specification is replaced by `<', then the gains for
yading@10 1051 that specification will be renormalized so that the total is 1, thus
yading@10 1052 avoiding clipping noise.
yading@10 1053
yading@10 1054 @subsection Mixing examples
yading@10 1055
yading@10 1056 For example, if you want to down-mix from stereo to mono, but with a bigger
yading@10 1057 factor for the left channel:
yading@10 1058 @example
yading@10 1059 pan=1:c0=0.9*c0+0.1*c1
yading@10 1060 @end example
yading@10 1061
yading@10 1062 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
yading@10 1063 7-channels surround:
yading@10 1064 @example
yading@10 1065 pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
yading@10 1066 @end example
yading@10 1067
yading@10 1068 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
yading@10 1069 that should be preferred (see "-ac" option) unless you have very specific
yading@10 1070 needs.
yading@10 1071
yading@10 1072 @subsection Remapping examples
yading@10 1073
yading@10 1074 The channel remapping will be effective if, and only if:
yading@10 1075
yading@10 1076 @itemize
yading@10 1077 @item gain coefficients are zeroes or ones,
yading@10 1078 @item only one input per channel output,
yading@10 1079 @end itemize
yading@10 1080
yading@10 1081 If all these conditions are satisfied, the filter will notify the user ("Pure
yading@10 1082 channel mapping detected"), and use an optimized and lossless method to do the
yading@10 1083 remapping.
yading@10 1084
yading@10 1085 For example, if you have a 5.1 source and want a stereo audio stream by
yading@10 1086 dropping the extra channels:
yading@10 1087 @example
yading@10 1088 pan="stereo: c0=FL : c1=FR"
yading@10 1089 @end example
yading@10 1090
yading@10 1091 Given the same source, you can also switch front left and front right channels
yading@10 1092 and keep the input channel layout:
yading@10 1093 @example
yading@10 1094 pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
yading@10 1095 @end example
yading@10 1096
yading@10 1097 If the input is a stereo audio stream, you can mute the front left channel (and
yading@10 1098 still keep the stereo channel layout) with:
yading@10 1099 @example
yading@10 1100 pan="stereo:c1=c1"
yading@10 1101 @end example
yading@10 1102
yading@10 1103 Still with a stereo audio stream input, you can copy the right channel in both
yading@10 1104 front left and right:
yading@10 1105 @example
yading@10 1106 pan="stereo: c0=FR : c1=FR"
yading@10 1107 @end example
yading@10 1108
yading@10 1109 @section silencedetect
yading@10 1110
yading@10 1111 Detect silence in an audio stream.
yading@10 1112
yading@10 1113 This filter logs a message when it detects that the input audio volume is less
yading@10 1114 or equal to a noise tolerance value for a duration greater or equal to the
yading@10 1115 minimum detected noise duration.
yading@10 1116
yading@10 1117 The printed times and duration are expressed in seconds.
yading@10 1118
yading@10 1119 The filter accepts the following options:
yading@10 1120
yading@10 1121 @table @option
yading@10 1122 @item duration, d
yading@10 1123 Set silence duration until notification (default is 2 seconds).
yading@10 1124
yading@10 1125 @item noise, n
yading@10 1126 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
yading@10 1127 specified value) or amplitude ratio. Default is -60dB, or 0.001.
yading@10 1128 @end table
yading@10 1129
yading@10 1130 @subsection Examples
yading@10 1131
yading@10 1132 @itemize
yading@10 1133 @item
yading@10 1134 Detect 5 seconds of silence with -50dB noise tolerance:
yading@10 1135 @example
yading@10 1136 silencedetect=n=-50dB:d=5
yading@10 1137 @end example
yading@10 1138
yading@10 1139 @item
yading@10 1140 Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
yading@10 1141 tolerance in @file{silence.mp3}:
yading@10 1142 @example
yading@10 1143 ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
yading@10 1144 @end example
yading@10 1145 @end itemize
yading@10 1146
yading@10 1147 @section asyncts
yading@10 1148 Synchronize audio data with timestamps by squeezing/stretching it and/or
yading@10 1149 dropping samples/adding silence when needed.
yading@10 1150
yading@10 1151 This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
yading@10 1152
yading@10 1153 The filter accepts the following named parameters:
yading@10 1154 @table @option
yading@10 1155
yading@10 1156 @item compensate
yading@10 1157 Enable stretching/squeezing the data to make it match the timestamps. Disabled
yading@10 1158 by default. When disabled, time gaps are covered with silence.
yading@10 1159
yading@10 1160 @item min_delta
yading@10 1161 Minimum difference between timestamps and audio data (in seconds) to trigger
yading@10 1162 adding/dropping samples. Default value is 0.1. If you get non-perfect sync with
yading@10 1163 this filter, try setting this parameter to 0.
yading@10 1164
yading@10 1165 @item max_comp
yading@10 1166 Maximum compensation in samples per second. Relevant only with compensate=1.
yading@10 1167 Default value 500.
yading@10 1168
yading@10 1169 @item first_pts
yading@10 1170 Assume the first pts should be this value. The time base is 1 / sample rate.
yading@10 1171 This allows for padding/trimming at the start of stream. By default, no
yading@10 1172 assumption is made about the first frame's expected pts, so no padding or
yading@10 1173 trimming is done. For example, this could be set to 0 to pad the beginning with
yading@10 1174 silence if an audio stream starts after the video stream or to trim any samples
yading@10 1175 with a negative pts due to encoder delay.
yading@10 1176
yading@10 1177 @end table
yading@10 1178
yading@10 1179 @section channelsplit
yading@10 1180 Split each channel in input audio stream into a separate output stream.
yading@10 1181
yading@10 1182 This filter accepts the following named parameters:
yading@10 1183 @table @option
yading@10 1184 @item channel_layout
yading@10 1185 Channel layout of the input stream. Default is "stereo".
yading@10 1186 @end table
yading@10 1187
yading@10 1188 For example, assuming a stereo input MP3 file
yading@10 1189 @example
yading@10 1190 ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
yading@10 1191 @end example
yading@10 1192 will create an output Matroska file with two audio streams, one containing only
yading@10 1193 the left channel and the other the right channel.
yading@10 1194
yading@10 1195 To split a 5.1 WAV file into per-channel files
yading@10 1196 @example
yading@10 1197 ffmpeg -i in.wav -filter_complex
yading@10 1198 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
yading@10 1199 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
yading@10 1200 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
yading@10 1201 side_right.wav
yading@10 1202 @end example
yading@10 1203
yading@10 1204 @section channelmap
yading@10 1205 Remap input channels to new locations.
yading@10 1206
yading@10 1207 This filter accepts the following named parameters:
yading@10 1208 @table @option
yading@10 1209 @item channel_layout
yading@10 1210 Channel layout of the output stream.
yading@10 1211
yading@10 1212 @item map
yading@10 1213 Map channels from input to output. The argument is a '|'-separated list of
yading@10 1214 mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
yading@10 1215 @var{in_channel} form. @var{in_channel} can be either the name of the input
yading@10 1216 channel (e.g. FL for front left) or its index in the input channel layout.
yading@10 1217 @var{out_channel} is the name of the output channel or its index in the output
yading@10 1218 channel layout. If @var{out_channel} is not given then it is implicitly an
yading@10 1219 index, starting with zero and increasing by one for each mapping.
yading@10 1220 @end table
yading@10 1221
yading@10 1222 If no mapping is present, the filter will implicitly map input channels to
yading@10 1223 output channels preserving index.
yading@10 1224
yading@10 1225 For example, assuming a 5.1+downmix input MOV file
yading@10 1226 @example
yading@10 1227 ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
yading@10 1228 @end example
yading@10 1229 will create an output WAV file tagged as stereo from the downmix channels of
yading@10 1230 the input.
yading@10 1231
yading@10 1232 To fix a 5.1 WAV improperly encoded in AAC's native channel order
yading@10 1233 @example
yading@10 1234 ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:channel_layout=5.1' out.wav
yading@10 1235 @end example
yading@10 1236
yading@10 1237 @section join
yading@10 1238 Join multiple input streams into one multi-channel stream.
yading@10 1239
yading@10 1240 The filter accepts the following named parameters:
yading@10 1241 @table @option
yading@10 1242
yading@10 1243 @item inputs
yading@10 1244 Number of input streams. Defaults to 2.
yading@10 1245
yading@10 1246 @item channel_layout
yading@10 1247 Desired output channel layout. Defaults to stereo.
yading@10 1248
yading@10 1249 @item map
yading@10 1250 Map channels from inputs to output. The argument is a '|'-separated list of
yading@10 1251 mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
yading@10 1252 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
yading@10 1253 can be either the name of the input channel (e.g. FL for front left) or its
yading@10 1254 index in the specified input stream. @var{out_channel} is the name of the output
yading@10 1255 channel.
yading@10 1256 @end table
yading@10 1257
yading@10 1258 The filter will attempt to guess the mappings when those are not specified
yading@10 1259 explicitly. It does so by first trying to find an unused matching input channel
yading@10 1260 and if that fails it picks the first unused input channel.
yading@10 1261
yading@10 1262 E.g. to join 3 inputs (with properly set channel layouts)
yading@10 1263 @example
yading@10 1264 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
yading@10 1265 @end example
yading@10 1266
yading@10 1267 To build a 5.1 output from 6 single-channel streams:
yading@10 1268 @example
yading@10 1269 ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
yading@10 1270 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
yading@10 1271 out
yading@10 1272 @end example
yading@10 1273
yading@10 1274 @section resample
yading@10 1275 Convert the audio sample format, sample rate and channel layout. This filter is
yading@10 1276 not meant to be used directly.
yading@10 1277
yading@10 1278 @section volume
yading@10 1279
yading@10 1280 Adjust the input audio volume.
yading@10 1281
yading@10 1282 The filter accepts the following options:
yading@10 1283
yading@10 1284 @table @option
yading@10 1285
yading@10 1286 @item volume
yading@10 1287 Expresses how the audio volume will be increased or decreased.
yading@10 1288
yading@10 1289 Output values are clipped to the maximum value.
yading@10 1290
yading@10 1291 The output audio volume is given by the relation:
yading@10 1292 @example
yading@10 1293 @var{output_volume} = @var{volume} * @var{input_volume}
yading@10 1294 @end example
yading@10 1295
yading@10 1296 Default value for @var{volume} is 1.0.
yading@10 1297
yading@10 1298 @item precision
yading@10 1299 Set the mathematical precision.
yading@10 1300
yading@10 1301 This determines which input sample formats will be allowed, which affects the
yading@10 1302 precision of the volume scaling.
yading@10 1303
yading@10 1304 @table @option
yading@10 1305 @item fixed
yading@10 1306 8-bit fixed-point; limits input sample format to U8, S16, and S32.
yading@10 1307 @item float
yading@10 1308 32-bit floating-point; limits input sample format to FLT. (default)
yading@10 1309 @item double
yading@10 1310 64-bit floating-point; limits input sample format to DBL.
yading@10 1311 @end table
yading@10 1312 @end table
yading@10 1313
yading@10 1314 @subsection Examples
yading@10 1315
yading@10 1316 @itemize
yading@10 1317 @item
yading@10 1318 Halve the input audio volume:
yading@10 1319 @example
yading@10 1320 volume=volume=0.5
yading@10 1321 volume=volume=1/2
yading@10 1322 volume=volume=-6.0206dB
yading@10 1323 @end example
yading@10 1324
yading@10 1325 In all the above example the named key for @option{volume} can be
yading@10 1326 omitted, for example like in:
yading@10 1327 @example
yading@10 1328 volume=0.5
yading@10 1329 @end example
yading@10 1330
yading@10 1331 @item
yading@10 1332 Increase input audio power by 6 decibels using fixed-point precision:
yading@10 1333 @example
yading@10 1334 volume=volume=6dB:precision=fixed
yading@10 1335 @end example
yading@10 1336 @end itemize
yading@10 1337
yading@10 1338 @section volumedetect
yading@10 1339
yading@10 1340 Detect the volume of the input video.
yading@10 1341
yading@10 1342 The filter has no parameters. The input is not modified. Statistics about
yading@10 1343 the volume will be printed in the log when the input stream end is reached.
yading@10 1344
yading@10 1345 In particular it will show the mean volume (root mean square), maximum
yading@10 1346 volume (on a per-sample basis), and the beginning of an histogram of the
yading@10 1347 registered volume values (from the maximum value to a cumulated 1/1000 of
yading@10 1348 the samples).
yading@10 1349
yading@10 1350 All volumes are in decibels relative to the maximum PCM value.
yading@10 1351
yading@10 1352 @subsection Examples
yading@10 1353
yading@10 1354 Here is an excerpt of the output:
yading@10 1355 @example
yading@10 1356 [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
yading@10 1357 [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
yading@10 1358 [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
yading@10 1359 [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
yading@10 1360 [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
yading@10 1361 [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
yading@10 1362 [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
yading@10 1363 [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
yading@10 1364 [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
yading@10 1365 @end example
yading@10 1366
yading@10 1367 It means that:
yading@10 1368 @itemize
yading@10 1369 @item
yading@10 1370 The mean square energy is approximately -27 dB, or 10^-2.7.
yading@10 1371 @item
yading@10 1372 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
yading@10 1373 @item
yading@10 1374 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
yading@10 1375 @end itemize
yading@10 1376
yading@10 1377 In other words, raising the volume by +4 dB does not cause any clipping,
yading@10 1378 raising it by +5 dB causes clipping for 6 samples, etc.
yading@10 1379
yading@10 1380 @c man end AUDIO FILTERS
yading@10 1381
yading@10 1382 @chapter Audio Sources
yading@10 1383 @c man begin AUDIO SOURCES
yading@10 1384
yading@10 1385 Below is a description of the currently available audio sources.
yading@10 1386
yading@10 1387 @section abuffer
yading@10 1388
yading@10 1389 Buffer audio frames, and make them available to the filter chain.
yading@10 1390
yading@10 1391 This source is mainly intended for a programmatic use, in particular
yading@10 1392 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
yading@10 1393
yading@10 1394 It accepts the following named parameters:
yading@10 1395
yading@10 1396 @table @option
yading@10 1397
yading@10 1398 @item time_base
yading@10 1399 Timebase which will be used for timestamps of submitted frames. It must be
yading@10 1400 either a floating-point number or in @var{numerator}/@var{denominator} form.
yading@10 1401
yading@10 1402 @item sample_rate
yading@10 1403 The sample rate of the incoming audio buffers.
yading@10 1404
yading@10 1405 @item sample_fmt
yading@10 1406 The sample format of the incoming audio buffers.
yading@10 1407 Either a sample format name or its corresponging integer representation from
yading@10 1408 the enum AVSampleFormat in @file{libavutil/samplefmt.h}
yading@10 1409
yading@10 1410 @item channel_layout
yading@10 1411 The channel layout of the incoming audio buffers.
yading@10 1412 Either a channel layout name from channel_layout_map in
yading@10 1413 @file{libavutil/channel_layout.c} or its corresponding integer representation
yading@10 1414 from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
yading@10 1415
yading@10 1416 @item channels
yading@10 1417 The number of channels of the incoming audio buffers.
yading@10 1418 If both @var{channels} and @var{channel_layout} are specified, then they
yading@10 1419 must be consistent.
yading@10 1420
yading@10 1421 @end table
yading@10 1422
yading@10 1423 @subsection Examples
yading@10 1424
yading@10 1425 @example
yading@10 1426 abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
yading@10 1427 @end example
yading@10 1428
yading@10 1429 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
yading@10 1430 Since the sample format with name "s16p" corresponds to the number
yading@10 1431 6 and the "stereo" channel layout corresponds to the value 0x3, this is
yading@10 1432 equivalent to:
yading@10 1433 @example
yading@10 1434 abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
yading@10 1435 @end example
yading@10 1436
yading@10 1437 @section aevalsrc
yading@10 1438
yading@10 1439 Generate an audio signal specified by an expression.
yading@10 1440
yading@10 1441 This source accepts in input one or more expressions (one for each
yading@10 1442 channel), which are evaluated and used to generate a corresponding
yading@10 1443 audio signal.
yading@10 1444
yading@10 1445 This source accepts the following options:
yading@10 1446
yading@10 1447 @table @option
yading@10 1448 @item exprs
yading@10 1449 Set the '|'-separated expressions list for each separate channel. In case the
yading@10 1450 @option{channel_layout} option is not specified, the selected channel layout
yading@10 1451 depends on the number of provided expressions.
yading@10 1452
yading@10 1453 @item channel_layout, c
yading@10 1454 Set the channel layout. The number of channels in the specified layout
yading@10 1455 must be equal to the number of specified expressions.
yading@10 1456
yading@10 1457 @item duration, d
yading@10 1458 Set the minimum duration of the sourced audio. See the function
yading@10 1459 @code{av_parse_time()} for the accepted format.
yading@10 1460 Note that the resulting duration may be greater than the specified
yading@10 1461 duration, as the generated audio is always cut at the end of a
yading@10 1462 complete frame.
yading@10 1463
yading@10 1464 If not specified, or the expressed duration is negative, the audio is
yading@10 1465 supposed to be generated forever.
yading@10 1466
yading@10 1467 @item nb_samples, n
yading@10 1468 Set the number of samples per channel per each output frame,
yading@10 1469 default to 1024.
yading@10 1470
yading@10 1471 @item sample_rate, s
yading@10 1472 Specify the sample rate, default to 44100.
yading@10 1473 @end table
yading@10 1474
yading@10 1475 Each expression in @var{exprs} can contain the following constants:
yading@10 1476
yading@10 1477 @table @option
yading@10 1478 @item n
yading@10 1479 number of the evaluated sample, starting from 0
yading@10 1480
yading@10 1481 @item t
yading@10 1482 time of the evaluated sample expressed in seconds, starting from 0
yading@10 1483
yading@10 1484 @item s
yading@10 1485 sample rate
yading@10 1486
yading@10 1487 @end table
yading@10 1488
yading@10 1489 @subsection Examples
yading@10 1490
yading@10 1491 @itemize
yading@10 1492 @item
yading@10 1493 Generate silence:
yading@10 1494 @example
yading@10 1495 aevalsrc=0
yading@10 1496 @end example
yading@10 1497
yading@10 1498 @item
yading@10 1499 Generate a sin signal with frequency of 440 Hz, set sample rate to
yading@10 1500 8000 Hz:
yading@10 1501 @example
yading@10 1502 aevalsrc="sin(440*2*PI*t):s=8000"
yading@10 1503 @end example
yading@10 1504
yading@10 1505 @item
yading@10 1506 Generate a two channels signal, specify the channel layout (Front
yading@10 1507 Center + Back Center) explicitly:
yading@10 1508 @example
yading@10 1509 aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
yading@10 1510 @end example
yading@10 1511
yading@10 1512 @item
yading@10 1513 Generate white noise:
yading@10 1514 @example
yading@10 1515 aevalsrc="-2+random(0)"
yading@10 1516 @end example
yading@10 1517
yading@10 1518 @item
yading@10 1519 Generate an amplitude modulated signal:
yading@10 1520 @example
yading@10 1521 aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
yading@10 1522 @end example
yading@10 1523
yading@10 1524 @item
yading@10 1525 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
yading@10 1526 @example
yading@10 1527 aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
yading@10 1528 @end example
yading@10 1529
yading@10 1530 @end itemize
yading@10 1531
yading@10 1532 @section anullsrc
yading@10 1533
yading@10 1534 Null audio source, return unprocessed audio frames. It is mainly useful
yading@10 1535 as a template and to be employed in analysis / debugging tools, or as
yading@10 1536 the source for filters which ignore the input data (for example the sox
yading@10 1537 synth filter).
yading@10 1538
yading@10 1539 This source accepts the following options:
yading@10 1540
yading@10 1541 @table @option
yading@10 1542
yading@10 1543 @item channel_layout, cl
yading@10 1544
yading@10 1545 Specify the channel layout, and can be either an integer or a string
yading@10 1546 representing a channel layout. The default value of @var{channel_layout}
yading@10 1547 is "stereo".
yading@10 1548
yading@10 1549 Check the channel_layout_map definition in
yading@10 1550 @file{libavutil/channel_layout.c} for the mapping between strings and
yading@10 1551 channel layout values.
yading@10 1552
yading@10 1553 @item sample_rate, r
yading@10 1554 Specify the sample rate, and defaults to 44100.
yading@10 1555
yading@10 1556 @item nb_samples, n
yading@10 1557 Set the number of samples per requested frames.
yading@10 1558
yading@10 1559 @end table
yading@10 1560
yading@10 1561 @subsection Examples
yading@10 1562
yading@10 1563 @itemize
yading@10 1564 @item
yading@10 1565 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
yading@10 1566 @example
yading@10 1567 anullsrc=r=48000:cl=4
yading@10 1568 @end example
yading@10 1569
yading@10 1570 @item
yading@10 1571 Do the same operation with a more obvious syntax:
yading@10 1572 @example
yading@10 1573 anullsrc=r=48000:cl=mono
yading@10 1574 @end example
yading@10 1575 @end itemize
yading@10 1576
yading@10 1577 @section abuffer
yading@10 1578 Buffer audio frames, and make them available to the filter chain.
yading@10 1579
yading@10 1580 This source is not intended to be part of user-supplied graph descriptions but
yading@10 1581 for insertion by calling programs through the interface defined in
yading@10 1582 @file{libavfilter/buffersrc.h}.
yading@10 1583
yading@10 1584 It accepts the following named parameters:
yading@10 1585 @table @option
yading@10 1586
yading@10 1587 @item time_base
yading@10 1588 Timebase which will be used for timestamps of submitted frames. It must be
yading@10 1589 either a floating-point number or in @var{numerator}/@var{denominator} form.
yading@10 1590
yading@10 1591 @item sample_rate
yading@10 1592 Audio sample rate.
yading@10 1593
yading@10 1594 @item sample_fmt
yading@10 1595 Name of the sample format, as returned by @code{av_get_sample_fmt_name()}.
yading@10 1596
yading@10 1597 @item channel_layout
yading@10 1598 Channel layout of the audio data, in the form that can be accepted by
yading@10 1599 @code{av_get_channel_layout()}.
yading@10 1600 @end table
yading@10 1601
yading@10 1602 All the parameters need to be explicitly defined.
yading@10 1603
yading@10 1604 @section flite
yading@10 1605
yading@10 1606 Synthesize a voice utterance using the libflite library.
yading@10 1607
yading@10 1608 To enable compilation of this filter you need to configure FFmpeg with
yading@10 1609 @code{--enable-libflite}.
yading@10 1610
yading@10 1611 Note that the flite library is not thread-safe.
yading@10 1612
yading@10 1613 The filter accepts the following options:
yading@10 1614
yading@10 1615 @table @option
yading@10 1616
yading@10 1617 @item list_voices
yading@10 1618 If set to 1, list the names of the available voices and exit
yading@10 1619 immediately. Default value is 0.
yading@10 1620
yading@10 1621 @item nb_samples, n
yading@10 1622 Set the maximum number of samples per frame. Default value is 512.
yading@10 1623
yading@10 1624 @item textfile
yading@10 1625 Set the filename containing the text to speak.
yading@10 1626
yading@10 1627 @item text
yading@10 1628 Set the text to speak.
yading@10 1629
yading@10 1630 @item voice, v
yading@10 1631 Set the voice to use for the speech synthesis. Default value is
yading@10 1632 @code{kal}. See also the @var{list_voices} option.
yading@10 1633 @end table
yading@10 1634
yading@10 1635 @subsection Examples
yading@10 1636
yading@10 1637 @itemize
yading@10 1638 @item
yading@10 1639 Read from file @file{speech.txt}, and synthetize the text using the
yading@10 1640 standard flite voice:
yading@10 1641 @example
yading@10 1642 flite=textfile=speech.txt
yading@10 1643 @end example
yading@10 1644
yading@10 1645 @item
yading@10 1646 Read the specified text selecting the @code{slt} voice:
yading@10 1647 @example
yading@10 1648 flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
yading@10 1649 @end example
yading@10 1650
yading@10 1651 @item
yading@10 1652 Input text to ffmpeg:
yading@10 1653 @example
yading@10 1654 ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
yading@10 1655 @end example
yading@10 1656
yading@10 1657 @item
yading@10 1658 Make @file{ffplay} speak the specified text, using @code{flite} and
yading@10 1659 the @code{lavfi} device:
yading@10 1660 @example
yading@10 1661 ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
yading@10 1662 @end example
yading@10 1663 @end itemize
yading@10 1664
yading@10 1665 For more information about libflite, check:
yading@10 1666 @url{http://www.speech.cs.cmu.edu/flite/}
yading@10 1667
yading@10 1668 @section sine
yading@10 1669
yading@10 1670 Generate an audio signal made of a sine wave with amplitude 1/8.
yading@10 1671
yading@10 1672 The audio signal is bit-exact.
yading@10 1673
yading@10 1674 The filter accepts the following options:
yading@10 1675
yading@10 1676 @table @option
yading@10 1677
yading@10 1678 @item frequency, f
yading@10 1679 Set the carrier frequency. Default is 440 Hz.
yading@10 1680
yading@10 1681 @item beep_factor, b
yading@10 1682 Enable a periodic beep every second with frequency @var{beep_factor} times
yading@10 1683 the carrier frequency. Default is 0, meaning the beep is disabled.
yading@10 1684
yading@10 1685 @item sample_rate, s
yading@10 1686 Specify the sample rate, default is 44100.
yading@10 1687
yading@10 1688 @item duration, d
yading@10 1689 Specify the duration of the generated audio stream.
yading@10 1690
yading@10 1691 @item samples_per_frame
yading@10 1692 Set the number of samples per output frame, default is 1024.
yading@10 1693 @end table
yading@10 1694
yading@10 1695 @subsection Examples
yading@10 1696
yading@10 1697 @itemize
yading@10 1698
yading@10 1699 @item
yading@10 1700 Generate a simple 440 Hz sine wave:
yading@10 1701 @example
yading@10 1702 sine
yading@10 1703 @end example
yading@10 1704
yading@10 1705 @item
yading@10 1706 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
yading@10 1707 @example
yading@10 1708 sine=220:4:d=5
yading@10 1709 sine=f=220:b=4:d=5
yading@10 1710 sine=frequency=220:beep_factor=4:duration=5
yading@10 1711 @end example
yading@10 1712
yading@10 1713 @end itemize
yading@10 1714
yading@10 1715 @c man end AUDIO SOURCES
yading@10 1716
yading@10 1717 @chapter Audio Sinks
yading@10 1718 @c man begin AUDIO SINKS
yading@10 1719
yading@10 1720 Below is a description of the currently available audio sinks.
yading@10 1721
yading@10 1722 @section abuffersink
yading@10 1723
yading@10 1724 Buffer audio frames, and make them available to the end of filter chain.
yading@10 1725
yading@10 1726 This sink is mainly intended for programmatic use, in particular
yading@10 1727 through the interface defined in @file{libavfilter/buffersink.h}
yading@10 1728 or the options system.
yading@10 1729
yading@10 1730 It accepts a pointer to an AVABufferSinkContext structure, which
yading@10 1731 defines the incoming buffers' formats, to be passed as the opaque
yading@10 1732 parameter to @code{avfilter_init_filter} for initialization.
yading@10 1733
yading@10 1734 @section anullsink
yading@10 1735
yading@10 1736 Null audio sink, do absolutely nothing with the input audio. It is
yading@10 1737 mainly useful as a template and to be employed in analysis / debugging
yading@10 1738 tools.
yading@10 1739
yading@10 1740 @c man end AUDIO SINKS
yading@10 1741
yading@10 1742 @chapter Video Filters
yading@10 1743 @c man begin VIDEO FILTERS
yading@10 1744
yading@10 1745 When you configure your FFmpeg build, you can disable any of the
yading@10 1746 existing filters using @code{--disable-filters}.
yading@10 1747 The configure output will show the video filters included in your
yading@10 1748 build.
yading@10 1749
yading@10 1750 Below is a description of the currently available video filters.
yading@10 1751
yading@10 1752 @section alphaextract
yading@10 1753
yading@10 1754 Extract the alpha component from the input as a grayscale video. This
yading@10 1755 is especially useful with the @var{alphamerge} filter.
yading@10 1756
yading@10 1757 @section alphamerge
yading@10 1758
yading@10 1759 Add or replace the alpha component of the primary input with the
yading@10 1760 grayscale value of a second input. This is intended for use with
yading@10 1761 @var{alphaextract} to allow the transmission or storage of frame
yading@10 1762 sequences that have alpha in a format that doesn't support an alpha
yading@10 1763 channel.
yading@10 1764
yading@10 1765 For example, to reconstruct full frames from a normal YUV-encoded video
yading@10 1766 and a separate video created with @var{alphaextract}, you might use:
yading@10 1767 @example
yading@10 1768 movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
yading@10 1769 @end example
yading@10 1770
yading@10 1771 Since this filter is designed for reconstruction, it operates on frame
yading@10 1772 sequences without considering timestamps, and terminates when either
yading@10 1773 input reaches end of stream. This will cause problems if your encoding
yading@10 1774 pipeline drops frames. If you're trying to apply an image as an
yading@10 1775 overlay to a video stream, consider the @var{overlay} filter instead.
yading@10 1776
yading@10 1777 @section ass
yading@10 1778
yading@10 1779 Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
yading@10 1780 and libavformat to work. On the other hand, it is limited to ASS (Advanced
yading@10 1781 Substation Alpha) subtitles files.
yading@10 1782
yading@10 1783 @section bbox
yading@10 1784
yading@10 1785 Compute the bounding box for the non-black pixels in the input frame
yading@10 1786 luminance plane.
yading@10 1787
yading@10 1788 This filter computes the bounding box containing all the pixels with a
yading@10 1789 luminance value greater than the minimum allowed value.
yading@10 1790 The parameters describing the bounding box are printed on the filter
yading@10 1791 log.
yading@10 1792
yading@10 1793 @section blackdetect
yading@10 1794
yading@10 1795 Detect video intervals that are (almost) completely black. Can be
yading@10 1796 useful to detect chapter transitions, commercials, or invalid
yading@10 1797 recordings. Output lines contains the time for the start, end and
yading@10 1798 duration of the detected black interval expressed in seconds.
yading@10 1799
yading@10 1800 In order to display the output lines, you need to set the loglevel at
yading@10 1801 least to the AV_LOG_INFO value.
yading@10 1802
yading@10 1803 The filter accepts the following options:
yading@10 1804
yading@10 1805 @table @option
yading@10 1806 @item black_min_duration, d
yading@10 1807 Set the minimum detected black duration expressed in seconds. It must
yading@10 1808 be a non-negative floating point number.
yading@10 1809
yading@10 1810 Default value is 2.0.
yading@10 1811
yading@10 1812 @item picture_black_ratio_th, pic_th
yading@10 1813 Set the threshold for considering a picture "black".
yading@10 1814 Express the minimum value for the ratio:
yading@10 1815 @example
yading@10 1816 @var{nb_black_pixels} / @var{nb_pixels}
yading@10 1817 @end example
yading@10 1818
yading@10 1819 for which a picture is considered black.
yading@10 1820 Default value is 0.98.
yading@10 1821
yading@10 1822 @item pixel_black_th, pix_th
yading@10 1823 Set the threshold for considering a pixel "black".
yading@10 1824
yading@10 1825 The threshold expresses the maximum pixel luminance value for which a
yading@10 1826 pixel is considered "black". The provided value is scaled according to
yading@10 1827 the following equation:
yading@10 1828 @example
yading@10 1829 @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
yading@10 1830 @end example
yading@10 1831
yading@10 1832 @var{luminance_range_size} and @var{luminance_minimum_value} depend on
yading@10 1833 the input video format, the range is [0-255] for YUV full-range
yading@10 1834 formats and [16-235] for YUV non full-range formats.
yading@10 1835
yading@10 1836 Default value is 0.10.
yading@10 1837 @end table
yading@10 1838
yading@10 1839 The following example sets the maximum pixel threshold to the minimum
yading@10 1840 value, and detects only black intervals of 2 or more seconds:
yading@10 1841 @example
yading@10 1842 blackdetect=d=2:pix_th=0.00
yading@10 1843 @end example
yading@10 1844
yading@10 1845 @section blackframe
yading@10 1846
yading@10 1847 Detect frames that are (almost) completely black. Can be useful to
yading@10 1848 detect chapter transitions or commercials. Output lines consist of
yading@10 1849 the frame number of the detected frame, the percentage of blackness,
yading@10 1850 the position in the file if known or -1 and the timestamp in seconds.
yading@10 1851
yading@10 1852 In order to display the output lines, you need to set the loglevel at
yading@10 1853 least to the AV_LOG_INFO value.
yading@10 1854
yading@10 1855 The filter accepts the following options:
yading@10 1856
yading@10 1857 @table @option
yading@10 1858
yading@10 1859 @item amount
yading@10 1860 Set the percentage of the pixels that have to be below the threshold, defaults
yading@10 1861 to @code{98}.
yading@10 1862
yading@10 1863 @item threshold, thresh
yading@10 1864 Set the threshold below which a pixel value is considered black, defaults to
yading@10 1865 @code{32}.
yading@10 1866
yading@10 1867 @end table
yading@10 1868
yading@10 1869 @section blend
yading@10 1870
yading@10 1871 Blend two video frames into each other.
yading@10 1872
yading@10 1873 It takes two input streams and outputs one stream, the first input is the
yading@10 1874 "top" layer and second input is "bottom" layer.
yading@10 1875 Output terminates when shortest input terminates.
yading@10 1876
yading@10 1877 A description of the accepted options follows.
yading@10 1878
yading@10 1879 @table @option
yading@10 1880 @item c0_mode
yading@10 1881 @item c1_mode
yading@10 1882 @item c2_mode
yading@10 1883 @item c3_mode
yading@10 1884 @item all_mode
yading@10 1885 Set blend mode for specific pixel component or all pixel components in case
yading@10 1886 of @var{all_mode}. Default value is @code{normal}.
yading@10 1887
yading@10 1888 Available values for component modes are:
yading@10 1889 @table @samp
yading@10 1890 @item addition
yading@10 1891 @item and
yading@10 1892 @item average
yading@10 1893 @item burn
yading@10 1894 @item darken
yading@10 1895 @item difference
yading@10 1896 @item divide
yading@10 1897 @item dodge
yading@10 1898 @item exclusion
yading@10 1899 @item hardlight
yading@10 1900 @item lighten
yading@10 1901 @item multiply
yading@10 1902 @item negation
yading@10 1903 @item normal
yading@10 1904 @item or
yading@10 1905 @item overlay
yading@10 1906 @item phoenix
yading@10 1907 @item pinlight
yading@10 1908 @item reflect
yading@10 1909 @item screen
yading@10 1910 @item softlight
yading@10 1911 @item subtract
yading@10 1912 @item vividlight
yading@10 1913 @item xor
yading@10 1914 @end table
yading@10 1915
yading@10 1916 @item c0_opacity
yading@10 1917 @item c1_opacity
yading@10 1918 @item c2_opacity
yading@10 1919 @item c3_opacity
yading@10 1920 @item all_opacity
yading@10 1921 Set blend opacity for specific pixel component or all pixel components in case
yading@10 1922 of @var{all_opacity}. Only used in combination with pixel component blend modes.
yading@10 1923
yading@10 1924 @item c0_expr
yading@10 1925 @item c1_expr
yading@10 1926 @item c2_expr
yading@10 1927 @item c3_expr
yading@10 1928 @item all_expr
yading@10 1929 Set blend expression for specific pixel component or all pixel components in case
yading@10 1930 of @var{all_expr}. Note that related mode options will be ignored if those are set.
yading@10 1931
yading@10 1932 The expressions can use the following variables:
yading@10 1933
yading@10 1934 @table @option
yading@10 1935 @item N
yading@10 1936 The sequential number of the filtered frame, starting from @code{0}.
yading@10 1937
yading@10 1938 @item X
yading@10 1939 @item Y
yading@10 1940 the coordinates of the current sample
yading@10 1941
yading@10 1942 @item W
yading@10 1943 @item H
yading@10 1944 the width and height of currently filtered plane
yading@10 1945
yading@10 1946 @item SW
yading@10 1947 @item SH
yading@10 1948 Width and height scale depending on the currently filtered plane. It is the
yading@10 1949 ratio between the corresponding luma plane number of pixels and the current
yading@10 1950 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
yading@10 1951 @code{0.5,0.5} for chroma planes.
yading@10 1952
yading@10 1953 @item T
yading@10 1954 Time of the current frame, expressed in seconds.
yading@10 1955
yading@10 1956 @item TOP, A
yading@10 1957 Value of pixel component at current location for first video frame (top layer).
yading@10 1958
yading@10 1959 @item BOTTOM, B
yading@10 1960 Value of pixel component at current location for second video frame (bottom layer).
yading@10 1961 @end table
yading@10 1962 @end table
yading@10 1963
yading@10 1964 @subsection Examples
yading@10 1965
yading@10 1966 @itemize
yading@10 1967 @item
yading@10 1968 Apply transition from bottom layer to top layer in first 10 seconds:
yading@10 1969 @example
yading@10 1970 blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
yading@10 1971 @end example
yading@10 1972
yading@10 1973 @item
yading@10 1974 Apply 1x1 checkerboard effect:
yading@10 1975 @example
yading@10 1976 blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
yading@10 1977 @end example
yading@10 1978 @end itemize
yading@10 1979
yading@10 1980 @section boxblur
yading@10 1981
yading@10 1982 Apply boxblur algorithm to the input video.
yading@10 1983
yading@10 1984 The filter accepts the following options:
yading@10 1985
yading@10 1986 @table @option
yading@10 1987
yading@10 1988 @item luma_radius, lr
yading@10 1989 @item luma_power, lp
yading@10 1990 @item chroma_radius, cr
yading@10 1991 @item chroma_power, cp
yading@10 1992 @item alpha_radius, ar
yading@10 1993 @item alpha_power, ap
yading@10 1994
yading@10 1995 @end table
yading@10 1996
yading@10 1997 A description of the accepted options follows.
yading@10 1998
yading@10 1999 @table @option
yading@10 2000 @item luma_radius, lr
yading@10 2001 @item chroma_radius, cr
yading@10 2002 @item alpha_radius, ar
yading@10 2003 Set an expression for the box radius in pixels used for blurring the
yading@10 2004 corresponding input plane.
yading@10 2005
yading@10 2006 The radius value must be a non-negative number, and must not be
yading@10 2007 greater than the value of the expression @code{min(w,h)/2} for the
yading@10 2008 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
yading@10 2009 planes.
yading@10 2010
yading@10 2011 Default value for @option{luma_radius} is "2". If not specified,
yading@10 2012 @option{chroma_radius} and @option{alpha_radius} default to the
yading@10 2013 corresponding value set for @option{luma_radius}.
yading@10 2014
yading@10 2015 The expressions can contain the following constants:
yading@10 2016 @table @option
yading@10 2017 @item w, h
yading@10 2018 the input width and height in pixels
yading@10 2019
yading@10 2020 @item cw, ch
yading@10 2021 the input chroma image width and height in pixels
yading@10 2022
yading@10 2023 @item hsub, vsub
yading@10 2024 horizontal and vertical chroma subsample values. For example for the
yading@10 2025 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
yading@10 2026 @end table
yading@10 2027
yading@10 2028 @item luma_power, lp
yading@10 2029 @item chroma_power, cp
yading@10 2030 @item alpha_power, ap
yading@10 2031 Specify how many times the boxblur filter is applied to the
yading@10 2032 corresponding plane.
yading@10 2033
yading@10 2034 Default value for @option{luma_power} is 2. If not specified,
yading@10 2035 @option{chroma_power} and @option{alpha_power} default to the
yading@10 2036 corresponding value set for @option{luma_power}.
yading@10 2037
yading@10 2038 A value of 0 will disable the effect.
yading@10 2039 @end table
yading@10 2040
yading@10 2041 @subsection Examples
yading@10 2042
yading@10 2043 @itemize
yading@10 2044 @item
yading@10 2045 Apply a boxblur filter with luma, chroma, and alpha radius
yading@10 2046 set to 2:
yading@10 2047 @example
yading@10 2048 boxblur=luma_radius=2:luma_power=1
yading@10 2049 boxblur=2:1
yading@10 2050 @end example
yading@10 2051
yading@10 2052 @item
yading@10 2053 Set luma radius to 2, alpha and chroma radius to 0:
yading@10 2054 @example
yading@10 2055 boxblur=2:1:cr=0:ar=0
yading@10 2056 @end example
yading@10 2057
yading@10 2058 @item
yading@10 2059 Set luma and chroma radius to a fraction of the video dimension:
yading@10 2060 @example
yading@10 2061 boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
yading@10 2062 @end example
yading@10 2063 @end itemize
yading@10 2064
yading@10 2065 @section colorbalance
yading@10 2066 Modify intensity of primary colors (red, green and blue) of input frames.
yading@10 2067
yading@10 2068 The filter allows an input frame to be adjusted in the shadows, midtones or highlights
yading@10 2069 regions for the red-cyan, green-magenta or blue-yellow balance.
yading@10 2070
yading@10 2071 A positive adjustment value shifts the balance towards the primary color, a negative
yading@10 2072 value towards the complementary color.
yading@10 2073
yading@10 2074 The filter accepts the following options:
yading@10 2075
yading@10 2076 @table @option
yading@10 2077 @item rs
yading@10 2078 @item gs
yading@10 2079 @item bs
yading@10 2080 Adjust red, green and blue shadows (darkest pixels).
yading@10 2081
yading@10 2082 @item rm
yading@10 2083 @item gm
yading@10 2084 @item bm
yading@10 2085 Adjust red, green and blue midtones (medium pixels).
yading@10 2086
yading@10 2087 @item rh
yading@10 2088 @item gh
yading@10 2089 @item bh
yading@10 2090 Adjust red, green and blue highlights (brightest pixels).
yading@10 2091
yading@10 2092 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
yading@10 2093 @end table
yading@10 2094
yading@10 2095 @subsection Examples
yading@10 2096
yading@10 2097 @itemize
yading@10 2098 @item
yading@10 2099 Add red color cast to shadows:
yading@10 2100 @example
yading@10 2101 colorbalance=rs=.3
yading@10 2102 @end example
yading@10 2103 @end itemize
yading@10 2104
yading@10 2105 @section colorchannelmixer
yading@10 2106
yading@10 2107 Adjust video input frames by re-mixing color channels.
yading@10 2108
yading@10 2109 This filter modifies a color channel by adding the values associated to
yading@10 2110 the other channels of the same pixels. For example if the value to
yading@10 2111 modify is red, the output value will be:
yading@10 2112 @example
yading@10 2113 @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
yading@10 2114 @end example
yading@10 2115
yading@10 2116 The filter accepts the following options:
yading@10 2117
yading@10 2118 @table @option
yading@10 2119 @item rr
yading@10 2120 @item rg
yading@10 2121 @item rb
yading@10 2122 @item ra
yading@10 2123 Adjust contribution of input red, green, blue and alpha channels for output red channel.
yading@10 2124 Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
yading@10 2125
yading@10 2126 @item gr
yading@10 2127 @item gg
yading@10 2128 @item gb
yading@10 2129 @item ga
yading@10 2130 Adjust contribution of input red, green, blue and alpha channels for output green channel.
yading@10 2131 Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
yading@10 2132
yading@10 2133 @item br
yading@10 2134 @item bg
yading@10 2135 @item bb
yading@10 2136 @item ba
yading@10 2137 Adjust contribution of input red, green, blue and alpha channels for output blue channel.
yading@10 2138 Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
yading@10 2139
yading@10 2140 @item ar
yading@10 2141 @item ag
yading@10 2142 @item ab
yading@10 2143 @item aa
yading@10 2144 Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
yading@10 2145 Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
yading@10 2146
yading@10 2147 Allowed ranges for options are @code{[-2.0, 2.0]}.
yading@10 2148 @end table
yading@10 2149
yading@10 2150 @subsection Examples
yading@10 2151
yading@10 2152 @itemize
yading@10 2153 @item
yading@10 2154 Convert source to grayscale:
yading@10 2155 @example
yading@10 2156 colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
yading@10 2157 @end example
yading@10 2158 @end itemize
yading@10 2159
yading@10 2160 @section colormatrix
yading@10 2161
yading@10 2162 Convert color matrix.
yading@10 2163
yading@10 2164 The filter accepts the following options:
yading@10 2165
yading@10 2166 @table @option
yading@10 2167 @item src
yading@10 2168 @item dst
yading@10 2169 Specify the source and destination color matrix. Both values must be
yading@10 2170 specified.
yading@10 2171
yading@10 2172 The accepted values are:
yading@10 2173 @table @samp
yading@10 2174 @item bt709
yading@10 2175 BT.709
yading@10 2176
yading@10 2177 @item bt601
yading@10 2178 BT.601
yading@10 2179
yading@10 2180 @item smpte240m
yading@10 2181 SMPTE-240M
yading@10 2182
yading@10 2183 @item fcc
yading@10 2184 FCC
yading@10 2185 @end table
yading@10 2186 @end table
yading@10 2187
yading@10 2188 For example to convert from BT.601 to SMPTE-240M, use the command:
yading@10 2189 @example
yading@10 2190 colormatrix=bt601:smpte240m
yading@10 2191 @end example
yading@10 2192
yading@10 2193 @section copy
yading@10 2194
yading@10 2195 Copy the input source unchanged to the output. Mainly useful for
yading@10 2196 testing purposes.
yading@10 2197
yading@10 2198 @section crop
yading@10 2199
yading@10 2200 Crop the input video to given dimensions.
yading@10 2201
yading@10 2202 The filter accepts the following options:
yading@10 2203
yading@10 2204 @table @option
yading@10 2205 @item w, out_w
yading@10 2206 Width of the output video. It defaults to @code{iw}.
yading@10 2207 This expression is evaluated only once during the filter
yading@10 2208 configuration.
yading@10 2209
yading@10 2210 @item h, out_h
yading@10 2211 Height of the output video. It defaults to @code{ih}.
yading@10 2212 This expression is evaluated only once during the filter
yading@10 2213 configuration.
yading@10 2214
yading@10 2215 @item x
yading@10 2216 Horizontal position, in the input video, of the left edge of the output video.
yading@10 2217 It defaults to @code{(in_w-out_w)/2}.
yading@10 2218 This expression is evaluated per-frame.
yading@10 2219
yading@10 2220 @item y
yading@10 2221 Vertical position, in the input video, of the top edge of the output video.
yading@10 2222 It defaults to @code{(in_h-out_h)/2}.
yading@10 2223 This expression is evaluated per-frame.
yading@10 2224
yading@10 2225 @item keep_aspect
yading@10 2226 If set to 1 will force the output display aspect ratio
yading@10 2227 to be the same of the input, by changing the output sample aspect
yading@10 2228 ratio. It defaults to 0.
yading@10 2229 @end table
yading@10 2230
yading@10 2231 The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
yading@10 2232 expressions containing the following constants:
yading@10 2233
yading@10 2234 @table @option
yading@10 2235 @item x, y
yading@10 2236 the computed values for @var{x} and @var{y}. They are evaluated for
yading@10 2237 each new frame.
yading@10 2238
yading@10 2239 @item in_w, in_h
yading@10 2240 the input width and height
yading@10 2241
yading@10 2242 @item iw, ih
yading@10 2243 same as @var{in_w} and @var{in_h}
yading@10 2244
yading@10 2245 @item out_w, out_h
yading@10 2246 the output (cropped) width and height
yading@10 2247
yading@10 2248 @item ow, oh
yading@10 2249 same as @var{out_w} and @var{out_h}
yading@10 2250
yading@10 2251 @item a
yading@10 2252 same as @var{iw} / @var{ih}
yading@10 2253
yading@10 2254 @item sar
yading@10 2255 input sample aspect ratio
yading@10 2256
yading@10 2257 @item dar
yading@10 2258 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
yading@10 2259
yading@10 2260 @item hsub, vsub
yading@10 2261 horizontal and vertical chroma subsample values. For example for the
yading@10 2262 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
yading@10 2263
yading@10 2264 @item n
yading@10 2265 the number of input frame, starting from 0
yading@10 2266
yading@10 2267 @item pos
yading@10 2268 the position in the file of the input frame, NAN if unknown
yading@10 2269
yading@10 2270 @item t
yading@10 2271 timestamp expressed in seconds, NAN if the input timestamp is unknown
yading@10 2272
yading@10 2273 @end table
yading@10 2274
yading@10 2275 The expression for @var{out_w} may depend on the value of @var{out_h},
yading@10 2276 and the expression for @var{out_h} may depend on @var{out_w}, but they
yading@10 2277 cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
yading@10 2278 evaluated after @var{out_w} and @var{out_h}.
yading@10 2279
yading@10 2280 The @var{x} and @var{y} parameters specify the expressions for the
yading@10 2281 position of the top-left corner of the output (non-cropped) area. They
yading@10 2282 are evaluated for each frame. If the evaluated value is not valid, it
yading@10 2283 is approximated to the nearest valid value.
yading@10 2284
yading@10 2285 The expression for @var{x} may depend on @var{y}, and the expression
yading@10 2286 for @var{y} may depend on @var{x}.
yading@10 2287
yading@10 2288 @subsection Examples
yading@10 2289
yading@10 2290 @itemize
yading@10 2291 @item
yading@10 2292 Crop area with size 100x100 at position (12,34).
yading@10 2293 @example
yading@10 2294 crop=100:100:12:34
yading@10 2295 @end example
yading@10 2296
yading@10 2297 Using named options, the example above becomes:
yading@10 2298 @example
yading@10 2299 crop=w=100:h=100:x=12:y=34
yading@10 2300 @end example
yading@10 2301
yading@10 2302 @item
yading@10 2303 Crop the central input area with size 100x100:
yading@10 2304 @example
yading@10 2305 crop=100:100
yading@10 2306 @end example
yading@10 2307
yading@10 2308 @item
yading@10 2309 Crop the central input area with size 2/3 of the input video:
yading@10 2310 @example
yading@10 2311 crop=2/3*in_w:2/3*in_h
yading@10 2312 @end example
yading@10 2313
yading@10 2314 @item
yading@10 2315 Crop the input video central square:
yading@10 2316 @example
yading@10 2317 crop=out_w=in_h
yading@10 2318 crop=in_h
yading@10 2319 @end example
yading@10 2320
yading@10 2321 @item
yading@10 2322 Delimit the rectangle with the top-left corner placed at position
yading@10 2323 100:100 and the right-bottom corner corresponding to the right-bottom
yading@10 2324 corner of the input image:
yading@10 2325 @example
yading@10 2326 crop=in_w-100:in_h-100:100:100
yading@10 2327 @end example
yading@10 2328
yading@10 2329 @item
yading@10 2330 Crop 10 pixels from the left and right borders, and 20 pixels from
yading@10 2331 the top and bottom borders
yading@10 2332 @example
yading@10 2333 crop=in_w-2*10:in_h-2*20
yading@10 2334 @end example
yading@10 2335
yading@10 2336 @item
yading@10 2337 Keep only the bottom right quarter of the input image:
yading@10 2338 @example
yading@10 2339 crop=in_w/2:in_h/2:in_w/2:in_h/2
yading@10 2340 @end example
yading@10 2341
yading@10 2342 @item
yading@10 2343 Crop height for getting Greek harmony:
yading@10 2344 @example
yading@10 2345 crop=in_w:1/PHI*in_w
yading@10 2346 @end example
yading@10 2347
yading@10 2348 @item
yading@10 2349 Appply trembling effect:
yading@10 2350 @example
yading@10 2351 crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
yading@10 2352 @end example
yading@10 2353
yading@10 2354 @item
yading@10 2355 Apply erratic camera effect depending on timestamp:
yading@10 2356 @example
yading@10 2357 crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
yading@10 2358 @end example
yading@10 2359
yading@10 2360 @item
yading@10 2361 Set x depending on the value of y:
yading@10 2362 @example
yading@10 2363 crop=in_w/2:in_h/2:y:10+10*sin(n/10)
yading@10 2364 @end example
yading@10 2365 @end itemize
yading@10 2366
yading@10 2367 @section cropdetect
yading@10 2368
yading@10 2369 Auto-detect crop size.
yading@10 2370
yading@10 2371 Calculate necessary cropping parameters and prints the recommended
yading@10 2372 parameters through the logging system. The detected dimensions
yading@10 2373 correspond to the non-black area of the input video.
yading@10 2374
yading@10 2375 The filter accepts the following options:
yading@10 2376
yading@10 2377 @table @option
yading@10 2378
yading@10 2379 @item limit
yading@10 2380 Set higher black value threshold, which can be optionally specified
yading@10 2381 from nothing (0) to everything (255). An intensity value greater
yading@10 2382 to the set value is considered non-black. Default value is 24.
yading@10 2383
yading@10 2384 @item round
yading@10 2385 Set the value for which the width/height should be divisible by. The
yading@10 2386 offset is automatically adjusted to center the video. Use 2 to get
yading@10 2387 only even dimensions (needed for 4:2:2 video). 16 is best when
yading@10 2388 encoding to most video codecs. Default value is 16.
yading@10 2389
yading@10 2390 @item reset_count, reset
yading@10 2391 Set the counter that determines after how many frames cropdetect will
yading@10 2392 reset the previously detected largest video area and start over to
yading@10 2393 detect the current optimal crop area. Default value is 0.
yading@10 2394
yading@10 2395 This can be useful when channel logos distort the video area. 0
yading@10 2396 indicates never reset and return the largest area encountered during
yading@10 2397 playback.
yading@10 2398 @end table
yading@10 2399
yading@10 2400 @section curves
yading@10 2401
yading@10 2402 Apply color adjustments using curves.
yading@10 2403
yading@10 2404 This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
yading@10 2405 component (red, green and blue) has its values defined by @var{N} key points
yading@10 2406 tied from each other using a smooth curve. The x-axis represents the pixel
yading@10 2407 values from the input frame, and the y-axis the new pixel values to be set for
yading@10 2408 the output frame.
yading@10 2409
yading@10 2410 By default, a component curve is defined by the two points @var{(0;0)} and
yading@10 2411 @var{(1;1)}. This creates a straight line where each original pixel value is
yading@10 2412 "adjusted" to its own value, which means no change to the image.
yading@10 2413
yading@10 2414 The filter allows you to redefine these two points and add some more. A new
yading@10 2415 curve (using a natural cubic spline interpolation) will be define to pass
yading@10 2416 smoothly through all these new coordinates. The new defined points needs to be
yading@10 2417 strictly increasing over the x-axis, and their @var{x} and @var{y} values must
yading@10 2418 be in the @var{[0;1]} interval. If the computed curves happened to go outside
yading@10 2419 the vector spaces, the values will be clipped accordingly.
yading@10 2420
yading@10 2421 If there is no key point defined in @code{x=0}, the filter will automatically
yading@10 2422 insert a @var{(0;0)} point. In the same way, if there is no key point defined
yading@10 2423 in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
yading@10 2424
yading@10 2425 The filter accepts the following options:
yading@10 2426
yading@10 2427 @table @option
yading@10 2428 @item preset
yading@10 2429 Select one of the available color presets. This option can be used in addition
yading@10 2430 to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
yading@10 2431 options takes priority on the preset values.
yading@10 2432 Available presets are:
yading@10 2433 @table @samp
yading@10 2434 @item none
yading@10 2435 @item color_negative
yading@10 2436 @item cross_process
yading@10 2437 @item darker
yading@10 2438 @item increase_contrast
yading@10 2439 @item lighter
yading@10 2440 @item linear_contrast
yading@10 2441 @item medium_contrast
yading@10 2442 @item negative
yading@10 2443 @item strong_contrast
yading@10 2444 @item vintage
yading@10 2445 @end table
yading@10 2446 Default is @code{none}.
yading@10 2447 @item master, m
yading@10 2448 Set the master key points. These points will define a second pass mapping. It
yading@10 2449 is sometimes called a "luminance" or "value" mapping. It can be used with
yading@10 2450 @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
yading@10 2451 post-processing LUT.
yading@10 2452 @item red, r
yading@10 2453 Set the key points for the red component.
yading@10 2454 @item green, g
yading@10 2455 Set the key points for the green component.
yading@10 2456 @item blue, b
yading@10 2457 Set the key points for the blue component.
yading@10 2458 @item all
yading@10 2459 Set the key points for all components (not including master).
yading@10 2460 Can be used in addition to the other key points component
yading@10 2461 options. In this case, the unset component(s) will fallback on this
yading@10 2462 @option{all} setting.
yading@10 2463 @item psfile
yading@10 2464 Specify a Photoshop curves file (@code{.asv}) to import the settings from.
yading@10 2465 @end table
yading@10 2466
yading@10 2467 To avoid some filtergraph syntax conflicts, each key points list need to be
yading@10 2468 defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
yading@10 2469
yading@10 2470 @subsection Examples
yading@10 2471
yading@10 2472 @itemize
yading@10 2473 @item
yading@10 2474 Increase slightly the middle level of blue:
yading@10 2475 @example
yading@10 2476 curves=blue='0.5/0.58'
yading@10 2477 @end example
yading@10 2478
yading@10 2479 @item
yading@10 2480 Vintage effect:
yading@10 2481 @example
yading@10 2482 curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
yading@10 2483 @end example
yading@10 2484 Here we obtain the following coordinates for each components:
yading@10 2485 @table @var
yading@10 2486 @item red
yading@10 2487 @code{(0;0.11) (0.42;0.51) (1;0.95)}
yading@10 2488 @item green
yading@10 2489 @code{(0;0) (0.50;0.48) (1;1)}
yading@10 2490 @item blue
yading@10 2491 @code{(0;0.22) (0.49;0.44) (1;0.80)}
yading@10 2492 @end table
yading@10 2493
yading@10 2494 @item
yading@10 2495 The previous example can also be achieved with the associated built-in preset:
yading@10 2496 @example
yading@10 2497 curves=preset=vintage
yading@10 2498 @end example
yading@10 2499
yading@10 2500 @item
yading@10 2501 Or simply:
yading@10 2502 @example
yading@10 2503 curves=vintage
yading@10 2504 @end example
yading@10 2505
yading@10 2506 @item
yading@10 2507 Use a Photoshop preset and redefine the points of the green component:
yading@10 2508 @example
yading@10 2509 curves=psfile='MyCurvesPresets/purple.asv':green='0.45/0.53'
yading@10 2510 @end example
yading@10 2511 @end itemize
yading@10 2512
yading@10 2513 @anchor{decimate}
yading@10 2514 @section decimate
yading@10 2515
yading@10 2516 Drop duplicated frames at regular intervals.
yading@10 2517
yading@10 2518 The filter accepts the following options:
yading@10 2519
yading@10 2520 @table @option
yading@10 2521 @item cycle
yading@10 2522 Set the number of frames from which one will be dropped. Setting this to
yading@10 2523 @var{N} means one frame in every batch of @var{N} frames will be dropped.
yading@10 2524 Default is @code{5}.
yading@10 2525
yading@10 2526 @item dupthresh
yading@10 2527 Set the threshold for duplicate detection. If the difference metric for a frame
yading@10 2528 is less than or equal to this value, then it is declared as duplicate. Default
yading@10 2529 is @code{1.1}
yading@10 2530
yading@10 2531 @item scthresh
yading@10 2532 Set scene change threshold. Default is @code{15}.
yading@10 2533
yading@10 2534 @item blockx
yading@10 2535 @item blocky
yading@10 2536 Set the size of the x and y-axis blocks used during metric calculations.
yading@10 2537 Larger blocks give better noise suppression, but also give worse detection of
yading@10 2538 small movements. Must be a power of two. Default is @code{32}.
yading@10 2539
yading@10 2540 @item ppsrc
yading@10 2541 Mark main input as a pre-processed input and activate clean source input
yading@10 2542 stream. This allows the input to be pre-processed with various filters to help
yading@10 2543 the metrics calculation while keeping the frame selection lossless. When set to
yading@10 2544 @code{1}, the first stream is for the pre-processed input, and the second
yading@10 2545 stream is the clean source from where the kept frames are chosen. Default is
yading@10 2546 @code{0}.
yading@10 2547
yading@10 2548 @item chroma
yading@10 2549 Set whether or not chroma is considered in the metric calculations. Default is
yading@10 2550 @code{1}.
yading@10 2551 @end table
yading@10 2552
yading@10 2553 @section delogo
yading@10 2554
yading@10 2555 Suppress a TV station logo by a simple interpolation of the surrounding
yading@10 2556 pixels. Just set a rectangle covering the logo and watch it disappear
yading@10 2557 (and sometimes something even uglier appear - your mileage may vary).
yading@10 2558
yading@10 2559 This filter accepts the following options:
yading@10 2560 @table @option
yading@10 2561
yading@10 2562 @item x, y
yading@10 2563 Specify the top left corner coordinates of the logo. They must be
yading@10 2564 specified.
yading@10 2565
yading@10 2566 @item w, h
yading@10 2567 Specify the width and height of the logo to clear. They must be
yading@10 2568 specified.
yading@10 2569
yading@10 2570 @item band, t
yading@10 2571 Specify the thickness of the fuzzy edge of the rectangle (added to
yading@10 2572 @var{w} and @var{h}). The default value is 4.
yading@10 2573
yading@10 2574 @item show
yading@10 2575 When set to 1, a green rectangle is drawn on the screen to simplify
yading@10 2576 finding the right @var{x}, @var{y}, @var{w}, @var{h} parameters, and
yading@10 2577 @var{band} is set to 4. The default value is 0.
yading@10 2578
yading@10 2579 @end table
yading@10 2580
yading@10 2581 @subsection Examples
yading@10 2582
yading@10 2583 @itemize
yading@10 2584 @item
yading@10 2585 Set a rectangle covering the area with top left corner coordinates 0,0
yading@10 2586 and size 100x77, setting a band of size 10:
yading@10 2587 @example
yading@10 2588 delogo=x=0:y=0:w=100:h=77:band=10
yading@10 2589 @end example
yading@10 2590
yading@10 2591 @end itemize
yading@10 2592
yading@10 2593 @section deshake
yading@10 2594
yading@10 2595 Attempt to fix small changes in horizontal and/or vertical shift. This
yading@10 2596 filter helps remove camera shake from hand-holding a camera, bumping a
yading@10 2597 tripod, moving on a vehicle, etc.
yading@10 2598
yading@10 2599 The filter accepts the following options:
yading@10 2600
yading@10 2601 @table @option
yading@10 2602
yading@10 2603 @item x
yading@10 2604 @item y
yading@10 2605 @item w
yading@10 2606 @item h
yading@10 2607 Specify a rectangular area where to limit the search for motion
yading@10 2608 vectors.
yading@10 2609 If desired the search for motion vectors can be limited to a
yading@10 2610 rectangular area of the frame defined by its top left corner, width
yading@10 2611 and height. These parameters have the same meaning as the drawbox
yading@10 2612 filter which can be used to visualise the position of the bounding
yading@10 2613 box.
yading@10 2614
yading@10 2615 This is useful when simultaneous movement of subjects within the frame
yading@10 2616 might be confused for camera motion by the motion vector search.
yading@10 2617
yading@10 2618 If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
yading@10 2619 then the full frame is used. This allows later options to be set
yading@10 2620 without specifying the bounding box for the motion vector search.
yading@10 2621
yading@10 2622 Default - search the whole frame.
yading@10 2623
yading@10 2624 @item rx
yading@10 2625 @item ry
yading@10 2626 Specify the maximum extent of movement in x and y directions in the
yading@10 2627 range 0-64 pixels. Default 16.
yading@10 2628
yading@10 2629 @item edge
yading@10 2630 Specify how to generate pixels to fill blanks at the edge of the
yading@10 2631 frame. Available values are:
yading@10 2632 @table @samp
yading@10 2633 @item blank, 0
yading@10 2634 Fill zeroes at blank locations
yading@10 2635 @item original, 1
yading@10 2636 Original image at blank locations
yading@10 2637 @item clamp, 2
yading@10 2638 Extruded edge value at blank locations
yading@10 2639 @item mirror, 3
yading@10 2640 Mirrored edge at blank locations
yading@10 2641 @end table
yading@10 2642 Default value is @samp{mirror}.
yading@10 2643
yading@10 2644 @item blocksize
yading@10 2645 Specify the blocksize to use for motion search. Range 4-128 pixels,
yading@10 2646 default 8.
yading@10 2647
yading@10 2648 @item contrast
yading@10 2649 Specify the contrast threshold for blocks. Only blocks with more than
yading@10 2650 the specified contrast (difference between darkest and lightest
yading@10 2651 pixels) will be considered. Range 1-255, default 125.
yading@10 2652
yading@10 2653 @item search
yading@10 2654 Specify the search strategy. Available values are:
yading@10 2655 @table @samp
yading@10 2656 @item exhaustive, 0
yading@10 2657 Set exhaustive search
yading@10 2658 @item less, 1
yading@10 2659 Set less exhaustive search.
yading@10 2660 @end table
yading@10 2661 Default value is @samp{exhaustive}.
yading@10 2662
yading@10 2663 @item filename
yading@10 2664 If set then a detailed log of the motion search is written to the
yading@10 2665 specified file.
yading@10 2666
yading@10 2667 @item opencl
yading@10 2668 If set to 1, specify using OpenCL capabilities, only available if
yading@10 2669 FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
yading@10 2670
yading@10 2671 @end table
yading@10 2672
yading@10 2673 @section drawbox
yading@10 2674
yading@10 2675 Draw a colored box on the input image.
yading@10 2676
yading@10 2677 This filter accepts the following options:
yading@10 2678
yading@10 2679 @table @option
yading@10 2680 @item x, y
yading@10 2681 Specify the top left corner coordinates of the box. Default to 0.
yading@10 2682
yading@10 2683 @item width, w
yading@10 2684 @item height, h
yading@10 2685 Specify the width and height of the box, if 0 they are interpreted as
yading@10 2686 the input width and height. Default to 0.
yading@10 2687
yading@10 2688 @item color, c
yading@10 2689 Specify the color of the box to write, it can be the name of a color
yading@10 2690 (case insensitive match) or a 0xRRGGBB[AA] sequence. If the special
yading@10 2691 value @code{invert} is used, the box edge color is the same as the
yading@10 2692 video with inverted luma.
yading@10 2693
yading@10 2694 @item thickness, t
yading@10 2695 Set the thickness of the box edge. Default value is @code{4}.
yading@10 2696 @end table
yading@10 2697
yading@10 2698 @subsection Examples
yading@10 2699
yading@10 2700 @itemize
yading@10 2701 @item
yading@10 2702 Draw a black box around the edge of the input image:
yading@10 2703 @example
yading@10 2704 drawbox
yading@10 2705 @end example
yading@10 2706
yading@10 2707 @item
yading@10 2708 Draw a box with color red and an opacity of 50%:
yading@10 2709 @example
yading@10 2710 drawbox=10:20:200:60:red@@0.5
yading@10 2711 @end example
yading@10 2712
yading@10 2713 The previous example can be specified as:
yading@10 2714 @example
yading@10 2715 drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
yading@10 2716 @end example
yading@10 2717
yading@10 2718 @item
yading@10 2719 Fill the box with pink color:
yading@10 2720 @example
yading@10 2721 drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
yading@10 2722 @end example
yading@10 2723 @end itemize
yading@10 2724
yading@10 2725 @anchor{drawtext}
yading@10 2726 @section drawtext
yading@10 2727
yading@10 2728 Draw text string or text from specified file on top of video using the
yading@10 2729 libfreetype library.
yading@10 2730
yading@10 2731 To enable compilation of this filter you need to configure FFmpeg with
yading@10 2732 @code{--enable-libfreetype}.
yading@10 2733
yading@10 2734 @subsection Syntax
yading@10 2735
yading@10 2736 The description of the accepted parameters follows.
yading@10 2737
yading@10 2738 @table @option
yading@10 2739
yading@10 2740 @item box
yading@10 2741 Used to draw a box around text using background color.
yading@10 2742 Value should be either 1 (enable) or 0 (disable).
yading@10 2743 The default value of @var{box} is 0.
yading@10 2744
yading@10 2745 @item boxcolor
yading@10 2746 The color to be used for drawing box around text.
yading@10 2747 Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
yading@10 2748 (e.g. "0xff00ff"), possibly followed by an alpha specifier.
yading@10 2749 The default value of @var{boxcolor} is "white".
yading@10 2750
yading@10 2751 @item draw
yading@10 2752 Set an expression which specifies if the text should be drawn. If the
yading@10 2753 expression evaluates to 0, the text is not drawn. This is useful for
yading@10 2754 specifying that the text should be drawn only when specific conditions
yading@10 2755 are met.
yading@10 2756
yading@10 2757 Default value is "1".
yading@10 2758
yading@10 2759 See below for the list of accepted constants and functions.
yading@10 2760
yading@10 2761 @item expansion
yading@10 2762 Select how the @var{text} is expanded. Can be either @code{none},
yading@10 2763 @code{strftime} (deprecated) or
yading@10 2764 @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
yading@10 2765 below for details.
yading@10 2766
yading@10 2767 @item fix_bounds
yading@10 2768 If true, check and fix text coords to avoid clipping.
yading@10 2769
yading@10 2770 @item fontcolor
yading@10 2771 The color to be used for drawing fonts.
yading@10 2772 Either a string (e.g. "red") or in 0xRRGGBB[AA] format
yading@10 2773 (e.g. "0xff000033"), possibly followed by an alpha specifier.
yading@10 2774 The default value of @var{fontcolor} is "black".
yading@10 2775
yading@10 2776 @item fontfile
yading@10 2777 The font file to be used for drawing text. Path must be included.
yading@10 2778 This parameter is mandatory.
yading@10 2779
yading@10 2780 @item fontsize
yading@10 2781 The font size to be used for drawing text.
yading@10 2782 The default value of @var{fontsize} is 16.
yading@10 2783
yading@10 2784 @item ft_load_flags
yading@10 2785 Flags to be used for loading the fonts.
yading@10 2786
yading@10 2787 The flags map the corresponding flags supported by libfreetype, and are
yading@10 2788 a combination of the following values:
yading@10 2789 @table @var
yading@10 2790 @item default
yading@10 2791 @item no_scale
yading@10 2792 @item no_hinting
yading@10 2793 @item render
yading@10 2794 @item no_bitmap
yading@10 2795 @item vertical_layout
yading@10 2796 @item force_autohint
yading@10 2797 @item crop_bitmap
yading@10 2798 @item pedantic
yading@10 2799 @item ignore_global_advance_width
yading@10 2800 @item no_recurse
yading@10 2801 @item ignore_transform
yading@10 2802 @item monochrome
yading@10 2803 @item linear_design
yading@10 2804 @item no_autohint
yading@10 2805 @item end table
yading@10 2806 @end table
yading@10 2807
yading@10 2808 Default value is "render".
yading@10 2809
yading@10 2810 For more information consult the documentation for the FT_LOAD_*
yading@10 2811 libfreetype flags.
yading@10 2812
yading@10 2813 @item shadowcolor
yading@10 2814 The color to be used for drawing a shadow behind the drawn text. It
yading@10 2815 can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
yading@10 2816 form (e.g. "0xff00ff"), possibly followed by an alpha specifier.
yading@10 2817 The default value of @var{shadowcolor} is "black".
yading@10 2818
yading@10 2819 @item shadowx, shadowy
yading@10 2820 The x and y offsets for the text shadow position with respect to the
yading@10 2821 position of the text. They can be either positive or negative
yading@10 2822 values. Default value for both is "0".
yading@10 2823
yading@10 2824 @item tabsize
yading@10 2825 The size in number of spaces to use for rendering the tab.
yading@10 2826 Default value is 4.
yading@10 2827
yading@10 2828 @item timecode
yading@10 2829 Set the initial timecode representation in "hh:mm:ss[:;.]ff"
yading@10 2830 format. It can be used with or without text parameter. @var{timecode_rate}
yading@10 2831 option must be specified.
yading@10 2832
yading@10 2833 @item timecode_rate, rate, r
yading@10 2834 Set the timecode frame rate (timecode only).
yading@10 2835
yading@10 2836 @item text
yading@10 2837 The text string to be drawn. The text must be a sequence of UTF-8
yading@10 2838 encoded characters.
yading@10 2839 This parameter is mandatory if no file is specified with the parameter
yading@10 2840 @var{textfile}.
yading@10 2841
yading@10 2842 @item textfile
yading@10 2843 A text file containing text to be drawn. The text must be a sequence
yading@10 2844 of UTF-8 encoded characters.
yading@10 2845
yading@10 2846 This parameter is mandatory if no text string is specified with the
yading@10 2847 parameter @var{text}.
yading@10 2848
yading@10 2849 If both @var{text} and @var{textfile} are specified, an error is thrown.
yading@10 2850
yading@10 2851 @item reload
yading@10 2852 If set to 1, the @var{textfile} will be reloaded before each frame.
yading@10 2853 Be sure to update it atomically, or it may be read partially, or even fail.
yading@10 2854
yading@10 2855 @item x, y
yading@10 2856 The expressions which specify the offsets where text will be drawn
yading@10 2857 within the video frame. They are relative to the top/left border of the
yading@10 2858 output image.
yading@10 2859
yading@10 2860 The default value of @var{x} and @var{y} is "0".
yading@10 2861
yading@10 2862 See below for the list of accepted constants and functions.
yading@10 2863 @end table
yading@10 2864
yading@10 2865 The parameters for @var{x} and @var{y} are expressions containing the
yading@10 2866 following constants and functions:
yading@10 2867
yading@10 2868 @table @option
yading@10 2869 @item dar
yading@10 2870 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
yading@10 2871
yading@10 2872 @item hsub, vsub
yading@10 2873 horizontal and vertical chroma subsample values. For example for the
yading@10 2874 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
yading@10 2875
yading@10 2876 @item line_h, lh
yading@10 2877 the height of each text line
yading@10 2878
yading@10 2879 @item main_h, h, H
yading@10 2880 the input height
yading@10 2881
yading@10 2882 @item main_w, w, W
yading@10 2883 the input width
yading@10 2884
yading@10 2885 @item max_glyph_a, ascent
yading@10 2886 the maximum distance from the baseline to the highest/upper grid
yading@10 2887 coordinate used to place a glyph outline point, for all the rendered
yading@10 2888 glyphs.
yading@10 2889 It is a positive value, due to the grid's orientation with the Y axis
yading@10 2890 upwards.
yading@10 2891
yading@10 2892 @item max_glyph_d, descent
yading@10 2893 the maximum distance from the baseline to the lowest grid coordinate
yading@10 2894 used to place a glyph outline point, for all the rendered glyphs.
yading@10 2895 This is a negative value, due to the grid's orientation, with the Y axis
yading@10 2896 upwards.
yading@10 2897
yading@10 2898 @item max_glyph_h
yading@10 2899 maximum glyph height, that is the maximum height for all the glyphs
yading@10 2900 contained in the rendered text, it is equivalent to @var{ascent} -
yading@10 2901 @var{descent}.
yading@10 2902
yading@10 2903 @item max_glyph_w
yading@10 2904 maximum glyph width, that is the maximum width for all the glyphs
yading@10 2905 contained in the rendered text
yading@10 2906
yading@10 2907 @item n
yading@10 2908 the number of input frame, starting from 0
yading@10 2909
yading@10 2910 @item rand(min, max)
yading@10 2911 return a random number included between @var{min} and @var{max}
yading@10 2912
yading@10 2913 @item sar
yading@10 2914 input sample aspect ratio
yading@10 2915
yading@10 2916 @item t
yading@10 2917 timestamp expressed in seconds, NAN if the input timestamp is unknown
yading@10 2918
yading@10 2919 @item text_h, th
yading@10 2920 the height of the rendered text
yading@10 2921
yading@10 2922 @item text_w, tw
yading@10 2923 the width of the rendered text
yading@10 2924
yading@10 2925 @item x, y
yading@10 2926 the x and y offset coordinates where the text is drawn.
yading@10 2927
yading@10 2928 These parameters allow the @var{x} and @var{y} expressions to refer
yading@10 2929 each other, so you can for example specify @code{y=x/dar}.
yading@10 2930 @end table
yading@10 2931
yading@10 2932 If libavfilter was built with @code{--enable-fontconfig}, then
yading@10 2933 @option{fontfile} can be a fontconfig pattern or omitted.
yading@10 2934
yading@10 2935 @anchor{drawtext_expansion}
yading@10 2936 @subsection Text expansion
yading@10 2937
yading@10 2938 If @option{expansion} is set to @code{strftime},
yading@10 2939 the filter recognizes strftime() sequences in the provided text and
yading@10 2940 expands them accordingly. Check the documentation of strftime(). This
yading@10 2941 feature is deprecated.
yading@10 2942
yading@10 2943 If @option{expansion} is set to @code{none}, the text is printed verbatim.
yading@10 2944
yading@10 2945 If @option{expansion} is set to @code{normal} (which is the default),
yading@10 2946 the following expansion mechanism is used.
yading@10 2947
yading@10 2948 The backslash character '\', followed by any character, always expands to
yading@10 2949 the second character.
yading@10 2950
yading@10 2951 Sequence of the form @code{%@{...@}} are expanded. The text between the
yading@10 2952 braces is a function name, possibly followed by arguments separated by ':'.
yading@10 2953 If the arguments contain special characters or delimiters (':' or '@}'),
yading@10 2954 they should be escaped.
yading@10 2955
yading@10 2956 Note that they probably must also be escaped as the value for the
yading@10 2957 @option{text} option in the filter argument string and as the filter
yading@10 2958 argument in the filtergraph description, and possibly also for the shell,
yading@10 2959 that makes up to four levels of escaping; using a text file avoids these
yading@10 2960 problems.
yading@10 2961
yading@10 2962 The following functions are available:
yading@10 2963
yading@10 2964 @table @command
yading@10 2965
yading@10 2966 @item expr, e
yading@10 2967 The expression evaluation result.
yading@10 2968
yading@10 2969 It must take one argument specifying the expression to be evaluated,
yading@10 2970 which accepts the same constants and functions as the @var{x} and
yading@10 2971 @var{y} values. Note that not all constants should be used, for
yading@10 2972 example the text size is not known when evaluating the expression, so
yading@10 2973 the constants @var{text_w} and @var{text_h} will have an undefined
yading@10 2974 value.
yading@10 2975
yading@10 2976 @item gmtime
yading@10 2977 The time at which the filter is running, expressed in UTC.
yading@10 2978 It can accept an argument: a strftime() format string.
yading@10 2979
yading@10 2980 @item localtime
yading@10 2981 The time at which the filter is running, expressed in the local time zone.
yading@10 2982 It can accept an argument: a strftime() format string.
yading@10 2983
yading@10 2984 @item n, frame_num
yading@10 2985 The frame number, starting from 0.
yading@10 2986
yading@10 2987 @item pts
yading@10 2988 The timestamp of the current frame, in seconds, with microsecond accuracy.
yading@10 2989
yading@10 2990 @end table
yading@10 2991
yading@10 2992 @subsection Examples
yading@10 2993
yading@10 2994 @itemize
yading@10 2995 @item
yading@10 2996 Draw "Test Text" with font FreeSerif, using the default values for the
yading@10 2997 optional parameters.
yading@10 2998
yading@10 2999 @example
yading@10 3000 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
yading@10 3001 @end example
yading@10 3002
yading@10 3003 @item
yading@10 3004 Draw 'Test Text' with font FreeSerif of size 24 at position x=100
yading@10 3005 and y=50 (counting from the top-left corner of the screen), text is
yading@10 3006 yellow with a red box around it. Both the text and the box have an
yading@10 3007 opacity of 20%.
yading@10 3008
yading@10 3009 @example
yading@10 3010 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
yading@10 3011 x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
yading@10 3012 @end example
yading@10 3013
yading@10 3014 Note that the double quotes are not necessary if spaces are not used
yading@10 3015 within the parameter list.
yading@10 3016
yading@10 3017 @item
yading@10 3018 Show the text at the center of the video frame:
yading@10 3019 @example
yading@10 3020 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
yading@10 3021 @end example
yading@10 3022
yading@10 3023 @item
yading@10 3024 Show a text line sliding from right to left in the last row of the video
yading@10 3025 frame. The file @file{LONG_LINE} is assumed to contain a single line
yading@10 3026 with no newlines.
yading@10 3027 @example
yading@10 3028 drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
yading@10 3029 @end example
yading@10 3030
yading@10 3031 @item
yading@10 3032 Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
yading@10 3033 @example
yading@10 3034 drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
yading@10 3035 @end example
yading@10 3036
yading@10 3037 @item
yading@10 3038 Draw a single green letter "g", at the center of the input video.
yading@10 3039 The glyph baseline is placed at half screen height.
yading@10 3040 @example
yading@10 3041 drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
yading@10 3042 @end example
yading@10 3043
yading@10 3044 @item
yading@10 3045 Show text for 1 second every 3 seconds:
yading@10 3046 @example
yading@10 3047 drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:draw=lt(mod(t\,3)\,1):text='blink'"
yading@10 3048 @end example
yading@10 3049
yading@10 3050 @item
yading@10 3051 Use fontconfig to set the font. Note that the colons need to be escaped.
yading@10 3052 @example
yading@10 3053 drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
yading@10 3054 @end example
yading@10 3055
yading@10 3056 @item
yading@10 3057 Print the date of a real-time encoding (see strftime(3)):
yading@10 3058 @example
yading@10 3059 drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
yading@10 3060 @end example
yading@10 3061
yading@10 3062 @end itemize
yading@10 3063
yading@10 3064 For more information about libfreetype, check:
yading@10 3065 @url{http://www.freetype.org/}.
yading@10 3066
yading@10 3067 For more information about fontconfig, check:
yading@10 3068 @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
yading@10 3069
yading@10 3070 @section edgedetect
yading@10 3071
yading@10 3072 Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
yading@10 3073
yading@10 3074 The filter accepts the following options:
yading@10 3075
yading@10 3076 @table @option
yading@10 3077 @item low, high
yading@10 3078 Set low and high threshold values used by the Canny thresholding
yading@10 3079 algorithm.
yading@10 3080
yading@10 3081 The high threshold selects the "strong" edge pixels, which are then
yading@10 3082 connected through 8-connectivity with the "weak" edge pixels selected
yading@10 3083 by the low threshold.
yading@10 3084
yading@10 3085 @var{low} and @var{high} threshold values must be choosen in the range
yading@10 3086 [0,1], and @var{low} should be lesser or equal to @var{high}.
yading@10 3087
yading@10 3088 Default value for @var{low} is @code{20/255}, and default value for @var{high}
yading@10 3089 is @code{50/255}.
yading@10 3090 @end table
yading@10 3091
yading@10 3092 Example:
yading@10 3093 @example
yading@10 3094 edgedetect=low=0.1:high=0.4
yading@10 3095 @end example
yading@10 3096
yading@10 3097 @section fade
yading@10 3098
yading@10 3099 Apply fade-in/out effect to input video.
yading@10 3100
yading@10 3101 This filter accepts the following options:
yading@10 3102
yading@10 3103 @table @option
yading@10 3104 @item type, t
yading@10 3105 The effect type -- can be either "in" for fade-in, or "out" for a fade-out
yading@10 3106 effect.
yading@10 3107 Default is @code{in}.
yading@10 3108
yading@10 3109 @item start_frame, s
yading@10 3110 Specify the number of the start frame for starting to apply the fade
yading@10 3111 effect. Default is 0.
yading@10 3112
yading@10 3113 @item nb_frames, n
yading@10 3114 The number of frames for which the fade effect has to last. At the end of the
yading@10 3115 fade-in effect the output video will have the same intensity as the input video,
yading@10 3116 at the end of the fade-out transition the output video will be completely black.
yading@10 3117 Default is 25.
yading@10 3118
yading@10 3119 @item alpha
yading@10 3120 If set to 1, fade only alpha channel, if one exists on the input.
yading@10 3121 Default value is 0.
yading@10 3122 @end table
yading@10 3123
yading@10 3124 @subsection Examples
yading@10 3125
yading@10 3126 @itemize
yading@10 3127 @item
yading@10 3128 Fade in first 30 frames of video:
yading@10 3129 @example
yading@10 3130 fade=in:0:30
yading@10 3131 @end example
yading@10 3132
yading@10 3133 The command above is equivalent to:
yading@10 3134 @example
yading@10 3135 fade=t=in:s=0:n=30
yading@10 3136 @end example
yading@10 3137
yading@10 3138 @item
yading@10 3139 Fade out last 45 frames of a 200-frame video:
yading@10 3140 @example
yading@10 3141 fade=out:155:45
yading@10 3142 fade=type=out:start_frame=155:nb_frames=45
yading@10 3143 @end example
yading@10 3144
yading@10 3145 @item
yading@10 3146 Fade in first 25 frames and fade out last 25 frames of a 1000-frame video:
yading@10 3147 @example
yading@10 3148 fade=in:0:25, fade=out:975:25
yading@10 3149 @end example
yading@10 3150
yading@10 3151 @item
yading@10 3152 Make first 5 frames black, then fade in from frame 5-24:
yading@10 3153 @example
yading@10 3154 fade=in:5:20
yading@10 3155 @end example
yading@10 3156
yading@10 3157 @item
yading@10 3158 Fade in alpha over first 25 frames of video:
yading@10 3159 @example
yading@10 3160 fade=in:0:25:alpha=1
yading@10 3161 @end example
yading@10 3162 @end itemize
yading@10 3163
yading@10 3164 @section field
yading@10 3165
yading@10 3166 Extract a single field from an interlaced image using stride
yading@10 3167 arithmetic to avoid wasting CPU time. The output frames are marked as
yading@10 3168 non-interlaced.
yading@10 3169
yading@10 3170 The filter accepts the following options:
yading@10 3171
yading@10 3172 @table @option
yading@10 3173 @item type
yading@10 3174 Specify whether to extract the top (if the value is @code{0} or
yading@10 3175 @code{top}) or the bottom field (if the value is @code{1} or
yading@10 3176 @code{bottom}).
yading@10 3177 @end table
yading@10 3178
yading@10 3179 @section fieldmatch
yading@10 3180
yading@10 3181 Field matching filter for inverse telecine. It is meant to reconstruct the
yading@10 3182 progressive frames from a telecined stream. The filter does not drop duplicated
yading@10 3183 frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
yading@10 3184 followed by a decimation filter such as @ref{decimate} in the filtergraph.
yading@10 3185
yading@10 3186 The separation of the field matching and the decimation is notably motivated by
yading@10 3187 the possibility of inserting a de-interlacing filter fallback between the two.
yading@10 3188 If the source has mixed telecined and real interlaced content,
yading@10 3189 @code{fieldmatch} will not be able to match fields for the interlaced parts.
yading@10 3190 But these remaining combed frames will be marked as interlaced, and thus can be
yading@10 3191 de-interlaced by a later filter such as @ref{yadif} before decimation.
yading@10 3192
yading@10 3193 In addition to the various configuration options, @code{fieldmatch} can take an
yading@10 3194 optional second stream, activated through the @option{ppsrc} option. If
yading@10 3195 enabled, the frames reconstruction will be based on the fields and frames from
yading@10 3196 this second stream. This allows the first input to be pre-processed in order to
yading@10 3197 help the various algorithms of the filter, while keeping the output lossless
yading@10 3198 (assuming the fields are matched properly). Typically, a field-aware denoiser,
yading@10 3199 or brightness/contrast adjustments can help.
yading@10 3200
yading@10 3201 Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
yading@10 3202 and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
yading@10 3203 which @code{fieldmatch} is based on. While the semantic and usage are very
yading@10 3204 close, some behaviour and options names can differ.
yading@10 3205
yading@10 3206 The filter accepts the following options:
yading@10 3207
yading@10 3208 @table @option
yading@10 3209 @item order
yading@10 3210 Specify the assumed field order of the input stream. Available values are:
yading@10 3211
yading@10 3212 @table @samp
yading@10 3213 @item auto
yading@10 3214 Auto detect parity (use FFmpeg's internal parity value).
yading@10 3215 @item bff
yading@10 3216 Assume bottom field first.
yading@10 3217 @item tff
yading@10 3218 Assume top field first.
yading@10 3219 @end table
yading@10 3220
yading@10 3221 Note that it is sometimes recommended not to trust the parity announced by the
yading@10 3222 stream.
yading@10 3223
yading@10 3224 Default value is @var{auto}.
yading@10 3225
yading@10 3226 @item mode
yading@10 3227 Set the matching mode or strategy to use. @option{pc} mode is the safest in the
yading@10 3228 sense that it wont risk creating jerkiness due to duplicate frames when
yading@10 3229 possible, but if there are bad edits or blended fields it will end up
yading@10 3230 outputting combed frames when a good match might actually exist. On the other
yading@10 3231 hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
yading@10 3232 but will almost always find a good frame if there is one. The other values are
yading@10 3233 all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
yading@10 3234 jerkiness and creating duplicate frames versus finding good matches in sections
yading@10 3235 with bad edits, orphaned fields, blended fields, etc.
yading@10 3236
yading@10 3237 More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
yading@10 3238
yading@10 3239 Available values are:
yading@10 3240
yading@10 3241 @table @samp
yading@10 3242 @item pc
yading@10 3243 2-way matching (p/c)
yading@10 3244 @item pc_n
yading@10 3245 2-way matching, and trying 3rd match if still combed (p/c + n)
yading@10 3246 @item pc_u
yading@10 3247 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
yading@10 3248 @item pc_n_ub
yading@10 3249 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
yading@10 3250 still combed (p/c + n + u/b)
yading@10 3251 @item pcn
yading@10 3252 3-way matching (p/c/n)
yading@10 3253 @item pcn_ub
yading@10 3254 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
yading@10 3255 detected as combed (p/c/n + u/b)
yading@10 3256 @end table
yading@10 3257
yading@10 3258 The parenthesis at the end indicate the matches that would be used for that
yading@10 3259 mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
yading@10 3260 @var{top}).
yading@10 3261
yading@10 3262 In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
yading@10 3263 the slowest.
yading@10 3264
yading@10 3265 Default value is @var{pc_n}.
yading@10 3266
yading@10 3267 @item ppsrc
yading@10 3268 Mark the main input stream as a pre-processed input, and enable the secondary
yading@10 3269 input stream as the clean source to pick the fields from. See the filter
yading@10 3270 introduction for more details. It is similar to the @option{clip2} feature from
yading@10 3271 VFM/TFM.
yading@10 3272
yading@10 3273 Default value is @code{0} (disabled).
yading@10 3274
yading@10 3275 @item field
yading@10 3276 Set the field to match from. It is recommended to set this to the same value as
yading@10 3277 @option{order} unless you experience matching failures with that setting. In
yading@10 3278 certain circumstances changing the field that is used to match from can have a
yading@10 3279 large impact on matching performance. Available values are:
yading@10 3280
yading@10 3281 @table @samp
yading@10 3282 @item auto
yading@10 3283 Automatic (same value as @option{order}).
yading@10 3284 @item bottom
yading@10 3285 Match from the bottom field.
yading@10 3286 @item top
yading@10 3287 Match from the top field.
yading@10 3288 @end table
yading@10 3289
yading@10 3290 Default value is @var{auto}.
yading@10 3291
yading@10 3292 @item mchroma
yading@10 3293 Set whether or not chroma is included during the match comparisons. In most
yading@10 3294 cases it is recommended to leave this enabled. You should set this to @code{0}
yading@10 3295 only if your clip has bad chroma problems such as heavy rainbowing or other
yading@10 3296 artifacts. Setting this to @code{0} could also be used to speed things up at
yading@10 3297 the cost of some accuracy.
yading@10 3298
yading@10 3299 Default value is @code{1}.
yading@10 3300
yading@10 3301 @item y0
yading@10 3302 @item y1
yading@10 3303 These define an exclusion band which excludes the lines between @option{y0} and
yading@10 3304 @option{y1} from being included in the field matching decision. An exclusion
yading@10 3305 band can be used to ignore subtitles, a logo, or other things that may
yading@10 3306 interfere with the matching. @option{y0} sets the starting scan line and
yading@10 3307 @option{y1} sets the ending line; all lines in between @option{y0} and
yading@10 3308 @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
yading@10 3309 @option{y0} and @option{y1} to the same value will disable the feature.
yading@10 3310 @option{y0} and @option{y1} defaults to @code{0}.
yading@10 3311
yading@10 3312 @item scthresh
yading@10 3313 Set the scene change detection threshold as a percentage of maximum change on
yading@10 3314 the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
yading@10 3315 detection is only relevant in case @option{combmatch}=@var{sc}. The range for
yading@10 3316 @option{scthresh} is @code{[0.0, 100.0]}.
yading@10 3317
yading@10 3318 Default value is @code{12.0}.
yading@10 3319
yading@10 3320 @item combmatch
yading@10 3321 When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
yading@10 3322 account the combed scores of matches when deciding what match to use as the
yading@10 3323 final match. Available values are:
yading@10 3324
yading@10 3325 @table @samp
yading@10 3326 @item none
yading@10 3327 No final matching based on combed scores.
yading@10 3328 @item sc
yading@10 3329 Combed scores are only used when a scene change is detected.
yading@10 3330 @item full
yading@10 3331 Use combed scores all the time.
yading@10 3332 @end table
yading@10 3333
yading@10 3334 Default is @var{sc}.
yading@10 3335
yading@10 3336 @item combdbg
yading@10 3337 Force @code{fieldmatch} to calculate the combed metrics for certain matches and
yading@10 3338 print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
yading@10 3339 Available values are:
yading@10 3340
yading@10 3341 @table @samp
yading@10 3342 @item none
yading@10 3343 No forced calculation.
yading@10 3344 @item pcn
yading@10 3345 Force p/c/n calculations.
yading@10 3346 @item pcnub
yading@10 3347 Force p/c/n/u/b calculations.
yading@10 3348 @end table
yading@10 3349
yading@10 3350 Default value is @var{none}.
yading@10 3351
yading@10 3352 @item cthresh
yading@10 3353 This is the area combing threshold used for combed frame detection. This
yading@10 3354 essentially controls how "strong" or "visible" combing must be to be detected.
yading@10 3355 Larger values mean combing must be more visible and smaller values mean combing
yading@10 3356 can be less visible or strong and still be detected. Valid settings are from
yading@10 3357 @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
yading@10 3358 be detected as combed). This is basically a pixel difference value. A good
yading@10 3359 range is @code{[8, 12]}.
yading@10 3360
yading@10 3361 Default value is @code{9}.
yading@10 3362
yading@10 3363 @item chroma
yading@10 3364 Sets whether or not chroma is considered in the combed frame decision. Only
yading@10 3365 disable this if your source has chroma problems (rainbowing, etc.) that are
yading@10 3366 causing problems for the combed frame detection with chroma enabled. Actually,
yading@10 3367 using @option{chroma}=@var{0} is usually more reliable, except for the case
yading@10 3368 where there is chroma only combing in the source.
yading@10 3369
yading@10 3370 Default value is @code{0}.
yading@10 3371
yading@10 3372 @item blockx
yading@10 3373 @item blocky
yading@10 3374 Respectively set the x-axis and y-axis size of the window used during combed
yading@10 3375 frame detection. This has to do with the size of the area in which
yading@10 3376 @option{combpel} pixels are required to be detected as combed for a frame to be
yading@10 3377 declared combed. See the @option{combpel} parameter description for more info.
yading@10 3378 Possible values are any number that is a power of 2 starting at 4 and going up
yading@10 3379 to 512.
yading@10 3380
yading@10 3381 Default value is @code{16}.
yading@10 3382
yading@10 3383 @item combpel
yading@10 3384 The number of combed pixels inside any of the @option{blocky} by
yading@10 3385 @option{blockx} size blocks on the frame for the frame to be detected as
yading@10 3386 combed. While @option{cthresh} controls how "visible" the combing must be, this
yading@10 3387 setting controls "how much" combing there must be in any localized area (a
yading@10 3388 window defined by the @option{blockx} and @option{blocky} settings) on the
yading@10 3389 frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
yading@10 3390 which point no frames will ever be detected as combed). This setting is known
yading@10 3391 as @option{MI} in TFM/VFM vocabulary.
yading@10 3392
yading@10 3393 Default value is @code{80}.
yading@10 3394 @end table
yading@10 3395
yading@10 3396 @anchor{p/c/n/u/b meaning}
yading@10 3397 @subsection p/c/n/u/b meaning
yading@10 3398
yading@10 3399 @subsubsection p/c/n
yading@10 3400
yading@10 3401 We assume the following telecined stream:
yading@10 3402
yading@10 3403 @example
yading@10 3404 Top fields: 1 2 2 3 4
yading@10 3405 Bottom fields: 1 2 3 4 4
yading@10 3406 @end example
yading@10 3407
yading@10 3408 The numbers correspond to the progressive frame the fields relate to. Here, the
yading@10 3409 first two frames are progressive, the 3rd and 4th are combed, and so on.
yading@10 3410
yading@10 3411 When @code{fieldmatch} is configured to run a matching from bottom
yading@10 3412 (@option{field}=@var{bottom}) this is how this input stream get transformed:
yading@10 3413
yading@10 3414 @example
yading@10 3415 Input stream:
yading@10 3416 T 1 2 2 3 4
yading@10 3417 B 1 2 3 4 4 <-- matching reference
yading@10 3418
yading@10 3419 Matches: c c n n c
yading@10 3420
yading@10 3421 Output stream:
yading@10 3422 T 1 2 3 4 4
yading@10 3423 B 1 2 3 4 4
yading@10 3424 @end example
yading@10 3425
yading@10 3426 As a result of the field matching, we can see that some frames get duplicated.
yading@10 3427 To perform a complete inverse telecine, you need to rely on a decimation filter
yading@10 3428 after this operation. See for instance the @ref{decimate} filter.
yading@10 3429
yading@10 3430 The same operation now matching from top fields (@option{field}=@var{top})
yading@10 3431 looks like this:
yading@10 3432
yading@10 3433 @example
yading@10 3434 Input stream:
yading@10 3435 T 1 2 2 3 4 <-- matching reference
yading@10 3436 B 1 2 3 4 4
yading@10 3437
yading@10 3438 Matches: c c p p c
yading@10 3439
yading@10 3440 Output stream:
yading@10 3441 T 1 2 2 3 4
yading@10 3442 B 1 2 2 3 4
yading@10 3443 @end example
yading@10 3444
yading@10 3445 In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
yading@10 3446 basically, they refer to the frame and field of the opposite parity:
yading@10 3447
yading@10 3448 @itemize
yading@10 3449 @item @var{p} matches the field of the opposite parity in the previous frame
yading@10 3450 @item @var{c} matches the field of the opposite parity in the current frame
yading@10 3451 @item @var{n} matches the field of the opposite parity in the next frame
yading@10 3452 @end itemize
yading@10 3453
yading@10 3454 @subsubsection u/b
yading@10 3455
yading@10 3456 The @var{u} and @var{b} matching are a bit special in the sense that they match
yading@10 3457 from the opposite parity flag. In the following examples, we assume that we are
yading@10 3458 currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
yading@10 3459 'x' is placed above and below each matched fields.
yading@10 3460
yading@10 3461 With bottom matching (@option{field}=@var{bottom}):
yading@10 3462 @example
yading@10 3463 Match: c p n b u
yading@10 3464
yading@10 3465 x x x x x
yading@10 3466 Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
yading@10 3467 Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
yading@10 3468 x x x x x
yading@10 3469
yading@10 3470 Output frames:
yading@10 3471 2 1 2 2 2
yading@10 3472 2 2 2 1 3
yading@10 3473 @end example
yading@10 3474
yading@10 3475 With top matching (@option{field}=@var{top}):
yading@10 3476 @example
yading@10 3477 Match: c p n b u
yading@10 3478
yading@10 3479 x x x x x
yading@10 3480 Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
yading@10 3481 Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
yading@10 3482 x x x x x
yading@10 3483
yading@10 3484 Output frames:
yading@10 3485 2 2 2 1 2
yading@10 3486 2 1 3 2 2
yading@10 3487 @end example
yading@10 3488
yading@10 3489 @subsection Examples
yading@10 3490
yading@10 3491 Simple IVTC of a top field first telecined stream:
yading@10 3492 @example
yading@10 3493 fieldmatch=order=tff:combmatch=none, decimate
yading@10 3494 @end example
yading@10 3495
yading@10 3496 Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
yading@10 3497 @example
yading@10 3498 fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
yading@10 3499 @end example
yading@10 3500
yading@10 3501 @section fieldorder
yading@10 3502
yading@10 3503 Transform the field order of the input video.
yading@10 3504
yading@10 3505 This filter accepts the following options:
yading@10 3506
yading@10 3507 @table @option
yading@10 3508
yading@10 3509 @item order
yading@10 3510 Output field order. Valid values are @var{tff} for top field first or @var{bff}
yading@10 3511 for bottom field first.
yading@10 3512 @end table
yading@10 3513
yading@10 3514 Default value is @samp{tff}.
yading@10 3515
yading@10 3516 Transformation is achieved by shifting the picture content up or down
yading@10 3517 by one line, and filling the remaining line with appropriate picture content.
yading@10 3518 This method is consistent with most broadcast field order converters.
yading@10 3519
yading@10 3520 If the input video is not flagged as being interlaced, or it is already
yading@10 3521 flagged as being of the required output field order then this filter does
yading@10 3522 not alter the incoming video.
yading@10 3523
yading@10 3524 This filter is very useful when converting to or from PAL DV material,
yading@10 3525 which is bottom field first.
yading@10 3526
yading@10 3527 For example:
yading@10 3528 @example
yading@10 3529 ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
yading@10 3530 @end example
yading@10 3531
yading@10 3532 @section fifo
yading@10 3533
yading@10 3534 Buffer input images and send them when they are requested.
yading@10 3535
yading@10 3536 This filter is mainly useful when auto-inserted by the libavfilter
yading@10 3537 framework.
yading@10 3538
yading@10 3539 The filter does not take parameters.
yading@10 3540
yading@10 3541 @anchor{format}
yading@10 3542 @section format
yading@10 3543
yading@10 3544 Convert the input video to one of the specified pixel formats.
yading@10 3545 Libavfilter will try to pick one that is supported for the input to
yading@10 3546 the next filter.
yading@10 3547
yading@10 3548 This filter accepts the following parameters:
yading@10 3549 @table @option
yading@10 3550
yading@10 3551 @item pix_fmts
yading@10 3552 A '|'-separated list of pixel format names, for example
yading@10 3553 "pix_fmts=yuv420p|monow|rgb24".
yading@10 3554
yading@10 3555 @end table
yading@10 3556
yading@10 3557 @subsection Examples
yading@10 3558
yading@10 3559 @itemize
yading@10 3560 @item
yading@10 3561 Convert the input video to the format @var{yuv420p}
yading@10 3562 @example
yading@10 3563 format=pix_fmts=yuv420p
yading@10 3564 @end example
yading@10 3565
yading@10 3566 Convert the input video to any of the formats in the list
yading@10 3567 @example
yading@10 3568 format=pix_fmts=yuv420p|yuv444p|yuv410p
yading@10 3569 @end example
yading@10 3570 @end itemize
yading@10 3571
yading@10 3572 @section fps
yading@10 3573
yading@10 3574 Convert the video to specified constant frame rate by duplicating or dropping
yading@10 3575 frames as necessary.
yading@10 3576
yading@10 3577 This filter accepts the following named parameters:
yading@10 3578 @table @option
yading@10 3579
yading@10 3580 @item fps
yading@10 3581 Desired output frame rate. The default is @code{25}.
yading@10 3582
yading@10 3583 @item round
yading@10 3584 Rounding method.
yading@10 3585
yading@10 3586 Possible values are:
yading@10 3587 @table @option
yading@10 3588 @item zero
yading@10 3589 zero round towards 0
yading@10 3590 @item inf
yading@10 3591 round away from 0
yading@10 3592 @item down
yading@10 3593 round towards -infinity
yading@10 3594 @item up
yading@10 3595 round towards +infinity
yading@10 3596 @item near
yading@10 3597 round to nearest
yading@10 3598 @end table
yading@10 3599 The default is @code{near}.
yading@10 3600
yading@10 3601 @end table
yading@10 3602
yading@10 3603 Alternatively, the options can be specified as a flat string:
yading@10 3604 @var{fps}[:@var{round}].
yading@10 3605
yading@10 3606 See also the @ref{setpts} filter.
yading@10 3607
yading@10 3608 @section framestep
yading@10 3609
yading@10 3610 Select one frame every N-th frame.
yading@10 3611
yading@10 3612 This filter accepts the following option:
yading@10 3613 @table @option
yading@10 3614 @item step
yading@10 3615 Select frame after every @code{step} frames.
yading@10 3616 Allowed values are positive integers higher than 0. Default value is @code{1}.
yading@10 3617 @end table
yading@10 3618
yading@10 3619 @anchor{frei0r}
yading@10 3620 @section frei0r
yading@10 3621
yading@10 3622 Apply a frei0r effect to the input video.
yading@10 3623
yading@10 3624 To enable compilation of this filter you need to install the frei0r
yading@10 3625 header and configure FFmpeg with @code{--enable-frei0r}.
yading@10 3626
yading@10 3627 This filter accepts the following options:
yading@10 3628
yading@10 3629 @table @option
yading@10 3630
yading@10 3631 @item filter_name
yading@10 3632 The name to the frei0r effect to load. If the environment variable
yading@10 3633 @env{FREI0R_PATH} is defined, the frei0r effect is searched in each one of the
yading@10 3634 directories specified by the colon separated list in @env{FREIOR_PATH},
yading@10 3635 otherwise in the standard frei0r paths, which are in this order:
yading@10 3636 @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
yading@10 3637 @file{/usr/lib/frei0r-1/}.
yading@10 3638
yading@10 3639 @item filter_params
yading@10 3640 A '|'-separated list of parameters to pass to the frei0r effect.
yading@10 3641
yading@10 3642 @end table
yading@10 3643
yading@10 3644 A frei0r effect parameter can be a boolean (whose values are specified
yading@10 3645 with "y" and "n"), a double, a color (specified by the syntax
yading@10 3646 @var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float
yading@10 3647 numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color
yading@10 3648 description), a position (specified by the syntax @var{X}/@var{Y},
yading@10 3649 @var{X} and @var{Y} being float numbers) and a string.
yading@10 3650
yading@10 3651 The number and kind of parameters depend on the loaded effect. If an
yading@10 3652 effect parameter is not specified the default value is set.
yading@10 3653
yading@10 3654 @subsection Examples
yading@10 3655
yading@10 3656 @itemize
yading@10 3657 @item
yading@10 3658 Apply the distort0r effect, set the first two double parameters:
yading@10 3659 @example
yading@10 3660 frei0r=filter_name=distort0r:filter_params=0.5|0.01
yading@10 3661 @end example
yading@10 3662
yading@10 3663 @item
yading@10 3664 Apply the colordistance effect, take a color as first parameter:
yading@10 3665 @example
yading@10 3666 frei0r=colordistance:0.2/0.3/0.4
yading@10 3667 frei0r=colordistance:violet
yading@10 3668 frei0r=colordistance:0x112233
yading@10 3669 @end example
yading@10 3670
yading@10 3671 @item
yading@10 3672 Apply the perspective effect, specify the top left and top right image
yading@10 3673 positions:
yading@10 3674 @example
yading@10 3675 frei0r=perspective:0.2/0.2|0.8/0.2
yading@10 3676 @end example
yading@10 3677 @end itemize
yading@10 3678
yading@10 3679 For more information see:
yading@10 3680 @url{http://frei0r.dyne.org}
yading@10 3681
yading@10 3682 @section geq
yading@10 3683
yading@10 3684 The filter accepts the following options:
yading@10 3685
yading@10 3686 @table @option
yading@10 3687 @item lum_expr
yading@10 3688 the luminance expression
yading@10 3689 @item cb_expr
yading@10 3690 the chrominance blue expression
yading@10 3691 @item cr_expr
yading@10 3692 the chrominance red expression
yading@10 3693 @item alpha_expr
yading@10 3694 the alpha expression
yading@10 3695 @end table
yading@10 3696
yading@10 3697 If one of the chrominance expression is not defined, it falls back on the other
yading@10 3698 one. If no alpha expression is specified it will evaluate to opaque value.
yading@10 3699 If none of chrominance expressions are
yading@10 3700 specified, they will evaluate the luminance expression.
yading@10 3701
yading@10 3702 The expressions can use the following variables and functions:
yading@10 3703
yading@10 3704 @table @option
yading@10 3705 @item N
yading@10 3706 The sequential number of the filtered frame, starting from @code{0}.
yading@10 3707
yading@10 3708 @item X
yading@10 3709 @item Y
yading@10 3710 The coordinates of the current sample.
yading@10 3711
yading@10 3712 @item W
yading@10 3713 @item H
yading@10 3714 The width and height of the image.
yading@10 3715
yading@10 3716 @item SW
yading@10 3717 @item SH
yading@10 3718 Width and height scale depending on the currently filtered plane. It is the
yading@10 3719 ratio between the corresponding luma plane number of pixels and the current
yading@10 3720 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
yading@10 3721 @code{0.5,0.5} for chroma planes.
yading@10 3722
yading@10 3723 @item T
yading@10 3724 Time of the current frame, expressed in seconds.
yading@10 3725
yading@10 3726 @item p(x, y)
yading@10 3727 Return the value of the pixel at location (@var{x},@var{y}) of the current
yading@10 3728 plane.
yading@10 3729
yading@10 3730 @item lum(x, y)
yading@10 3731 Return the value of the pixel at location (@var{x},@var{y}) of the luminance
yading@10 3732 plane.
yading@10 3733
yading@10 3734 @item cb(x, y)
yading@10 3735 Return the value of the pixel at location (@var{x},@var{y}) of the
yading@10 3736 blue-difference chroma plane. Returns 0 if there is no such plane.
yading@10 3737
yading@10 3738 @item cr(x, y)
yading@10 3739 Return the value of the pixel at location (@var{x},@var{y}) of the
yading@10 3740 red-difference chroma plane. Returns 0 if there is no such plane.
yading@10 3741
yading@10 3742 @item alpha(x, y)
yading@10 3743 Return the value of the pixel at location (@var{x},@var{y}) of the alpha
yading@10 3744 plane. Returns 0 if there is no such plane.
yading@10 3745 @end table
yading@10 3746
yading@10 3747 For functions, if @var{x} and @var{y} are outside the area, the value will be
yading@10 3748 automatically clipped to the closer edge.
yading@10 3749
yading@10 3750 @subsection Examples
yading@10 3751
yading@10 3752 @itemize
yading@10 3753 @item
yading@10 3754 Flip the image horizontally:
yading@10 3755 @example
yading@10 3756 geq=p(W-X\,Y)
yading@10 3757 @end example
yading@10 3758
yading@10 3759 @item
yading@10 3760 Generate a bidimensional sine wave, with angle @code{PI/3} and a
yading@10 3761 wavelength of 100 pixels:
yading@10 3762 @example
yading@10 3763 geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
yading@10 3764 @end example
yading@10 3765
yading@10 3766 @item
yading@10 3767 Generate a fancy enigmatic moving light:
yading@10 3768 @example
yading@10 3769 nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
yading@10 3770 @end example
yading@10 3771
yading@10 3772 @item
yading@10 3773 Generate a quick emboss effect:
yading@10 3774 @example
yading@10 3775 format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
yading@10 3776 @end example
yading@10 3777 @end itemize
yading@10 3778
yading@10 3779 @section gradfun
yading@10 3780
yading@10 3781 Fix the banding artifacts that are sometimes introduced into nearly flat
yading@10 3782 regions by truncation to 8bit color depth.
yading@10 3783 Interpolate the gradients that should go where the bands are, and
yading@10 3784 dither them.
yading@10 3785
yading@10 3786 This filter is designed for playback only. Do not use it prior to
yading@10 3787 lossy compression, because compression tends to lose the dither and
yading@10 3788 bring back the bands.
yading@10 3789
yading@10 3790 This filter accepts the following options:
yading@10 3791
yading@10 3792 @table @option
yading@10 3793
yading@10 3794 @item strength
yading@10 3795 The maximum amount by which the filter will change any one pixel. Also the
yading@10 3796 threshold for detecting nearly flat regions. Acceptable values range from .51 to
yading@10 3797 64, default value is 1.2, out-of-range values will be clipped to the valid
yading@10 3798 range.
yading@10 3799
yading@10 3800 @item radius
yading@10 3801 The neighborhood to fit the gradient to. A larger radius makes for smoother
yading@10 3802 gradients, but also prevents the filter from modifying the pixels near detailed
yading@10 3803 regions. Acceptable values are 8-32, default value is 16, out-of-range values
yading@10 3804 will be clipped to the valid range.
yading@10 3805
yading@10 3806 @end table
yading@10 3807
yading@10 3808 Alternatively, the options can be specified as a flat string:
yading@10 3809 @var{strength}[:@var{radius}]
yading@10 3810
yading@10 3811 @subsection Examples
yading@10 3812
yading@10 3813 @itemize
yading@10 3814 @item
yading@10 3815 Apply the filter with a @code{3.5} strength and radius of @code{8}:
yading@10 3816 @example
yading@10 3817 gradfun=3.5:8
yading@10 3818 @end example
yading@10 3819
yading@10 3820 @item
yading@10 3821 Specify radius, omitting the strength (which will fall-back to the default
yading@10 3822 value):
yading@10 3823 @example
yading@10 3824 gradfun=radius=8
yading@10 3825 @end example
yading@10 3826
yading@10 3827 @end itemize
yading@10 3828
yading@10 3829 @section hflip
yading@10 3830
yading@10 3831 Flip the input video horizontally.
yading@10 3832
yading@10 3833 For example to horizontally flip the input video with @command{ffmpeg}:
yading@10 3834 @example
yading@10 3835 ffmpeg -i in.avi -vf "hflip" out.avi
yading@10 3836 @end example
yading@10 3837
yading@10 3838 @section histeq
yading@10 3839 This filter applies a global color histogram equalization on a
yading@10 3840 per-frame basis.
yading@10 3841
yading@10 3842 It can be used to correct video that has a compressed range of pixel
yading@10 3843 intensities. The filter redistributes the pixel intensities to
yading@10 3844 equalize their distribution across the intensity range. It may be
yading@10 3845 viewed as an "automatically adjusting contrast filter". This filter is
yading@10 3846 useful only for correcting degraded or poorly captured source
yading@10 3847 video.
yading@10 3848
yading@10 3849 The filter accepts the following options:
yading@10 3850
yading@10 3851 @table @option
yading@10 3852 @item strength
yading@10 3853 Determine the amount of equalization to be applied. As the strength
yading@10 3854 is reduced, the distribution of pixel intensities more-and-more
yading@10 3855 approaches that of the input frame. The value must be a float number
yading@10 3856 in the range [0,1] and defaults to 0.200.
yading@10 3857
yading@10 3858 @item intensity
yading@10 3859 Set the maximum intensity that can generated and scale the output
yading@10 3860 values appropriately. The strength should be set as desired and then
yading@10 3861 the intensity can be limited if needed to avoid washing-out. The value
yading@10 3862 must be a float number in the range [0,1] and defaults to 0.210.
yading@10 3863
yading@10 3864 @item antibanding
yading@10 3865 Set the antibanding level. If enabled the filter will randomly vary
yading@10 3866 the luminance of output pixels by a small amount to avoid banding of
yading@10 3867 the histogram. Possible values are @code{none}, @code{weak} or
yading@10 3868 @code{strong}. It defaults to @code{none}.
yading@10 3869 @end table
yading@10 3870
yading@10 3871 @section histogram
yading@10 3872
yading@10 3873 Compute and draw a color distribution histogram for the input video.
yading@10 3874
yading@10 3875 The computed histogram is a representation of distribution of color components
yading@10 3876 in an image.
yading@10 3877
yading@10 3878 The filter accepts the following options:
yading@10 3879
yading@10 3880 @table @option
yading@10 3881 @item mode
yading@10 3882 Set histogram mode.
yading@10 3883
yading@10 3884 It accepts the following values:
yading@10 3885 @table @samp
yading@10 3886 @item levels
yading@10 3887 standard histogram that display color components distribution in an image.
yading@10 3888 Displays color graph for each color component. Shows distribution
yading@10 3889 of the Y, U, V, A or G, B, R components, depending on input format,
yading@10 3890 in current frame. Bellow each graph is color component scale meter.
yading@10 3891
yading@10 3892 @item color
yading@10 3893 chroma values in vectorscope, if brighter more such chroma values are
yading@10 3894 distributed in an image.
yading@10 3895 Displays chroma values (U/V color placement) in two dimensional graph
yading@10 3896 (which is called a vectorscope). It can be used to read of the hue and
yading@10 3897 saturation of the current frame. At a same time it is a histogram.
yading@10 3898 The whiter a pixel in the vectorscope, the more pixels of the input frame
yading@10 3899 correspond to that pixel (that is the more pixels have this chroma value).
yading@10 3900 The V component is displayed on the horizontal (X) axis, with the leftmost
yading@10 3901 side being V = 0 and the rightmost side being V = 255.
yading@10 3902 The U component is displayed on the vertical (Y) axis, with the top
yading@10 3903 representing U = 0 and the bottom representing U = 255.
yading@10 3904
yading@10 3905 The position of a white pixel in the graph corresponds to the chroma value
yading@10 3906 of a pixel of the input clip. So the graph can be used to read of the
yading@10 3907 hue (color flavor) and the saturation (the dominance of the hue in the color).
yading@10 3908 As the hue of a color changes, it moves around the square. At the center of
yading@10 3909 the square, the saturation is zero, which means that the corresponding pixel
yading@10 3910 has no color. If you increase the amount of a specific color, while leaving
yading@10 3911 the other colors unchanged, the saturation increases, and you move towards
yading@10 3912 the edge of the square.
yading@10 3913
yading@10 3914 @item color2
yading@10 3915 chroma values in vectorscope, similar as @code{color} but actual chroma values
yading@10 3916 are displayed.
yading@10 3917
yading@10 3918 @item waveform
yading@10 3919 per row/column color component graph. In row mode graph in the left side represents
yading@10 3920 color component value 0 and right side represents value = 255. In column mode top
yading@10 3921 side represents color component value = 0 and bottom side represents value = 255.
yading@10 3922 @end table
yading@10 3923 Default value is @code{levels}.
yading@10 3924
yading@10 3925 @item level_height
yading@10 3926 Set height of level in @code{levels}. Default value is @code{200}.
yading@10 3927 Allowed range is [50, 2048].
yading@10 3928
yading@10 3929 @item scale_height
yading@10 3930 Set height of color scale in @code{levels}. Default value is @code{12}.
yading@10 3931 Allowed range is [0, 40].
yading@10 3932
yading@10 3933 @item step
yading@10 3934 Set step for @code{waveform} mode. Smaller values are useful to find out how much
yading@10 3935 of same luminance values across input rows/columns are distributed.
yading@10 3936 Default value is @code{10}. Allowed range is [1, 255].
yading@10 3937
yading@10 3938 @item waveform_mode
yading@10 3939 Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
yading@10 3940 Default is @code{row}.
yading@10 3941
yading@10 3942 @item display_mode
yading@10 3943 Set display mode for @code{waveform} and @code{levels}.
yading@10 3944 It accepts the following values:
yading@10 3945 @table @samp
yading@10 3946 @item parade
yading@10 3947 Display separate graph for the color components side by side in
yading@10 3948 @code{row} waveform mode or one below other in @code{column} waveform mode
yading@10 3949 for @code{waveform} histogram mode. For @code{levels} histogram mode
yading@10 3950 per color component graphs are placed one bellow other.
yading@10 3951
yading@10 3952 This display mode in @code{waveform} histogram mode makes it easy to spot
yading@10 3953 color casts in the highlights and shadows of an image, by comparing the
yading@10 3954 contours of the top and the bottom of each waveform.
yading@10 3955 Since whites, grays, and blacks are characterized by
yading@10 3956 exactly equal amounts of red, green, and blue, neutral areas of the
yading@10 3957 picture should display three waveforms of roughly equal width/height.
yading@10 3958 If not, the correction is easy to make by making adjustments to level the
yading@10 3959 three waveforms.
yading@10 3960
yading@10 3961 @item overlay
yading@10 3962 Presents information that's identical to that in the @code{parade}, except
yading@10 3963 that the graphs representing color components are superimposed directly
yading@10 3964 over one another.
yading@10 3965
yading@10 3966 This display mode in @code{waveform} histogram mode can make it easier to spot
yading@10 3967 the relative differences or similarities in overlapping areas of the color
yading@10 3968 components that are supposed to be identical, such as neutral whites, grays,
yading@10 3969 or blacks.
yading@10 3970 @end table
yading@10 3971 Default is @code{parade}.
yading@10 3972 @end table
yading@10 3973
yading@10 3974 @subsection Examples
yading@10 3975
yading@10 3976 @itemize
yading@10 3977
yading@10 3978 @item
yading@10 3979 Calculate and draw histogram:
yading@10 3980 @example
yading@10 3981 ffplay -i input -vf histogram
yading@10 3982 @end example
yading@10 3983
yading@10 3984 @end itemize
yading@10 3985
yading@10 3986 @section hqdn3d
yading@10 3987
yading@10 3988 High precision/quality 3d denoise filter. This filter aims to reduce
yading@10 3989 image noise producing smooth images and making still images really
yading@10 3990 still. It should enhance compressibility.
yading@10 3991
yading@10 3992 It accepts the following optional parameters:
yading@10 3993
yading@10 3994 @table @option
yading@10 3995 @item luma_spatial
yading@10 3996 a non-negative float number which specifies spatial luma strength,
yading@10 3997 defaults to 4.0
yading@10 3998
yading@10 3999 @item chroma_spatial
yading@10 4000 a non-negative float number which specifies spatial chroma strength,
yading@10 4001 defaults to 3.0*@var{luma_spatial}/4.0
yading@10 4002
yading@10 4003 @item luma_tmp
yading@10 4004 a float number which specifies luma temporal strength, defaults to
yading@10 4005 6.0*@var{luma_spatial}/4.0
yading@10 4006
yading@10 4007 @item chroma_tmp
yading@10 4008 a float number which specifies chroma temporal strength, defaults to
yading@10 4009 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
yading@10 4010 @end table
yading@10 4011
yading@10 4012 @section hue
yading@10 4013
yading@10 4014 Modify the hue and/or the saturation of the input.
yading@10 4015
yading@10 4016 This filter accepts the following options:
yading@10 4017
yading@10 4018 @table @option
yading@10 4019 @item h
yading@10 4020 Specify the hue angle as a number of degrees. It accepts an expression,
yading@10 4021 and defaults to "0".
yading@10 4022
yading@10 4023 @item s
yading@10 4024 Specify the saturation in the [-10,10] range. It accepts a float number and
yading@10 4025 defaults to "1".
yading@10 4026
yading@10 4027 @item H
yading@10 4028 Specify the hue angle as a number of radians. It accepts a float
yading@10 4029 number or an expression, and defaults to "0".
yading@10 4030 @end table
yading@10 4031
yading@10 4032 @option{h} and @option{H} are mutually exclusive, and can't be
yading@10 4033 specified at the same time.
yading@10 4034
yading@10 4035 The @option{h}, @option{H} and @option{s} option values are
yading@10 4036 expressions containing the following constants:
yading@10 4037
yading@10 4038 @table @option
yading@10 4039 @item n
yading@10 4040 frame count of the input frame starting from 0
yading@10 4041
yading@10 4042 @item pts
yading@10 4043 presentation timestamp of the input frame expressed in time base units
yading@10 4044
yading@10 4045 @item r
yading@10 4046 frame rate of the input video, NAN if the input frame rate is unknown
yading@10 4047
yading@10 4048 @item t
yading@10 4049 timestamp expressed in seconds, NAN if the input timestamp is unknown
yading@10 4050
yading@10 4051 @item tb
yading@10 4052 time base of the input video
yading@10 4053 @end table
yading@10 4054
yading@10 4055 @subsection Examples
yading@10 4056
yading@10 4057 @itemize
yading@10 4058 @item
yading@10 4059 Set the hue to 90 degrees and the saturation to 1.0:
yading@10 4060 @example
yading@10 4061 hue=h=90:s=1
yading@10 4062 @end example
yading@10 4063
yading@10 4064 @item
yading@10 4065 Same command but expressing the hue in radians:
yading@10 4066 @example
yading@10 4067 hue=H=PI/2:s=1
yading@10 4068 @end example
yading@10 4069
yading@10 4070 @item
yading@10 4071 Rotate hue and make the saturation swing between 0
yading@10 4072 and 2 over a period of 1 second:
yading@10 4073 @example
yading@10 4074 hue="H=2*PI*t: s=sin(2*PI*t)+1"
yading@10 4075 @end example
yading@10 4076
yading@10 4077 @item
yading@10 4078 Apply a 3 seconds saturation fade-in effect starting at 0:
yading@10 4079 @example
yading@10 4080 hue="s=min(t/3\,1)"
yading@10 4081 @end example
yading@10 4082
yading@10 4083 The general fade-in expression can be written as:
yading@10 4084 @example
yading@10 4085 hue="s=min(0\, max((t-START)/DURATION\, 1))"
yading@10 4086 @end example
yading@10 4087
yading@10 4088 @item
yading@10 4089 Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
yading@10 4090 @example
yading@10 4091 hue="s=max(0\, min(1\, (8-t)/3))"
yading@10 4092 @end example
yading@10 4093
yading@10 4094 The general fade-out expression can be written as:
yading@10 4095 @example
yading@10 4096 hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
yading@10 4097 @end example
yading@10 4098
yading@10 4099 @end itemize
yading@10 4100
yading@10 4101 @subsection Commands
yading@10 4102
yading@10 4103 This filter supports the following commands:
yading@10 4104 @table @option
yading@10 4105 @item s
yading@10 4106 @item h
yading@10 4107 @item H
yading@10 4108 Modify the hue and/or the saturation of the input video.
yading@10 4109 The command accepts the same syntax of the corresponding option.
yading@10 4110
yading@10 4111 If the specified expression is not valid, it is kept at its current
yading@10 4112 value.
yading@10 4113 @end table
yading@10 4114
yading@10 4115 @section idet
yading@10 4116
yading@10 4117 Detect video interlacing type.
yading@10 4118
yading@10 4119 This filter tries to detect if the input is interlaced or progressive,
yading@10 4120 top or bottom field first.
yading@10 4121
yading@10 4122 The filter accepts the following options:
yading@10 4123
yading@10 4124 @table @option
yading@10 4125 @item intl_thres
yading@10 4126 Set interlacing threshold.
yading@10 4127 @item prog_thres
yading@10 4128 Set progressive threshold.
yading@10 4129 @end table
yading@10 4130
yading@10 4131 @section il
yading@10 4132
yading@10 4133 Deinterleave or interleave fields.
yading@10 4134
yading@10 4135 This filter allows to process interlaced images fields without
yading@10 4136 deinterlacing them. Deinterleaving splits the input frame into 2
yading@10 4137 fields (so called half pictures). Odd lines are moved to the top
yading@10 4138 half of the output image, even lines to the bottom half.
yading@10 4139 You can process (filter) them independently and then re-interleave them.
yading@10 4140
yading@10 4141 The filter accepts the following options:
yading@10 4142
yading@10 4143 @table @option
yading@10 4144 @item luma_mode, l
yading@10 4145 @item chroma_mode, s
yading@10 4146 @item alpha_mode, a
yading@10 4147 Available values for @var{luma_mode}, @var{chroma_mode} and
yading@10 4148 @var{alpha_mode} are:
yading@10 4149
yading@10 4150 @table @samp
yading@10 4151 @item none
yading@10 4152 Do nothing.
yading@10 4153
yading@10 4154 @item deinterleave, d
yading@10 4155 Deinterleave fields, placing one above the other.
yading@10 4156
yading@10 4157 @item interleave, i
yading@10 4158 Interleave fields. Reverse the effect of deinterleaving.
yading@10 4159 @end table
yading@10 4160 Default value is @code{none}.
yading@10 4161
yading@10 4162 @item luma_swap, ls
yading@10 4163 @item chroma_swap, cs
yading@10 4164 @item alpha_swap, as
yading@10 4165 Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
yading@10 4166 @end table
yading@10 4167
yading@10 4168 @section interlace
yading@10 4169
yading@10 4170 Simple interlacing filter from progressive contents. This interleaves upper (or
yading@10 4171 lower) lines from odd frames with lower (or upper) lines from even frames,
yading@10 4172 halving the frame rate and preserving image height.
yading@10 4173
yading@10 4174 @example
yading@10 4175 Original Original New Frame
yading@10 4176 Frame 'j' Frame 'j+1' (tff)
yading@10 4177 ========== =========== ==================
yading@10 4178 Line 0 --------------------> Frame 'j' Line 0
yading@10 4179 Line 1 Line 1 ----> Frame 'j+1' Line 1
yading@10 4180 Line 2 ---------------------> Frame 'j' Line 2
yading@10 4181 Line 3 Line 3 ----> Frame 'j+1' Line 3
yading@10 4182 ... ... ...
yading@10 4183 New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
yading@10 4184 @end example
yading@10 4185
yading@10 4186 It accepts the following optional parameters:
yading@10 4187
yading@10 4188 @table @option
yading@10 4189 @item scan
yading@10 4190 determines whether the interlaced frame is taken from the even (tff - default)
yading@10 4191 or odd (bff) lines of the progressive frame.
yading@10 4192
yading@10 4193 @item lowpass
yading@10 4194 Enable (default) or disable the vertical lowpass filter to avoid twitter
yading@10 4195 interlacing and reduce moire patterns.
yading@10 4196 @end table
yading@10 4197
yading@10 4198 @section kerndeint
yading@10 4199
yading@10 4200 Deinterlace input video by applying Donald Graft's adaptive kernel
yading@10 4201 deinterling. Work on interlaced parts of a video to produce
yading@10 4202 progressive frames.
yading@10 4203
yading@10 4204 The description of the accepted parameters follows.
yading@10 4205
yading@10 4206 @table @option
yading@10 4207 @item thresh
yading@10 4208 Set the threshold which affects the filter's tolerance when
yading@10 4209 determining if a pixel line must be processed. It must be an integer
yading@10 4210 in the range [0,255] and defaults to 10. A value of 0 will result in
yading@10 4211 applying the process on every pixels.
yading@10 4212
yading@10 4213 @item map
yading@10 4214 Paint pixels exceeding the threshold value to white if set to 1.
yading@10 4215 Default is 0.
yading@10 4216
yading@10 4217 @item order
yading@10 4218 Set the fields order. Swap fields if set to 1, leave fields alone if
yading@10 4219 0. Default is 0.
yading@10 4220
yading@10 4221 @item sharp
yading@10 4222 Enable additional sharpening if set to 1. Default is 0.
yading@10 4223
yading@10 4224 @item twoway
yading@10 4225 Enable twoway sharpening if set to 1. Default is 0.
yading@10 4226 @end table
yading@10 4227
yading@10 4228 @subsection Examples
yading@10 4229
yading@10 4230 @itemize
yading@10 4231 @item
yading@10 4232 Apply default values:
yading@10 4233 @example
yading@10 4234 kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
yading@10 4235 @end example
yading@10 4236
yading@10 4237 @item
yading@10 4238 Enable additional sharpening:
yading@10 4239 @example
yading@10 4240 kerndeint=sharp=1
yading@10 4241 @end example
yading@10 4242
yading@10 4243 @item
yading@10 4244 Paint processed pixels in white:
yading@10 4245 @example
yading@10 4246 kerndeint=map=1
yading@10 4247 @end example
yading@10 4248 @end itemize
yading@10 4249
yading@10 4250 @section lut, lutrgb, lutyuv
yading@10 4251
yading@10 4252 Compute a look-up table for binding each pixel component input value
yading@10 4253 to an output value, and apply it to input video.
yading@10 4254
yading@10 4255 @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
yading@10 4256 to an RGB input video.
yading@10 4257
yading@10 4258 These filters accept the following options:
yading@10 4259 @table @option
yading@10 4260 @item c0
yading@10 4261 set first pixel component expression
yading@10 4262 @item c1
yading@10 4263 set second pixel component expression
yading@10 4264 @item c2
yading@10 4265 set third pixel component expression
yading@10 4266 @item c3
yading@10 4267 set fourth pixel component expression, corresponds to the alpha component
yading@10 4268
yading@10 4269 @item r
yading@10 4270 set red component expression
yading@10 4271 @item g
yading@10 4272 set green component expression
yading@10 4273 @item b
yading@10 4274 set blue component expression
yading@10 4275 @item a
yading@10 4276 alpha component expression
yading@10 4277
yading@10 4278 @item y
yading@10 4279 set Y/luminance component expression
yading@10 4280 @item u
yading@10 4281 set U/Cb component expression
yading@10 4282 @item v
yading@10 4283 set V/Cr component expression
yading@10 4284 @end table
yading@10 4285
yading@10 4286 Each of them specifies the expression to use for computing the lookup table for
yading@10 4287 the corresponding pixel component values.
yading@10 4288
yading@10 4289 The exact component associated to each of the @var{c*} options depends on the
yading@10 4290 format in input.
yading@10 4291
yading@10 4292 The @var{lut} filter requires either YUV or RGB pixel formats in input,
yading@10 4293 @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
yading@10 4294
yading@10 4295 The expressions can contain the following constants and functions:
yading@10 4296
yading@10 4297 @table @option
yading@10 4298 @item w, h
yading@10 4299 the input width and height
yading@10 4300
yading@10 4301 @item val
yading@10 4302 input value for the pixel component
yading@10 4303
yading@10 4304 @item clipval
yading@10 4305 the input value clipped in the @var{minval}-@var{maxval} range
yading@10 4306
yading@10 4307 @item maxval
yading@10 4308 maximum value for the pixel component
yading@10 4309
yading@10 4310 @item minval
yading@10 4311 minimum value for the pixel component
yading@10 4312
yading@10 4313 @item negval
yading@10 4314 the negated value for the pixel component value clipped in the
yading@10 4315 @var{minval}-@var{maxval} range , it corresponds to the expression
yading@10 4316 "maxval-clipval+minval"
yading@10 4317
yading@10 4318 @item clip(val)
yading@10 4319 the computed value in @var{val} clipped in the
yading@10 4320 @var{minval}-@var{maxval} range
yading@10 4321
yading@10 4322 @item gammaval(gamma)
yading@10 4323 the computed gamma correction value of the pixel component value
yading@10 4324 clipped in the @var{minval}-@var{maxval} range, corresponds to the
yading@10 4325 expression
yading@10 4326 "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
yading@10 4327
yading@10 4328 @end table
yading@10 4329
yading@10 4330 All expressions default to "val".
yading@10 4331
yading@10 4332 @subsection Examples
yading@10 4333
yading@10 4334 @itemize
yading@10 4335 @item
yading@10 4336 Negate input video:
yading@10 4337 @example
yading@10 4338 lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
yading@10 4339 lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
yading@10 4340 @end example
yading@10 4341
yading@10 4342 The above is the same as:
yading@10 4343 @example
yading@10 4344 lutrgb="r=negval:g=negval:b=negval"
yading@10 4345 lutyuv="y=negval:u=negval:v=negval"
yading@10 4346 @end example
yading@10 4347
yading@10 4348 @item
yading@10 4349 Negate luminance:
yading@10 4350 @example
yading@10 4351 lutyuv=y=negval
yading@10 4352 @end example
yading@10 4353
yading@10 4354 @item
yading@10 4355 Remove chroma components, turns the video into a graytone image:
yading@10 4356 @example
yading@10 4357 lutyuv="u=128:v=128"
yading@10 4358 @end example
yading@10 4359
yading@10 4360 @item
yading@10 4361 Apply a luma burning effect:
yading@10 4362 @example
yading@10 4363 lutyuv="y=2*val"
yading@10 4364 @end example
yading@10 4365
yading@10 4366 @item
yading@10 4367 Remove green and blue components:
yading@10 4368 @example
yading@10 4369 lutrgb="g=0:b=0"
yading@10 4370 @end example
yading@10 4371
yading@10 4372 @item
yading@10 4373 Set a constant alpha channel value on input:
yading@10 4374 @example
yading@10 4375 format=rgba,lutrgb=a="maxval-minval/2"
yading@10 4376 @end example
yading@10 4377
yading@10 4378 @item
yading@10 4379 Correct luminance gamma by a 0.5 factor:
yading@10 4380 @example
yading@10 4381 lutyuv=y=gammaval(0.5)
yading@10 4382 @end example
yading@10 4383
yading@10 4384 @item
yading@10 4385 Discard least significant bits of luma:
yading@10 4386 @example
yading@10 4387 lutyuv=y='bitand(val, 128+64+32)'
yading@10 4388 @end example
yading@10 4389 @end itemize
yading@10 4390
yading@10 4391 @section mp
yading@10 4392
yading@10 4393 Apply an MPlayer filter to the input video.
yading@10 4394
yading@10 4395 This filter provides a wrapper around most of the filters of
yading@10 4396 MPlayer/MEncoder.
yading@10 4397
yading@10 4398 This wrapper is considered experimental. Some of the wrapped filters
yading@10 4399 may not work properly and we may drop support for them, as they will
yading@10 4400 be implemented natively into FFmpeg. Thus you should avoid
yading@10 4401 depending on them when writing portable scripts.
yading@10 4402
yading@10 4403 The filters accepts the parameters:
yading@10 4404 @var{filter_name}[:=]@var{filter_params}
yading@10 4405
yading@10 4406 @var{filter_name} is the name of a supported MPlayer filter,
yading@10 4407 @var{filter_params} is a string containing the parameters accepted by
yading@10 4408 the named filter.
yading@10 4409
yading@10 4410 The list of the currently supported filters follows:
yading@10 4411 @table @var
yading@10 4412 @item dint
yading@10 4413 @item down3dright
yading@10 4414 @item eq2
yading@10 4415 @item eq
yading@10 4416 @item fil
yading@10 4417 @item fspp
yading@10 4418 @item ilpack
yading@10 4419 @item mcdeint
yading@10 4420 @item ow
yading@10 4421 @item perspective
yading@10 4422 @item phase
yading@10 4423 @item pp7
yading@10 4424 @item pullup
yading@10 4425 @item qp
yading@10 4426 @item sab
yading@10 4427 @item softpulldown
yading@10 4428 @item spp
yading@10 4429 @item tinterlace
yading@10 4430 @item uspp
yading@10 4431 @end table
yading@10 4432
yading@10 4433 The parameter syntax and behavior for the listed filters are the same
yading@10 4434 of the corresponding MPlayer filters. For detailed instructions check
yading@10 4435 the "VIDEO FILTERS" section in the MPlayer manual.
yading@10 4436
yading@10 4437 @subsection Examples
yading@10 4438
yading@10 4439 @itemize
yading@10 4440 @item
yading@10 4441 Adjust gamma, brightness, contrast:
yading@10 4442 @example
yading@10 4443 mp=eq2=1.0:2:0.5
yading@10 4444 @end example
yading@10 4445 @end itemize
yading@10 4446
yading@10 4447 See also mplayer(1), @url{http://www.mplayerhq.hu/}.
yading@10 4448
yading@10 4449 @section mpdecimate
yading@10 4450
yading@10 4451 Drop frames that do not differ greatly from the previous frame in
yading@10 4452 order to reduce frame rate.
yading@10 4453
yading@10 4454 The main use of this filter is for very-low-bitrate encoding
yading@10 4455 (e.g. streaming over dialup modem), but it could in theory be used for
yading@10 4456 fixing movies that were inverse-telecined incorrectly.
yading@10 4457
yading@10 4458 A description of the accepted options follows.
yading@10 4459
yading@10 4460 @table @option
yading@10 4461 @item max
yading@10 4462 Set the maximum number of consecutive frames which can be dropped (if
yading@10 4463 positive), or the minimum interval between dropped frames (if
yading@10 4464 negative). If the value is 0, the frame is dropped unregarding the
yading@10 4465 number of previous sequentially dropped frames.
yading@10 4466
yading@10 4467 Default value is 0.
yading@10 4468
yading@10 4469 @item hi
yading@10 4470 @item lo
yading@10 4471 @item frac
yading@10 4472 Set the dropping threshold values.
yading@10 4473
yading@10 4474 Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
yading@10 4475 represent actual pixel value differences, so a threshold of 64
yading@10 4476 corresponds to 1 unit of difference for each pixel, or the same spread
yading@10 4477 out differently over the block.
yading@10 4478
yading@10 4479 A frame is a candidate for dropping if no 8x8 blocks differ by more
yading@10 4480 than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
yading@10 4481 meaning the whole image) differ by more than a threshold of @option{lo}.
yading@10 4482
yading@10 4483 Default value for @option{hi} is 64*12, default value for @option{lo} is
yading@10 4484 64*5, and default value for @option{frac} is 0.33.
yading@10 4485 @end table
yading@10 4486
yading@10 4487
yading@10 4488 @section negate
yading@10 4489
yading@10 4490 Negate input video.
yading@10 4491
yading@10 4492 This filter accepts an integer in input, if non-zero it negates the
yading@10 4493 alpha component (if available). The default value in input is 0.
yading@10 4494
yading@10 4495 @section noformat
yading@10 4496
yading@10 4497 Force libavfilter not to use any of the specified pixel formats for the
yading@10 4498 input to the next filter.
yading@10 4499
yading@10 4500 This filter accepts the following parameters:
yading@10 4501 @table @option
yading@10 4502
yading@10 4503 @item pix_fmts
yading@10 4504 A '|'-separated list of pixel format names, for example
yading@10 4505 "pix_fmts=yuv420p|monow|rgb24".
yading@10 4506
yading@10 4507 @end table
yading@10 4508
yading@10 4509 @subsection Examples
yading@10 4510
yading@10 4511 @itemize
yading@10 4512 @item
yading@10 4513 Force libavfilter to use a format different from @var{yuv420p} for the
yading@10 4514 input to the vflip filter:
yading@10 4515 @example
yading@10 4516 noformat=pix_fmts=yuv420p,vflip
yading@10 4517 @end example
yading@10 4518
yading@10 4519 @item
yading@10 4520 Convert the input video to any of the formats not contained in the list:
yading@10 4521 @example
yading@10 4522 noformat=yuv420p|yuv444p|yuv410p
yading@10 4523 @end example
yading@10 4524 @end itemize
yading@10 4525
yading@10 4526 @section noise
yading@10 4527
yading@10 4528 Add noise on video input frame.
yading@10 4529
yading@10 4530 The filter accepts the following options:
yading@10 4531
yading@10 4532 @table @option
yading@10 4533 @item all_seed
yading@10 4534 @item c0_seed
yading@10 4535 @item c1_seed
yading@10 4536 @item c2_seed
yading@10 4537 @item c3_seed
yading@10 4538 Set noise seed for specific pixel component or all pixel components in case
yading@10 4539 of @var{all_seed}. Default value is @code{123457}.
yading@10 4540
yading@10 4541 @item all_strength, alls
yading@10 4542 @item c0_strength, c0s
yading@10 4543 @item c1_strength, c1s
yading@10 4544 @item c2_strength, c2s
yading@10 4545 @item c3_strength, c3s
yading@10 4546 Set noise strength for specific pixel component or all pixel components in case
yading@10 4547 @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
yading@10 4548
yading@10 4549 @item all_flags, allf
yading@10 4550 @item c0_flags, c0f
yading@10 4551 @item c1_flags, c1f
yading@10 4552 @item c2_flags, c2f
yading@10 4553 @item c3_flags, c3f
yading@10 4554 Set pixel component flags or set flags for all components if @var{all_flags}.
yading@10 4555 Available values for component flags are:
yading@10 4556 @table @samp
yading@10 4557 @item a
yading@10 4558 averaged temporal noise (smoother)
yading@10 4559 @item p
yading@10 4560 mix random noise with a (semi)regular pattern
yading@10 4561 @item q
yading@10 4562 higher quality (slightly better looking, slightly slower)
yading@10 4563 @item t
yading@10 4564 temporal noise (noise pattern changes between frames)
yading@10 4565 @item u
yading@10 4566 uniform noise (gaussian otherwise)
yading@10 4567 @end table
yading@10 4568 @end table
yading@10 4569
yading@10 4570 @subsection Examples
yading@10 4571
yading@10 4572 Add temporal and uniform noise to input video:
yading@10 4573 @example
yading@10 4574 noise=alls=20:allf=t+u
yading@10 4575 @end example
yading@10 4576
yading@10 4577 @section null
yading@10 4578
yading@10 4579 Pass the video source unchanged to the output.
yading@10 4580
yading@10 4581 @section ocv
yading@10 4582
yading@10 4583 Apply video transform using libopencv.
yading@10 4584
yading@10 4585 To enable this filter install libopencv library and headers and
yading@10 4586 configure FFmpeg with @code{--enable-libopencv}.
yading@10 4587
yading@10 4588 This filter accepts the following parameters:
yading@10 4589
yading@10 4590 @table @option
yading@10 4591
yading@10 4592 @item filter_name
yading@10 4593 The name of the libopencv filter to apply.
yading@10 4594
yading@10 4595 @item filter_params
yading@10 4596 The parameters to pass to the libopencv filter. If not specified the default
yading@10 4597 values are assumed.
yading@10 4598
yading@10 4599 @end table
yading@10 4600
yading@10 4601 Refer to the official libopencv documentation for more precise
yading@10 4602 information:
yading@10 4603 @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
yading@10 4604
yading@10 4605 Follows the list of supported libopencv filters.
yading@10 4606
yading@10 4607 @anchor{dilate}
yading@10 4608 @subsection dilate
yading@10 4609
yading@10 4610 Dilate an image by using a specific structuring element.
yading@10 4611 This filter corresponds to the libopencv function @code{cvDilate}.
yading@10 4612
yading@10 4613 It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
yading@10 4614
yading@10 4615 @var{struct_el} represents a structuring element, and has the syntax:
yading@10 4616 @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
yading@10 4617
yading@10 4618 @var{cols} and @var{rows} represent the number of columns and rows of
yading@10 4619 the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
yading@10 4620 point, and @var{shape} the shape for the structuring element, and
yading@10 4621 can be one of the values "rect", "cross", "ellipse", "custom".
yading@10 4622
yading@10 4623 If the value for @var{shape} is "custom", it must be followed by a
yading@10 4624 string of the form "=@var{filename}". The file with name
yading@10 4625 @var{filename} is assumed to represent a binary image, with each
yading@10 4626 printable character corresponding to a bright pixel. When a custom
yading@10 4627 @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
yading@10 4628 or columns and rows of the read file are assumed instead.
yading@10 4629
yading@10 4630 The default value for @var{struct_el} is "3x3+0x0/rect".
yading@10 4631
yading@10 4632 @var{nb_iterations} specifies the number of times the transform is
yading@10 4633 applied to the image, and defaults to 1.
yading@10 4634
yading@10 4635 Follow some example:
yading@10 4636 @example
yading@10 4637 # use the default values
yading@10 4638 ocv=dilate
yading@10 4639
yading@10 4640 # dilate using a structuring element with a 5x5 cross, iterate two times
yading@10 4641 ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
yading@10 4642
yading@10 4643 # read the shape from the file diamond.shape, iterate two times
yading@10 4644 # the file diamond.shape may contain a pattern of characters like this:
yading@10 4645 # *
yading@10 4646 # ***
yading@10 4647 # *****
yading@10 4648 # ***
yading@10 4649 # *
yading@10 4650 # the specified cols and rows are ignored (but not the anchor point coordinates)
yading@10 4651 ocv=dilate:0x0+2x2/custom=diamond.shape|2
yading@10 4652 @end example
yading@10 4653
yading@10 4654 @subsection erode
yading@10 4655
yading@10 4656 Erode an image by using a specific structuring element.
yading@10 4657 This filter corresponds to the libopencv function @code{cvErode}.
yading@10 4658
yading@10 4659 The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
yading@10 4660 with the same syntax and semantics as the @ref{dilate} filter.
yading@10 4661
yading@10 4662 @subsection smooth
yading@10 4663
yading@10 4664 Smooth the input video.
yading@10 4665
yading@10 4666 The filter takes the following parameters:
yading@10 4667 @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
yading@10 4668
yading@10 4669 @var{type} is the type of smooth filter to apply, and can be one of
yading@10 4670 the following values: "blur", "blur_no_scale", "median", "gaussian",
yading@10 4671 "bilateral". The default value is "gaussian".
yading@10 4672
yading@10 4673 @var{param1}, @var{param2}, @var{param3}, and @var{param4} are
yading@10 4674 parameters whose meanings depend on smooth type. @var{param1} and
yading@10 4675 @var{param2} accept integer positive values or 0, @var{param3} and
yading@10 4676 @var{param4} accept float values.
yading@10 4677
yading@10 4678 The default value for @var{param1} is 3, the default value for the
yading@10 4679 other parameters is 0.
yading@10 4680
yading@10 4681 These parameters correspond to the parameters assigned to the
yading@10 4682 libopencv function @code{cvSmooth}.
yading@10 4683
yading@10 4684 @anchor{overlay}
yading@10 4685 @section overlay
yading@10 4686
yading@10 4687 Overlay one video on top of another.
yading@10 4688
yading@10 4689 It takes two inputs and one output, the first input is the "main"
yading@10 4690 video on which the second input is overlayed.
yading@10 4691
yading@10 4692 This filter accepts the following parameters:
yading@10 4693
yading@10 4694 A description of the accepted options follows.
yading@10 4695
yading@10 4696 @table @option
yading@10 4697 @item x
yading@10 4698 @item y
yading@10 4699 Set the expression for the x and y coordinates of the overlayed video
yading@10 4700 on the main video. Default value is "0" for both expressions. In case
yading@10 4701 the expression is invalid, it is set to a huge value (meaning that the
yading@10 4702 overlay will not be displayed within the output visible area).
yading@10 4703
yading@10 4704 @item enable
yading@10 4705 Set the expression which enables the overlay. If the evaluation is
yading@10 4706 different from 0, the overlay is displayed on top of the input
yading@10 4707 frame. By default it is "1".
yading@10 4708
yading@10 4709 @item eval
yading@10 4710 Set when the expressions for @option{x}, @option{y}, and
yading@10 4711 @option{enable} are evaluated.
yading@10 4712
yading@10 4713 It accepts the following values:
yading@10 4714 @table @samp
yading@10 4715 @item init
yading@10 4716 only evaluate expressions once during the filter initialization or
yading@10 4717 when a command is processed
yading@10 4718
yading@10 4719 @item frame
yading@10 4720 evaluate expressions for each incoming frame
yading@10 4721 @end table
yading@10 4722
yading@10 4723 Default value is @samp{frame}.
yading@10 4724
yading@10 4725 @item shortest
yading@10 4726 If set to 1, force the output to terminate when the shortest input
yading@10 4727 terminates. Default value is 0.
yading@10 4728
yading@10 4729 @item format
yading@10 4730 Set the format for the output video.
yading@10 4731
yading@10 4732 It accepts the following values:
yading@10 4733 @table @samp
yading@10 4734 @item yuv420
yading@10 4735 force YUV420 output
yading@10 4736
yading@10 4737 @item yuv444
yading@10 4738 force YUV444 output
yading@10 4739
yading@10 4740 @item rgb
yading@10 4741 force RGB output
yading@10 4742 @end table
yading@10 4743
yading@10 4744 Default value is @samp{yuv420}.
yading@10 4745
yading@10 4746 @item rgb @emph{(deprecated)}
yading@10 4747 If set to 1, force the filter to accept inputs in the RGB
yading@10 4748 color space. Default value is 0. This option is deprecated, use
yading@10 4749 @option{format} instead.
yading@10 4750
yading@10 4751 @item repeatlast
yading@10 4752 If set to 1, force the filter to draw the last overlay frame over the
yading@10 4753 main input until the end of the stream. A value of 0 disables this
yading@10 4754 behavior, which is enabled by default.
yading@10 4755 @end table
yading@10 4756
yading@10 4757 The @option{x}, @option{y}, and @option{enable} expressions can
yading@10 4758 contain the following parameters.
yading@10 4759
yading@10 4760 @table @option
yading@10 4761 @item main_w, W
yading@10 4762 @item main_h, H
yading@10 4763 main input width and height
yading@10 4764
yading@10 4765 @item overlay_w, w
yading@10 4766 @item overlay_h, h
yading@10 4767 overlay input width and height
yading@10 4768
yading@10 4769 @item x
yading@10 4770 @item y
yading@10 4771 the computed values for @var{x} and @var{y}. They are evaluated for
yading@10 4772 each new frame.
yading@10 4773
yading@10 4774 @item hsub
yading@10 4775 @item vsub
yading@10 4776 horizontal and vertical chroma subsample values of the output
yading@10 4777 format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
yading@10 4778 @var{vsub} is 1.
yading@10 4779
yading@10 4780 @item n
yading@10 4781 the number of input frame, starting from 0
yading@10 4782
yading@10 4783 @item pos
yading@10 4784 the position in the file of the input frame, NAN if unknown
yading@10 4785
yading@10 4786 @item t
yading@10 4787 timestamp expressed in seconds, NAN if the input timestamp is unknown
yading@10 4788 @end table
yading@10 4789
yading@10 4790 Note that the @var{n}, @var{pos}, @var{t} variables are available only
yading@10 4791 when evaluation is done @emph{per frame}, and will evaluate to NAN
yading@10 4792 when @option{eval} is set to @samp{init}.
yading@10 4793
yading@10 4794 Be aware that frames are taken from each input video in timestamp
yading@10 4795 order, hence, if their initial timestamps differ, it is a a good idea
yading@10 4796 to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
yading@10 4797 have them begin in the same zero timestamp, as it does the example for
yading@10 4798 the @var{movie} filter.
yading@10 4799
yading@10 4800 You can chain together more overlays but you should test the
yading@10 4801 efficiency of such approach.
yading@10 4802
yading@10 4803 @subsection Commands
yading@10 4804
yading@10 4805 This filter supports the following commands:
yading@10 4806 @table @option
yading@10 4807 @item x
yading@10 4808 @item y
yading@10 4809 @item enable
yading@10 4810 Modify the x/y and enable overlay of the overlay input.
yading@10 4811 The command accepts the same syntax of the corresponding option.
yading@10 4812
yading@10 4813 If the specified expression is not valid, it is kept at its current
yading@10 4814 value.
yading@10 4815 @end table
yading@10 4816
yading@10 4817 @subsection Examples
yading@10 4818
yading@10 4819 @itemize
yading@10 4820 @item
yading@10 4821 Draw the overlay at 10 pixels from the bottom right corner of the main
yading@10 4822 video:
yading@10 4823 @example
yading@10 4824 overlay=main_w-overlay_w-10:main_h-overlay_h-10
yading@10 4825 @end example
yading@10 4826
yading@10 4827 Using named options the example above becomes:
yading@10 4828 @example
yading@10 4829 overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
yading@10 4830 @end example
yading@10 4831
yading@10 4832 @item
yading@10 4833 Insert a transparent PNG logo in the bottom left corner of the input,
yading@10 4834 using the @command{ffmpeg} tool with the @code{-filter_complex} option:
yading@10 4835 @example
yading@10 4836 ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
yading@10 4837 @end example
yading@10 4838
yading@10 4839 @item
yading@10 4840 Insert 2 different transparent PNG logos (second logo on bottom
yading@10 4841 right corner) using the @command{ffmpeg} tool:
yading@10 4842 @example
yading@10 4843 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
yading@10 4844 @end example
yading@10 4845
yading@10 4846 @item
yading@10 4847 Add a transparent color layer on top of the main video, @code{WxH}
yading@10 4848 must specify the size of the main input to the overlay filter:
yading@10 4849 @example
yading@10 4850 color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
yading@10 4851 @end example
yading@10 4852
yading@10 4853 @item
yading@10 4854 Play an original video and a filtered version (here with the deshake
yading@10 4855 filter) side by side using the @command{ffplay} tool:
yading@10 4856 @example
yading@10 4857 ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
yading@10 4858 @end example
yading@10 4859
yading@10 4860 The above command is the same as:
yading@10 4861 @example
yading@10 4862 ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
yading@10 4863 @end example
yading@10 4864
yading@10 4865 @item
yading@10 4866 Make a sliding overlay appearing from the left to the right top part of the
yading@10 4867 screen starting since time 2:
yading@10 4868 @example
yading@10 4869 overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
yading@10 4870 @end example
yading@10 4871
yading@10 4872 @item
yading@10 4873 Compose output by putting two input videos side to side:
yading@10 4874 @example
yading@10 4875 ffmpeg -i left.avi -i right.avi -filter_complex "
yading@10 4876 nullsrc=size=200x100 [background];
yading@10 4877 [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
yading@10 4878 [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
yading@10 4879 [background][left] overlay=shortest=1 [background+left];
yading@10 4880 [background+left][right] overlay=shortest=1:x=100 [left+right]
yading@10 4881 "
yading@10 4882 @end example
yading@10 4883
yading@10 4884 @item
yading@10 4885 Chain several overlays in cascade:
yading@10 4886 @example
yading@10 4887 nullsrc=s=200x200 [bg];
yading@10 4888 testsrc=s=100x100, split=4 [in0][in1][in2][in3];
yading@10 4889 [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
yading@10 4890 [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
yading@10 4891 [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
yading@10 4892 [in3] null, [mid2] overlay=100:100 [out0]
yading@10 4893 @end example
yading@10 4894
yading@10 4895 @end itemize
yading@10 4896
yading@10 4897 @section pad
yading@10 4898
yading@10 4899 Add paddings to the input image, and place the original input at the
yading@10 4900 given coordinates @var{x}, @var{y}.
yading@10 4901
yading@10 4902 This filter accepts the following parameters:
yading@10 4903
yading@10 4904 @table @option
yading@10 4905 @item width, w
yading@10 4906 @item height, h
yading@10 4907 Specify an expression for the size of the output image with the
yading@10 4908 paddings added. If the value for @var{width} or @var{height} is 0, the
yading@10 4909 corresponding input size is used for the output.
yading@10 4910
yading@10 4911 The @var{width} expression can reference the value set by the
yading@10 4912 @var{height} expression, and vice versa.
yading@10 4913
yading@10 4914 The default value of @var{width} and @var{height} is 0.
yading@10 4915
yading@10 4916 @item x
yading@10 4917 @item y
yading@10 4918 Specify an expression for the offsets where to place the input image
yading@10 4919 in the padded area with respect to the top/left border of the output
yading@10 4920 image.
yading@10 4921
yading@10 4922 The @var{x} expression can reference the value set by the @var{y}
yading@10 4923 expression, and vice versa.
yading@10 4924
yading@10 4925 The default value of @var{x} and @var{y} is 0.
yading@10 4926
yading@10 4927 @item color
yading@10 4928 Specify the color of the padded area, it can be the name of a color
yading@10 4929 (case insensitive match) or a 0xRRGGBB[AA] sequence.
yading@10 4930
yading@10 4931 The default value of @var{color} is "black".
yading@10 4932 @end table
yading@10 4933
yading@10 4934 The value for the @var{width}, @var{height}, @var{x}, and @var{y}
yading@10 4935 options are expressions containing the following constants:
yading@10 4936
yading@10 4937 @table @option
yading@10 4938 @item in_w, in_h
yading@10 4939 the input video width and height
yading@10 4940
yading@10 4941 @item iw, ih
yading@10 4942 same as @var{in_w} and @var{in_h}
yading@10 4943
yading@10 4944 @item out_w, out_h
yading@10 4945 the output width and height, that is the size of the padded area as
yading@10 4946 specified by the @var{width} and @var{height} expressions
yading@10 4947
yading@10 4948 @item ow, oh
yading@10 4949 same as @var{out_w} and @var{out_h}
yading@10 4950
yading@10 4951 @item x, y
yading@10 4952 x and y offsets as specified by the @var{x} and @var{y}
yading@10 4953 expressions, or NAN if not yet specified
yading@10 4954
yading@10 4955 @item a
yading@10 4956 same as @var{iw} / @var{ih}
yading@10 4957
yading@10 4958 @item sar
yading@10 4959 input sample aspect ratio
yading@10 4960
yading@10 4961 @item dar
yading@10 4962 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
yading@10 4963
yading@10 4964 @item hsub, vsub
yading@10 4965 horizontal and vertical chroma subsample values. For example for the
yading@10 4966 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
yading@10 4967 @end table
yading@10 4968
yading@10 4969 @subsection Examples
yading@10 4970
yading@10 4971 @itemize
yading@10 4972 @item
yading@10 4973 Add paddings with color "violet" to the input video. Output video
yading@10 4974 size is 640x480, the top-left corner of the input video is placed at
yading@10 4975 column 0, row 40:
yading@10 4976 @example
yading@10 4977 pad=640:480:0:40:violet
yading@10 4978 @end example
yading@10 4979
yading@10 4980 The example above is equivalent to the following command:
yading@10 4981 @example
yading@10 4982 pad=width=640:height=480:x=0:y=40:color=violet
yading@10 4983 @end example
yading@10 4984
yading@10 4985 @item
yading@10 4986 Pad the input to get an output with dimensions increased by 3/2,
yading@10 4987 and put the input video at the center of the padded area:
yading@10 4988 @example
yading@10 4989 pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
yading@10 4990 @end example
yading@10 4991
yading@10 4992 @item
yading@10 4993 Pad the input to get a squared output with size equal to the maximum
yading@10 4994 value between the input width and height, and put the input video at
yading@10 4995 the center of the padded area:
yading@10 4996 @example
yading@10 4997 pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
yading@10 4998 @end example
yading@10 4999
yading@10 5000 @item
yading@10 5001 Pad the input to get a final w/h ratio of 16:9:
yading@10 5002 @example
yading@10 5003 pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
yading@10 5004 @end example
yading@10 5005
yading@10 5006 @item
yading@10 5007 In case of anamorphic video, in order to set the output display aspect
yading@10 5008 correctly, it is necessary to use @var{sar} in the expression,
yading@10 5009 according to the relation:
yading@10 5010 @example
yading@10 5011 (ih * X / ih) * sar = output_dar
yading@10 5012 X = output_dar / sar
yading@10 5013 @end example
yading@10 5014
yading@10 5015 Thus the previous example needs to be modified to:
yading@10 5016 @example
yading@10 5017 pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
yading@10 5018 @end example
yading@10 5019
yading@10 5020 @item
yading@10 5021 Double output size and put the input video in the bottom-right
yading@10 5022 corner of the output padded area:
yading@10 5023 @example
yading@10 5024 pad="2*iw:2*ih:ow-iw:oh-ih"
yading@10 5025 @end example
yading@10 5026 @end itemize
yading@10 5027
yading@10 5028 @section pixdesctest
yading@10 5029
yading@10 5030 Pixel format descriptor test filter, mainly useful for internal
yading@10 5031 testing. The output video should be equal to the input video.
yading@10 5032
yading@10 5033 For example:
yading@10 5034 @example
yading@10 5035 format=monow, pixdesctest
yading@10 5036 @end example
yading@10 5037
yading@10 5038 can be used to test the monowhite pixel format descriptor definition.
yading@10 5039
yading@10 5040 @section pp
yading@10 5041
yading@10 5042 Enable the specified chain of postprocessing subfilters using libpostproc. This
yading@10 5043 library should be automatically selected with a GPL build (@code{--enable-gpl}).
yading@10 5044 Subfilters must be separated by '/' and can be disabled by prepending a '-'.
yading@10 5045 Each subfilter and some options have a short and a long name that can be used
yading@10 5046 interchangeably, i.e. dr/dering are the same.
yading@10 5047
yading@10 5048 The filters accept the following options:
yading@10 5049
yading@10 5050 @table @option
yading@10 5051 @item subfilters
yading@10 5052 Set postprocessing subfilters string.
yading@10 5053 @end table
yading@10 5054
yading@10 5055 All subfilters share common options to determine their scope:
yading@10 5056
yading@10 5057 @table @option
yading@10 5058 @item a/autoq
yading@10 5059 Honor the quality commands for this subfilter.
yading@10 5060
yading@10 5061 @item c/chrom
yading@10 5062 Do chrominance filtering, too (default).
yading@10 5063
yading@10 5064 @item y/nochrom
yading@10 5065 Do luminance filtering only (no chrominance).
yading@10 5066
yading@10 5067 @item n/noluma
yading@10 5068 Do chrominance filtering only (no luminance).
yading@10 5069 @end table
yading@10 5070
yading@10 5071 These options can be appended after the subfilter name, separated by a '|'.
yading@10 5072
yading@10 5073 Available subfilters are:
yading@10 5074
yading@10 5075 @table @option
yading@10 5076 @item hb/hdeblock[|difference[|flatness]]
yading@10 5077 Horizontal deblocking filter
yading@10 5078 @table @option
yading@10 5079 @item difference
yading@10 5080 Difference factor where higher values mean more deblocking (default: @code{32}).
yading@10 5081 @item flatness
yading@10 5082 Flatness threshold where lower values mean more deblocking (default: @code{39}).
yading@10 5083 @end table
yading@10 5084
yading@10 5085 @item vb/vdeblock[|difference[|flatness]]
yading@10 5086 Vertical deblocking filter
yading@10 5087 @table @option
yading@10 5088 @item difference
yading@10 5089 Difference factor where higher values mean more deblocking (default: @code{32}).
yading@10 5090 @item flatness
yading@10 5091 Flatness threshold where lower values mean more deblocking (default: @code{39}).
yading@10 5092 @end table
yading@10 5093
yading@10 5094 @item ha/hadeblock[|difference[|flatness]]
yading@10 5095 Accurate horizontal deblocking filter
yading@10 5096 @table @option
yading@10 5097 @item difference
yading@10 5098 Difference factor where higher values mean more deblocking (default: @code{32}).
yading@10 5099 @item flatness
yading@10 5100 Flatness threshold where lower values mean more deblocking (default: @code{39}).
yading@10 5101 @end table
yading@10 5102
yading@10 5103 @item va/vadeblock[|difference[|flatness]]
yading@10 5104 Accurate vertical deblocking filter
yading@10 5105 @table @option
yading@10 5106 @item difference
yading@10 5107 Difference factor where higher values mean more deblocking (default: @code{32}).
yading@10 5108 @item flatness
yading@10 5109 Flatness threshold where lower values mean more deblocking (default: @code{39}).
yading@10 5110 @end table
yading@10 5111 @end table
yading@10 5112
yading@10 5113 The horizontal and vertical deblocking filters share the difference and
yading@10 5114 flatness values so you cannot set different horizontal and vertical
yading@10 5115 thresholds.
yading@10 5116
yading@10 5117 @table @option
yading@10 5118 @item h1/x1hdeblock
yading@10 5119 Experimental horizontal deblocking filter
yading@10 5120
yading@10 5121 @item v1/x1vdeblock
yading@10 5122 Experimental vertical deblocking filter
yading@10 5123
yading@10 5124 @item dr/dering
yading@10 5125 Deringing filter
yading@10 5126
yading@10 5127 @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
yading@10 5128 @table @option
yading@10 5129 @item threshold1
yading@10 5130 larger -> stronger filtering
yading@10 5131 @item threshold2
yading@10 5132 larger -> stronger filtering
yading@10 5133 @item threshold3
yading@10 5134 larger -> stronger filtering
yading@10 5135 @end table
yading@10 5136
yading@10 5137 @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
yading@10 5138 @table @option
yading@10 5139 @item f/fullyrange
yading@10 5140 Stretch luminance to @code{0-255}.
yading@10 5141 @end table
yading@10 5142
yading@10 5143 @item lb/linblenddeint
yading@10 5144 Linear blend deinterlacing filter that deinterlaces the given block by
yading@10 5145 filtering all lines with a @code{(1 2 1)} filter.
yading@10 5146
yading@10 5147 @item li/linipoldeint
yading@10 5148 Linear interpolating deinterlacing filter that deinterlaces the given block by
yading@10 5149 linearly interpolating every second line.
yading@10 5150
yading@10 5151 @item ci/cubicipoldeint
yading@10 5152 Cubic interpolating deinterlacing filter deinterlaces the given block by
yading@10 5153 cubically interpolating every second line.
yading@10 5154
yading@10 5155 @item md/mediandeint
yading@10 5156 Median deinterlacing filter that deinterlaces the given block by applying a
yading@10 5157 median filter to every second line.
yading@10 5158
yading@10 5159 @item fd/ffmpegdeint
yading@10 5160 FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
yading@10 5161 second line with a @code{(-1 4 2 4 -1)} filter.
yading@10 5162
yading@10 5163 @item l5/lowpass5
yading@10 5164 Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
yading@10 5165 block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
yading@10 5166
yading@10 5167 @item fq/forceQuant[|quantizer]
yading@10 5168 Overrides the quantizer table from the input with the constant quantizer you
yading@10 5169 specify.
yading@10 5170 @table @option
yading@10 5171 @item quantizer
yading@10 5172 Quantizer to use
yading@10 5173 @end table
yading@10 5174
yading@10 5175 @item de/default
yading@10 5176 Default pp filter combination (@code{hb|a,vb|a,dr|a})
yading@10 5177
yading@10 5178 @item fa/fast
yading@10 5179 Fast pp filter combination (@code{h1|a,v1|a,dr|a})
yading@10 5180
yading@10 5181 @item ac
yading@10 5182 High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
yading@10 5183 @end table
yading@10 5184
yading@10 5185 @subsection Examples
yading@10 5186
yading@10 5187 @itemize
yading@10 5188 @item
yading@10 5189 Apply horizontal and vertical deblocking, deringing and automatic
yading@10 5190 brightness/contrast:
yading@10 5191 @example
yading@10 5192 pp=hb/vb/dr/al
yading@10 5193 @end example
yading@10 5194
yading@10 5195 @item
yading@10 5196 Apply default filters without brightness/contrast correction:
yading@10 5197 @example
yading@10 5198 pp=de/-al
yading@10 5199 @end example
yading@10 5200
yading@10 5201 @item
yading@10 5202 Apply default filters and temporal denoiser:
yading@10 5203 @example
yading@10 5204 pp=default/tmpnoise|1|2|3
yading@10 5205 @end example
yading@10 5206
yading@10 5207 @item
yading@10 5208 Apply deblocking on luminance only, and switch vertical deblocking on or off
yading@10 5209 automatically depending on available CPU time:
yading@10 5210 @example
yading@10 5211 pp=hb|y/vb|a
yading@10 5212 @end example
yading@10 5213 @end itemize
yading@10 5214
yading@10 5215 @section removelogo
yading@10 5216
yading@10 5217 Suppress a TV station logo, using an image file to determine which
yading@10 5218 pixels comprise the logo. It works by filling in the pixels that
yading@10 5219 comprise the logo with neighboring pixels.
yading@10 5220
yading@10 5221 The filters accept the following options:
yading@10 5222
yading@10 5223 @table @option
yading@10 5224 @item filename, f
yading@10 5225 Set the filter bitmap file, which can be any image format supported by
yading@10 5226 libavformat. The width and height of the image file must match those of the
yading@10 5227 video stream being processed.
yading@10 5228 @end table
yading@10 5229
yading@10 5230 Pixels in the provided bitmap image with a value of zero are not
yading@10 5231 considered part of the logo, non-zero pixels are considered part of
yading@10 5232 the logo. If you use white (255) for the logo and black (0) for the
yading@10 5233 rest, you will be safe. For making the filter bitmap, it is
yading@10 5234 recommended to take a screen capture of a black frame with the logo
yading@10 5235 visible, and then using a threshold filter followed by the erode
yading@10 5236 filter once or twice.
yading@10 5237
yading@10 5238 If needed, little splotches can be fixed manually. Remember that if
yading@10 5239 logo pixels are not covered, the filter quality will be much
yading@10 5240 reduced. Marking too many pixels as part of the logo does not hurt as
yading@10 5241 much, but it will increase the amount of blurring needed to cover over
yading@10 5242 the image and will destroy more information than necessary, and extra
yading@10 5243 pixels will slow things down on a large logo.
yading@10 5244
yading@10 5245 @section scale
yading@10 5246
yading@10 5247 Scale (resize) the input video, using the libswscale library.
yading@10 5248
yading@10 5249 The scale filter forces the output display aspect ratio to be the same
yading@10 5250 of the input, by changing the output sample aspect ratio.
yading@10 5251
yading@10 5252 The filter accepts the following options:
yading@10 5253
yading@10 5254 @table @option
yading@10 5255 @item width, w
yading@10 5256 Output video width.
yading@10 5257 default value is @code{iw}. See below
yading@10 5258 for the list of accepted constants.
yading@10 5259
yading@10 5260 @item height, h
yading@10 5261 Output video height.
yading@10 5262 default value is @code{ih}.
yading@10 5263 See below for the list of accepted constants.
yading@10 5264
yading@10 5265 @item interl
yading@10 5266 Set the interlacing. It accepts the following values:
yading@10 5267
yading@10 5268 @table @option
yading@10 5269 @item 1
yading@10 5270 force interlaced aware scaling
yading@10 5271
yading@10 5272 @item 0
yading@10 5273 do not apply interlaced scaling
yading@10 5274
yading@10 5275 @item -1
yading@10 5276 select interlaced aware scaling depending on whether the source frames
yading@10 5277 are flagged as interlaced or not
yading@10 5278 @end table
yading@10 5279
yading@10 5280 Default value is @code{0}.
yading@10 5281
yading@10 5282 @item flags
yading@10 5283 Set libswscale scaling flags. If not explictly specified the filter
yading@10 5284 applies a bilinear scaling algorithm.
yading@10 5285
yading@10 5286 @item size, s
yading@10 5287 Set the video size, the value must be a valid abbreviation or in the
yading@10 5288 form @var{width}x@var{height}.
yading@10 5289 @end table
yading@10 5290
yading@10 5291 The values of the @var{w} and @var{h} options are expressions
yading@10 5292 containing the following constants:
yading@10 5293
yading@10 5294 @table @option
yading@10 5295 @item in_w, in_h
yading@10 5296 the input width and height
yading@10 5297
yading@10 5298 @item iw, ih
yading@10 5299 same as @var{in_w} and @var{in_h}
yading@10 5300
yading@10 5301 @item out_w, out_h
yading@10 5302 the output (cropped) width and height
yading@10 5303
yading@10 5304 @item ow, oh
yading@10 5305 same as @var{out_w} and @var{out_h}
yading@10 5306
yading@10 5307 @item a
yading@10 5308 same as @var{iw} / @var{ih}
yading@10 5309
yading@10 5310 @item sar
yading@10 5311 input sample aspect ratio
yading@10 5312
yading@10 5313 @item dar
yading@10 5314 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
yading@10 5315
yading@10 5316 @item hsub, vsub
yading@10 5317 horizontal and vertical chroma subsample values. For example for the
yading@10 5318 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
yading@10 5319 @end table
yading@10 5320
yading@10 5321 If the input image format is different from the format requested by
yading@10 5322 the next filter, the scale filter will convert the input to the
yading@10 5323 requested format.
yading@10 5324
yading@10 5325 If the value for @var{w} or @var{h} is 0, the respective input
yading@10 5326 size is used for the output.
yading@10 5327
yading@10 5328 If the value for @var{w} or @var{h} is -1, the scale filter will use, for the
yading@10 5329 respective output size, a value that maintains the aspect ratio of the input
yading@10 5330 image.
yading@10 5331
yading@10 5332 @subsection Examples
yading@10 5333
yading@10 5334 @itemize
yading@10 5335 @item
yading@10 5336 Scale the input video to a size of 200x100:
yading@10 5337 @example
yading@10 5338 scale=w=200:h=100
yading@10 5339 @end example
yading@10 5340
yading@10 5341 This is equivalent to:
yading@10 5342 @example
yading@10 5343 scale=w=200:h=100
yading@10 5344 @end example
yading@10 5345
yading@10 5346 or:
yading@10 5347 @example
yading@10 5348 scale=200x100
yading@10 5349 @end example
yading@10 5350
yading@10 5351 @item
yading@10 5352 Specify a size abbreviation for the output size:
yading@10 5353 @example
yading@10 5354 scale=qcif
yading@10 5355 @end example
yading@10 5356
yading@10 5357 which can also be written as:
yading@10 5358 @example
yading@10 5359 scale=size=qcif
yading@10 5360 @end example
yading@10 5361
yading@10 5362 @item
yading@10 5363 Scale the input to 2x:
yading@10 5364 @example
yading@10 5365 scale=w=2*iw:h=2*ih
yading@10 5366 @end example
yading@10 5367
yading@10 5368 @item
yading@10 5369 The above is the same as:
yading@10 5370 @example
yading@10 5371 scale=2*in_w:2*in_h
yading@10 5372 @end example
yading@10 5373
yading@10 5374 @item
yading@10 5375 Scale the input to 2x with forced interlaced scaling:
yading@10 5376 @example
yading@10 5377 scale=2*iw:2*ih:interl=1
yading@10 5378 @end example
yading@10 5379
yading@10 5380 @item
yading@10 5381 Scale the input to half size:
yading@10 5382 @example
yading@10 5383 scale=w=iw/2:h=ih/2
yading@10 5384 @end example
yading@10 5385
yading@10 5386 @item
yading@10 5387 Increase the width, and set the height to the same size:
yading@10 5388 @example
yading@10 5389 scale=3/2*iw:ow
yading@10 5390 @end example
yading@10 5391
yading@10 5392 @item
yading@10 5393 Seek for Greek harmony:
yading@10 5394 @example
yading@10 5395 scale=iw:1/PHI*iw
yading@10 5396 scale=ih*PHI:ih
yading@10 5397 @end example
yading@10 5398
yading@10 5399 @item
yading@10 5400 Increase the height, and set the width to 3/2 of the height:
yading@10 5401 @example
yading@10 5402 scale=w=3/2*oh:h=3/5*ih
yading@10 5403 @end example
yading@10 5404
yading@10 5405 @item
yading@10 5406 Increase the size, but make the size a multiple of the chroma
yading@10 5407 subsample values:
yading@10 5408 @example
yading@10 5409 scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
yading@10 5410 @end example
yading@10 5411
yading@10 5412 @item
yading@10 5413 Increase the width to a maximum of 500 pixels, keep the same input
yading@10 5414 aspect ratio:
yading@10 5415 @example
yading@10 5416 scale=w='min(500\, iw*3/2):h=-1'
yading@10 5417 @end example
yading@10 5418 @end itemize
yading@10 5419
yading@10 5420 @section separatefields
yading@10 5421
yading@10 5422 The @code{separatefields} takes a frame-based video input and splits
yading@10 5423 each frame into its components fields, producing a new half height clip
yading@10 5424 with twice the frame rate and twice the frame count.
yading@10 5425
yading@10 5426 This filter use field-dominance information in frame to decide which
yading@10 5427 of each pair of fields to place first in the output.
yading@10 5428 If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
yading@10 5429
yading@10 5430 @section setdar, setsar
yading@10 5431
yading@10 5432 The @code{setdar} filter sets the Display Aspect Ratio for the filter
yading@10 5433 output video.
yading@10 5434
yading@10 5435 This is done by changing the specified Sample (aka Pixel) Aspect
yading@10 5436 Ratio, according to the following equation:
yading@10 5437 @example
yading@10 5438 @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
yading@10 5439 @end example
yading@10 5440
yading@10 5441 Keep in mind that the @code{setdar} filter does not modify the pixel
yading@10 5442 dimensions of the video frame. Also the display aspect ratio set by
yading@10 5443 this filter may be changed by later filters in the filterchain,
yading@10 5444 e.g. in case of scaling or if another "setdar" or a "setsar" filter is
yading@10 5445 applied.
yading@10 5446
yading@10 5447 The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
yading@10 5448 the filter output video.
yading@10 5449
yading@10 5450 Note that as a consequence of the application of this filter, the
yading@10 5451 output display aspect ratio will change according to the equation
yading@10 5452 above.
yading@10 5453
yading@10 5454 Keep in mind that the sample aspect ratio set by the @code{setsar}
yading@10 5455 filter may be changed by later filters in the filterchain, e.g. if
yading@10 5456 another "setsar" or a "setdar" filter is applied.
yading@10 5457
yading@10 5458 The filters accept the following options:
yading@10 5459
yading@10 5460 @table @option
yading@10 5461 @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
yading@10 5462 Set the aspect ratio used by the filter.
yading@10 5463
yading@10 5464 The parameter can be a floating point number string, an expression, or
yading@10 5465 a string of the form @var{num}:@var{den}, where @var{num} and
yading@10 5466 @var{den} are the numerator and denominator of the aspect ratio. If
yading@10 5467 the parameter is not specified, it is assumed the value "0".
yading@10 5468 In case the form "@var{num}:@var{den}" is used, the @code{:} character
yading@10 5469 should be escaped.
yading@10 5470
yading@10 5471 @item max
yading@10 5472 Set the maximum integer value to use for expressing numerator and
yading@10 5473 denominator when reducing the expressed aspect ratio to a rational.
yading@10 5474 Default value is @code{100}.
yading@10 5475
yading@10 5476 @end table
yading@10 5477
yading@10 5478 @subsection Examples
yading@10 5479
yading@10 5480 @itemize
yading@10 5481
yading@10 5482 @item
yading@10 5483 To change the display aspect ratio to 16:9, specify one of the following:
yading@10 5484 @example
yading@10 5485 setdar=dar=1.77777
yading@10 5486 setdar=dar=16/9
yading@10 5487 setdar=dar=1.77777
yading@10 5488 @end example
yading@10 5489
yading@10 5490 @item
yading@10 5491 To change the sample aspect ratio to 10:11, specify:
yading@10 5492 @example
yading@10 5493 setsar=sar=10/11
yading@10 5494 @end example
yading@10 5495
yading@10 5496 @item
yading@10 5497 To set a display aspect ratio of 16:9, and specify a maximum integer value of
yading@10 5498 1000 in the aspect ratio reduction, use the command:
yading@10 5499 @example
yading@10 5500 setdar=ratio=16/9:max=1000
yading@10 5501 @end example
yading@10 5502
yading@10 5503 @end itemize
yading@10 5504
yading@10 5505 @anchor{setfield}
yading@10 5506 @section setfield
yading@10 5507
yading@10 5508 Force field for the output video frame.
yading@10 5509
yading@10 5510 The @code{setfield} filter marks the interlace type field for the
yading@10 5511 output frames. It does not change the input frame, but only sets the
yading@10 5512 corresponding property, which affects how the frame is treated by
yading@10 5513 following filters (e.g. @code{fieldorder} or @code{yadif}).
yading@10 5514
yading@10 5515 The filter accepts the following options:
yading@10 5516
yading@10 5517 @table @option
yading@10 5518
yading@10 5519 @item mode
yading@10 5520 Available values are:
yading@10 5521
yading@10 5522 @table @samp
yading@10 5523 @item auto
yading@10 5524 Keep the same field property.
yading@10 5525
yading@10 5526 @item bff
yading@10 5527 Mark the frame as bottom-field-first.
yading@10 5528
yading@10 5529 @item tff
yading@10 5530 Mark the frame as top-field-first.
yading@10 5531
yading@10 5532 @item prog
yading@10 5533 Mark the frame as progressive.
yading@10 5534 @end table
yading@10 5535 @end table
yading@10 5536
yading@10 5537 @section showinfo
yading@10 5538
yading@10 5539 Show a line containing various information for each input video frame.
yading@10 5540 The input video is not modified.
yading@10 5541
yading@10 5542 The shown line contains a sequence of key/value pairs of the form
yading@10 5543 @var{key}:@var{value}.
yading@10 5544
yading@10 5545 A description of each shown parameter follows:
yading@10 5546
yading@10 5547 @table @option
yading@10 5548 @item n
yading@10 5549 sequential number of the input frame, starting from 0
yading@10 5550
yading@10 5551 @item pts
yading@10 5552 Presentation TimeStamp of the input frame, expressed as a number of
yading@10 5553 time base units. The time base unit depends on the filter input pad.
yading@10 5554
yading@10 5555 @item pts_time
yading@10 5556 Presentation TimeStamp of the input frame, expressed as a number of
yading@10 5557 seconds
yading@10 5558
yading@10 5559 @item pos
yading@10 5560 position of the frame in the input stream, -1 if this information in
yading@10 5561 unavailable and/or meaningless (for example in case of synthetic video)
yading@10 5562
yading@10 5563 @item fmt
yading@10 5564 pixel format name
yading@10 5565
yading@10 5566 @item sar
yading@10 5567 sample aspect ratio of the input frame, expressed in the form
yading@10 5568 @var{num}/@var{den}
yading@10 5569
yading@10 5570 @item s
yading@10 5571 size of the input frame, expressed in the form
yading@10 5572 @var{width}x@var{height}
yading@10 5573
yading@10 5574 @item i
yading@10 5575 interlaced mode ("P" for "progressive", "T" for top field first, "B"
yading@10 5576 for bottom field first)
yading@10 5577
yading@10 5578 @item iskey
yading@10 5579 1 if the frame is a key frame, 0 otherwise
yading@10 5580
yading@10 5581 @item type
yading@10 5582 picture type of the input frame ("I" for an I-frame, "P" for a
yading@10 5583 P-frame, "B" for a B-frame, "?" for unknown type).
yading@10 5584 Check also the documentation of the @code{AVPictureType} enum and of
yading@10 5585 the @code{av_get_picture_type_char} function defined in
yading@10 5586 @file{libavutil/avutil.h}.
yading@10 5587
yading@10 5588 @item checksum
yading@10 5589 Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
yading@10 5590
yading@10 5591 @item plane_checksum
yading@10 5592 Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
yading@10 5593 expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]"
yading@10 5594 @end table
yading@10 5595
yading@10 5596 @section smartblur
yading@10 5597
yading@10 5598 Blur the input video without impacting the outlines.
yading@10 5599
yading@10 5600 The filter accepts the following options:
yading@10 5601
yading@10 5602 @table @option
yading@10 5603 @item luma_radius, lr
yading@10 5604 Set the luma radius. The option value must be a float number in
yading@10 5605 the range [0.1,5.0] that specifies the variance of the gaussian filter
yading@10 5606 used to blur the image (slower if larger). Default value is 1.0.
yading@10 5607
yading@10 5608 @item luma_strength, ls
yading@10 5609 Set the luma strength. The option value must be a float number
yading@10 5610 in the range [-1.0,1.0] that configures the blurring. A value included
yading@10 5611 in [0.0,1.0] will blur the image whereas a value included in
yading@10 5612 [-1.0,0.0] will sharpen the image. Default value is 1.0.
yading@10 5613
yading@10 5614 @item luma_threshold, lt
yading@10 5615 Set the luma threshold used as a coefficient to determine
yading@10 5616 whether a pixel should be blurred or not. The option value must be an
yading@10 5617 integer in the range [-30,30]. A value of 0 will filter all the image,
yading@10 5618 a value included in [0,30] will filter flat areas and a value included
yading@10 5619 in [-30,0] will filter edges. Default value is 0.
yading@10 5620
yading@10 5621 @item chroma_radius, cr
yading@10 5622 Set the chroma radius. The option value must be a float number in
yading@10 5623 the range [0.1,5.0] that specifies the variance of the gaussian filter
yading@10 5624 used to blur the image (slower if larger). Default value is 1.0.
yading@10 5625
yading@10 5626 @item chroma_strength, cs
yading@10 5627 Set the chroma strength. The option value must be a float number
yading@10 5628 in the range [-1.0,1.0] that configures the blurring. A value included
yading@10 5629 in [0.0,1.0] will blur the image whereas a value included in
yading@10 5630 [-1.0,0.0] will sharpen the image. Default value is 1.0.
yading@10 5631
yading@10 5632 @item chroma_threshold, ct
yading@10 5633 Set the chroma threshold used as a coefficient to determine
yading@10 5634 whether a pixel should be blurred or not. The option value must be an
yading@10 5635 integer in the range [-30,30]. A value of 0 will filter all the image,
yading@10 5636 a value included in [0,30] will filter flat areas and a value included
yading@10 5637 in [-30,0] will filter edges. Default value is 0.
yading@10 5638 @end table
yading@10 5639
yading@10 5640 If a chroma option is not explicitly set, the corresponding luma value
yading@10 5641 is set.
yading@10 5642
yading@10 5643 @section stereo3d
yading@10 5644
yading@10 5645 Convert between different stereoscopic image formats.
yading@10 5646
yading@10 5647 The filters accept the following options:
yading@10 5648
yading@10 5649 @table @option
yading@10 5650 @item in
yading@10 5651 Set stereoscopic image format of input.
yading@10 5652
yading@10 5653 Available values for input image formats are:
yading@10 5654 @table @samp
yading@10 5655 @item sbsl
yading@10 5656 side by side parallel (left eye left, right eye right)
yading@10 5657
yading@10 5658 @item sbsr
yading@10 5659 side by side crosseye (right eye left, left eye right)
yading@10 5660
yading@10 5661 @item sbs2l
yading@10 5662 side by side parallel with half width resolution
yading@10 5663 (left eye left, right eye right)
yading@10 5664
yading@10 5665 @item sbs2r
yading@10 5666 side by side crosseye with half width resolution
yading@10 5667 (right eye left, left eye right)
yading@10 5668
yading@10 5669 @item abl
yading@10 5670 above-below (left eye above, right eye below)
yading@10 5671
yading@10 5672 @item abr
yading@10 5673 above-below (right eye above, left eye below)
yading@10 5674
yading@10 5675 @item ab2l
yading@10 5676 above-below with half height resolution
yading@10 5677 (left eye above, right eye below)
yading@10 5678
yading@10 5679 @item ab2r
yading@10 5680 above-below with half height resolution
yading@10 5681 (right eye above, left eye below)
yading@10 5682
yading@10 5683 Default value is @samp{sbsl}.
yading@10 5684 @end table
yading@10 5685
yading@10 5686 @item out
yading@10 5687 Set stereoscopic image format of output.
yading@10 5688
yading@10 5689 Available values for output image formats are all the input formats as well as:
yading@10 5690 @table @samp
yading@10 5691 @item arbg
yading@10 5692 anaglyph red/blue gray
yading@10 5693 (red filter on left eye, blue filter on right eye)
yading@10 5694
yading@10 5695 @item argg
yading@10 5696 anaglyph red/green gray
yading@10 5697 (red filter on left eye, green filter on right eye)
yading@10 5698
yading@10 5699 @item arcg
yading@10 5700 anaglyph red/cyan gray
yading@10 5701 (red filter on left eye, cyan filter on right eye)
yading@10 5702
yading@10 5703 @item arch
yading@10 5704 anaglyph red/cyan half colored
yading@10 5705 (red filter on left eye, cyan filter on right eye)
yading@10 5706
yading@10 5707 @item arcc
yading@10 5708 anaglyph red/cyan color
yading@10 5709 (red filter on left eye, cyan filter on right eye)
yading@10 5710
yading@10 5711 @item arcd
yading@10 5712 anaglyph red/cyan color optimized with the least squares projection of dubois
yading@10 5713 (red filter on left eye, cyan filter on right eye)
yading@10 5714
yading@10 5715 @item agmg
yading@10 5716 anaglyph green/magenta gray
yading@10 5717 (green filter on left eye, magenta filter on right eye)
yading@10 5718
yading@10 5719 @item agmh
yading@10 5720 anaglyph green/magenta half colored
yading@10 5721 (green filter on left eye, magenta filter on right eye)
yading@10 5722
yading@10 5723 @item agmc
yading@10 5724 anaglyph green/magenta colored
yading@10 5725 (green filter on left eye, magenta filter on right eye)
yading@10 5726
yading@10 5727 @item agmd
yading@10 5728 anaglyph green/magenta color optimized with the least squares projection of dubois
yading@10 5729 (green filter on left eye, magenta filter on right eye)
yading@10 5730
yading@10 5731 @item aybg
yading@10 5732 anaglyph yellow/blue gray
yading@10 5733 (yellow filter on left eye, blue filter on right eye)
yading@10 5734
yading@10 5735 @item aybh
yading@10 5736 anaglyph yellow/blue half colored
yading@10 5737 (yellow filter on left eye, blue filter on right eye)
yading@10 5738
yading@10 5739 @item aybc
yading@10 5740 anaglyph yellow/blue colored
yading@10 5741 (yellow filter on left eye, blue filter on right eye)
yading@10 5742
yading@10 5743 @item aybd
yading@10 5744 anaglyph yellow/blue color optimized with the least squares projection of dubois
yading@10 5745 (yellow filter on left eye, blue filter on right eye)
yading@10 5746
yading@10 5747 @item irl
yading@10 5748 interleaved rows (left eye has top row, right eye starts on next row)
yading@10 5749
yading@10 5750 @item irr
yading@10 5751 interleaved rows (right eye has top row, left eye starts on next row)
yading@10 5752
yading@10 5753 @item ml
yading@10 5754 mono output (left eye only)
yading@10 5755
yading@10 5756 @item mr
yading@10 5757 mono output (right eye only)
yading@10 5758 @end table
yading@10 5759
yading@10 5760 Default value is @samp{arcd}.
yading@10 5761 @end table
yading@10 5762
yading@10 5763 @anchor{subtitles}
yading@10 5764 @section subtitles
yading@10 5765
yading@10 5766 Draw subtitles on top of input video using the libass library.
yading@10 5767
yading@10 5768 To enable compilation of this filter you need to configure FFmpeg with
yading@10 5769 @code{--enable-libass}. This filter also requires a build with libavcodec and
yading@10 5770 libavformat to convert the passed subtitles file to ASS (Advanced Substation
yading@10 5771 Alpha) subtitles format.
yading@10 5772
yading@10 5773 The filter accepts the following options:
yading@10 5774
yading@10 5775 @table @option
yading@10 5776 @item filename, f
yading@10 5777 Set the filename of the subtitle file to read. It must be specified.
yading@10 5778
yading@10 5779 @item original_size
yading@10 5780 Specify the size of the original video, the video for which the ASS file
yading@10 5781 was composed. Due to a misdesign in ASS aspect ratio arithmetic, this is
yading@10 5782 necessary to correctly scale the fonts if the aspect ratio has been changed.
yading@10 5783
yading@10 5784 @item charenc
yading@10 5785 Set subtitles input character encoding. @code{subtitles} filter only. Only
yading@10 5786 useful if not UTF-8.
yading@10 5787 @end table
yading@10 5788
yading@10 5789 If the first key is not specified, it is assumed that the first value
yading@10 5790 specifies the @option{filename}.
yading@10 5791
yading@10 5792 For example, to render the file @file{sub.srt} on top of the input
yading@10 5793 video, use the command:
yading@10 5794 @example
yading@10 5795 subtitles=sub.srt
yading@10 5796 @end example
yading@10 5797
yading@10 5798 which is equivalent to:
yading@10 5799 @example
yading@10 5800 subtitles=filename=sub.srt
yading@10 5801 @end example
yading@10 5802
yading@10 5803 @section super2xsai
yading@10 5804
yading@10 5805 Scale the input by 2x and smooth using the Super2xSaI (Scale and
yading@10 5806 Interpolate) pixel art scaling algorithm.
yading@10 5807
yading@10 5808 Useful for enlarging pixel art images without reducing sharpness.
yading@10 5809
yading@10 5810 @section swapuv
yading@10 5811 Swap U & V plane.
yading@10 5812
yading@10 5813 @section telecine
yading@10 5814
yading@10 5815 Apply telecine process to the video.
yading@10 5816
yading@10 5817 This filter accepts the following options:
yading@10 5818
yading@10 5819 @table @option
yading@10 5820 @item first_field
yading@10 5821 @table @samp
yading@10 5822 @item top, t
yading@10 5823 top field first
yading@10 5824 @item bottom, b
yading@10 5825 bottom field first
yading@10 5826 The default value is @code{top}.
yading@10 5827 @end table
yading@10 5828
yading@10 5829 @item pattern
yading@10 5830 A string of numbers representing the pulldown pattern you wish to apply.
yading@10 5831 The default value is @code{23}.
yading@10 5832 @end table
yading@10 5833
yading@10 5834 @example
yading@10 5835 Some typical patterns:
yading@10 5836
yading@10 5837 NTSC output (30i):
yading@10 5838 27.5p: 32222
yading@10 5839 24p: 23 (classic)
yading@10 5840 24p: 2332 (preferred)
yading@10 5841 20p: 33
yading@10 5842 18p: 334
yading@10 5843 16p: 3444
yading@10 5844
yading@10 5845 PAL output (25i):
yading@10 5846 27.5p: 12222
yading@10 5847 24p: 222222222223 ("Euro pulldown")
yading@10 5848 16.67p: 33
yading@10 5849 16p: 33333334
yading@10 5850 @end example
yading@10 5851
yading@10 5852 @section thumbnail
yading@10 5853 Select the most representative frame in a given sequence of consecutive frames.
yading@10 5854
yading@10 5855 The filter accepts the following options:
yading@10 5856
yading@10 5857 @table @option
yading@10 5858 @item n
yading@10 5859 Set the frames batch size to analyze; in a set of @var{n} frames, the filter
yading@10 5860 will pick one of them, and then handle the next batch of @var{n} frames until
yading@10 5861 the end. Default is @code{100}.
yading@10 5862 @end table
yading@10 5863
yading@10 5864 Since the filter keeps track of the whole frames sequence, a bigger @var{n}
yading@10 5865 value will result in a higher memory usage, so a high value is not recommended.
yading@10 5866
yading@10 5867 @subsection Examples
yading@10 5868
yading@10 5869 @itemize
yading@10 5870 @item
yading@10 5871 Extract one picture each 50 frames:
yading@10 5872 @example
yading@10 5873 thumbnail=50
yading@10 5874 @end example
yading@10 5875
yading@10 5876 @item
yading@10 5877 Complete example of a thumbnail creation with @command{ffmpeg}:
yading@10 5878 @example
yading@10 5879 ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
yading@10 5880 @end example
yading@10 5881 @end itemize
yading@10 5882
yading@10 5883 @section tile
yading@10 5884
yading@10 5885 Tile several successive frames together.
yading@10 5886
yading@10 5887 The filter accepts the following options:
yading@10 5888
yading@10 5889 @table @option
yading@10 5890
yading@10 5891 @item layout
yading@10 5892 Set the grid size (i.e. the number of lines and columns) in the form
yading@10 5893 "@var{w}x@var{h}".
yading@10 5894
yading@10 5895 @item nb_frames
yading@10 5896 Set the maximum number of frames to render in the given area. It must be less
yading@10 5897 than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
yading@10 5898 the area will be used.
yading@10 5899
yading@10 5900 @item margin
yading@10 5901 Set the outer border margin in pixels.
yading@10 5902
yading@10 5903 @item padding
yading@10 5904 Set the inner border thickness (i.e. the number of pixels between frames). For
yading@10 5905 more advanced padding options (such as having different values for the edges),
yading@10 5906 refer to the pad video filter.
yading@10 5907
yading@10 5908 @end table
yading@10 5909
yading@10 5910 @subsection Examples
yading@10 5911
yading@10 5912 @itemize
yading@10 5913 @item
yading@10 5914 Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
yading@10 5915 @example
yading@10 5916 ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
yading@10 5917 @end example
yading@10 5918 The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
yading@10 5919 duplicating each output frame to accomodate the originally detected frame
yading@10 5920 rate.
yading@10 5921
yading@10 5922 @item
yading@10 5923 Display @code{5} pictures in an area of @code{3x2} frames,
yading@10 5924 with @code{7} pixels between them, and @code{2} pixels of initial margin, using
yading@10 5925 mixed flat and named options:
yading@10 5926 @example
yading@10 5927 tile=3x2:nb_frames=5:padding=7:margin=2
yading@10 5928 @end example
yading@10 5929 @end itemize
yading@10 5930
yading@10 5931 @section tinterlace
yading@10 5932
yading@10 5933 Perform various types of temporal field interlacing.
yading@10 5934
yading@10 5935 Frames are counted starting from 1, so the first input frame is
yading@10 5936 considered odd.
yading@10 5937
yading@10 5938 The filter accepts the following options:
yading@10 5939
yading@10 5940 @table @option
yading@10 5941
yading@10 5942 @item mode
yading@10 5943 Specify the mode of the interlacing. This option can also be specified
yading@10 5944 as a value alone. See below for a list of values for this option.
yading@10 5945
yading@10 5946 Available values are:
yading@10 5947
yading@10 5948 @table @samp
yading@10 5949 @item merge, 0
yading@10 5950 Move odd frames into the upper field, even into the lower field,
yading@10 5951 generating a double height frame at half frame rate.
yading@10 5952
yading@10 5953 @item drop_odd, 1
yading@10 5954 Only output even frames, odd frames are dropped, generating a frame with
yading@10 5955 unchanged height at half frame rate.
yading@10 5956
yading@10 5957 @item drop_even, 2
yading@10 5958 Only output odd frames, even frames are dropped, generating a frame with
yading@10 5959 unchanged height at half frame rate.
yading@10 5960
yading@10 5961 @item pad, 3
yading@10 5962 Expand each frame to full height, but pad alternate lines with black,
yading@10 5963 generating a frame with double height at the same input frame rate.
yading@10 5964
yading@10 5965 @item interleave_top, 4
yading@10 5966 Interleave the upper field from odd frames with the lower field from
yading@10 5967 even frames, generating a frame with unchanged height at half frame rate.
yading@10 5968
yading@10 5969 @item interleave_bottom, 5
yading@10 5970 Interleave the lower field from odd frames with the upper field from
yading@10 5971 even frames, generating a frame with unchanged height at half frame rate.
yading@10 5972
yading@10 5973 @item interlacex2, 6
yading@10 5974 Double frame rate with unchanged height. Frames are inserted each
yading@10 5975 containing the second temporal field from the previous input frame and
yading@10 5976 the first temporal field from the next input frame. This mode relies on
yading@10 5977 the top_field_first flag. Useful for interlaced video displays with no
yading@10 5978 field synchronisation.
yading@10 5979 @end table
yading@10 5980
yading@10 5981 Numeric values are deprecated but are accepted for backward
yading@10 5982 compatibility reasons.
yading@10 5983
yading@10 5984 Default mode is @code{merge}.
yading@10 5985
yading@10 5986 @item flags
yading@10 5987 Specify flags influencing the filter process.
yading@10 5988
yading@10 5989 Available value for @var{flags} is:
yading@10 5990
yading@10 5991 @table @option
yading@10 5992 @item low_pass_filter, vlfp
yading@10 5993 Enable vertical low-pass filtering in the filter.
yading@10 5994 Vertical low-pass filtering is required when creating an interlaced
yading@10 5995 destination from a progressive source which contains high-frequency
yading@10 5996 vertical detail. Filtering will reduce interlace 'twitter' and Moire
yading@10 5997 patterning.
yading@10 5998
yading@10 5999 Vertical low-pass filtering can only be enabled for @option{mode}
yading@10 6000 @var{interleave_top} and @var{interleave_bottom}.
yading@10 6001
yading@10 6002 @end table
yading@10 6003 @end table
yading@10 6004
yading@10 6005 @section transpose
yading@10 6006
yading@10 6007 Transpose rows with columns in the input video and optionally flip it.
yading@10 6008
yading@10 6009 This filter accepts the following options:
yading@10 6010
yading@10 6011 @table @option
yading@10 6012
yading@10 6013 @item dir
yading@10 6014 The direction of the transpose.
yading@10 6015
yading@10 6016 @table @samp
yading@10 6017 @item 0, 4, cclock_flip
yading@10 6018 Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
yading@10 6019 @example
yading@10 6020 L.R L.l
yading@10 6021 . . -> . .
yading@10 6022 l.r R.r
yading@10 6023 @end example
yading@10 6024
yading@10 6025 @item 1, 5, clock
yading@10 6026 Rotate by 90 degrees clockwise, that is:
yading@10 6027 @example
yading@10 6028 L.R l.L
yading@10 6029 . . -> . .
yading@10 6030 l.r r.R
yading@10 6031 @end example
yading@10 6032
yading@10 6033 @item 2, 6, cclock
yading@10 6034 Rotate by 90 degrees counterclockwise, that is:
yading@10 6035 @example
yading@10 6036 L.R R.r
yading@10 6037 . . -> . .
yading@10 6038 l.r L.l
yading@10 6039 @end example
yading@10 6040
yading@10 6041 @item 3, 7, clock_flip
yading@10 6042 Rotate by 90 degrees clockwise and vertically flip, that is:
yading@10 6043 @example
yading@10 6044 L.R r.R
yading@10 6045 . . -> . .
yading@10 6046 l.r l.L
yading@10 6047 @end example
yading@10 6048 @end table
yading@10 6049
yading@10 6050 For values between 4-7, the transposition is only done if the input
yading@10 6051 video geometry is portrait and not landscape. These values are
yading@10 6052 deprecated, the @code{passthrough} option should be used instead.
yading@10 6053
yading@10 6054 @item passthrough
yading@10 6055 Do not apply the transposition if the input geometry matches the one
yading@10 6056 specified by the specified value. It accepts the following values:
yading@10 6057 @table @samp
yading@10 6058 @item none
yading@10 6059 Always apply transposition.
yading@10 6060 @item portrait
yading@10 6061 Preserve portrait geometry (when @var{height} >= @var{width}).
yading@10 6062 @item landscape
yading@10 6063 Preserve landscape geometry (when @var{width} >= @var{height}).
yading@10 6064 @end table
yading@10 6065
yading@10 6066 Default value is @code{none}.
yading@10 6067 @end table
yading@10 6068
yading@10 6069 For example to rotate by 90 degrees clockwise and preserve portrait
yading@10 6070 layout:
yading@10 6071 @example
yading@10 6072 transpose=dir=1:passthrough=portrait
yading@10 6073 @end example
yading@10 6074
yading@10 6075 The command above can also be specified as:
yading@10 6076 @example
yading@10 6077 transpose=1:portrait
yading@10 6078 @end example
yading@10 6079
yading@10 6080 @section unsharp
yading@10 6081
yading@10 6082 Sharpen or blur the input video.
yading@10 6083
yading@10 6084 It accepts the following parameters:
yading@10 6085
yading@10 6086 @table @option
yading@10 6087 @item luma_msize_x, lx
yading@10 6088 @item chroma_msize_x, cx
yading@10 6089 Set the luma/chroma matrix horizontal size. It must be an odd integer
yading@10 6090 between 3 and 63, default value is 5.
yading@10 6091
yading@10 6092 @item luma_msize_y, ly
yading@10 6093 @item chroma_msize_y, cy
yading@10 6094 Set the luma/chroma matrix vertical size. It must be an odd integer
yading@10 6095 between 3 and 63, default value is 5.
yading@10 6096
yading@10 6097 @item luma_amount, la
yading@10 6098 @item chroma_amount, ca
yading@10 6099 Set the luma/chroma effect strength. It can be a float number,
yading@10 6100 reasonable values lay between -1.5 and 1.5.
yading@10 6101
yading@10 6102 Negative values will blur the input video, while positive values will
yading@10 6103 sharpen it, a value of zero will disable the effect.
yading@10 6104
yading@10 6105 Default value is 1.0 for @option{luma_amount}, 0.0 for
yading@10 6106 @option{chroma_amount}.
yading@10 6107 @end table
yading@10 6108
yading@10 6109 All parameters are optional and default to the
yading@10 6110 equivalent of the string '5:5:1.0:5:5:0.0'.
yading@10 6111
yading@10 6112 @subsection Examples
yading@10 6113
yading@10 6114 @itemize
yading@10 6115 @item
yading@10 6116 Apply strong luma sharpen effect:
yading@10 6117 @example
yading@10 6118 unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
yading@10 6119 @end example
yading@10 6120
yading@10 6121 @item
yading@10 6122 Apply strong blur of both luma and chroma parameters:
yading@10 6123 @example
yading@10 6124 unsharp=7:7:-2:7:7:-2
yading@10 6125 @end example
yading@10 6126 @end itemize
yading@10 6127
yading@10 6128 @section vflip
yading@10 6129
yading@10 6130 Flip the input video vertically.
yading@10 6131
yading@10 6132 @example
yading@10 6133 ffmpeg -i in.avi -vf "vflip" out.avi
yading@10 6134 @end example
yading@10 6135
yading@10 6136 @anchor{yadif}
yading@10 6137 @section yadif
yading@10 6138
yading@10 6139 Deinterlace the input video ("yadif" means "yet another deinterlacing
yading@10 6140 filter").
yading@10 6141
yading@10 6142 This filter accepts the following options:
yading@10 6143
yading@10 6144
yading@10 6145 @table @option
yading@10 6146
yading@10 6147 @item mode
yading@10 6148 The interlacing mode to adopt, accepts one of the following values:
yading@10 6149
yading@10 6150 @table @option
yading@10 6151 @item 0, send_frame
yading@10 6152 output 1 frame for each frame
yading@10 6153 @item 1, send_field
yading@10 6154 output 1 frame for each field
yading@10 6155 @item 2, send_frame_nospatial
yading@10 6156 like @code{send_frame} but skip spatial interlacing check
yading@10 6157 @item 3, send_field_nospatial
yading@10 6158 like @code{send_field} but skip spatial interlacing check
yading@10 6159 @end table
yading@10 6160
yading@10 6161 Default value is @code{send_frame}.
yading@10 6162
yading@10 6163 @item parity
yading@10 6164 The picture field parity assumed for the input interlaced video, accepts one of
yading@10 6165 the following values:
yading@10 6166
yading@10 6167 @table @option
yading@10 6168 @item 0, tff
yading@10 6169 assume top field first
yading@10 6170 @item 1, bff
yading@10 6171 assume bottom field first
yading@10 6172 @item -1, auto
yading@10 6173 enable automatic detection
yading@10 6174 @end table
yading@10 6175
yading@10 6176 Default value is @code{auto}.
yading@10 6177 If interlacing is unknown or decoder does not export this information,
yading@10 6178 top field first will be assumed.
yading@10 6179
yading@10 6180 @item deint
yading@10 6181 Specify which frames to deinterlace. Accept one of the following
yading@10 6182 values:
yading@10 6183
yading@10 6184 @table @option
yading@10 6185 @item 0, all
yading@10 6186 deinterlace all frames
yading@10 6187 @item 1, interlaced
yading@10 6188 only deinterlace frames marked as interlaced
yading@10 6189 @end table
yading@10 6190
yading@10 6191 Default value is @code{all}.
yading@10 6192 @end table
yading@10 6193
yading@10 6194 @c man end VIDEO FILTERS
yading@10 6195
yading@10 6196 @chapter Video Sources
yading@10 6197 @c man begin VIDEO SOURCES
yading@10 6198
yading@10 6199 Below is a description of the currently available video sources.
yading@10 6200
yading@10 6201 @section buffer
yading@10 6202
yading@10 6203 Buffer video frames, and make them available to the filter chain.
yading@10 6204
yading@10 6205 This source is mainly intended for a programmatic use, in particular
yading@10 6206 through the interface defined in @file{libavfilter/vsrc_buffer.h}.
yading@10 6207
yading@10 6208 This source accepts the following options:
yading@10 6209
yading@10 6210 @table @option
yading@10 6211
yading@10 6212 @item video_size
yading@10 6213 Specify the size (width and height) of the buffered video frames.
yading@10 6214
yading@10 6215 @item width
yading@10 6216 Input video width.
yading@10 6217
yading@10 6218 @item height
yading@10 6219 Input video height.
yading@10 6220
yading@10 6221 @item pix_fmt
yading@10 6222 A string representing the pixel format of the buffered video frames.
yading@10 6223 It may be a number corresponding to a pixel format, or a pixel format
yading@10 6224 name.
yading@10 6225
yading@10 6226 @item time_base
yading@10 6227 Specify the timebase assumed by the timestamps of the buffered frames.
yading@10 6228
yading@10 6229 @item frame_rate
yading@10 6230 Specify the frame rate expected for the video stream.
yading@10 6231
yading@10 6232 @item pixel_aspect, sar
yading@10 6233 Specify the sample aspect ratio assumed by the video frames.
yading@10 6234
yading@10 6235 @item sws_param
yading@10 6236 Specify the optional parameters to be used for the scale filter which
yading@10 6237 is automatically inserted when an input change is detected in the
yading@10 6238 input size or format.
yading@10 6239 @end table
yading@10 6240
yading@10 6241 For example:
yading@10 6242 @example
yading@10 6243 buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
yading@10 6244 @end example
yading@10 6245
yading@10 6246 will instruct the source to accept video frames with size 320x240 and
yading@10 6247 with format "yuv410p", assuming 1/24 as the timestamps timebase and
yading@10 6248 square pixels (1:1 sample aspect ratio).
yading@10 6249 Since the pixel format with name "yuv410p" corresponds to the number 6
yading@10 6250 (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
yading@10 6251 this example corresponds to:
yading@10 6252 @example
yading@10 6253 buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
yading@10 6254 @end example
yading@10 6255
yading@10 6256 Alternatively, the options can be specified as a flat string, but this
yading@10 6257 syntax is deprecated:
yading@10 6258
yading@10 6259 @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
yading@10 6260
yading@10 6261 @section cellauto
yading@10 6262
yading@10 6263 Create a pattern generated by an elementary cellular automaton.
yading@10 6264
yading@10 6265 The initial state of the cellular automaton can be defined through the
yading@10 6266 @option{filename}, and @option{pattern} options. If such options are
yading@10 6267 not specified an initial state is created randomly.
yading@10 6268
yading@10 6269 At each new frame a new row in the video is filled with the result of
yading@10 6270 the cellular automaton next generation. The behavior when the whole
yading@10 6271 frame is filled is defined by the @option{scroll} option.
yading@10 6272
yading@10 6273 This source accepts the following options:
yading@10 6274
yading@10 6275 @table @option
yading@10 6276 @item filename, f
yading@10 6277 Read the initial cellular automaton state, i.e. the starting row, from
yading@10 6278 the specified file.
yading@10 6279 In the file, each non-whitespace character is considered an alive
yading@10 6280 cell, a newline will terminate the row, and further characters in the
yading@10 6281 file will be ignored.
yading@10 6282
yading@10 6283 @item pattern, p
yading@10 6284 Read the initial cellular automaton state, i.e. the starting row, from
yading@10 6285 the specified string.
yading@10 6286
yading@10 6287 Each non-whitespace character in the string is considered an alive
yading@10 6288 cell, a newline will terminate the row, and further characters in the
yading@10 6289 string will be ignored.
yading@10 6290
yading@10 6291 @item rate, r
yading@10 6292 Set the video rate, that is the number of frames generated per second.
yading@10 6293 Default is 25.
yading@10 6294
yading@10 6295 @item random_fill_ratio, ratio
yading@10 6296 Set the random fill ratio for the initial cellular automaton row. It
yading@10 6297 is a floating point number value ranging from 0 to 1, defaults to
yading@10 6298 1/PHI.
yading@10 6299
yading@10 6300 This option is ignored when a file or a pattern is specified.
yading@10 6301
yading@10 6302 @item random_seed, seed
yading@10 6303 Set the seed for filling randomly the initial row, must be an integer
yading@10 6304 included between 0 and UINT32_MAX. If not specified, or if explicitly
yading@10 6305 set to -1, the filter will try to use a good random seed on a best
yading@10 6306 effort basis.
yading@10 6307
yading@10 6308 @item rule
yading@10 6309 Set the cellular automaton rule, it is a number ranging from 0 to 255.
yading@10 6310 Default value is 110.
yading@10 6311
yading@10 6312 @item size, s
yading@10 6313 Set the size of the output video.
yading@10 6314
yading@10 6315 If @option{filename} or @option{pattern} is specified, the size is set
yading@10 6316 by default to the width of the specified initial state row, and the
yading@10 6317 height is set to @var{width} * PHI.
yading@10 6318
yading@10 6319 If @option{size} is set, it must contain the width of the specified
yading@10 6320 pattern string, and the specified pattern will be centered in the
yading@10 6321 larger row.
yading@10 6322
yading@10 6323 If a filename or a pattern string is not specified, the size value
yading@10 6324 defaults to "320x518" (used for a randomly generated initial state).
yading@10 6325
yading@10 6326 @item scroll
yading@10 6327 If set to 1, scroll the output upward when all the rows in the output
yading@10 6328 have been already filled. If set to 0, the new generated row will be
yading@10 6329 written over the top row just after the bottom row is filled.
yading@10 6330 Defaults to 1.
yading@10 6331
yading@10 6332 @item start_full, full
yading@10 6333 If set to 1, completely fill the output with generated rows before
yading@10 6334 outputting the first frame.
yading@10 6335 This is the default behavior, for disabling set the value to 0.
yading@10 6336
yading@10 6337 @item stitch
yading@10 6338 If set to 1, stitch the left and right row edges together.
yading@10 6339 This is the default behavior, for disabling set the value to 0.
yading@10 6340 @end table
yading@10 6341
yading@10 6342 @subsection Examples
yading@10 6343
yading@10 6344 @itemize
yading@10 6345 @item
yading@10 6346 Read the initial state from @file{pattern}, and specify an output of
yading@10 6347 size 200x400.
yading@10 6348 @example
yading@10 6349 cellauto=f=pattern:s=200x400
yading@10 6350 @end example
yading@10 6351
yading@10 6352 @item
yading@10 6353 Generate a random initial row with a width of 200 cells, with a fill
yading@10 6354 ratio of 2/3:
yading@10 6355 @example
yading@10 6356 cellauto=ratio=2/3:s=200x200
yading@10 6357 @end example
yading@10 6358
yading@10 6359 @item
yading@10 6360 Create a pattern generated by rule 18 starting by a single alive cell
yading@10 6361 centered on an initial row with width 100:
yading@10 6362 @example
yading@10 6363 cellauto=p=@@:s=100x400:full=0:rule=18
yading@10 6364 @end example
yading@10 6365
yading@10 6366 @item
yading@10 6367 Specify a more elaborated initial pattern:
yading@10 6368 @example
yading@10 6369 cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
yading@10 6370 @end example
yading@10 6371
yading@10 6372 @end itemize
yading@10 6373
yading@10 6374 @section mandelbrot
yading@10 6375
yading@10 6376 Generate a Mandelbrot set fractal, and progressively zoom towards the
yading@10 6377 point specified with @var{start_x} and @var{start_y}.
yading@10 6378
yading@10 6379 This source accepts the following options:
yading@10 6380
yading@10 6381 @table @option
yading@10 6382
yading@10 6383 @item end_pts
yading@10 6384 Set the terminal pts value. Default value is 400.
yading@10 6385
yading@10 6386 @item end_scale
yading@10 6387 Set the terminal scale value.
yading@10 6388 Must be a floating point value. Default value is 0.3.
yading@10 6389
yading@10 6390 @item inner
yading@10 6391 Set the inner coloring mode, that is the algorithm used to draw the
yading@10 6392 Mandelbrot fractal internal region.
yading@10 6393
yading@10 6394 It shall assume one of the following values:
yading@10 6395 @table @option
yading@10 6396 @item black
yading@10 6397 Set black mode.
yading@10 6398 @item convergence
yading@10 6399 Show time until convergence.
yading@10 6400 @item mincol
yading@10 6401 Set color based on point closest to the origin of the iterations.
yading@10 6402 @item period
yading@10 6403 Set period mode.
yading@10 6404 @end table
yading@10 6405
yading@10 6406 Default value is @var{mincol}.
yading@10 6407
yading@10 6408 @item bailout
yading@10 6409 Set the bailout value. Default value is 10.0.
yading@10 6410
yading@10 6411 @item maxiter
yading@10 6412 Set the maximum of iterations performed by the rendering
yading@10 6413 algorithm. Default value is 7189.
yading@10 6414
yading@10 6415 @item outer
yading@10 6416 Set outer coloring mode.
yading@10 6417 It shall assume one of following values:
yading@10 6418 @table @option
yading@10 6419 @item iteration_count
yading@10 6420 Set iteration cound mode.
yading@10 6421 @item normalized_iteration_count
yading@10 6422 set normalized iteration count mode.
yading@10 6423 @end table
yading@10 6424 Default value is @var{normalized_iteration_count}.
yading@10 6425
yading@10 6426 @item rate, r
yading@10 6427 Set frame rate, expressed as number of frames per second. Default
yading@10 6428 value is "25".
yading@10 6429
yading@10 6430 @item size, s
yading@10 6431 Set frame size. Default value is "640x480".
yading@10 6432
yading@10 6433 @item start_scale
yading@10 6434 Set the initial scale value. Default value is 3.0.
yading@10 6435
yading@10 6436 @item start_x
yading@10 6437 Set the initial x position. Must be a floating point value between
yading@10 6438 -100 and 100. Default value is -0.743643887037158704752191506114774.
yading@10 6439
yading@10 6440 @item start_y
yading@10 6441 Set the initial y position. Must be a floating point value between
yading@10 6442 -100 and 100. Default value is -0.131825904205311970493132056385139.
yading@10 6443 @end table
yading@10 6444
yading@10 6445 @section mptestsrc
yading@10 6446
yading@10 6447 Generate various test patterns, as generated by the MPlayer test filter.
yading@10 6448
yading@10 6449 The size of the generated video is fixed, and is 256x256.
yading@10 6450 This source is useful in particular for testing encoding features.
yading@10 6451
yading@10 6452 This source accepts the following options:
yading@10 6453
yading@10 6454 @table @option
yading@10 6455
yading@10 6456 @item rate, r
yading@10 6457 Specify the frame rate of the sourced video, as the number of frames
yading@10 6458 generated per second. It has to be a string in the format
yading@10 6459 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
yading@10 6460 number or a valid video frame rate abbreviation. The default value is
yading@10 6461 "25".
yading@10 6462
yading@10 6463 @item duration, d
yading@10 6464 Set the video duration of the sourced video. The accepted syntax is:
yading@10 6465 @example
yading@10 6466 [-]HH:MM:SS[.m...]
yading@10 6467 [-]S+[.m...]
yading@10 6468 @end example
yading@10 6469 See also the function @code{av_parse_time()}.
yading@10 6470
yading@10 6471 If not specified, or the expressed duration is negative, the video is
yading@10 6472 supposed to be generated forever.
yading@10 6473
yading@10 6474 @item test, t
yading@10 6475
yading@10 6476 Set the number or the name of the test to perform. Supported tests are:
yading@10 6477 @table @option
yading@10 6478 @item dc_luma
yading@10 6479 @item dc_chroma
yading@10 6480 @item freq_luma
yading@10 6481 @item freq_chroma
yading@10 6482 @item amp_luma
yading@10 6483 @item amp_chroma
yading@10 6484 @item cbp
yading@10 6485 @item mv
yading@10 6486 @item ring1
yading@10 6487 @item ring2
yading@10 6488 @item all
yading@10 6489 @end table
yading@10 6490
yading@10 6491 Default value is "all", which will cycle through the list of all tests.
yading@10 6492 @end table
yading@10 6493
yading@10 6494 For example the following:
yading@10 6495 @example
yading@10 6496 testsrc=t=dc_luma
yading@10 6497 @end example
yading@10 6498
yading@10 6499 will generate a "dc_luma" test pattern.
yading@10 6500
yading@10 6501 @section frei0r_src
yading@10 6502
yading@10 6503 Provide a frei0r source.
yading@10 6504
yading@10 6505 To enable compilation of this filter you need to install the frei0r
yading@10 6506 header and configure FFmpeg with @code{--enable-frei0r}.
yading@10 6507
yading@10 6508 This source accepts the following options:
yading@10 6509
yading@10 6510 @table @option
yading@10 6511
yading@10 6512 @item size
yading@10 6513 The size of the video to generate, may be a string of the form
yading@10 6514 @var{width}x@var{height} or a frame size abbreviation.
yading@10 6515
yading@10 6516 @item framerate
yading@10 6517 Framerate of the generated video, may be a string of the form
yading@10 6518 @var{num}/@var{den} or a frame rate abbreviation.
yading@10 6519
yading@10 6520 @item filter_name
yading@10 6521 The name to the frei0r source to load. For more information regarding frei0r and
yading@10 6522 how to set the parameters read the section @ref{frei0r} in the description of
yading@10 6523 the video filters.
yading@10 6524
yading@10 6525 @item filter_params
yading@10 6526 A '|'-separated list of parameters to pass to the frei0r source.
yading@10 6527
yading@10 6528 @end table
yading@10 6529
yading@10 6530 For example, to generate a frei0r partik0l source with size 200x200
yading@10 6531 and frame rate 10 which is overlayed on the overlay filter main input:
yading@10 6532 @example
yading@10 6533 frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
yading@10 6534 @end example
yading@10 6535
yading@10 6536 @section life
yading@10 6537
yading@10 6538 Generate a life pattern.
yading@10 6539
yading@10 6540 This source is based on a generalization of John Conway's life game.
yading@10 6541
yading@10 6542 The sourced input represents a life grid, each pixel represents a cell
yading@10 6543 which can be in one of two possible states, alive or dead. Every cell
yading@10 6544 interacts with its eight neighbours, which are the cells that are
yading@10 6545 horizontally, vertically, or diagonally adjacent.
yading@10 6546
yading@10 6547 At each interaction the grid evolves according to the adopted rule,
yading@10 6548 which specifies the number of neighbor alive cells which will make a
yading@10 6549 cell stay alive or born. The @option{rule} option allows to specify
yading@10 6550 the rule to adopt.
yading@10 6551
yading@10 6552 This source accepts the following options:
yading@10 6553
yading@10 6554 @table @option
yading@10 6555 @item filename, f
yading@10 6556 Set the file from which to read the initial grid state. In the file,
yading@10 6557 each non-whitespace character is considered an alive cell, and newline
yading@10 6558 is used to delimit the end of each row.
yading@10 6559
yading@10 6560 If this option is not specified, the initial grid is generated
yading@10 6561 randomly.
yading@10 6562
yading@10 6563 @item rate, r
yading@10 6564 Set the video rate, that is the number of frames generated per second.
yading@10 6565 Default is 25.
yading@10 6566
yading@10 6567 @item random_fill_ratio, ratio
yading@10 6568 Set the random fill ratio for the initial random grid. It is a
yading@10 6569 floating point number value ranging from 0 to 1, defaults to 1/PHI.
yading@10 6570 It is ignored when a file is specified.
yading@10 6571
yading@10 6572 @item random_seed, seed
yading@10 6573 Set the seed for filling the initial random grid, must be an integer
yading@10 6574 included between 0 and UINT32_MAX. If not specified, or if explicitly
yading@10 6575 set to -1, the filter will try to use a good random seed on a best
yading@10 6576 effort basis.
yading@10 6577
yading@10 6578 @item rule
yading@10 6579 Set the life rule.
yading@10 6580
yading@10 6581 A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
yading@10 6582 where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
yading@10 6583 @var{NS} specifies the number of alive neighbor cells which make a
yading@10 6584 live cell stay alive, and @var{NB} the number of alive neighbor cells
yading@10 6585 which make a dead cell to become alive (i.e. to "born").
yading@10 6586 "s" and "b" can be used in place of "S" and "B", respectively.
yading@10 6587
yading@10 6588 Alternatively a rule can be specified by an 18-bits integer. The 9
yading@10 6589 high order bits are used to encode the next cell state if it is alive
yading@10 6590 for each number of neighbor alive cells, the low order bits specify
yading@10 6591 the rule for "borning" new cells. Higher order bits encode for an
yading@10 6592 higher number of neighbor cells.
yading@10 6593 For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
yading@10 6594 rule of 12 and a born rule of 9, which corresponds to "S23/B03".
yading@10 6595
yading@10 6596 Default value is "S23/B3", which is the original Conway's game of life
yading@10 6597 rule, and will keep a cell alive if it has 2 or 3 neighbor alive
yading@10 6598 cells, and will born a new cell if there are three alive cells around
yading@10 6599 a dead cell.
yading@10 6600
yading@10 6601 @item size, s
yading@10 6602 Set the size of the output video.
yading@10 6603
yading@10 6604 If @option{filename} is specified, the size is set by default to the
yading@10 6605 same size of the input file. If @option{size} is set, it must contain
yading@10 6606 the size specified in the input file, and the initial grid defined in
yading@10 6607 that file is centered in the larger resulting area.
yading@10 6608
yading@10 6609 If a filename is not specified, the size value defaults to "320x240"
yading@10 6610 (used for a randomly generated initial grid).
yading@10 6611
yading@10 6612 @item stitch
yading@10 6613 If set to 1, stitch the left and right grid edges together, and the
yading@10 6614 top and bottom edges also. Defaults to 1.
yading@10 6615
yading@10 6616 @item mold
yading@10 6617 Set cell mold speed. If set, a dead cell will go from @option{death_color} to
yading@10 6618 @option{mold_color} with a step of @option{mold}. @option{mold} can have a
yading@10 6619 value from 0 to 255.
yading@10 6620
yading@10 6621 @item life_color
yading@10 6622 Set the color of living (or new born) cells.
yading@10 6623
yading@10 6624 @item death_color
yading@10 6625 Set the color of dead cells. If @option{mold} is set, this is the first color
yading@10 6626 used to represent a dead cell.
yading@10 6627
yading@10 6628 @item mold_color
yading@10 6629 Set mold color, for definitely dead and moldy cells.
yading@10 6630 @end table
yading@10 6631
yading@10 6632 @subsection Examples
yading@10 6633
yading@10 6634 @itemize
yading@10 6635 @item
yading@10 6636 Read a grid from @file{pattern}, and center it on a grid of size
yading@10 6637 300x300 pixels:
yading@10 6638 @example
yading@10 6639 life=f=pattern:s=300x300
yading@10 6640 @end example
yading@10 6641
yading@10 6642 @item
yading@10 6643 Generate a random grid of size 200x200, with a fill ratio of 2/3:
yading@10 6644 @example
yading@10 6645 life=ratio=2/3:s=200x200
yading@10 6646 @end example
yading@10 6647
yading@10 6648 @item
yading@10 6649 Specify a custom rule for evolving a randomly generated grid:
yading@10 6650 @example
yading@10 6651 life=rule=S14/B34
yading@10 6652 @end example
yading@10 6653
yading@10 6654 @item
yading@10 6655 Full example with slow death effect (mold) using @command{ffplay}:
yading@10 6656 @example
yading@10 6657 ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
yading@10 6658 @end example
yading@10 6659 @end itemize
yading@10 6660
yading@10 6661 @section color, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
yading@10 6662
yading@10 6663 The @code{color} source provides an uniformly colored input.
yading@10 6664
yading@10 6665 The @code{nullsrc} source returns unprocessed video frames. It is
yading@10 6666 mainly useful to be employed in analysis / debugging tools, or as the
yading@10 6667 source for filters which ignore the input data.
yading@10 6668
yading@10 6669 The @code{rgbtestsrc} source generates an RGB test pattern useful for
yading@10 6670 detecting RGB vs BGR issues. You should see a red, green and blue
yading@10 6671 stripe from top to bottom.
yading@10 6672
yading@10 6673 The @code{smptebars} source generates a color bars pattern, based on
yading@10 6674 the SMPTE Engineering Guideline EG 1-1990.
yading@10 6675
yading@10 6676 The @code{smptehdbars} source generates a color bars pattern, based on
yading@10 6677 the SMPTE RP 219-2002.
yading@10 6678
yading@10 6679 The @code{testsrc} source generates a test video pattern, showing a
yading@10 6680 color pattern, a scrolling gradient and a timestamp. This is mainly
yading@10 6681 intended for testing purposes.
yading@10 6682
yading@10 6683 The sources accept the following options:
yading@10 6684
yading@10 6685 @table @option
yading@10 6686
yading@10 6687 @item color, c
yading@10 6688 Specify the color of the source, only used in the @code{color}
yading@10 6689 source. It can be the name of a color (case insensitive match) or a
yading@10 6690 0xRRGGBB[AA] sequence, possibly followed by an alpha specifier. The
yading@10 6691 default value is "black".
yading@10 6692
yading@10 6693 @item size, s
yading@10 6694 Specify the size of the sourced video, it may be a string of the form
yading@10 6695 @var{width}x@var{height}, or the name of a size abbreviation. The
yading@10 6696 default value is "320x240".
yading@10 6697
yading@10 6698 @item rate, r
yading@10 6699 Specify the frame rate of the sourced video, as the number of frames
yading@10 6700 generated per second. It has to be a string in the format
yading@10 6701 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
yading@10 6702 number or a valid video frame rate abbreviation. The default value is
yading@10 6703 "25".
yading@10 6704
yading@10 6705 @item sar
yading@10 6706 Set the sample aspect ratio of the sourced video.
yading@10 6707
yading@10 6708 @item duration, d
yading@10 6709 Set the video duration of the sourced video. The accepted syntax is:
yading@10 6710 @example
yading@10 6711 [-]HH[:MM[:SS[.m...]]]
yading@10 6712 [-]S+[.m...]
yading@10 6713 @end example
yading@10 6714 See also the function @code{av_parse_time()}.
yading@10 6715
yading@10 6716 If not specified, or the expressed duration is negative, the video is
yading@10 6717 supposed to be generated forever.
yading@10 6718
yading@10 6719 @item decimals, n
yading@10 6720 Set the number of decimals to show in the timestamp, only used in the
yading@10 6721 @code{testsrc} source.
yading@10 6722
yading@10 6723 The displayed timestamp value will correspond to the original
yading@10 6724 timestamp value multiplied by the power of 10 of the specified
yading@10 6725 value. Default value is 0.
yading@10 6726 @end table
yading@10 6727
yading@10 6728 For example the following:
yading@10 6729 @example
yading@10 6730 testsrc=duration=5.3:size=qcif:rate=10
yading@10 6731 @end example
yading@10 6732
yading@10 6733 will generate a video with a duration of 5.3 seconds, with size
yading@10 6734 176x144 and a frame rate of 10 frames per second.
yading@10 6735
yading@10 6736 The following graph description will generate a red source
yading@10 6737 with an opacity of 0.2, with size "qcif" and a frame rate of 10
yading@10 6738 frames per second.
yading@10 6739 @example
yading@10 6740 color=c=red@@0.2:s=qcif:r=10
yading@10 6741 @end example
yading@10 6742
yading@10 6743 If the input content is to be ignored, @code{nullsrc} can be used. The
yading@10 6744 following command generates noise in the luminance plane by employing
yading@10 6745 the @code{geq} filter:
yading@10 6746 @example
yading@10 6747 nullsrc=s=256x256, geq=random(1)*255:128:128
yading@10 6748 @end example
yading@10 6749
yading@10 6750 @c man end VIDEO SOURCES
yading@10 6751
yading@10 6752 @chapter Video Sinks
yading@10 6753 @c man begin VIDEO SINKS
yading@10 6754
yading@10 6755 Below is a description of the currently available video sinks.
yading@10 6756
yading@10 6757 @section buffersink
yading@10 6758
yading@10 6759 Buffer video frames, and make them available to the end of the filter
yading@10 6760 graph.
yading@10 6761
yading@10 6762 This sink is mainly intended for a programmatic use, in particular
yading@10 6763 through the interface defined in @file{libavfilter/buffersink.h}
yading@10 6764 or the options system.
yading@10 6765
yading@10 6766 It accepts a pointer to an AVBufferSinkContext structure, which
yading@10 6767 defines the incoming buffers' formats, to be passed as the opaque
yading@10 6768 parameter to @code{avfilter_init_filter} for initialization.
yading@10 6769
yading@10 6770 @section nullsink
yading@10 6771
yading@10 6772 Null video sink, do absolutely nothing with the input video. It is
yading@10 6773 mainly useful as a template and to be employed in analysis / debugging
yading@10 6774 tools.
yading@10 6775
yading@10 6776 @c man end VIDEO SINKS
yading@10 6777
yading@10 6778 @chapter Multimedia Filters
yading@10 6779 @c man begin MULTIMEDIA FILTERS
yading@10 6780
yading@10 6781 Below is a description of the currently available multimedia filters.
yading@10 6782
yading@10 6783 @section aperms, perms
yading@10 6784
yading@10 6785 Set read/write permissions for the output frames.
yading@10 6786
yading@10 6787 These filters are mainly aimed at developers to test direct path in the
yading@10 6788 following filter in the filtergraph.
yading@10 6789
yading@10 6790 The filters accept the following options:
yading@10 6791
yading@10 6792 @table @option
yading@10 6793 @item mode
yading@10 6794 Select the permissions mode.
yading@10 6795
yading@10 6796 It accepts the following values:
yading@10 6797 @table @samp
yading@10 6798 @item none
yading@10 6799 Do nothing. This is the default.
yading@10 6800 @item ro
yading@10 6801 Set all the output frames read-only.
yading@10 6802 @item rw
yading@10 6803 Set all the output frames directly writable.
yading@10 6804 @item toggle
yading@10 6805 Make the frame read-only if writable, and writable if read-only.
yading@10 6806 @item random
yading@10 6807 Set each output frame read-only or writable randomly.
yading@10 6808 @end table
yading@10 6809
yading@10 6810 @item seed
yading@10 6811 Set the seed for the @var{random} mode, must be an integer included between
yading@10 6812 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
yading@10 6813 @code{-1}, the filter will try to use a good random seed on a best effort
yading@10 6814 basis.
yading@10 6815 @end table
yading@10 6816
yading@10 6817 Note: in case of auto-inserted filter between the permission filter and the
yading@10 6818 following one, the permission might not be received as expected in that
yading@10 6819 following filter. Inserting a @ref{format} or @ref{aformat} filter before the
yading@10 6820 perms/aperms filter can avoid this problem.
yading@10 6821
yading@10 6822 @section aselect, select
yading@10 6823 Select frames to pass in output.
yading@10 6824
yading@10 6825 This filter accepts the following options:
yading@10 6826
yading@10 6827 @table @option
yading@10 6828
yading@10 6829 @item expr, e
yading@10 6830 Set expression, which is evaluated for each input frame.
yading@10 6831
yading@10 6832 If the expression is evaluated to zero, the frame is discarded.
yading@10 6833
yading@10 6834 If the evaluation result is negative or NaN, the frame is sent to the
yading@10 6835 first output; otherwise it is sent to the output with index
yading@10 6836 @code{ceil(val)-1}, assuming that the input index starts from 0.
yading@10 6837
yading@10 6838 For example a value of @code{1.2} corresponds to the output with index
yading@10 6839 @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
yading@10 6840
yading@10 6841 @item outputs, n
yading@10 6842 Set the number of outputs. The output to which to send the selected
yading@10 6843 frame is based on the result of the evaluation. Default value is 1.
yading@10 6844 @end table
yading@10 6845
yading@10 6846 The expression can contain the following constants:
yading@10 6847
yading@10 6848 @table @option
yading@10 6849 @item n
yading@10 6850 the sequential number of the filtered frame, starting from 0
yading@10 6851
yading@10 6852 @item selected_n
yading@10 6853 the sequential number of the selected frame, starting from 0
yading@10 6854
yading@10 6855 @item prev_selected_n
yading@10 6856 the sequential number of the last selected frame, NAN if undefined
yading@10 6857
yading@10 6858 @item TB
yading@10 6859 timebase of the input timestamps
yading@10 6860
yading@10 6861 @item pts
yading@10 6862 the PTS (Presentation TimeStamp) of the filtered video frame,
yading@10 6863 expressed in @var{TB} units, NAN if undefined
yading@10 6864
yading@10 6865 @item t
yading@10 6866 the PTS (Presentation TimeStamp) of the filtered video frame,
yading@10 6867 expressed in seconds, NAN if undefined
yading@10 6868
yading@10 6869 @item prev_pts
yading@10 6870 the PTS of the previously filtered video frame, NAN if undefined
yading@10 6871
yading@10 6872 @item prev_selected_pts
yading@10 6873 the PTS of the last previously filtered video frame, NAN if undefined
yading@10 6874
yading@10 6875 @item prev_selected_t
yading@10 6876 the PTS of the last previously selected video frame, NAN if undefined
yading@10 6877
yading@10 6878 @item start_pts
yading@10 6879 the PTS of the first video frame in the video, NAN if undefined
yading@10 6880
yading@10 6881 @item start_t
yading@10 6882 the time of the first video frame in the video, NAN if undefined
yading@10 6883
yading@10 6884 @item pict_type @emph{(video only)}
yading@10 6885 the type of the filtered frame, can assume one of the following
yading@10 6886 values:
yading@10 6887 @table @option
yading@10 6888 @item I
yading@10 6889 @item P
yading@10 6890 @item B
yading@10 6891 @item S
yading@10 6892 @item SI
yading@10 6893 @item SP
yading@10 6894 @item BI
yading@10 6895 @end table
yading@10 6896
yading@10 6897 @item interlace_type @emph{(video only)}
yading@10 6898 the frame interlace type, can assume one of the following values:
yading@10 6899 @table @option
yading@10 6900 @item PROGRESSIVE
yading@10 6901 the frame is progressive (not interlaced)
yading@10 6902 @item TOPFIRST
yading@10 6903 the frame is top-field-first
yading@10 6904 @item BOTTOMFIRST
yading@10 6905 the frame is bottom-field-first
yading@10 6906 @end table
yading@10 6907
yading@10 6908 @item consumed_sample_n @emph{(audio only)}
yading@10 6909 the number of selected samples before the current frame
yading@10 6910
yading@10 6911 @item samples_n @emph{(audio only)}
yading@10 6912 the number of samples in the current frame
yading@10 6913
yading@10 6914 @item sample_rate @emph{(audio only)}
yading@10 6915 the input sample rate
yading@10 6916
yading@10 6917 @item key
yading@10 6918 1 if the filtered frame is a key-frame, 0 otherwise
yading@10 6919
yading@10 6920 @item pos
yading@10 6921 the position in the file of the filtered frame, -1 if the information
yading@10 6922 is not available (e.g. for synthetic video)
yading@10 6923
yading@10 6924 @item scene @emph{(video only)}
yading@10 6925 value between 0 and 1 to indicate a new scene; a low value reflects a low
yading@10 6926 probability for the current frame to introduce a new scene, while a higher
yading@10 6927 value means the current frame is more likely to be one (see the example below)
yading@10 6928
yading@10 6929 @end table
yading@10 6930
yading@10 6931 The default value of the select expression is "1".
yading@10 6932
yading@10 6933 @subsection Examples
yading@10 6934
yading@10 6935 @itemize
yading@10 6936 @item
yading@10 6937 Select all frames in input:
yading@10 6938 @example
yading@10 6939 select
yading@10 6940 @end example
yading@10 6941
yading@10 6942 The example above is the same as:
yading@10 6943 @example
yading@10 6944 select=1
yading@10 6945 @end example
yading@10 6946
yading@10 6947 @item
yading@10 6948 Skip all frames:
yading@10 6949 @example
yading@10 6950 select=0
yading@10 6951 @end example
yading@10 6952
yading@10 6953 @item
yading@10 6954 Select only I-frames:
yading@10 6955 @example
yading@10 6956 select='eq(pict_type\,I)'
yading@10 6957 @end example
yading@10 6958
yading@10 6959 @item
yading@10 6960 Select one frame every 100:
yading@10 6961 @example
yading@10 6962 select='not(mod(n\,100))'
yading@10 6963 @end example
yading@10 6964
yading@10 6965 @item
yading@10 6966 Select only frames contained in the 10-20 time interval:
yading@10 6967 @example
yading@10 6968 select='gte(t\,10)*lte(t\,20)'
yading@10 6969 @end example
yading@10 6970
yading@10 6971 @item
yading@10 6972 Select only I frames contained in the 10-20 time interval:
yading@10 6973 @example
yading@10 6974 select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
yading@10 6975 @end example
yading@10 6976
yading@10 6977 @item
yading@10 6978 Select frames with a minimum distance of 10 seconds:
yading@10 6979 @example
yading@10 6980 select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
yading@10 6981 @end example
yading@10 6982
yading@10 6983 @item
yading@10 6984 Use aselect to select only audio frames with samples number > 100:
yading@10 6985 @example
yading@10 6986 aselect='gt(samples_n\,100)'
yading@10 6987 @end example
yading@10 6988
yading@10 6989 @item
yading@10 6990 Create a mosaic of the first scenes:
yading@10 6991 @example
yading@10 6992 ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
yading@10 6993 @end example
yading@10 6994
yading@10 6995 Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
yading@10 6996 choice.
yading@10 6997
yading@10 6998 @item
yading@10 6999 Send even and odd frames to separate outputs, and compose them:
yading@10 7000 @example
yading@10 7001 select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
yading@10 7002 @end example
yading@10 7003 @end itemize
yading@10 7004
yading@10 7005 @section asendcmd, sendcmd
yading@10 7006
yading@10 7007 Send commands to filters in the filtergraph.
yading@10 7008
yading@10 7009 These filters read commands to be sent to other filters in the
yading@10 7010 filtergraph.
yading@10 7011
yading@10 7012 @code{asendcmd} must be inserted between two audio filters,
yading@10 7013 @code{sendcmd} must be inserted between two video filters, but apart
yading@10 7014 from that they act the same way.
yading@10 7015
yading@10 7016 The specification of commands can be provided in the filter arguments
yading@10 7017 with the @var{commands} option, or in a file specified by the
yading@10 7018 @var{filename} option.
yading@10 7019
yading@10 7020 These filters accept the following options:
yading@10 7021 @table @option
yading@10 7022 @item commands, c
yading@10 7023 Set the commands to be read and sent to the other filters.
yading@10 7024 @item filename, f
yading@10 7025 Set the filename of the commands to be read and sent to the other
yading@10 7026 filters.
yading@10 7027 @end table
yading@10 7028
yading@10 7029 @subsection Commands syntax
yading@10 7030
yading@10 7031 A commands description consists of a sequence of interval
yading@10 7032 specifications, comprising a list of commands to be executed when a
yading@10 7033 particular event related to that interval occurs. The occurring event
yading@10 7034 is typically the current frame time entering or leaving a given time
yading@10 7035 interval.
yading@10 7036
yading@10 7037 An interval is specified by the following syntax:
yading@10 7038 @example
yading@10 7039 @var{START}[-@var{END}] @var{COMMANDS};
yading@10 7040 @end example
yading@10 7041
yading@10 7042 The time interval is specified by the @var{START} and @var{END} times.
yading@10 7043 @var{END} is optional and defaults to the maximum time.
yading@10 7044
yading@10 7045 The current frame time is considered within the specified interval if
yading@10 7046 it is included in the interval [@var{START}, @var{END}), that is when
yading@10 7047 the time is greater or equal to @var{START} and is lesser than
yading@10 7048 @var{END}.
yading@10 7049
yading@10 7050 @var{COMMANDS} consists of a sequence of one or more command
yading@10 7051 specifications, separated by ",", relating to that interval. The
yading@10 7052 syntax of a command specification is given by:
yading@10 7053 @example
yading@10 7054 [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
yading@10 7055 @end example
yading@10 7056
yading@10 7057 @var{FLAGS} is optional and specifies the type of events relating to
yading@10 7058 the time interval which enable sending the specified command, and must
yading@10 7059 be a non-null sequence of identifier flags separated by "+" or "|" and
yading@10 7060 enclosed between "[" and "]".
yading@10 7061
yading@10 7062 The following flags are recognized:
yading@10 7063 @table @option
yading@10 7064 @item enter
yading@10 7065 The command is sent when the current frame timestamp enters the
yading@10 7066 specified interval. In other words, the command is sent when the
yading@10 7067 previous frame timestamp was not in the given interval, and the
yading@10 7068 current is.
yading@10 7069
yading@10 7070 @item leave
yading@10 7071 The command is sent when the current frame timestamp leaves the
yading@10 7072 specified interval. In other words, the command is sent when the
yading@10 7073 previous frame timestamp was in the given interval, and the
yading@10 7074 current is not.
yading@10 7075 @end table
yading@10 7076
yading@10 7077 If @var{FLAGS} is not specified, a default value of @code{[enter]} is
yading@10 7078 assumed.
yading@10 7079
yading@10 7080 @var{TARGET} specifies the target of the command, usually the name of
yading@10 7081 the filter class or a specific filter instance name.
yading@10 7082
yading@10 7083 @var{COMMAND} specifies the name of the command for the target filter.
yading@10 7084
yading@10 7085 @var{ARG} is optional and specifies the optional list of argument for
yading@10 7086 the given @var{COMMAND}.
yading@10 7087
yading@10 7088 Between one interval specification and another, whitespaces, or
yading@10 7089 sequences of characters starting with @code{#} until the end of line,
yading@10 7090 are ignored and can be used to annotate comments.
yading@10 7091
yading@10 7092 A simplified BNF description of the commands specification syntax
yading@10 7093 follows:
yading@10 7094 @example
yading@10 7095 @var{COMMAND_FLAG} ::= "enter" | "leave"
yading@10 7096 @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
yading@10 7097 @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
yading@10 7098 @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
yading@10 7099 @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
yading@10 7100 @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
yading@10 7101 @end example
yading@10 7102
yading@10 7103 @subsection Examples
yading@10 7104
yading@10 7105 @itemize
yading@10 7106 @item
yading@10 7107 Specify audio tempo change at second 4:
yading@10 7108 @example
yading@10 7109 asendcmd=c='4.0 atempo tempo 1.5',atempo
yading@10 7110 @end example
yading@10 7111
yading@10 7112 @item
yading@10 7113 Specify a list of drawtext and hue commands in a file.
yading@10 7114 @example
yading@10 7115 # show text in the interval 5-10
yading@10 7116 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
yading@10 7117 [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
yading@10 7118
yading@10 7119 # desaturate the image in the interval 15-20
yading@10 7120 15.0-20.0 [enter] hue s 0,
yading@10 7121 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
yading@10 7122 [leave] hue s 1,
yading@10 7123 [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
yading@10 7124
yading@10 7125 # apply an exponential saturation fade-out effect, starting from time 25
yading@10 7126 25 [enter] hue s exp(25-t)
yading@10 7127 @end example
yading@10 7128
yading@10 7129 A filtergraph allowing to read and process the above command list
yading@10 7130 stored in a file @file{test.cmd}, can be specified with:
yading@10 7131 @example
yading@10 7132 sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
yading@10 7133 @end example
yading@10 7134 @end itemize
yading@10 7135
yading@10 7136 @anchor{setpts}
yading@10 7137 @section asetpts, setpts
yading@10 7138
yading@10 7139 Change the PTS (presentation timestamp) of the input frames.
yading@10 7140
yading@10 7141 @code{asetpts} works on audio frames, @code{setpts} on video frames.
yading@10 7142
yading@10 7143 This filter accepts the following options:
yading@10 7144
yading@10 7145 @table @option
yading@10 7146
yading@10 7147 @item expr
yading@10 7148 The expression which is evaluated for each frame to construct its timestamp.
yading@10 7149
yading@10 7150 @end table
yading@10 7151
yading@10 7152 The expression is evaluated through the eval API and can contain the following
yading@10 7153 constants:
yading@10 7154
yading@10 7155 @table @option
yading@10 7156 @item FRAME_RATE
yading@10 7157 frame rate, only defined for constant frame-rate video
yading@10 7158
yading@10 7159 @item PTS
yading@10 7160 the presentation timestamp in input
yading@10 7161
yading@10 7162 @item N
yading@10 7163 the count of the input frame, starting from 0.
yading@10 7164
yading@10 7165 @item NB_CONSUMED_SAMPLES
yading@10 7166 the number of consumed samples, not including the current frame (only
yading@10 7167 audio)
yading@10 7168
yading@10 7169 @item NB_SAMPLES
yading@10 7170 the number of samples in the current frame (only audio)
yading@10 7171
yading@10 7172 @item SAMPLE_RATE
yading@10 7173 audio sample rate
yading@10 7174
yading@10 7175 @item STARTPTS
yading@10 7176 the PTS of the first frame
yading@10 7177
yading@10 7178 @item STARTT
yading@10 7179 the time in seconds of the first frame
yading@10 7180
yading@10 7181 @item INTERLACED
yading@10 7182 tell if the current frame is interlaced
yading@10 7183
yading@10 7184 @item T
yading@10 7185 the time in seconds of the current frame
yading@10 7186
yading@10 7187 @item TB
yading@10 7188 the time base
yading@10 7189
yading@10 7190 @item POS
yading@10 7191 original position in the file of the frame, or undefined if undefined
yading@10 7192 for the current frame
yading@10 7193
yading@10 7194 @item PREV_INPTS
yading@10 7195 previous input PTS
yading@10 7196
yading@10 7197 @item PREV_INT
yading@10 7198 previous input time in seconds
yading@10 7199
yading@10 7200 @item PREV_OUTPTS
yading@10 7201 previous output PTS
yading@10 7202
yading@10 7203 @item PREV_OUTT
yading@10 7204 previous output time in seconds
yading@10 7205
yading@10 7206 @item RTCTIME
yading@10 7207 wallclock (RTC) time in microseconds. This is deprecated, use time(0)
yading@10 7208 instead.
yading@10 7209
yading@10 7210 @item RTCSTART
yading@10 7211 wallclock (RTC) time at the start of the movie in microseconds
yading@10 7212 @end table
yading@10 7213
yading@10 7214 @subsection Examples
yading@10 7215
yading@10 7216 @itemize
yading@10 7217 @item
yading@10 7218 Start counting PTS from zero
yading@10 7219 @example
yading@10 7220 setpts=PTS-STARTPTS
yading@10 7221 @end example
yading@10 7222
yading@10 7223 @item
yading@10 7224 Apply fast motion effect:
yading@10 7225 @example
yading@10 7226 setpts=0.5*PTS
yading@10 7227 @end example
yading@10 7228
yading@10 7229 @item
yading@10 7230 Apply slow motion effect:
yading@10 7231 @example
yading@10 7232 setpts=2.0*PTS
yading@10 7233 @end example
yading@10 7234
yading@10 7235 @item
yading@10 7236 Set fixed rate of 25 frames per second:
yading@10 7237 @example
yading@10 7238 setpts=N/(25*TB)
yading@10 7239 @end example
yading@10 7240
yading@10 7241 @item
yading@10 7242 Set fixed rate 25 fps with some jitter:
yading@10 7243 @example
yading@10 7244 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
yading@10 7245 @end example
yading@10 7246
yading@10 7247 @item
yading@10 7248 Apply an offset of 10 seconds to the input PTS:
yading@10 7249 @example
yading@10 7250 setpts=PTS+10/TB
yading@10 7251 @end example
yading@10 7252
yading@10 7253 @item
yading@10 7254 Generate timestamps from a "live source" and rebase onto the current timebase:
yading@10 7255 @example
yading@10 7256 setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
yading@10 7257 @end example
yading@10 7258 @end itemize
yading@10 7259
yading@10 7260 @section ebur128
yading@10 7261
yading@10 7262 EBU R128 scanner filter. This filter takes an audio stream as input and outputs
yading@10 7263 it unchanged. By default, it logs a message at a frequency of 10Hz with the
yading@10 7264 Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
yading@10 7265 Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
yading@10 7266
yading@10 7267 The filter also has a video output (see the @var{video} option) with a real
yading@10 7268 time graph to observe the loudness evolution. The graphic contains the logged
yading@10 7269 message mentioned above, so it is not printed anymore when this option is set,
yading@10 7270 unless the verbose logging is set. The main graphing area contains the
yading@10 7271 short-term loudness (3 seconds of analysis), and the gauge on the right is for
yading@10 7272 the momentary loudness (400 milliseconds).
yading@10 7273
yading@10 7274 More information about the Loudness Recommendation EBU R128 on
yading@10 7275 @url{http://tech.ebu.ch/loudness}.
yading@10 7276
yading@10 7277 The filter accepts the following options:
yading@10 7278
yading@10 7279 @table @option
yading@10 7280
yading@10 7281 @item video
yading@10 7282 Activate the video output. The audio stream is passed unchanged whether this
yading@10 7283 option is set or no. The video stream will be the first output stream if
yading@10 7284 activated. Default is @code{0}.
yading@10 7285
yading@10 7286 @item size
yading@10 7287 Set the video size. This option is for video only. Default and minimum
yading@10 7288 resolution is @code{640x480}.
yading@10 7289
yading@10 7290 @item meter
yading@10 7291 Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
yading@10 7292 @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
yading@10 7293 other integer value between this range is allowed.
yading@10 7294
yading@10 7295 @item metadata
yading@10 7296 Set metadata injection. If set to @code{1}, the audio input will be segmented
yading@10 7297 into 100ms output frames, each of them containing various loudness information
yading@10 7298 in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
yading@10 7299
yading@10 7300 Default is @code{0}.
yading@10 7301
yading@10 7302 @item framelog
yading@10 7303 Force the frame logging level.
yading@10 7304
yading@10 7305 Available values are:
yading@10 7306 @table @samp
yading@10 7307 @item info
yading@10 7308 information logging level
yading@10 7309 @item verbose
yading@10 7310 verbose logging level
yading@10 7311 @end table
yading@10 7312
yading@10 7313 By default, the logging level is set to @var{info}. If the @option{video} or
yading@10 7314 the @option{metadata} options are set, it switches to @var{verbose}.
yading@10 7315 @end table
yading@10 7316
yading@10 7317 @subsection Examples
yading@10 7318
yading@10 7319 @itemize
yading@10 7320 @item
yading@10 7321 Real-time graph using @command{ffplay}, with a EBU scale meter +18:
yading@10 7322 @example
yading@10 7323 ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
yading@10 7324 @end example
yading@10 7325
yading@10 7326 @item
yading@10 7327 Run an analysis with @command{ffmpeg}:
yading@10 7328 @example
yading@10 7329 ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
yading@10 7330 @end example
yading@10 7331 @end itemize
yading@10 7332
yading@10 7333 @section settb, asettb
yading@10 7334
yading@10 7335 Set the timebase to use for the output frames timestamps.
yading@10 7336 It is mainly useful for testing timebase configuration.
yading@10 7337
yading@10 7338 This filter accepts the following options:
yading@10 7339
yading@10 7340 @table @option
yading@10 7341
yading@10 7342 @item expr, tb
yading@10 7343 The expression which is evaluated into the output timebase.
yading@10 7344
yading@10 7345 @end table
yading@10 7346
yading@10 7347 The value for @option{tb} is an arithmetic expression representing a
yading@10 7348 rational. The expression can contain the constants "AVTB" (the default
yading@10 7349 timebase), "intb" (the input timebase) and "sr" (the sample rate,
yading@10 7350 audio only). Default value is "intb".
yading@10 7351
yading@10 7352 @subsection Examples
yading@10 7353
yading@10 7354 @itemize
yading@10 7355 @item
yading@10 7356 Set the timebase to 1/25:
yading@10 7357 @example
yading@10 7358 settb=expr=1/25
yading@10 7359 @end example
yading@10 7360
yading@10 7361 @item
yading@10 7362 Set the timebase to 1/10:
yading@10 7363 @example
yading@10 7364 settb=expr=0.1
yading@10 7365 @end example
yading@10 7366
yading@10 7367 @item
yading@10 7368 Set the timebase to 1001/1000:
yading@10 7369 @example
yading@10 7370 settb=1+0.001
yading@10 7371 @end example
yading@10 7372
yading@10 7373 @item
yading@10 7374 Set the timebase to 2*intb:
yading@10 7375 @example
yading@10 7376 settb=2*intb
yading@10 7377 @end example
yading@10 7378
yading@10 7379 @item
yading@10 7380 Set the default timebase value:
yading@10 7381 @example
yading@10 7382 settb=AVTB
yading@10 7383 @end example
yading@10 7384 @end itemize
yading@10 7385
yading@10 7386 @section concat
yading@10 7387
yading@10 7388 Concatenate audio and video streams, joining them together one after the
yading@10 7389 other.
yading@10 7390
yading@10 7391 The filter works on segments of synchronized video and audio streams. All
yading@10 7392 segments must have the same number of streams of each type, and that will
yading@10 7393 also be the number of streams at output.
yading@10 7394
yading@10 7395 The filter accepts the following options:
yading@10 7396
yading@10 7397 @table @option
yading@10 7398
yading@10 7399 @item n
yading@10 7400 Set the number of segments. Default is 2.
yading@10 7401
yading@10 7402 @item v
yading@10 7403 Set the number of output video streams, that is also the number of video
yading@10 7404 streams in each segment. Default is 1.
yading@10 7405
yading@10 7406 @item a
yading@10 7407 Set the number of output audio streams, that is also the number of video
yading@10 7408 streams in each segment. Default is 0.
yading@10 7409
yading@10 7410 @item unsafe
yading@10 7411 Activate unsafe mode: do not fail if segments have a different format.
yading@10 7412
yading@10 7413 @end table
yading@10 7414
yading@10 7415 The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
yading@10 7416 @var{a} audio outputs.
yading@10 7417
yading@10 7418 There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
yading@10 7419 segment, in the same order as the outputs, then the inputs for the second
yading@10 7420 segment, etc.
yading@10 7421
yading@10 7422 Related streams do not always have exactly the same duration, for various
yading@10 7423 reasons including codec frame size or sloppy authoring. For that reason,
yading@10 7424 related synchronized streams (e.g. a video and its audio track) should be
yading@10 7425 concatenated at once. The concat filter will use the duration of the longest
yading@10 7426 stream in each segment (except the last one), and if necessary pad shorter
yading@10 7427 audio streams with silence.
yading@10 7428
yading@10 7429 For this filter to work correctly, all segments must start at timestamp 0.
yading@10 7430
yading@10 7431 All corresponding streams must have the same parameters in all segments; the
yading@10 7432 filtering system will automatically select a common pixel format for video
yading@10 7433 streams, and a common sample format, sample rate and channel layout for
yading@10 7434 audio streams, but other settings, such as resolution, must be converted
yading@10 7435 explicitly by the user.
yading@10 7436
yading@10 7437 Different frame rates are acceptable but will result in variable frame rate
yading@10 7438 at output; be sure to configure the output file to handle it.
yading@10 7439
yading@10 7440 @subsection Examples
yading@10 7441
yading@10 7442 @itemize
yading@10 7443 @item
yading@10 7444 Concatenate an opening, an episode and an ending, all in bilingual version
yading@10 7445 (video in stream 0, audio in streams 1 and 2):
yading@10 7446 @example
yading@10 7447 ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
yading@10 7448 '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
yading@10 7449 concat=n=3:v=1:a=2 [v] [a1] [a2]' \
yading@10 7450 -map '[v]' -map '[a1]' -map '[a2]' output.mkv
yading@10 7451 @end example
yading@10 7452
yading@10 7453 @item
yading@10 7454 Concatenate two parts, handling audio and video separately, using the
yading@10 7455 (a)movie sources, and adjusting the resolution:
yading@10 7456 @example
yading@10 7457 movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
yading@10 7458 movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
yading@10 7459 [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
yading@10 7460 @end example
yading@10 7461 Note that a desync will happen at the stitch if the audio and video streams
yading@10 7462 do not have exactly the same duration in the first file.
yading@10 7463
yading@10 7464 @end itemize
yading@10 7465
yading@10 7466 @section showspectrum
yading@10 7467
yading@10 7468 Convert input audio to a video output, representing the audio frequency
yading@10 7469 spectrum.
yading@10 7470
yading@10 7471 The filter accepts the following options:
yading@10 7472
yading@10 7473 @table @option
yading@10 7474 @item size, s
yading@10 7475 Specify the video size for the output. Default value is @code{640x512}.
yading@10 7476
yading@10 7477 @item slide
yading@10 7478 Specify if the spectrum should slide along the window. Default value is
yading@10 7479 @code{0}.
yading@10 7480
yading@10 7481 @item mode
yading@10 7482 Specify display mode.
yading@10 7483
yading@10 7484 It accepts the following values:
yading@10 7485 @table @samp
yading@10 7486 @item combined
yading@10 7487 all channels are displayed in the same row
yading@10 7488 @item separate
yading@10 7489 all channels are displayed in separate rows
yading@10 7490 @end table
yading@10 7491
yading@10 7492 Default value is @samp{combined}.
yading@10 7493
yading@10 7494 @item color
yading@10 7495 Specify display color mode.
yading@10 7496
yading@10 7497 It accepts the following values:
yading@10 7498 @table @samp
yading@10 7499 @item channel
yading@10 7500 each channel is displayed in a separate color
yading@10 7501 @item intensity
yading@10 7502 each channel is is displayed using the same color scheme
yading@10 7503 @end table
yading@10 7504
yading@10 7505 Default value is @samp{channel}.
yading@10 7506
yading@10 7507 @item scale
yading@10 7508 Specify scale used for calculating intensity color values.
yading@10 7509
yading@10 7510 It accepts the following values:
yading@10 7511 @table @samp
yading@10 7512 @item lin
yading@10 7513 linear
yading@10 7514 @item sqrt
yading@10 7515 square root, default
yading@10 7516 @item cbrt
yading@10 7517 cubic root
yading@10 7518 @item log
yading@10 7519 logarithmic
yading@10 7520 @end table
yading@10 7521
yading@10 7522 Default value is @samp{sqrt}.
yading@10 7523
yading@10 7524 @item saturation
yading@10 7525 Set saturation modifier for displayed colors. Negative values provide
yading@10 7526 alternative color scheme. @code{0} is no saturation at all.
yading@10 7527 Saturation must be in [-10.0, 10.0] range.
yading@10 7528 Default value is @code{1}.
yading@10 7529 @end table
yading@10 7530
yading@10 7531 The usage is very similar to the showwaves filter; see the examples in that
yading@10 7532 section.
yading@10 7533
yading@10 7534 @subsection Examples
yading@10 7535
yading@10 7536 @itemize
yading@10 7537 @item
yading@10 7538 Large window with logarithmic color scaling:
yading@10 7539 @example
yading@10 7540 showspectrum=s=1280x480:scale=log
yading@10 7541 @end example
yading@10 7542
yading@10 7543 @item
yading@10 7544 Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
yading@10 7545 @example
yading@10 7546 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
yading@10 7547 [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
yading@10 7548 @end example
yading@10 7549 @end itemize
yading@10 7550
yading@10 7551 @section showwaves
yading@10 7552
yading@10 7553 Convert input audio to a video output, representing the samples waves.
yading@10 7554
yading@10 7555 The filter accepts the following options:
yading@10 7556
yading@10 7557 @table @option
yading@10 7558 @item size, s
yading@10 7559 Specify the video size for the output. Default value is "600x240".
yading@10 7560
yading@10 7561 @item mode
yading@10 7562 Set display mode.
yading@10 7563
yading@10 7564 Available values are:
yading@10 7565 @table @samp
yading@10 7566 @item point
yading@10 7567 Draw a point for each sample.
yading@10 7568
yading@10 7569 @item line
yading@10 7570 Draw a vertical line for each sample.
yading@10 7571 @end table
yading@10 7572
yading@10 7573 Default value is @code{point}.
yading@10 7574
yading@10 7575 @item n
yading@10 7576 Set the number of samples which are printed on the same column. A
yading@10 7577 larger value will decrease the frame rate. Must be a positive
yading@10 7578 integer. This option can be set only if the value for @var{rate}
yading@10 7579 is not explicitly specified.
yading@10 7580
yading@10 7581 @item rate, r
yading@10 7582 Set the (approximate) output frame rate. This is done by setting the
yading@10 7583 option @var{n}. Default value is "25".
yading@10 7584
yading@10 7585 @end table
yading@10 7586
yading@10 7587 @subsection Examples
yading@10 7588
yading@10 7589 @itemize
yading@10 7590 @item
yading@10 7591 Output the input file audio and the corresponding video representation
yading@10 7592 at the same time:
yading@10 7593 @example
yading@10 7594 amovie=a.mp3,asplit[out0],showwaves[out1]
yading@10 7595 @end example
yading@10 7596
yading@10 7597 @item
yading@10 7598 Create a synthetic signal and show it with showwaves, forcing a
yading@10 7599 frame rate of 30 frames per second:
yading@10 7600 @example
yading@10 7601 aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
yading@10 7602 @end example
yading@10 7603 @end itemize
yading@10 7604
yading@10 7605 @section split, asplit
yading@10 7606
yading@10 7607 Split input into several identical outputs.
yading@10 7608
yading@10 7609 @code{asplit} works with audio input, @code{split} with video.
yading@10 7610
yading@10 7611 The filter accepts a single parameter which specifies the number of outputs. If
yading@10 7612 unspecified, it defaults to 2.
yading@10 7613
yading@10 7614 @subsection Examples
yading@10 7615
yading@10 7616 @itemize
yading@10 7617 @item
yading@10 7618 Create two separate outputs from the same input:
yading@10 7619 @example
yading@10 7620 [in] split [out0][out1]
yading@10 7621 @end example
yading@10 7622
yading@10 7623 @item
yading@10 7624 To create 3 or more outputs, you need to specify the number of
yading@10 7625 outputs, like in:
yading@10 7626 @example
yading@10 7627 [in] asplit=3 [out0][out1][out2]
yading@10 7628 @end example
yading@10 7629
yading@10 7630 @item
yading@10 7631 Create two separate outputs from the same input, one cropped and
yading@10 7632 one padded:
yading@10 7633 @example
yading@10 7634 [in] split [splitout1][splitout2];
yading@10 7635 [splitout1] crop=100:100:0:0 [cropout];
yading@10 7636 [splitout2] pad=200:200:100:100 [padout];
yading@10 7637 @end example
yading@10 7638
yading@10 7639 @item
yading@10 7640 Create 5 copies of the input audio with @command{ffmpeg}:
yading@10 7641 @example
yading@10 7642 ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
yading@10 7643 @end example
yading@10 7644 @end itemize
yading@10 7645
yading@10 7646 @c man end MULTIMEDIA FILTERS
yading@10 7647
yading@10 7648 @chapter Multimedia Sources
yading@10 7649 @c man begin MULTIMEDIA SOURCES
yading@10 7650
yading@10 7651 Below is a description of the currently available multimedia sources.
yading@10 7652
yading@10 7653 @section amovie
yading@10 7654
yading@10 7655 This is the same as @ref{movie} source, except it selects an audio
yading@10 7656 stream by default.
yading@10 7657
yading@10 7658 @anchor{movie}
yading@10 7659 @section movie
yading@10 7660
yading@10 7661 Read audio and/or video stream(s) from a movie container.
yading@10 7662
yading@10 7663 This filter accepts the following options:
yading@10 7664
yading@10 7665 @table @option
yading@10 7666 @item filename
yading@10 7667 The name of the resource to read (not necessarily a file but also a device or a
yading@10 7668 stream accessed through some protocol).
yading@10 7669
yading@10 7670 @item format_name, f
yading@10 7671 Specifies the format assumed for the movie to read, and can be either
yading@10 7672 the name of a container or an input device. If not specified the
yading@10 7673 format is guessed from @var{movie_name} or by probing.
yading@10 7674
yading@10 7675 @item seek_point, sp
yading@10 7676 Specifies the seek point in seconds, the frames will be output
yading@10 7677 starting from this seek point, the parameter is evaluated with
yading@10 7678 @code{av_strtod} so the numerical value may be suffixed by an IS
yading@10 7679 postfix. Default value is "0".
yading@10 7680
yading@10 7681 @item streams, s
yading@10 7682 Specifies the streams to read. Several streams can be specified,
yading@10 7683 separated by "+". The source will then have as many outputs, in the
yading@10 7684 same order. The syntax is explained in the ``Stream specifiers''
yading@10 7685 section in the ffmpeg manual. Two special names, "dv" and "da" specify
yading@10 7686 respectively the default (best suited) video and audio stream. Default
yading@10 7687 is "dv", or "da" if the filter is called as "amovie".
yading@10 7688
yading@10 7689 @item stream_index, si
yading@10 7690 Specifies the index of the video stream to read. If the value is -1,
yading@10 7691 the best suited video stream will be automatically selected. Default
yading@10 7692 value is "-1". Deprecated. If the filter is called "amovie", it will select
yading@10 7693 audio instead of video.
yading@10 7694
yading@10 7695 @item loop
yading@10 7696 Specifies how many times to read the stream in sequence.
yading@10 7697 If the value is less than 1, the stream will be read again and again.
yading@10 7698 Default value is "1".
yading@10 7699
yading@10 7700 Note that when the movie is looped the source timestamps are not
yading@10 7701 changed, so it will generate non monotonically increasing timestamps.
yading@10 7702 @end table
yading@10 7703
yading@10 7704 This filter allows to overlay a second video on top of main input of
yading@10 7705 a filtergraph as shown in this graph:
yading@10 7706 @example
yading@10 7707 input -----------> deltapts0 --> overlay --> output
yading@10 7708 ^
yading@10 7709 |
yading@10 7710 movie --> scale--> deltapts1 -------+
yading@10 7711 @end example
yading@10 7712
yading@10 7713 @subsection Examples
yading@10 7714
yading@10 7715 @itemize
yading@10 7716 @item
yading@10 7717 Skip 3.2 seconds from the start of the avi file in.avi, and overlay it
yading@10 7718 on top of the input labelled as "in":
yading@10 7719 @example
yading@10 7720 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
yading@10 7721 [in] setpts=PTS-STARTPTS [main];
yading@10 7722 [main][over] overlay=16:16 [out]
yading@10 7723 @end example
yading@10 7724
yading@10 7725 @item
yading@10 7726 Read from a video4linux2 device, and overlay it on top of the input
yading@10 7727 labelled as "in":
yading@10 7728 @example
yading@10 7729 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
yading@10 7730 [in] setpts=PTS-STARTPTS [main];
yading@10 7731 [main][over] overlay=16:16 [out]
yading@10 7732 @end example
yading@10 7733
yading@10 7734 @item
yading@10 7735 Read the first video stream and the audio stream with id 0x81 from
yading@10 7736 dvd.vob; the video is connected to the pad named "video" and the audio is
yading@10 7737 connected to the pad named "audio":
yading@10 7738 @example
yading@10 7739 movie=dvd.vob:s=v:0+#0x81 [video] [audio]
yading@10 7740 @end example
yading@10 7741 @end itemize
yading@10 7742
yading@10 7743 @c man end MULTIMEDIA SOURCES