]> git.sesse.net Git - ffmpeg/blob - doc/filters.texi
avfilter/af_afir: make IR gain control more flexible
[ffmpeg] / doc / filters.texi
1 @chapter Filtering Introduction
2 @c man begin FILTERING INTRODUCTION
3
4 Filtering in FFmpeg is enabled through the libavfilter library.
5
6 In libavfilter, a filter can have multiple inputs and multiple
7 outputs.
8 To illustrate the sorts of things that are possible, we consider the
9 following filtergraph.
10
11 @verbatim
12                 [main]
13 input --> split ---------------------> overlay --> output
14             |                             ^
15             |[tmp]                  [flip]|
16             +-----> crop --> vflip -------+
17 @end verbatim
18
19 This filtergraph splits the input stream in two streams, then sends one
20 stream through the crop filter and the vflip filter, before merging it
21 back with the other stream by overlaying it on top. You can use the
22 following command to achieve this:
23
24 @example
25 ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
26 @end example
27
28 The result will be that the top half of the video is mirrored
29 onto the bottom half of the output video.
30
31 Filters in the same linear chain are separated by commas, and distinct
32 linear chains of filters are separated by semicolons. In our example,
33 @var{crop,vflip} are in one linear chain, @var{split} and
34 @var{overlay} are separately in another. The points where the linear
35 chains join are labelled by names enclosed in square brackets. In the
36 example, the split filter generates two outputs that are associated to
37 the labels @var{[main]} and @var{[tmp]}.
38
39 The stream sent to the second output of @var{split}, labelled as
40 @var{[tmp]}, is processed through the @var{crop} filter, which crops
41 away the lower half part of the video, and then vertically flipped. The
42 @var{overlay} filter takes in input the first unchanged output of the
43 split filter (which was labelled as @var{[main]}), and overlay on its
44 lower half the output generated by the @var{crop,vflip} filterchain.
45
46 Some filters take in input a list of parameters: they are specified
47 after the filter name and an equal sign, and are separated from each other
48 by a colon.
49
50 There exist so-called @var{source filters} that do not have an
51 audio/video input, and @var{sink filters} that will not have audio/video
52 output.
53
54 @c man end FILTERING INTRODUCTION
55
56 @chapter graph2dot
57 @c man begin GRAPH2DOT
58
59 The @file{graph2dot} program included in the FFmpeg @file{tools}
60 directory can be used to parse a filtergraph description and issue a
61 corresponding textual representation in the dot language.
62
63 Invoke the command:
64 @example
65 graph2dot -h
66 @end example
67
68 to see how to use @file{graph2dot}.
69
70 You can then pass the dot description to the @file{dot} program (from
71 the graphviz suite of programs) and obtain a graphical representation
72 of the filtergraph.
73
74 For example the sequence of commands:
75 @example
76 echo @var{GRAPH_DESCRIPTION} | \
77 tools/graph2dot -o graph.tmp && \
78 dot -Tpng graph.tmp -o graph.png && \
79 display graph.png
80 @end example
81
82 can be used to create and display an image representing the graph
83 described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
84 a complete self-contained graph, with its inputs and outputs explicitly defined.
85 For example if your command line is of the form:
86 @example
87 ffmpeg -i infile -vf scale=640:360 outfile
88 @end example
89 your @var{GRAPH_DESCRIPTION} string will need to be of the form:
90 @example
91 nullsrc,scale=640:360,nullsink
92 @end example
93 you may also need to set the @var{nullsrc} parameters and add a @var{format}
94 filter in order to simulate a specific input file.
95
96 @c man end GRAPH2DOT
97
98 @chapter Filtergraph description
99 @c man begin FILTERGRAPH DESCRIPTION
100
101 A filtergraph is a directed graph of connected filters. It can contain
102 cycles, and there can be multiple links between a pair of
103 filters. Each link has one input pad on one side connecting it to one
104 filter from which it takes its input, and one output pad on the other
105 side connecting it to one filter accepting its output.
106
107 Each filter in a filtergraph is an instance of a filter class
108 registered in the application, which defines the features and the
109 number of input and output pads of the filter.
110
111 A filter with no input pads is called a "source", and a filter with no
112 output pads is called a "sink".
113
114 @anchor{Filtergraph syntax}
115 @section Filtergraph syntax
116
117 A filtergraph has a textual representation, which is recognized by the
118 @option{-filter}/@option{-vf}/@option{-af} and
119 @option{-filter_complex} options in @command{ffmpeg} and
120 @option{-vf}/@option{-af} in @command{ffplay}, and by the
121 @code{avfilter_graph_parse_ptr()} function defined in
122 @file{libavfilter/avfilter.h}.
123
124 A filterchain consists of a sequence of connected filters, each one
125 connected to the previous one in the sequence. A filterchain is
126 represented by a list of ","-separated filter descriptions.
127
128 A filtergraph consists of a sequence of filterchains. A sequence of
129 filterchains is represented by a list of ";"-separated filterchain
130 descriptions.
131
132 A filter is represented by a string of the form:
133 [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
134
135 @var{filter_name} is the name of the filter class of which the
136 described filter is an instance of, and has to be the name of one of
137 the filter classes registered in the program optionally followed by "@@@var{id}".
138 The name of the filter class is optionally followed by a string
139 "=@var{arguments}".
140
141 @var{arguments} is a string which contains the parameters used to
142 initialize the filter instance. It may have one of two forms:
143 @itemize
144
145 @item
146 A ':'-separated list of @var{key=value} pairs.
147
148 @item
149 A ':'-separated list of @var{value}. In this case, the keys are assumed to be
150 the option names in the order they are declared. E.g. the @code{fade} filter
151 declares three options in this order -- @option{type}, @option{start_frame} and
152 @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
153 @var{in} is assigned to the option @option{type}, @var{0} to
154 @option{start_frame} and @var{30} to @option{nb_frames}.
155
156 @item
157 A ':'-separated list of mixed direct @var{value} and long @var{key=value}
158 pairs. The direct @var{value} must precede the @var{key=value} pairs, and
159 follow the same constraints order of the previous point. The following
160 @var{key=value} pairs can be set in any preferred order.
161
162 @end itemize
163
164 If the option value itself is a list of items (e.g. the @code{format} filter
165 takes a list of pixel formats), the items in the list are usually separated by
166 @samp{|}.
167
168 The list of arguments can be quoted using the character @samp{'} as initial
169 and ending mark, and the character @samp{\} for escaping the characters
170 within the quoted text; otherwise the argument string is considered
171 terminated when the next special character (belonging to the set
172 @samp{[]=;,}) is encountered.
173
174 The name and arguments of the filter are optionally preceded and
175 followed by a list of link labels.
176 A link label allows one to name a link and associate it to a filter output
177 or input pad. The preceding labels @var{in_link_1}
178 ... @var{in_link_N}, are associated to the filter input pads,
179 the following labels @var{out_link_1} ... @var{out_link_M}, are
180 associated to the output pads.
181
182 When two link labels with the same name are found in the
183 filtergraph, a link between the corresponding input and output pad is
184 created.
185
186 If an output pad is not labelled, it is linked by default to the first
187 unlabelled input pad of the next filter in the filterchain.
188 For example in the filterchain
189 @example
190 nullsrc, split[L1], [L2]overlay, nullsink
191 @end example
192 the split filter instance has two output pads, and the overlay filter
193 instance two input pads. The first output pad of split is labelled
194 "L1", the first input pad of overlay is labelled "L2", and the second
195 output pad of split is linked to the second input pad of overlay,
196 which are both unlabelled.
197
198 In a filter description, if the input label of the first filter is not
199 specified, "in" is assumed; if the output label of the last filter is not
200 specified, "out" is assumed.
201
202 In a complete filterchain all the unlabelled filter input and output
203 pads must be connected. A filtergraph is considered valid if all the
204 filter input and output pads of all the filterchains are connected.
205
206 Libavfilter will automatically insert @ref{scale} filters where format
207 conversion is required. It is possible to specify swscale flags
208 for those automatically inserted scalers by prepending
209 @code{sws_flags=@var{flags};}
210 to the filtergraph description.
211
212 Here is a BNF description of the filtergraph syntax:
213 @example
214 @var{NAME}             ::= sequence of alphanumeric characters and '_'
215 @var{FILTER_NAME}      ::= @var{NAME}["@@"@var{NAME}]
216 @var{LINKLABEL}        ::= "[" @var{NAME} "]"
217 @var{LINKLABELS}       ::= @var{LINKLABEL} [@var{LINKLABELS}]
218 @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
219 @var{FILTER}           ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
220 @var{FILTERCHAIN}      ::= @var{FILTER} [,@var{FILTERCHAIN}]
221 @var{FILTERGRAPH}      ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
222 @end example
223
224 @anchor{filtergraph escaping}
225 @section Notes on filtergraph escaping
226
227 Filtergraph description composition entails several levels of
228 escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
229 section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
230 information about the employed escaping procedure.
231
232 A first level escaping affects the content of each filter option
233 value, which may contain the special character @code{:} used to
234 separate values, or one of the escaping characters @code{\'}.
235
236 A second level escaping affects the whole filter description, which
237 may contain the escaping characters @code{\'} or the special
238 characters @code{[],;} used by the filtergraph description.
239
240 Finally, when you specify a filtergraph on a shell commandline, you
241 need to perform a third level escaping for the shell special
242 characters contained within it.
243
244 For example, consider the following string to be embedded in
245 the @ref{drawtext} filter description @option{text} value:
246 @example
247 this is a 'string': may contain one, or more, special characters
248 @end example
249
250 This string contains the @code{'} special escaping character, and the
251 @code{:} special character, so it needs to be escaped in this way:
252 @example
253 text=this is a \'string\'\: may contain one, or more, special characters
254 @end example
255
256 A second level of escaping is required when embedding the filter
257 description in a filtergraph description, in order to escape all the
258 filtergraph special characters. Thus the example above becomes:
259 @example
260 drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
261 @end example
262 (note that in addition to the @code{\'} escaping special characters,
263 also @code{,} needs to be escaped).
264
265 Finally an additional level of escaping is needed when writing the
266 filtergraph description in a shell command, which depends on the
267 escaping rules of the adopted shell. For example, assuming that
268 @code{\} is special and needs to be escaped with another @code{\}, the
269 previous string will finally result in:
270 @example
271 -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
272 @end example
273
274 @chapter Timeline editing
275
276 Some filters support a generic @option{enable} option. For the filters
277 supporting timeline editing, this option can be set to an expression which is
278 evaluated before sending a frame to the filter. If the evaluation is non-zero,
279 the filter will be enabled, otherwise the frame will be sent unchanged to the
280 next filter in the filtergraph.
281
282 The expression accepts the following values:
283 @table @samp
284 @item t
285 timestamp expressed in seconds, NAN if the input timestamp is unknown
286
287 @item n
288 sequential number of the input frame, starting from 0
289
290 @item pos
291 the position in the file of the input frame, NAN if unknown
292
293 @item w
294 @item h
295 width and height of the input frame if video
296 @end table
297
298 Additionally, these filters support an @option{enable} command that can be used
299 to re-define the expression.
300
301 Like any other filtering option, the @option{enable} option follows the same
302 rules.
303
304 For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
305 minutes, and a @ref{curves} filter starting at 3 seconds:
306 @example
307 smartblur = enable='between(t,10,3*60)',
308 curves    = enable='gte(t,3)' : preset=cross_process
309 @end example
310
311 See @code{ffmpeg -filters} to view which filters have timeline support.
312
313 @c man end FILTERGRAPH DESCRIPTION
314
315 @anchor{framesync}
316 @chapter Options for filters with several inputs (framesync)
317 @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
318
319 Some filters with several inputs support a common set of options.
320 These options can only be set by name, not with the short notation.
321
322 @table @option
323 @item eof_action
324 The action to take when EOF is encountered on the secondary input; it accepts
325 one of the following values:
326
327 @table @option
328 @item repeat
329 Repeat the last frame (the default).
330 @item endall
331 End both streams.
332 @item pass
333 Pass the main input through.
334 @end table
335
336 @item shortest
337 If set to 1, force the output to terminate when the shortest input
338 terminates. Default value is 0.
339
340 @item repeatlast
341 If set to 1, force the filter to extend the last frame of secondary streams
342 until the end of the primary stream. A value of 0 disables this behavior.
343 Default value is 1.
344 @end table
345
346 @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
347
348 @chapter Audio Filters
349 @c man begin AUDIO FILTERS
350
351 When you configure your FFmpeg build, you can disable any of the
352 existing filters using @code{--disable-filters}.
353 The configure output will show the audio filters included in your
354 build.
355
356 Below is a description of the currently available audio filters.
357
358 @section acompressor
359
360 A compressor is mainly used to reduce the dynamic range of a signal.
361 Especially modern music is mostly compressed at a high ratio to
362 improve the overall loudness. It's done to get the highest attention
363 of a listener, "fatten" the sound and bring more "power" to the track.
364 If a signal is compressed too much it may sound dull or "dead"
365 afterwards or it may start to "pump" (which could be a powerful effect
366 but can also destroy a track completely).
367 The right compression is the key to reach a professional sound and is
368 the high art of mixing and mastering. Because of its complex settings
369 it may take a long time to get the right feeling for this kind of effect.
370
371 Compression is done by detecting the volume above a chosen level
372 @code{threshold} and dividing it by the factor set with @code{ratio}.
373 So if you set the threshold to -12dB and your signal reaches -6dB a ratio
374 of 2:1 will result in a signal at -9dB. Because an exact manipulation of
375 the signal would cause distortion of the waveform the reduction can be
376 levelled over the time. This is done by setting "Attack" and "Release".
377 @code{attack} determines how long the signal has to rise above the threshold
378 before any reduction will occur and @code{release} sets the time the signal
379 has to fall below the threshold to reduce the reduction again. Shorter signals
380 than the chosen attack time will be left untouched.
381 The overall reduction of the signal can be made up afterwards with the
382 @code{makeup} setting. So compressing the peaks of a signal about 6dB and
383 raising the makeup to this level results in a signal twice as loud than the
384 source. To gain a softer entry in the compression the @code{knee} flattens the
385 hard edge at the threshold in the range of the chosen decibels.
386
387 The filter accepts the following options:
388
389 @table @option
390 @item level_in
391 Set input gain. Default is 1. Range is between 0.015625 and 64.
392
393 @item threshold
394 If a signal of stream rises above this level it will affect the gain
395 reduction.
396 By default it is 0.125. Range is between 0.00097563 and 1.
397
398 @item ratio
399 Set a ratio by which the signal is reduced. 1:2 means that if the level
400 rose 4dB above the threshold, it will be only 2dB above after the reduction.
401 Default is 2. Range is between 1 and 20.
402
403 @item attack
404 Amount of milliseconds the signal has to rise above the threshold before gain
405 reduction starts. Default is 20. Range is between 0.01 and 2000.
406
407 @item release
408 Amount of milliseconds the signal has to fall below the threshold before
409 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
410
411 @item makeup
412 Set the amount by how much signal will be amplified after processing.
413 Default is 1. Range is from 1 to 64.
414
415 @item knee
416 Curve the sharp knee around the threshold to enter gain reduction more softly.
417 Default is 2.82843. Range is between 1 and 8.
418
419 @item link
420 Choose if the @code{average} level between all channels of input stream
421 or the louder(@code{maximum}) channel of input stream affects the
422 reduction. Default is @code{average}.
423
424 @item detection
425 Should the exact signal be taken in case of @code{peak} or an RMS one in case
426 of @code{rms}. Default is @code{rms} which is mostly smoother.
427
428 @item mix
429 How much to use compressed signal in output. Default is 1.
430 Range is between 0 and 1.
431 @end table
432
433 @section acontrast
434 Simple audio dynamic range commpression/expansion filter.
435
436 The filter accepts the following options:
437
438 @table @option
439 @item contrast
440 Set contrast. Default is 33. Allowed range is between 0 and 100.
441 @end table
442
443 @section acopy
444
445 Copy the input audio source unchanged to the output. This is mainly useful for
446 testing purposes.
447
448 @section acrossfade
449
450 Apply cross fade from one input audio stream to another input audio stream.
451 The cross fade is applied for specified duration near the end of first stream.
452
453 The filter accepts the following options:
454
455 @table @option
456 @item nb_samples, ns
457 Specify the number of samples for which the cross fade effect has to last.
458 At the end of the cross fade effect the first input audio will be completely
459 silent. Default is 44100.
460
461 @item duration, d
462 Specify the duration of the cross fade effect. See
463 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
464 for the accepted syntax.
465 By default the duration is determined by @var{nb_samples}.
466 If set this option is used instead of @var{nb_samples}.
467
468 @item overlap, o
469 Should first stream end overlap with second stream start. Default is enabled.
470
471 @item curve1
472 Set curve for cross fade transition for first stream.
473
474 @item curve2
475 Set curve for cross fade transition for second stream.
476
477 For description of available curve types see @ref{afade} filter description.
478 @end table
479
480 @subsection Examples
481
482 @itemize
483 @item
484 Cross fade from one input to another:
485 @example
486 ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
487 @end example
488
489 @item
490 Cross fade from one input to another but without overlapping:
491 @example
492 ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
493 @end example
494 @end itemize
495
496 @section acrossover
497 Split audio stream into several bands.
498
499 This filter splits audio stream into two or more frequency ranges.
500 Summing all streams back will give flat output.
501
502 The filter accepts the following options:
503
504 @table @option
505 @item split
506 Set split frequencies. Those must be positive and increasing.
507
508 @item order
509 Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
510 Default is @var{4th}.
511 @end table
512
513 @section acrusher
514
515 Reduce audio bit resolution.
516
517 This filter is bit crusher with enhanced functionality. A bit crusher
518 is used to audibly reduce number of bits an audio signal is sampled
519 with. This doesn't change the bit depth at all, it just produces the
520 effect. Material reduced in bit depth sounds more harsh and "digital".
521 This filter is able to even round to continuous values instead of discrete
522 bit depths.
523 Additionally it has a D/C offset which results in different crushing of
524 the lower and the upper half of the signal.
525 An Anti-Aliasing setting is able to produce "softer" crushing sounds.
526
527 Another feature of this filter is the logarithmic mode.
528 This setting switches from linear distances between bits to logarithmic ones.
529 The result is a much more "natural" sounding crusher which doesn't gate low
530 signals for example. The human ear has a logarithmic perception,
531 so this kind of crushing is much more pleasant.
532 Logarithmic crushing is also able to get anti-aliased.
533
534 The filter accepts the following options:
535
536 @table @option
537 @item level_in
538 Set level in.
539
540 @item level_out
541 Set level out.
542
543 @item bits
544 Set bit reduction.
545
546 @item mix
547 Set mixing amount.
548
549 @item mode
550 Can be linear: @code{lin} or logarithmic: @code{log}.
551
552 @item dc
553 Set DC.
554
555 @item aa
556 Set anti-aliasing.
557
558 @item samples
559 Set sample reduction.
560
561 @item lfo
562 Enable LFO. By default disabled.
563
564 @item lforange
565 Set LFO range.
566
567 @item lforate
568 Set LFO rate.
569 @end table
570
571 @section acue
572
573 Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
574 filter.
575
576 @section adeclick
577 Remove impulsive noise from input audio.
578
579 Samples detected as impulsive noise are replaced by interpolated samples using
580 autoregressive modelling.
581
582 @table @option
583 @item w
584 Set window size, in milliseconds. Allowed range is from @code{10} to
585 @code{100}. Default value is @code{55} milliseconds.
586 This sets size of window which will be processed at once.
587
588 @item o
589 Set window overlap, in percentage of window size. Allowed range is from
590 @code{50} to @code{95}. Default value is @code{75} percent.
591 Setting this to a very high value increases impulsive noise removal but makes
592 whole process much slower.
593
594 @item a
595 Set autoregression order, in percentage of window size. Allowed range is from
596 @code{0} to @code{25}. Default value is @code{2} percent. This option also
597 controls quality of interpolated samples using neighbour good samples.
598
599 @item t
600 Set threshold value. Allowed range is from @code{1} to @code{100}.
601 Default value is @code{2}.
602 This controls the strength of impulsive noise which is going to be removed.
603 The lower value, the more samples will be detected as impulsive noise.
604
605 @item b
606 Set burst fusion, in percentage of window size. Allowed range is @code{0} to
607 @code{10}. Default value is @code{2}.
608 If any two samples deteced as noise are spaced less than this value then any
609 sample inbetween those two samples will be also detected as noise.
610
611 @item m
612 Set overlap method.
613
614 It accepts the following values:
615 @table @option
616 @item a
617 Select overlap-add method. Even not interpolated samples are slightly
618 changed with this method.
619
620 @item s
621 Select overlap-save method. Not interpolated samples remain unchanged.
622 @end table
623
624 Default value is @code{a}.
625 @end table
626
627 @section adeclip
628 Remove clipped samples from input audio.
629
630 Samples detected as clipped are replaced by interpolated samples using
631 autoregressive modelling.
632
633 @table @option
634 @item w
635 Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
636 Default value is @code{55} milliseconds.
637 This sets size of window which will be processed at once.
638
639 @item o
640 Set window overlap, in percentage of window size. Allowed range is from @code{50}
641 to @code{95}. Default value is @code{75} percent.
642
643 @item a
644 Set autoregression order, in percentage of window size. Allowed range is from
645 @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
646 quality of interpolated samples using neighbour good samples.
647
648 @item t
649 Set threshold value. Allowed range is from @code{1} to @code{100}.
650 Default value is @code{10}. Higher values make clip detection less aggressive.
651
652 @item n
653 Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
654 Default value is @code{1000}. Higher values make clip detection less aggressive.
655
656 @item m
657 Set overlap method.
658
659 It accepts the following values:
660 @table @option
661 @item a
662 Select overlap-add method. Even not interpolated samples are slightly changed
663 with this method.
664
665 @item s
666 Select overlap-save method. Not interpolated samples remain unchanged.
667 @end table
668
669 Default value is @code{a}.
670 @end table
671
672 @section adelay
673
674 Delay one or more audio channels.
675
676 Samples in delayed channel are filled with silence.
677
678 The filter accepts the following option:
679
680 @table @option
681 @item delays
682 Set list of delays in milliseconds for each channel separated by '|'.
683 Unused delays will be silently ignored. If number of given delays is
684 smaller than number of channels all remaining channels will not be delayed.
685 If you want to delay exact number of samples, append 'S' to number.
686 @end table
687
688 @subsection Examples
689
690 @itemize
691 @item
692 Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
693 the second channel (and any other channels that may be present) unchanged.
694 @example
695 adelay=1500|0|500
696 @end example
697
698 @item
699 Delay second channel by 500 samples, the third channel by 700 samples and leave
700 the first channel (and any other channels that may be present) unchanged.
701 @example
702 adelay=0|500S|700S
703 @end example
704 @end itemize
705
706 @section aderivative, aintegral
707
708 Compute derivative/integral of audio stream.
709
710 Applying both filters one after another produces original audio.
711
712 @section aecho
713
714 Apply echoing to the input audio.
715
716 Echoes are reflected sound and can occur naturally amongst mountains
717 (and sometimes large buildings) when talking or shouting; digital echo
718 effects emulate this behaviour and are often used to help fill out the
719 sound of a single instrument or vocal. The time difference between the
720 original signal and the reflection is the @code{delay}, and the
721 loudness of the reflected signal is the @code{decay}.
722 Multiple echoes can have different delays and decays.
723
724 A description of the accepted parameters follows.
725
726 @table @option
727 @item in_gain
728 Set input gain of reflected signal. Default is @code{0.6}.
729
730 @item out_gain
731 Set output gain of reflected signal. Default is @code{0.3}.
732
733 @item delays
734 Set list of time intervals in milliseconds between original signal and reflections
735 separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
736 Default is @code{1000}.
737
738 @item decays
739 Set list of loudness of reflected signals separated by '|'.
740 Allowed range for each @code{decay} is @code{(0 - 1.0]}.
741 Default is @code{0.5}.
742 @end table
743
744 @subsection Examples
745
746 @itemize
747 @item
748 Make it sound as if there are twice as many instruments as are actually playing:
749 @example
750 aecho=0.8:0.88:60:0.4
751 @end example
752
753 @item
754 If delay is very short, then it sound like a (metallic) robot playing music:
755 @example
756 aecho=0.8:0.88:6:0.4
757 @end example
758
759 @item
760 A longer delay will sound like an open air concert in the mountains:
761 @example
762 aecho=0.8:0.9:1000:0.3
763 @end example
764
765 @item
766 Same as above but with one more mountain:
767 @example
768 aecho=0.8:0.9:1000|1800:0.3|0.25
769 @end example
770 @end itemize
771
772 @section aemphasis
773 Audio emphasis filter creates or restores material directly taken from LPs or
774 emphased CDs with different filter curves. E.g. to store music on vinyl the
775 signal has to be altered by a filter first to even out the disadvantages of
776 this recording medium.
777 Once the material is played back the inverse filter has to be applied to
778 restore the distortion of the frequency response.
779
780 The filter accepts the following options:
781
782 @table @option
783 @item level_in
784 Set input gain.
785
786 @item level_out
787 Set output gain.
788
789 @item mode
790 Set filter mode. For restoring material use @code{reproduction} mode, otherwise
791 use @code{production} mode. Default is @code{reproduction} mode.
792
793 @item type
794 Set filter type. Selects medium. Can be one of the following:
795
796 @table @option
797 @item col
798 select Columbia.
799 @item emi
800 select EMI.
801 @item bsi
802 select BSI (78RPM).
803 @item riaa
804 select RIAA.
805 @item cd
806 select Compact Disc (CD).
807 @item 50fm
808 select 50µs (FM).
809 @item 75fm
810 select 75µs (FM).
811 @item 50kf
812 select 50µs (FM-KF).
813 @item 75kf
814 select 75µs (FM-KF).
815 @end table
816 @end table
817
818 @section aeval
819
820 Modify an audio signal according to the specified expressions.
821
822 This filter accepts one or more expressions (one for each channel),
823 which are evaluated and used to modify a corresponding audio signal.
824
825 It accepts the following parameters:
826
827 @table @option
828 @item exprs
829 Set the '|'-separated expressions list for each separate channel. If
830 the number of input channels is greater than the number of
831 expressions, the last specified expression is used for the remaining
832 output channels.
833
834 @item channel_layout, c
835 Set output channel layout. If not specified, the channel layout is
836 specified by the number of expressions. If set to @samp{same}, it will
837 use by default the same input channel layout.
838 @end table
839
840 Each expression in @var{exprs} can contain the following constants and functions:
841
842 @table @option
843 @item ch
844 channel number of the current expression
845
846 @item n
847 number of the evaluated sample, starting from 0
848
849 @item s
850 sample rate
851
852 @item t
853 time of the evaluated sample expressed in seconds
854
855 @item nb_in_channels
856 @item nb_out_channels
857 input and output number of channels
858
859 @item val(CH)
860 the value of input channel with number @var{CH}
861 @end table
862
863 Note: this filter is slow. For faster processing you should use a
864 dedicated filter.
865
866 @subsection Examples
867
868 @itemize
869 @item
870 Half volume:
871 @example
872 aeval=val(ch)/2:c=same
873 @end example
874
875 @item
876 Invert phase of the second channel:
877 @example
878 aeval=val(0)|-val(1)
879 @end example
880 @end itemize
881
882 @anchor{afade}
883 @section afade
884
885 Apply fade-in/out effect to input audio.
886
887 A description of the accepted parameters follows.
888
889 @table @option
890 @item type, t
891 Specify the effect type, can be either @code{in} for fade-in, or
892 @code{out} for a fade-out effect. Default is @code{in}.
893
894 @item start_sample, ss
895 Specify the number of the start sample for starting to apply the fade
896 effect. Default is 0.
897
898 @item nb_samples, ns
899 Specify the number of samples for which the fade effect has to last. At
900 the end of the fade-in effect the output audio will have the same
901 volume as the input audio, at the end of the fade-out transition
902 the output audio will be silence. Default is 44100.
903
904 @item start_time, st
905 Specify the start time of the fade effect. Default is 0.
906 The value must be specified as a time duration; see
907 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
908 for the accepted syntax.
909 If set this option is used instead of @var{start_sample}.
910
911 @item duration, d
912 Specify the duration of the fade effect. See
913 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
914 for the accepted syntax.
915 At the end of the fade-in effect the output audio will have the same
916 volume as the input audio, at the end of the fade-out transition
917 the output audio will be silence.
918 By default the duration is determined by @var{nb_samples}.
919 If set this option is used instead of @var{nb_samples}.
920
921 @item curve
922 Set curve for fade transition.
923
924 It accepts the following values:
925 @table @option
926 @item tri
927 select triangular, linear slope (default)
928 @item qsin
929 select quarter of sine wave
930 @item hsin
931 select half of sine wave
932 @item esin
933 select exponential sine wave
934 @item log
935 select logarithmic
936 @item ipar
937 select inverted parabola
938 @item qua
939 select quadratic
940 @item cub
941 select cubic
942 @item squ
943 select square root
944 @item cbr
945 select cubic root
946 @item par
947 select parabola
948 @item exp
949 select exponential
950 @item iqsin
951 select inverted quarter of sine wave
952 @item ihsin
953 select inverted half of sine wave
954 @item dese
955 select double-exponential seat
956 @item desi
957 select double-exponential sigmoid
958 @end table
959 @end table
960
961 @subsection Examples
962
963 @itemize
964 @item
965 Fade in first 15 seconds of audio:
966 @example
967 afade=t=in:ss=0:d=15
968 @end example
969
970 @item
971 Fade out last 25 seconds of a 900 seconds audio:
972 @example
973 afade=t=out:st=875:d=25
974 @end example
975 @end itemize
976
977 @section afftdn
978 Denoise audio samples with FFT.
979
980 A description of the accepted parameters follows.
981
982 @table @option
983 @item nr
984 Set the noise reduction in dB, allowed range is 0.01 to 97.
985 Default value is 12 dB.
986
987 @item nf
988 Set the noise floor in dB, allowed range is -80 to -20.
989 Default value is -50 dB.
990
991 @item nt
992 Set the noise type.
993
994 It accepts the following values:
995 @table @option
996 @item w
997 Select white noise.
998
999 @item v
1000 Select vinyl noise.
1001
1002 @item s
1003 Select shellac noise.
1004
1005 @item c
1006 Select custom noise, defined in @code{bn} option.
1007
1008 Default value is white noise.
1009 @end table
1010
1011 @item bn
1012 Set custom band noise for every one of 15 bands.
1013 Bands are separated by ' ' or '|'.
1014
1015 @item rf
1016 Set the residual floor in dB, allowed range is -80 to -20.
1017 Default value is -38 dB.
1018
1019 @item tn
1020 Enable noise tracking. By default is disabled.
1021 With this enabled, noise floor is automatically adjusted.
1022
1023 @item tr
1024 Enable residual tracking. By default is disabled.
1025
1026 @item om
1027 Set the output mode.
1028
1029 It accepts the following values:
1030 @table @option
1031 @item i
1032 Pass input unchanged.
1033
1034 @item o
1035 Pass noise filtered out.
1036
1037 @item n
1038 Pass only noise.
1039
1040 Default value is @var{o}.
1041 @end table
1042 @end table
1043
1044 @subsection Commands
1045
1046 This filter supports the following commands:
1047 @table @option
1048 @item sample_noise, sn
1049 Start or stop measuring noise profile.
1050 Syntax for the command is : "start" or "stop" string.
1051 After measuring noise profile is stopped it will be
1052 automatically applied in filtering.
1053
1054 @item noise_reduction, nr
1055 Change noise reduction. Argument is single float number.
1056 Syntax for the command is : "@var{noise_reduction}"
1057
1058 @item noise_floor, nf
1059 Change noise floor. Argument is single float number.
1060 Syntax for the command is : "@var{noise_floor}"
1061
1062 @item output_mode, om
1063 Change output mode operation.
1064 Syntax for the command is : "i", "o" or "n" string.
1065 @end table
1066
1067 @section afftfilt
1068 Apply arbitrary expressions to samples in frequency domain.
1069
1070 @table @option
1071 @item real
1072 Set frequency domain real expression for each separate channel separated
1073 by '|'. Default is "1".
1074 If the number of input channels is greater than the number of
1075 expressions, the last specified expression is used for the remaining
1076 output channels.
1077
1078 @item imag
1079 Set frequency domain imaginary expression for each separate channel
1080 separated by '|'. If not set, @var{real} option is used.
1081
1082 Each expression in @var{real} and @var{imag} can contain the following
1083 constants:
1084
1085 @table @option
1086 @item sr
1087 sample rate
1088
1089 @item b
1090 current frequency bin number
1091
1092 @item nb
1093 number of available bins
1094
1095 @item ch
1096 channel number of the current expression
1097
1098 @item chs
1099 number of channels
1100
1101 @item pts
1102 current frame pts
1103 @end table
1104
1105 @item win_size
1106 Set window size.
1107
1108 It accepts the following values:
1109 @table @samp
1110 @item w16
1111 @item w32
1112 @item w64
1113 @item w128
1114 @item w256
1115 @item w512
1116 @item w1024
1117 @item w2048
1118 @item w4096
1119 @item w8192
1120 @item w16384
1121 @item w32768
1122 @item w65536
1123 @end table
1124 Default is @code{w4096}
1125
1126 @item win_func
1127 Set window function. Default is @code{hann}.
1128
1129 @item overlap
1130 Set window overlap. If set to 1, the recommended overlap for selected
1131 window function will be picked. Default is @code{0.75}.
1132 @end table
1133
1134 @subsection Examples
1135
1136 @itemize
1137 @item
1138 Leave almost only low frequencies in audio:
1139 @example
1140 afftfilt="1-clip((b/nb)*b,0,1)"
1141 @end example
1142 @end itemize
1143
1144 @anchor{afir}
1145 @section afir
1146
1147 Apply an arbitrary Frequency Impulse Response filter.
1148
1149 This filter is designed for applying long FIR filters,
1150 up to 60 seconds long.
1151
1152 It can be used as component for digital crossover filters,
1153 room equalization, cross talk cancellation, wavefield synthesis,
1154 auralization, ambiophonics and ambisonics.
1155
1156 This filter uses second stream as FIR coefficients.
1157 If second stream holds single channel, it will be used
1158 for all input channels in first stream, otherwise
1159 number of channels in second stream must be same as
1160 number of channels in first stream.
1161
1162 It accepts the following parameters:
1163
1164 @table @option
1165 @item dry
1166 Set dry gain. This sets input gain.
1167
1168 @item wet
1169 Set wet gain. This sets final output gain.
1170
1171 @item length
1172 Set Impulse Response filter length. Default is 1, which means whole IR is processed.
1173
1174 @item again
1175 Enable applying gain measured from power of IR. For approach to use for measuring power
1176 of IR see next option.
1177
1178 @item gtype
1179 Set which approach to use for auto gain measurement.
1180
1181 @table @option
1182 @item peak
1183 select peak gain, very conservative approach. This is default value.
1184
1185 @item dc
1186 select DC gain, limited application.
1187
1188 @item gn
1189 select gain to noise approach, this is most popular one.
1190 @end table
1191
1192 @item irgain
1193 Set gain to be applied to IR coefficients before filtering.
1194 Allowed range is 0 to 1. This can be set even with @var{again} used.
1195
1196 @item maxir
1197 Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
1198 Allowed range is 0.1 to 60 seconds.
1199
1200 @item response
1201 Show IR frequency reponse, magnitude and phase in additional video stream.
1202 By default it is disabled.
1203
1204 @item channel
1205 Set for which IR channel to display frequency response. By default is first channel
1206 displayed. This option is used only when @var{response} is enabled.
1207
1208 @item size
1209 Set video stream size. This option is used only when @var{response} is enabled.
1210 @end table
1211
1212 @subsection Examples
1213
1214 @itemize
1215 @item
1216 Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
1217 @example
1218 ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
1219 @end example
1220 @end itemize
1221
1222 @anchor{aformat}
1223 @section aformat
1224
1225 Set output format constraints for the input audio. The framework will
1226 negotiate the most appropriate format to minimize conversions.
1227
1228 It accepts the following parameters:
1229 @table @option
1230
1231 @item sample_fmts
1232 A '|'-separated list of requested sample formats.
1233
1234 @item sample_rates
1235 A '|'-separated list of requested sample rates.
1236
1237 @item channel_layouts
1238 A '|'-separated list of requested channel layouts.
1239
1240 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
1241 for the required syntax.
1242 @end table
1243
1244 If a parameter is omitted, all values are allowed.
1245
1246 Force the output to either unsigned 8-bit or signed 16-bit stereo
1247 @example
1248 aformat=sample_fmts=u8|s16:channel_layouts=stereo
1249 @end example
1250
1251 @section agate
1252
1253 A gate is mainly used to reduce lower parts of a signal. This kind of signal
1254 processing reduces disturbing noise between useful signals.
1255
1256 Gating is done by detecting the volume below a chosen level @var{threshold}
1257 and dividing it by the factor set with @var{ratio}. The bottom of the noise
1258 floor is set via @var{range}. Because an exact manipulation of the signal
1259 would cause distortion of the waveform the reduction can be levelled over
1260 time. This is done by setting @var{attack} and @var{release}.
1261
1262 @var{attack} determines how long the signal has to fall below the threshold
1263 before any reduction will occur and @var{release} sets the time the signal
1264 has to rise above the threshold to reduce the reduction again.
1265 Shorter signals than the chosen attack time will be left untouched.
1266
1267 @table @option
1268 @item level_in
1269 Set input level before filtering.
1270 Default is 1. Allowed range is from 0.015625 to 64.
1271
1272 @item range
1273 Set the level of gain reduction when the signal is below the threshold.
1274 Default is 0.06125. Allowed range is from 0 to 1.
1275
1276 @item threshold
1277 If a signal rises above this level the gain reduction is released.
1278 Default is 0.125. Allowed range is from 0 to 1.
1279
1280 @item ratio
1281 Set a ratio by which the signal is reduced.
1282 Default is 2. Allowed range is from 1 to 9000.
1283
1284 @item attack
1285 Amount of milliseconds the signal has to rise above the threshold before gain
1286 reduction stops.
1287 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
1288
1289 @item release
1290 Amount of milliseconds the signal has to fall below the threshold before the
1291 reduction is increased again. Default is 250 milliseconds.
1292 Allowed range is from 0.01 to 9000.
1293
1294 @item makeup
1295 Set amount of amplification of signal after processing.
1296 Default is 1. Allowed range is from 1 to 64.
1297
1298 @item knee
1299 Curve the sharp knee around the threshold to enter gain reduction more softly.
1300 Default is 2.828427125. Allowed range is from 1 to 8.
1301
1302 @item detection
1303 Choose if exact signal should be taken for detection or an RMS like one.
1304 Default is @code{rms}. Can be @code{peak} or @code{rms}.
1305
1306 @item link
1307 Choose if the average level between all channels or the louder channel affects
1308 the reduction.
1309 Default is @code{average}. Can be @code{average} or @code{maximum}.
1310 @end table
1311
1312 @section aiir
1313
1314 Apply an arbitrary Infinite Impulse Response filter.
1315
1316 It accepts the following parameters:
1317
1318 @table @option
1319 @item z
1320 Set numerator/zeros coefficients.
1321
1322 @item p
1323 Set denominator/poles coefficients.
1324
1325 @item k
1326 Set channels gains.
1327
1328 @item dry_gain
1329 Set input gain.
1330
1331 @item wet_gain
1332 Set output gain.
1333
1334 @item f
1335 Set coefficients format.
1336
1337 @table @samp
1338 @item tf
1339 transfer function
1340 @item zp
1341 Z-plane zeros/poles, cartesian (default)
1342 @item pr
1343 Z-plane zeros/poles, polar radians
1344 @item pd
1345 Z-plane zeros/poles, polar degrees
1346 @end table
1347
1348 @item r
1349 Set kind of processing.
1350 Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
1351
1352 @item e
1353 Set filtering precision.
1354
1355 @table @samp
1356 @item dbl
1357 double-precision floating-point (default)
1358 @item flt
1359 single-precision floating-point
1360 @item i32
1361 32-bit integers
1362 @item i16
1363 16-bit integers
1364 @end table
1365
1366 @item response
1367 Show IR frequency reponse, magnitude and phase in additional video stream.
1368 By default it is disabled.
1369
1370 @item channel
1371 Set for which IR channel to display frequency response. By default is first channel
1372 displayed. This option is used only when @var{response} is enabled.
1373
1374 @item size
1375 Set video stream size. This option is used only when @var{response} is enabled.
1376 @end table
1377
1378 Coefficients in @code{tf} format are separated by spaces and are in ascending
1379 order.
1380
1381 Coefficients in @code{zp} format are separated by spaces and order of coefficients
1382 doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
1383 imaginary unit.
1384
1385 Different coefficients and gains can be provided for every channel, in such case
1386 use '|' to separate coefficients or gains. Last provided coefficients will be
1387 used for all remaining channels.
1388
1389 @subsection Examples
1390
1391 @itemize
1392 @item
1393 Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
1394 @example
1395 aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
1396 @end example
1397
1398 @item
1399 Same as above but in @code{zp} format:
1400 @example
1401 aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
1402 @end example
1403 @end itemize
1404
1405 @section alimiter
1406
1407 The limiter prevents an input signal from rising over a desired threshold.
1408 This limiter uses lookahead technology to prevent your signal from distorting.
1409 It means that there is a small delay after the signal is processed. Keep in mind
1410 that the delay it produces is the attack time you set.
1411
1412 The filter accepts the following options:
1413
1414 @table @option
1415 @item level_in
1416 Set input gain. Default is 1.
1417
1418 @item level_out
1419 Set output gain. Default is 1.
1420
1421 @item limit
1422 Don't let signals above this level pass the limiter. Default is 1.
1423
1424 @item attack
1425 The limiter will reach its attenuation level in this amount of time in
1426 milliseconds. Default is 5 milliseconds.
1427
1428 @item release
1429 Come back from limiting to attenuation 1.0 in this amount of milliseconds.
1430 Default is 50 milliseconds.
1431
1432 @item asc
1433 When gain reduction is always needed ASC takes care of releasing to an
1434 average reduction level rather than reaching a reduction of 0 in the release
1435 time.
1436
1437 @item asc_level
1438 Select how much the release time is affected by ASC, 0 means nearly no changes
1439 in release time while 1 produces higher release times.
1440
1441 @item level
1442 Auto level output signal. Default is enabled.
1443 This normalizes audio back to 0dB if enabled.
1444 @end table
1445
1446 Depending on picked setting it is recommended to upsample input 2x or 4x times
1447 with @ref{aresample} before applying this filter.
1448
1449 @section allpass
1450
1451 Apply a two-pole all-pass filter with central frequency (in Hz)
1452 @var{frequency}, and filter-width @var{width}.
1453 An all-pass filter changes the audio's frequency to phase relationship
1454 without changing its frequency to amplitude relationship.
1455
1456 The filter accepts the following options:
1457
1458 @table @option
1459 @item frequency, f
1460 Set frequency in Hz.
1461
1462 @item width_type, t
1463 Set method to specify band-width of filter.
1464 @table @option
1465 @item h
1466 Hz
1467 @item q
1468 Q-Factor
1469 @item o
1470 octave
1471 @item s
1472 slope
1473 @item k
1474 kHz
1475 @end table
1476
1477 @item width, w
1478 Specify the band-width of a filter in width_type units.
1479
1480 @item channels, c
1481 Specify which channels to filter, by default all available are filtered.
1482 @end table
1483
1484 @subsection Commands
1485
1486 This filter supports the following commands:
1487 @table @option
1488 @item frequency, f
1489 Change allpass frequency.
1490 Syntax for the command is : "@var{frequency}"
1491
1492 @item width_type, t
1493 Change allpass width_type.
1494 Syntax for the command is : "@var{width_type}"
1495
1496 @item width, w
1497 Change allpass width.
1498 Syntax for the command is : "@var{width}"
1499 @end table
1500
1501 @section aloop
1502
1503 Loop audio samples.
1504
1505 The filter accepts the following options:
1506
1507 @table @option
1508 @item loop
1509 Set the number of loops. Setting this value to -1 will result in infinite loops.
1510 Default is 0.
1511
1512 @item size
1513 Set maximal number of samples. Default is 0.
1514
1515 @item start
1516 Set first sample of loop. Default is 0.
1517 @end table
1518
1519 @anchor{amerge}
1520 @section amerge
1521
1522 Merge two or more audio streams into a single multi-channel stream.
1523
1524 The filter accepts the following options:
1525
1526 @table @option
1527
1528 @item inputs
1529 Set the number of inputs. Default is 2.
1530
1531 @end table
1532
1533 If the channel layouts of the inputs are disjoint, and therefore compatible,
1534 the channel layout of the output will be set accordingly and the channels
1535 will be reordered as necessary. If the channel layouts of the inputs are not
1536 disjoint, the output will have all the channels of the first input then all
1537 the channels of the second input, in that order, and the channel layout of
1538 the output will be the default value corresponding to the total number of
1539 channels.
1540
1541 For example, if the first input is in 2.1 (FL+FR+LF) and the second input
1542 is FC+BL+BR, then the output will be in 5.1, with the channels in the
1543 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
1544 first input, b1 is the first channel of the second input).
1545
1546 On the other hand, if both input are in stereo, the output channels will be
1547 in the default order: a1, a2, b1, b2, and the channel layout will be
1548 arbitrarily set to 4.0, which may or may not be the expected value.
1549
1550 All inputs must have the same sample rate, and format.
1551
1552 If inputs do not have the same duration, the output will stop with the
1553 shortest.
1554
1555 @subsection Examples
1556
1557 @itemize
1558 @item
1559 Merge two mono files into a stereo stream:
1560 @example
1561 amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
1562 @end example
1563
1564 @item
1565 Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
1566 @example
1567 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
1568 @end example
1569 @end itemize
1570
1571 @section amix
1572
1573 Mixes multiple audio inputs into a single output.
1574
1575 Note that this filter only supports float samples (the @var{amerge}
1576 and @var{pan} audio filters support many formats). If the @var{amix}
1577 input has integer samples then @ref{aresample} will be automatically
1578 inserted to perform the conversion to float samples.
1579
1580 For example
1581 @example
1582 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
1583 @end example
1584 will mix 3 input audio streams to a single output with the same duration as the
1585 first input and a dropout transition time of 3 seconds.
1586
1587 It accepts the following parameters:
1588 @table @option
1589
1590 @item inputs
1591 The number of inputs. If unspecified, it defaults to 2.
1592
1593 @item duration
1594 How to determine the end-of-stream.
1595 @table @option
1596
1597 @item longest
1598 The duration of the longest input. (default)
1599
1600 @item shortest
1601 The duration of the shortest input.
1602
1603 @item first
1604 The duration of the first input.
1605
1606 @end table
1607
1608 @item dropout_transition
1609 The transition time, in seconds, for volume renormalization when an input
1610 stream ends. The default value is 2 seconds.
1611
1612 @item weights
1613 Specify weight of each input audio stream as sequence.
1614 Each weight is separated by space. By default all inputs have same weight.
1615 @end table
1616
1617 @section amultiply
1618
1619 Multiply first audio stream with second audio stream and store result
1620 in output audio stream. Multiplication is done by multiplying each
1621 sample from first stream with sample at same position from second stream.
1622
1623 With this element-wise multiplication one can create amplitude fades and
1624 amplitude modulations.
1625
1626 @section anequalizer
1627
1628 High-order parametric multiband equalizer for each channel.
1629
1630 It accepts the following parameters:
1631 @table @option
1632 @item params
1633
1634 This option string is in format:
1635 "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
1636 Each equalizer band is separated by '|'.
1637
1638 @table @option
1639 @item chn
1640 Set channel number to which equalization will be applied.
1641 If input doesn't have that channel the entry is ignored.
1642
1643 @item f
1644 Set central frequency for band.
1645 If input doesn't have that frequency the entry is ignored.
1646
1647 @item w
1648 Set band width in hertz.
1649
1650 @item g
1651 Set band gain in dB.
1652
1653 @item t
1654 Set filter type for band, optional, can be:
1655
1656 @table @samp
1657 @item 0
1658 Butterworth, this is default.
1659
1660 @item 1
1661 Chebyshev type 1.
1662
1663 @item 2
1664 Chebyshev type 2.
1665 @end table
1666 @end table
1667
1668 @item curves
1669 With this option activated frequency response of anequalizer is displayed
1670 in video stream.
1671
1672 @item size
1673 Set video stream size. Only useful if curves option is activated.
1674
1675 @item mgain
1676 Set max gain that will be displayed. Only useful if curves option is activated.
1677 Setting this to a reasonable value makes it possible to display gain which is derived from
1678 neighbour bands which are too close to each other and thus produce higher gain
1679 when both are activated.
1680
1681 @item fscale
1682 Set frequency scale used to draw frequency response in video output.
1683 Can be linear or logarithmic. Default is logarithmic.
1684
1685 @item colors
1686 Set color for each channel curve which is going to be displayed in video stream.
1687 This is list of color names separated by space or by '|'.
1688 Unrecognised or missing colors will be replaced by white color.
1689 @end table
1690
1691 @subsection Examples
1692
1693 @itemize
1694 @item
1695 Lower gain by 10 of central frequency 200Hz and width 100 Hz
1696 for first 2 channels using Chebyshev type 1 filter:
1697 @example
1698 anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
1699 @end example
1700 @end itemize
1701
1702 @subsection Commands
1703
1704 This filter supports the following commands:
1705 @table @option
1706 @item change
1707 Alter existing filter parameters.
1708 Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
1709
1710 @var{fN} is existing filter number, starting from 0, if no such filter is available
1711 error is returned.
1712 @var{freq} set new frequency parameter.
1713 @var{width} set new width parameter in herz.
1714 @var{gain} set new gain parameter in dB.
1715
1716 Full filter invocation with asendcmd may look like this:
1717 asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
1718 @end table
1719
1720 @section anull
1721
1722 Pass the audio source unchanged to the output.
1723
1724 @section apad
1725
1726 Pad the end of an audio stream with silence.
1727
1728 This can be used together with @command{ffmpeg} @option{-shortest} to
1729 extend audio streams to the same length as the video stream.
1730
1731 A description of the accepted options follows.
1732
1733 @table @option
1734 @item packet_size
1735 Set silence packet size. Default value is 4096.
1736
1737 @item pad_len
1738 Set the number of samples of silence to add to the end. After the
1739 value is reached, the stream is terminated. This option is mutually
1740 exclusive with @option{whole_len}.
1741
1742 @item whole_len
1743 Set the minimum total number of samples in the output audio stream. If
1744 the value is longer than the input audio length, silence is added to
1745 the end, until the value is reached. This option is mutually exclusive
1746 with @option{pad_len}.
1747 @end table
1748
1749 If neither the @option{pad_len} nor the @option{whole_len} option is
1750 set, the filter will add silence to the end of the input stream
1751 indefinitely.
1752
1753 @subsection Examples
1754
1755 @itemize
1756 @item
1757 Add 1024 samples of silence to the end of the input:
1758 @example
1759 apad=pad_len=1024
1760 @end example
1761
1762 @item
1763 Make sure the audio output will contain at least 10000 samples, pad
1764 the input with silence if required:
1765 @example
1766 apad=whole_len=10000
1767 @end example
1768
1769 @item
1770 Use @command{ffmpeg} to pad the audio input with silence, so that the
1771 video stream will always result the shortest and will be converted
1772 until the end in the output file when using the @option{shortest}
1773 option:
1774 @example
1775 ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
1776 @end example
1777 @end itemize
1778
1779 @section aphaser
1780 Add a phasing effect to the input audio.
1781
1782 A phaser filter creates series of peaks and troughs in the frequency spectrum.
1783 The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
1784
1785 A description of the accepted parameters follows.
1786
1787 @table @option
1788 @item in_gain
1789 Set input gain. Default is 0.4.
1790
1791 @item out_gain
1792 Set output gain. Default is 0.74
1793
1794 @item delay
1795 Set delay in milliseconds. Default is 3.0.
1796
1797 @item decay
1798 Set decay. Default is 0.4.
1799
1800 @item speed
1801 Set modulation speed in Hz. Default is 0.5.
1802
1803 @item type
1804 Set modulation type. Default is triangular.
1805
1806 It accepts the following values:
1807 @table @samp
1808 @item triangular, t
1809 @item sinusoidal, s
1810 @end table
1811 @end table
1812
1813 @section apulsator
1814
1815 Audio pulsator is something between an autopanner and a tremolo.
1816 But it can produce funny stereo effects as well. Pulsator changes the volume
1817 of the left and right channel based on a LFO (low frequency oscillator) with
1818 different waveforms and shifted phases.
1819 This filter have the ability to define an offset between left and right
1820 channel. An offset of 0 means that both LFO shapes match each other.
1821 The left and right channel are altered equally - a conventional tremolo.
1822 An offset of 50% means that the shape of the right channel is exactly shifted
1823 in phase (or moved backwards about half of the frequency) - pulsator acts as
1824 an autopanner. At 1 both curves match again. Every setting in between moves the
1825 phase shift gapless between all stages and produces some "bypassing" sounds with
1826 sine and triangle waveforms. The more you set the offset near 1 (starting from
1827 the 0.5) the faster the signal passes from the left to the right speaker.
1828
1829 The filter accepts the following options:
1830
1831 @table @option
1832 @item level_in
1833 Set input gain. By default it is 1. Range is [0.015625 - 64].
1834
1835 @item level_out
1836 Set output gain. By default it is 1. Range is [0.015625 - 64].
1837
1838 @item mode
1839 Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
1840 sawup or sawdown. Default is sine.
1841
1842 @item amount
1843 Set modulation. Define how much of original signal is affected by the LFO.
1844
1845 @item offset_l
1846 Set left channel offset. Default is 0. Allowed range is [0 - 1].
1847
1848 @item offset_r
1849 Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
1850
1851 @item width
1852 Set pulse width. Default is 1. Allowed range is [0 - 2].
1853
1854 @item timing
1855 Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
1856
1857 @item bpm
1858 Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
1859 is set to bpm.
1860
1861 @item ms
1862 Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
1863 is set to ms.
1864
1865 @item hz
1866 Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
1867 if timing is set to hz.
1868 @end table
1869
1870 @anchor{aresample}
1871 @section aresample
1872
1873 Resample the input audio to the specified parameters, using the
1874 libswresample library. If none are specified then the filter will
1875 automatically convert between its input and output.
1876
1877 This filter is also able to stretch/squeeze the audio data to make it match
1878 the timestamps or to inject silence / cut out audio to make it match the
1879 timestamps, do a combination of both or do neither.
1880
1881 The filter accepts the syntax
1882 [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
1883 expresses a sample rate and @var{resampler_options} is a list of
1884 @var{key}=@var{value} pairs, separated by ":". See the
1885 @ref{Resampler Options,,"Resampler Options" section in the
1886 ffmpeg-resampler(1) manual,ffmpeg-resampler}
1887 for the complete list of supported options.
1888
1889 @subsection Examples
1890
1891 @itemize
1892 @item
1893 Resample the input audio to 44100Hz:
1894 @example
1895 aresample=44100
1896 @end example
1897
1898 @item
1899 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
1900 samples per second compensation:
1901 @example
1902 aresample=async=1000
1903 @end example
1904 @end itemize
1905
1906 @section areverse
1907
1908 Reverse an audio clip.
1909
1910 Warning: This filter requires memory to buffer the entire clip, so trimming
1911 is suggested.
1912
1913 @subsection Examples
1914
1915 @itemize
1916 @item
1917 Take the first 5 seconds of a clip, and reverse it.
1918 @example
1919 atrim=end=5,areverse
1920 @end example
1921 @end itemize
1922
1923 @section asetnsamples
1924
1925 Set the number of samples per each output audio frame.
1926
1927 The last output packet may contain a different number of samples, as
1928 the filter will flush all the remaining samples when the input audio
1929 signals its end.
1930
1931 The filter accepts the following options:
1932
1933 @table @option
1934
1935 @item nb_out_samples, n
1936 Set the number of frames per each output audio frame. The number is
1937 intended as the number of samples @emph{per each channel}.
1938 Default value is 1024.
1939
1940 @item pad, p
1941 If set to 1, the filter will pad the last audio frame with zeroes, so
1942 that the last frame will contain the same number of samples as the
1943 previous ones. Default value is 1.
1944 @end table
1945
1946 For example, to set the number of per-frame samples to 1234 and
1947 disable padding for the last frame, use:
1948 @example
1949 asetnsamples=n=1234:p=0
1950 @end example
1951
1952 @section asetrate
1953
1954 Set the sample rate without altering the PCM data.
1955 This will result in a change of speed and pitch.
1956
1957 The filter accepts the following options:
1958
1959 @table @option
1960 @item sample_rate, r
1961 Set the output sample rate. Default is 44100 Hz.
1962 @end table
1963
1964 @section ashowinfo
1965
1966 Show a line containing various information for each input audio frame.
1967 The input audio is not modified.
1968
1969 The shown line contains a sequence of key/value pairs of the form
1970 @var{key}:@var{value}.
1971
1972 The following values are shown in the output:
1973
1974 @table @option
1975 @item n
1976 The (sequential) number of the input frame, starting from 0.
1977
1978 @item pts
1979 The presentation timestamp of the input frame, in time base units; the time base
1980 depends on the filter input pad, and is usually 1/@var{sample_rate}.
1981
1982 @item pts_time
1983 The presentation timestamp of the input frame in seconds.
1984
1985 @item pos
1986 position of the frame in the input stream, -1 if this information in
1987 unavailable and/or meaningless (for example in case of synthetic audio)
1988
1989 @item fmt
1990 The sample format.
1991
1992 @item chlayout
1993 The channel layout.
1994
1995 @item rate
1996 The sample rate for the audio frame.
1997
1998 @item nb_samples
1999 The number of samples (per channel) in the frame.
2000
2001 @item checksum
2002 The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
2003 audio, the data is treated as if all the planes were concatenated.
2004
2005 @item plane_checksums
2006 A list of Adler-32 checksums for each data plane.
2007 @end table
2008
2009 @anchor{astats}
2010 @section astats
2011
2012 Display time domain statistical information about the audio channels.
2013 Statistics are calculated and displayed for each audio channel and,
2014 where applicable, an overall figure is also given.
2015
2016 It accepts the following option:
2017 @table @option
2018 @item length
2019 Short window length in seconds, used for peak and trough RMS measurement.
2020 Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
2021
2022 @item metadata
2023
2024 Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
2025 where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
2026 disabled.
2027
2028 Available keys for each channel are:
2029 DC_offset
2030 Min_level
2031 Max_level
2032 Min_difference
2033 Max_difference
2034 Mean_difference
2035 RMS_difference
2036 Peak_level
2037 RMS_peak
2038 RMS_trough
2039 Crest_factor
2040 Flat_factor
2041 Peak_count
2042 Bit_depth
2043 Dynamic_range
2044 Zero_crossings
2045 Zero_crossings_rate
2046
2047 and for Overall:
2048 DC_offset
2049 Min_level
2050 Max_level
2051 Min_difference
2052 Max_difference
2053 Mean_difference
2054 RMS_difference
2055 Peak_level
2056 RMS_level
2057 RMS_peak
2058 RMS_trough
2059 Flat_factor
2060 Peak_count
2061 Bit_depth
2062 Number_of_samples
2063
2064 For example full key look like this @code{lavfi.astats.1.DC_offset} or
2065 this @code{lavfi.astats.Overall.Peak_count}.
2066
2067 For description what each key means read below.
2068
2069 @item reset
2070 Set number of frame after which stats are going to be recalculated.
2071 Default is disabled.
2072 @end table
2073
2074 A description of each shown parameter follows:
2075
2076 @table @option
2077 @item DC offset
2078 Mean amplitude displacement from zero.
2079
2080 @item Min level
2081 Minimal sample level.
2082
2083 @item Max level
2084 Maximal sample level.
2085
2086 @item Min difference
2087 Minimal difference between two consecutive samples.
2088
2089 @item Max difference
2090 Maximal difference between two consecutive samples.
2091
2092 @item Mean difference
2093 Mean difference between two consecutive samples.
2094 The average of each difference between two consecutive samples.
2095
2096 @item RMS difference
2097 Root Mean Square difference between two consecutive samples.
2098
2099 @item Peak level dB
2100 @item RMS level dB
2101 Standard peak and RMS level measured in dBFS.
2102
2103 @item RMS peak dB
2104 @item RMS trough dB
2105 Peak and trough values for RMS level measured over a short window.
2106
2107 @item Crest factor
2108 Standard ratio of peak to RMS level (note: not in dB).
2109
2110 @item Flat factor
2111 Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
2112 (i.e. either @var{Min level} or @var{Max level}).
2113
2114 @item Peak count
2115 Number of occasions (not the number of samples) that the signal attained either
2116 @var{Min level} or @var{Max level}.
2117
2118 @item Bit depth
2119 Overall bit depth of audio. Number of bits used for each sample.
2120
2121 @item Dynamic range
2122 Measured dynamic range of audio in dB.
2123
2124 @item Zero crossings
2125 Number of points where the waveform crosses the zero level axis.
2126
2127 @item Zero crossings rate
2128 Rate of Zero crossings and number of audio samples.
2129 @end table
2130
2131 @section atempo
2132
2133 Adjust audio tempo.
2134
2135 The filter accepts exactly one parameter, the audio tempo. If not
2136 specified then the filter will assume nominal 1.0 tempo. Tempo must
2137 be in the [0.5, 100.0] range.
2138
2139 Note that tempo greater than 2 will skip some samples rather than
2140 blend them in.  If for any reason this is a concern it is always
2141 possible to daisy-chain several instances of atempo to achieve the
2142 desired product tempo.
2143
2144 @subsection Examples
2145
2146 @itemize
2147 @item
2148 Slow down audio to 80% tempo:
2149 @example
2150 atempo=0.8
2151 @end example
2152
2153 @item
2154 To speed up audio to 300% tempo:
2155 @example
2156 atempo=3
2157 @end example
2158
2159 @item
2160 To speed up audio to 300% tempo by daisy-chaining two atempo instances:
2161 @example
2162 atempo=sqrt(3),atempo=sqrt(3)
2163 @end example
2164 @end itemize
2165
2166 @section atrim
2167
2168 Trim the input so that the output contains one continuous subpart of the input.
2169
2170 It accepts the following parameters:
2171 @table @option
2172 @item start
2173 Timestamp (in seconds) of the start of the section to keep. I.e. the audio
2174 sample with the timestamp @var{start} will be the first sample in the output.
2175
2176 @item end
2177 Specify time of the first audio sample that will be dropped, i.e. the
2178 audio sample immediately preceding the one with the timestamp @var{end} will be
2179 the last sample in the output.
2180
2181 @item start_pts
2182 Same as @var{start}, except this option sets the start timestamp in samples
2183 instead of seconds.
2184
2185 @item end_pts
2186 Same as @var{end}, except this option sets the end timestamp in samples instead
2187 of seconds.
2188
2189 @item duration
2190 The maximum duration of the output in seconds.
2191
2192 @item start_sample
2193 The number of the first sample that should be output.
2194
2195 @item end_sample
2196 The number of the first sample that should be dropped.
2197 @end table
2198
2199 @option{start}, @option{end}, and @option{duration} are expressed as time
2200 duration specifications; see
2201 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
2202
2203 Note that the first two sets of the start/end options and the @option{duration}
2204 option look at the frame timestamp, while the _sample options simply count the
2205 samples that pass through the filter. So start/end_pts and start/end_sample will
2206 give different results when the timestamps are wrong, inexact or do not start at
2207 zero. Also note that this filter does not modify the timestamps. If you wish
2208 to have the output timestamps start at zero, insert the asetpts filter after the
2209 atrim filter.
2210
2211 If multiple start or end options are set, this filter tries to be greedy and
2212 keep all samples that match at least one of the specified constraints. To keep
2213 only the part that matches all the constraints at once, chain multiple atrim
2214 filters.
2215
2216 The defaults are such that all the input is kept. So it is possible to set e.g.
2217 just the end values to keep everything before the specified time.
2218
2219 Examples:
2220 @itemize
2221 @item
2222 Drop everything except the second minute of input:
2223 @example
2224 ffmpeg -i INPUT -af atrim=60:120
2225 @end example
2226
2227 @item
2228 Keep only the first 1000 samples:
2229 @example
2230 ffmpeg -i INPUT -af atrim=end_sample=1000
2231 @end example
2232
2233 @end itemize
2234
2235 @section bandpass
2236
2237 Apply a two-pole Butterworth band-pass filter with central
2238 frequency @var{frequency}, and (3dB-point) band-width width.
2239 The @var{csg} option selects a constant skirt gain (peak gain = Q)
2240 instead of the default: constant 0dB peak gain.
2241 The filter roll off at 6dB per octave (20dB per decade).
2242
2243 The filter accepts the following options:
2244
2245 @table @option
2246 @item frequency, f
2247 Set the filter's central frequency. Default is @code{3000}.
2248
2249 @item csg
2250 Constant skirt gain if set to 1. Defaults to 0.
2251
2252 @item width_type, t
2253 Set method to specify band-width of filter.
2254 @table @option
2255 @item h
2256 Hz
2257 @item q
2258 Q-Factor
2259 @item o
2260 octave
2261 @item s
2262 slope
2263 @item k
2264 kHz
2265 @end table
2266
2267 @item width, w
2268 Specify the band-width of a filter in width_type units.
2269
2270 @item channels, c
2271 Specify which channels to filter, by default all available are filtered.
2272 @end table
2273
2274 @subsection Commands
2275
2276 This filter supports the following commands:
2277 @table @option
2278 @item frequency, f
2279 Change bandpass frequency.
2280 Syntax for the command is : "@var{frequency}"
2281
2282 @item width_type, t
2283 Change bandpass width_type.
2284 Syntax for the command is : "@var{width_type}"
2285
2286 @item width, w
2287 Change bandpass width.
2288 Syntax for the command is : "@var{width}"
2289 @end table
2290
2291 @section bandreject
2292
2293 Apply a two-pole Butterworth band-reject filter with central
2294 frequency @var{frequency}, and (3dB-point) band-width @var{width}.
2295 The filter roll off at 6dB per octave (20dB per decade).
2296
2297 The filter accepts the following options:
2298
2299 @table @option
2300 @item frequency, f
2301 Set the filter's central frequency. Default is @code{3000}.
2302
2303 @item width_type, t
2304 Set method to specify band-width of filter.
2305 @table @option
2306 @item h
2307 Hz
2308 @item q
2309 Q-Factor
2310 @item o
2311 octave
2312 @item s
2313 slope
2314 @item k
2315 kHz
2316 @end table
2317
2318 @item width, w
2319 Specify the band-width of a filter in width_type units.
2320
2321 @item channels, c
2322 Specify which channels to filter, by default all available are filtered.
2323 @end table
2324
2325 @subsection Commands
2326
2327 This filter supports the following commands:
2328 @table @option
2329 @item frequency, f
2330 Change bandreject frequency.
2331 Syntax for the command is : "@var{frequency}"
2332
2333 @item width_type, t
2334 Change bandreject width_type.
2335 Syntax for the command is : "@var{width_type}"
2336
2337 @item width, w
2338 Change bandreject width.
2339 Syntax for the command is : "@var{width}"
2340 @end table
2341
2342 @section bass, lowshelf
2343
2344 Boost or cut the bass (lower) frequencies of the audio using a two-pole
2345 shelving filter with a response similar to that of a standard
2346 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
2347
2348 The filter accepts the following options:
2349
2350 @table @option
2351 @item gain, g
2352 Give the gain at 0 Hz. Its useful range is about -20
2353 (for a large cut) to +20 (for a large boost).
2354 Beware of clipping when using a positive gain.
2355
2356 @item frequency, f
2357 Set the filter's central frequency and so can be used
2358 to extend or reduce the frequency range to be boosted or cut.
2359 The default value is @code{100} Hz.
2360
2361 @item width_type, t
2362 Set method to specify band-width of filter.
2363 @table @option
2364 @item h
2365 Hz
2366 @item q
2367 Q-Factor
2368 @item o
2369 octave
2370 @item s
2371 slope
2372 @item k
2373 kHz
2374 @end table
2375
2376 @item width, w
2377 Determine how steep is the filter's shelf transition.
2378
2379 @item channels, c
2380 Specify which channels to filter, by default all available are filtered.
2381 @end table
2382
2383 @subsection Commands
2384
2385 This filter supports the following commands:
2386 @table @option
2387 @item frequency, f
2388 Change bass frequency.
2389 Syntax for the command is : "@var{frequency}"
2390
2391 @item width_type, t
2392 Change bass width_type.
2393 Syntax for the command is : "@var{width_type}"
2394
2395 @item width, w
2396 Change bass width.
2397 Syntax for the command is : "@var{width}"
2398
2399 @item gain, g
2400 Change bass gain.
2401 Syntax for the command is : "@var{gain}"
2402 @end table
2403
2404 @section biquad
2405
2406 Apply a biquad IIR filter with the given coefficients.
2407 Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
2408 are the numerator and denominator coefficients respectively.
2409 and @var{channels}, @var{c} specify which channels to filter, by default all
2410 available are filtered.
2411
2412 @subsection Commands
2413
2414 This filter supports the following commands:
2415 @table @option
2416 @item a0
2417 @item a1
2418 @item a2
2419 @item b0
2420 @item b1
2421 @item b2
2422 Change biquad parameter.
2423 Syntax for the command is : "@var{value}"
2424 @end table
2425
2426 @section bs2b
2427 Bauer stereo to binaural transformation, which improves headphone listening of
2428 stereo audio records.
2429
2430 To enable compilation of this filter you need to configure FFmpeg with
2431 @code{--enable-libbs2b}.
2432
2433 It accepts the following parameters:
2434 @table @option
2435
2436 @item profile
2437 Pre-defined crossfeed level.
2438 @table @option
2439
2440 @item default
2441 Default level (fcut=700, feed=50).
2442
2443 @item cmoy
2444 Chu Moy circuit (fcut=700, feed=60).
2445
2446 @item jmeier
2447 Jan Meier circuit (fcut=650, feed=95).
2448
2449 @end table
2450
2451 @item fcut
2452 Cut frequency (in Hz).
2453
2454 @item feed
2455 Feed level (in Hz).
2456
2457 @end table
2458
2459 @section channelmap
2460
2461 Remap input channels to new locations.
2462
2463 It accepts the following parameters:
2464 @table @option
2465 @item map
2466 Map channels from input to output. The argument is a '|'-separated list of
2467 mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
2468 @var{in_channel} form. @var{in_channel} can be either the name of the input
2469 channel (e.g. FL for front left) or its index in the input channel layout.
2470 @var{out_channel} is the name of the output channel or its index in the output
2471 channel layout. If @var{out_channel} is not given then it is implicitly an
2472 index, starting with zero and increasing by one for each mapping.
2473
2474 @item channel_layout
2475 The channel layout of the output stream.
2476 @end table
2477
2478 If no mapping is present, the filter will implicitly map input channels to
2479 output channels, preserving indices.
2480
2481 @subsection Examples
2482
2483 @itemize
2484 @item
2485 For example, assuming a 5.1+downmix input MOV file,
2486 @example
2487 ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
2488 @end example
2489 will create an output WAV file tagged as stereo from the downmix channels of
2490 the input.
2491
2492 @item
2493 To fix a 5.1 WAV improperly encoded in AAC's native channel order
2494 @example
2495 ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
2496 @end example
2497 @end itemize
2498
2499 @section channelsplit
2500
2501 Split each channel from an input audio stream into a separate output stream.
2502
2503 It accepts the following parameters:
2504 @table @option
2505 @item channel_layout
2506 The channel layout of the input stream. The default is "stereo".
2507 @item channels
2508 A channel layout describing the channels to be extracted as separate output streams
2509 or "all" to extract each input channel as a separate stream. The default is "all".
2510
2511 Choosing channels not present in channel layout in the input will result in an error.
2512 @end table
2513
2514 @subsection Examples
2515
2516 @itemize
2517 @item
2518 For example, assuming a stereo input MP3 file,
2519 @example
2520 ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
2521 @end example
2522 will create an output Matroska file with two audio streams, one containing only
2523 the left channel and the other the right channel.
2524
2525 @item
2526 Split a 5.1 WAV file into per-channel files:
2527 @example
2528 ffmpeg -i in.wav -filter_complex
2529 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
2530 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
2531 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
2532 side_right.wav
2533 @end example
2534
2535 @item
2536 Extract only LFE from a 5.1 WAV file:
2537 @example
2538 ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
2539 -map '[LFE]' lfe.wav
2540 @end example
2541 @end itemize
2542
2543 @section chorus
2544 Add a chorus effect to the audio.
2545
2546 Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
2547
2548 Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
2549 constant, with chorus, it is varied using using sinusoidal or triangular modulation.
2550 The modulation depth defines the range the modulated delay is played before or after
2551 the delay. Hence the delayed sound will sound slower or faster, that is the delayed
2552 sound tuned around the original one, like in a chorus where some vocals are slightly
2553 off key.
2554
2555 It accepts the following parameters:
2556 @table @option
2557 @item in_gain
2558 Set input gain. Default is 0.4.
2559
2560 @item out_gain
2561 Set output gain. Default is 0.4.
2562
2563 @item delays
2564 Set delays. A typical delay is around 40ms to 60ms.
2565
2566 @item decays
2567 Set decays.
2568
2569 @item speeds
2570 Set speeds.
2571
2572 @item depths
2573 Set depths.
2574 @end table
2575
2576 @subsection Examples
2577
2578 @itemize
2579 @item
2580 A single delay:
2581 @example
2582 chorus=0.7:0.9:55:0.4:0.25:2
2583 @end example
2584
2585 @item
2586 Two delays:
2587 @example
2588 chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
2589 @end example
2590
2591 @item
2592 Fuller sounding chorus with three delays:
2593 @example
2594 chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
2595 @end example
2596 @end itemize
2597
2598 @section compand
2599 Compress or expand the audio's dynamic range.
2600
2601 It accepts the following parameters:
2602
2603 @table @option
2604
2605 @item attacks
2606 @item decays
2607 A list of times in seconds for each channel over which the instantaneous level
2608 of the input signal is averaged to determine its volume. @var{attacks} refers to
2609 increase of volume and @var{decays} refers to decrease of volume. For most
2610 situations, the attack time (response to the audio getting louder) should be
2611 shorter than the decay time, because the human ear is more sensitive to sudden
2612 loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
2613 a typical value for decay is 0.8 seconds.
2614 If specified number of attacks & decays is lower than number of channels, the last
2615 set attack/decay will be used for all remaining channels.
2616
2617 @item points
2618 A list of points for the transfer function, specified in dB relative to the
2619 maximum possible signal amplitude. Each key points list must be defined using
2620 the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
2621 @code{x0/y0 x1/y1 x2/y2 ....}
2622
2623 The input values must be in strictly increasing order but the transfer function
2624 does not have to be monotonically rising. The point @code{0/0} is assumed but
2625 may be overridden (by @code{0/out-dBn}). Typical values for the transfer
2626 function are @code{-70/-70|-60/-20|1/0}.
2627
2628 @item soft-knee
2629 Set the curve radius in dB for all joints. It defaults to 0.01.
2630
2631 @item gain
2632 Set the additional gain in dB to be applied at all points on the transfer
2633 function. This allows for easy adjustment of the overall gain.
2634 It defaults to 0.
2635
2636 @item volume
2637 Set an initial volume, in dB, to be assumed for each channel when filtering
2638 starts. This permits the user to supply a nominal level initially, so that, for
2639 example, a very large gain is not applied to initial signal levels before the
2640 companding has begun to operate. A typical value for audio which is initially
2641 quiet is -90 dB. It defaults to 0.
2642
2643 @item delay
2644 Set a delay, in seconds. The input audio is analyzed immediately, but audio is
2645 delayed before being fed to the volume adjuster. Specifying a delay
2646 approximately equal to the attack/decay times allows the filter to effectively
2647 operate in predictive rather than reactive mode. It defaults to 0.
2648
2649 @end table
2650
2651 @subsection Examples
2652
2653 @itemize
2654 @item
2655 Make music with both quiet and loud passages suitable for listening to in a
2656 noisy environment:
2657 @example
2658 compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
2659 @end example
2660
2661 Another example for audio with whisper and explosion parts:
2662 @example
2663 compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
2664 @end example
2665
2666 @item
2667 A noise gate for when the noise is at a lower level than the signal:
2668 @example
2669 compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
2670 @end example
2671
2672 @item
2673 Here is another noise gate, this time for when the noise is at a higher level
2674 than the signal (making it, in some ways, similar to squelch):
2675 @example
2676 compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
2677 @end example
2678
2679 @item
2680 2:1 compression starting at -6dB:
2681 @example
2682 compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
2683 @end example
2684
2685 @item
2686 2:1 compression starting at -9dB:
2687 @example
2688 compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
2689 @end example
2690
2691 @item
2692 2:1 compression starting at -12dB:
2693 @example
2694 compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
2695 @end example
2696
2697 @item
2698 2:1 compression starting at -18dB:
2699 @example
2700 compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
2701 @end example
2702
2703 @item
2704 3:1 compression starting at -15dB:
2705 @example
2706 compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
2707 @end example
2708
2709 @item
2710 Compressor/Gate:
2711 @example
2712 compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
2713 @end example
2714
2715 @item
2716 Expander:
2717 @example
2718 compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
2719 @end example
2720
2721 @item
2722 Hard limiter at -6dB:
2723 @example
2724 compand=attacks=0:points=-80/-80|-6/-6|20/-6
2725 @end example
2726
2727 @item
2728 Hard limiter at -12dB:
2729 @example
2730 compand=attacks=0:points=-80/-80|-12/-12|20/-12
2731 @end example
2732
2733 @item
2734 Hard noise gate at -35 dB:
2735 @example
2736 compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
2737 @end example
2738
2739 @item
2740 Soft limiter:
2741 @example
2742 compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
2743 @end example
2744 @end itemize
2745
2746 @section compensationdelay
2747
2748 Compensation Delay Line is a metric based delay to compensate differing
2749 positions of microphones or speakers.
2750
2751 For example, you have recorded guitar with two microphones placed in
2752 different location. Because the front of sound wave has fixed speed in
2753 normal conditions, the phasing of microphones can vary and depends on
2754 their location and interposition. The best sound mix can be achieved when
2755 these microphones are in phase (synchronized). Note that distance of
2756 ~30 cm between microphones makes one microphone to capture signal in
2757 antiphase to another microphone. That makes the final mix sounding moody.
2758 This filter helps to solve phasing problems by adding different delays
2759 to each microphone track and make them synchronized.
2760
2761 The best result can be reached when you take one track as base and
2762 synchronize other tracks one by one with it.
2763 Remember that synchronization/delay tolerance depends on sample rate, too.
2764 Higher sample rates will give more tolerance.
2765
2766 It accepts the following parameters:
2767
2768 @table @option
2769 @item mm
2770 Set millimeters distance. This is compensation distance for fine tuning.
2771 Default is 0.
2772
2773 @item cm
2774 Set cm distance. This is compensation distance for tightening distance setup.
2775 Default is 0.
2776
2777 @item m
2778 Set meters distance. This is compensation distance for hard distance setup.
2779 Default is 0.
2780
2781 @item dry
2782 Set dry amount. Amount of unprocessed (dry) signal.
2783 Default is 0.
2784
2785 @item wet
2786 Set wet amount. Amount of processed (wet) signal.
2787 Default is 1.
2788
2789 @item temp
2790 Set temperature degree in Celsius. This is the temperature of the environment.
2791 Default is 20.
2792 @end table
2793
2794 @section crossfeed
2795 Apply headphone crossfeed filter.
2796
2797 Crossfeed is the process of blending the left and right channels of stereo
2798 audio recording.
2799 It is mainly used to reduce extreme stereo separation of low frequencies.
2800
2801 The intent is to produce more speaker like sound to the listener.
2802
2803 The filter accepts the following options:
2804
2805 @table @option
2806 @item strength
2807 Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
2808 This sets gain of low shelf filter for side part of stereo image.
2809 Default is -6dB. Max allowed is -30db when strength is set to 1.
2810
2811 @item range
2812 Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
2813 This sets cut off frequency of low shelf filter. Default is cut off near
2814 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
2815
2816 @item level_in
2817 Set input gain. Default is 0.9.
2818
2819 @item level_out
2820 Set output gain. Default is 1.
2821 @end table
2822
2823 @section crystalizer
2824 Simple algorithm to expand audio dynamic range.
2825
2826 The filter accepts the following options:
2827
2828 @table @option
2829 @item i
2830 Sets the intensity of effect (default: 2.0). Must be in range between 0.0
2831 (unchanged sound) to 10.0 (maximum effect).
2832
2833 @item c
2834 Enable clipping. By default is enabled.
2835 @end table
2836
2837 @section dcshift
2838 Apply a DC shift to the audio.
2839
2840 This can be useful to remove a DC offset (caused perhaps by a hardware problem
2841 in the recording chain) from the audio. The effect of a DC offset is reduced
2842 headroom and hence volume. The @ref{astats} filter can be used to determine if
2843 a signal has a DC offset.
2844
2845 @table @option
2846 @item shift
2847 Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
2848 the audio.
2849
2850 @item limitergain
2851 Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
2852 used to prevent clipping.
2853 @end table
2854
2855 @section drmeter
2856 Measure audio dynamic range.
2857
2858 DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
2859 is found in transition material. And anything less that 8 have very poor dynamics
2860 and is very compressed.
2861
2862 The filter accepts the following options:
2863
2864 @table @option
2865 @item length
2866 Set window length in seconds used to split audio into segments of equal length.
2867 Default is 3 seconds.
2868 @end table
2869
2870 @section dynaudnorm
2871 Dynamic Audio Normalizer.
2872
2873 This filter applies a certain amount of gain to the input audio in order
2874 to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
2875 contrast to more "simple" normalization algorithms, the Dynamic Audio
2876 Normalizer *dynamically* re-adjusts the gain factor to the input audio.
2877 This allows for applying extra gain to the "quiet" sections of the audio
2878 while avoiding distortions or clipping the "loud" sections. In other words:
2879 The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
2880 sections, in the sense that the volume of each section is brought to the
2881 same target level. Note, however, that the Dynamic Audio Normalizer achieves
2882 this goal *without* applying "dynamic range compressing". It will retain 100%
2883 of the dynamic range *within* each section of the audio file.
2884
2885 @table @option
2886 @item f
2887 Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
2888 Default is 500 milliseconds.
2889 The Dynamic Audio Normalizer processes the input audio in small chunks,
2890 referred to as frames. This is required, because a peak magnitude has no
2891 meaning for just a single sample value. Instead, we need to determine the
2892 peak magnitude for a contiguous sequence of sample values. While a "standard"
2893 normalizer would simply use the peak magnitude of the complete file, the
2894 Dynamic Audio Normalizer determines the peak magnitude individually for each
2895 frame. The length of a frame is specified in milliseconds. By default, the
2896 Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
2897 been found to give good results with most files.
2898 Note that the exact frame length, in number of samples, will be determined
2899 automatically, based on the sampling rate of the individual input audio file.
2900
2901 @item g
2902 Set the Gaussian filter window size. In range from 3 to 301, must be odd
2903 number. Default is 31.
2904 Probably the most important parameter of the Dynamic Audio Normalizer is the
2905 @code{window size} of the Gaussian smoothing filter. The filter's window size
2906 is specified in frames, centered around the current frame. For the sake of
2907 simplicity, this must be an odd number. Consequently, the default value of 31
2908 takes into account the current frame, as well as the 15 preceding frames and
2909 the 15 subsequent frames. Using a larger window results in a stronger
2910 smoothing effect and thus in less gain variation, i.e. slower gain
2911 adaptation. Conversely, using a smaller window results in a weaker smoothing
2912 effect and thus in more gain variation, i.e. faster gain adaptation.
2913 In other words, the more you increase this value, the more the Dynamic Audio
2914 Normalizer will behave like a "traditional" normalization filter. On the
2915 contrary, the more you decrease this value, the more the Dynamic Audio
2916 Normalizer will behave like a dynamic range compressor.
2917
2918 @item p
2919 Set the target peak value. This specifies the highest permissible magnitude
2920 level for the normalized audio input. This filter will try to approach the
2921 target peak magnitude as closely as possible, but at the same time it also
2922 makes sure that the normalized signal will never exceed the peak magnitude.
2923 A frame's maximum local gain factor is imposed directly by the target peak
2924 magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
2925 It is not recommended to go above this value.
2926
2927 @item m
2928 Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
2929 The Dynamic Audio Normalizer determines the maximum possible (local) gain
2930 factor for each input frame, i.e. the maximum gain factor that does not
2931 result in clipping or distortion. The maximum gain factor is determined by
2932 the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
2933 additionally bounds the frame's maximum gain factor by a predetermined
2934 (global) maximum gain factor. This is done in order to avoid excessive gain
2935 factors in "silent" or almost silent frames. By default, the maximum gain
2936 factor is 10.0, For most inputs the default value should be sufficient and
2937 it usually is not recommended to increase this value. Though, for input
2938 with an extremely low overall volume level, it may be necessary to allow even
2939 higher gain factors. Note, however, that the Dynamic Audio Normalizer does
2940 not simply apply a "hard" threshold (i.e. cut off values above the threshold).
2941 Instead, a "sigmoid" threshold function will be applied. This way, the
2942 gain factors will smoothly approach the threshold value, but never exceed that
2943 value.
2944
2945 @item r
2946 Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
2947 By default, the Dynamic Audio Normalizer performs "peak" normalization.
2948 This means that the maximum local gain factor for each frame is defined
2949 (only) by the frame's highest magnitude sample. This way, the samples can
2950 be amplified as much as possible without exceeding the maximum signal
2951 level, i.e. without clipping. Optionally, however, the Dynamic Audio
2952 Normalizer can also take into account the frame's root mean square,
2953 abbreviated RMS. In electrical engineering, the RMS is commonly used to
2954 determine the power of a time-varying signal. It is therefore considered
2955 that the RMS is a better approximation of the "perceived loudness" than
2956 just looking at the signal's peak magnitude. Consequently, by adjusting all
2957 frames to a constant RMS value, a uniform "perceived loudness" can be
2958 established. If a target RMS value has been specified, a frame's local gain
2959 factor is defined as the factor that would result in exactly that RMS value.
2960 Note, however, that the maximum local gain factor is still restricted by the
2961 frame's highest magnitude sample, in order to prevent clipping.
2962
2963 @item n
2964 Enable channels coupling. By default is enabled.
2965 By default, the Dynamic Audio Normalizer will amplify all channels by the same
2966 amount. This means the same gain factor will be applied to all channels, i.e.
2967 the maximum possible gain factor is determined by the "loudest" channel.
2968 However, in some recordings, it may happen that the volume of the different
2969 channels is uneven, e.g. one channel may be "quieter" than the other one(s).
2970 In this case, this option can be used to disable the channel coupling. This way,
2971 the gain factor will be determined independently for each channel, depending
2972 only on the individual channel's highest magnitude sample. This allows for
2973 harmonizing the volume of the different channels.
2974
2975 @item c
2976 Enable DC bias correction. By default is disabled.
2977 An audio signal (in the time domain) is a sequence of sample values.
2978 In the Dynamic Audio Normalizer these sample values are represented in the
2979 -1.0 to 1.0 range, regardless of the original input format. Normally, the
2980 audio signal, or "waveform", should be centered around the zero point.
2981 That means if we calculate the mean value of all samples in a file, or in a
2982 single frame, then the result should be 0.0 or at least very close to that
2983 value. If, however, there is a significant deviation of the mean value from
2984 0.0, in either positive or negative direction, this is referred to as a
2985 DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
2986 Audio Normalizer provides optional DC bias correction.
2987 With DC bias correction enabled, the Dynamic Audio Normalizer will determine
2988 the mean value, or "DC correction" offset, of each input frame and subtract
2989 that value from all of the frame's sample values which ensures those samples
2990 are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
2991 boundaries, the DC correction offset values will be interpolated smoothly
2992 between neighbouring frames.
2993
2994 @item b
2995 Enable alternative boundary mode. By default is disabled.
2996 The Dynamic Audio Normalizer takes into account a certain neighbourhood
2997 around each frame. This includes the preceding frames as well as the
2998 subsequent frames. However, for the "boundary" frames, located at the very
2999 beginning and at the very end of the audio file, not all neighbouring
3000 frames are available. In particular, for the first few frames in the audio
3001 file, the preceding frames are not known. And, similarly, for the last few
3002 frames in the audio file, the subsequent frames are not known. Thus, the
3003 question arises which gain factors should be assumed for the missing frames
3004 in the "boundary" region. The Dynamic Audio Normalizer implements two modes
3005 to deal with this situation. The default boundary mode assumes a gain factor
3006 of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
3007 "fade out" at the beginning and at the end of the input, respectively.
3008
3009 @item s
3010 Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
3011 By default, the Dynamic Audio Normalizer does not apply "traditional"
3012 compression. This means that signal peaks will not be pruned and thus the
3013 full dynamic range will be retained within each local neighbourhood. However,
3014 in some cases it may be desirable to combine the Dynamic Audio Normalizer's
3015 normalization algorithm with a more "traditional" compression.
3016 For this purpose, the Dynamic Audio Normalizer provides an optional compression
3017 (thresholding) function. If (and only if) the compression feature is enabled,
3018 all input frames will be processed by a soft knee thresholding function prior
3019 to the actual normalization process. Put simply, the thresholding function is
3020 going to prune all samples whose magnitude exceeds a certain threshold value.
3021 However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
3022 value. Instead, the threshold value will be adjusted for each individual
3023 frame.
3024 In general, smaller parameters result in stronger compression, and vice versa.
3025 Values below 3.0 are not recommended, because audible distortion may appear.
3026 @end table
3027
3028 @section earwax
3029
3030 Make audio easier to listen to on headphones.
3031
3032 This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
3033 so that when listened to on headphones the stereo image is moved from
3034 inside your head (standard for headphones) to outside and in front of
3035 the listener (standard for speakers).
3036
3037 Ported from SoX.
3038
3039 @section equalizer
3040
3041 Apply a two-pole peaking equalisation (EQ) filter. With this
3042 filter, the signal-level at and around a selected frequency can
3043 be increased or decreased, whilst (unlike bandpass and bandreject
3044 filters) that at all other frequencies is unchanged.
3045
3046 In order to produce complex equalisation curves, this filter can
3047 be given several times, each with a different central frequency.
3048
3049 The filter accepts the following options:
3050
3051 @table @option
3052 @item frequency, f
3053 Set the filter's central frequency in Hz.
3054
3055 @item width_type, t
3056 Set method to specify band-width of filter.
3057 @table @option
3058 @item h
3059 Hz
3060 @item q
3061 Q-Factor
3062 @item o
3063 octave
3064 @item s
3065 slope
3066 @item k
3067 kHz
3068 @end table
3069
3070 @item width, w
3071 Specify the band-width of a filter in width_type units.
3072
3073 @item gain, g
3074 Set the required gain or attenuation in dB.
3075 Beware of clipping when using a positive gain.
3076
3077 @item channels, c
3078 Specify which channels to filter, by default all available are filtered.
3079 @end table
3080
3081 @subsection Examples
3082 @itemize
3083 @item
3084 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
3085 @example
3086 equalizer=f=1000:t=h:width=200:g=-10
3087 @end example
3088
3089 @item
3090 Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
3091 @example
3092 equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
3093 @end example
3094 @end itemize
3095
3096 @subsection Commands
3097
3098 This filter supports the following commands:
3099 @table @option
3100 @item frequency, f
3101 Change equalizer frequency.
3102 Syntax for the command is : "@var{frequency}"
3103
3104 @item width_type, t
3105 Change equalizer width_type.
3106 Syntax for the command is : "@var{width_type}"
3107
3108 @item width, w
3109 Change equalizer width.
3110 Syntax for the command is : "@var{width}"
3111
3112 @item gain, g
3113 Change equalizer gain.
3114 Syntax for the command is : "@var{gain}"
3115 @end table
3116
3117 @section extrastereo
3118
3119 Linearly increases the difference between left and right channels which
3120 adds some sort of "live" effect to playback.
3121
3122 The filter accepts the following options:
3123
3124 @table @option
3125 @item m
3126 Sets the difference coefficient (default: 2.5). 0.0 means mono sound
3127 (average of both channels), with 1.0 sound will be unchanged, with
3128 -1.0 left and right channels will be swapped.
3129
3130 @item c
3131 Enable clipping. By default is enabled.
3132 @end table
3133
3134 @section firequalizer
3135 Apply FIR Equalization using arbitrary frequency response.
3136
3137 The filter accepts the following option:
3138
3139 @table @option
3140 @item gain
3141 Set gain curve equation (in dB). The expression can contain variables:
3142 @table @option
3143 @item f
3144 the evaluated frequency
3145 @item sr
3146 sample rate
3147 @item ch
3148 channel number, set to 0 when multichannels evaluation is disabled
3149 @item chid
3150 channel id, see libavutil/channel_layout.h, set to the first channel id when
3151 multichannels evaluation is disabled
3152 @item chs
3153 number of channels
3154 @item chlayout
3155 channel_layout, see libavutil/channel_layout.h
3156
3157 @end table
3158 and functions:
3159 @table @option
3160 @item gain_interpolate(f)
3161 interpolate gain on frequency f based on gain_entry
3162 @item cubic_interpolate(f)
3163 same as gain_interpolate, but smoother
3164 @end table
3165 This option is also available as command. Default is @code{gain_interpolate(f)}.
3166
3167 @item gain_entry
3168 Set gain entry for gain_interpolate function. The expression can
3169 contain functions:
3170 @table @option
3171 @item entry(f, g)
3172 store gain entry at frequency f with value g
3173 @end table
3174 This option is also available as command.
3175
3176 @item delay
3177 Set filter delay in seconds. Higher value means more accurate.
3178 Default is @code{0.01}.
3179
3180 @item accuracy
3181 Set filter accuracy in Hz. Lower value means more accurate.
3182 Default is @code{5}.
3183
3184 @item wfunc
3185 Set window function. Acceptable values are:
3186 @table @option
3187 @item rectangular
3188 rectangular window, useful when gain curve is already smooth
3189 @item hann
3190 hann window (default)
3191 @item hamming
3192 hamming window
3193 @item blackman
3194 blackman window
3195 @item nuttall3
3196 3-terms continuous 1st derivative nuttall window
3197 @item mnuttall3
3198 minimum 3-terms discontinuous nuttall window
3199 @item nuttall
3200 4-terms continuous 1st derivative nuttall window
3201 @item bnuttall
3202 minimum 4-terms discontinuous nuttall (blackman-nuttall) window
3203 @item bharris
3204 blackman-harris window
3205 @item tukey
3206 tukey window
3207 @end table
3208
3209 @item fixed
3210 If enabled, use fixed number of audio samples. This improves speed when
3211 filtering with large delay. Default is disabled.
3212
3213 @item multi
3214 Enable multichannels evaluation on gain. Default is disabled.
3215
3216 @item zero_phase
3217 Enable zero phase mode by subtracting timestamp to compensate delay.
3218 Default is disabled.
3219
3220 @item scale
3221 Set scale used by gain. Acceptable values are:
3222 @table @option
3223 @item linlin
3224 linear frequency, linear gain
3225 @item linlog
3226 linear frequency, logarithmic (in dB) gain (default)
3227 @item loglin
3228 logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
3229 @item loglog
3230 logarithmic frequency, logarithmic gain
3231 @end table
3232
3233 @item dumpfile
3234 Set file for dumping, suitable for gnuplot.
3235
3236 @item dumpscale
3237 Set scale for dumpfile. Acceptable values are same with scale option.
3238 Default is linlog.
3239
3240 @item fft2
3241 Enable 2-channel convolution using complex FFT. This improves speed significantly.
3242 Default is disabled.
3243
3244 @item min_phase
3245 Enable minimum phase impulse response. Default is disabled.
3246 @end table
3247
3248 @subsection Examples
3249 @itemize
3250 @item
3251 lowpass at 1000 Hz:
3252 @example
3253 firequalizer=gain='if(lt(f,1000), 0, -INF)'
3254 @end example
3255 @item
3256 lowpass at 1000 Hz with gain_entry:
3257 @example
3258 firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
3259 @end example
3260 @item
3261 custom equalization:
3262 @example
3263 firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
3264 @end example
3265 @item
3266 higher delay with zero phase to compensate delay:
3267 @example
3268 firequalizer=delay=0.1:fixed=on:zero_phase=on
3269 @end example
3270 @item
3271 lowpass on left channel, highpass on right channel:
3272 @example
3273 firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
3274 :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
3275 @end example
3276 @end itemize
3277
3278 @section flanger
3279 Apply a flanging effect to the audio.
3280
3281 The filter accepts the following options:
3282
3283 @table @option
3284 @item delay
3285 Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
3286
3287 @item depth
3288 Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
3289
3290 @item regen
3291 Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
3292 Default value is 0.
3293
3294 @item width
3295 Set percentage of delayed signal mixed with original. Range from 0 to 100.
3296 Default value is 71.
3297
3298 @item speed
3299 Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
3300
3301 @item shape
3302 Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
3303 Default value is @var{sinusoidal}.
3304
3305 @item phase
3306 Set swept wave percentage-shift for multi channel. Range from 0 to 100.
3307 Default value is 25.
3308
3309 @item interp
3310 Set delay-line interpolation, @var{linear} or @var{quadratic}.
3311 Default is @var{linear}.
3312 @end table
3313
3314 @section haas
3315 Apply Haas effect to audio.
3316
3317 Note that this makes most sense to apply on mono signals.
3318 With this filter applied to mono signals it give some directionality and
3319 stretches its stereo image.
3320
3321 The filter accepts the following options:
3322
3323 @table @option
3324 @item level_in
3325 Set input level. By default is @var{1}, or 0dB
3326
3327 @item level_out
3328 Set output level. By default is @var{1}, or 0dB.
3329
3330 @item side_gain
3331 Set gain applied to side part of signal. By default is @var{1}.
3332
3333 @item middle_source
3334 Set kind of middle source. Can be one of the following:
3335
3336 @table @samp
3337 @item left
3338 Pick left channel.
3339
3340 @item right
3341 Pick right channel.
3342
3343 @item mid
3344 Pick middle part signal of stereo image.
3345
3346 @item side
3347 Pick side part signal of stereo image.
3348 @end table
3349
3350 @item middle_phase
3351 Change middle phase. By default is disabled.
3352
3353 @item left_delay
3354 Set left channel delay. By default is @var{2.05} milliseconds.
3355
3356 @item left_balance
3357 Set left channel balance. By default is @var{-1}.
3358
3359 @item left_gain
3360 Set left channel gain. By default is @var{1}.
3361
3362 @item left_phase
3363 Change left phase. By default is disabled.
3364
3365 @item right_delay
3366 Set right channel delay. By defaults is @var{2.12} milliseconds.
3367
3368 @item right_balance
3369 Set right channel balance. By default is @var{1}.
3370
3371 @item right_gain
3372 Set right channel gain. By default is @var{1}.
3373
3374 @item right_phase
3375 Change right phase. By default is enabled.
3376 @end table
3377
3378 @section hdcd
3379
3380 Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
3381 embedded HDCD codes is expanded into a 20-bit PCM stream.
3382
3383 The filter supports the Peak Extend and Low-level Gain Adjustment features
3384 of HDCD, and detects the Transient Filter flag.
3385
3386 @example
3387 ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
3388 @end example
3389
3390 When using the filter with wav, note the default encoding for wav is 16-bit,
3391 so the resulting 20-bit stream will be truncated back to 16-bit. Use something
3392 like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
3393 @example
3394 ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
3395 ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
3396 @end example
3397
3398 The filter accepts the following options:
3399
3400 @table @option
3401 @item disable_autoconvert
3402 Disable any automatic format conversion or resampling in the filter graph.
3403
3404 @item process_stereo
3405 Process the stereo channels together. If target_gain does not match between
3406 channels, consider it invalid and use the last valid target_gain.
3407
3408 @item cdt_ms
3409 Set the code detect timer period in ms.
3410
3411 @item force_pe
3412 Always extend peaks above -3dBFS even if PE isn't signaled.
3413
3414 @item analyze_mode
3415 Replace audio with a solid tone and adjust the amplitude to signal some
3416 specific aspect of the decoding process. The output file can be loaded in
3417 an audio editor alongside the original to aid analysis.
3418
3419 @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
3420
3421 Modes are:
3422 @table @samp
3423 @item 0, off
3424 Disabled
3425 @item 1, lle
3426 Gain adjustment level at each sample
3427 @item 2, pe
3428 Samples where peak extend occurs
3429 @item 3, cdt
3430 Samples where the code detect timer is active
3431 @item 4, tgm
3432 Samples where the target gain does not match between channels
3433 @end table
3434 @end table
3435
3436 @section headphone
3437
3438 Apply head-related transfer functions (HRTFs) to create virtual
3439 loudspeakers around the user for binaural listening via headphones.
3440 The HRIRs are provided via additional streams, for each channel
3441 one stereo input stream is needed.
3442
3443 The filter accepts the following options:
3444
3445 @table @option
3446 @item map
3447 Set mapping of input streams for convolution.
3448 The argument is a '|'-separated list of channel names in order as they
3449 are given as additional stream inputs for filter.
3450 This also specify number of input streams. Number of input streams
3451 must be not less than number of channels in first stream plus one.
3452
3453 @item gain
3454 Set gain applied to audio. Value is in dB. Default is 0.
3455
3456 @item type
3457 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
3458 processing audio in time domain which is slow.
3459 @var{freq} is processing audio in frequency domain which is fast.
3460 Default is @var{freq}.
3461
3462 @item lfe
3463 Set custom gain for LFE channels. Value is in dB. Default is 0.
3464
3465 @item size
3466 Set size of frame in number of samples which will be processed at once.
3467 Default value is @var{1024}. Allowed range is from 1024 to 96000.
3468
3469 @item hrir
3470 Set format of hrir stream.
3471 Default value is @var{stereo}. Alternative value is @var{multich}.
3472 If value is set to @var{stereo}, number of additional streams should
3473 be greater or equal to number of input channels in first input stream.
3474 Also each additional stream should have stereo number of channels.
3475 If value is set to @var{multich}, number of additional streams should
3476 be exactly one. Also number of input channels of additional stream
3477 should be equal or greater than twice number of channels of first input
3478 stream.
3479 @end table
3480
3481 @subsection Examples
3482
3483 @itemize
3484 @item
3485 Full example using wav files as coefficients with amovie filters for 7.1 downmix,
3486 each amovie filter use stereo file with IR coefficients as input.
3487 The files give coefficients for each position of virtual loudspeaker:
3488 @example
3489 ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
3490 output.wav
3491 @end example
3492
3493 @item
3494 Full example using wav files as coefficients with amovie filters for 7.1 downmix,
3495 but now in @var{multich} @var{hrir} format.
3496 @example
3497 ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
3498 output.wav
3499 @end example
3500 @end itemize
3501
3502 @section highpass
3503
3504 Apply a high-pass filter with 3dB point frequency.
3505 The filter can be either single-pole, or double-pole (the default).
3506 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
3507
3508 The filter accepts the following options:
3509
3510 @table @option
3511 @item frequency, f
3512 Set frequency in Hz. Default is 3000.
3513
3514 @item poles, p
3515 Set number of poles. Default is 2.
3516
3517 @item width_type, t
3518 Set method to specify band-width of filter.
3519 @table @option
3520 @item h
3521 Hz
3522 @item q
3523 Q-Factor
3524 @item o
3525 octave
3526 @item s
3527 slope
3528 @item k
3529 kHz
3530 @end table
3531
3532 @item width, w
3533 Specify the band-width of a filter in width_type units.
3534 Applies only to double-pole filter.
3535 The default is 0.707q and gives a Butterworth response.
3536
3537 @item channels, c
3538 Specify which channels to filter, by default all available are filtered.
3539 @end table
3540
3541 @subsection Commands
3542
3543 This filter supports the following commands:
3544 @table @option
3545 @item frequency, f
3546 Change highpass frequency.
3547 Syntax for the command is : "@var{frequency}"
3548
3549 @item width_type, t
3550 Change highpass width_type.
3551 Syntax for the command is : "@var{width_type}"
3552
3553 @item width, w
3554 Change highpass width.
3555 Syntax for the command is : "@var{width}"
3556 @end table
3557
3558 @section join
3559
3560 Join multiple input streams into one multi-channel stream.
3561
3562 It accepts the following parameters:
3563 @table @option
3564
3565 @item inputs
3566 The number of input streams. It defaults to 2.
3567
3568 @item channel_layout
3569 The desired output channel layout. It defaults to stereo.
3570
3571 @item map
3572 Map channels from inputs to output. The argument is a '|'-separated list of
3573 mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
3574 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
3575 can be either the name of the input channel (e.g. FL for front left) or its
3576 index in the specified input stream. @var{out_channel} is the name of the output
3577 channel.
3578 @end table
3579
3580 The filter will attempt to guess the mappings when they are not specified
3581 explicitly. It does so by first trying to find an unused matching input channel
3582 and if that fails it picks the first unused input channel.
3583
3584 Join 3 inputs (with properly set channel layouts):
3585 @example
3586 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
3587 @end example
3588
3589 Build a 5.1 output from 6 single-channel streams:
3590 @example
3591 ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
3592 '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'
3593 out
3594 @end example
3595
3596 @section ladspa
3597
3598 Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
3599
3600 To enable compilation of this filter you need to configure FFmpeg with
3601 @code{--enable-ladspa}.
3602
3603 @table @option
3604 @item file, f
3605 Specifies the name of LADSPA plugin library to load. If the environment
3606 variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
3607 each one of the directories specified by the colon separated list in
3608 @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
3609 this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
3610 @file{/usr/lib/ladspa/}.
3611
3612 @item plugin, p
3613 Specifies the plugin within the library. Some libraries contain only
3614 one plugin, but others contain many of them. If this is not set filter
3615 will list all available plugins within the specified library.
3616
3617 @item controls, c
3618 Set the '|' separated list of controls which are zero or more floating point
3619 values that determine the behavior of the loaded plugin (for example delay,
3620 threshold or gain).
3621 Controls need to be defined using the following syntax:
3622 c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
3623 @var{valuei} is the value set on the @var{i}-th control.
3624 Alternatively they can be also defined using the following syntax:
3625 @var{value0}|@var{value1}|@var{value2}|..., where
3626 @var{valuei} is the value set on the @var{i}-th control.
3627 If @option{controls} is set to @code{help}, all available controls and
3628 their valid ranges are printed.
3629
3630 @item sample_rate, s
3631 Specify the sample rate, default to 44100. Only used if plugin have
3632 zero inputs.
3633
3634 @item nb_samples, n
3635 Set the number of samples per channel per each output frame, default
3636 is 1024. Only used if plugin have zero inputs.
3637
3638 @item duration, d
3639 Set the minimum duration of the sourced audio. See
3640 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3641 for the accepted syntax.
3642 Note that the resulting duration may be greater than the specified duration,
3643 as the generated audio is always cut at the end of a complete frame.
3644 If not specified, or the expressed duration is negative, the audio is
3645 supposed to be generated forever.
3646 Only used if plugin have zero inputs.
3647
3648 @end table
3649
3650 @subsection Examples
3651
3652 @itemize
3653 @item
3654 List all available plugins within amp (LADSPA example plugin) library:
3655 @example
3656 ladspa=file=amp
3657 @end example
3658
3659 @item
3660 List all available controls and their valid ranges for @code{vcf_notch}
3661 plugin from @code{VCF} library:
3662 @example
3663 ladspa=f=vcf:p=vcf_notch:c=help
3664 @end example
3665
3666 @item
3667 Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
3668 plugin library:
3669 @example
3670 ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
3671 @end example
3672
3673 @item
3674 Add reverberation to the audio using TAP-plugins
3675 (Tom's Audio Processing plugins):
3676 @example
3677 ladspa=file=tap_reverb:tap_reverb
3678 @end example
3679
3680 @item
3681 Generate white noise, with 0.2 amplitude:
3682 @example
3683 ladspa=file=cmt:noise_source_white:c=c0=.2
3684 @end example
3685
3686 @item
3687 Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
3688 @code{C* Audio Plugin Suite} (CAPS) library:
3689 @example
3690 ladspa=file=caps:Click:c=c1=20'
3691 @end example
3692
3693 @item
3694 Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
3695 @example
3696 ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
3697 @end example
3698
3699 @item
3700 Increase volume by 20dB using fast lookahead limiter from Steve Harris
3701 @code{SWH Plugins} collection:
3702 @example
3703 ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
3704 @end example
3705
3706 @item
3707 Attenuate low frequencies using Multiband EQ from Steve Harris
3708 @code{SWH Plugins} collection:
3709 @example
3710 ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
3711 @end example
3712
3713 @item
3714 Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
3715 (CAPS) library:
3716 @example
3717 ladspa=caps:Narrower
3718 @end example
3719
3720 @item
3721 Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
3722 @example
3723 ladspa=caps:White:.2
3724 @end example
3725
3726 @item
3727 Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
3728 @example
3729 ladspa=caps:Fractal:c=c1=1
3730 @end example
3731
3732 @item
3733 Dynamic volume normalization using @code{VLevel} plugin:
3734 @example
3735 ladspa=vlevel-ladspa:vlevel_mono
3736 @end example
3737 @end itemize
3738
3739 @subsection Commands
3740
3741 This filter supports the following commands:
3742 @table @option
3743 @item cN
3744 Modify the @var{N}-th control value.
3745
3746 If the specified value is not valid, it is ignored and prior one is kept.
3747 @end table
3748
3749 @section loudnorm
3750
3751 EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
3752 Support for both single pass (livestreams, files) and double pass (files) modes.
3753 This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
3754 the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
3755 Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
3756
3757 The filter accepts the following options:
3758
3759 @table @option
3760 @item I, i
3761 Set integrated loudness target.
3762 Range is -70.0 - -5.0. Default value is -24.0.
3763
3764 @item LRA, lra
3765 Set loudness range target.
3766 Range is 1.0 - 20.0. Default value is 7.0.
3767
3768 @item TP, tp
3769 Set maximum true peak.
3770 Range is -9.0 - +0.0. Default value is -2.0.
3771
3772 @item measured_I, measured_i
3773 Measured IL of input file.
3774 Range is -99.0 - +0.0.
3775
3776 @item measured_LRA, measured_lra
3777 Measured LRA of input file.
3778 Range is  0.0 - 99.0.
3779
3780 @item measured_TP, measured_tp
3781 Measured true peak of input file.
3782 Range is  -99.0 - +99.0.
3783
3784 @item measured_thresh
3785 Measured threshold of input file.
3786 Range is -99.0 - +0.0.
3787
3788 @item offset
3789 Set offset gain. Gain is applied before the true-peak limiter.
3790 Range is  -99.0 - +99.0. Default is +0.0.
3791
3792 @item linear
3793 Normalize linearly if possible.
3794 measured_I, measured_LRA, measured_TP, and measured_thresh must also
3795 to be specified in order to use this mode.
3796 Options are true or false. Default is true.
3797
3798 @item dual_mono
3799 Treat mono input files as "dual-mono". If a mono file is intended for playback
3800 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
3801 If set to @code{true}, this option will compensate for this effect.
3802 Multi-channel input files are not affected by this option.
3803 Options are true or false. Default is false.
3804
3805 @item print_format
3806 Set print format for stats. Options are summary, json, or none.
3807 Default value is none.
3808 @end table
3809
3810 @section lowpass
3811
3812 Apply a low-pass filter with 3dB point frequency.
3813 The filter can be either single-pole or double-pole (the default).
3814 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
3815
3816 The filter accepts the following options:
3817
3818 @table @option
3819 @item frequency, f
3820 Set frequency in Hz. Default is 500.
3821
3822 @item poles, p
3823 Set number of poles. Default is 2.
3824
3825 @item width_type, t
3826 Set method to specify band-width of filter.
3827 @table @option
3828 @item h
3829 Hz
3830 @item q
3831 Q-Factor
3832 @item o
3833 octave
3834 @item s
3835 slope
3836 @item k
3837 kHz
3838 @end table
3839
3840 @item width, w
3841 Specify the band-width of a filter in width_type units.
3842 Applies only to double-pole filter.
3843 The default is 0.707q and gives a Butterworth response.
3844
3845 @item channels, c
3846 Specify which channels to filter, by default all available are filtered.
3847 @end table
3848
3849 @subsection Examples
3850 @itemize
3851 @item
3852 Lowpass only LFE channel, it LFE is not present it does nothing:
3853 @example
3854 lowpass=c=LFE
3855 @end example
3856 @end itemize
3857
3858 @subsection Commands
3859
3860 This filter supports the following commands:
3861 @table @option
3862 @item frequency, f
3863 Change lowpass frequency.
3864 Syntax for the command is : "@var{frequency}"
3865
3866 @item width_type, t
3867 Change lowpass width_type.
3868 Syntax for the command is : "@var{width_type}"
3869
3870 @item width, w
3871 Change lowpass width.
3872 Syntax for the command is : "@var{width}"
3873 @end table
3874
3875 @section lv2
3876
3877 Load a LV2 (LADSPA Version 2) plugin.
3878
3879 To enable compilation of this filter you need to configure FFmpeg with
3880 @code{--enable-lv2}.
3881
3882 @table @option
3883 @item plugin, p
3884 Specifies the plugin URI. You may need to escape ':'.
3885
3886 @item controls, c
3887 Set the '|' separated list of controls which are zero or more floating point
3888 values that determine the behavior of the loaded plugin (for example delay,
3889 threshold or gain).
3890 If @option{controls} is set to @code{help}, all available controls and
3891 their valid ranges are printed.
3892
3893 @item sample_rate, s
3894 Specify the sample rate, default to 44100. Only used if plugin have
3895 zero inputs.
3896
3897 @item nb_samples, n
3898 Set the number of samples per channel per each output frame, default
3899 is 1024. Only used if plugin have zero inputs.
3900
3901 @item duration, d
3902 Set the minimum duration of the sourced audio. See
3903 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3904 for the accepted syntax.
3905 Note that the resulting duration may be greater than the specified duration,
3906 as the generated audio is always cut at the end of a complete frame.
3907 If not specified, or the expressed duration is negative, the audio is
3908 supposed to be generated forever.
3909 Only used if plugin have zero inputs.
3910 @end table
3911
3912 @subsection Examples
3913
3914 @itemize
3915 @item
3916 Apply bass enhancer plugin from Calf:
3917 @example
3918 lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
3919 @end example
3920
3921 @item
3922 Apply vinyl plugin from Calf:
3923 @example
3924 lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
3925 @end example
3926
3927 @item
3928 Apply bit crusher plugin from ArtyFX:
3929 @example
3930 lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
3931 @end example
3932 @end itemize
3933
3934 @section mcompand
3935 Multiband Compress or expand the audio's dynamic range.
3936
3937 The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
3938 This is akin to the crossover of a loudspeaker, and results in flat frequency
3939 response when absent compander action.
3940
3941 It accepts the following parameters:
3942
3943 @table @option
3944 @item args
3945 This option syntax is:
3946 attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
3947 For explanation of each item refer to compand filter documentation.
3948 @end table
3949
3950 @anchor{pan}
3951 @section pan
3952
3953 Mix channels with specific gain levels. The filter accepts the output
3954 channel layout followed by a set of channels definitions.
3955
3956 This filter is also designed to efficiently remap the channels of an audio
3957 stream.
3958
3959 The filter accepts parameters of the form:
3960 "@var{l}|@var{outdef}|@var{outdef}|..."
3961
3962 @table @option
3963 @item l
3964 output channel layout or number of channels
3965
3966 @item outdef
3967 output channel specification, of the form:
3968 "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
3969
3970 @item out_name
3971 output channel to define, either a channel name (FL, FR, etc.) or a channel
3972 number (c0, c1, etc.)
3973
3974 @item gain
3975 multiplicative coefficient for the channel, 1 leaving the volume unchanged
3976
3977 @item in_name
3978 input channel to use, see out_name for details; it is not possible to mix
3979 named and numbered input channels
3980 @end table
3981
3982 If the `=' in a channel specification is replaced by `<', then the gains for
3983 that specification will be renormalized so that the total is 1, thus
3984 avoiding clipping noise.
3985
3986 @subsection Mixing examples
3987
3988 For example, if you want to down-mix from stereo to mono, but with a bigger
3989 factor for the left channel:
3990 @example
3991 pan=1c|c0=0.9*c0+0.1*c1
3992 @end example
3993
3994 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
3995 7-channels surround:
3996 @example
3997 pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
3998 @end example
3999
4000 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
4001 that should be preferred (see "-ac" option) unless you have very specific
4002 needs.
4003
4004 @subsection Remapping examples
4005
4006 The channel remapping will be effective if, and only if:
4007
4008 @itemize
4009 @item gain coefficients are zeroes or ones,
4010 @item only one input per channel output,
4011 @end itemize
4012
4013 If all these conditions are satisfied, the filter will notify the user ("Pure
4014 channel mapping detected"), and use an optimized and lossless method to do the
4015 remapping.
4016
4017 For example, if you have a 5.1 source and want a stereo audio stream by
4018 dropping the extra channels:
4019 @example
4020 pan="stereo| c0=FL | c1=FR"
4021 @end example
4022
4023 Given the same source, you can also switch front left and front right channels
4024 and keep the input channel layout:
4025 @example
4026 pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
4027 @end example
4028
4029 If the input is a stereo audio stream, you can mute the front left channel (and
4030 still keep the stereo channel layout) with:
4031 @example
4032 pan="stereo|c1=c1"
4033 @end example
4034
4035 Still with a stereo audio stream input, you can copy the right channel in both
4036 front left and right:
4037 @example
4038 pan="stereo| c0=FR | c1=FR"
4039 @end example
4040
4041 @section replaygain
4042
4043 ReplayGain scanner filter. This filter takes an audio stream as an input and
4044 outputs it unchanged.
4045 At end of filtering it displays @code{track_gain} and @code{track_peak}.
4046
4047 @section resample
4048
4049 Convert the audio sample format, sample rate and channel layout. It is
4050 not meant to be used directly.
4051
4052 @section rubberband
4053 Apply time-stretching and pitch-shifting with librubberband.
4054
4055 To enable compilation of this filter, you need to configure FFmpeg with
4056 @code{--enable-librubberband}.
4057
4058 The filter accepts the following options:
4059
4060 @table @option
4061 @item tempo
4062 Set tempo scale factor.
4063
4064 @item pitch
4065 Set pitch scale factor.
4066
4067 @item transients
4068 Set transients detector.
4069 Possible values are:
4070 @table @var
4071 @item crisp
4072 @item mixed
4073 @item smooth
4074 @end table
4075
4076 @item detector
4077 Set detector.
4078 Possible values are:
4079 @table @var
4080 @item compound
4081 @item percussive
4082 @item soft
4083 @end table
4084
4085 @item phase
4086 Set phase.
4087 Possible values are:
4088 @table @var
4089 @item laminar
4090 @item independent
4091 @end table
4092
4093 @item window
4094 Set processing window size.
4095 Possible values are:
4096 @table @var
4097 @item standard
4098 @item short
4099 @item long
4100 @end table
4101
4102 @item smoothing
4103 Set smoothing.
4104 Possible values are:
4105 @table @var
4106 @item off
4107 @item on
4108 @end table
4109
4110 @item formant
4111 Enable formant preservation when shift pitching.
4112 Possible values are:
4113 @table @var
4114 @item shifted
4115 @item preserved
4116 @end table
4117
4118 @item pitchq
4119 Set pitch quality.
4120 Possible values are:
4121 @table @var
4122 @item quality
4123 @item speed
4124 @item consistency
4125 @end table
4126
4127 @item channels
4128 Set channels.
4129 Possible values are:
4130 @table @var
4131 @item apart
4132 @item together
4133 @end table
4134 @end table
4135
4136 @section sidechaincompress
4137
4138 This filter acts like normal compressor but has the ability to compress
4139 detected signal using second input signal.
4140 It needs two input streams and returns one output stream.
4141 First input stream will be processed depending on second stream signal.
4142 The filtered signal then can be filtered with other filters in later stages of
4143 processing. See @ref{pan} and @ref{amerge} filter.
4144
4145 The filter accepts the following options:
4146
4147 @table @option
4148 @item level_in
4149 Set input gain. Default is 1. Range is between 0.015625 and 64.
4150
4151 @item threshold
4152 If a signal of second stream raises above this level it will affect the gain
4153 reduction of first stream.
4154 By default is 0.125. Range is between 0.00097563 and 1.
4155
4156 @item ratio
4157 Set a ratio about which the signal is reduced. 1:2 means that if the level
4158 raised 4dB above the threshold, it will be only 2dB above after the reduction.
4159 Default is 2. Range is between 1 and 20.
4160
4161 @item attack
4162 Amount of milliseconds the signal has to rise above the threshold before gain
4163 reduction starts. Default is 20. Range is between 0.01 and 2000.
4164
4165 @item release
4166 Amount of milliseconds the signal has to fall below the threshold before
4167 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
4168
4169 @item makeup
4170 Set the amount by how much signal will be amplified after processing.
4171 Default is 1. Range is from 1 to 64.
4172
4173 @item knee
4174 Curve the sharp knee around the threshold to enter gain reduction more softly.
4175 Default is 2.82843. Range is between 1 and 8.
4176
4177 @item link
4178 Choose if the @code{average} level between all channels of side-chain stream
4179 or the louder(@code{maximum}) channel of side-chain stream affects the
4180 reduction. Default is @code{average}.
4181
4182 @item detection
4183 Should the exact signal be taken in case of @code{peak} or an RMS one in case
4184 of @code{rms}. Default is @code{rms} which is mainly smoother.
4185
4186 @item level_sc
4187 Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
4188
4189 @item mix
4190 How much to use compressed signal in output. Default is 1.
4191 Range is between 0 and 1.
4192 @end table
4193
4194 @subsection Examples
4195
4196 @itemize
4197 @item
4198 Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
4199 depending on the signal of 2nd input and later compressed signal to be
4200 merged with 2nd input:
4201 @example
4202 ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
4203 @end example
4204 @end itemize
4205
4206 @section sidechaingate
4207
4208 A sidechain gate acts like a normal (wideband) gate but has the ability to
4209 filter the detected signal before sending it to the gain reduction stage.
4210 Normally a gate uses the full range signal to detect a level above the
4211 threshold.
4212 For example: If you cut all lower frequencies from your sidechain signal
4213 the gate will decrease the volume of your track only if not enough highs
4214 appear. With this technique you are able to reduce the resonation of a
4215 natural drum or remove "rumbling" of muted strokes from a heavily distorted
4216 guitar.
4217 It needs two input streams and returns one output stream.
4218 First input stream will be processed depending on second stream signal.
4219
4220 The filter accepts the following options:
4221
4222 @table @option
4223 @item level_in
4224 Set input level before filtering.
4225 Default is 1. Allowed range is from 0.015625 to 64.
4226
4227 @item range
4228 Set the level of gain reduction when the signal is below the threshold.
4229 Default is 0.06125. Allowed range is from 0 to 1.
4230
4231 @item threshold
4232 If a signal rises above this level the gain reduction is released.
4233 Default is 0.125. Allowed range is from 0 to 1.
4234
4235 @item ratio
4236 Set a ratio about which the signal is reduced.
4237 Default is 2. Allowed range is from 1 to 9000.
4238
4239 @item attack
4240 Amount of milliseconds the signal has to rise above the threshold before gain
4241 reduction stops.
4242 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
4243
4244 @item release
4245 Amount of milliseconds the signal has to fall below the threshold before the
4246 reduction is increased again. Default is 250 milliseconds.
4247 Allowed range is from 0.01 to 9000.
4248
4249 @item makeup
4250 Set amount of amplification of signal after processing.
4251 Default is 1. Allowed range is from 1 to 64.
4252
4253 @item knee
4254 Curve the sharp knee around the threshold to enter gain reduction more softly.
4255 Default is 2.828427125. Allowed range is from 1 to 8.
4256
4257 @item detection
4258 Choose if exact signal should be taken for detection or an RMS like one.
4259 Default is rms. Can be peak or rms.
4260
4261 @item link
4262 Choose if the average level between all channels or the louder channel affects
4263 the reduction.
4264 Default is average. Can be average or maximum.
4265
4266 @item level_sc
4267 Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
4268 @end table
4269
4270 @section silencedetect
4271
4272 Detect silence in an audio stream.
4273
4274 This filter logs a message when it detects that the input audio volume is less
4275 or equal to a noise tolerance value for a duration greater or equal to the
4276 minimum detected noise duration.
4277
4278 The printed times and duration are expressed in seconds.
4279
4280 The filter accepts the following options:
4281
4282 @table @option
4283 @item noise, n
4284 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
4285 specified value) or amplitude ratio. Default is -60dB, or 0.001.
4286
4287 @item duration, d
4288 Set silence duration until notification (default is 2 seconds).
4289
4290 @item mono, m
4291 Process each channel separately, instead of combined. By default is disabled.
4292 @end table
4293
4294 @subsection Examples
4295
4296 @itemize
4297 @item
4298 Detect 5 seconds of silence with -50dB noise tolerance:
4299 @example
4300 silencedetect=n=-50dB:d=5
4301 @end example
4302
4303 @item
4304 Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
4305 tolerance in @file{silence.mp3}:
4306 @example
4307 ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
4308 @end example
4309 @end itemize
4310
4311 @section silenceremove
4312
4313 Remove silence from the beginning, middle or end of the audio.
4314
4315 The filter accepts the following options:
4316
4317 @table @option
4318 @item start_periods
4319 This value is used to indicate if audio should be trimmed at beginning of
4320 the audio. A value of zero indicates no silence should be trimmed from the
4321 beginning. When specifying a non-zero value, it trims audio up until it
4322 finds non-silence. Normally, when trimming silence from beginning of audio
4323 the @var{start_periods} will be @code{1} but it can be increased to higher
4324 values to trim all audio up to specific count of non-silence periods.
4325 Default value is @code{0}.
4326
4327 @item start_duration
4328 Specify the amount of time that non-silence must be detected before it stops
4329 trimming audio. By increasing the duration, bursts of noises can be treated
4330 as silence and trimmed off. Default value is @code{0}.
4331
4332 @item start_threshold
4333 This indicates what sample value should be treated as silence. For digital
4334 audio, a value of @code{0} may be fine but for audio recorded from analog,
4335 you may wish to increase the value to account for background noise.
4336 Can be specified in dB (in case "dB" is appended to the specified value)
4337 or amplitude ratio. Default value is @code{0}.
4338
4339 @item stop_periods
4340 Set the count for trimming silence from the end of audio.
4341 To remove silence from the middle of a file, specify a @var{stop_periods}
4342 that is negative. This value is then treated as a positive value and is
4343 used to indicate the effect should restart processing as specified by
4344 @var{start_periods}, making it suitable for removing periods of silence
4345 in the middle of the audio.
4346 Default value is @code{0}.
4347
4348 @item stop_duration
4349 Specify a duration of silence that must exist before audio is not copied any
4350 more. By specifying a higher duration, silence that is wanted can be left in
4351 the audio.
4352 Default value is @code{0}.
4353
4354 @item stop_threshold
4355 This is the same as @option{start_threshold} but for trimming silence from
4356 the end of audio.
4357 Can be specified in dB (in case "dB" is appended to the specified value)
4358 or amplitude ratio. Default value is @code{0}.
4359
4360 @item leave_silence
4361 This indicates that @var{stop_duration} length of audio should be left intact
4362 at the beginning of each period of silence.
4363 For example, if you want to remove long pauses between words but do not want
4364 to remove the pauses completely. Default value is @code{0}.
4365
4366 @item detection
4367 Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
4368 and works better with digital silence which is exactly 0.
4369 Default value is @code{rms}.
4370
4371 @item window
4372 Set ratio used to calculate size of window for detecting silence.
4373 Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
4374 @end table
4375
4376 @subsection Examples
4377
4378 @itemize
4379 @item
4380 The following example shows how this filter can be used to start a recording
4381 that does not contain the delay at the start which usually occurs between
4382 pressing the record button and the start of the performance:
4383 @example
4384 silenceremove=1:5:0.02
4385 @end example
4386
4387 @item
4388 Trim all silence encountered from beginning to end where there is more than 1
4389 second of silence in audio:
4390 @example
4391 silenceremove=0:0:0:-1:1:-90dB
4392 @end example
4393 @end itemize
4394
4395 @section sofalizer
4396
4397 SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
4398 loudspeakers around the user for binaural listening via headphones (audio
4399 formats up to 9 channels supported).
4400 The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
4401 SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
4402 Austrian Academy of Sciences.
4403
4404 To enable compilation of this filter you need to configure FFmpeg with
4405 @code{--enable-libmysofa}.
4406
4407 The filter accepts the following options:
4408
4409 @table @option
4410 @item sofa
4411 Set the SOFA file used for rendering.
4412
4413 @item gain
4414 Set gain applied to audio. Value is in dB. Default is 0.
4415
4416 @item rotation
4417 Set rotation of virtual loudspeakers in deg. Default is 0.
4418
4419 @item elevation
4420 Set elevation of virtual speakers in deg. Default is 0.
4421
4422 @item radius
4423 Set distance in meters between loudspeakers and the listener with near-field
4424 HRTFs. Default is 1.
4425
4426 @item type
4427 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
4428 processing audio in time domain which is slow.
4429 @var{freq} is processing audio in frequency domain which is fast.
4430 Default is @var{freq}.
4431
4432 @item speakers
4433 Set custom positions of virtual loudspeakers. Syntax for this option is:
4434 <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
4435 Each virtual loudspeaker is described with short channel name following with
4436 azimuth and elevation in degrees.
4437 Each virtual loudspeaker description is separated by '|'.
4438 For example to override front left and front right channel positions use:
4439 'speakers=FL 45 15|FR 345 15'.
4440 Descriptions with unrecognised channel names are ignored.
4441
4442 @item lfegain
4443 Set custom gain for LFE channels. Value is in dB. Default is 0.
4444 @end table
4445
4446 @subsection Examples
4447
4448 @itemize
4449 @item
4450 Using ClubFritz6 sofa file:
4451 @example
4452 sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
4453 @end example
4454
4455 @item
4456 Using ClubFritz12 sofa file and bigger radius with small rotation:
4457 @example
4458 sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
4459 @end example
4460
4461 @item
4462 Similar as above but with custom speaker positions for front left, front right, back left and back right
4463 and also with custom gain:
4464 @example
4465 "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
4466 @end example
4467 @end itemize
4468
4469 @section stereotools
4470
4471 This filter has some handy utilities to manage stereo signals, for converting
4472 M/S stereo recordings to L/R signal while having control over the parameters
4473 or spreading the stereo image of master track.
4474
4475 The filter accepts the following options:
4476
4477 @table @option
4478 @item level_in
4479 Set input level before filtering for both channels. Defaults is 1.
4480 Allowed range is from 0.015625 to 64.
4481
4482 @item level_out
4483 Set output level after filtering for both channels. Defaults is 1.
4484 Allowed range is from 0.015625 to 64.
4485
4486 @item balance_in
4487 Set input balance between both channels. Default is 0.
4488 Allowed range is from -1 to 1.
4489
4490 @item balance_out
4491 Set output balance between both channels. Default is 0.
4492 Allowed range is from -1 to 1.
4493
4494 @item softclip
4495 Enable softclipping. Results in analog distortion instead of harsh digital 0dB
4496 clipping. Disabled by default.
4497
4498 @item mutel
4499 Mute the left channel. Disabled by default.
4500
4501 @item muter
4502 Mute the right channel. Disabled by default.
4503
4504 @item phasel
4505 Change the phase of the left channel. Disabled by default.
4506
4507 @item phaser
4508 Change the phase of the right channel. Disabled by default.
4509
4510 @item mode
4511 Set stereo mode. Available values are:
4512
4513 @table @samp
4514 @item lr>lr
4515 Left/Right to Left/Right, this is default.
4516
4517 @item lr>ms
4518 Left/Right to Mid/Side.
4519
4520 @item ms>lr
4521 Mid/Side to Left/Right.
4522
4523 @item lr>ll
4524 Left/Right to Left/Left.
4525
4526 @item lr>rr
4527 Left/Right to Right/Right.
4528
4529 @item lr>l+r
4530 Left/Right to Left + Right.
4531
4532 @item lr>rl
4533 Left/Right to Right/Left.
4534
4535 @item ms>ll
4536 Mid/Side to Left/Left.
4537
4538 @item ms>rr
4539 Mid/Side to Right/Right.
4540 @end table
4541
4542 @item slev
4543 Set level of side signal. Default is 1.
4544 Allowed range is from 0.015625 to 64.
4545
4546 @item sbal
4547 Set balance of side signal. Default is 0.
4548 Allowed range is from -1 to 1.
4549
4550 @item mlev
4551 Set level of the middle signal. Default is 1.
4552 Allowed range is from 0.015625 to 64.
4553
4554 @item mpan
4555 Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
4556
4557 @item base
4558 Set stereo base between mono and inversed channels. Default is 0.
4559 Allowed range is from -1 to 1.
4560
4561 @item delay
4562 Set delay in milliseconds how much to delay left from right channel and
4563 vice versa. Default is 0. Allowed range is from -20 to 20.
4564
4565 @item sclevel
4566 Set S/C level. Default is 1. Allowed range is from 1 to 100.
4567
4568 @item phase
4569 Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
4570
4571 @item bmode_in, bmode_out
4572 Set balance mode for balance_in/balance_out option.
4573
4574 Can be one of the following:
4575
4576 @table @samp
4577 @item balance
4578 Classic balance mode. Attenuate one channel at time.
4579 Gain is raised up to 1.
4580
4581 @item amplitude
4582 Similar as classic mode above but gain is raised up to 2.
4583
4584 @item power
4585 Equal power distribution, from -6dB to +6dB range.
4586 @end table
4587 @end table
4588
4589 @subsection Examples
4590
4591 @itemize
4592 @item
4593 Apply karaoke like effect:
4594 @example
4595 stereotools=mlev=0.015625
4596 @end example
4597
4598 @item
4599 Convert M/S signal to L/R:
4600 @example
4601 "stereotools=mode=ms>lr"
4602 @end example
4603 @end itemize
4604
4605 @section stereowiden
4606
4607 This filter enhance the stereo effect by suppressing signal common to both
4608 channels and by delaying the signal of left into right and vice versa,
4609 thereby widening the stereo effect.
4610
4611 The filter accepts the following options:
4612
4613 @table @option
4614 @item delay
4615 Time in milliseconds of the delay of left signal into right and vice versa.
4616 Default is 20 milliseconds.
4617
4618 @item feedback
4619 Amount of gain in delayed signal into right and vice versa. Gives a delay
4620 effect of left signal in right output and vice versa which gives widening
4621 effect. Default is 0.3.
4622
4623 @item crossfeed
4624 Cross feed of left into right with inverted phase. This helps in suppressing
4625 the mono. If the value is 1 it will cancel all the signal common to both
4626 channels. Default is 0.3.
4627
4628 @item drymix
4629 Set level of input signal of original channel. Default is 0.8.
4630 @end table
4631
4632 @section superequalizer
4633 Apply 18 band equalizer.
4634
4635 The filter accepts the following options:
4636 @table @option
4637 @item 1b
4638 Set 65Hz band gain.
4639 @item 2b
4640 Set 92Hz band gain.
4641 @item 3b
4642 Set 131Hz band gain.
4643 @item 4b
4644 Set 185Hz band gain.
4645 @item 5b
4646 Set 262Hz band gain.
4647 @item 6b
4648 Set 370Hz band gain.
4649 @item 7b
4650 Set 523Hz band gain.
4651 @item 8b
4652 Set 740Hz band gain.
4653 @item 9b
4654 Set 1047Hz band gain.
4655 @item 10b
4656 Set 1480Hz band gain.
4657 @item 11b
4658 Set 2093Hz band gain.
4659 @item 12b
4660 Set 2960Hz band gain.
4661 @item 13b
4662 Set 4186Hz band gain.
4663 @item 14b
4664 Set 5920Hz band gain.
4665 @item 15b
4666 Set 8372Hz band gain.
4667 @item 16b
4668 Set 11840Hz band gain.
4669 @item 17b
4670 Set 16744Hz band gain.
4671 @item 18b
4672 Set 20000Hz band gain.
4673 @end table
4674
4675 @section surround
4676 Apply audio surround upmix filter.
4677
4678 This filter allows to produce multichannel output from audio stream.
4679
4680 The filter accepts the following options:
4681
4682 @table @option
4683 @item chl_out
4684 Set output channel layout. By default, this is @var{5.1}.
4685
4686 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4687 for the required syntax.
4688
4689 @item chl_in
4690 Set input channel layout. By default, this is @var{stereo}.
4691
4692 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4693 for the required syntax.
4694
4695 @item level_in
4696 Set input volume level. By default, this is @var{1}.
4697
4698 @item level_out
4699 Set output volume level. By default, this is @var{1}.
4700
4701 @item lfe
4702 Enable LFE channel output if output channel layout has it. By default, this is enabled.
4703
4704 @item lfe_low
4705 Set LFE low cut off frequency. By default, this is @var{128} Hz.
4706
4707 @item lfe_high
4708 Set LFE high cut off frequency. By default, this is @var{256} Hz.
4709
4710 @item fc_in
4711 Set front center input volume. By default, this is @var{1}.
4712
4713 @item fc_out
4714 Set front center output volume. By default, this is @var{1}.
4715
4716 @item lfe_in
4717 Set LFE input volume. By default, this is @var{1}.
4718
4719 @item lfe_out
4720 Set LFE output volume. By default, this is @var{1}.
4721 @end table
4722
4723 @section treble, highshelf
4724
4725 Boost or cut treble (upper) frequencies of the audio using a two-pole
4726 shelving filter with a response similar to that of a standard
4727 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
4728
4729 The filter accepts the following options:
4730
4731 @table @option
4732 @item gain, g
4733 Give the gain at whichever is the lower of ~22 kHz and the
4734 Nyquist frequency. Its useful range is about -20 (for a large cut)
4735 to +20 (for a large boost). Beware of clipping when using a positive gain.
4736
4737 @item frequency, f
4738 Set the filter's central frequency and so can be used
4739 to extend or reduce the frequency range to be boosted or cut.
4740 The default value is @code{3000} Hz.
4741
4742 @item width_type, t
4743 Set method to specify band-width of filter.
4744 @table @option
4745 @item h
4746 Hz
4747 @item q
4748 Q-Factor
4749 @item o
4750 octave
4751 @item s
4752 slope
4753 @item k
4754 kHz
4755 @end table
4756
4757 @item width, w
4758 Determine how steep is the filter's shelf transition.
4759
4760 @item channels, c
4761 Specify which channels to filter, by default all available are filtered.
4762 @end table
4763
4764 @subsection Commands
4765
4766 This filter supports the following commands:
4767 @table @option
4768 @item frequency, f
4769 Change treble frequency.
4770 Syntax for the command is : "@var{frequency}"
4771
4772 @item width_type, t
4773 Change treble width_type.
4774 Syntax for the command is : "@var{width_type}"
4775
4776 @item width, w
4777 Change treble width.
4778 Syntax for the command is : "@var{width}"
4779
4780 @item gain, g
4781 Change treble gain.
4782 Syntax for the command is : "@var{gain}"
4783 @end table
4784
4785 @section tremolo
4786
4787 Sinusoidal amplitude modulation.
4788
4789 The filter accepts the following options:
4790
4791 @table @option
4792 @item f
4793 Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
4794 (20 Hz or lower) will result in a tremolo effect.
4795 This filter may also be used as a ring modulator by specifying
4796 a modulation frequency higher than 20 Hz.
4797 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
4798
4799 @item d
4800 Depth of modulation as a percentage. Range is 0.0 - 1.0.
4801 Default value is 0.5.
4802 @end table
4803
4804 @section vibrato
4805
4806 Sinusoidal phase modulation.
4807
4808 The filter accepts the following options:
4809
4810 @table @option
4811 @item f
4812 Modulation frequency in Hertz.
4813 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
4814
4815 @item d
4816 Depth of modulation as a percentage. Range is 0.0 - 1.0.
4817 Default value is 0.5.
4818 @end table
4819
4820 @section volume
4821
4822 Adjust the input audio volume.
4823
4824 It accepts the following parameters:
4825 @table @option
4826
4827 @item volume
4828 Set audio volume expression.
4829
4830 Output values are clipped to the maximum value.
4831
4832 The output audio volume is given by the relation:
4833 @example
4834 @var{output_volume} = @var{volume} * @var{input_volume}
4835 @end example
4836
4837 The default value for @var{volume} is "1.0".
4838
4839 @item precision
4840 This parameter represents the mathematical precision.
4841
4842 It determines which input sample formats will be allowed, which affects the
4843 precision of the volume scaling.
4844
4845 @table @option
4846 @item fixed
4847 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
4848 @item float
4849 32-bit floating-point; this limits input sample format to FLT. (default)
4850 @item double
4851 64-bit floating-point; this limits input sample format to DBL.
4852 @end table
4853
4854 @item replaygain
4855 Choose the behaviour on encountering ReplayGain side data in input frames.
4856
4857 @table @option
4858 @item drop
4859 Remove ReplayGain side data, ignoring its contents (the default).
4860
4861 @item ignore
4862 Ignore ReplayGain side data, but leave it in the frame.
4863
4864 @item track
4865 Prefer the track gain, if present.
4866
4867 @item album
4868 Prefer the album gain, if present.
4869 @end table
4870
4871 @item replaygain_preamp
4872 Pre-amplification gain in dB to apply to the selected replaygain gain.
4873
4874 Default value for @var{replaygain_preamp} is 0.0.
4875
4876 @item eval
4877 Set when the volume expression is evaluated.
4878
4879 It accepts the following values:
4880 @table @samp
4881 @item once
4882 only evaluate expression once during the filter initialization, or
4883 when the @samp{volume} command is sent
4884
4885 @item frame
4886 evaluate expression for each incoming frame
4887 @end table
4888
4889 Default value is @samp{once}.
4890 @end table
4891
4892 The volume expression can contain the following parameters.
4893
4894 @table @option
4895 @item n
4896 frame number (starting at zero)
4897 @item nb_channels
4898 number of channels
4899 @item nb_consumed_samples
4900 number of samples consumed by the filter
4901 @item nb_samples
4902 number of samples in the current frame
4903 @item pos
4904 original frame position in the file
4905 @item pts
4906 frame PTS
4907 @item sample_rate
4908 sample rate
4909 @item startpts
4910 PTS at start of stream
4911 @item startt
4912 time at start of stream
4913 @item t
4914 frame time
4915 @item tb
4916 timestamp timebase
4917 @item volume
4918 last set volume value
4919 @end table
4920
4921 Note that when @option{eval} is set to @samp{once} only the
4922 @var{sample_rate} and @var{tb} variables are available, all other
4923 variables will evaluate to NAN.
4924
4925 @subsection Commands
4926
4927 This filter supports the following commands:
4928 @table @option
4929 @item volume
4930 Modify the volume expression.
4931 The command accepts the same syntax of the corresponding option.
4932
4933 If the specified expression is not valid, it is kept at its current
4934 value.
4935 @item replaygain_noclip
4936 Prevent clipping by limiting the gain applied.
4937
4938 Default value for @var{replaygain_noclip} is 1.
4939
4940 @end table
4941
4942 @subsection Examples
4943
4944 @itemize
4945 @item
4946 Halve the input audio volume:
4947 @example
4948 volume=volume=0.5
4949 volume=volume=1/2
4950 volume=volume=-6.0206dB
4951 @end example
4952
4953 In all the above example the named key for @option{volume} can be
4954 omitted, for example like in:
4955 @example
4956 volume=0.5
4957 @end example
4958
4959 @item
4960 Increase input audio power by 6 decibels using fixed-point precision:
4961 @example
4962 volume=volume=6dB:precision=fixed
4963 @end example
4964
4965 @item
4966 Fade volume after time 10 with an annihilation period of 5 seconds:
4967 @example
4968 volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
4969 @end example
4970 @end itemize
4971
4972 @section volumedetect
4973
4974 Detect the volume of the input video.
4975
4976 The filter has no parameters. The input is not modified. Statistics about
4977 the volume will be printed in the log when the input stream end is reached.
4978
4979 In particular it will show the mean volume (root mean square), maximum
4980 volume (on a per-sample basis), and the beginning of a histogram of the
4981 registered volume values (from the maximum value to a cumulated 1/1000 of
4982 the samples).
4983
4984 All volumes are in decibels relative to the maximum PCM value.
4985
4986 @subsection Examples
4987
4988 Here is an excerpt of the output:
4989 @example
4990 [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
4991 [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
4992 [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
4993 [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
4994 [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
4995 [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
4996 [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
4997 [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
4998 [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
4999 @end example
5000
5001 It means that:
5002 @itemize
5003 @item
5004 The mean square energy is approximately -27 dB, or 10^-2.7.
5005 @item
5006 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
5007 @item
5008 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
5009 @end itemize
5010
5011 In other words, raising the volume by +4 dB does not cause any clipping,
5012 raising it by +5 dB causes clipping for 6 samples, etc.
5013
5014 @c man end AUDIO FILTERS
5015
5016 @chapter Audio Sources
5017 @c man begin AUDIO SOURCES
5018
5019 Below is a description of the currently available audio sources.
5020
5021 @section abuffer
5022
5023 Buffer audio frames, and make them available to the filter chain.
5024
5025 This source is mainly intended for a programmatic use, in particular
5026 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
5027
5028 It accepts the following parameters:
5029 @table @option
5030
5031 @item time_base
5032 The timebase which will be used for timestamps of submitted frames. It must be
5033 either a floating-point number or in @var{numerator}/@var{denominator} form.
5034
5035 @item sample_rate
5036 The sample rate of the incoming audio buffers.
5037
5038 @item sample_fmt
5039 The sample format of the incoming audio buffers.
5040 Either a sample format name or its corresponding integer representation from
5041 the enum AVSampleFormat in @file{libavutil/samplefmt.h}
5042
5043 @item channel_layout
5044 The channel layout of the incoming audio buffers.
5045 Either a channel layout name from channel_layout_map in
5046 @file{libavutil/channel_layout.c} or its corresponding integer representation
5047 from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
5048
5049 @item channels
5050 The number of channels of the incoming audio buffers.
5051 If both @var{channels} and @var{channel_layout} are specified, then they
5052 must be consistent.
5053
5054 @end table
5055
5056 @subsection Examples
5057
5058 @example
5059 abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
5060 @end example
5061
5062 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
5063 Since the sample format with name "s16p" corresponds to the number
5064 6 and the "stereo" channel layout corresponds to the value 0x3, this is
5065 equivalent to:
5066 @example
5067 abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
5068 @end example
5069
5070 @section aevalsrc
5071
5072 Generate an audio signal specified by an expression.
5073
5074 This source accepts in input one or more expressions (one for each
5075 channel), which are evaluated and used to generate a corresponding
5076 audio signal.
5077
5078 This source accepts the following options:
5079
5080 @table @option
5081 @item exprs
5082 Set the '|'-separated expressions list for each separate channel. In case the
5083 @option{channel_layout} option is not specified, the selected channel layout
5084 depends on the number of provided expressions. Otherwise the last
5085 specified expression is applied to the remaining output channels.
5086
5087 @item channel_layout, c
5088 Set the channel layout. The number of channels in the specified layout
5089 must be equal to the number of specified expressions.
5090
5091 @item duration, d
5092 Set the minimum duration of the sourced audio. See
5093 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
5094 for the accepted syntax.
5095 Note that the resulting duration may be greater than the specified
5096 duration, as the generated audio is always cut at the end of a
5097 complete frame.
5098
5099 If not specified, or the expressed duration is negative, the audio is
5100 supposed to be generated forever.
5101
5102 @item nb_samples, n
5103 Set the number of samples per channel per each output frame,
5104 default to 1024.
5105
5106 @item sample_rate, s
5107 Specify the sample rate, default to 44100.
5108 @end table
5109
5110 Each expression in @var{exprs} can contain the following constants:
5111
5112 @table @option
5113 @item n
5114 number of the evaluated sample, starting from 0
5115
5116 @item t
5117 time of the evaluated sample expressed in seconds, starting from 0
5118
5119 @item s
5120 sample rate
5121
5122 @end table
5123
5124 @subsection Examples
5125
5126 @itemize
5127 @item
5128 Generate silence:
5129 @example
5130 aevalsrc=0
5131 @end example
5132
5133 @item
5134 Generate a sin signal with frequency of 440 Hz, set sample rate to
5135 8000 Hz:
5136 @example
5137 aevalsrc="sin(440*2*PI*t):s=8000"
5138 @end example
5139
5140 @item
5141 Generate a two channels signal, specify the channel layout (Front
5142 Center + Back Center) explicitly:
5143 @example
5144 aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
5145 @end example
5146
5147 @item
5148 Generate white noise:
5149 @example
5150 aevalsrc="-2+random(0)"
5151 @end example
5152
5153 @item
5154 Generate an amplitude modulated signal:
5155 @example
5156 aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
5157 @end example
5158
5159 @item
5160 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
5161 @example
5162 aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
5163 @end example
5164
5165 @end itemize
5166
5167 @section anullsrc
5168
5169 The null audio source, return unprocessed audio frames. It is mainly useful
5170 as a template and to be employed in analysis / debugging tools, or as
5171 the source for filters which ignore the input data (for example the sox
5172 synth filter).
5173
5174 This source accepts the following options:
5175
5176 @table @option
5177
5178 @item channel_layout, cl
5179
5180 Specifies the channel layout, and can be either an integer or a string
5181 representing a channel layout. The default value of @var{channel_layout}
5182 is "stereo".
5183
5184 Check the channel_layout_map definition in
5185 @file{libavutil/channel_layout.c} for the mapping between strings and
5186 channel layout values.
5187
5188 @item sample_rate, r
5189 Specifies the sample rate, and defaults to 44100.
5190
5191 @item nb_samples, n
5192 Set the number of samples per requested frames.
5193
5194 @end table
5195
5196 @subsection Examples
5197
5198 @itemize
5199 @item
5200 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
5201 @example
5202 anullsrc=r=48000:cl=4
5203 @end example
5204
5205 @item
5206 Do the same operation with a more obvious syntax:
5207 @example
5208 anullsrc=r=48000:cl=mono
5209 @end example
5210 @end itemize
5211
5212 All the parameters need to be explicitly defined.
5213
5214 @section flite
5215
5216 Synthesize a voice utterance using the libflite library.
5217
5218 To enable compilation of this filter you need to configure FFmpeg with
5219 @code{--enable-libflite}.
5220
5221 Note that versions of the flite library prior to 2.0 are not thread-safe.
5222
5223 The filter accepts the following options:
5224
5225 @table @option
5226
5227 @item list_voices
5228 If set to 1, list the names of the available voices and exit
5229 immediately. Default value is 0.
5230
5231 @item nb_samples, n
5232 Set the maximum number of samples per frame. Default value is 512.
5233
5234 @item textfile
5235 Set the filename containing the text to speak.
5236
5237 @item text
5238 Set the text to speak.
5239
5240 @item voice, v
5241 Set the voice to use for the speech synthesis. Default value is
5242 @code{kal}. See also the @var{list_voices} option.
5243 @end table
5244
5245 @subsection Examples
5246
5247 @itemize
5248 @item
5249 Read from file @file{speech.txt}, and synthesize the text using the
5250 standard flite voice:
5251 @example
5252 flite=textfile=speech.txt
5253 @end example
5254
5255 @item
5256 Read the specified text selecting the @code{slt} voice:
5257 @example
5258 flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
5259 @end example
5260
5261 @item
5262 Input text to ffmpeg:
5263 @example
5264 ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
5265 @end example
5266
5267 @item
5268 Make @file{ffplay} speak the specified text, using @code{flite} and
5269 the @code{lavfi} device:
5270 @example
5271 ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
5272 @end example
5273 @end itemize
5274
5275 For more information about libflite, check:
5276 @url{http://www.festvox.org/flite/}
5277
5278 @section anoisesrc
5279
5280 Generate a noise audio signal.
5281
5282 The filter accepts the following options:
5283
5284 @table @option
5285 @item sample_rate, r
5286 Specify the sample rate. Default value is 48000 Hz.
5287
5288 @item amplitude, a
5289 Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
5290 is 1.0.
5291
5292 @item duration, d
5293 Specify the duration of the generated audio stream. Not specifying this option
5294 results in noise with an infinite length.
5295
5296 @item color, colour, c
5297 Specify the color of noise. Available noise colors are white, pink, brown,
5298 blue and violet. Default color is white.
5299
5300 @item seed, s
5301 Specify a value used to seed the PRNG.
5302
5303 @item nb_samples, n
5304 Set the number of samples per each output frame, default is 1024.
5305 @end table
5306
5307 @subsection Examples
5308
5309 @itemize
5310
5311 @item
5312 Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
5313 @example
5314 anoisesrc=d=60:c=pink:r=44100:a=0.5
5315 @end example
5316 @end itemize
5317
5318 @section hilbert
5319
5320 Generate odd-tap Hilbert transform FIR coefficients.
5321
5322 The resulting stream can be used with @ref{afir} filter for phase-shifting
5323 the signal by 90 degrees.
5324
5325 This is used in many matrix coding schemes and for analytic signal generation.
5326 The process is often written as a multiplication by i (or j), the imaginary unit.
5327
5328 The filter accepts the following options:
5329
5330 @table @option
5331
5332 @item sample_rate, s
5333 Set sample rate, default is 44100.
5334
5335 @item taps, t
5336 Set length of FIR filter, default is 22051.
5337
5338 @item nb_samples, n
5339 Set number of samples per each frame.
5340
5341 @item win_func, w
5342 Set window function to be used when generating FIR coefficients.
5343 @end table
5344
5345 @section sine
5346
5347 Generate an audio signal made of a sine wave with amplitude 1/8.
5348
5349 The audio signal is bit-exact.
5350
5351 The filter accepts the following options:
5352
5353 @table @option
5354
5355 @item frequency, f
5356 Set the carrier frequency. Default is 440 Hz.
5357
5358 @item beep_factor, b
5359 Enable a periodic beep every second with frequency @var{beep_factor} times
5360 the carrier frequency. Default is 0, meaning the beep is disabled.
5361
5362 @item sample_rate, r
5363 Specify the sample rate, default is 44100.
5364
5365 @item duration, d
5366 Specify the duration of the generated audio stream.
5367
5368 @item samples_per_frame
5369 Set the number of samples per output frame.
5370
5371 The expression can contain the following constants:
5372
5373 @table @option
5374 @item n
5375 The (sequential) number of the output audio frame, starting from 0.
5376
5377 @item pts
5378 The PTS (Presentation TimeStamp) of the output audio frame,
5379 expressed in @var{TB} units.
5380
5381 @item t
5382 The PTS of the output audio frame, expressed in seconds.
5383
5384 @item TB
5385 The timebase of the output audio frames.
5386 @end table
5387
5388 Default is @code{1024}.
5389 @end table
5390
5391 @subsection Examples
5392
5393 @itemize
5394
5395 @item
5396 Generate a simple 440 Hz sine wave:
5397 @example
5398 sine
5399 @end example
5400
5401 @item
5402 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
5403 @example
5404 sine=220:4:d=5
5405 sine=f=220:b=4:d=5
5406 sine=frequency=220:beep_factor=4:duration=5
5407 @end example
5408
5409 @item
5410 Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
5411 pattern:
5412 @example
5413 sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
5414 @end example
5415 @end itemize
5416
5417 @c man end AUDIO SOURCES
5418
5419 @chapter Audio Sinks
5420 @c man begin AUDIO SINKS
5421
5422 Below is a description of the currently available audio sinks.
5423
5424 @section abuffersink
5425
5426 Buffer audio frames, and make them available to the end of filter chain.
5427
5428 This sink is mainly intended for programmatic use, in particular
5429 through the interface defined in @file{libavfilter/buffersink.h}
5430 or the options system.
5431
5432 It accepts a pointer to an AVABufferSinkContext structure, which
5433 defines the incoming buffers' formats, to be passed as the opaque
5434 parameter to @code{avfilter_init_filter} for initialization.
5435 @section anullsink
5436
5437 Null audio sink; do absolutely nothing with the input audio. It is
5438 mainly useful as a template and for use in analysis / debugging
5439 tools.
5440
5441 @c man end AUDIO SINKS
5442
5443 @chapter Video Filters
5444 @c man begin VIDEO FILTERS
5445
5446 When you configure your FFmpeg build, you can disable any of the
5447 existing filters using @code{--disable-filters}.
5448 The configure output will show the video filters included in your
5449 build.
5450
5451 Below is a description of the currently available video filters.
5452
5453 @section alphaextract
5454
5455 Extract the alpha component from the input as a grayscale video. This
5456 is especially useful with the @var{alphamerge} filter.
5457
5458 @section alphamerge
5459
5460 Add or replace the alpha component of the primary input with the
5461 grayscale value of a second input. This is intended for use with
5462 @var{alphaextract} to allow the transmission or storage of frame
5463 sequences that have alpha in a format that doesn't support an alpha
5464 channel.
5465
5466 For example, to reconstruct full frames from a normal YUV-encoded video
5467 and a separate video created with @var{alphaextract}, you might use:
5468 @example
5469 movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
5470 @end example
5471
5472 Since this filter is designed for reconstruction, it operates on frame
5473 sequences without considering timestamps, and terminates when either
5474 input reaches end of stream. This will cause problems if your encoding
5475 pipeline drops frames. If you're trying to apply an image as an
5476 overlay to a video stream, consider the @var{overlay} filter instead.
5477
5478 @section amplify
5479
5480 Amplify differences between current pixel and pixels of adjacent frames in
5481 same pixel location.
5482
5483 This filter accepts the following options:
5484
5485 @table @option
5486 @item radius
5487 Set frame radius. Default is 2. Allowed range is from 1 to 63.
5488 For example radius of 3 will instruct filter to calculate average of 7 frames.
5489
5490 @item factor
5491 Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
5492
5493 @item threshold
5494 Set threshold for difference amplification. Any differrence greater or equal to
5495 this value will not alter source pixel. Default is 10.
5496 Allowed range is from 0 to 65535.
5497
5498 @item low
5499 Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
5500 This option controls maximum possible value that will decrease source pixel value.
5501
5502 @item high
5503 Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
5504 This option controls maximum possible value that will increase source pixel value.
5505
5506 @item planes
5507 Set which planes to filter. Default is all. Allowed range is from 0 to 15.
5508 @end table
5509
5510 @section ass
5511
5512 Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
5513 and libavformat to work. On the other hand, it is limited to ASS (Advanced
5514 Substation Alpha) subtitles files.
5515
5516 This filter accepts the following option in addition to the common options from
5517 the @ref{subtitles} filter:
5518
5519 @table @option
5520 @item shaping
5521 Set the shaping engine
5522
5523 Available values are:
5524 @table @samp
5525 @item auto
5526 The default libass shaping engine, which is the best available.
5527 @item simple
5528 Fast, font-agnostic shaper that can do only substitutions
5529 @item complex
5530 Slower shaper using OpenType for substitutions and positioning
5531 @end table
5532
5533 The default is @code{auto}.
5534 @end table
5535
5536 @section atadenoise
5537 Apply an Adaptive Temporal Averaging Denoiser to the video input.
5538
5539 The filter accepts the following options:
5540
5541 @table @option
5542 @item 0a
5543 Set threshold A for 1st plane. Default is 0.02.
5544 Valid range is 0 to 0.3.
5545
5546 @item 0b
5547 Set threshold B for 1st plane. Default is 0.04.
5548 Valid range is 0 to 5.
5549
5550 @item 1a
5551 Set threshold A for 2nd plane. Default is 0.02.
5552 Valid range is 0 to 0.3.
5553
5554 @item 1b
5555 Set threshold B for 2nd plane. Default is 0.04.
5556 Valid range is 0 to 5.
5557
5558 @item 2a
5559 Set threshold A for 3rd plane. Default is 0.02.
5560 Valid range is 0 to 0.3.
5561
5562 @item 2b
5563 Set threshold B for 3rd plane. Default is 0.04.
5564 Valid range is 0 to 5.
5565
5566 Threshold A is designed to react on abrupt changes in the input signal and
5567 threshold B is designed to react on continuous changes in the input signal.
5568
5569 @item s
5570 Set number of frames filter will use for averaging. Default is 9. Must be odd
5571 number in range [5, 129].
5572
5573 @item p
5574 Set what planes of frame filter will use for averaging. Default is all.
5575 @end table
5576
5577 @section avgblur
5578
5579 Apply average blur filter.
5580
5581 The filter accepts the following options:
5582
5583 @table @option
5584 @item sizeX
5585 Set horizontal radius size.
5586
5587 @item planes
5588 Set which planes to filter. By default all planes are filtered.
5589
5590 @item sizeY
5591 Set vertical radius size, if zero it will be same as @code{sizeX}.
5592 Default is @code{0}.
5593 @end table
5594
5595 @section bbox
5596
5597 Compute the bounding box for the non-black pixels in the input frame
5598 luminance plane.
5599
5600 This filter computes the bounding box containing all the pixels with a
5601 luminance value greater than the minimum allowed value.
5602 The parameters describing the bounding box are printed on the filter
5603 log.
5604
5605 The filter accepts the following option:
5606
5607 @table @option
5608 @item min_val
5609 Set the minimal luminance value. Default is @code{16}.
5610 @end table
5611
5612 @section bitplanenoise
5613
5614 Show and measure bit plane noise.
5615
5616 The filter accepts the following options:
5617
5618 @table @option
5619 @item bitplane
5620 Set which plane to analyze. Default is @code{1}.
5621
5622 @item filter
5623 Filter out noisy pixels from @code{bitplane} set above.
5624 Default is disabled.
5625 @end table
5626
5627 @section blackdetect
5628
5629 Detect video intervals that are (almost) completely black. Can be
5630 useful to detect chapter transitions, commercials, or invalid
5631 recordings. Output lines contains the time for the start, end and
5632 duration of the detected black interval expressed in seconds.
5633
5634 In order to display the output lines, you need to set the loglevel at
5635 least to the AV_LOG_INFO value.
5636
5637 The filter accepts the following options:
5638
5639 @table @option
5640 @item black_min_duration, d
5641 Set the minimum detected black duration expressed in seconds. It must
5642 be a non-negative floating point number.
5643
5644 Default value is 2.0.
5645
5646 @item picture_black_ratio_th, pic_th
5647 Set the threshold for considering a picture "black".
5648 Express the minimum value for the ratio:
5649 @example
5650 @var{nb_black_pixels} / @var{nb_pixels}
5651 @end example
5652
5653 for which a picture is considered black.
5654 Default value is 0.98.
5655
5656 @item pixel_black_th, pix_th
5657 Set the threshold for considering a pixel "black".
5658
5659 The threshold expresses the maximum pixel luminance value for which a
5660 pixel is considered "black". The provided value is scaled according to
5661 the following equation:
5662 @example
5663 @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
5664 @end example
5665
5666 @var{luminance_range_size} and @var{luminance_minimum_value} depend on
5667 the input video format, the range is [0-255] for YUV full-range
5668 formats and [16-235] for YUV non full-range formats.
5669
5670 Default value is 0.10.
5671 @end table
5672
5673 The following example sets the maximum pixel threshold to the minimum
5674 value, and detects only black intervals of 2 or more seconds:
5675 @example
5676 blackdetect=d=2:pix_th=0.00
5677 @end example
5678
5679 @section blackframe
5680
5681 Detect frames that are (almost) completely black. Can be useful to
5682 detect chapter transitions or commercials. Output lines consist of
5683 the frame number of the detected frame, the percentage of blackness,
5684 the position in the file if known or -1 and the timestamp in seconds.
5685
5686 In order to display the output lines, you need to set the loglevel at
5687 least to the AV_LOG_INFO value.
5688
5689 This filter exports frame metadata @code{lavfi.blackframe.pblack}.
5690 The value represents the percentage of pixels in the picture that
5691 are below the threshold value.
5692
5693 It accepts the following parameters:
5694
5695 @table @option
5696
5697 @item amount
5698 The percentage of the pixels that have to be below the threshold; it defaults to
5699 @code{98}.
5700
5701 @item threshold, thresh
5702 The threshold below which a pixel value is considered black; it defaults to
5703 @code{32}.
5704
5705 @end table
5706
5707 @section blend, tblend
5708
5709 Blend two video frames into each other.
5710
5711 The @code{blend} filter takes two input streams and outputs one
5712 stream, the first input is the "top" layer and second input is
5713 "bottom" layer.  By default, the output terminates when the longest input terminates.
5714
5715 The @code{tblend} (time blend) filter takes two consecutive frames
5716 from one single stream, and outputs the result obtained by blending
5717 the new frame on top of the old frame.
5718
5719 A description of the accepted options follows.
5720
5721 @table @option
5722 @item c0_mode
5723 @item c1_mode
5724 @item c2_mode
5725 @item c3_mode
5726 @item all_mode
5727 Set blend mode for specific pixel component or all pixel components in case
5728 of @var{all_mode}. Default value is @code{normal}.
5729
5730 Available values for component modes are:
5731 @table @samp
5732 @item addition
5733 @item grainmerge
5734 @item and
5735 @item average
5736 @item burn
5737 @item darken
5738 @item difference
5739 @item grainextract
5740 @item divide
5741 @item dodge
5742 @item freeze
5743 @item exclusion
5744 @item extremity
5745 @item glow
5746 @item hardlight
5747 @item hardmix
5748 @item heat
5749 @item lighten
5750 @item linearlight
5751 @item multiply
5752 @item multiply128
5753 @item negation
5754 @item normal
5755 @item or
5756 @item overlay
5757 @item phoenix
5758 @item pinlight
5759 @item reflect
5760 @item screen
5761 @item softlight
5762 @item subtract
5763 @item vividlight
5764 @item xor
5765 @end table
5766
5767 @item c0_opacity
5768 @item c1_opacity
5769 @item c2_opacity
5770 @item c3_opacity
5771 @item all_opacity
5772 Set blend opacity for specific pixel component or all pixel components in case
5773 of @var{all_opacity}. Only used in combination with pixel component blend modes.
5774
5775 @item c0_expr
5776 @item c1_expr
5777 @item c2_expr
5778 @item c3_expr
5779 @item all_expr
5780 Set blend expression for specific pixel component or all pixel components in case
5781 of @var{all_expr}. Note that related mode options will be ignored if those are set.
5782
5783 The expressions can use the following variables:
5784
5785 @table @option
5786 @item N
5787 The sequential number of the filtered frame, starting from @code{0}.
5788
5789 @item X
5790 @item Y
5791 the coordinates of the current sample
5792
5793 @item W
5794 @item H
5795 the width and height of currently filtered plane
5796
5797 @item SW
5798 @item SH
5799 Width and height scale for the plane being filtered. It is the
5800 ratio between the dimensions of the current plane to the luma plane,
5801 e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
5802 the luma plane and @code{0.5,0.5} for the chroma planes.
5803
5804 @item T
5805 Time of the current frame, expressed in seconds.
5806
5807 @item TOP, A
5808 Value of pixel component at current location for first video frame (top layer).
5809
5810 @item BOTTOM, B
5811 Value of pixel component at current location for second video frame (bottom layer).
5812 @end table
5813 @end table
5814
5815 The @code{blend} filter also supports the @ref{framesync} options.
5816
5817 @subsection Examples
5818
5819 @itemize
5820 @item
5821 Apply transition from bottom layer to top layer in first 10 seconds:
5822 @example
5823 blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
5824 @end example
5825
5826 @item
5827 Apply linear horizontal transition from top layer to bottom layer:
5828 @example
5829 blend=all_expr='A*(X/W)+B*(1-X/W)'
5830 @end example
5831
5832 @item
5833 Apply 1x1 checkerboard effect:
5834 @example
5835 blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
5836 @end example
5837
5838 @item
5839 Apply uncover left effect:
5840 @example
5841 blend=all_expr='if(gte(N*SW+X,W),A,B)'
5842 @end example
5843
5844 @item
5845 Apply uncover down effect:
5846 @example
5847 blend=all_expr='if(gte(Y-N*SH,0),A,B)'
5848 @end example
5849
5850 @item
5851 Apply uncover up-left effect:
5852 @example
5853 blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
5854 @end example
5855
5856 @item
5857 Split diagonally video and shows top and bottom layer on each side:
5858 @example
5859 blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
5860 @end example
5861
5862 @item
5863 Display differences between the current and the previous frame:
5864 @example
5865 tblend=all_mode=grainextract
5866 @end example
5867 @end itemize
5868
5869 @section bm3d
5870
5871 Denoise frames using Block-Matching 3D algorithm.
5872
5873 The filter accepts the following options.
5874
5875 @table @option
5876 @item sigma
5877 Set denoising strength. Default value is 1.
5878 Allowed range is from 0 to 999.9.
5879 The denoising algorith is very sensitive to sigma, so adjust it
5880 according to the source.
5881
5882 @item block
5883 Set local patch size. This sets dimensions in 2D.
5884
5885 @item bstep
5886 Set sliding step for processing blocks. Default value is 4.
5887 Allowed range is from 1 to 64.
5888 Smaller values allows processing more reference blocks and is slower.
5889
5890 @item group
5891 Set maximal number of similar blocks for 3rd dimension. Default value is 1.
5892 When set to 1, no block matching is done. Larger values allows more blocks
5893 in single group.
5894 Allowed range is from 1 to 256.
5895
5896 @item range
5897 Set radius for search block matching. Default is 9.
5898 Allowed range is from 1 to INT32_MAX.
5899
5900 @item mstep
5901 Set step between two search locations for block matching. Default is 1.
5902 Allowed range is from 1 to 64. Smaller is slower.
5903
5904 @item thmse
5905 Set threshold of mean square error for block matching. Valid range is 0 to
5906 INT32_MAX.
5907
5908 @item hdthr
5909 Set thresholding parameter for hard thresholding in 3D transformed domain.
5910 Larger values results in stronger hard-thresholding filtering in frequency
5911 domain.
5912
5913 @item estim
5914 Set filtering estimation mode. Can be @code{basic} or @code{final}.
5915 Default is @code{basic}.
5916
5917 @item ref
5918 If enabled, filter will use 2nd stream for block matching.
5919 Default is disabled for @code{basic} value of @var{estim} option,
5920 and always enabled if value of @var{estim} is @code{final}.
5921
5922 @item planes
5923 Set planes to filter. Default is all available except alpha.
5924 @end table
5925
5926 @subsection Examples
5927
5928 @itemize
5929 @item
5930 Basic filtering with bm3d:
5931 @example
5932 bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
5933 @end example
5934
5935 @item
5936 Same as above, but filtering only luma:
5937 @example
5938 bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
5939 @end example
5940
5941 @item
5942 Same as above, but with both estimation modes:
5943 @example
5944 split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
5945 @end example
5946
5947 @item
5948 Same as above, but prefilter with @ref{nlmeans} filter instead:
5949 @example
5950 split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
5951 @end example
5952 @end itemize
5953
5954 @section boxblur
5955
5956 Apply a boxblur algorithm to the input video.
5957
5958 It accepts the following parameters:
5959
5960 @table @option
5961
5962 @item luma_radius, lr
5963 @item luma_power, lp
5964 @item chroma_radius, cr
5965 @item chroma_power, cp
5966 @item alpha_radius, ar
5967 @item alpha_power, ap
5968
5969 @end table
5970
5971 A description of the accepted options follows.
5972
5973 @table @option
5974 @item luma_radius, lr
5975 @item chroma_radius, cr
5976 @item alpha_radius, ar
5977 Set an expression for the box radius in pixels used for blurring the
5978 corresponding input plane.
5979
5980 The radius value must be a non-negative number, and must not be
5981 greater than the value of the expression @code{min(w,h)/2} for the
5982 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
5983 planes.
5984
5985 Default value for @option{luma_radius} is "2". If not specified,
5986 @option{chroma_radius} and @option{alpha_radius} default to the
5987 corresponding value set for @option{luma_radius}.
5988
5989 The expressions can contain the following constants:
5990 @table @option
5991 @item w
5992 @item h
5993 The input width and height in pixels.
5994
5995 @item cw
5996 @item ch
5997 The input chroma image width and height in pixels.
5998
5999 @item hsub
6000 @item vsub
6001 The horizontal and vertical chroma subsample values. For example, for the
6002 pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
6003 @end table
6004
6005 @item luma_power, lp
6006 @item chroma_power, cp
6007 @item alpha_power, ap
6008 Specify how many times the boxblur filter is applied to the
6009 corresponding plane.
6010
6011 Default value for @option{luma_power} is 2. If not specified,
6012 @option{chroma_power} and @option{alpha_power} default to the
6013 corresponding value set for @option{luma_power}.
6014
6015 A value of 0 will disable the effect.
6016 @end table
6017
6018 @subsection Examples
6019
6020 @itemize
6021 @item
6022 Apply a boxblur filter with the luma, chroma, and alpha radii
6023 set to 2:
6024 @example
6025 boxblur=luma_radius=2:luma_power=1
6026 boxblur=2:1
6027 @end example
6028
6029 @item
6030 Set the luma radius to 2, and alpha and chroma radius to 0:
6031 @example
6032 boxblur=2:1:cr=0:ar=0
6033 @end example
6034
6035 @item
6036 Set the luma and chroma radii to a fraction of the video dimension:
6037 @example
6038 boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
6039 @end example
6040 @end itemize
6041
6042 @section bwdif
6043
6044 Deinterlace the input video ("bwdif" stands for "Bob Weaver
6045 Deinterlacing Filter").
6046
6047 Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
6048 interpolation algorithms.
6049 It accepts the following parameters:
6050
6051 @table @option
6052 @item mode
6053 The interlacing mode to adopt. It accepts one of the following values:
6054
6055 @table @option
6056 @item 0, send_frame
6057 Output one frame for each frame.
6058 @item 1, send_field
6059 Output one frame for each field.
6060 @end table
6061
6062 The default value is @code{send_field}.
6063
6064 @item parity
6065 The picture field parity assumed for the input interlaced video. It accepts one
6066 of the following values:
6067
6068 @table @option
6069 @item 0, tff
6070 Assume the top field is first.
6071 @item 1, bff
6072 Assume the bottom field is first.
6073 @item -1, auto
6074 Enable automatic detection of field parity.
6075 @end table
6076
6077 The default value is @code{auto}.
6078 If the interlacing is unknown or the decoder does not export this information,
6079 top field first will be assumed.
6080
6081 @item deint
6082 Specify which frames to deinterlace. Accept one of the following
6083 values:
6084
6085 @table @option
6086 @item 0, all
6087 Deinterlace all frames.
6088 @item 1, interlaced
6089 Only deinterlace frames marked as interlaced.
6090 @end table
6091
6092 The default value is @code{all}.
6093 @end table
6094
6095 @section chromakey
6096 YUV colorspace color/chroma keying.
6097
6098 The filter accepts the following options:
6099
6100 @table @option
6101 @item color
6102 The color which will be replaced with transparency.
6103
6104 @item similarity
6105 Similarity percentage with the key color.
6106
6107 0.01 matches only the exact key color, while 1.0 matches everything.
6108
6109 @item blend
6110 Blend percentage.
6111
6112 0.0 makes pixels either fully transparent, or not transparent at all.
6113
6114 Higher values result in semi-transparent pixels, with a higher transparency
6115 the more similar the pixels color is to the key color.
6116
6117 @item yuv
6118 Signals that the color passed is already in YUV instead of RGB.
6119
6120 Literal colors like "green" or "red" don't make sense with this enabled anymore.
6121 This can be used to pass exact YUV values as hexadecimal numbers.
6122 @end table
6123
6124 @subsection Examples
6125
6126 @itemize
6127 @item
6128 Make every green pixel in the input image transparent:
6129 @example
6130 ffmpeg -i input.png -vf chromakey=green out.png
6131 @end example
6132
6133 @item
6134 Overlay a greenscreen-video on top of a static black background.
6135 @example
6136 ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
6137 @end example
6138 @end itemize
6139
6140 @section ciescope
6141
6142 Display CIE color diagram with pixels overlaid onto it.
6143
6144 The filter accepts the following options:
6145
6146 @table @option
6147 @item system
6148 Set color system.
6149
6150 @table @samp
6151 @item ntsc, 470m
6152 @item ebu, 470bg
6153 @item smpte
6154 @item 240m
6155 @item apple
6156 @item widergb
6157 @item cie1931
6158 @item rec709, hdtv
6159 @item uhdtv, rec2020
6160 @end table
6161
6162 @item cie
6163 Set CIE system.
6164
6165 @table @samp
6166 @item xyy
6167 @item ucs
6168 @item luv
6169 @end table
6170
6171 @item gamuts
6172 Set what gamuts to draw.
6173
6174 See @code{system} option for available values.
6175
6176 @item size, s
6177 Set ciescope size, by default set to 512.
6178
6179 @item intensity, i
6180 Set intensity used to map input pixel values to CIE diagram.
6181
6182 @item contrast
6183 Set contrast used to draw tongue colors that are out of active color system gamut.
6184
6185 @item corrgamma
6186 Correct gamma displayed on scope, by default enabled.
6187
6188 @item showwhite
6189 Show white point on CIE diagram, by default disabled.
6190
6191 @item gamma
6192 Set input gamma. Used only with XYZ input color space.
6193 @end table
6194
6195 @section codecview
6196
6197 Visualize information exported by some codecs.
6198
6199 Some codecs can export information through frames using side-data or other
6200 means. For example, some MPEG based codecs export motion vectors through the
6201 @var{export_mvs} flag in the codec @option{flags2} option.
6202
6203 The filter accepts the following option:
6204
6205 @table @option
6206 @item mv
6207 Set motion vectors to visualize.
6208
6209 Available flags for @var{mv} are:
6210
6211 @table @samp
6212 @item pf
6213 forward predicted MVs of P-frames
6214 @item bf
6215 forward predicted MVs of B-frames
6216 @item bb
6217 backward predicted MVs of B-frames
6218 @end table
6219
6220 @item qp
6221 Display quantization parameters using the chroma planes.
6222
6223 @item mv_type, mvt
6224 Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
6225
6226 Available flags for @var{mv_type} are:
6227
6228 @table @samp
6229 @item fp
6230 forward predicted MVs
6231 @item bp
6232 backward predicted MVs
6233 @end table
6234
6235 @item frame_type, ft
6236 Set frame type to visualize motion vectors of.
6237
6238 Available flags for @var{frame_type} are:
6239
6240 @table @samp
6241 @item if
6242 intra-coded frames (I-frames)
6243 @item pf
6244 predicted frames (P-frames)
6245 @item bf
6246 bi-directionally predicted frames (B-frames)
6247 @end table
6248 @end table
6249
6250 @subsection Examples
6251
6252 @itemize
6253 @item
6254 Visualize forward predicted MVs of all frames using @command{ffplay}:
6255 @example
6256 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
6257 @end example
6258
6259 @item
6260 Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
6261 @example
6262 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
6263 @end example
6264 @end itemize
6265
6266 @section colorbalance
6267 Modify intensity of primary colors (red, green and blue) of input frames.
6268
6269 The filter allows an input frame to be adjusted in the shadows, midtones or highlights
6270 regions for the red-cyan, green-magenta or blue-yellow balance.
6271
6272 A positive adjustment value shifts the balance towards the primary color, a negative
6273 value towards the complementary color.
6274
6275 The filter accepts the following options:
6276
6277 @table @option
6278 @item rs
6279 @item gs
6280 @item bs
6281 Adjust red, green and blue shadows (darkest pixels).
6282
6283 @item rm
6284 @item gm
6285 @item bm
6286 Adjust red, green and blue midtones (medium pixels).
6287
6288 @item rh
6289 @item gh
6290 @item bh
6291 Adjust red, green and blue highlights (brightest pixels).
6292
6293 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
6294 @end table
6295
6296 @subsection Examples
6297
6298 @itemize
6299 @item
6300 Add red color cast to shadows:
6301 @example
6302 colorbalance=rs=.3
6303 @end example
6304 @end itemize
6305
6306 @section colorkey
6307 RGB colorspace color keying.
6308
6309 The filter accepts the following options:
6310
6311 @table @option
6312 @item color
6313 The color which will be replaced with transparency.
6314
6315 @item similarity
6316 Similarity percentage with the key color.
6317
6318 0.01 matches only the exact key color, while 1.0 matches everything.
6319
6320 @item blend
6321 Blend percentage.
6322
6323 0.0 makes pixels either fully transparent, or not transparent at all.
6324
6325 Higher values result in semi-transparent pixels, with a higher transparency
6326 the more similar the pixels color is to the key color.
6327 @end table
6328
6329 @subsection Examples
6330
6331 @itemize
6332 @item
6333 Make every green pixel in the input image transparent:
6334 @example
6335 ffmpeg -i input.png -vf colorkey=green out.png
6336 @end example
6337
6338 @item
6339 Overlay a greenscreen-video on top of a static background image.
6340 @example
6341 ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
6342 @end example
6343 @end itemize
6344
6345 @section colorlevels
6346
6347 Adjust video input frames using levels.
6348
6349 The filter accepts the following options:
6350
6351 @table @option
6352 @item rimin
6353 @item gimin
6354 @item bimin
6355 @item aimin
6356 Adjust red, green, blue and alpha input black point.
6357 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
6358
6359 @item rimax
6360 @item gimax
6361 @item bimax
6362 @item aimax
6363 Adjust red, green, blue and alpha input white point.
6364 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
6365
6366 Input levels are used to lighten highlights (bright tones), darken shadows
6367 (dark tones), change the balance of bright and dark tones.
6368
6369 @item romin
6370 @item gomin
6371 @item bomin
6372 @item aomin
6373 Adjust red, green, blue and alpha output black point.
6374 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
6375
6376 @item romax
6377 @item gomax
6378 @item bomax
6379 @item aomax
6380 Adjust red, green, blue and alpha output white point.
6381 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
6382
6383 Output levels allows manual selection of a constrained output level range.
6384 @end table
6385
6386 @subsection Examples
6387
6388 @itemize
6389 @item
6390 Make video output darker:
6391 @example
6392 colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
6393 @end example
6394
6395 @item
6396 Increase contrast:
6397 @example
6398 colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
6399 @end example
6400
6401 @item
6402 Make video output lighter:
6403 @example
6404 colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
6405 @end example
6406
6407 @item
6408 Increase brightness:
6409 @example
6410 colorlevels=romin=0.5:gomin=0.5:bomin=0.5
6411 @end example
6412 @end itemize
6413
6414 @section colorchannelmixer
6415
6416 Adjust video input frames by re-mixing color channels.
6417
6418 This filter modifies a color channel by adding the values associated to
6419 the other channels of the same pixels. For example if the value to
6420 modify is red, the output value will be:
6421 @example
6422 @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
6423 @end example
6424
6425 The filter accepts the following options:
6426
6427 @table @option
6428 @item rr
6429 @item rg
6430 @item rb
6431 @item ra
6432 Adjust contribution of input red, green, blue and alpha channels for output red channel.
6433 Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
6434
6435 @item gr
6436 @item gg
6437 @item gb
6438 @item ga
6439 Adjust contribution of input red, green, blue and alpha channels for output green channel.
6440 Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
6441
6442 @item br
6443 @item bg
6444 @item bb
6445 @item ba
6446 Adjust contribution of input red, green, blue and alpha channels for output blue channel.
6447 Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
6448
6449 @item ar
6450 @item ag
6451 @item ab
6452 @item aa
6453 Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
6454 Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
6455
6456 Allowed ranges for options are @code{[-2.0, 2.0]}.
6457 @end table
6458
6459 @subsection Examples
6460
6461 @itemize
6462 @item
6463 Convert source to grayscale:
6464 @example
6465 colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
6466 @end example
6467 @item
6468 Simulate sepia tones:
6469 @example
6470 colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
6471 @end example
6472 @end itemize
6473
6474 @section colormatrix
6475
6476 Convert color matrix.
6477
6478 The filter accepts the following options:
6479
6480 @table @option
6481 @item src
6482 @item dst
6483 Specify the source and destination color matrix. Both values must be
6484 specified.
6485
6486 The accepted values are:
6487 @table @samp
6488 @item bt709
6489 BT.709
6490
6491 @item fcc
6492 FCC
6493
6494 @item bt601
6495 BT.601
6496
6497 @item bt470
6498 BT.470
6499
6500 @item bt470bg
6501 BT.470BG
6502
6503 @item smpte170m
6504 SMPTE-170M
6505
6506 @item smpte240m
6507 SMPTE-240M
6508
6509 @item bt2020
6510 BT.2020
6511 @end table
6512 @end table
6513
6514 For example to convert from BT.601 to SMPTE-240M, use the command:
6515 @example
6516 colormatrix=bt601:smpte240m
6517 @end example
6518
6519 @section colorspace
6520
6521 Convert colorspace, transfer characteristics or color primaries.
6522 Input video needs to have an even size.
6523
6524 The filter accepts the following options:
6525
6526 @table @option
6527 @anchor{all}
6528 @item all
6529 Specify all color properties at once.
6530
6531 The accepted values are:
6532 @table @samp
6533 @item bt470m
6534 BT.470M
6535
6536 @item bt470bg
6537 BT.470BG
6538
6539 @item bt601-6-525
6540 BT.601-6 525
6541
6542 @item bt601-6-625
6543 BT.601-6 625
6544
6545 @item bt709
6546 BT.709
6547
6548 @item smpte170m
6549 SMPTE-170M
6550
6551 @item smpte240m
6552 SMPTE-240M
6553
6554 @item bt2020
6555 BT.2020
6556
6557 @end table
6558
6559 @anchor{space}
6560 @item space
6561 Specify output colorspace.
6562
6563 The accepted values are:
6564 @table @samp
6565 @item bt709
6566 BT.709
6567
6568 @item fcc
6569 FCC
6570
6571 @item bt470bg
6572 BT.470BG or BT.601-6 625
6573
6574 @item smpte170m
6575 SMPTE-170M or BT.601-6 525
6576
6577 @item smpte240m
6578 SMPTE-240M
6579
6580 @item ycgco
6581 YCgCo
6582
6583 @item bt2020ncl
6584 BT.2020 with non-constant luminance
6585
6586 @end table
6587
6588 @anchor{trc}
6589 @item trc
6590 Specify output transfer characteristics.
6591
6592 The accepted values are:
6593 @table @samp
6594 @item bt709
6595 BT.709
6596
6597 @item bt470m
6598 BT.470M
6599
6600 @item bt470bg
6601 BT.470BG
6602
6603 @item gamma22
6604 Constant gamma of 2.2
6605
6606 @item gamma28
6607 Constant gamma of 2.8
6608
6609 @item smpte170m
6610 SMPTE-170M, BT.601-6 625 or BT.601-6 525
6611
6612 @item smpte240m
6613 SMPTE-240M
6614
6615 @item srgb
6616 SRGB
6617
6618 @item iec61966-2-1
6619 iec61966-2-1
6620
6621 @item iec61966-2-4
6622 iec61966-2-4
6623
6624 @item xvycc
6625 xvycc
6626
6627 @item bt2020-10
6628 BT.2020 for 10-bits content
6629
6630 @item bt2020-12
6631 BT.2020 for 12-bits content
6632
6633 @end table
6634
6635 @anchor{primaries}
6636 @item primaries
6637 Specify output color primaries.
6638
6639 The accepted values are:
6640 @table @samp
6641 @item bt709
6642 BT.709
6643
6644 @item bt470m
6645 BT.470M
6646
6647 @item bt470bg
6648 BT.470BG or BT.601-6 625
6649
6650 @item smpte170m
6651 SMPTE-170M or BT.601-6 525
6652
6653 @item smpte240m
6654 SMPTE-240M
6655
6656 @item film
6657 film
6658
6659 @item smpte431
6660 SMPTE-431
6661
6662 @item smpte432
6663 SMPTE-432
6664
6665 @item bt2020
6666 BT.2020
6667
6668 @item jedec-p22
6669 JEDEC P22 phosphors
6670
6671 @end table
6672
6673 @anchor{range}
6674 @item range
6675 Specify output color range.
6676
6677 The accepted values are:
6678 @table @samp
6679 @item tv
6680 TV (restricted) range
6681
6682 @item mpeg
6683 MPEG (restricted) range
6684
6685 @item pc
6686 PC (full) range
6687
6688 @item jpeg
6689 JPEG (full) range
6690
6691 @end table
6692
6693 @item format
6694 Specify output color format.
6695
6696 The accepted values are:
6697 @table @samp
6698 @item yuv420p
6699 YUV 4:2:0 planar 8-bits
6700
6701 @item yuv420p10
6702 YUV 4:2:0 planar 10-bits
6703
6704 @item yuv420p12
6705 YUV 4:2:0 planar 12-bits
6706
6707 @item yuv422p
6708 YUV 4:2:2 planar 8-bits
6709
6710 @item yuv422p10
6711 YUV 4:2:2 planar 10-bits
6712
6713 @item yuv422p12
6714 YUV 4:2:2 planar 12-bits
6715
6716 @item yuv444p
6717 YUV 4:4:4 planar 8-bits
6718
6719 @item yuv444p10
6720 YUV 4:4:4 planar 10-bits
6721
6722 @item yuv444p12
6723 YUV 4:4:4 planar 12-bits
6724
6725 @end table
6726
6727 @item fast
6728 Do a fast conversion, which skips gamma/primary correction. This will take
6729 significantly less CPU, but will be mathematically incorrect. To get output
6730 compatible with that produced by the colormatrix filter, use fast=1.
6731
6732 @item dither
6733 Specify dithering mode.
6734
6735 The accepted values are:
6736 @table @samp
6737 @item none
6738 No dithering
6739
6740 @item fsb
6741 Floyd-Steinberg dithering
6742 @end table
6743
6744 @item wpadapt
6745 Whitepoint adaptation mode.
6746
6747 The accepted values are:
6748 @table @samp
6749 @item bradford
6750 Bradford whitepoint adaptation
6751
6752 @item vonkries
6753 von Kries whitepoint adaptation
6754
6755 @item identity
6756 identity whitepoint adaptation (i.e. no whitepoint adaptation)
6757 @end table
6758
6759 @item iall
6760 Override all input properties at once. Same accepted values as @ref{all}.
6761
6762 @item ispace
6763 Override input colorspace. Same accepted values as @ref{space}.
6764
6765 @item iprimaries
6766 Override input color primaries. Same accepted values as @ref{primaries}.
6767
6768 @item itrc
6769 Override input transfer characteristics. Same accepted values as @ref{trc}.
6770
6771 @item irange
6772 Override input color range. Same accepted values as @ref{range}.
6773
6774 @end table
6775
6776 The filter converts the transfer characteristics, color space and color
6777 primaries to the specified user values. The output value, if not specified,
6778 is set to a default value based on the "all" property. If that property is
6779 also not specified, the filter will log an error. The output color range and
6780 format default to the same value as the input color range and format. The
6781 input transfer characteristics, color space, color primaries and color range
6782 should be set on the input data. If any of these are missing, the filter will
6783 log an error and no conversion will take place.
6784
6785 For example to convert the input to SMPTE-240M, use the command:
6786 @example
6787 colorspace=smpte240m
6788 @end example
6789
6790 @section convolution
6791
6792 Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
6793
6794 The filter accepts the following options:
6795
6796 @table @option
6797 @item 0m
6798 @item 1m
6799 @item 2m
6800 @item 3m
6801 Set matrix for each plane.
6802 Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
6803 and from 1 to 49 odd number of signed integers in @var{row} mode.
6804
6805 @item 0rdiv
6806 @item 1rdiv
6807 @item 2rdiv
6808 @item 3rdiv
6809 Set multiplier for calculated value for each plane.
6810 If unset or 0, it will be sum of all matrix elements.
6811
6812 @item 0bias
6813 @item 1bias
6814 @item 2bias
6815 @item 3bias
6816 Set bias for each plane. This value is added to the result of the multiplication.
6817 Useful for making the overall image brighter or darker. Default is 0.0.
6818
6819 @item 0mode
6820 @item 1mode
6821 @item 2mode
6822 @item 3mode
6823 Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
6824 Default is @var{square}.
6825 @end table
6826
6827 @subsection Examples
6828
6829 @itemize
6830 @item
6831 Apply sharpen:
6832 @example
6833 convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
6834 @end example
6835
6836 @item
6837 Apply blur:
6838 @example
6839 convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
6840 @end example
6841
6842 @item
6843 Apply edge enhance:
6844 @example
6845 convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
6846 @end example
6847
6848 @item
6849 Apply edge detect:
6850 @example
6851 convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
6852 @end example
6853
6854 @item
6855 Apply laplacian edge detector which includes diagonals:
6856 @example
6857 convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
6858 @end example
6859
6860 @item
6861 Apply emboss:
6862 @example
6863 convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
6864 @end example
6865 @end itemize
6866
6867 @section convolve
6868
6869 Apply 2D convolution of video stream in frequency domain using second stream
6870 as impulse.
6871
6872 The filter accepts the following options:
6873
6874 @table @option
6875 @item planes
6876 Set which planes to process.
6877
6878 @item impulse
6879 Set which impulse video frames will be processed, can be @var{first}
6880 or @var{all}. Default is @var{all}.
6881 @end table
6882
6883 The @code{convolve} filter also supports the @ref{framesync} options.
6884
6885 @section copy
6886
6887 Copy the input video source unchanged to the output. This is mainly useful for
6888 testing purposes.
6889
6890 @anchor{coreimage}
6891 @section coreimage
6892 Video filtering on GPU using Apple's CoreImage API on OSX.
6893
6894 Hardware acceleration is based on an OpenGL context. Usually, this means it is
6895 processed by video hardware. However, software-based OpenGL implementations
6896 exist which means there is no guarantee for hardware processing. It depends on
6897 the respective OSX.
6898
6899 There are many filters and image generators provided by Apple that come with a
6900 large variety of options. The filter has to be referenced by its name along
6901 with its options.
6902
6903 The coreimage filter accepts the following options:
6904 @table @option
6905 @item list_filters
6906 List all available filters and generators along with all their respective
6907 options as well as possible minimum and maximum values along with the default
6908 values.
6909 @example
6910 list_filters=true
6911 @end example
6912
6913 @item filter
6914 Specify all filters by their respective name and options.
6915 Use @var{list_filters} to determine all valid filter names and options.
6916 Numerical options are specified by a float value and are automatically clamped
6917 to their respective value range.  Vector and color options have to be specified
6918 by a list of space separated float values. Character escaping has to be done.
6919 A special option name @code{default} is available to use default options for a
6920 filter.
6921
6922 It is required to specify either @code{default} or at least one of the filter options.
6923 All omitted options are used with their default values.
6924 The syntax of the filter string is as follows:
6925 @example
6926 filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
6927 @end example
6928
6929 @item output_rect
6930 Specify a rectangle where the output of the filter chain is copied into the
6931 input image. It is given by a list of space separated float values:
6932 @example
6933 output_rect=x\ y\ width\ height
6934 @end example
6935 If not given, the output rectangle equals the dimensions of the input image.
6936 The output rectangle is automatically cropped at the borders of the input
6937 image. Negative values are valid for each component.
6938 @example
6939 output_rect=25\ 25\ 100\ 100
6940 @end example
6941 @end table
6942
6943 Several filters can be chained for successive processing without GPU-HOST
6944 transfers allowing for fast processing of complex filter chains.
6945 Currently, only filters with zero (generators) or exactly one (filters) input
6946 image and one output image are supported. Also, transition filters are not yet
6947 usable as intended.
6948
6949 Some filters generate output images with additional padding depending on the
6950 respective filter kernel. The padding is automatically removed to ensure the
6951 filter output has the same size as the input image.
6952
6953 For image generators, the size of the output image is determined by the
6954 previous output image of the filter chain or the input image of the whole
6955 filterchain, respectively. The generators do not use the pixel information of
6956 this image to generate their output. However, the generated output is
6957 blended onto this image, resulting in partial or complete coverage of the
6958 output image.
6959
6960 The @ref{coreimagesrc} video source can be used for generating input images
6961 which are directly fed into the filter chain. By using it, providing input
6962 images by another video source or an input video is not required.
6963
6964 @subsection Examples
6965
6966 @itemize
6967
6968 @item
6969 List all filters available:
6970 @example
6971 coreimage=list_filters=true
6972 @end example
6973
6974 @item
6975 Use the CIBoxBlur filter with default options to blur an image:
6976 @example
6977 coreimage=filter=CIBoxBlur@@default
6978 @end example
6979
6980 @item
6981 Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
6982 its center at 100x100 and a radius of 50 pixels:
6983 @example
6984 coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
6985 @end example
6986
6987 @item
6988 Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
6989 given as complete and escaped command-line for Apple's standard bash shell:
6990 @example
6991 ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
6992 @end example
6993 @end itemize
6994
6995 @section crop
6996
6997 Crop the input video to given dimensions.
6998
6999 It accepts the following parameters:
7000
7001 @table @option
7002 @item w, out_w
7003 The width of the output video. It defaults to @code{iw}.
7004 This expression is evaluated only once during the filter
7005 configuration, or when the @samp{w} or @samp{out_w} command is sent.
7006
7007 @item h, out_h
7008 The height of the output video. It defaults to @code{ih}.
7009 This expression is evaluated only once during the filter
7010 configuration, or when the @samp{h} or @samp{out_h} command is sent.
7011
7012 @item x
7013 The horizontal position, in the input video, of the left edge of the output
7014 video. It defaults to @code{(in_w-out_w)/2}.
7015 This expression is evaluated per-frame.
7016
7017 @item y
7018 The vertical position, in the input video, of the top edge of the output video.
7019 It defaults to @code{(in_h-out_h)/2}.
7020 This expression is evaluated per-frame.
7021
7022 @item keep_aspect
7023 If set to 1 will force the output display aspect ratio
7024 to be the same of the input, by changing the output sample aspect
7025 ratio. It defaults to 0.
7026
7027 @item exact
7028 Enable exact cropping. If enabled, subsampled videos will be cropped at exact
7029 width/height/x/y as specified and will not be rounded to nearest smaller value.
7030 It defaults to 0.
7031 @end table
7032
7033 The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
7034 expressions containing the following constants:
7035
7036 @table @option
7037 @item x
7038 @item y
7039 The computed values for @var{x} and @var{y}. They are evaluated for
7040 each new frame.
7041
7042 @item in_w
7043 @item in_h
7044 The input width and height.
7045
7046 @item iw
7047 @item ih
7048 These are the same as @var{in_w} and @var{in_h}.
7049
7050 @item out_w
7051 @item out_h
7052 The output (cropped) width and height.
7053
7054 @item ow
7055 @item oh
7056 These are the same as @var{out_w} and @var{out_h}.
7057
7058 @item a
7059 same as @var{iw} / @var{ih}
7060
7061 @item sar
7062 input sample aspect ratio
7063
7064 @item dar
7065 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
7066
7067 @item hsub
7068 @item vsub
7069 horizontal and vertical chroma subsample values. For example for the
7070 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
7071
7072 @item n
7073 The number of the input frame, starting from 0.
7074
7075 @item pos
7076 the position in the file of the input frame, NAN if unknown
7077
7078 @item t
7079 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
7080
7081 @end table
7082
7083 The expression for @var{out_w} may depend on the value of @var{out_h},
7084 and the expression for @var{out_h} may depend on @var{out_w}, but they
7085 cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
7086 evaluated after @var{out_w} and @var{out_h}.
7087
7088 The @var{x} and @var{y} parameters specify the expressions for the
7089 position of the top-left corner of the output (non-cropped) area. They
7090 are evaluated for each frame. If the evaluated value is not valid, it
7091 is approximated to the nearest valid value.
7092
7093 The expression for @var{x} may depend on @var{y}, and the expression
7094 for @var{y} may depend on @var{x}.
7095
7096 @subsection Examples
7097
7098 @itemize
7099 @item
7100 Crop area with size 100x100 at position (12,34).
7101 @example
7102 crop=100:100:12:34
7103 @end example
7104
7105 Using named options, the example above becomes:
7106 @example
7107 crop=w=100:h=100:x=12:y=34
7108 @end example
7109
7110 @item
7111 Crop the central input area with size 100x100:
7112 @example
7113 crop=100:100
7114 @end example
7115
7116 @item
7117 Crop the central input area with size 2/3 of the input video:
7118 @example
7119 crop=2/3*in_w:2/3*in_h
7120 @end example
7121
7122 @item
7123 Crop the input video central square:
7124 @example
7125 crop=out_w=in_h
7126 crop=in_h
7127 @end example
7128
7129 @item
7130 Delimit the rectangle with the top-left corner placed at position
7131 100:100 and the right-bottom corner corresponding to the right-bottom
7132 corner of the input image.
7133 @example
7134 crop=in_w-100:in_h-100:100:100
7135 @end example
7136
7137 @item
7138 Crop 10 pixels from the left and right borders, and 20 pixels from
7139 the top and bottom borders
7140 @example
7141 crop=in_w-2*10:in_h-2*20
7142 @end example
7143
7144 @item
7145 Keep only the bottom right quarter of the input image:
7146 @example
7147 crop=in_w/2:in_h/2:in_w/2:in_h/2
7148 @end example
7149
7150 @item
7151 Crop height for getting Greek harmony:
7152 @example
7153 crop=in_w:1/PHI*in_w
7154 @end example
7155
7156 @item
7157 Apply trembling effect:
7158 @example
7159 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)
7160 @end example
7161
7162 @item
7163 Apply erratic camera effect depending on timestamp:
7164 @example
7165 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)"
7166 @end example
7167
7168 @item
7169 Set x depending on the value of y:
7170 @example
7171 crop=in_w/2:in_h/2:y:10+10*sin(n/10)
7172 @end example
7173 @end itemize
7174
7175 @subsection Commands
7176
7177 This filter supports the following commands:
7178 @table @option
7179 @item w, out_w
7180 @item h, out_h
7181 @item x
7182 @item y
7183 Set width/height of the output video and the horizontal/vertical position
7184 in the input video.
7185 The command accepts the same syntax of the corresponding option.
7186
7187 If the specified expression is not valid, it is kept at its current
7188 value.
7189 @end table
7190
7191 @section cropdetect
7192
7193 Auto-detect the crop size.
7194
7195 It calculates the necessary cropping parameters and prints the
7196 recommended parameters via the logging system. The detected dimensions
7197 correspond to the non-black area of the input video.
7198
7199 It accepts the following parameters:
7200
7201 @table @option
7202
7203 @item limit
7204 Set higher black value threshold, which can be optionally specified
7205 from nothing (0) to everything (255 for 8-bit based formats). An intensity
7206 value greater to the set value is considered non-black. It defaults to 24.
7207 You can also specify a value between 0.0 and 1.0 which will be scaled depending
7208 on the bitdepth of the pixel format.
7209
7210 @item round
7211 The value which the width/height should be divisible by. It defaults to
7212 16. The offset is automatically adjusted to center the video. Use 2 to
7213 get only even dimensions (needed for 4:2:2 video). 16 is best when
7214 encoding to most video codecs.
7215
7216 @item reset_count, reset
7217 Set the counter that determines after how many frames cropdetect will
7218 reset the previously detected largest video area and start over to
7219 detect the current optimal crop area. Default value is 0.
7220
7221 This can be useful when channel logos distort the video area. 0
7222 indicates 'never reset', and returns the largest area encountered during
7223 playback.
7224 @end table
7225
7226 @anchor{cue}
7227 @section cue
7228
7229 Delay video filtering until a given wallclock timestamp. The filter first
7230 passes on @option{preroll} amount of frames, then it buffers at most
7231 @option{buffer} amount of frames and waits for the cue. After reaching the cue
7232 it forwards the buffered frames and also any subsequent frames coming in its
7233 input.
7234
7235 The filter can be used synchronize the output of multiple ffmpeg processes for
7236 realtime output devices like decklink. By putting the delay in the filtering
7237 chain and pre-buffering frames the process can pass on data to output almost
7238 immediately after the target wallclock timestamp is reached.
7239
7240 Perfect frame accuracy cannot be guaranteed, but the result is good enough for
7241 some use cases.
7242
7243 @table @option
7244
7245 @item cue
7246 The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
7247
7248 @item preroll
7249 The duration of content to pass on as preroll expressed in seconds. Default is 0.
7250
7251 @item buffer
7252 The maximum duration of content to buffer before waiting for the cue expressed
7253 in seconds. Default is 0.
7254
7255 @end table
7256
7257 @anchor{curves}
7258 @section curves
7259
7260 Apply color adjustments using curves.
7261
7262 This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
7263 component (red, green and blue) has its values defined by @var{N} key points
7264 tied from each other using a smooth curve. The x-axis represents the pixel
7265 values from the input frame, and the y-axis the new pixel values to be set for
7266 the output frame.
7267
7268 By default, a component curve is defined by the two points @var{(0;0)} and
7269 @var{(1;1)}. This creates a straight line where each original pixel value is
7270 "adjusted" to its own value, which means no change to the image.
7271
7272 The filter allows you to redefine these two points and add some more. A new
7273 curve (using a natural cubic spline interpolation) will be define to pass
7274 smoothly through all these new coordinates. The new defined points needs to be
7275 strictly increasing over the x-axis, and their @var{x} and @var{y} values must
7276 be in the @var{[0;1]} interval.  If the computed curves happened to go outside
7277 the vector spaces, the values will be clipped accordingly.
7278
7279 The filter accepts the following options:
7280
7281 @table @option
7282 @item preset
7283 Select one of the available color presets. This option can be used in addition
7284 to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
7285 options takes priority on the preset values.
7286 Available presets are:
7287 @table @samp
7288 @item none
7289 @item color_negative
7290 @item cross_process
7291 @item darker
7292 @item increase_contrast
7293 @item lighter
7294 @item linear_contrast
7295 @item medium_contrast
7296 @item negative
7297 @item strong_contrast
7298 @item vintage
7299 @end table
7300 Default is @code{none}.
7301 @item master, m
7302 Set the master key points. These points will define a second pass mapping. It
7303 is sometimes called a "luminance" or "value" mapping. It can be used with
7304 @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
7305 post-processing LUT.
7306 @item red, r
7307 Set the key points for the red component.
7308 @item green, g
7309 Set the key points for the green component.
7310 @item blue, b
7311 Set the key points for the blue component.
7312 @item all
7313 Set the key points for all components (not including master).
7314 Can be used in addition to the other key points component
7315 options. In this case, the unset component(s) will fallback on this
7316 @option{all} setting.
7317 @item psfile
7318 Specify a Photoshop curves file (@code{.acv}) to import the settings from.
7319 @item plot
7320 Save Gnuplot script of the curves in specified file.
7321 @end table
7322
7323 To avoid some filtergraph syntax conflicts, each key points list need to be
7324 defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
7325
7326 @subsection Examples
7327
7328 @itemize
7329 @item
7330 Increase slightly the middle level of blue:
7331 @example
7332 curves=blue='0/0 0.5/0.58 1/1'
7333 @end example
7334
7335 @item
7336 Vintage effect:
7337 @example
7338 curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
7339 @end example
7340 Here we obtain the following coordinates for each components:
7341 @table @var
7342 @item red
7343 @code{(0;0.11) (0.42;0.51) (1;0.95)}
7344 @item green
7345 @code{(0;0) (0.50;0.48) (1;1)}
7346 @item blue
7347 @code{(0;0.22) (0.49;0.44) (1;0.80)}
7348 @end table
7349
7350 @item
7351 The previous example can also be achieved with the associated built-in preset:
7352 @example
7353 curves=preset=vintage
7354 @end example
7355
7356 @item
7357 Or simply:
7358 @example
7359 curves=vintage
7360 @end example
7361
7362 @item
7363 Use a Photoshop preset and redefine the points of the green component:
7364 @example
7365 curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
7366 @end example
7367
7368 @item
7369 Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
7370 and @command{gnuplot}:
7371 @example
7372 ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
7373 gnuplot -p /tmp/curves.plt
7374 @end example
7375 @end itemize
7376
7377 @section datascope
7378
7379 Video data analysis filter.
7380
7381 This filter shows hexadecimal pixel values of part of video.
7382
7383 The filter accepts the following options:
7384
7385 @table @option
7386 @item size, s
7387 Set output video size.
7388
7389 @item x
7390 Set x offset from where to pick pixels.
7391
7392 @item y
7393 Set y offset from where to pick pixels.
7394
7395 @item mode
7396 Set scope mode, can be one of the following:
7397 @table @samp
7398 @item mono
7399 Draw hexadecimal pixel values with white color on black background.
7400
7401 @item color
7402 Draw hexadecimal pixel values with input video pixel color on black
7403 background.
7404
7405 @item color2
7406 Draw hexadecimal pixel values on color background picked from input video,
7407 the text color is picked in such way so its always visible.
7408 @end table
7409
7410 @item axis
7411 Draw rows and columns numbers on left and top of video.
7412
7413 @item opacity
7414 Set background opacity.
7415 @end table
7416
7417 @section dctdnoiz
7418
7419 Denoise frames using 2D DCT (frequency domain filtering).
7420
7421 This filter is not designed for real time.
7422
7423 The filter accepts the following options:
7424
7425 @table @option
7426 @item sigma, s
7427 Set the noise sigma constant.
7428
7429 This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
7430 coefficient (absolute value) below this threshold with be dropped.
7431
7432 If you need a more advanced filtering, see @option{expr}.
7433
7434 Default is @code{0}.
7435
7436 @item overlap
7437 Set number overlapping pixels for each block. Since the filter can be slow, you
7438 may want to reduce this value, at the cost of a less effective filter and the
7439 risk of various artefacts.
7440
7441 If the overlapping value doesn't permit processing the whole input width or
7442 height, a warning will be displayed and according borders won't be denoised.
7443
7444 Default value is @var{blocksize}-1, which is the best possible setting.
7445
7446 @item expr, e
7447 Set the coefficient factor expression.
7448
7449 For each coefficient of a DCT block, this expression will be evaluated as a
7450 multiplier value for the coefficient.
7451
7452 If this is option is set, the @option{sigma} option will be ignored.
7453
7454 The absolute value of the coefficient can be accessed through the @var{c}
7455 variable.
7456
7457 @item n
7458 Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
7459 @var{blocksize}, which is the width and height of the processed blocks.
7460
7461 The default value is @var{3} (8x8) and can be raised to @var{4} for a
7462 @var{blocksize} of 16x16. Note that changing this setting has huge consequences
7463 on the speed processing. Also, a larger block size does not necessarily means a
7464 better de-noising.
7465 @end table
7466
7467 @subsection Examples
7468
7469 Apply a denoise with a @option{sigma} of @code{4.5}:
7470 @example
7471 dctdnoiz=4.5
7472 @end example
7473
7474 The same operation can be achieved using the expression system:
7475 @example
7476 dctdnoiz=e='gte(c, 4.5*3)'
7477 @end example
7478
7479 Violent denoise using a block size of @code{16x16}:
7480 @example
7481 dctdnoiz=15:n=4
7482 @end example
7483
7484 @section deband
7485
7486 Remove banding artifacts from input video.
7487 It works by replacing banded pixels with average value of referenced pixels.
7488
7489 The filter accepts the following options:
7490
7491 @table @option
7492 @item 1thr
7493 @item 2thr
7494 @item 3thr
7495 @item 4thr
7496 Set banding detection threshold for each plane. Default is 0.02.
7497 Valid range is 0.00003 to 0.5.
7498 If difference between current pixel and reference pixel is less than threshold,
7499 it will be considered as banded.
7500
7501 @item range, r
7502 Banding detection range in pixels. Default is 16. If positive, random number
7503 in range 0 to set value will be used. If negative, exact absolute value
7504 will be used.
7505 The range defines square of four pixels around current pixel.
7506
7507 @item direction, d
7508 Set direction in radians from which four pixel will be compared. If positive,
7509 random direction from 0 to set direction will be picked. If negative, exact of
7510 absolute value will be picked. For example direction 0, -PI or -2*PI radians
7511 will pick only pixels on same row and -PI/2 will pick only pixels on same
7512 column.
7513
7514 @item blur, b
7515 If enabled, current pixel is compared with average value of all four
7516 surrounding pixels. The default is enabled. If disabled current pixel is
7517 compared with all four surrounding pixels. The pixel is considered banded
7518 if only all four differences with surrounding pixels are less than threshold.
7519
7520 @item coupling, c
7521 If enabled, current pixel is changed if and only if all pixel components are banded,
7522 e.g. banding detection threshold is triggered for all color components.
7523 The default is disabled.
7524 @end table
7525
7526 @section deblock
7527
7528 Remove blocking artifacts from input video.
7529
7530 The filter accepts the following options:
7531
7532 @table @option
7533 @item filter
7534 Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
7535 This controls what kind of deblocking is applied.
7536
7537 @item block
7538 Set size of block, allowed range is from 4 to 512. Default is @var{8}.
7539
7540 @item alpha
7541 @item beta
7542 @item gamma
7543 @item delta
7544 Set blocking detection thresholds. Allowed range is 0 to 1.
7545 Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
7546 Using higher threshold gives more deblocking strength.
7547 Setting @var{alpha} controls threshold detection at exact edge of block.
7548 Remaining options controls threshold detection near the edge. Each one for
7549 below/above or left/right. Setting any of those to @var{0} disables
7550 deblocking.
7551
7552 @item planes
7553 Set planes to filter. Default is to filter all available planes.
7554 @end table
7555
7556 @subsection Examples
7557
7558 @itemize
7559 @item
7560 Deblock using weak filter and block size of 4 pixels.
7561 @example
7562 deblock=filter=weak:block=4
7563 @end example
7564
7565 @item
7566 Deblock using strong filter, block size of 4 pixels and custom thresholds for
7567 deblocking more edges.
7568 @example
7569 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
7570 @end example
7571
7572 @item
7573 Similar as above, but filter only first plane.
7574 @example
7575 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
7576 @end example
7577
7578 @item
7579 Similar as above, but filter only second and third plane.
7580 @example
7581 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
7582 @end example
7583 @end itemize
7584
7585 @anchor{decimate}
7586 @section decimate
7587
7588 Drop duplicated frames at regular intervals.
7589
7590 The filter accepts the following options:
7591
7592 @table @option
7593 @item cycle
7594 Set the number of frames from which one will be dropped. Setting this to
7595 @var{N} means one frame in every batch of @var{N} frames will be dropped.
7596 Default is @code{5}.
7597
7598 @item dupthresh
7599 Set the threshold for duplicate detection. If the difference metric for a frame
7600 is less than or equal to this value, then it is declared as duplicate. Default
7601 is @code{1.1}
7602
7603 @item scthresh
7604 Set scene change threshold. Default is @code{15}.
7605
7606 @item blockx
7607 @item blocky
7608 Set the size of the x and y-axis blocks used during metric calculations.
7609 Larger blocks give better noise suppression, but also give worse detection of
7610 small movements. Must be a power of two. Default is @code{32}.
7611
7612 @item ppsrc
7613 Mark main input as a pre-processed input and activate clean source input
7614 stream. This allows the input to be pre-processed with various filters to help
7615 the metrics calculation while keeping the frame selection lossless. When set to
7616 @code{1}, the first stream is for the pre-processed input, and the second
7617 stream is the clean source from where the kept frames are chosen. Default is
7618 @code{0}.
7619
7620 @item chroma
7621 Set whether or not chroma is considered in the metric calculations. Default is
7622 @code{1}.
7623 @end table
7624
7625 @section deconvolve
7626
7627 Apply 2D deconvolution of video stream in frequency domain using second stream
7628 as impulse.
7629
7630 The filter accepts the following options:
7631
7632 @table @option
7633 @item planes
7634 Set which planes to process.
7635
7636 @item impulse
7637 Set which impulse video frames will be processed, can be @var{first}
7638 or @var{all}. Default is @var{all}.
7639
7640 @item noise
7641 Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
7642 and height are not same and not power of 2 or if stream prior to convolving
7643 had noise.
7644 @end table
7645
7646 The @code{deconvolve} filter also supports the @ref{framesync} options.
7647
7648 @section deflate
7649
7650 Apply deflate effect to the video.
7651
7652 This filter replaces the pixel by the local(3x3) average by taking into account
7653 only values lower than the pixel.
7654
7655 It accepts the following options:
7656
7657 @table @option
7658 @item threshold0
7659 @item threshold1
7660 @item threshold2
7661 @item threshold3
7662 Limit the maximum change for each plane, default is 65535.
7663 If 0, plane will remain unchanged.
7664 @end table
7665
7666 @section deflicker
7667
7668 Remove temporal frame luminance variations.
7669
7670 It accepts the following options:
7671
7672 @table @option
7673 @item size, s
7674 Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
7675
7676 @item mode, m
7677 Set averaging mode to smooth temporal luminance variations.
7678
7679 Available values are:
7680 @table @samp
7681 @item am
7682 Arithmetic mean
7683
7684 @item gm
7685 Geometric mean
7686
7687 @item hm
7688 Harmonic mean
7689
7690 @item qm
7691 Quadratic mean
7692
7693 @item cm
7694 Cubic mean
7695
7696 @item pm
7697 Power mean
7698
7699 @item median
7700 Median
7701 @end table
7702
7703 @item bypass
7704 Do not actually modify frame. Useful when one only wants metadata.
7705 @end table
7706
7707 @section dejudder
7708
7709 Remove judder produced by partially interlaced telecined content.
7710
7711 Judder can be introduced, for instance, by @ref{pullup} filter. If the original
7712 source was partially telecined content then the output of @code{pullup,dejudder}
7713 will have a variable frame rate. May change the recorded frame rate of the
7714 container. Aside from that change, this filter will not affect constant frame
7715 rate video.
7716
7717 The option available in this filter is:
7718 @table @option
7719
7720 @item cycle
7721 Specify the length of the window over which the judder repeats.
7722
7723 Accepts any integer greater than 1. Useful values are:
7724 @table @samp
7725
7726 @item 4
7727 If the original was telecined from 24 to 30 fps (Film to NTSC).
7728
7729 @item 5
7730 If the original was telecined from 25 to 30 fps (PAL to NTSC).
7731
7732 @item 20
7733 If a mixture of the two.
7734 @end table
7735
7736 The default is @samp{4}.
7737 @end table
7738
7739 @section delogo
7740
7741 Suppress a TV station logo by a simple interpolation of the surrounding
7742 pixels. Just set a rectangle covering the logo and watch it disappear
7743 (and sometimes something even uglier appear - your mileage may vary).
7744
7745 It accepts the following parameters:
7746 @table @option
7747
7748 @item x
7749 @item y
7750 Specify the top left corner coordinates of the logo. They must be
7751 specified.
7752
7753 @item w
7754 @item h
7755 Specify the width and height of the logo to clear. They must be
7756 specified.
7757
7758 @item band, t
7759 Specify the thickness of the fuzzy edge of the rectangle (added to
7760 @var{w} and @var{h}). The default value is 1. This option is
7761 deprecated, setting higher values should no longer be necessary and
7762 is not recommended.
7763
7764 @item show
7765 When set to 1, a green rectangle is drawn on the screen to simplify
7766 finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
7767 The default value is 0.
7768
7769 The rectangle is drawn on the outermost pixels which will be (partly)
7770 replaced with interpolated values. The values of the next pixels
7771 immediately outside this rectangle in each direction will be used to
7772 compute the interpolated pixel values inside the rectangle.
7773
7774 @end table
7775
7776 @subsection Examples
7777
7778 @itemize
7779 @item
7780 Set a rectangle covering the area with top left corner coordinates 0,0
7781 and size 100x77, and a band of size 10:
7782 @example
7783 delogo=x=0:y=0:w=100:h=77:band=10
7784 @end example
7785
7786 @end itemize
7787
7788 @section deshake
7789
7790 Attempt to fix small changes in horizontal and/or vertical shift. This
7791 filter helps remove camera shake from hand-holding a camera, bumping a
7792 tripod, moving on a vehicle, etc.
7793
7794 The filter accepts the following options:
7795
7796 @table @option
7797
7798 @item x
7799 @item y
7800 @item w
7801 @item h
7802 Specify a rectangular area where to limit the search for motion
7803 vectors.
7804 If desired the search for motion vectors can be limited to a
7805 rectangular area of the frame defined by its top left corner, width
7806 and height. These parameters have the same meaning as the drawbox
7807 filter which can be used to visualise the position of the bounding
7808 box.
7809
7810 This is useful when simultaneous movement of subjects within the frame
7811 might be confused for camera motion by the motion vector search.
7812
7813 If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
7814 then the full frame is used. This allows later options to be set
7815 without specifying the bounding box for the motion vector search.
7816
7817 Default - search the whole frame.
7818
7819 @item rx
7820 @item ry
7821 Specify the maximum extent of movement in x and y directions in the
7822 range 0-64 pixels. Default 16.
7823
7824 @item edge
7825 Specify how to generate pixels to fill blanks at the edge of the
7826 frame. Available values are:
7827 @table @samp
7828 @item blank, 0
7829 Fill zeroes at blank locations
7830 @item original, 1
7831 Original image at blank locations
7832 @item clamp, 2
7833 Extruded edge value at blank locations
7834 @item mirror, 3
7835 Mirrored edge at blank locations
7836 @end table
7837 Default value is @samp{mirror}.
7838
7839 @item blocksize
7840 Specify the blocksize to use for motion search. Range 4-128 pixels,
7841 default 8.
7842
7843 @item contrast
7844 Specify the contrast threshold for blocks. Only blocks with more than
7845 the specified contrast (difference between darkest and lightest
7846 pixels) will be considered. Range 1-255, default 125.
7847
7848 @item search
7849 Specify the search strategy. Available values are:
7850 @table @samp
7851 @item exhaustive, 0
7852 Set exhaustive search
7853 @item less, 1
7854 Set less exhaustive search.
7855 @end table
7856 Default value is @samp{exhaustive}.
7857
7858 @item filename
7859 If set then a detailed log of the motion search is written to the
7860 specified file.
7861
7862 @end table
7863
7864 @section despill
7865
7866 Remove unwanted contamination of foreground colors, caused by reflected color of
7867 greenscreen or bluescreen.
7868
7869 This filter accepts the following options:
7870
7871 @table @option
7872 @item type
7873 Set what type of despill to use.
7874
7875 @item mix
7876 Set how spillmap will be generated.
7877
7878 @item expand
7879 Set how much to get rid of still remaining spill.
7880
7881 @item red
7882 Controls amount of red in spill area.
7883
7884 @item green
7885 Controls amount of green in spill area.
7886 Should be -1 for greenscreen.
7887
7888 @item blue
7889 Controls amount of blue in spill area.
7890 Should be -1 for bluescreen.
7891
7892 @item brightness
7893 Controls brightness of spill area, preserving colors.
7894
7895 @item alpha
7896 Modify alpha from generated spillmap.
7897 @end table
7898
7899 @section detelecine
7900
7901 Apply an exact inverse of the telecine operation. It requires a predefined
7902 pattern specified using the pattern option which must be the same as that passed
7903 to the telecine filter.
7904
7905 This filter accepts the following options:
7906
7907 @table @option
7908 @item first_field
7909 @table @samp
7910 @item top, t
7911 top field first
7912 @item bottom, b
7913 bottom field first
7914 The default value is @code{top}.
7915 @end table
7916
7917 @item pattern
7918 A string of numbers representing the pulldown pattern you wish to apply.
7919 The default value is @code{23}.
7920
7921 @item start_frame
7922 A number representing position of the first frame with respect to the telecine
7923 pattern. This is to be used if the stream is cut. The default value is @code{0}.
7924 @end table
7925
7926 @section dilation
7927
7928 Apply dilation effect to the video.
7929
7930 This filter replaces the pixel by the local(3x3) maximum.
7931
7932 It accepts the following options:
7933
7934 @table @option
7935 @item threshold0
7936 @item threshold1
7937 @item threshold2
7938 @item threshold3
7939 Limit the maximum change for each plane, default is 65535.
7940 If 0, plane will remain unchanged.
7941
7942 @item coordinates
7943 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
7944 pixels are used.
7945
7946 Flags to local 3x3 coordinates maps like this:
7947
7948     1 2 3
7949     4   5
7950     6 7 8
7951 @end table
7952
7953 @section displace
7954
7955 Displace pixels as indicated by second and third input stream.
7956
7957 It takes three input streams and outputs one stream, the first input is the
7958 source, and second and third input are displacement maps.
7959
7960 The second input specifies how much to displace pixels along the
7961 x-axis, while the third input specifies how much to displace pixels
7962 along the y-axis.
7963 If one of displacement map streams terminates, last frame from that
7964 displacement map will be used.
7965
7966 Note that once generated, displacements maps can be reused over and over again.
7967
7968 A description of the accepted options follows.
7969
7970 @table @option
7971 @item edge
7972 Set displace behavior for pixels that are out of range.
7973
7974 Available values are:
7975 @table @samp
7976 @item blank
7977 Missing pixels are replaced by black pixels.
7978
7979 @item smear
7980 Adjacent pixels will spread out to replace missing pixels.
7981
7982 @item wrap
7983 Out of range pixels are wrapped so they point to pixels of other side.
7984
7985 @item mirror
7986 Out of range pixels will be replaced with mirrored pixels.
7987 @end table
7988 Default is @samp{smear}.
7989
7990 @end table
7991
7992 @subsection Examples
7993
7994 @itemize
7995 @item
7996 Add ripple effect to rgb input of video size hd720:
7997 @example
7998 ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
7999 @end example
8000
8001 @item
8002 Add wave effect to rgb input of video size hd720:
8003 @example
8004 ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
8005 @end example
8006 @end itemize
8007
8008 @section drawbox
8009
8010 Draw a colored box on the input image.
8011
8012 It accepts the following parameters:
8013
8014 @table @option
8015 @item x
8016 @item y
8017 The expressions which specify the top left corner coordinates of the box. It defaults to 0.
8018
8019 @item width, w
8020 @item height, h
8021 The expressions which specify the width and height of the box; if 0 they are interpreted as
8022 the input width and height. It defaults to 0.
8023
8024 @item color, c
8025 Specify the color of the box to write. For the general syntax of this option,
8026 check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
8027 value @code{invert} is used, the box edge color is the same as the
8028 video with inverted luma.
8029
8030 @item thickness, t
8031 The expression which sets the thickness of the box edge.
8032 A value of @code{fill} will create a filled box. Default value is @code{3}.
8033
8034 See below for the list of accepted constants.
8035
8036 @item replace
8037 Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
8038 will overwrite the video's color and alpha pixels.
8039 Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
8040 @end table
8041
8042 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
8043 following constants:
8044
8045 @table @option
8046 @item dar
8047 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
8048
8049 @item hsub
8050 @item vsub
8051 horizontal and vertical chroma subsample values. For example for the
8052 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8053
8054 @item in_h, ih
8055 @item in_w, iw
8056 The input width and height.
8057
8058 @item sar
8059 The input sample aspect ratio.
8060
8061 @item x
8062 @item y
8063 The x and y offset coordinates where the box is drawn.
8064
8065 @item w
8066 @item h
8067 The width and height of the drawn box.
8068
8069 @item t
8070 The thickness of the drawn box.
8071
8072 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
8073 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
8074
8075 @end table
8076
8077 @subsection Examples
8078
8079 @itemize
8080 @item
8081 Draw a black box around the edge of the input image:
8082 @example
8083 drawbox
8084 @end example
8085
8086 @item
8087 Draw a box with color red and an opacity of 50%:
8088 @example
8089 drawbox=10:20:200:60:red@@0.5
8090 @end example
8091
8092 The previous example can be specified as:
8093 @example
8094 drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
8095 @end example
8096
8097 @item
8098 Fill the box with pink color:
8099 @example
8100 drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
8101 @end example
8102
8103 @item
8104 Draw a 2-pixel red 2.40:1 mask:
8105 @example
8106 drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
8107 @end example
8108 @end itemize
8109
8110 @section drawgrid
8111
8112 Draw a grid on the input image.
8113
8114 It accepts the following parameters:
8115
8116 @table @option
8117 @item x
8118 @item y
8119 The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
8120
8121 @item width, w
8122 @item height, h
8123 The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
8124 input width and height, respectively, minus @code{thickness}, so image gets
8125 framed. Default to 0.
8126
8127 @item color, c
8128 Specify the color of the grid. For the general syntax of this option,
8129 check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
8130 value @code{invert} is used, the grid color is the same as the
8131 video with inverted luma.
8132
8133 @item thickness, t
8134 The expression which sets the thickness of the grid line. Default value is @code{1}.
8135
8136 See below for the list of accepted constants.
8137
8138 @item replace
8139 Applicable if the input has alpha. With @code{1} the pixels of the painted grid
8140 will overwrite the video's color and alpha pixels.
8141 Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
8142 @end table
8143
8144 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
8145 following constants:
8146
8147 @table @option
8148 @item dar
8149 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
8150
8151 @item hsub
8152 @item vsub
8153 horizontal and vertical chroma subsample values. For example for the
8154 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8155
8156 @item in_h, ih
8157 @item in_w, iw
8158 The input grid cell width and height.
8159
8160 @item sar
8161 The input sample aspect ratio.
8162
8163 @item x
8164 @item y
8165 The x and y coordinates of some point of grid intersection (meant to configure offset).
8166
8167 @item w
8168 @item h
8169 The width and height of the drawn cell.
8170
8171 @item t
8172 The thickness of the drawn cell.
8173
8174 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
8175 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
8176
8177 @end table
8178
8179 @subsection Examples
8180
8181 @itemize
8182 @item
8183 Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
8184 @example
8185 drawgrid=width=100:height=100:thickness=2:color=red@@0.5
8186 @end example
8187
8188 @item
8189 Draw a white 3x3 grid with an opacity of 50%:
8190 @example
8191 drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
8192 @end example
8193 @end itemize
8194
8195 @anchor{drawtext}
8196 @section drawtext
8197
8198 Draw a text string or text from a specified file on top of a video, using the
8199 libfreetype library.
8200
8201 To enable compilation of this filter, you need to configure FFmpeg with
8202 @code{--enable-libfreetype}.
8203 To enable default font fallback and the @var{font} option you need to
8204 configure FFmpeg with @code{--enable-libfontconfig}.
8205 To enable the @var{text_shaping} option, you need to configure FFmpeg with
8206 @code{--enable-libfribidi}.
8207
8208 @subsection Syntax
8209
8210 It accepts the following parameters:
8211
8212 @table @option
8213
8214 @item box
8215 Used to draw a box around text using the background color.
8216 The value must be either 1 (enable) or 0 (disable).
8217 The default value of @var{box} is 0.
8218
8219 @item boxborderw
8220 Set the width of the border to be drawn around the box using @var{boxcolor}.
8221 The default value of @var{boxborderw} is 0.
8222
8223 @item boxcolor
8224 The color to be used for drawing box around text. For the syntax of this
8225 option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8226
8227 The default value of @var{boxcolor} is "white".
8228
8229 @item line_spacing
8230 Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
8231 The default value of @var{line_spacing} is 0.
8232
8233 @item borderw
8234 Set the width of the border to be drawn around the text using @var{bordercolor}.
8235 The default value of @var{borderw} is 0.
8236
8237 @item bordercolor
8238 Set the color to be used for drawing border around text. For the syntax of this
8239 option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8240
8241 The default value of @var{bordercolor} is "black".
8242
8243 @item expansion
8244 Select how the @var{text} is expanded. Can be either @code{none},
8245 @code{strftime} (deprecated) or
8246 @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
8247 below for details.
8248
8249 @item basetime
8250 Set a start time for the count. Value is in microseconds. Only applied
8251 in the deprecated strftime expansion mode. To emulate in normal expansion
8252 mode use the @code{pts} function, supplying the start time (in seconds)
8253 as the second argument.
8254
8255 @item fix_bounds
8256 If true, check and fix text coords to avoid clipping.
8257
8258 @item fontcolor
8259 The color to be used for drawing fonts. For the syntax of this option, check
8260 the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8261
8262 The default value of @var{fontcolor} is "black".
8263
8264 @item fontcolor_expr
8265 String which is expanded the same way as @var{text} to obtain dynamic
8266 @var{fontcolor} value. By default this option has empty value and is not
8267 processed. When this option is set, it overrides @var{fontcolor} option.
8268
8269 @item font
8270 The font family to be used for drawing text. By default Sans.
8271
8272 @item fontfile
8273 The font file to be used for drawing text. The path must be included.
8274 This parameter is mandatory if the fontconfig support is disabled.
8275
8276 @item alpha
8277 Draw the text applying alpha blending. The value can
8278 be a number between 0.0 and 1.0.
8279 The expression accepts the same variables @var{x, y} as well.
8280 The default value is 1.
8281 Please see @var{fontcolor_expr}.
8282
8283 @item fontsize
8284 The font size to be used for drawing text.
8285 The default value of @var{fontsize} is 16.
8286
8287 @item text_shaping
8288 If set to 1, attempt to shape the text (for example, reverse the order of
8289 right-to-left text and join Arabic characters) before drawing it.
8290 Otherwise, just draw the text exactly as given.
8291 By default 1 (if supported).
8292
8293 @item ft_load_flags
8294 The flags to be used for loading the fonts.
8295
8296 The flags map the corresponding flags supported by libfreetype, and are
8297 a combination of the following values:
8298 @table @var
8299 @item default
8300 @item no_scale
8301 @item no_hinting
8302 @item render
8303 @item no_bitmap
8304 @item vertical_layout
8305 @item force_autohint
8306 @item crop_bitmap
8307 @item pedantic
8308 @item ignore_global_advance_width
8309 @item no_recurse
8310 @item ignore_transform
8311 @item monochrome
8312 @item linear_design
8313 @item no_autohint
8314 @end table
8315
8316 Default value is "default".
8317
8318 For more information consult the documentation for the FT_LOAD_*
8319 libfreetype flags.
8320
8321 @item shadowcolor
8322 The color to be used for drawing a shadow behind the drawn text. For the
8323 syntax of this option, check the @ref{color syntax,,"Color" section in the
8324 ffmpeg-utils manual,ffmpeg-utils}.
8325
8326 The default value of @var{shadowcolor} is "black".
8327
8328 @item shadowx
8329 @item shadowy
8330 The x and y offsets for the text shadow position with respect to the
8331 position of the text. They can be either positive or negative
8332 values. The default value for both is "0".
8333
8334 @item start_number
8335 The starting frame number for the n/frame_num variable. The default value
8336 is "0".
8337
8338 @item tabsize
8339 The size in number of spaces to use for rendering the tab.
8340 Default value is 4.
8341
8342 @item timecode
8343 Set the initial timecode representation in "hh:mm:ss[:;.]ff"
8344 format. It can be used with or without text parameter. @var{timecode_rate}
8345 option must be specified.
8346
8347 @item timecode_rate, rate, r
8348 Set the timecode frame rate (timecode only). Value will be rounded to nearest
8349 integer. Minimum value is "1".
8350 Drop-frame timecode is supported for frame rates 30 & 60.
8351
8352 @item tc24hmax
8353 If set to 1, the output of the timecode option will wrap around at 24 hours.
8354 Default is 0 (disabled).
8355
8356 @item text
8357 The text string to be drawn. The text must be a sequence of UTF-8
8358 encoded characters.
8359 This parameter is mandatory if no file is specified with the parameter
8360 @var{textfile}.
8361
8362 @item textfile
8363 A text file containing text to be drawn. The text must be a sequence
8364 of UTF-8 encoded characters.
8365
8366 This parameter is mandatory if no text string is specified with the
8367 parameter @var{text}.
8368
8369 If both @var{text} and @var{textfile} are specified, an error is thrown.
8370
8371 @item reload
8372 If set to 1, the @var{textfile} will be reloaded before each frame.
8373 Be sure to update it atomically, or it may be read partially, or even fail.
8374
8375 @item x
8376 @item y
8377 The expressions which specify the offsets where text will be drawn
8378 within the video frame. They are relative to the top/left border of the
8379 output image.
8380
8381 The default value of @var{x} and @var{y} is "0".
8382
8383 See below for the list of accepted constants and functions.
8384 @end table
8385
8386 The parameters for @var{x} and @var{y} are expressions containing the
8387 following constants and functions:
8388
8389 @table @option
8390 @item dar
8391 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
8392
8393 @item hsub
8394 @item vsub
8395 horizontal and vertical chroma subsample values. For example for the
8396 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8397
8398 @item line_h, lh
8399 the height of each text line
8400
8401 @item main_h, h, H
8402 the input height
8403
8404 @item main_w, w, W
8405 the input width
8406
8407 @item max_glyph_a, ascent
8408 the maximum distance from the baseline to the highest/upper grid
8409 coordinate used to place a glyph outline point, for all the rendered
8410 glyphs.
8411 It is a positive value, due to the grid's orientation with the Y axis
8412 upwards.
8413
8414 @item max_glyph_d, descent
8415 the maximum distance from the baseline to the lowest grid coordinate
8416 used to place a glyph outline point, for all the rendered glyphs.
8417 This is a negative value, due to the grid's orientation, with the Y axis
8418 upwards.
8419
8420 @item max_glyph_h
8421 maximum glyph height, that is the maximum height for all the glyphs
8422 contained in the rendered text, it is equivalent to @var{ascent} -
8423 @var{descent}.
8424
8425 @item max_glyph_w
8426 maximum glyph width, that is the maximum width for all the glyphs
8427 contained in the rendered text
8428
8429 @item n
8430 the number of input frame, starting from 0
8431
8432 @item rand(min, max)
8433 return a random number included between @var{min} and @var{max}
8434
8435 @item sar
8436 The input sample aspect ratio.
8437
8438 @item t
8439 timestamp expressed in seconds, NAN if the input timestamp is unknown
8440
8441 @item text_h, th
8442 the height of the rendered text
8443
8444 @item text_w, tw
8445 the width of the rendered text
8446
8447 @item x
8448 @item y
8449 the x and y offset coordinates where the text is drawn.
8450
8451 These parameters allow the @var{x} and @var{y} expressions to refer
8452 each other, so you can for example specify @code{y=x/dar}.
8453 @end table
8454
8455 @anchor{drawtext_expansion}
8456 @subsection Text expansion
8457
8458 If @option{expansion} is set to @code{strftime},
8459 the filter recognizes strftime() sequences in the provided text and
8460 expands them accordingly. Check the documentation of strftime(). This
8461 feature is deprecated.
8462
8463 If @option{expansion} is set to @code{none}, the text is printed verbatim.
8464
8465 If @option{expansion} is set to @code{normal} (which is the default),
8466 the following expansion mechanism is used.
8467
8468 The backslash character @samp{\}, followed by any character, always expands to
8469 the second character.
8470
8471 Sequences of the form @code{%@{...@}} are expanded. The text between the
8472 braces is a function name, possibly followed by arguments separated by ':'.
8473 If the arguments contain special characters or delimiters (':' or '@}'),
8474 they should be escaped.
8475
8476 Note that they probably must also be escaped as the value for the
8477 @option{text} option in the filter argument string and as the filter
8478 argument in the filtergraph description, and possibly also for the shell,
8479 that makes up to four levels of escaping; using a text file avoids these
8480 problems.
8481
8482 The following functions are available:
8483
8484 @table @command
8485
8486 @item expr, e
8487 The expression evaluation result.
8488
8489 It must take one argument specifying the expression to be evaluated,
8490 which accepts the same constants and functions as the @var{x} and
8491 @var{y} values. Note that not all constants should be used, for
8492 example the text size is not known when evaluating the expression, so
8493 the constants @var{text_w} and @var{text_h} will have an undefined
8494 value.
8495
8496 @item expr_int_format, eif
8497 Evaluate the expression's value and output as formatted integer.
8498
8499 The first argument is the expression to be evaluated, just as for the @var{expr} function.
8500 The second argument specifies the output format. Allowed values are @samp{x},
8501 @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
8502 @code{printf} function.
8503 The third parameter is optional and sets the number of positions taken by the output.
8504 It can be used to add padding with zeros from the left.
8505
8506 @item gmtime
8507 The time at which the filter is running, expressed in UTC.
8508 It can accept an argument: a strftime() format string.
8509
8510 @item localtime
8511 The time at which the filter is running, expressed in the local time zone.
8512 It can accept an argument: a strftime() format string.
8513
8514 @item metadata
8515 Frame metadata. Takes one or two arguments.
8516
8517 The first argument is mandatory and specifies the metadata key.
8518
8519 The second argument is optional and specifies a default value, used when the
8520 metadata key is not found or empty.
8521
8522 @item n, frame_num
8523 The frame number, starting from 0.
8524
8525 @item pict_type
8526 A 1 character description of the current picture type.
8527
8528 @item pts
8529 The timestamp of the current frame.
8530 It can take up to three arguments.
8531
8532 The first argument is the format of the timestamp; it defaults to @code{flt}
8533 for seconds as a decimal number with microsecond accuracy; @code{hms} stands
8534 for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
8535 @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
8536 @code{localtime} stands for the timestamp of the frame formatted as
8537 local time zone time.
8538
8539 The second argument is an offset added to the timestamp.
8540
8541 If the format is set to @code{hms}, a third argument @code{24HH} may be
8542 supplied to present the hour part of the formatted timestamp in 24h format
8543 (00-23).
8544
8545 If the format is set to @code{localtime} or @code{gmtime},
8546 a third argument may be supplied: a strftime() format string.
8547 By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
8548 @end table
8549
8550 @subsection Examples
8551
8552 @itemize
8553 @item
8554 Draw "Test Text" with font FreeSerif, using the default values for the
8555 optional parameters.
8556
8557 @example
8558 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
8559 @end example
8560
8561 @item
8562 Draw 'Test Text' with font FreeSerif of size 24 at position x=100
8563 and y=50 (counting from the top-left corner of the screen), text is
8564 yellow with a red box around it. Both the text and the box have an
8565 opacity of 20%.
8566
8567 @example
8568 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
8569           x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
8570 @end example
8571
8572 Note that the double quotes are not necessary if spaces are not used
8573 within the parameter list.
8574
8575 @item
8576 Show the text at the center of the video frame:
8577 @example
8578 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
8579 @end example
8580
8581 @item
8582 Show the text at a random position, switching to a new position every 30 seconds:
8583 @example
8584 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
8585 @end example
8586
8587 @item
8588 Show a text line sliding from right to left in the last row of the video
8589 frame. The file @file{LONG_LINE} is assumed to contain a single line
8590 with no newlines.
8591 @example
8592 drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
8593 @end example
8594
8595 @item
8596 Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
8597 @example
8598 drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
8599 @end example
8600
8601 @item
8602 Draw a single green letter "g", at the center of the input video.
8603 The glyph baseline is placed at half screen height.
8604 @example
8605 drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
8606 @end example
8607
8608 @item
8609 Show text for 1 second every 3 seconds:
8610 @example
8611 drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
8612 @end example
8613
8614 @item
8615 Use fontconfig to set the font. Note that the colons need to be escaped.
8616 @example
8617 drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
8618 @end example
8619
8620 @item
8621 Print the date of a real-time encoding (see strftime(3)):
8622 @example
8623 drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
8624 @end example
8625
8626 @item
8627 Show text fading in and out (appearing/disappearing):
8628 @example
8629 #!/bin/sh
8630 DS=1.0 # display start
8631 DE=10.0 # display end
8632 FID=1.5 # fade in duration
8633 FOD=5 # fade out duration
8634 ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%@{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 @}"
8635 @end example
8636
8637 @item
8638 Horizontally align multiple separate texts. Note that @option{max_glyph_a}
8639 and the @option{fontsize} value are included in the @option{y} offset.
8640 @example
8641 drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
8642 drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
8643 @end example
8644
8645 @end itemize
8646
8647 For more information about libfreetype, check:
8648 @url{http://www.freetype.org/}.
8649
8650 For more information about fontconfig, check:
8651 @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
8652
8653 For more information about libfribidi, check:
8654 @url{http://fribidi.org/}.
8655
8656 @section edgedetect
8657
8658 Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
8659
8660 The filter accepts the following options:
8661
8662 @table @option
8663 @item low
8664 @item high
8665 Set low and high threshold values used by the Canny thresholding
8666 algorithm.
8667
8668 The high threshold selects the "strong" edge pixels, which are then
8669 connected through 8-connectivity with the "weak" edge pixels selected
8670 by the low threshold.
8671
8672 @var{low} and @var{high} threshold values must be chosen in the range
8673 [0,1], and @var{low} should be lesser or equal to @var{high}.
8674
8675 Default value for @var{low} is @code{20/255}, and default value for @var{high}
8676 is @code{50/255}.
8677
8678 @item mode
8679 Define the drawing mode.
8680
8681 @table @samp
8682 @item wires
8683 Draw white/gray wires on black background.
8684
8685 @item colormix
8686 Mix the colors to create a paint/cartoon effect.
8687
8688 @item canny
8689 Apply Canny edge detector on all selected planes.
8690 @end table
8691 Default value is @var{wires}.
8692
8693 @item planes
8694 Select planes for filtering. By default all available planes are filtered.
8695 @end table
8696
8697 @subsection Examples
8698
8699 @itemize
8700 @item
8701 Standard edge detection with custom values for the hysteresis thresholding:
8702 @example
8703 edgedetect=low=0.1:high=0.4
8704 @end example
8705
8706 @item
8707 Painting effect without thresholding:
8708 @example
8709 edgedetect=mode=colormix:high=0
8710 @end example
8711 @end itemize
8712
8713 @section eq
8714 Set brightness, contrast, saturation and approximate gamma adjustment.
8715
8716 The filter accepts the following options:
8717
8718 @table @option
8719 @item contrast
8720 Set the contrast expression. The value must be a float value in range
8721 @code{-2.0} to @code{2.0}. The default value is "1".
8722
8723 @item brightness
8724 Set the brightness expression. The value must be a float value in
8725 range @code{-1.0} to @code{1.0}. The default value is "0".
8726
8727 @item saturation
8728 Set the saturation expression. The value must be a float in
8729 range @code{0.0} to @code{3.0}. The default value is "1".
8730
8731 @item gamma
8732 Set the gamma expression. The value must be a float in range
8733 @code{0.1} to @code{10.0}.  The default value is "1".
8734
8735 @item gamma_r
8736 Set the gamma expression for red. The value must be a float in
8737 range @code{0.1} to @code{10.0}. The default value is "1".
8738
8739 @item gamma_g
8740 Set the gamma expression for green. The value must be a float in range
8741 @code{0.1} to @code{10.0}. The default value is "1".
8742
8743 @item gamma_b
8744 Set the gamma expression for blue. The value must be a float in range
8745 @code{0.1} to @code{10.0}. The default value is "1".
8746
8747 @item gamma_weight
8748 Set the gamma weight expression. It can be used to reduce the effect
8749 of a high gamma value on bright image areas, e.g. keep them from
8750 getting overamplified and just plain white. The value must be a float
8751 in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
8752 gamma correction all the way down while @code{1.0} leaves it at its
8753 full strength. Default is "1".
8754
8755 @item eval
8756 Set when the expressions for brightness, contrast, saturation and
8757 gamma expressions are evaluated.
8758
8759 It accepts the following values:
8760 @table @samp
8761 @item init
8762 only evaluate expressions once during the filter initialization or
8763 when a command is processed
8764
8765 @item frame
8766 evaluate expressions for each incoming frame
8767 @end table
8768
8769 Default value is @samp{init}.
8770 @end table
8771
8772 The expressions accept the following parameters:
8773 @table @option
8774 @item n
8775 frame count of the input frame starting from 0
8776
8777 @item pos
8778 byte position of the corresponding packet in the input file, NAN if
8779 unspecified
8780
8781 @item r
8782 frame rate of the input video, NAN if the input frame rate is unknown
8783
8784 @item t
8785 timestamp expressed in seconds, NAN if the input timestamp is unknown
8786 @end table
8787
8788 @subsection Commands
8789 The filter supports the following commands:
8790
8791 @table @option
8792 @item contrast
8793 Set the contrast expression.
8794
8795 @item brightness
8796 Set the brightness expression.
8797
8798 @item saturation
8799 Set the saturation expression.
8800
8801 @item gamma
8802 Set the gamma expression.
8803
8804 @item gamma_r
8805 Set the gamma_r expression.
8806
8807 @item gamma_g
8808 Set gamma_g expression.
8809
8810 @item gamma_b
8811 Set gamma_b expression.
8812
8813 @item gamma_weight
8814 Set gamma_weight expression.
8815
8816 The command accepts the same syntax of the corresponding option.
8817
8818 If the specified expression is not valid, it is kept at its current
8819 value.
8820
8821 @end table
8822
8823 @section erosion
8824
8825 Apply erosion effect to the video.
8826
8827 This filter replaces the pixel by the local(3x3) minimum.
8828
8829 It accepts the following options:
8830
8831 @table @option
8832 @item threshold0
8833 @item threshold1
8834 @item threshold2
8835 @item threshold3
8836 Limit the maximum change for each plane, default is 65535.
8837 If 0, plane will remain unchanged.
8838
8839 @item coordinates
8840 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
8841 pixels are used.
8842
8843 Flags to local 3x3 coordinates maps like this:
8844
8845     1 2 3
8846     4   5
8847     6 7 8
8848 @end table
8849
8850 @section extractplanes
8851
8852 Extract color channel components from input video stream into
8853 separate grayscale video streams.
8854
8855 The filter accepts the following option:
8856
8857 @table @option
8858 @item planes
8859 Set plane(s) to extract.
8860
8861 Available values for planes are:
8862 @table @samp
8863 @item y
8864 @item u
8865 @item v
8866 @item a
8867 @item r
8868 @item g
8869 @item b
8870 @end table
8871
8872 Choosing planes not available in the input will result in an error.
8873 That means you cannot select @code{r}, @code{g}, @code{b} planes
8874 with @code{y}, @code{u}, @code{v} planes at same time.
8875 @end table
8876
8877 @subsection Examples
8878
8879 @itemize
8880 @item
8881 Extract luma, u and v color channel component from input video frame
8882 into 3 grayscale outputs:
8883 @example
8884 ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
8885 @end example
8886 @end itemize
8887
8888 @section elbg
8889
8890 Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
8891
8892 For each input image, the filter will compute the optimal mapping from
8893 the input to the output given the codebook length, that is the number
8894 of distinct output colors.
8895
8896 This filter accepts the following options.
8897
8898 @table @option
8899 @item codebook_length, l
8900 Set codebook length. The value must be a positive integer, and
8901 represents the number of distinct output colors. Default value is 256.
8902
8903 @item nb_steps, n
8904 Set the maximum number of iterations to apply for computing the optimal
8905 mapping. The higher the value the better the result and the higher the
8906 computation time. Default value is 1.
8907
8908 @item seed, s
8909 Set a random seed, must be an integer included between 0 and
8910 UINT32_MAX. If not specified, or if explicitly set to -1, the filter
8911 will try to use a good random seed on a best effort basis.
8912
8913 @item pal8
8914 Set pal8 output pixel format. This option does not work with codebook
8915 length greater than 256.
8916 @end table
8917
8918 @section entropy
8919
8920 Measure graylevel entropy in histogram of color channels of video frames.
8921
8922 It accepts the following parameters:
8923
8924 @table @option
8925 @item mode
8926 Can be either @var{normal} or @var{diff}. Default is @var{normal}.
8927
8928 @var{diff} mode measures entropy of histogram delta values, absolute differences
8929 between neighbour histogram values.
8930 @end table
8931
8932 @section fade
8933
8934 Apply a fade-in/out effect to the input video.
8935
8936 It accepts the following parameters:
8937
8938 @table @option
8939 @item type, t
8940 The effect type can be either "in" for a fade-in, or "out" for a fade-out
8941 effect.
8942 Default is @code{in}.
8943
8944 @item start_frame, s
8945 Specify the number of the frame to start applying the fade
8946 effect at. Default is 0.
8947
8948 @item nb_frames, n
8949 The number of frames that the fade effect lasts. At the end of the
8950 fade-in effect, the output video will have the same intensity as the input video.
8951 At the end of the fade-out transition, the output video will be filled with the
8952 selected @option{color}.
8953 Default is 25.
8954
8955 @item alpha
8956 If set to 1, fade only alpha channel, if one exists on the input.
8957 Default value is 0.
8958
8959 @item start_time, st
8960 Specify the timestamp (in seconds) of the frame to start to apply the fade
8961 effect. If both start_frame and start_time are specified, the fade will start at
8962 whichever comes last.  Default is 0.
8963
8964 @item duration, d
8965 The number of seconds for which the fade effect has to last. At the end of the
8966 fade-in effect the output video will have the same intensity as the input video,
8967 at the end of the fade-out transition the output video will be filled with the
8968 selected @option{color}.
8969 If both duration and nb_frames are specified, duration is used. Default is 0
8970 (nb_frames is used by default).
8971
8972 @item color, c
8973 Specify the color of the fade. Default is "black".
8974 @end table
8975
8976 @subsection Examples
8977
8978 @itemize
8979 @item
8980 Fade in the first 30 frames of video:
8981 @example
8982 fade=in:0:30
8983 @end example
8984
8985 The command above is equivalent to:
8986 @example
8987 fade=t=in:s=0:n=30
8988 @end example
8989
8990 @item
8991 Fade out the last 45 frames of a 200-frame video:
8992 @example
8993 fade=out:155:45
8994 fade=type=out:start_frame=155:nb_frames=45
8995 @end example
8996
8997 @item
8998 Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
8999 @example
9000 fade=in:0:25, fade=out:975:25
9001 @end example
9002
9003 @item
9004 Make the first 5 frames yellow, then fade in from frame 5-24:
9005 @example
9006 fade=in:5:20:color=yellow
9007 @end example
9008
9009 @item
9010 Fade in alpha over first 25 frames of video:
9011 @example
9012 fade=in:0:25:alpha=1
9013 @end example
9014
9015 @item
9016 Make the first 5.5 seconds black, then fade in for 0.5 seconds:
9017 @example
9018 fade=t=in:st=5.5:d=0.5
9019 @end example
9020
9021 @end itemize
9022
9023 @section fftfilt
9024 Apply arbitrary expressions to samples in frequency domain
9025
9026 @table @option
9027 @item dc_Y
9028 Adjust the dc value (gain) of the luma plane of the image. The filter
9029 accepts an integer value in range @code{0} to @code{1000}. The default
9030 value is set to @code{0}.
9031
9032 @item dc_U
9033 Adjust the dc value (gain) of the 1st chroma plane of the image. The
9034 filter accepts an integer value in range @code{0} to @code{1000}. The
9035 default value is set to @code{0}.
9036
9037 @item dc_V
9038 Adjust the dc value (gain) of the 2nd chroma plane of the image. The
9039 filter accepts an integer value in range @code{0} to @code{1000}. The
9040 default value is set to @code{0}.
9041
9042 @item weight_Y
9043 Set the frequency domain weight expression for the luma plane.
9044
9045 @item weight_U
9046 Set the frequency domain weight expression for the 1st chroma plane.
9047
9048 @item weight_V
9049 Set the frequency domain weight expression for the 2nd chroma plane.
9050
9051 @item eval
9052 Set when the expressions are evaluated.
9053
9054 It accepts the following values:
9055 @table @samp
9056 @item init
9057 Only evaluate expressions once during the filter initialization.
9058
9059 @item frame
9060 Evaluate expressions for each incoming frame.
9061 @end table
9062
9063 Default value is @samp{init}.
9064
9065 The filter accepts the following variables:
9066 @item X
9067 @item Y
9068 The coordinates of the current sample.
9069
9070 @item W
9071 @item H
9072 The width and height of the image.
9073
9074 @item N
9075 The number of input frame, starting from 0.
9076 @end table
9077
9078 @subsection Examples
9079
9080 @itemize
9081 @item
9082 High-pass:
9083 @example
9084 fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
9085 @end example
9086
9087 @item
9088 Low-pass:
9089 @example
9090 fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
9091 @end example
9092
9093 @item
9094 Sharpen:
9095 @example
9096 fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
9097 @end example
9098
9099 @item
9100 Blur:
9101 @example
9102 fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
9103 @end example
9104
9105 @end itemize
9106
9107 @section fftdnoiz
9108 Denoise frames using 3D FFT (frequency domain filtering).
9109
9110 The filter accepts the following options:
9111
9112 @table @option
9113 @item sigma
9114 Set the noise sigma constant. This sets denoising strength.
9115 Default value is 1. Allowed range is from 0 to 30.
9116 Using very high sigma with low overlap may give blocking artifacts.
9117
9118 @item amount
9119 Set amount of denoising. By default all detected noise is reduced.
9120 Default value is 1. Allowed range is from 0 to 1.
9121
9122 @item block
9123 Set size of block, Default is 4, can be 3, 4, 5 or 6.
9124 Actual size of block in pixels is 2 to power of @var{block}, so by default
9125 block size in pixels is 2^4 which is 16.
9126
9127 @item overlap
9128 Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
9129
9130 @item prev
9131 Set number of previous frames to use for denoising. By default is set to 0.
9132
9133 @item next
9134 Set number of next frames to to use for denoising. By default is set to 0.
9135
9136 @item planes
9137 Set planes which will be filtered, by default are all available filtered
9138 except alpha.
9139 @end table
9140
9141 @section field
9142
9143 Extract a single field from an interlaced image using stride
9144 arithmetic to avoid wasting CPU time. The output frames are marked as
9145 non-interlaced.
9146
9147 The filter accepts the following options:
9148
9149 @table @option
9150 @item type
9151 Specify whether to extract the top (if the value is @code{0} or
9152 @code{top}) or the bottom field (if the value is @code{1} or
9153 @code{bottom}).
9154 @end table
9155
9156 @section fieldhint
9157
9158 Create new frames by copying the top and bottom fields from surrounding frames
9159 supplied as numbers by the hint file.
9160
9161 @table @option
9162 @item hint
9163 Set file containing hints: absolute/relative frame numbers.
9164
9165 There must be one line for each frame in a clip. Each line must contain two
9166 numbers separated by the comma, optionally followed by @code{-} or @code{+}.
9167 Numbers supplied on each line of file can not be out of [N-1,N+1] where N
9168 is current frame number for @code{absolute} mode or out of [-1, 1] range
9169 for @code{relative} mode. First number tells from which frame to pick up top
9170 field and second number tells from which frame to pick up bottom field.
9171
9172 If optionally followed by @code{+} output frame will be marked as interlaced,
9173 else if followed by @code{-} output frame will be marked as progressive, else
9174 it will be marked same as input frame.
9175 If line starts with @code{#} or @code{;} that line is skipped.
9176
9177 @item mode
9178 Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
9179 @end table
9180
9181 Example of first several lines of @code{hint} file for @code{relative} mode:
9182 @example
9183 0,0 - # first frame
9184 1,0 - # second frame, use third's frame top field and second's frame bottom field
9185 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
9186 1,0 -
9187 0,0 -
9188 0,0 -
9189 1,0 -
9190 1,0 -
9191 1,0 -
9192 0,0 -
9193 0,0 -
9194 1,0 -
9195 1,0 -
9196 1,0 -
9197 0,0 -
9198 @end example
9199
9200 @section fieldmatch
9201
9202 Field matching filter for inverse telecine. It is meant to reconstruct the
9203 progressive frames from a telecined stream. The filter does not drop duplicated
9204 frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
9205 followed by a decimation filter such as @ref{decimate} in the filtergraph.
9206
9207 The separation of the field matching and the decimation is notably motivated by
9208 the possibility of inserting a de-interlacing filter fallback between the two.
9209 If the source has mixed telecined and real interlaced content,
9210 @code{fieldmatch} will not be able to match fields for the interlaced parts.
9211 But these remaining combed frames will be marked as interlaced, and thus can be
9212 de-interlaced by a later filter such as @ref{yadif} before decimation.
9213
9214 In addition to the various configuration options, @code{fieldmatch} can take an
9215 optional second stream, activated through the @option{ppsrc} option. If
9216 enabled, the frames reconstruction will be based on the fields and frames from
9217 this second stream. This allows the first input to be pre-processed in order to
9218 help the various algorithms of the filter, while keeping the output lossless
9219 (assuming the fields are matched properly). Typically, a field-aware denoiser,
9220 or brightness/contrast adjustments can help.
9221
9222 Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
9223 and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
9224 which @code{fieldmatch} is based on. While the semantic and usage are very
9225 close, some behaviour and options names can differ.
9226
9227 The @ref{decimate} filter currently only works for constant frame rate input.
9228 If your input has mixed telecined (30fps) and progressive content with a lower
9229 framerate like 24fps use the following filterchain to produce the necessary cfr
9230 stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
9231
9232 The filter accepts the following options:
9233
9234 @table @option
9235 @item order
9236 Specify the assumed field order of the input stream. Available values are:
9237
9238 @table @samp
9239 @item auto
9240 Auto detect parity (use FFmpeg's internal parity value).
9241 @item bff
9242 Assume bottom field first.
9243 @item tff
9244 Assume top field first.
9245 @end table
9246
9247 Note that it is sometimes recommended not to trust the parity announced by the
9248 stream.
9249
9250 Default value is @var{auto}.
9251
9252 @item mode
9253 Set the matching mode or strategy to use. @option{pc} mode is the safest in the
9254 sense that it won't risk creating jerkiness due to duplicate frames when
9255 possible, but if there are bad edits or blended fields it will end up
9256 outputting combed frames when a good match might actually exist. On the other
9257 hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
9258 but will almost always find a good frame if there is one. The other values are
9259 all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
9260 jerkiness and creating duplicate frames versus finding good matches in sections
9261 with bad edits, orphaned fields, blended fields, etc.
9262
9263 More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
9264
9265 Available values are:
9266
9267 @table @samp
9268 @item pc
9269 2-way matching (p/c)
9270 @item pc_n
9271 2-way matching, and trying 3rd match if still combed (p/c + n)
9272 @item pc_u
9273 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
9274 @item pc_n_ub
9275 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
9276 still combed (p/c + n + u/b)
9277 @item pcn
9278 3-way matching (p/c/n)
9279 @item pcn_ub
9280 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
9281 detected as combed (p/c/n + u/b)
9282 @end table
9283
9284 The parenthesis at the end indicate the matches that would be used for that
9285 mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
9286 @var{top}).
9287
9288 In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
9289 the slowest.
9290
9291 Default value is @var{pc_n}.
9292
9293 @item ppsrc
9294 Mark the main input stream as a pre-processed input, and enable the secondary
9295 input stream as the clean source to pick the fields from. See the filter
9296 introduction for more details. It is similar to the @option{clip2} feature from
9297 VFM/TFM.
9298
9299 Default value is @code{0} (disabled).
9300
9301 @item field
9302 Set the field to match from. It is recommended to set this to the same value as
9303 @option{order} unless you experience matching failures with that setting. In
9304 certain circumstances changing the field that is used to match from can have a
9305 large impact on matching performance. Available values are:
9306
9307 @table @samp
9308 @item auto
9309 Automatic (same value as @option{order}).
9310 @item bottom
9311 Match from the bottom field.
9312 @item top
9313 Match from the top field.
9314 @end table
9315
9316 Default value is @var{auto}.
9317
9318 @item mchroma
9319 Set whether or not chroma is included during the match comparisons. In most
9320 cases it is recommended to leave this enabled. You should set this to @code{0}
9321 only if your clip has bad chroma problems such as heavy rainbowing or other
9322 artifacts. Setting this to @code{0} could also be used to speed things up at
9323 the cost of some accuracy.
9324
9325 Default value is @code{1}.
9326
9327 @item y0
9328 @item y1
9329 These define an exclusion band which excludes the lines between @option{y0} and
9330 @option{y1} from being included in the field matching decision. An exclusion
9331 band can be used to ignore subtitles, a logo, or other things that may
9332 interfere with the matching. @option{y0} sets the starting scan line and
9333 @option{y1} sets the ending line; all lines in between @option{y0} and
9334 @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
9335 @option{y0} and @option{y1} to the same value will disable the feature.
9336 @option{y0} and @option{y1} defaults to @code{0}.
9337
9338 @item scthresh
9339 Set the scene change detection threshold as a percentage of maximum change on
9340 the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
9341 detection is only relevant in case @option{combmatch}=@var{sc}.  The range for
9342 @option{scthresh} is @code{[0.0, 100.0]}.
9343
9344 Default value is @code{12.0}.
9345
9346 @item combmatch
9347 When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
9348 account the combed scores of matches when deciding what match to use as the
9349 final match. Available values are:
9350
9351 @table @samp
9352 @item none
9353 No final matching based on combed scores.
9354 @item sc
9355 Combed scores are only used when a scene change is detected.
9356 @item full
9357 Use combed scores all the time.
9358 @end table
9359
9360 Default is @var{sc}.
9361
9362 @item combdbg
9363 Force @code{fieldmatch} to calculate the combed metrics for certain matches and
9364 print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
9365 Available values are:
9366
9367 @table @samp
9368 @item none
9369 No forced calculation.
9370 @item pcn
9371 Force p/c/n calculations.
9372 @item pcnub
9373 Force p/c/n/u/b calculations.
9374 @end table
9375
9376 Default value is @var{none}.
9377
9378 @item cthresh
9379 This is the area combing threshold used for combed frame detection. This
9380 essentially controls how "strong" or "visible" combing must be to be detected.
9381 Larger values mean combing must be more visible and smaller values mean combing
9382 can be less visible or strong and still be detected. Valid settings are from
9383 @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
9384 be detected as combed). This is basically a pixel difference value. A good
9385 range is @code{[8, 12]}.
9386
9387 Default value is @code{9}.
9388
9389 @item chroma
9390 Sets whether or not chroma is considered in the combed frame decision.  Only
9391 disable this if your source has chroma problems (rainbowing, etc.) that are
9392 causing problems for the combed frame detection with chroma enabled. Actually,
9393 using @option{chroma}=@var{0} is usually more reliable, except for the case
9394 where there is chroma only combing in the source.
9395
9396 Default value is @code{0}.
9397
9398 @item blockx
9399 @item blocky
9400 Respectively set the x-axis and y-axis size of the window used during combed
9401 frame detection. This has to do with the size of the area in which
9402 @option{combpel} pixels are required to be detected as combed for a frame to be
9403 declared combed. See the @option{combpel} parameter description for more info.
9404 Possible values are any number that is a power of 2 starting at 4 and going up
9405 to 512.
9406
9407 Default value is @code{16}.
9408
9409 @item combpel
9410 The number of combed pixels inside any of the @option{blocky} by
9411 @option{blockx} size blocks on the frame for the frame to be detected as
9412 combed. While @option{cthresh} controls how "visible" the combing must be, this
9413 setting controls "how much" combing there must be in any localized area (a
9414 window defined by the @option{blockx} and @option{blocky} settings) on the
9415 frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
9416 which point no frames will ever be detected as combed). This setting is known
9417 as @option{MI} in TFM/VFM vocabulary.
9418
9419 Default value is @code{80}.
9420 @end table
9421
9422 @anchor{p/c/n/u/b meaning}
9423 @subsection p/c/n/u/b meaning
9424
9425 @subsubsection p/c/n
9426
9427 We assume the following telecined stream:
9428
9429 @example
9430 Top fields:     1 2 2 3 4
9431 Bottom fields:  1 2 3 4 4
9432 @end example
9433
9434 The numbers correspond to the progressive frame the fields relate to. Here, the
9435 first two frames are progressive, the 3rd and 4th are combed, and so on.
9436
9437 When @code{fieldmatch} is configured to run a matching from bottom
9438 (@option{field}=@var{bottom}) this is how this input stream get transformed:
9439
9440 @example
9441 Input stream:
9442                 T     1 2 2 3 4
9443                 B     1 2 3 4 4   <-- matching reference
9444
9445 Matches:              c c n n c
9446
9447 Output stream:
9448                 T     1 2 3 4 4
9449                 B     1 2 3 4 4
9450 @end example
9451
9452 As a result of the field matching, we can see that some frames get duplicated.
9453 To perform a complete inverse telecine, you need to rely on a decimation filter
9454 after this operation. See for instance the @ref{decimate} filter.
9455
9456 The same operation now matching from top fields (@option{field}=@var{top})
9457 looks like this:
9458
9459 @example
9460 Input stream:
9461                 T     1 2 2 3 4   <-- matching reference
9462                 B     1 2 3 4 4
9463
9464 Matches:              c c p p c
9465
9466 Output stream:
9467                 T     1 2 2 3 4
9468                 B     1 2 2 3 4
9469 @end example
9470
9471 In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
9472 basically, they refer to the frame and field of the opposite parity:
9473
9474 @itemize
9475 @item @var{p} matches the field of the opposite parity in the previous frame
9476 @item @var{c} matches the field of the opposite parity in the current frame
9477 @item @var{n} matches the field of the opposite parity in the next frame
9478 @end itemize
9479
9480 @subsubsection u/b
9481
9482 The @var{u} and @var{b} matching are a bit special in the sense that they match
9483 from the opposite parity flag. In the following examples, we assume that we are
9484 currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
9485 'x' is placed above and below each matched fields.
9486
9487 With bottom matching (@option{field}=@var{bottom}):
9488 @example
9489 Match:           c         p           n          b          u
9490
9491                  x       x               x        x          x
9492   Top          1 2 2     1 2 2       1 2 2      1 2 2      1 2 2
9493   Bottom       1 2 3     1 2 3       1 2 3      1 2 3      1 2 3
9494                  x         x           x        x              x
9495
9496 Output frames:
9497                  2          1          2          2          2
9498                  2          2          2          1          3
9499 @end example
9500
9501 With top matching (@option{field}=@var{top}):
9502 @example
9503 Match:           c         p           n          b          u
9504
9505                  x         x           x        x              x
9506   Top          1 2 2     1 2 2       1 2 2      1 2 2      1 2 2
9507   Bottom       1 2 3     1 2 3       1 2 3      1 2 3      1 2 3
9508                  x       x               x        x          x
9509
9510 Output frames:
9511                  2          2          2          1          2
9512                  2          1          3          2          2
9513 @end example
9514
9515 @subsection Examples
9516
9517 Simple IVTC of a top field first telecined stream:
9518 @example
9519 fieldmatch=order=tff:combmatch=none, decimate
9520 @end example
9521
9522 Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
9523 @example
9524 fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
9525 @end example
9526
9527 @section fieldorder
9528
9529 Transform the field order of the input video.
9530
9531 It accepts the following parameters:
9532
9533 @table @option
9534
9535 @item order
9536 The output field order. Valid values are @var{tff} for top field first or @var{bff}
9537 for bottom field first.
9538 @end table
9539
9540 The default value is @samp{tff}.
9541
9542 The transformation is done by shifting the picture content up or down
9543 by one line, and filling the remaining line with appropriate picture content.
9544 This method is consistent with most broadcast field order converters.
9545
9546 If the input video is not flagged as being interlaced, or it is already
9547 flagged as being of the required output field order, then this filter does
9548 not alter the incoming video.
9549
9550 It is very useful when converting to or from PAL DV material,
9551 which is bottom field first.
9552
9553 For example:
9554 @example
9555 ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
9556 @end example
9557
9558 @section fifo, afifo
9559
9560 Buffer input images and send them when they are requested.
9561
9562 It is mainly useful when auto-inserted by the libavfilter
9563 framework.
9564
9565 It does not take parameters.
9566
9567 @section fillborders
9568
9569 Fill borders of the input video, without changing video stream dimensions.
9570 Sometimes video can have garbage at the four edges and you may not want to
9571 crop video input to keep size multiple of some number.
9572
9573 This filter accepts the following options:
9574
9575 @table @option
9576 @item left
9577 Number of pixels to fill from left border.
9578
9579 @item right
9580 Number of pixels to fill from right border.
9581
9582 @item top
9583 Number of pixels to fill from top border.
9584
9585 @item bottom
9586 Number of pixels to fill from bottom border.
9587
9588 @item mode
9589 Set fill mode.
9590
9591 It accepts the following values:
9592 @table @samp
9593 @item smear
9594 fill pixels using outermost pixels
9595
9596 @item mirror
9597 fill pixels using mirroring
9598
9599 @item fixed
9600 fill pixels with constant value
9601 @end table
9602
9603 Default is @var{smear}.
9604
9605 @item color
9606 Set color for pixels in fixed mode. Default is @var{black}.
9607 @end table
9608
9609 @section find_rect
9610
9611 Find a rectangular object
9612
9613 It accepts the following options:
9614
9615 @table @option
9616 @item object
9617 Filepath of the object image, needs to be in gray8.
9618
9619 @item threshold
9620 Detection threshold, default is 0.5.
9621
9622 @item mipmaps
9623 Number of mipmaps, default is 3.
9624
9625 @item xmin, ymin, xmax, ymax
9626 Specifies the rectangle in which to search.
9627 @end table
9628
9629 @subsection Examples
9630
9631 @itemize
9632 @item
9633 Generate a representative palette of a given video using @command{ffmpeg}:
9634 @example
9635 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
9636 @end example
9637 @end itemize
9638
9639 @section cover_rect
9640
9641 Cover a rectangular object
9642
9643 It accepts the following options:
9644
9645 @table @option
9646 @item cover
9647 Filepath of the optional cover image, needs to be in yuv420.
9648
9649 @item mode
9650 Set covering mode.
9651
9652 It accepts the following values:
9653 @table @samp
9654 @item cover
9655 cover it by the supplied image
9656 @item blur
9657 cover it by interpolating the surrounding pixels
9658 @end table
9659
9660 Default value is @var{blur}.
9661 @end table
9662
9663 @subsection Examples
9664
9665 @itemize
9666 @item
9667 Generate a representative palette of a given video using @command{ffmpeg}:
9668 @example
9669 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
9670 @end example
9671 @end itemize
9672
9673 @section floodfill
9674
9675 Flood area with values of same pixel components with another values.
9676
9677 It accepts the following options:
9678 @table @option
9679 @item x
9680 Set pixel x coordinate.
9681
9682 @item y
9683 Set pixel y coordinate.
9684
9685 @item s0
9686 Set source #0 component value.
9687
9688 @item s1
9689 Set source #1 component value.
9690
9691 @item s2
9692 Set source #2 component value.
9693
9694 @item s3
9695 Set source #3 component value.
9696
9697 @item d0
9698 Set destination #0 component value.
9699
9700 @item d1
9701 Set destination #1 component value.
9702
9703 @item d2
9704 Set destination #2 component value.
9705
9706 @item d3
9707 Set destination #3 component value.
9708 @end table
9709
9710 @anchor{format}
9711 @section format
9712
9713 Convert the input video to one of the specified pixel formats.
9714 Libavfilter will try to pick one that is suitable as input to
9715 the next filter.
9716
9717 It accepts the following parameters:
9718 @table @option
9719
9720 @item pix_fmts
9721 A '|'-separated list of pixel format names, such as
9722 "pix_fmts=yuv420p|monow|rgb24".
9723
9724 @end table
9725
9726 @subsection Examples
9727
9728 @itemize
9729 @item
9730 Convert the input video to the @var{yuv420p} format
9731 @example
9732 format=pix_fmts=yuv420p
9733 @end example
9734
9735 Convert the input video to any of the formats in the list
9736 @example
9737 format=pix_fmts=yuv420p|yuv444p|yuv410p
9738 @end example
9739 @end itemize
9740
9741 @anchor{fps}
9742 @section fps
9743
9744 Convert the video to specified constant frame rate by duplicating or dropping
9745 frames as necessary.
9746
9747 It accepts the following parameters:
9748 @table @option
9749
9750 @item fps
9751 The desired output frame rate. The default is @code{25}.
9752
9753 @item start_time
9754 Assume the first PTS should be the given value, in seconds. This allows for
9755 padding/trimming at the start of stream. By default, no assumption is made
9756 about the first frame's expected PTS, so no padding or trimming is done.
9757 For example, this could be set to 0 to pad the beginning with duplicates of
9758 the first frame if a video stream starts after the audio stream or to trim any
9759 frames with a negative PTS.
9760
9761 @item round
9762 Timestamp (PTS) rounding method.
9763
9764 Possible values are:
9765 @table @option
9766 @item zero
9767 round towards 0
9768 @item inf
9769 round away from 0
9770 @item down
9771 round towards -infinity
9772 @item up
9773 round towards +infinity
9774 @item near
9775 round to nearest
9776 @end table
9777 The default is @code{near}.
9778
9779 @item eof_action
9780 Action performed when reading the last frame.
9781
9782 Possible values are:
9783 @table @option
9784 @item round
9785 Use same timestamp rounding method as used for other frames.
9786 @item pass
9787 Pass through last frame if input duration has not been reached yet.
9788 @end table
9789 The default is @code{round}.
9790
9791 @end table
9792
9793 Alternatively, the options can be specified as a flat string:
9794 @var{fps}[:@var{start_time}[:@var{round}]].
9795
9796 See also the @ref{setpts} filter.
9797
9798 @subsection Examples
9799
9800 @itemize
9801 @item
9802 A typical usage in order to set the fps to 25:
9803 @example
9804 fps=fps=25
9805 @end example
9806
9807 @item
9808 Sets the fps to 24, using abbreviation and rounding method to round to nearest:
9809 @example
9810 fps=fps=film:round=near
9811 @end example
9812 @end itemize
9813
9814 @section framepack
9815
9816 Pack two different video streams into a stereoscopic video, setting proper
9817 metadata on supported codecs. The two views should have the same size and
9818 framerate and processing will stop when the shorter video ends. Please note
9819 that you may conveniently adjust view properties with the @ref{scale} and
9820 @ref{fps} filters.
9821
9822 It accepts the following parameters:
9823 @table @option
9824
9825 @item format
9826 The desired packing format. Supported values are:
9827
9828 @table @option
9829
9830 @item sbs
9831 The views are next to each other (default).
9832
9833 @item tab
9834 The views are on top of each other.
9835
9836 @item lines
9837 The views are packed by line.
9838
9839 @item columns
9840 The views are packed by column.
9841
9842 @item frameseq
9843 The views are temporally interleaved.
9844
9845 @end table
9846
9847 @end table
9848
9849 Some examples:
9850
9851 @example
9852 # Convert left and right views into a frame-sequential video
9853 ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
9854
9855 # Convert views into a side-by-side video with the same output resolution as the input
9856 ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
9857 @end example
9858
9859 @section framerate
9860
9861 Change the frame rate by interpolating new video output frames from the source
9862 frames.
9863
9864 This filter is not designed to function correctly with interlaced media. If
9865 you wish to change the frame rate of interlaced media then you are required
9866 to deinterlace before this filter and re-interlace after this filter.
9867
9868 A description of the accepted options follows.
9869
9870 @table @option
9871 @item fps
9872 Specify the output frames per second. This option can also be specified
9873 as a value alone. The default is @code{50}.
9874
9875 @item interp_start
9876 Specify the start of a range where the output frame will be created as a
9877 linear interpolation of two frames. The range is [@code{0}-@code{255}],
9878 the default is @code{15}.
9879
9880 @item interp_end
9881 Specify the end of a range where the output frame will be created as a
9882 linear interpolation of two frames. The range is [@code{0}-@code{255}],
9883 the default is @code{240}.
9884
9885 @item scene
9886 Specify the level at which a scene change is detected as a value between
9887 0 and 100 to indicate a new scene; a low value reflects a low
9888 probability for the current frame to introduce a new scene, while a higher
9889 value means the current frame is more likely to be one.
9890 The default is @code{8.2}.
9891
9892 @item flags
9893 Specify flags influencing the filter process.
9894
9895 Available value for @var{flags} is:
9896
9897 @table @option
9898 @item scene_change_detect, scd
9899 Enable scene change detection using the value of the option @var{scene}.
9900 This flag is enabled by default.
9901 @end table
9902 @end table
9903
9904 @section framestep
9905
9906 Select one frame every N-th frame.
9907
9908 This filter accepts the following option:
9909 @table @option
9910 @item step
9911 Select frame after every @code{step} frames.
9912 Allowed values are positive integers higher than 0. Default value is @code{1}.
9913 @end table
9914
9915 @anchor{frei0r}
9916 @section frei0r
9917
9918 Apply a frei0r effect to the input video.
9919
9920 To enable the compilation of this filter, you need to install the frei0r
9921 header and configure FFmpeg with @code{--enable-frei0r}.
9922
9923 It accepts the following parameters:
9924
9925 @table @option
9926
9927 @item filter_name
9928 The name of the frei0r effect to load. If the environment variable
9929 @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
9930 directories specified by the colon-separated list in @env{FREI0R_PATH}.
9931 Otherwise, the standard frei0r paths are searched, in this order:
9932 @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
9933 @file{/usr/lib/frei0r-1/}.
9934
9935 @item filter_params
9936 A '|'-separated list of parameters to pass to the frei0r effect.
9937
9938 @end table
9939
9940 A frei0r effect parameter can be a boolean (its value is either
9941 "y" or "n"), a double, a color (specified as
9942 @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
9943 numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
9944 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
9945 a position (specified as @var{X}/@var{Y}, where
9946 @var{X} and @var{Y} are floating point numbers) and/or a string.
9947
9948 The number and types of parameters depend on the loaded effect. If an
9949 effect parameter is not specified, the default value is set.
9950
9951 @subsection Examples
9952
9953 @itemize
9954 @item
9955 Apply the distort0r effect, setting the first two double parameters:
9956 @example
9957 frei0r=filter_name=distort0r:filter_params=0.5|0.01
9958 @end example
9959
9960 @item
9961 Apply the colordistance effect, taking a color as the first parameter:
9962 @example
9963 frei0r=colordistance:0.2/0.3/0.4
9964 frei0r=colordistance:violet
9965 frei0r=colordistance:0x112233
9966 @end example
9967
9968 @item
9969 Apply the perspective effect, specifying the top left and top right image
9970 positions:
9971 @example
9972 frei0r=perspective:0.2/0.2|0.8/0.2
9973 @end example
9974 @end itemize
9975
9976 For more information, see
9977 @url{http://frei0r.dyne.org}
9978
9979 @section fspp
9980
9981 Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
9982
9983 It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
9984 processing filter, one of them is performed once per block, not per pixel.
9985 This allows for much higher speed.
9986
9987 The filter accepts the following options:
9988
9989 @table @option
9990 @item quality
9991 Set quality. This option defines the number of levels for averaging. It accepts
9992 an integer in the range 4-5. Default value is @code{4}.
9993
9994 @item qp
9995 Force a constant quantization parameter. It accepts an integer in range 0-63.
9996 If not set, the filter will use the QP from the video stream (if available).
9997
9998 @item strength
9999 Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
10000 more details but also more artifacts, while higher values make the image smoother
10001 but also blurrier. Default value is @code{0} âˆ’ PSNR optimal.
10002
10003 @item use_bframe_qp
10004 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
10005 option may cause flicker since the B-Frames have often larger QP. Default is
10006 @code{0} (not enabled).
10007
10008 @end table
10009
10010 @section gblur
10011
10012 Apply Gaussian blur filter.
10013
10014 The filter accepts the following options:
10015
10016 @table @option
10017 @item sigma
10018 Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
10019
10020 @item steps
10021 Set number of steps for Gaussian approximation. Defauls is @code{1}.
10022
10023 @item planes
10024 Set which planes to filter. By default all planes are filtered.
10025
10026 @item sigmaV
10027 Set vertical sigma, if negative it will be same as @code{sigma}.
10028 Default is @code{-1}.
10029 @end table
10030
10031 @section geq
10032
10033 The filter accepts the following options:
10034
10035 @table @option
10036 @item lum_expr, lum
10037 Set the luminance expression.
10038 @item cb_expr, cb
10039 Set the chrominance blue expression.
10040 @item cr_expr, cr
10041 Set the chrominance red expression.
10042 @item alpha_expr, a
10043 Set the alpha expression.
10044 @item red_expr, r
10045 Set the red expression.
10046 @item green_expr, g
10047 Set the green expression.
10048 @item blue_expr, b
10049 Set the blue expression.
10050 @end table
10051
10052 The colorspace is selected according to the specified options. If one
10053 of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
10054 options is specified, the filter will automatically select a YCbCr
10055 colorspace. If one of the @option{red_expr}, @option{green_expr}, or
10056 @option{blue_expr} options is specified, it will select an RGB
10057 colorspace.
10058
10059 If one of the chrominance expression is not defined, it falls back on the other
10060 one. If no alpha expression is specified it will evaluate to opaque value.
10061 If none of chrominance expressions are specified, they will evaluate
10062 to the luminance expression.
10063
10064 The expressions can use the following variables and functions:
10065
10066 @table @option
10067 @item N
10068 The sequential number of the filtered frame, starting from @code{0}.
10069
10070 @item X
10071 @item Y
10072 The coordinates of the current sample.
10073
10074 @item W
10075 @item H
10076 The width and height of the image.
10077
10078 @item SW
10079 @item SH
10080 Width and height scale depending on the currently filtered plane. It is the
10081 ratio between the corresponding luma plane number of pixels and the current
10082 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
10083 @code{0.5,0.5} for chroma planes.
10084
10085 @item T
10086 Time of the current frame, expressed in seconds.
10087
10088 @item p(x, y)
10089 Return the value of the pixel at location (@var{x},@var{y}) of the current
10090 plane.
10091
10092 @item lum(x, y)
10093 Return the value of the pixel at location (@var{x},@var{y}) of the luminance
10094 plane.
10095
10096 @item cb(x, y)
10097 Return the value of the pixel at location (@var{x},@var{y}) of the
10098 blue-difference chroma plane. Return 0 if there is no such plane.
10099
10100 @item cr(x, y)
10101 Return the value of the pixel at location (@var{x},@var{y}) of the
10102 red-difference chroma plane. Return 0 if there is no such plane.
10103
10104 @item r(x, y)
10105 @item g(x, y)
10106 @item b(x, y)
10107 Return the value of the pixel at location (@var{x},@var{y}) of the
10108 red/green/blue component. Return 0 if there is no such component.
10109
10110 @item alpha(x, y)
10111 Return the value of the pixel at location (@var{x},@var{y}) of the alpha
10112 plane. Return 0 if there is no such plane.
10113 @end table
10114
10115 For functions, if @var{x} and @var{y} are outside the area, the value will be
10116 automatically clipped to the closer edge.
10117
10118 @subsection Examples
10119
10120 @itemize
10121 @item
10122 Flip the image horizontally:
10123 @example
10124 geq=p(W-X\,Y)
10125 @end example
10126
10127 @item
10128 Generate a bidimensional sine wave, with angle @code{PI/3} and a
10129 wavelength of 100 pixels:
10130 @example
10131 geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
10132 @end example
10133
10134 @item
10135 Generate a fancy enigmatic moving light:
10136 @example
10137 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
10138 @end example
10139
10140 @item
10141 Generate a quick emboss effect:
10142 @example
10143 format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
10144 @end example
10145
10146 @item
10147 Modify RGB components depending on pixel position:
10148 @example
10149 geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
10150 @end example
10151
10152 @item
10153 Create a radial gradient that is the same size as the input (also see
10154 the @ref{vignette} filter):
10155 @example
10156 geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
10157 @end example
10158 @end itemize
10159
10160 @section gradfun
10161
10162 Fix the banding artifacts that are sometimes introduced into nearly flat
10163 regions by truncation to 8-bit color depth.
10164 Interpolate the gradients that should go where the bands are, and
10165 dither them.
10166
10167 It is designed for playback only.  Do not use it prior to
10168 lossy compression, because compression tends to lose the dither and
10169 bring back the bands.
10170
10171 It accepts the following parameters:
10172
10173 @table @option
10174
10175 @item strength
10176 The maximum amount by which the filter will change any one pixel. This is also
10177 the threshold for detecting nearly flat regions. Acceptable values range from
10178 .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
10179 valid range.
10180
10181 @item radius
10182 The neighborhood to fit the gradient to. A larger radius makes for smoother
10183 gradients, but also prevents the filter from modifying the pixels near detailed
10184 regions. Acceptable values are 8-32; the default value is 16. Out-of-range
10185 values will be clipped to the valid range.
10186
10187 @end table
10188
10189 Alternatively, the options can be specified as a flat string:
10190 @var{strength}[:@var{radius}]
10191
10192 @subsection Examples
10193
10194 @itemize
10195 @item
10196 Apply the filter with a @code{3.5} strength and radius of @code{8}:
10197 @example
10198 gradfun=3.5:8
10199 @end example
10200
10201 @item
10202 Specify radius, omitting the strength (which will fall-back to the default
10203 value):
10204 @example
10205 gradfun=radius=8
10206 @end example
10207
10208 @end itemize
10209
10210 @section greyedge
10211 A color constancy variation filter which estimates scene illumination via grey edge algorithm
10212 and corrects the scene colors accordingly.
10213
10214 See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
10215
10216 The filter accepts the following options:
10217
10218 @table @option
10219 @item difford
10220 The order of differentiation to be applied on the scene. Must be chosen in the range
10221 [0,2] and default value is 1.
10222
10223 @item minknorm
10224 The Minkowski parameter to be used for calculating the Minkowski distance. Must
10225 be chosen in the range [0,20] and default value is 1. Set to 0 for getting
10226 max value instead of calculating Minkowski distance.
10227
10228 @item sigma
10229 The standard deviation of Gaussian blur to be applied on the scene. Must be
10230 chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
10231 can't be euqal to 0 if @var{difford} is greater than 0.
10232 @end table
10233
10234 @subsection Examples
10235 @itemize
10236
10237 @item
10238 Grey Edge:
10239 @example
10240 greyedge=difford=1:minknorm=5:sigma=2
10241 @end example
10242
10243 @item
10244 Max Edge:
10245 @example
10246 greyedge=difford=1:minknorm=0:sigma=2
10247 @end example
10248
10249 @end itemize
10250
10251 @anchor{haldclut}
10252 @section haldclut
10253
10254 Apply a Hald CLUT to a video stream.
10255
10256 First input is the video stream to process, and second one is the Hald CLUT.
10257 The Hald CLUT input can be a simple picture or a complete video stream.
10258
10259 The filter accepts the following options:
10260
10261 @table @option
10262 @item shortest
10263 Force termination when the shortest input terminates. Default is @code{0}.
10264 @item repeatlast
10265 Continue applying the last CLUT after the end of the stream. A value of
10266 @code{0} disable the filter after the last frame of the CLUT is reached.
10267 Default is @code{1}.
10268 @end table
10269
10270 @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
10271 filters share the same internals).
10272
10273 More information about the Hald CLUT can be found on Eskil Steenberg's website
10274 (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
10275
10276 @subsection Workflow examples
10277
10278 @subsubsection Hald CLUT video stream
10279
10280 Generate an identity Hald CLUT stream altered with various effects:
10281 @example
10282 ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
10283 @end example
10284
10285 Note: make sure you use a lossless codec.
10286
10287 Then use it with @code{haldclut} to apply it on some random stream:
10288 @example
10289 ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
10290 @end example
10291
10292 The Hald CLUT will be applied to the 10 first seconds (duration of
10293 @file{clut.nut}), then the latest picture of that CLUT stream will be applied
10294 to the remaining frames of the @code{mandelbrot} stream.
10295
10296 @subsubsection Hald CLUT with preview
10297
10298 A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
10299 @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
10300 biggest possible square starting at the top left of the picture. The remaining
10301 padding pixels (bottom or right) will be ignored. This area can be used to add
10302 a preview of the Hald CLUT.
10303
10304 Typically, the following generated Hald CLUT will be supported by the
10305 @code{haldclut} filter:
10306
10307 @example
10308 ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
10309    pad=iw+320 [padded_clut];
10310    smptebars=s=320x256, split [a][b];
10311    [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
10312    [main][b] overlay=W-320" -frames:v 1 clut.png
10313 @end example
10314
10315 It contains the original and a preview of the effect of the CLUT: SMPTE color
10316 bars are displayed on the right-top, and below the same color bars processed by
10317 the color changes.
10318
10319 Then, the effect of this Hald CLUT can be visualized with:
10320 @example
10321 ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
10322 @end example
10323
10324 @section hflip
10325
10326 Flip the input video horizontally.
10327
10328 For example, to horizontally flip the input video with @command{ffmpeg}:
10329 @example
10330 ffmpeg -i in.avi -vf "hflip" out.avi
10331 @end example
10332
10333 @section histeq
10334 This filter applies a global color histogram equalization on a
10335 per-frame basis.
10336
10337 It can be used to correct video that has a compressed range of pixel
10338 intensities.  The filter redistributes the pixel intensities to
10339 equalize their distribution across the intensity range. It may be
10340 viewed as an "automatically adjusting contrast filter". This filter is
10341 useful only for correcting degraded or poorly captured source
10342 video.
10343
10344 The filter accepts the following options:
10345
10346 @table @option
10347 @item strength
10348 Determine the amount of equalization to be applied.  As the strength
10349 is reduced, the distribution of pixel intensities more-and-more
10350 approaches that of the input frame. The value must be a float number
10351 in the range [0,1] and defaults to 0.200.
10352
10353 @item intensity
10354 Set the maximum intensity that can generated and scale the output
10355 values appropriately.  The strength should be set as desired and then
10356 the intensity can be limited if needed to avoid washing-out. The value
10357 must be a float number in the range [0,1] and defaults to 0.210.
10358
10359 @item antibanding
10360 Set the antibanding level. If enabled the filter will randomly vary
10361 the luminance of output pixels by a small amount to avoid banding of
10362 the histogram. Possible values are @code{none}, @code{weak} or
10363 @code{strong}. It defaults to @code{none}.
10364 @end table
10365
10366 @section histogram
10367
10368 Compute and draw a color distribution histogram for the input video.
10369
10370 The computed histogram is a representation of the color component
10371 distribution in an image.
10372
10373 Standard histogram displays the color components distribution in an image.
10374 Displays color graph for each color component. Shows distribution of
10375 the Y, U, V, A or R, G, B components, depending on input format, in the
10376 current frame. Below each graph a color component scale meter is shown.
10377
10378 The filter accepts the following options:
10379
10380 @table @option
10381 @item level_height
10382 Set height of level. Default value is @code{200}.
10383 Allowed range is [50, 2048].
10384
10385 @item scale_height
10386 Set height of color scale. Default value is @code{12}.
10387 Allowed range is [0, 40].
10388
10389 @item display_mode
10390 Set display mode.
10391 It accepts the following values:
10392 @table @samp
10393 @item stack
10394 Per color component graphs are placed below each other.
10395
10396 @item parade
10397 Per color component graphs are placed side by side.
10398
10399 @item overlay
10400 Presents information identical to that in the @code{parade}, except
10401 that the graphs representing color components are superimposed directly
10402 over one another.
10403 @end table
10404 Default is @code{stack}.
10405
10406 @item levels_mode
10407 Set mode. Can be either @code{linear}, or @code{logarithmic}.
10408 Default is @code{linear}.
10409
10410 @item components
10411 Set what color components to display.
10412 Default is @code{7}.
10413
10414 @item fgopacity
10415 Set foreground opacity. Default is @code{0.7}.
10416
10417 @item bgopacity
10418 Set background opacity. Default is @code{0.5}.
10419 @end table
10420
10421 @subsection Examples
10422
10423 @itemize
10424
10425 @item
10426 Calculate and draw histogram:
10427 @example
10428 ffplay -i input -vf histogram
10429 @end example
10430
10431 @end itemize
10432
10433 @anchor{hqdn3d}
10434 @section hqdn3d
10435
10436 This is a high precision/quality 3d denoise filter. It aims to reduce
10437 image noise, producing smooth images and making still images really
10438 still. It should enhance compressibility.
10439
10440 It accepts the following optional parameters:
10441
10442 @table @option
10443 @item luma_spatial
10444 A non-negative floating point number which specifies spatial luma strength.
10445 It defaults to 4.0.
10446
10447 @item chroma_spatial
10448 A non-negative floating point number which specifies spatial chroma strength.
10449 It defaults to 3.0*@var{luma_spatial}/4.0.
10450
10451 @item luma_tmp
10452 A floating point number which specifies luma temporal strength. It defaults to
10453 6.0*@var{luma_spatial}/4.0.
10454
10455 @item chroma_tmp
10456 A floating point number which specifies chroma temporal strength. It defaults to
10457 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
10458 @end table
10459
10460 @section hwdownload
10461
10462 Download hardware frames to system memory.
10463
10464 The input must be in hardware frames, and the output a non-hardware format.
10465 Not all formats will be supported on the output - it may be necessary to insert
10466 an additional @option{format} filter immediately following in the graph to get
10467 the output in a supported format.
10468
10469 @section hwmap
10470
10471 Map hardware frames to system memory or to another device.
10472
10473 This filter has several different modes of operation; which one is used depends
10474 on the input and output formats:
10475 @itemize
10476 @item
10477 Hardware frame input, normal frame output
10478
10479 Map the input frames to system memory and pass them to the output.  If the
10480 original hardware frame is later required (for example, after overlaying
10481 something else on part of it), the @option{hwmap} filter can be used again
10482 in the next mode to retrieve it.
10483 @item
10484 Normal frame input, hardware frame output
10485
10486 If the input is actually a software-mapped hardware frame, then unmap it -
10487 that is, return the original hardware frame.
10488
10489 Otherwise, a device must be provided.  Create new hardware surfaces on that
10490 device for the output, then map them back to the software format at the input
10491 and give those frames to the preceding filter.  This will then act like the
10492 @option{hwupload} filter, but may be able to avoid an additional copy when
10493 the input is already in a compatible format.
10494 @item
10495 Hardware frame input and output
10496
10497 A device must be supplied for the output, either directly or with the
10498 @option{derive_device} option.  The input and output devices must be of
10499 different types and compatible - the exact meaning of this is
10500 system-dependent, but typically it means that they must refer to the same
10501 underlying hardware context (for example, refer to the same graphics card).
10502
10503 If the input frames were originally created on the output device, then unmap
10504 to retrieve the original frames.
10505
10506 Otherwise, map the frames to the output device - create new hardware frames
10507 on the output corresponding to the frames on the input.
10508 @end itemize
10509
10510 The following additional parameters are accepted:
10511
10512 @table @option
10513 @item mode
10514 Set the frame mapping mode.  Some combination of:
10515 @table @var
10516 @item read
10517 The mapped frame should be readable.
10518 @item write
10519 The mapped frame should be writeable.
10520 @item overwrite
10521 The mapping will always overwrite the entire frame.
10522
10523 This may improve performance in some cases, as the original contents of the
10524 frame need not be loaded.
10525 @item direct
10526 The mapping must not involve any copying.
10527
10528 Indirect mappings to copies of frames are created in some cases where either
10529 direct mapping is not possible or it would have unexpected properties.
10530 Setting this flag ensures that the mapping is direct and will fail if that is
10531 not possible.
10532 @end table
10533 Defaults to @var{read+write} if not specified.
10534
10535 @item derive_device @var{type}
10536 Rather than using the device supplied at initialisation, instead derive a new
10537 device of type @var{type} from the device the input frames exist on.
10538
10539 @item reverse
10540 In a hardware to hardware mapping, map in reverse - create frames in the sink
10541 and map them back to the source.  This may be necessary in some cases where
10542 a mapping in one direction is required but only the opposite direction is
10543 supported by the devices being used.
10544
10545 This option is dangerous - it may break the preceding filter in undefined
10546 ways if there are any additional constraints on that filter's output.
10547 Do not use it without fully understanding the implications of its use.
10548 @end table
10549
10550 @section hwupload
10551
10552 Upload system memory frames to hardware surfaces.
10553
10554 The device to upload to must be supplied when the filter is initialised.  If
10555 using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
10556 option.
10557
10558 @anchor{hwupload_cuda}
10559 @section hwupload_cuda
10560
10561 Upload system memory frames to a CUDA device.
10562
10563 It accepts the following optional parameters:
10564
10565 @table @option
10566 @item device
10567 The number of the CUDA device to use
10568 @end table
10569
10570 @section hqx
10571
10572 Apply a high-quality magnification filter designed for pixel art. This filter
10573 was originally created by Maxim Stepin.
10574
10575 It accepts the following option:
10576
10577 @table @option
10578 @item n
10579 Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
10580 @code{hq3x} and @code{4} for @code{hq4x}.
10581 Default is @code{3}.
10582 @end table
10583
10584 @section hstack
10585 Stack input videos horizontally.
10586
10587 All streams must be of same pixel format and of same height.
10588
10589 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
10590 to create same output.
10591
10592 The filter accept the following option:
10593
10594 @table @option
10595 @item inputs
10596 Set number of input streams. Default is 2.
10597
10598 @item shortest
10599 If set to 1, force the output to terminate when the shortest input
10600 terminates. Default value is 0.
10601 @end table
10602
10603 @section hue
10604
10605 Modify the hue and/or the saturation of the input.
10606
10607 It accepts the following parameters:
10608
10609 @table @option
10610 @item h
10611 Specify the hue angle as a number of degrees. It accepts an expression,
10612 and defaults to "0".
10613
10614 @item s
10615 Specify the saturation in the [-10,10] range. It accepts an expression and
10616 defaults to "1".
10617
10618 @item H
10619 Specify the hue angle as a number of radians. It accepts an
10620 expression, and defaults to "0".
10621
10622 @item b
10623 Specify the brightness in the [-10,10] range. It accepts an expression and
10624 defaults to "0".
10625 @end table
10626
10627 @option{h} and @option{H} are mutually exclusive, and can't be
10628 specified at the same time.
10629
10630 The @option{b}, @option{h}, @option{H} and @option{s} option values are
10631 expressions containing the following constants:
10632
10633 @table @option
10634 @item n
10635 frame count of the input frame starting from 0
10636
10637 @item pts
10638 presentation timestamp of the input frame expressed in time base units
10639
10640 @item r
10641 frame rate of the input video, NAN if the input frame rate is unknown
10642
10643 @item t
10644 timestamp expressed in seconds, NAN if the input timestamp is unknown
10645
10646 @item tb
10647 time base of the input video
10648 @end table
10649
10650 @subsection Examples
10651
10652 @itemize
10653 @item
10654 Set the hue to 90 degrees and the saturation to 1.0:
10655 @example
10656 hue=h=90:s=1
10657 @end example
10658
10659 @item
10660 Same command but expressing the hue in radians:
10661 @example
10662 hue=H=PI/2:s=1
10663 @end example
10664
10665 @item
10666 Rotate hue and make the saturation swing between 0
10667 and 2 over a period of 1 second:
10668 @example
10669 hue="H=2*PI*t: s=sin(2*PI*t)+1"
10670 @end example
10671
10672 @item
10673 Apply a 3 seconds saturation fade-in effect starting at 0:
10674 @example
10675 hue="s=min(t/3\,1)"
10676 @end example
10677
10678 The general fade-in expression can be written as:
10679 @example
10680 hue="s=min(0\, max((t-START)/DURATION\, 1))"
10681 @end example
10682
10683 @item
10684 Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
10685 @example
10686 hue="s=max(0\, min(1\, (8-t)/3))"
10687 @end example
10688
10689 The general fade-out expression can be written as:
10690 @example
10691 hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
10692 @end example
10693
10694 @end itemize
10695
10696 @subsection Commands
10697
10698 This filter supports the following commands:
10699 @table @option
10700 @item b
10701 @item s
10702 @item h
10703 @item H
10704 Modify the hue and/or the saturation and/or brightness of the input video.
10705 The command accepts the same syntax of the corresponding option.
10706
10707 If the specified expression is not valid, it is kept at its current
10708 value.
10709 @end table
10710
10711 @section hysteresis
10712
10713 Grow first stream into second stream by connecting components.
10714 This makes it possible to build more robust edge masks.
10715
10716 This filter accepts the following options:
10717
10718 @table @option
10719 @item planes
10720 Set which planes will be processed as bitmap, unprocessed planes will be
10721 copied from first stream.
10722 By default value 0xf, all planes will be processed.
10723
10724 @item threshold
10725 Set threshold which is used in filtering. If pixel component value is higher than
10726 this value filter algorithm for connecting components is activated.
10727 By default value is 0.
10728 @end table
10729
10730 @section idet
10731
10732 Detect video interlacing type.
10733
10734 This filter tries to detect if the input frames are interlaced, progressive,
10735 top or bottom field first. It will also try to detect fields that are
10736 repeated between adjacent frames (a sign of telecine).
10737
10738 Single frame detection considers only immediately adjacent frames when classifying each frame.
10739 Multiple frame detection incorporates the classification history of previous frames.
10740
10741 The filter will log these metadata values:
10742
10743 @table @option
10744 @item single.current_frame
10745 Detected type of current frame using single-frame detection. One of:
10746 ``tff'' (top field first), ``bff'' (bottom field first),
10747 ``progressive'', or ``undetermined''
10748
10749 @item single.tff
10750 Cumulative number of frames detected as top field first using single-frame detection.
10751
10752 @item multiple.tff
10753 Cumulative number of frames detected as top field first using multiple-frame detection.
10754
10755 @item single.bff
10756 Cumulative number of frames detected as bottom field first using single-frame detection.
10757
10758 @item multiple.current_frame
10759 Detected type of current frame using multiple-frame detection. One of:
10760 ``tff'' (top field first), ``bff'' (bottom field first),
10761 ``progressive'', or ``undetermined''
10762
10763 @item multiple.bff
10764 Cumulative number of frames detected as bottom field first using multiple-frame detection.
10765
10766 @item single.progressive
10767 Cumulative number of frames detected as progressive using single-frame detection.
10768
10769 @item multiple.progressive
10770 Cumulative number of frames detected as progressive using multiple-frame detection.
10771
10772 @item single.undetermined
10773 Cumulative number of frames that could not be classified using single-frame detection.
10774
10775 @item multiple.undetermined
10776 Cumulative number of frames that could not be classified using multiple-frame detection.
10777
10778 @item repeated.current_frame
10779 Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
10780
10781 @item repeated.neither
10782 Cumulative number of frames with no repeated field.
10783
10784 @item repeated.top
10785 Cumulative number of frames with the top field repeated from the previous frame's top field.
10786
10787 @item repeated.bottom
10788 Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
10789 @end table
10790
10791 The filter accepts the following options:
10792
10793 @table @option
10794 @item intl_thres
10795 Set interlacing threshold.
10796 @item prog_thres
10797 Set progressive threshold.
10798 @item rep_thres
10799 Threshold for repeated field detection.
10800 @item half_life
10801 Number of frames after which a given frame's contribution to the
10802 statistics is halved (i.e., it contributes only 0.5 to its
10803 classification). The default of 0 means that all frames seen are given
10804 full weight of 1.0 forever.
10805 @item analyze_interlaced_flag
10806 When this is not 0 then idet will use the specified number of frames to determine
10807 if the interlaced flag is accurate, it will not count undetermined frames.
10808 If the flag is found to be accurate it will be used without any further
10809 computations, if it is found to be inaccurate it will be cleared without any
10810 further computations. This allows inserting the idet filter as a low computational
10811 method to clean up the interlaced flag
10812 @end table
10813
10814 @section il
10815
10816 Deinterleave or interleave fields.
10817
10818 This filter allows one to process interlaced images fields without
10819 deinterlacing them. Deinterleaving splits the input frame into 2
10820 fields (so called half pictures). Odd lines are moved to the top
10821 half of the output image, even lines to the bottom half.
10822 You can process (filter) them independently and then re-interleave them.
10823
10824 The filter accepts the following options:
10825
10826 @table @option
10827 @item luma_mode, l
10828 @item chroma_mode, c
10829 @item alpha_mode, a
10830 Available values for @var{luma_mode}, @var{chroma_mode} and
10831 @var{alpha_mode} are:
10832
10833 @table @samp
10834 @item none
10835 Do nothing.
10836
10837 @item deinterleave, d
10838 Deinterleave fields, placing one above the other.
10839
10840 @item interleave, i
10841 Interleave fields. Reverse the effect of deinterleaving.
10842 @end table
10843 Default value is @code{none}.
10844
10845 @item luma_swap, ls
10846 @item chroma_swap, cs
10847 @item alpha_swap, as
10848 Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
10849 @end table
10850
10851 @section inflate
10852
10853 Apply inflate effect to the video.
10854
10855 This filter replaces the pixel by the local(3x3) average by taking into account
10856 only values higher than the pixel.
10857
10858 It accepts the following options:
10859
10860 @table @option
10861 @item threshold0
10862 @item threshold1
10863 @item threshold2
10864 @item threshold3
10865 Limit the maximum change for each plane, default is 65535.
10866 If 0, plane will remain unchanged.
10867 @end table
10868
10869 @section interlace
10870
10871 Simple interlacing filter from progressive contents. This interleaves upper (or
10872 lower) lines from odd frames with lower (or upper) lines from even frames,
10873 halving the frame rate and preserving image height.
10874
10875 @example
10876    Original        Original             New Frame
10877    Frame 'j'      Frame 'j+1'             (tff)
10878   ==========      ===========       ==================
10879     Line 0  -------------------->    Frame 'j' Line 0
10880     Line 1          Line 1  ---->   Frame 'j+1' Line 1
10881     Line 2 --------------------->    Frame 'j' Line 2
10882     Line 3          Line 3  ---->   Frame 'j+1' Line 3
10883      ...             ...                   ...
10884 New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
10885 @end example
10886
10887 It accepts the following optional parameters:
10888
10889 @table @option
10890 @item scan
10891 This determines whether the interlaced frame is taken from the even
10892 (tff - default) or odd (bff) lines of the progressive frame.
10893
10894 @item lowpass
10895 Vertical lowpass filter to avoid twitter interlacing and
10896 reduce moire patterns.
10897
10898 @table @samp
10899 @item 0, off
10900 Disable vertical lowpass filter
10901
10902 @item 1, linear
10903 Enable linear filter (default)
10904
10905 @item 2, complex
10906 Enable complex filter. This will slightly less reduce twitter and moire
10907 but better retain detail and subjective sharpness impression.
10908
10909 @end table
10910 @end table
10911
10912 @section kerndeint
10913
10914 Deinterlace input video by applying Donald Graft's adaptive kernel
10915 deinterling. Work on interlaced parts of a video to produce
10916 progressive frames.
10917
10918 The description of the accepted parameters follows.
10919
10920 @table @option
10921 @item thresh
10922 Set the threshold which affects the filter's tolerance when
10923 determining if a pixel line must be processed. It must be an integer
10924 in the range [0,255] and defaults to 10. A value of 0 will result in
10925 applying the process on every pixels.
10926
10927 @item map
10928 Paint pixels exceeding the threshold value to white if set to 1.
10929 Default is 0.
10930
10931 @item order
10932 Set the fields order. Swap fields if set to 1, leave fields alone if
10933 0. Default is 0.
10934
10935 @item sharp
10936 Enable additional sharpening if set to 1. Default is 0.
10937
10938 @item twoway
10939 Enable twoway sharpening if set to 1. Default is 0.
10940 @end table
10941
10942 @subsection Examples
10943
10944 @itemize
10945 @item
10946 Apply default values:
10947 @example
10948 kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
10949 @end example
10950
10951 @item
10952 Enable additional sharpening:
10953 @example
10954 kerndeint=sharp=1
10955 @end example
10956
10957 @item
10958 Paint processed pixels in white:
10959 @example
10960 kerndeint=map=1
10961 @end example
10962 @end itemize
10963
10964 @section lenscorrection
10965
10966 Correct radial lens distortion
10967
10968 This filter can be used to correct for radial distortion as can result from the use
10969 of wide angle lenses, and thereby re-rectify the image. To find the right parameters
10970 one can use tools available for example as part of opencv or simply trial-and-error.
10971 To use opencv use the calibration sample (under samples/cpp) from the opencv sources
10972 and extract the k1 and k2 coefficients from the resulting matrix.
10973
10974 Note that effectively the same filter is available in the open-source tools Krita and
10975 Digikam from the KDE project.
10976
10977 In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
10978 this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
10979 brightness distribution, so you may want to use both filters together in certain
10980 cases, though you will have to take care of ordering, i.e. whether vignetting should
10981 be applied before or after lens correction.
10982
10983 @subsection Options
10984
10985 The filter accepts the following options:
10986
10987 @table @option
10988 @item cx
10989 Relative x-coordinate of the focal point of the image, and thereby the center of the
10990 distortion. This value has a range [0,1] and is expressed as fractions of the image
10991 width. Default is 0.5.
10992 @item cy
10993 Relative y-coordinate of the focal point of the image, and thereby the center of the
10994 distortion. This value has a range [0,1] and is expressed as fractions of the image
10995 height. Default is 0.5.
10996 @item k1
10997 Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
10998 no correction. Default is 0.
10999 @item k2
11000 Coefficient of the double quadratic correction term. This value has a range [-1,1].
11001 0 means no correction. Default is 0.
11002 @end table
11003
11004 The formula that generates the correction is:
11005
11006 @var{r_src} = @var{r_tgt} * (1 + @var{k1} * (@var{r_tgt} / @var{r_0})^2 + @var{k2} * (@var{r_tgt} / @var{r_0})^4)
11007
11008 where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
11009 distances from the focal point in the source and target images, respectively.
11010
11011 @section lensfun
11012
11013 Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
11014
11015 The @code{lensfun} filter requires the camera make, camera model, and lens model
11016 to apply the lens correction. The filter will load the lensfun database and
11017 query it to find the corresponding camera and lens entries in the database. As
11018 long as these entries can be found with the given options, the filter can
11019 perform corrections on frames. Note that incomplete strings will result in the
11020 filter choosing the best match with the given options, and the filter will
11021 output the chosen camera and lens models (logged with level "info"). You must
11022 provide the make, camera model, and lens model as they are required.
11023
11024 The filter accepts the following options:
11025
11026 @table @option
11027 @item make
11028 The make of the camera (for example, "Canon"). This option is required.
11029
11030 @item model
11031 The model of the camera (for example, "Canon EOS 100D"). This option is
11032 required.
11033
11034 @item lens_model
11035 The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
11036 option is required.
11037
11038 @item mode
11039 The type of correction to apply. The following values are valid options:
11040
11041 @table @samp
11042 @item vignetting
11043 Enables fixing lens vignetting.
11044
11045 @item geometry
11046 Enables fixing lens geometry. This is the default.
11047
11048 @item subpixel
11049 Enables fixing chromatic aberrations.
11050
11051 @item vig_geo
11052 Enables fixing lens vignetting and lens geometry.
11053
11054 @item vig_subpixel
11055 Enables fixing lens vignetting and chromatic aberrations.
11056
11057 @item distortion
11058 Enables fixing both lens geometry and chromatic aberrations.
11059
11060 @item all
11061 Enables all possible corrections.
11062
11063 @end table
11064 @item focal_length
11065 The focal length of the image/video (zoom; expected constant for video). For
11066 example, a 18--55mm lens has focal length range of [18--55], so a value in that
11067 range should be chosen when using that lens. Default 18.
11068
11069 @item aperture
11070 The aperture of the image/video (expected constant for video). Note that
11071 aperture is only used for vignetting correction. Default 3.5.
11072
11073 @item focus_distance
11074 The focus distance of the image/video (expected constant for video). Note that
11075 focus distance is only used for vignetting and only slightly affects the
11076 vignetting correction process. If unknown, leave it at the default value (which
11077 is 1000).
11078
11079 @item target_geometry
11080 The target geometry of the output image/video. The following values are valid
11081 options:
11082
11083 @table @samp
11084 @item rectilinear (default)
11085 @item fisheye
11086 @item panoramic
11087 @item equirectangular
11088 @item fisheye_orthographic
11089 @item fisheye_stereographic
11090 @item fisheye_equisolid
11091 @item fisheye_thoby
11092 @end table
11093 @item reverse
11094 Apply the reverse of image correction (instead of correcting distortion, apply
11095 it).
11096
11097 @item interpolation
11098 The type of interpolation used when correcting distortion. The following values
11099 are valid options:
11100
11101 @table @samp
11102 @item nearest
11103 @item linear (default)
11104 @item lanczos
11105 @end table
11106 @end table
11107
11108 @subsection Examples
11109
11110 @itemize
11111 @item
11112 Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
11113 model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
11114 aperture of "8.0".
11115
11116 @example
11117 ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov
11118 @end example
11119
11120 @item
11121 Apply the same as before, but only for the first 5 seconds of video.
11122
11123 @example
11124 ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:enable='lte(t\,5)' -c:v h264 -b:v 8000k output.mov
11125 @end example
11126
11127 @end itemize
11128
11129 @section libvmaf
11130
11131 Obtain the VMAF (Video Multi-Method Assessment Fusion)
11132 score between two input videos.
11133
11134 The obtained VMAF score is printed through the logging system.
11135
11136 It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
11137 After installing the library it can be enabled using:
11138 @code{./configure --enable-libvmaf --enable-version3}.
11139 If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
11140
11141 The filter has following options:
11142
11143 @table @option
11144 @item model_path
11145 Set the model path which is to be used for SVM.
11146 Default value: @code{"vmaf_v0.6.1.pkl"}
11147
11148 @item log_path
11149 Set the file path to be used to store logs.
11150
11151 @item log_fmt
11152 Set the format of the log file (xml or json).
11153
11154 @item enable_transform
11155 Enables transform for computing vmaf.
11156
11157 @item phone_model
11158 Invokes the phone model which will generate VMAF scores higher than in the
11159 regular model, which is more suitable for laptop, TV, etc. viewing conditions.
11160
11161 @item psnr
11162 Enables computing psnr along with vmaf.
11163
11164 @item ssim
11165 Enables computing ssim along with vmaf.
11166
11167 @item ms_ssim
11168 Enables computing ms_ssim along with vmaf.
11169
11170 @item pool
11171 Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
11172
11173 @item n_threads
11174 Set number of threads to be used when computing vmaf.
11175
11176 @item n_subsample
11177 Set interval for frame subsampling used when computing vmaf.
11178
11179 @item enable_conf_interval
11180 Enables confidence interval.
11181 @end table
11182
11183 This filter also supports the @ref{framesync} options.
11184
11185 On the below examples the input file @file{main.mpg} being processed is
11186 compared with the reference file @file{ref.mpg}.
11187
11188 @example
11189 ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
11190 @end example
11191
11192 Example with options:
11193 @example
11194 ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
11195 @end example
11196
11197 @section limiter
11198
11199 Limits the pixel components values to the specified range [min, max].
11200
11201 The filter accepts the following options:
11202
11203 @table @option
11204 @item min
11205 Lower bound. Defaults to the lowest allowed value for the input.
11206
11207 @item max
11208 Upper bound. Defaults to the highest allowed value for the input.
11209
11210 @item planes
11211 Specify which planes will be processed. Defaults to all available.
11212 @end table
11213
11214 @section loop
11215
11216 Loop video frames.
11217
11218 The filter accepts the following options:
11219
11220 @table @option
11221 @item loop
11222 Set the number of loops. Setting this value to -1 will result in infinite loops.
11223 Default is 0.
11224
11225 @item size
11226 Set maximal size in number of frames. Default is 0.
11227
11228 @item start
11229 Set first frame of loop. Default is 0.
11230 @end table
11231
11232 @section lut1d
11233
11234 Apply a 1D LUT to an input video.
11235
11236 The filter accepts the following options:
11237
11238 @table @option
11239 @item file
11240 Set the 1D LUT file name.
11241
11242 Currently supported formats:
11243 @table @samp
11244 @item cube
11245 Iridas
11246 @end table
11247
11248 @item interp
11249 Select interpolation mode.
11250
11251 Available values are:
11252
11253 @table @samp
11254 @item nearest
11255 Use values from the nearest defined point.
11256 @item linear
11257 Interpolate values using the linear interpolation.
11258 @item cubic
11259 Interpolate values using the cubic interpolation.
11260 @end table
11261 @end table
11262
11263 @anchor{lut3d}
11264 @section lut3d
11265
11266 Apply a 3D LUT to an input video.
11267
11268 The filter accepts the following options:
11269
11270 @table @option
11271 @item file
11272 Set the 3D LUT file name.
11273
11274 Currently supported formats:
11275 @table @samp
11276 @item 3dl
11277 AfterEffects
11278 @item cube
11279 Iridas
11280 @item dat
11281 DaVinci
11282 @item m3d
11283 Pandora
11284 @end table
11285 @item interp
11286 Select interpolation mode.
11287
11288 Available values are:
11289
11290 @table @samp
11291 @item nearest
11292 Use values from the nearest defined point.
11293 @item trilinear
11294 Interpolate values using the 8 points defining a cube.
11295 @item tetrahedral
11296 Interpolate values using a tetrahedron.
11297 @end table
11298 @end table
11299
11300 This filter also supports the @ref{framesync} options.
11301
11302 @section lumakey
11303
11304 Turn certain luma values into transparency.
11305
11306 The filter accepts the following options:
11307
11308 @table @option
11309 @item threshold
11310 Set the luma which will be used as base for transparency.
11311 Default value is @code{0}.
11312
11313 @item tolerance
11314 Set the range of luma values to be keyed out.
11315 Default value is @code{0}.
11316
11317 @item softness
11318 Set the range of softness. Default value is @code{0}.
11319 Use this to control gradual transition from zero to full transparency.
11320 @end table
11321
11322 @section lut, lutrgb, lutyuv
11323
11324 Compute a look-up table for binding each pixel component input value
11325 to an output value, and apply it to the input video.
11326
11327 @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
11328 to an RGB input video.
11329
11330 These filters accept the following parameters:
11331 @table @option
11332 @item c0
11333 set first pixel component expression
11334 @item c1
11335 set second pixel component expression
11336 @item c2
11337 set third pixel component expression
11338 @item c3
11339 set fourth pixel component expression, corresponds to the alpha component
11340
11341 @item r
11342 set red component expression
11343 @item g
11344 set green component expression
11345 @item b
11346 set blue component expression
11347 @item a
11348 alpha component expression
11349
11350 @item y
11351 set Y/luminance component expression
11352 @item u
11353 set U/Cb component expression
11354 @item v
11355 set V/Cr component expression
11356 @end table
11357
11358 Each of them specifies the expression to use for computing the lookup table for
11359 the corresponding pixel component values.
11360
11361 The exact component associated to each of the @var{c*} options depends on the
11362 format in input.
11363
11364 The @var{lut} filter requires either YUV or RGB pixel formats in input,
11365 @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
11366
11367 The expressions can contain the following constants and functions:
11368
11369 @table @option
11370 @item w
11371 @item h
11372 The input width and height.
11373
11374 @item val
11375 The input value for the pixel component.
11376
11377 @item clipval
11378 The input value, clipped to the @var{minval}-@var{maxval} range.
11379
11380 @item maxval
11381 The maximum value for the pixel component.
11382
11383 @item minval
11384 The minimum value for the pixel component.
11385
11386 @item negval
11387 The negated value for the pixel component value, clipped to the
11388 @var{minval}-@var{maxval} range; it corresponds to the expression
11389 "maxval-clipval+minval".
11390
11391 @item clip(val)
11392 The computed value in @var{val}, clipped to the
11393 @var{minval}-@var{maxval} range.
11394
11395 @item gammaval(gamma)
11396 The computed gamma correction value of the pixel component value,
11397 clipped to the @var{minval}-@var{maxval} range. It corresponds to the
11398 expression
11399 "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
11400
11401 @end table
11402
11403 All expressions default to "val".
11404
11405 @subsection Examples
11406
11407 @itemize
11408 @item
11409 Negate input video:
11410 @example
11411 lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
11412 lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
11413 @end example
11414
11415 The above is the same as:
11416 @example
11417 lutrgb="r=negval:g=negval:b=negval"
11418 lutyuv="y=negval:u=negval:v=negval"
11419 @end example
11420
11421 @item
11422 Negate luminance:
11423 @example
11424 lutyuv=y=negval
11425 @end example
11426
11427 @item
11428 Remove chroma components, turning the video into a graytone image:
11429 @example
11430 lutyuv="u=128:v=128"
11431 @end example
11432
11433 @item
11434 Apply a luma burning effect:
11435 @example
11436 lutyuv="y=2*val"
11437 @end example
11438
11439 @item
11440 Remove green and blue components:
11441 @example
11442 lutrgb="g=0:b=0"
11443 @end example
11444
11445 @item
11446 Set a constant alpha channel value on input:
11447 @example
11448 format=rgba,lutrgb=a="maxval-minval/2"
11449 @end example
11450
11451 @item
11452 Correct luminance gamma by a factor of 0.5:
11453 @example
11454 lutyuv=y=gammaval(0.5)
11455 @end example
11456
11457 @item
11458 Discard least significant bits of luma:
11459 @example
11460 lutyuv=y='bitand(val, 128+64+32)'
11461 @end example
11462
11463 @item
11464 Technicolor like effect:
11465 @example
11466 lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
11467 @end example
11468 @end itemize
11469
11470 @section lut2, tlut2
11471
11472 The @code{lut2} filter takes two input streams and outputs one
11473 stream.
11474
11475 The @code{tlut2} (time lut2) filter takes two consecutive frames
11476 from one single stream.
11477
11478 This filter accepts the following parameters:
11479 @table @option
11480 @item c0
11481 set first pixel component expression
11482 @item c1
11483 set second pixel component expression
11484 @item c2
11485 set third pixel component expression
11486 @item c3
11487 set fourth pixel component expression, corresponds to the alpha component
11488 @end table
11489
11490 Each of them specifies the expression to use for computing the lookup table for
11491 the corresponding pixel component values.
11492
11493 The exact component associated to each of the @var{c*} options depends on the
11494 format in inputs.
11495
11496 The expressions can contain the following constants:
11497
11498 @table @option
11499 @item w
11500 @item h
11501 The input width and height.
11502
11503 @item x
11504 The first input value for the pixel component.
11505
11506 @item y
11507 The second input value for the pixel component.
11508
11509 @item bdx
11510 The first input video bit depth.
11511
11512 @item bdy
11513 The second input video bit depth.
11514 @end table
11515
11516 All expressions default to "x".
11517
11518 @subsection Examples
11519
11520 @itemize
11521 @item
11522 Highlight differences between two RGB video streams:
11523 @example
11524 lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
11525 @end example
11526
11527 @item
11528 Highlight differences between two YUV video streams:
11529 @example
11530 lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
11531 @end example
11532
11533 @item
11534 Show max difference between two video streams:
11535 @example
11536 lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
11537 @end example
11538 @end itemize
11539
11540 @section maskedclamp
11541
11542 Clamp the first input stream with the second input and third input stream.
11543
11544 Returns the value of first stream to be between second input
11545 stream - @code{undershoot} and third input stream + @code{overshoot}.
11546
11547 This filter accepts the following options:
11548 @table @option
11549 @item undershoot
11550 Default value is @code{0}.
11551
11552 @item overshoot
11553 Default value is @code{0}.
11554
11555 @item planes
11556 Set which planes will be processed as bitmap, unprocessed planes will be
11557 copied from first stream.
11558 By default value 0xf, all planes will be processed.
11559 @end table
11560
11561 @section maskedmerge
11562
11563 Merge the first input stream with the second input stream using per pixel
11564 weights in the third input stream.
11565
11566 A value of 0 in the third stream pixel component means that pixel component
11567 from first stream is returned unchanged, while maximum value (eg. 255 for
11568 8-bit videos) means that pixel component from second stream is returned
11569 unchanged. Intermediate values define the amount of merging between both
11570 input stream's pixel components.
11571
11572 This filter accepts the following options:
11573 @table @option
11574 @item planes
11575 Set which planes will be processed as bitmap, unprocessed planes will be
11576 copied from first stream.
11577 By default value 0xf, all planes will be processed.
11578 @end table
11579
11580 @section mcdeint
11581
11582 Apply motion-compensation deinterlacing.
11583
11584 It needs one field per frame as input and must thus be used together
11585 with yadif=1/3 or equivalent.
11586
11587 This filter accepts the following options:
11588 @table @option
11589 @item mode
11590 Set the deinterlacing mode.
11591
11592 It accepts one of the following values:
11593 @table @samp
11594 @item fast
11595 @item medium
11596 @item slow
11597 use iterative motion estimation
11598 @item extra_slow
11599 like @samp{slow}, but use multiple reference frames.
11600 @end table
11601 Default value is @samp{fast}.
11602
11603 @item parity
11604 Set the picture field parity assumed for the input video. It must be
11605 one of the following values:
11606
11607 @table @samp
11608 @item 0, tff
11609 assume top field first
11610 @item 1, bff
11611 assume bottom field first
11612 @end table
11613
11614 Default value is @samp{bff}.
11615
11616 @item qp
11617 Set per-block quantization parameter (QP) used by the internal
11618 encoder.
11619
11620 Higher values should result in a smoother motion vector field but less
11621 optimal individual vectors. Default value is 1.
11622 @end table
11623
11624 @section mergeplanes
11625
11626 Merge color channel components from several video streams.
11627
11628 The filter accepts up to 4 input streams, and merge selected input
11629 planes to the output video.
11630
11631 This filter accepts the following options:
11632 @table @option
11633 @item mapping
11634 Set input to output plane mapping. Default is @code{0}.
11635
11636 The mappings is specified as a bitmap. It should be specified as a
11637 hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
11638 mapping for the first plane of the output stream. 'A' sets the number of
11639 the input stream to use (from 0 to 3), and 'a' the plane number of the
11640 corresponding input to use (from 0 to 3). The rest of the mappings is
11641 similar, 'Bb' describes the mapping for the output stream second
11642 plane, 'Cc' describes the mapping for the output stream third plane and
11643 'Dd' describes the mapping for the output stream fourth plane.
11644
11645 @item format
11646 Set output pixel format. Default is @code{yuva444p}.
11647 @end table
11648
11649 @subsection Examples
11650
11651 @itemize
11652 @item
11653 Merge three gray video streams of same width and height into single video stream:
11654 @example
11655 [a0][a1][a2]mergeplanes=0x001020:yuv444p
11656 @end example
11657
11658 @item
11659 Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
11660 @example
11661 [a0][a1]mergeplanes=0x00010210:yuva444p
11662 @end example
11663
11664 @item
11665 Swap Y and A plane in yuva444p stream:
11666 @example
11667 format=yuva444p,mergeplanes=0x03010200:yuva444p
11668 @end example
11669
11670 @item
11671 Swap U and V plane in yuv420p stream:
11672 @example
11673 format=yuv420p,mergeplanes=0x000201:yuv420p
11674 @end example
11675
11676 @item
11677 Cast a rgb24 clip to yuv444p:
11678 @example
11679 format=rgb24,mergeplanes=0x000102:yuv444p
11680 @end example
11681 @end itemize
11682
11683 @section mestimate
11684
11685 Estimate and export motion vectors using block matching algorithms.
11686 Motion vectors are stored in frame side data to be used by other filters.
11687
11688 This filter accepts the following options:
11689 @table @option
11690 @item method
11691 Specify the motion estimation method. Accepts one of the following values:
11692
11693 @table @samp
11694 @item esa
11695 Exhaustive search algorithm.
11696 @item tss
11697 Three step search algorithm.
11698 @item tdls
11699 Two dimensional logarithmic search algorithm.
11700 @item ntss
11701 New three step search algorithm.
11702 @item fss
11703 Four step search algorithm.
11704 @item ds
11705 Diamond search algorithm.
11706 @item hexbs
11707 Hexagon-based search algorithm.
11708 @item epzs
11709 Enhanced predictive zonal search algorithm.
11710 @item umh
11711 Uneven multi-hexagon search algorithm.
11712 @end table
11713 Default value is @samp{esa}.
11714
11715 @item mb_size
11716 Macroblock size. Default @code{16}.
11717
11718 @item search_param
11719 Search parameter. Default @code{7}.
11720 @end table
11721
11722 @section midequalizer
11723
11724 Apply Midway Image Equalization effect using two video streams.
11725
11726 Midway Image Equalization adjusts a pair of images to have the same
11727 histogram, while maintaining their dynamics as much as possible. It's
11728 useful for e.g. matching exposures from a pair of stereo cameras.
11729
11730 This filter has two inputs and one output, which must be of same pixel format, but
11731 may be of different sizes. The output of filter is first input adjusted with
11732 midway histogram of both inputs.
11733
11734 This filter accepts the following option:
11735
11736 @table @option
11737 @item planes
11738 Set which planes to process. Default is @code{15}, which is all available planes.
11739 @end table
11740
11741 @section minterpolate
11742
11743 Convert the video to specified frame rate using motion interpolation.
11744
11745 This filter accepts the following options:
11746 @table @option
11747 @item fps
11748 Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
11749
11750 @item mi_mode
11751 Motion interpolation mode. Following values are accepted:
11752 @table @samp
11753 @item dup
11754 Duplicate previous or next frame for interpolating new ones.
11755 @item blend
11756 Blend source frames. Interpolated frame is mean of previous and next frames.
11757 @item mci
11758 Motion compensated interpolation. Following options are effective when this mode is selected:
11759
11760 @table @samp
11761 @item mc_mode
11762 Motion compensation mode. Following values are accepted:
11763 @table @samp
11764 @item obmc
11765 Overlapped block motion compensation.
11766 @item aobmc
11767 Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
11768 @end table
11769 Default mode is @samp{obmc}.
11770
11771 @item me_mode
11772 Motion estimation mode. Following values are accepted:
11773 @table @samp
11774 @item bidir
11775 Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
11776 @item bilat
11777 Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
11778 @end table
11779 Default mode is @samp{bilat}.
11780
11781 @item me
11782 The algorithm to be used for motion estimation. Following values are accepted:
11783 @table @samp
11784 @item esa
11785 Exhaustive search algorithm.
11786 @item tss
11787 Three step search algorithm.
11788 @item tdls
11789 Two dimensional logarithmic search algorithm.
11790 @item ntss
11791 New three step search algorithm.
11792 @item fss
11793 Four step search algorithm.
11794 @item ds
11795 Diamond search algorithm.
11796 @item hexbs
11797 Hexagon-based search algorithm.
11798 @item epzs
11799 Enhanced predictive zonal search algorithm.
11800 @item umh
11801 Uneven multi-hexagon search algorithm.
11802 @end table
11803 Default algorithm is @samp{epzs}.
11804
11805 @item mb_size
11806 Macroblock size. Default @code{16}.
11807
11808 @item search_param
11809 Motion estimation search parameter. Default @code{32}.
11810
11811 @item vsbmc
11812 Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
11813 @end table
11814 @end table
11815
11816 @item scd
11817 Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
11818 @table @samp
11819 @item none
11820 Disable scene change detection.
11821 @item fdiff
11822 Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
11823 @end table
11824 Default method is @samp{fdiff}.
11825
11826 @item scd_threshold
11827 Scene change detection threshold. Default is @code{5.0}.
11828 @end table
11829
11830 @section mix
11831
11832 Mix several video input streams into one video stream.
11833
11834 A description of the accepted options follows.
11835
11836 @table @option
11837 @item nb_inputs
11838 The number of inputs. If unspecified, it defaults to 2.
11839
11840 @item weights
11841 Specify weight of each input video stream as sequence.
11842 Each weight is separated by space. If number of weights
11843 is smaller than number of @var{frames} last specified
11844 weight will be used for all remaining unset weights.
11845
11846 @item scale
11847 Specify scale, if it is set it will be multiplied with sum
11848 of each weight multiplied with pixel values to give final destination
11849 pixel value. By default @var{scale} is auto scaled to sum of weights.
11850
11851 @item duration
11852 Specify how end of stream is determined.
11853 @table @samp
11854 @item longest
11855 The duration of the longest input. (default)
11856
11857 @item shortest
11858 The duration of the shortest input.
11859
11860 @item first
11861 The duration of the first input.
11862 @end table
11863 @end table
11864
11865 @section mpdecimate
11866
11867 Drop frames that do not differ greatly from the previous frame in
11868 order to reduce frame rate.
11869
11870 The main use of this filter is for very-low-bitrate encoding
11871 (e.g. streaming over dialup modem), but it could in theory be used for
11872 fixing movies that were inverse-telecined incorrectly.
11873
11874 A description of the accepted options follows.
11875
11876 @table @option
11877 @item max
11878 Set the maximum number of consecutive frames which can be dropped (if
11879 positive), or the minimum interval between dropped frames (if
11880 negative). If the value is 0, the frame is dropped disregarding the
11881 number of previous sequentially dropped frames.
11882
11883 Default value is 0.
11884
11885 @item hi
11886 @item lo
11887 @item frac
11888 Set the dropping threshold values.
11889
11890 Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
11891 represent actual pixel value differences, so a threshold of 64
11892 corresponds to 1 unit of difference for each pixel, or the same spread
11893 out differently over the block.
11894
11895 A frame is a candidate for dropping if no 8x8 blocks differ by more
11896 than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
11897 meaning the whole image) differ by more than a threshold of @option{lo}.
11898
11899 Default value for @option{hi} is 64*12, default value for @option{lo} is
11900 64*5, and default value for @option{frac} is 0.33.
11901 @end table
11902
11903
11904 @section negate
11905
11906 Negate (invert) the input video.
11907
11908 It accepts the following option:
11909
11910 @table @option
11911
11912 @item negate_alpha
11913 With value 1, it negates the alpha component, if present. Default value is 0.
11914 @end table
11915
11916 @anchor{nlmeans}
11917 @section nlmeans
11918
11919 Denoise frames using Non-Local Means algorithm.
11920
11921 Each pixel is adjusted by looking for other pixels with similar contexts. This
11922 context similarity is defined by comparing their surrounding patches of size
11923 @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
11924 around the pixel.
11925
11926 Note that the research area defines centers for patches, which means some
11927 patches will be made of pixels outside that research area.
11928
11929 The filter accepts the following options.
11930
11931 @table @option
11932 @item s
11933 Set denoising strength.
11934
11935 @item p
11936 Set patch size.
11937
11938 @item pc
11939 Same as @option{p} but for chroma planes.
11940
11941 The default value is @var{0} and means automatic.
11942
11943 @item r
11944 Set research size.
11945
11946 @item rc
11947 Same as @option{r} but for chroma planes.
11948
11949 The default value is @var{0} and means automatic.
11950 @end table
11951
11952 @section nnedi
11953
11954 Deinterlace video using neural network edge directed interpolation.
11955
11956 This filter accepts the following options:
11957
11958 @table @option
11959 @item weights
11960 Mandatory option, without binary file filter can not work.
11961 Currently file can be found here:
11962 https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
11963
11964 @item deint
11965 Set which frames to deinterlace, by default it is @code{all}.
11966 Can be @code{all} or @code{interlaced}.
11967
11968 @item field
11969 Set mode of operation.
11970
11971 Can be one of the following:
11972
11973 @table @samp
11974 @item af
11975 Use frame flags, both fields.
11976 @item a
11977 Use frame flags, single field.
11978 @item t
11979 Use top field only.
11980 @item b
11981 Use bottom field only.
11982 @item tf
11983 Use both fields, top first.
11984 @item bf
11985 Use both fields, bottom first.
11986 @end table
11987
11988 @item planes
11989 Set which planes to process, by default filter process all frames.
11990
11991 @item nsize
11992 Set size of local neighborhood around each pixel, used by the predictor neural
11993 network.
11994
11995 Can be one of the following:
11996
11997 @table @samp
11998 @item s8x6
11999 @item s16x6
12000 @item s32x6
12001 @item s48x6
12002 @item s8x4
12003 @item s16x4
12004 @item s32x4
12005 @end table
12006
12007 @item nns
12008 Set the number of neurons in predictor neural network.
12009 Can be one of the following:
12010
12011 @table @samp
12012 @item n16
12013 @item n32
12014 @item n64
12015 @item n128
12016 @item n256
12017 @end table
12018
12019 @item qual
12020 Controls the number of different neural network predictions that are blended
12021 together to compute the final output value. Can be @code{fast}, default or
12022 @code{slow}.
12023
12024 @item etype
12025 Set which set of weights to use in the predictor.
12026 Can be one of the following:
12027
12028 @table @samp
12029 @item a
12030 weights trained to minimize absolute error
12031 @item s
12032 weights trained to minimize squared error
12033 @end table
12034
12035 @item pscrn
12036 Controls whether or not the prescreener neural network is used to decide
12037 which pixels should be processed by the predictor neural network and which
12038 can be handled by simple cubic interpolation.
12039 The prescreener is trained to know whether cubic interpolation will be
12040 sufficient for a pixel or whether it should be predicted by the predictor nn.
12041 The computational complexity of the prescreener nn is much less than that of
12042 the predictor nn. Since most pixels can be handled by cubic interpolation,
12043 using the prescreener generally results in much faster processing.
12044 The prescreener is pretty accurate, so the difference between using it and not
12045 using it is almost always unnoticeable.
12046
12047 Can be one of the following:
12048
12049 @table @samp
12050 @item none
12051 @item original
12052 @item new
12053 @end table
12054
12055 Default is @code{new}.
12056
12057 @item fapprox
12058 Set various debugging flags.
12059 @end table
12060
12061 @section noformat
12062
12063 Force libavfilter not to use any of the specified pixel formats for the
12064 input to the next filter.
12065
12066 It accepts the following parameters:
12067 @table @option
12068
12069 @item pix_fmts
12070 A '|'-separated list of pixel format names, such as
12071 pix_fmts=yuv420p|monow|rgb24".
12072
12073 @end table
12074
12075 @subsection Examples
12076
12077 @itemize
12078 @item
12079 Force libavfilter to use a format different from @var{yuv420p} for the
12080 input to the vflip filter:
12081 @example
12082 noformat=pix_fmts=yuv420p,vflip
12083 @end example
12084
12085 @item
12086 Convert the input video to any of the formats not contained in the list:
12087 @example
12088 noformat=yuv420p|yuv444p|yuv410p
12089 @end example
12090 @end itemize
12091
12092 @section noise
12093
12094 Add noise on video input frame.
12095
12096 The filter accepts the following options:
12097
12098 @table @option
12099 @item all_seed
12100 @item c0_seed
12101 @item c1_seed
12102 @item c2_seed
12103 @item c3_seed
12104 Set noise seed for specific pixel component or all pixel components in case
12105 of @var{all_seed}. Default value is @code{123457}.
12106
12107 @item all_strength, alls
12108 @item c0_strength, c0s
12109 @item c1_strength, c1s
12110 @item c2_strength, c2s
12111 @item c3_strength, c3s
12112 Set noise strength for specific pixel component or all pixel components in case
12113 @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
12114
12115 @item all_flags, allf
12116 @item c0_flags, c0f
12117 @item c1_flags, c1f
12118 @item c2_flags, c2f
12119 @item c3_flags, c3f
12120 Set pixel component flags or set flags for all components if @var{all_flags}.
12121 Available values for component flags are:
12122 @table @samp
12123 @item a
12124 averaged temporal noise (smoother)
12125 @item p
12126 mix random noise with a (semi)regular pattern
12127 @item t
12128 temporal noise (noise pattern changes between frames)
12129 @item u
12130 uniform noise (gaussian otherwise)
12131 @end table
12132 @end table
12133
12134 @subsection Examples
12135
12136 Add temporal and uniform noise to input video:
12137 @example
12138 noise=alls=20:allf=t+u
12139 @end example
12140
12141 @section normalize
12142
12143 Normalize RGB video (aka histogram stretching, contrast stretching).
12144 See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
12145
12146 For each channel of each frame, the filter computes the input range and maps
12147 it linearly to the user-specified output range. The output range defaults
12148 to the full dynamic range from pure black to pure white.
12149
12150 Temporal smoothing can be used on the input range to reduce flickering (rapid
12151 changes in brightness) caused when small dark or bright objects enter or leave
12152 the scene. This is similar to the auto-exposure (automatic gain control) on a
12153 video camera, and, like a video camera, it may cause a period of over- or
12154 under-exposure of the video.
12155
12156 The R,G,B channels can be normalized independently, which may cause some
12157 color shifting, or linked together as a single channel, which prevents
12158 color shifting. Linked normalization preserves hue. Independent normalization
12159 does not, so it can be used to remove some color casts. Independent and linked
12160 normalization can be combined in any ratio.
12161
12162 The normalize filter accepts the following options:
12163
12164 @table @option
12165 @item blackpt
12166 @item whitept
12167 Colors which define the output range. The minimum input value is mapped to
12168 the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
12169 The defaults are black and white respectively. Specifying white for
12170 @var{blackpt} and black for @var{whitept} will give color-inverted,
12171 normalized video. Shades of grey can be used to reduce the dynamic range
12172 (contrast). Specifying saturated colors here can create some interesting
12173 effects.
12174
12175 @item smoothing
12176 The number of previous frames to use for temporal smoothing. The input range
12177 of each channel is smoothed using a rolling average over the current frame
12178 and the @var{smoothing} previous frames. The default is 0 (no temporal
12179 smoothing).
12180
12181 @item independence
12182 Controls the ratio of independent (color shifting) channel normalization to
12183 linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
12184 independent. Defaults to 1.0 (fully independent).
12185
12186 @item strength
12187 Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
12188 expensive no-op. Defaults to 1.0 (full strength).
12189
12190 @end table
12191
12192 @subsection Examples
12193
12194 Stretch video contrast to use the full dynamic range, with no temporal
12195 smoothing; may flicker depending on the source content:
12196 @example
12197 normalize=blackpt=black:whitept=white:smoothing=0
12198 @end example
12199
12200 As above, but with 50 frames of temporal smoothing; flicker should be
12201 reduced, depending on the source content:
12202 @example
12203 normalize=blackpt=black:whitept=white:smoothing=50
12204 @end example
12205
12206 As above, but with hue-preserving linked channel normalization:
12207 @example
12208 normalize=blackpt=black:whitept=white:smoothing=50:independence=0
12209 @end example
12210
12211 As above, but with half strength:
12212 @example
12213 normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
12214 @end example
12215
12216 Map the darkest input color to red, the brightest input color to cyan:
12217 @example
12218 normalize=blackpt=red:whitept=cyan
12219 @end example
12220
12221 @section null
12222
12223 Pass the video source unchanged to the output.
12224
12225 @section ocr
12226 Optical Character Recognition
12227
12228 This filter uses Tesseract for optical character recognition. To enable
12229 compilation of this filter, you need to configure FFmpeg with
12230 @code{--enable-libtesseract}.
12231
12232 It accepts the following options:
12233
12234 @table @option
12235 @item datapath
12236 Set datapath to tesseract data. Default is to use whatever was
12237 set at installation.
12238
12239 @item language
12240 Set language, default is "eng".
12241
12242 @item whitelist
12243 Set character whitelist.
12244
12245 @item blacklist
12246 Set character blacklist.
12247 @end table
12248
12249 The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
12250
12251 @section ocv
12252
12253 Apply a video transform using libopencv.
12254
12255 To enable this filter, install the libopencv library and headers and
12256 configure FFmpeg with @code{--enable-libopencv}.
12257
12258 It accepts the following parameters:
12259
12260 @table @option
12261
12262 @item filter_name
12263 The name of the libopencv filter to apply.
12264
12265 @item filter_params
12266 The parameters to pass to the libopencv filter. If not specified, the default
12267 values are assumed.
12268
12269 @end table
12270
12271 Refer to the official libopencv documentation for more precise
12272 information:
12273 @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
12274
12275 Several libopencv filters are supported; see the following subsections.
12276
12277 @anchor{dilate}
12278 @subsection dilate
12279
12280 Dilate an image by using a specific structuring element.
12281 It corresponds to the libopencv function @code{cvDilate}.
12282
12283 It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
12284
12285 @var{struct_el} represents a structuring element, and has the syntax:
12286 @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
12287
12288 @var{cols} and @var{rows} represent the number of columns and rows of
12289 the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
12290 point, and @var{shape} the shape for the structuring element. @var{shape}
12291 must be "rect", "cross", "ellipse", or "custom".
12292
12293 If the value for @var{shape} is "custom", it must be followed by a
12294 string of the form "=@var{filename}". The file with name
12295 @var{filename} is assumed to represent a binary image, with each
12296 printable character corresponding to a bright pixel. When a custom
12297 @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
12298 or columns and rows of the read file are assumed instead.
12299
12300 The default value for @var{struct_el} is "3x3+0x0/rect".
12301
12302 @var{nb_iterations} specifies the number of times the transform is
12303 applied to the image, and defaults to 1.
12304
12305 Some examples:
12306 @example
12307 # Use the default values
12308 ocv=dilate
12309
12310 # Dilate using a structuring element with a 5x5 cross, iterating two times
12311 ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
12312
12313 # Read the shape from the file diamond.shape, iterating two times.
12314 # The file diamond.shape may contain a pattern of characters like this
12315 #   *
12316 #  ***
12317 # *****
12318 #  ***
12319 #   *
12320 # The specified columns and rows are ignored
12321 # but the anchor point coordinates are not
12322 ocv=dilate:0x0+2x2/custom=diamond.shape|2
12323 @end example
12324
12325 @subsection erode
12326
12327 Erode an image by using a specific structuring element.
12328 It corresponds to the libopencv function @code{cvErode}.
12329
12330 It accepts the parameters: @var{struct_el}:@var{nb_iterations},
12331 with the same syntax and semantics as the @ref{dilate} filter.
12332
12333 @subsection smooth
12334
12335 Smooth the input video.
12336
12337 The filter takes the following parameters:
12338 @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
12339
12340 @var{type} is the type of smooth filter to apply, and must be one of
12341 the following values: "blur", "blur_no_scale", "median", "gaussian",
12342 or "bilateral". The default value is "gaussian".
12343
12344 The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
12345 depend on the smooth type. @var{param1} and
12346 @var{param2} accept integer positive values or 0. @var{param3} and
12347 @var{param4} accept floating point values.
12348
12349 The default value for @var{param1} is 3. The default value for the
12350 other parameters is 0.
12351
12352 These parameters correspond to the parameters assigned to the
12353 libopencv function @code{cvSmooth}.
12354
12355 @section oscilloscope
12356
12357 2D Video Oscilloscope.
12358
12359 Useful to measure spatial impulse, step responses, chroma delays, etc.
12360
12361 It accepts the following parameters:
12362
12363 @table @option
12364 @item x
12365 Set scope center x position.
12366
12367 @item y
12368 Set scope center y position.
12369
12370 @item s
12371 Set scope size, relative to frame diagonal.
12372
12373 @item t
12374 Set scope tilt/rotation.
12375
12376 @item o
12377 Set trace opacity.
12378
12379 @item tx
12380 Set trace center x position.
12381
12382 @item ty
12383 Set trace center y position.
12384
12385 @item tw
12386 Set trace width, relative to width of frame.
12387
12388 @item th
12389 Set trace height, relative to height of frame.
12390
12391 @item c
12392 Set which components to trace. By default it traces first three components.
12393
12394 @item g
12395 Draw trace grid. By default is enabled.
12396
12397 @item st
12398 Draw some statistics. By default is enabled.
12399
12400 @item sc
12401 Draw scope. By default is enabled.
12402 @end table
12403
12404 @subsection Examples
12405
12406 @itemize
12407 @item
12408 Inspect full first row of video frame.
12409 @example
12410 oscilloscope=x=0.5:y=0:s=1
12411 @end example
12412
12413 @item
12414 Inspect full last row of video frame.
12415 @example
12416 oscilloscope=x=0.5:y=1:s=1
12417 @end example
12418
12419 @item
12420 Inspect full 5th line of video frame of height 1080.
12421 @example
12422 oscilloscope=x=0.5:y=5/1080:s=1
12423 @end example
12424
12425 @item
12426 Inspect full last column of video frame.
12427 @example
12428 oscilloscope=x=1:y=0.5:s=1:t=1
12429 @end example
12430
12431 @end itemize
12432
12433 @anchor{overlay}
12434 @section overlay
12435
12436 Overlay one video on top of another.
12437
12438 It takes two inputs and has one output. The first input is the "main"
12439 video on which the second input is overlaid.
12440
12441 It accepts the following parameters:
12442
12443 A description of the accepted options follows.
12444
12445 @table @option
12446 @item x
12447 @item y
12448 Set the expression for the x and y coordinates of the overlaid video
12449 on the main video. Default value is "0" for both expressions. In case
12450 the expression is invalid, it is set to a huge value (meaning that the
12451 overlay will not be displayed within the output visible area).
12452
12453 @item eof_action
12454 See @ref{framesync}.
12455
12456 @item eval
12457 Set when the expressions for @option{x}, and @option{y} are evaluated.
12458
12459 It accepts the following values:
12460 @table @samp
12461 @item init
12462 only evaluate expressions once during the filter initialization or
12463 when a command is processed
12464
12465 @item frame
12466 evaluate expressions for each incoming frame
12467 @end table
12468
12469 Default value is @samp{frame}.
12470
12471 @item shortest
12472 See @ref{framesync}.
12473
12474 @item format
12475 Set the format for the output video.
12476
12477 It accepts the following values:
12478 @table @samp
12479 @item yuv420
12480 force YUV420 output
12481
12482 @item yuv422
12483 force YUV422 output
12484
12485 @item yuv444
12486 force YUV444 output
12487
12488 @item rgb
12489 force packed RGB output
12490
12491 @item gbrp
12492 force planar RGB output
12493
12494 @item auto
12495 automatically pick format
12496 @end table
12497
12498 Default value is @samp{yuv420}.
12499
12500 @item repeatlast
12501 See @ref{framesync}.
12502
12503 @item alpha
12504 Set format of alpha of the overlaid video, it can be @var{straight} or
12505 @var{premultiplied}. Default is @var{straight}.
12506 @end table
12507
12508 The @option{x}, and @option{y} expressions can contain the following
12509 parameters.
12510
12511 @table @option
12512 @item main_w, W
12513 @item main_h, H
12514 The main input width and height.
12515
12516 @item overlay_w, w
12517 @item overlay_h, h
12518 The overlay input width and height.
12519
12520 @item x
12521 @item y
12522 The computed values for @var{x} and @var{y}. They are evaluated for
12523 each new frame.
12524
12525 @item hsub
12526 @item vsub
12527 horizontal and vertical chroma subsample values of the output
12528 format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
12529 @var{vsub} is 1.
12530
12531 @item n
12532 the number of input frame, starting from 0
12533
12534 @item pos
12535 the position in the file of the input frame, NAN if unknown
12536
12537 @item t
12538 The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
12539
12540 @end table
12541
12542 This filter also supports the @ref{framesync} options.
12543
12544 Note that the @var{n}, @var{pos}, @var{t} variables are available only
12545 when evaluation is done @emph{per frame}, and will evaluate to NAN
12546 when @option{eval} is set to @samp{init}.
12547
12548 Be aware that frames are taken from each input video in timestamp
12549 order, hence, if their initial timestamps differ, it is a good idea
12550 to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
12551 have them begin in the same zero timestamp, as the example for
12552 the @var{movie} filter does.
12553
12554 You can chain together more overlays but you should test the
12555 efficiency of such approach.
12556
12557 @subsection Commands
12558
12559 This filter supports the following commands:
12560 @table @option
12561 @item x
12562 @item y
12563 Modify the x and y of the overlay input.
12564 The command accepts the same syntax of the corresponding option.
12565
12566 If the specified expression is not valid, it is kept at its current
12567 value.
12568 @end table
12569
12570 @subsection Examples
12571
12572 @itemize
12573 @item
12574 Draw the overlay at 10 pixels from the bottom right corner of the main
12575 video:
12576 @example
12577 overlay=main_w-overlay_w-10:main_h-overlay_h-10
12578 @end example
12579
12580 Using named options the example above becomes:
12581 @example
12582 overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
12583 @end example
12584
12585 @item
12586 Insert a transparent PNG logo in the bottom left corner of the input,
12587 using the @command{ffmpeg} tool with the @code{-filter_complex} option:
12588 @example
12589 ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
12590 @end example
12591
12592 @item
12593 Insert 2 different transparent PNG logos (second logo on bottom
12594 right corner) using the @command{ffmpeg} tool:
12595 @example
12596 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
12597 @end example
12598
12599 @item
12600 Add a transparent color layer on top of the main video; @code{WxH}
12601 must specify the size of the main input to the overlay filter:
12602 @example
12603 color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
12604 @end example
12605
12606 @item
12607 Play an original video and a filtered version (here with the deshake
12608 filter) side by side using the @command{ffplay} tool:
12609 @example
12610 ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
12611 @end example
12612
12613 The above command is the same as:
12614 @example
12615 ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
12616 @end example
12617
12618 @item
12619 Make a sliding overlay appearing from the left to the right top part of the
12620 screen starting since time 2:
12621 @example
12622 overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
12623 @end example
12624
12625 @item
12626 Compose output by putting two input videos side to side:
12627 @example
12628 ffmpeg -i left.avi -i right.avi -filter_complex "
12629 nullsrc=size=200x100 [background];
12630 [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
12631 [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
12632 [background][left]       overlay=shortest=1       [background+left];
12633 [background+left][right] overlay=shortest=1:x=100 [left+right]
12634 "
12635 @end example
12636
12637 @item
12638 Mask 10-20 seconds of a video by applying the delogo filter to a section
12639 @example
12640 ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
12641 -vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
12642 masked.avi
12643 @end example
12644
12645 @item
12646 Chain several overlays in cascade:
12647 @example
12648 nullsrc=s=200x200 [bg];
12649 testsrc=s=100x100, split=4 [in0][in1][in2][in3];
12650 [in0] lutrgb=r=0, [bg]   overlay=0:0     [mid0];
12651 [in1] lutrgb=g=0, [mid0] overlay=100:0   [mid1];
12652 [in2] lutrgb=b=0, [mid1] overlay=0:100   [mid2];
12653 [in3] null,       [mid2] overlay=100:100 [out0]
12654 @end example
12655
12656 @end itemize
12657
12658 @section owdenoise
12659
12660 Apply Overcomplete Wavelet denoiser.
12661
12662 The filter accepts the following options:
12663
12664 @table @option
12665 @item depth
12666 Set depth.
12667
12668 Larger depth values will denoise lower frequency components more, but
12669 slow down filtering.
12670
12671 Must be an int in the range 8-16, default is @code{8}.
12672
12673 @item luma_strength, ls
12674 Set luma strength.
12675
12676 Must be a double value in the range 0-1000, default is @code{1.0}.
12677
12678 @item chroma_strength, cs
12679 Set chroma strength.
12680
12681 Must be a double value in the range 0-1000, default is @code{1.0}.
12682 @end table
12683
12684 @anchor{pad}
12685 @section pad
12686
12687 Add paddings to the input image, and place the original input at the
12688 provided @var{x}, @var{y} coordinates.
12689
12690 It accepts the following parameters:
12691
12692 @table @option
12693 @item width, w
12694 @item height, h
12695 Specify an expression for the size of the output image with the
12696 paddings added. If the value for @var{width} or @var{height} is 0, the
12697 corresponding input size is used for the output.
12698
12699 The @var{width} expression can reference the value set by the
12700 @var{height} expression, and vice versa.
12701
12702 The default value of @var{width} and @var{height} is 0.
12703
12704 @item x
12705 @item y
12706 Specify the offsets to place the input image at within the padded area,
12707 with respect to the top/left border of the output image.
12708
12709 The @var{x} expression can reference the value set by the @var{y}
12710 expression, and vice versa.
12711
12712 The default value of @var{x} and @var{y} is 0.
12713
12714 If @var{x} or @var{y} evaluate to a negative number, they'll be changed
12715 so the input image is centered on the padded area.
12716
12717 @item color
12718 Specify the color of the padded area. For the syntax of this option,
12719 check the @ref{color syntax,,"Color" section in the ffmpeg-utils
12720 manual,ffmpeg-utils}.
12721
12722 The default value of @var{color} is "black".
12723
12724 @item eval
12725 Specify when to evaluate  @var{width}, @var{height}, @var{x} and @var{y} expression.
12726
12727 It accepts the following values:
12728
12729 @table @samp
12730 @item init
12731 Only evaluate expressions once during the filter initialization or when
12732 a command is processed.
12733
12734 @item frame
12735 Evaluate expressions for each incoming frame.
12736
12737 @end table
12738
12739 Default value is @samp{init}.
12740
12741 @item aspect
12742 Pad to aspect instead to a resolution.
12743
12744 @end table
12745
12746 The value for the @var{width}, @var{height}, @var{x}, and @var{y}
12747 options are expressions containing the following constants:
12748
12749 @table @option
12750 @item in_w
12751 @item in_h
12752 The input video width and height.
12753
12754 @item iw
12755 @item ih
12756 These are the same as @var{in_w} and @var{in_h}.
12757
12758 @item out_w
12759 @item out_h
12760 The output width and height (the size of the padded area), as
12761 specified by the @var{width} and @var{height} expressions.
12762
12763 @item ow
12764 @item oh
12765 These are the same as @var{out_w} and @var{out_h}.
12766
12767 @item x
12768 @item y
12769 The x and y offsets as specified by the @var{x} and @var{y}
12770 expressions, or NAN if not yet specified.
12771
12772 @item a
12773 same as @var{iw} / @var{ih}
12774
12775 @item sar
12776 input sample aspect ratio
12777
12778 @item dar
12779 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
12780
12781 @item hsub
12782 @item vsub
12783 The horizontal and vertical chroma subsample values. For example for the
12784 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
12785 @end table
12786
12787 @subsection Examples
12788
12789 @itemize
12790 @item
12791 Add paddings with the color "violet" to the input video. The output video
12792 size is 640x480, and the top-left corner of the input video is placed at
12793 column 0, row 40
12794 @example
12795 pad=640:480:0:40:violet
12796 @end example
12797
12798 The example above is equivalent to the following command:
12799 @example
12800 pad=width=640:height=480:x=0:y=40:color=violet
12801 @end example
12802
12803 @item
12804 Pad the input to get an output with dimensions increased by 3/2,
12805 and put the input video at the center of the padded area:
12806 @example
12807 pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
12808 @end example
12809
12810 @item
12811 Pad the input to get a squared output with size equal to the maximum
12812 value between the input width and height, and put the input video at
12813 the center of the padded area:
12814 @example
12815 pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
12816 @end example
12817
12818 @item
12819 Pad the input to get a final w/h ratio of 16:9:
12820 @example
12821 pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
12822 @end example
12823
12824 @item
12825 In case of anamorphic video, in order to set the output display aspect
12826 correctly, it is necessary to use @var{sar} in the expression,
12827 according to the relation:
12828 @example
12829 (ih * X / ih) * sar = output_dar
12830 X = output_dar / sar
12831 @end example
12832
12833 Thus the previous example needs to be modified to:
12834 @example
12835 pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
12836 @end example
12837
12838 @item
12839 Double the output size and put the input video in the bottom-right
12840 corner of the output padded area:
12841 @example
12842 pad="2*iw:2*ih:ow-iw:oh-ih"
12843 @end example
12844 @end itemize
12845
12846 @anchor{palettegen}
12847 @section palettegen
12848
12849 Generate one palette for a whole video stream.
12850
12851 It accepts the following options:
12852
12853 @table @option
12854 @item max_colors
12855 Set the maximum number of colors to quantize in the palette.
12856 Note: the palette will still contain 256 colors; the unused palette entries
12857 will be black.
12858
12859 @item reserve_transparent
12860 Create a palette of 255 colors maximum and reserve the last one for
12861 transparency. Reserving the transparency color is useful for GIF optimization.
12862 If not set, the maximum of colors in the palette will be 256. You probably want
12863 to disable this option for a standalone image.
12864 Set by default.
12865
12866 @item transparency_color
12867 Set the color that will be used as background for transparency.
12868
12869 @item stats_mode
12870 Set statistics mode.
12871
12872 It accepts the following values:
12873 @table @samp
12874 @item full
12875 Compute full frame histograms.
12876 @item diff
12877 Compute histograms only for the part that differs from previous frame. This
12878 might be relevant to give more importance to the moving part of your input if
12879 the background is static.
12880 @item single
12881 Compute new histogram for each frame.
12882 @end table
12883
12884 Default value is @var{full}.
12885 @end table
12886
12887 The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
12888 (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
12889 color quantization of the palette. This information is also visible at
12890 @var{info} logging level.
12891
12892 @subsection Examples
12893
12894 @itemize
12895 @item
12896 Generate a representative palette of a given video using @command{ffmpeg}:
12897 @example
12898 ffmpeg -i input.mkv -vf palettegen palette.png
12899 @end example
12900 @end itemize
12901
12902 @section paletteuse
12903
12904 Use a palette to downsample an input video stream.
12905
12906 The filter takes two inputs: one video stream and a palette. The palette must
12907 be a 256 pixels image.
12908
12909 It accepts the following options:
12910
12911 @table @option
12912 @item dither
12913 Select dithering mode. Available algorithms are:
12914 @table @samp
12915 @item bayer
12916 Ordered 8x8 bayer dithering (deterministic)
12917 @item heckbert
12918 Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
12919 Note: this dithering is sometimes considered "wrong" and is included as a
12920 reference.
12921 @item floyd_steinberg
12922 Floyd and Steingberg dithering (error diffusion)
12923 @item sierra2
12924 Frankie Sierra dithering v2 (error diffusion)
12925 @item sierra2_4a
12926 Frankie Sierra dithering v2 "Lite" (error diffusion)
12927 @end table
12928
12929 Default is @var{sierra2_4a}.
12930
12931 @item bayer_scale
12932 When @var{bayer} dithering is selected, this option defines the scale of the
12933 pattern (how much the crosshatch pattern is visible). A low value means more
12934 visible pattern for less banding, and higher value means less visible pattern
12935 at the cost of more banding.
12936
12937 The option must be an integer value in the range [0,5]. Default is @var{2}.
12938
12939 @item diff_mode
12940 If set, define the zone to process
12941
12942 @table @samp
12943 @item rectangle
12944 Only the changing rectangle will be reprocessed. This is similar to GIF
12945 cropping/offsetting compression mechanism. This option can be useful for speed
12946 if only a part of the image is changing, and has use cases such as limiting the
12947 scope of the error diffusal @option{dither} to the rectangle that bounds the
12948 moving scene (it leads to more deterministic output if the scene doesn't change
12949 much, and as a result less moving noise and better GIF compression).
12950 @end table
12951
12952 Default is @var{none}.
12953
12954 @item new
12955 Take new palette for each output frame.
12956
12957 @item alpha_threshold
12958 Sets the alpha threshold for transparency. Alpha values above this threshold
12959 will be treated as completely opaque, and values below this threshold will be
12960 treated as completely transparent.
12961
12962 The option must be an integer value in the range [0,255]. Default is @var{128}.
12963 @end table
12964
12965 @subsection Examples
12966
12967 @itemize
12968 @item
12969 Use a palette (generated for example with @ref{palettegen}) to encode a GIF
12970 using @command{ffmpeg}:
12971 @example
12972 ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
12973 @end example
12974 @end itemize
12975
12976 @section perspective
12977
12978 Correct perspective of video not recorded perpendicular to the screen.
12979
12980 A description of the accepted parameters follows.
12981
12982 @table @option
12983 @item x0
12984 @item y0
12985 @item x1
12986 @item y1
12987 @item x2
12988 @item y2
12989 @item x3
12990 @item y3
12991 Set coordinates expression for top left, top right, bottom left and bottom right corners.
12992 Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
12993 If the @code{sense} option is set to @code{source}, then the specified points will be sent
12994 to the corners of the destination. If the @code{sense} option is set to @code{destination},
12995 then the corners of the source will be sent to the specified coordinates.
12996
12997 The expressions can use the following variables:
12998
12999 @table @option
13000 @item W
13001 @item H
13002 the width and height of video frame.
13003 @item in
13004 Input frame count.
13005 @item on
13006 Output frame count.
13007 @end table
13008
13009 @item interpolation
13010 Set interpolation for perspective correction.
13011
13012 It accepts the following values:
13013 @table @samp
13014 @item linear
13015 @item cubic
13016 @end table
13017
13018 Default value is @samp{linear}.
13019
13020 @item sense
13021 Set interpretation of coordinate options.
13022
13023 It accepts the following values:
13024 @table @samp
13025 @item 0, source
13026
13027 Send point in the source specified by the given coordinates to
13028 the corners of the destination.
13029
13030 @item 1, destination
13031
13032 Send the corners of the source to the point in the destination specified
13033 by the given coordinates.
13034
13035 Default value is @samp{source}.
13036 @end table
13037
13038 @item eval
13039 Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
13040
13041 It accepts the following values:
13042 @table @samp
13043 @item init
13044 only evaluate expressions once during the filter initialization or
13045 when a command is processed
13046
13047 @item frame
13048 evaluate expressions for each incoming frame
13049 @end table
13050
13051 Default value is @samp{init}.
13052 @end table
13053
13054 @section phase
13055
13056 Delay interlaced video by one field time so that the field order changes.
13057
13058 The intended use is to fix PAL movies that have been captured with the
13059 opposite field order to the film-to-video transfer.
13060
13061 A description of the accepted parameters follows.
13062
13063 @table @option
13064 @item mode
13065 Set phase mode.
13066
13067 It accepts the following values:
13068 @table @samp
13069 @item t
13070 Capture field order top-first, transfer bottom-first.
13071 Filter will delay the bottom field.
13072
13073 @item b
13074 Capture field order bottom-first, transfer top-first.
13075 Filter will delay the top field.
13076
13077 @item p
13078 Capture and transfer with the same field order. This mode only exists
13079 for the documentation of the other options to refer to, but if you
13080 actually select it, the filter will faithfully do nothing.
13081
13082 @item a
13083 Capture field order determined automatically by field flags, transfer
13084 opposite.
13085 Filter selects among @samp{t} and @samp{b} modes on a frame by frame
13086 basis using field flags. If no field information is available,
13087 then this works just like @samp{u}.
13088
13089 @item u
13090 Capture unknown or varying, transfer opposite.
13091 Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
13092 analyzing the images and selecting the alternative that produces best
13093 match between the fields.
13094
13095 @item T
13096 Capture top-first, transfer unknown or varying.
13097 Filter selects among @samp{t} and @samp{p} using image analysis.
13098
13099 @item B
13100 Capture bottom-first, transfer unknown or varying.
13101 Filter selects among @samp{b} and @samp{p} using image analysis.
13102
13103 @item A
13104 Capture determined by field flags, transfer unknown or varying.
13105 Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
13106 image analysis. If no field information is available, then this works just
13107 like @samp{U}. This is the default mode.
13108
13109 @item U
13110 Both capture and transfer unknown or varying.
13111 Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
13112 @end table
13113 @end table
13114
13115 @section pixdesctest
13116
13117 Pixel format descriptor test filter, mainly useful for internal
13118 testing. The output video should be equal to the input video.
13119
13120 For example:
13121 @example
13122 format=monow, pixdesctest
13123 @end example
13124
13125 can be used to test the monowhite pixel format descriptor definition.
13126
13127 @section pixscope
13128
13129 Display sample values of color channels. Mainly useful for checking color
13130 and levels. Minimum supported resolution is 640x480.
13131
13132 The filters accept the following options:
13133
13134 @table @option
13135 @item x
13136 Set scope X position, relative offset on X axis.
13137
13138 @item y
13139 Set scope Y position, relative offset on Y axis.
13140
13141 @item w
13142 Set scope width.
13143
13144 @item h
13145 Set scope height.
13146
13147 @item o
13148 Set window opacity. This window also holds statistics about pixel area.
13149
13150 @item wx
13151 Set window X position, relative offset on X axis.
13152
13153 @item wy
13154 Set window Y position, relative offset on Y axis.
13155 @end table
13156
13157 @section pp
13158
13159 Enable the specified chain of postprocessing subfilters using libpostproc. This
13160 library should be automatically selected with a GPL build (@code{--enable-gpl}).
13161 Subfilters must be separated by '/' and can be disabled by prepending a '-'.
13162 Each subfilter and some options have a short and a long name that can be used
13163 interchangeably, i.e. dr/dering are the same.
13164
13165 The filters accept the following options:
13166
13167 @table @option
13168 @item subfilters
13169 Set postprocessing subfilters string.
13170 @end table
13171
13172 All subfilters share common options to determine their scope:
13173
13174 @table @option
13175 @item a/autoq
13176 Honor the quality commands for this subfilter.
13177
13178 @item c/chrom
13179 Do chrominance filtering, too (default).
13180
13181 @item y/nochrom
13182 Do luminance filtering only (no chrominance).
13183
13184 @item n/noluma
13185 Do chrominance filtering only (no luminance).
13186 @end table
13187
13188 These options can be appended after the subfilter name, separated by a '|'.
13189
13190 Available subfilters are:
13191
13192 @table @option
13193 @item hb/hdeblock[|difference[|flatness]]
13194 Horizontal deblocking filter
13195 @table @option
13196 @item difference
13197 Difference factor where higher values mean more deblocking (default: @code{32}).
13198 @item flatness
13199 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13200 @end table
13201
13202 @item vb/vdeblock[|difference[|flatness]]
13203 Vertical deblocking filter
13204 @table @option
13205 @item difference
13206 Difference factor where higher values mean more deblocking (default: @code{32}).
13207 @item flatness
13208 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13209 @end table
13210
13211 @item ha/hadeblock[|difference[|flatness]]
13212 Accurate horizontal deblocking filter
13213 @table @option
13214 @item difference
13215 Difference factor where higher values mean more deblocking (default: @code{32}).
13216 @item flatness
13217 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13218 @end table
13219
13220 @item va/vadeblock[|difference[|flatness]]
13221 Accurate vertical deblocking filter
13222 @table @option
13223 @item difference
13224 Difference factor where higher values mean more deblocking (default: @code{32}).
13225 @item flatness
13226 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13227 @end table
13228 @end table
13229
13230 The horizontal and vertical deblocking filters share the difference and
13231 flatness values so you cannot set different horizontal and vertical
13232 thresholds.
13233
13234 @table @option
13235 @item h1/x1hdeblock
13236 Experimental horizontal deblocking filter
13237
13238 @item v1/x1vdeblock
13239 Experimental vertical deblocking filter
13240
13241 @item dr/dering
13242 Deringing filter
13243
13244 @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
13245 @table @option
13246 @item threshold1
13247 larger -> stronger filtering
13248 @item threshold2
13249 larger -> stronger filtering
13250 @item threshold3
13251 larger -> stronger filtering
13252 @end table
13253
13254 @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
13255 @table @option
13256 @item f/fullyrange
13257 Stretch luminance to @code{0-255}.
13258 @end table
13259
13260 @item lb/linblenddeint
13261 Linear blend deinterlacing filter that deinterlaces the given block by
13262 filtering all lines with a @code{(1 2 1)} filter.
13263
13264 @item li/linipoldeint
13265 Linear interpolating deinterlacing filter that deinterlaces the given block by
13266 linearly interpolating every second line.
13267
13268 @item ci/cubicipoldeint
13269 Cubic interpolating deinterlacing filter deinterlaces the given block by
13270 cubically interpolating every second line.
13271
13272 @item md/mediandeint
13273 Median deinterlacing filter that deinterlaces the given block by applying a
13274 median filter to every second line.
13275
13276 @item fd/ffmpegdeint
13277 FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
13278 second line with a @code{(-1 4 2 4 -1)} filter.
13279
13280 @item l5/lowpass5
13281 Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
13282 block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
13283
13284 @item fq/forceQuant[|quantizer]
13285 Overrides the quantizer table from the input with the constant quantizer you
13286 specify.
13287 @table @option
13288 @item quantizer
13289 Quantizer to use
13290 @end table
13291
13292 @item de/default
13293 Default pp filter combination (@code{hb|a,vb|a,dr|a})
13294
13295 @item fa/fast
13296 Fast pp filter combination (@code{h1|a,v1|a,dr|a})
13297
13298 @item ac
13299 High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
13300 @end table
13301
13302 @subsection Examples
13303
13304 @itemize
13305 @item
13306 Apply horizontal and vertical deblocking, deringing and automatic
13307 brightness/contrast:
13308 @example
13309 pp=hb/vb/dr/al
13310 @end example
13311
13312 @item
13313 Apply default filters without brightness/contrast correction:
13314 @example
13315 pp=de/-al
13316 @end example
13317
13318 @item
13319 Apply default filters and temporal denoiser:
13320 @example
13321 pp=default/tmpnoise|1|2|3
13322 @end example
13323
13324 @item
13325 Apply deblocking on luminance only, and switch vertical deblocking on or off
13326 automatically depending on available CPU time:
13327 @example
13328 pp=hb|y/vb|a
13329 @end example
13330 @end itemize
13331
13332 @section pp7
13333 Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
13334 similar to spp = 6 with 7 point DCT, where only the center sample is
13335 used after IDCT.
13336
13337 The filter accepts the following options:
13338
13339 @table @option
13340 @item qp
13341 Force a constant quantization parameter. It accepts an integer in range
13342 0 to 63. If not set, the filter will use the QP from the video stream
13343 (if available).
13344
13345 @item mode
13346 Set thresholding mode. Available modes are:
13347
13348 @table @samp
13349 @item hard
13350 Set hard thresholding.
13351 @item soft
13352 Set soft thresholding (better de-ringing effect, but likely blurrier).
13353 @item medium
13354 Set medium thresholding (good results, default).
13355 @end table
13356 @end table
13357
13358 @section premultiply
13359 Apply alpha premultiply effect to input video stream using first plane
13360 of second stream as alpha.
13361
13362 Both streams must have same dimensions and same pixel format.
13363
13364 The filter accepts the following option:
13365
13366 @table @option
13367 @item planes
13368 Set which planes will be processed, unprocessed planes will be copied.
13369 By default value 0xf, all planes will be processed.
13370
13371 @item inplace
13372 Do not require 2nd input for processing, instead use alpha plane from input stream.
13373 @end table
13374
13375 @section prewitt
13376 Apply prewitt operator to input video stream.
13377
13378 The filter accepts the following option:
13379
13380 @table @option
13381 @item planes
13382 Set which planes will be processed, unprocessed planes will be copied.
13383 By default value 0xf, all planes will be processed.
13384
13385 @item scale
13386 Set value which will be multiplied with filtered result.
13387
13388 @item delta
13389 Set value which will be added to filtered result.
13390 @end table
13391
13392 @anchor{program_opencl}
13393 @section program_opencl
13394
13395 Filter video using an OpenCL program.
13396
13397 @table @option
13398
13399 @item source
13400 OpenCL program source file.
13401
13402 @item kernel
13403 Kernel name in program.
13404
13405 @item inputs
13406 Number of inputs to the filter.  Defaults to 1.
13407
13408 @item size, s
13409 Size of output frames.  Defaults to the same as the first input.
13410
13411 @end table
13412
13413 The program source file must contain a kernel function with the given name,
13414 which will be run once for each plane of the output.  Each run on a plane
13415 gets enqueued as a separate 2D global NDRange with one work-item for each
13416 pixel to be generated.  The global ID offset for each work-item is therefore
13417 the coordinates of a pixel in the destination image.
13418
13419 The kernel function needs to take the following arguments:
13420 @itemize
13421 @item
13422 Destination image, @var{__write_only image2d_t}.
13423
13424 This image will become the output; the kernel should write all of it.
13425 @item
13426 Frame index, @var{unsigned int}.
13427
13428 This is a counter starting from zero and increasing by one for each frame.
13429 @item
13430 Source images, @var{__read_only image2d_t}.
13431
13432 These are the most recent images on each input.  The kernel may read from
13433 them to generate the output, but they can't be written to.
13434 @end itemize
13435
13436 Example programs:
13437
13438 @itemize
13439 @item
13440 Copy the input to the output (output must be the same size as the input).
13441 @verbatim
13442 __kernel void copy(__write_only image2d_t destination,
13443                    unsigned int index,
13444                    __read_only  image2d_t source)
13445 {
13446     const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
13447
13448     int2 location = (int2)(get_global_id(0), get_global_id(1));
13449
13450     float4 value = read_imagef(source, sampler, location);
13451
13452     write_imagef(destination, location, value);
13453 }
13454 @end verbatim
13455
13456 @item
13457 Apply a simple transformation, rotating the input by an amount increasing
13458 with the index counter.  Pixel values are linearly interpolated by the
13459 sampler, and the output need not have the same dimensions as the input.
13460 @verbatim
13461 __kernel void rotate_image(__write_only image2d_t dst,
13462                            unsigned int index,
13463                            __read_only  image2d_t src)
13464 {
13465     const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
13466                                CLK_FILTER_LINEAR);
13467
13468     float angle = (float)index / 100.0f;
13469
13470     float2 dst_dim = convert_float2(get_image_dim(dst));
13471     float2 src_dim = convert_float2(get_image_dim(src));
13472
13473     float2 dst_cen = dst_dim / 2.0f;
13474     float2 src_cen = src_dim / 2.0f;
13475
13476     int2   dst_loc = (int2)(get_global_id(0), get_global_id(1));
13477
13478     float2 dst_pos = convert_float2(dst_loc) - dst_cen;
13479     float2 src_pos = {
13480         cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
13481         sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
13482     };
13483     src_pos = src_pos * src_dim / dst_dim;
13484
13485     float2 src_loc = src_pos + src_cen;
13486
13487     if (src_loc.x < 0.0f      || src_loc.y < 0.0f ||
13488         src_loc.x > src_dim.x || src_loc.y > src_dim.y)
13489         write_imagef(dst, dst_loc, 0.5f);
13490     else
13491         write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
13492 }
13493 @end verbatim
13494
13495 @item
13496 Blend two inputs together, with the amount of each input used varying
13497 with the index counter.
13498 @verbatim
13499 __kernel void blend_images(__write_only image2d_t dst,
13500                            unsigned int index,
13501                            __read_only  image2d_t src1,
13502                            __read_only  image2d_t src2)
13503 {
13504     const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
13505                                CLK_FILTER_LINEAR);
13506
13507     float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
13508
13509     int2  dst_loc = (int2)(get_global_id(0), get_global_id(1));
13510     int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
13511     int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
13512
13513     float4 val1 = read_imagef(src1, sampler, src1_loc);
13514     float4 val2 = read_imagef(src2, sampler, src2_loc);
13515
13516     write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
13517 }
13518 @end verbatim
13519
13520 @end itemize
13521
13522 @section pseudocolor
13523
13524 Alter frame colors in video with pseudocolors.
13525
13526 This filter accept the following options:
13527
13528 @table @option
13529 @item c0
13530 set pixel first component expression
13531
13532 @item c1
13533 set pixel second component expression
13534
13535 @item c2
13536 set pixel third component expression
13537
13538 @item c3
13539 set pixel fourth component expression, corresponds to the alpha component
13540
13541 @item i
13542 set component to use as base for altering colors
13543 @end table
13544
13545 Each of them specifies the expression to use for computing the lookup table for
13546 the corresponding pixel component values.
13547
13548 The expressions can contain the following constants and functions:
13549
13550 @table @option
13551 @item w
13552 @item h
13553 The input width and height.
13554
13555 @item val
13556 The input value for the pixel component.
13557
13558 @item ymin, umin, vmin, amin
13559 The minimum allowed component value.
13560
13561 @item ymax, umax, vmax, amax
13562 The maximum allowed component value.
13563 @end table
13564
13565 All expressions default to "val".
13566
13567 @subsection Examples
13568
13569 @itemize
13570 @item
13571 Change too high luma values to gradient:
13572 @example
13573 pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
13574 @end example
13575 @end itemize
13576
13577 @section psnr
13578
13579 Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
13580 Ratio) between two input videos.
13581
13582 This filter takes in input two input videos, the first input is
13583 considered the "main" source and is passed unchanged to the
13584 output. The second input is used as a "reference" video for computing
13585 the PSNR.
13586
13587 Both video inputs must have the same resolution and pixel format for
13588 this filter to work correctly. Also it assumes that both inputs
13589 have the same number of frames, which are compared one by one.
13590
13591 The obtained average PSNR is printed through the logging system.
13592
13593 The filter stores the accumulated MSE (mean squared error) of each
13594 frame, and at the end of the processing it is averaged across all frames
13595 equally, and the following formula is applied to obtain the PSNR:
13596
13597 @example
13598 PSNR = 10*log10(MAX^2/MSE)
13599 @end example
13600
13601 Where MAX is the average of the maximum values of each component of the
13602 image.
13603
13604 The description of the accepted parameters follows.
13605
13606 @table @option
13607 @item stats_file, f
13608 If specified the filter will use the named file to save the PSNR of
13609 each individual frame. When filename equals "-" the data is sent to
13610 standard output.
13611
13612 @item stats_version
13613 Specifies which version of the stats file format to use. Details of
13614 each format are written below.
13615 Default value is 1.
13616
13617 @item stats_add_max
13618 Determines whether the max value is output to the stats log.
13619 Default value is 0.
13620 Requires stats_version >= 2. If this is set and stats_version < 2,
13621 the filter will return an error.
13622 @end table
13623
13624 This filter also supports the @ref{framesync} options.
13625
13626 The file printed if @var{stats_file} is selected, contains a sequence of
13627 key/value pairs of the form @var{key}:@var{value} for each compared
13628 couple of frames.
13629
13630 If a @var{stats_version} greater than 1 is specified, a header line precedes
13631 the list of per-frame-pair stats, with key value pairs following the frame
13632 format with the following parameters:
13633
13634 @table @option
13635 @item psnr_log_version
13636 The version of the log file format. Will match @var{stats_version}.
13637
13638 @item fields
13639 A comma separated list of the per-frame-pair parameters included in
13640 the log.
13641 @end table
13642
13643 A description of each shown per-frame-pair parameter follows:
13644
13645 @table @option
13646 @item n
13647 sequential number of the input frame, starting from 1
13648
13649 @item mse_avg
13650 Mean Square Error pixel-by-pixel average difference of the compared
13651 frames, averaged over all the image components.
13652
13653 @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
13654 Mean Square Error pixel-by-pixel average difference of the compared
13655 frames for the component specified by the suffix.
13656
13657 @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
13658 Peak Signal to Noise ratio of the compared frames for the component
13659 specified by the suffix.
13660
13661 @item max_avg, max_y, max_u, max_v
13662 Maximum allowed value for each channel, and average over all
13663 channels.
13664 @end table
13665
13666 For example:
13667 @example
13668 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
13669 [main][ref] psnr="stats_file=stats.log" [out]
13670 @end example
13671
13672 On this example the input file being processed is compared with the
13673 reference file @file{ref_movie.mpg}. The PSNR of each individual frame
13674 is stored in @file{stats.log}.
13675
13676 @anchor{pullup}
13677 @section pullup
13678
13679 Pulldown reversal (inverse telecine) filter, capable of handling mixed
13680 hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
13681 content.
13682
13683 The pullup filter is designed to take advantage of future context in making
13684 its decisions. This filter is stateless in the sense that it does not lock
13685 onto a pattern to follow, but it instead looks forward to the following
13686 fields in order to identify matches and rebuild progressive frames.
13687
13688 To produce content with an even framerate, insert the fps filter after
13689 pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
13690 @code{fps=24} for 30fps and the (rare) telecined 25fps input.
13691
13692 The filter accepts the following options:
13693
13694 @table @option
13695 @item jl
13696 @item jr
13697 @item jt
13698 @item jb
13699 These options set the amount of "junk" to ignore at the left, right, top, and
13700 bottom of the image, respectively. Left and right are in units of 8 pixels,
13701 while top and bottom are in units of 2 lines.
13702 The default is 8 pixels on each side.
13703
13704 @item sb
13705 Set the strict breaks. Setting this option to 1 will reduce the chances of
13706 filter generating an occasional mismatched frame, but it may also cause an
13707 excessive number of frames to be dropped during high motion sequences.
13708 Conversely, setting it to -1 will make filter match fields more easily.
13709 This may help processing of video where there is slight blurring between
13710 the fields, but may also cause there to be interlaced frames in the output.
13711 Default value is @code{0}.
13712
13713 @item mp
13714 Set the metric plane to use. It accepts the following values:
13715 @table @samp
13716 @item l
13717 Use luma plane.
13718
13719 @item u
13720 Use chroma blue plane.
13721
13722 @item v
13723 Use chroma red plane.
13724 @end table
13725
13726 This option may be set to use chroma plane instead of the default luma plane
13727 for doing filter's computations. This may improve accuracy on very clean
13728 source material, but more likely will decrease accuracy, especially if there
13729 is chroma noise (rainbow effect) or any grayscale video.
13730 The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
13731 load and make pullup usable in realtime on slow machines.
13732 @end table
13733
13734 For best results (without duplicated frames in the output file) it is
13735 necessary to change the output frame rate. For example, to inverse
13736 telecine NTSC input:
13737 @example
13738 ffmpeg -i input -vf pullup -r 24000/1001 ...
13739 @end example
13740
13741 @section qp
13742
13743 Change video quantization parameters (QP).
13744
13745 The filter accepts the following option:
13746
13747 @table @option
13748 @item qp
13749 Set expression for quantization parameter.
13750 @end table
13751
13752 The expression is evaluated through the eval API and can contain, among others,
13753 the following constants:
13754
13755 @table @var
13756 @item known
13757 1 if index is not 129, 0 otherwise.
13758
13759 @item qp
13760 Sequential index starting from -129 to 128.
13761 @end table
13762
13763 @subsection Examples
13764
13765 @itemize
13766 @item
13767 Some equation like:
13768 @example
13769 qp=2+2*sin(PI*qp)
13770 @end example
13771 @end itemize
13772
13773 @section random
13774
13775 Flush video frames from internal cache of frames into a random order.
13776 No frame is discarded.
13777 Inspired by @ref{frei0r} nervous filter.
13778
13779 @table @option
13780 @item frames
13781 Set size in number of frames of internal cache, in range from @code{2} to
13782 @code{512}. Default is @code{30}.
13783
13784 @item seed
13785 Set seed for random number generator, must be an integer included between
13786 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
13787 less than @code{0}, the filter will try to use a good random seed on a
13788 best effort basis.
13789 @end table
13790
13791 @section readeia608
13792
13793 Read closed captioning (EIA-608) information from the top lines of a video frame.
13794
13795 This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
13796 @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
13797 with EIA-608 data (starting from 0). A description of each metadata value follows:
13798
13799 @table @option
13800 @item lavfi.readeia608.X.cc
13801 The two bytes stored as EIA-608 data (printed in hexadecimal).
13802
13803 @item lavfi.readeia608.X.line
13804 The number of the line on which the EIA-608 data was identified and read.
13805 @end table
13806
13807 This filter accepts the following options:
13808
13809 @table @option
13810 @item scan_min
13811 Set the line to start scanning for EIA-608 data. Default is @code{0}.
13812
13813 @item scan_max
13814 Set the line to end scanning for EIA-608 data. Default is @code{29}.
13815
13816 @item mac
13817 Set minimal acceptable amplitude change for sync codes detection.
13818 Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
13819
13820 @item spw
13821 Set the ratio of width reserved for sync code detection.
13822 Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
13823
13824 @item mhd
13825 Set the max peaks height difference for sync code detection.
13826 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
13827
13828 @item mpd
13829 Set max peaks period difference for sync code detection.
13830 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
13831
13832 @item msd
13833 Set the first two max start code bits differences.
13834 Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
13835
13836 @item bhd
13837 Set the minimum ratio of bits height compared to 3rd start code bit.
13838 Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
13839
13840 @item th_w
13841 Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
13842
13843 @item th_b
13844 Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
13845
13846 @item chp
13847 Enable checking the parity bit. In the event of a parity error, the filter will output
13848 @code{0x00} for that character. Default is false.
13849 @end table
13850
13851 @subsection Examples
13852
13853 @itemize
13854 @item
13855 Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
13856 @example
13857 ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
13858 @end example
13859 @end itemize
13860
13861 @section readvitc
13862
13863 Read vertical interval timecode (VITC) information from the top lines of a
13864 video frame.
13865
13866 The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
13867 timecode value, if a valid timecode has been detected. Further metadata key
13868 @code{lavfi.readvitc.found} is set to 0/1 depending on whether
13869 timecode data has been found or not.
13870
13871 This filter accepts the following options:
13872
13873 @table @option
13874 @item scan_max
13875 Set the maximum number of lines to scan for VITC data. If the value is set to
13876 @code{-1} the full video frame is scanned. Default is @code{45}.
13877
13878 @item thr_b
13879 Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
13880 default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
13881
13882 @item thr_w
13883 Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
13884 default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
13885 @end table
13886
13887 @subsection Examples
13888
13889 @itemize
13890 @item
13891 Detect and draw VITC data onto the video frame; if no valid VITC is detected,
13892 draw @code{--:--:--:--} as a placeholder:
13893 @example
13894 ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
13895 @end example
13896 @end itemize
13897
13898 @section remap
13899
13900 Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
13901
13902 Destination pixel at position (X, Y) will be picked from source (x, y) position
13903 where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
13904 value for pixel will be used for destination pixel.
13905
13906 Xmap and Ymap input video streams must be of same dimensions. Output video stream
13907 will have Xmap/Ymap video stream dimensions.
13908 Xmap and Ymap input video streams are 16bit depth, single channel.
13909
13910 @section removegrain
13911
13912 The removegrain filter is a spatial denoiser for progressive video.
13913
13914 @table @option
13915 @item m0
13916 Set mode for the first plane.
13917
13918 @item m1
13919 Set mode for the second plane.
13920
13921 @item m2
13922 Set mode for the third plane.
13923
13924 @item m3
13925 Set mode for the fourth plane.
13926 @end table
13927
13928 Range of mode is from 0 to 24. Description of each mode follows:
13929
13930 @table @var
13931 @item 0
13932 Leave input plane unchanged. Default.
13933
13934 @item 1
13935 Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
13936
13937 @item 2
13938 Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
13939
13940 @item 3
13941 Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
13942
13943 @item 4
13944 Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
13945 This is equivalent to a median filter.
13946
13947 @item 5
13948 Line-sensitive clipping giving the minimal change.
13949
13950 @item 6
13951 Line-sensitive clipping, intermediate.
13952
13953 @item 7
13954 Line-sensitive clipping, intermediate.
13955
13956 @item 8
13957 Line-sensitive clipping, intermediate.
13958
13959 @item 9
13960 Line-sensitive clipping on a line where the neighbours pixels are the closest.
13961
13962 @item 10
13963 Replaces the target pixel with the closest neighbour.
13964
13965 @item 11
13966 [1 2 1] horizontal and vertical kernel blur.
13967
13968 @item 12
13969 Same as mode 11.
13970
13971 @item 13
13972 Bob mode, interpolates top field from the line where the neighbours
13973 pixels are the closest.
13974
13975 @item 14
13976 Bob mode, interpolates bottom field from the line where the neighbours
13977 pixels are the closest.
13978
13979 @item 15
13980 Bob mode, interpolates top field. Same as 13 but with a more complicated
13981 interpolation formula.
13982
13983 @item 16
13984 Bob mode, interpolates bottom field. Same as 14 but with a more complicated
13985 interpolation formula.
13986
13987 @item 17
13988 Clips the pixel with the minimum and maximum of respectively the maximum and
13989 minimum of each pair of opposite neighbour pixels.
13990
13991 @item 18
13992 Line-sensitive clipping using opposite neighbours whose greatest distance from
13993 the current pixel is minimal.
13994
13995 @item 19
13996 Replaces the pixel with the average of its 8 neighbours.
13997
13998 @item 20
13999 Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
14000
14001 @item 21
14002 Clips pixels using the averages of opposite neighbour.
14003
14004 @item 22
14005 Same as mode 21 but simpler and faster.
14006
14007 @item 23
14008 Small edge and halo removal, but reputed useless.
14009
14010 @item 24
14011 Similar as 23.
14012 @end table
14013
14014 @section removelogo
14015
14016 Suppress a TV station logo, using an image file to determine which
14017 pixels comprise the logo. It works by filling in the pixels that
14018 comprise the logo with neighboring pixels.
14019
14020 The filter accepts the following options:
14021
14022 @table @option
14023 @item filename, f
14024 Set the filter bitmap file, which can be any image format supported by
14025 libavformat. The width and height of the image file must match those of the
14026 video stream being processed.
14027 @end table
14028
14029 Pixels in the provided bitmap image with a value of zero are not
14030 considered part of the logo, non-zero pixels are considered part of
14031 the logo. If you use white (255) for the logo and black (0) for the
14032 rest, you will be safe. For making the filter bitmap, it is
14033 recommended to take a screen capture of a black frame with the logo
14034 visible, and then using a threshold filter followed by the erode
14035 filter once or twice.
14036
14037 If needed, little splotches can be fixed manually. Remember that if
14038 logo pixels are not covered, the filter quality will be much
14039 reduced. Marking too many pixels as part of the logo does not hurt as
14040 much, but it will increase the amount of blurring needed to cover over
14041 the image and will destroy more information than necessary, and extra
14042 pixels will slow things down on a large logo.
14043
14044 @section repeatfields
14045
14046 This filter uses the repeat_field flag from the Video ES headers and hard repeats
14047 fields based on its value.
14048
14049 @section reverse
14050
14051 Reverse a video clip.
14052
14053 Warning: This filter requires memory to buffer the entire clip, so trimming
14054 is suggested.
14055
14056 @subsection Examples
14057
14058 @itemize
14059 @item
14060 Take the first 5 seconds of a clip, and reverse it.
14061 @example
14062 trim=end=5,reverse
14063 @end example
14064 @end itemize
14065
14066 @section roberts
14067 Apply roberts cross operator to input video stream.
14068
14069 The filter accepts the following option:
14070
14071 @table @option
14072 @item planes
14073 Set which planes will be processed, unprocessed planes will be copied.
14074 By default value 0xf, all planes will be processed.
14075
14076 @item scale
14077 Set value which will be multiplied with filtered result.
14078
14079 @item delta
14080 Set value which will be added to filtered result.
14081 @end table
14082
14083 @section rotate
14084
14085 Rotate video by an arbitrary angle expressed in radians.
14086
14087 The filter accepts the following options:
14088
14089 A description of the optional parameters follows.
14090 @table @option
14091 @item angle, a
14092 Set an expression for the angle by which to rotate the input video
14093 clockwise, expressed as a number of radians. A negative value will
14094 result in a counter-clockwise rotation. By default it is set to "0".
14095
14096 This expression is evaluated for each frame.
14097
14098 @item out_w, ow
14099 Set the output width expression, default value is "iw".
14100 This expression is evaluated just once during configuration.
14101
14102 @item out_h, oh
14103 Set the output height expression, default value is "ih".
14104 This expression is evaluated just once during configuration.
14105
14106 @item bilinear
14107 Enable bilinear interpolation if set to 1, a value of 0 disables
14108 it. Default value is 1.
14109
14110 @item fillcolor, c
14111 Set the color used to fill the output area not covered by the rotated
14112 image. For the general syntax of this option, check the
14113 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
14114 If the special value "none" is selected then no
14115 background is printed (useful for example if the background is never shown).
14116
14117 Default value is "black".
14118 @end table
14119
14120 The expressions for the angle and the output size can contain the
14121 following constants and functions:
14122
14123 @table @option
14124 @item n
14125 sequential number of the input frame, starting from 0. It is always NAN
14126 before the first frame is filtered.
14127
14128 @item t
14129 time in seconds of the input frame, it is set to 0 when the filter is
14130 configured. It is always NAN before the first frame is filtered.
14131
14132 @item hsub
14133 @item vsub
14134 horizontal and vertical chroma subsample values. For example for the
14135 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14136
14137 @item in_w, iw
14138 @item in_h, ih
14139 the input video width and height
14140
14141 @item out_w, ow
14142 @item out_h, oh
14143 the output width and height, that is the size of the padded area as
14144 specified by the @var{width} and @var{height} expressions
14145
14146 @item rotw(a)
14147 @item roth(a)
14148 the minimal width/height required for completely containing the input
14149 video rotated by @var{a} radians.
14150
14151 These are only available when computing the @option{out_w} and
14152 @option{out_h} expressions.
14153 @end table
14154
14155 @subsection Examples
14156
14157 @itemize
14158 @item
14159 Rotate the input by PI/6 radians clockwise:
14160 @example
14161 rotate=PI/6
14162 @end example
14163
14164 @item
14165 Rotate the input by PI/6 radians counter-clockwise:
14166 @example
14167 rotate=-PI/6
14168 @end example
14169
14170 @item
14171 Rotate the input by 45 degrees clockwise:
14172 @example
14173 rotate=45*PI/180
14174 @end example
14175
14176 @item
14177 Apply a constant rotation with period T, starting from an angle of PI/3:
14178 @example
14179 rotate=PI/3+2*PI*t/T
14180 @end example
14181
14182 @item
14183 Make the input video rotation oscillating with a period of T
14184 seconds and an amplitude of A radians:
14185 @example
14186 rotate=A*sin(2*PI/T*t)
14187 @end example
14188
14189 @item
14190 Rotate the video, output size is chosen so that the whole rotating
14191 input video is always completely contained in the output:
14192 @example
14193 rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
14194 @end example
14195
14196 @item
14197 Rotate the video, reduce the output size so that no background is ever
14198 shown:
14199 @example
14200 rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
14201 @end example
14202 @end itemize
14203
14204 @subsection Commands
14205
14206 The filter supports the following commands:
14207
14208 @table @option
14209 @item a, angle
14210 Set the angle expression.
14211 The command accepts the same syntax of the corresponding option.
14212
14213 If the specified expression is not valid, it is kept at its current
14214 value.
14215 @end table
14216
14217 @section sab
14218
14219 Apply Shape Adaptive Blur.
14220
14221 The filter accepts the following options:
14222
14223 @table @option
14224 @item luma_radius, lr
14225 Set luma blur filter strength, must be a value in range 0.1-4.0, default
14226 value is 1.0. A greater value will result in a more blurred image, and
14227 in slower processing.
14228
14229 @item luma_pre_filter_radius, lpfr
14230 Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
14231 value is 1.0.
14232
14233 @item luma_strength, ls
14234 Set luma maximum difference between pixels to still be considered, must
14235 be a value in the 0.1-100.0 range, default value is 1.0.
14236
14237 @item chroma_radius, cr
14238 Set chroma blur filter strength, must be a value in range -0.9-4.0. A
14239 greater value will result in a more blurred image, and in slower
14240 processing.
14241
14242 @item chroma_pre_filter_radius, cpfr
14243 Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
14244
14245 @item chroma_strength, cs
14246 Set chroma maximum difference between pixels to still be considered,
14247 must be a value in the -0.9-100.0 range.
14248 @end table
14249
14250 Each chroma option value, if not explicitly specified, is set to the
14251 corresponding luma option value.
14252
14253 @anchor{scale}
14254 @section scale
14255
14256 Scale (resize) the input video, using the libswscale library.
14257
14258 The scale filter forces the output display aspect ratio to be the same
14259 of the input, by changing the output sample aspect ratio.
14260
14261 If the input image format is different from the format requested by
14262 the next filter, the scale filter will convert the input to the
14263 requested format.
14264
14265 @subsection Options
14266 The filter accepts the following options, or any of the options
14267 supported by the libswscale scaler.
14268
14269 See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
14270 the complete list of scaler options.
14271
14272 @table @option
14273 @item width, w
14274 @item height, h
14275 Set the output video dimension expression. Default value is the input
14276 dimension.
14277
14278 If the @var{width} or @var{w} value is 0, the input width is used for
14279 the output. If the @var{height} or @var{h} value is 0, the input height
14280 is used for the output.
14281
14282 If one and only one of the values is -n with n >= 1, the scale filter
14283 will use a value that maintains the aspect ratio of the input image,
14284 calculated from the other specified dimension. After that it will,
14285 however, make sure that the calculated dimension is divisible by n and
14286 adjust the value if necessary.
14287
14288 If both values are -n with n >= 1, the behavior will be identical to
14289 both values being set to 0 as previously detailed.
14290
14291 See below for the list of accepted constants for use in the dimension
14292 expression.
14293
14294 @item eval
14295 Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
14296
14297 @table @samp
14298 @item init
14299 Only evaluate expressions once during the filter initialization or when a command is processed.
14300
14301 @item frame
14302 Evaluate expressions for each incoming frame.
14303
14304 @end table
14305
14306 Default value is @samp{init}.
14307
14308
14309 @item interl
14310 Set the interlacing mode. It accepts the following values:
14311
14312 @table @samp
14313 @item 1
14314 Force interlaced aware scaling.
14315
14316 @item 0
14317 Do not apply interlaced scaling.
14318
14319 @item -1
14320 Select interlaced aware scaling depending on whether the source frames
14321 are flagged as interlaced or not.
14322 @end table
14323
14324 Default value is @samp{0}.
14325
14326 @item flags
14327 Set libswscale scaling flags. See
14328 @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
14329 complete list of values. If not explicitly specified the filter applies
14330 the default flags.
14331
14332
14333 @item param0, param1
14334 Set libswscale input parameters for scaling algorithms that need them. See
14335 @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
14336 complete documentation. If not explicitly specified the filter applies
14337 empty parameters.
14338
14339
14340
14341 @item size, s
14342 Set the video size. For the syntax of this option, check the
14343 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
14344
14345 @item in_color_matrix
14346 @item out_color_matrix
14347 Set in/output YCbCr color space type.
14348
14349 This allows the autodetected value to be overridden as well as allows forcing
14350 a specific value used for the output and encoder.
14351
14352 If not specified, the color space type depends on the pixel format.
14353
14354 Possible values:
14355
14356 @table @samp
14357 @item auto
14358 Choose automatically.
14359
14360 @item bt709
14361 Format conforming to International Telecommunication Union (ITU)
14362 Recommendation BT.709.
14363
14364 @item fcc
14365 Set color space conforming to the United States Federal Communications
14366 Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
14367
14368 @item bt601
14369 Set color space conforming to:
14370
14371 @itemize
14372 @item
14373 ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
14374
14375 @item
14376 ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
14377
14378 @item
14379 Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
14380
14381 @end itemize
14382
14383 @item smpte240m
14384 Set color space conforming to SMPTE ST 240:1999.
14385 @end table
14386
14387 @item in_range
14388 @item out_range
14389 Set in/output YCbCr sample range.
14390
14391 This allows the autodetected value to be overridden as well as allows forcing
14392 a specific value used for the output and encoder. If not specified, the
14393 range depends on the pixel format. Possible values:
14394
14395 @table @samp
14396 @item auto/unknown
14397 Choose automatically.
14398
14399 @item jpeg/full/pc
14400 Set full range (0-255 in case of 8-bit luma).
14401
14402 @item mpeg/limited/tv
14403 Set "MPEG" range (16-235 in case of 8-bit luma).
14404 @end table
14405
14406 @item force_original_aspect_ratio
14407 Enable decreasing or increasing output video width or height if necessary to
14408 keep the original aspect ratio. Possible values:
14409
14410 @table @samp
14411 @item disable
14412 Scale the video as specified and disable this feature.
14413
14414 @item decrease
14415 The output video dimensions will automatically be decreased if needed.
14416
14417 @item increase
14418 The output video dimensions will automatically be increased if needed.
14419
14420 @end table
14421
14422 One useful instance of this option is that when you know a specific device's
14423 maximum allowed resolution, you can use this to limit the output video to
14424 that, while retaining the aspect ratio. For example, device A allows
14425 1280x720 playback, and your video is 1920x800. Using this option (set it to
14426 decrease) and specifying 1280x720 to the command line makes the output
14427 1280x533.
14428
14429 Please note that this is a different thing than specifying -1 for @option{w}
14430 or @option{h}, you still need to specify the output resolution for this option
14431 to work.
14432
14433 @end table
14434
14435 The values of the @option{w} and @option{h} options are expressions
14436 containing the following constants:
14437
14438 @table @var
14439 @item in_w
14440 @item in_h
14441 The input width and height
14442
14443 @item iw
14444 @item ih
14445 These are the same as @var{in_w} and @var{in_h}.
14446
14447 @item out_w
14448 @item out_h
14449 The output (scaled) width and height
14450
14451 @item ow
14452 @item oh
14453 These are the same as @var{out_w} and @var{out_h}
14454
14455 @item a
14456 The same as @var{iw} / @var{ih}
14457
14458 @item sar
14459 input sample aspect ratio
14460
14461 @item dar
14462 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
14463
14464 @item hsub
14465 @item vsub
14466 horizontal and vertical input chroma subsample values. For example for the
14467 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14468
14469 @item ohsub
14470 @item ovsub
14471 horizontal and vertical output chroma subsample values. For example for the
14472 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14473 @end table
14474
14475 @subsection Examples
14476
14477 @itemize
14478 @item
14479 Scale the input video to a size of 200x100
14480 @example
14481 scale=w=200:h=100
14482 @end example
14483
14484 This is equivalent to:
14485 @example
14486 scale=200:100
14487 @end example
14488
14489 or:
14490 @example
14491 scale=200x100
14492 @end example
14493
14494 @item
14495 Specify a size abbreviation for the output size:
14496 @example
14497 scale=qcif
14498 @end example
14499
14500 which can also be written as:
14501 @example
14502 scale=size=qcif
14503 @end example
14504
14505 @item
14506 Scale the input to 2x:
14507 @example
14508 scale=w=2*iw:h=2*ih
14509 @end example
14510
14511 @item
14512 The above is the same as:
14513 @example
14514 scale=2*in_w:2*in_h
14515 @end example
14516
14517 @item
14518 Scale the input to 2x with forced interlaced scaling:
14519 @example
14520 scale=2*iw:2*ih:interl=1
14521 @end example
14522
14523 @item
14524 Scale the input to half size:
14525 @example
14526 scale=w=iw/2:h=ih/2
14527 @end example
14528
14529 @item
14530 Increase the width, and set the height to the same size:
14531 @example
14532 scale=3/2*iw:ow
14533 @end example
14534
14535 @item
14536 Seek Greek harmony:
14537 @example
14538 scale=iw:1/PHI*iw
14539 scale=ih*PHI:ih
14540 @end example
14541
14542 @item
14543 Increase the height, and set the width to 3/2 of the height:
14544 @example
14545 scale=w=3/2*oh:h=3/5*ih
14546 @end example
14547
14548 @item
14549 Increase the size, making the size a multiple of the chroma
14550 subsample values:
14551 @example
14552 scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
14553 @end example
14554
14555 @item
14556 Increase the width to a maximum of 500 pixels,
14557 keeping the same aspect ratio as the input:
14558 @example
14559 scale=w='min(500\, iw*3/2):h=-1'
14560 @end example
14561
14562 @item
14563 Make pixels square by combining scale and setsar:
14564 @example
14565 scale='trunc(ih*dar):ih',setsar=1/1
14566 @end example
14567
14568 @item
14569 Make pixels square by combining scale and setsar,
14570 making sure the resulting resolution is even (required by some codecs):
14571 @example
14572 scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
14573 @end example
14574 @end itemize
14575
14576 @subsection Commands
14577
14578 This filter supports the following commands:
14579 @table @option
14580 @item width, w
14581 @item height, h
14582 Set the output video dimension expression.
14583 The command accepts the same syntax of the corresponding option.
14584
14585 If the specified expression is not valid, it is kept at its current
14586 value.
14587 @end table
14588
14589 @section scale_npp
14590
14591 Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
14592 format conversion on CUDA video frames. Setting the output width and height
14593 works in the same way as for the @var{scale} filter.
14594
14595 The following additional options are accepted:
14596 @table @option
14597 @item format
14598 The pixel format of the output CUDA frames. If set to the string "same" (the
14599 default), the input format will be kept. Note that automatic format negotiation
14600 and conversion is not yet supported for hardware frames
14601
14602 @item interp_algo
14603 The interpolation algorithm used for resizing. One of the following:
14604 @table @option
14605 @item nn
14606 Nearest neighbour.
14607
14608 @item linear
14609 @item cubic
14610 @item cubic2p_bspline
14611 2-parameter cubic (B=1, C=0)
14612
14613 @item cubic2p_catmullrom
14614 2-parameter cubic (B=0, C=1/2)
14615
14616 @item cubic2p_b05c03
14617 2-parameter cubic (B=1/2, C=3/10)
14618
14619 @item super
14620 Supersampling
14621
14622 @item lanczos
14623 @end table
14624
14625 @end table
14626
14627 @section scale2ref
14628
14629 Scale (resize) the input video, based on a reference video.
14630
14631 See the scale filter for available options, scale2ref supports the same but
14632 uses the reference video instead of the main input as basis. scale2ref also
14633 supports the following additional constants for the @option{w} and
14634 @option{h} options:
14635
14636 @table @var
14637 @item main_w
14638 @item main_h
14639 The main input video's width and height
14640
14641 @item main_a
14642 The same as @var{main_w} / @var{main_h}
14643
14644 @item main_sar
14645 The main input video's sample aspect ratio
14646
14647 @item main_dar, mdar
14648 The main input video's display aspect ratio. Calculated from
14649 @code{(main_w / main_h) * main_sar}.
14650
14651 @item main_hsub
14652 @item main_vsub
14653 The main input video's horizontal and vertical chroma subsample values.
14654 For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
14655 is 1.
14656 @end table
14657
14658 @subsection Examples
14659
14660 @itemize
14661 @item
14662 Scale a subtitle stream (b) to match the main video (a) in size before overlaying
14663 @example
14664 'scale2ref[b][a];[a][b]overlay'
14665 @end example
14666 @end itemize
14667
14668 @anchor{selectivecolor}
14669 @section selectivecolor
14670
14671 Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
14672 as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
14673 by the "purity" of the color (that is, how saturated it already is).
14674
14675 This filter is similar to the Adobe Photoshop Selective Color tool.
14676
14677 The filter accepts the following options:
14678
14679 @table @option
14680 @item correction_method
14681 Select color correction method.
14682
14683 Available values are:
14684 @table @samp
14685 @item absolute
14686 Specified adjustments are applied "as-is" (added/subtracted to original pixel
14687 component value).
14688 @item relative
14689 Specified adjustments are relative to the original component value.
14690 @end table
14691 Default is @code{absolute}.
14692 @item reds
14693 Adjustments for red pixels (pixels where the red component is the maximum)
14694 @item yellows
14695 Adjustments for yellow pixels (pixels where the blue component is the minimum)
14696 @item greens
14697 Adjustments for green pixels (pixels where the green component is the maximum)
14698 @item cyans
14699 Adjustments for cyan pixels (pixels where the red component is the minimum)
14700 @item blues
14701 Adjustments for blue pixels (pixels where the blue component is the maximum)
14702 @item magentas
14703 Adjustments for magenta pixels (pixels where the green component is the minimum)
14704 @item whites
14705 Adjustments for white pixels (pixels where all components are greater than 128)
14706 @item neutrals
14707 Adjustments for all pixels except pure black and pure white
14708 @item blacks
14709 Adjustments for black pixels (pixels where all components are lesser than 128)
14710 @item psfile
14711 Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
14712 @end table
14713
14714 All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
14715 4 space separated floating point adjustment values in the [-1,1] range,
14716 respectively to adjust the amount of cyan, magenta, yellow and black for the
14717 pixels of its range.
14718
14719 @subsection Examples
14720
14721 @itemize
14722 @item
14723 Increase cyan by 50% and reduce yellow by 33% in every green areas, and
14724 increase magenta by 27% in blue areas:
14725 @example
14726 selectivecolor=greens=.5 0 -.33 0:blues=0 .27
14727 @end example
14728
14729 @item
14730 Use a Photoshop selective color preset:
14731 @example
14732 selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
14733 @end example
14734 @end itemize
14735
14736 @anchor{separatefields}
14737 @section separatefields
14738
14739 The @code{separatefields} takes a frame-based video input and splits
14740 each frame into its components fields, producing a new half height clip
14741 with twice the frame rate and twice the frame count.
14742
14743 This filter use field-dominance information in frame to decide which
14744 of each pair of fields to place first in the output.
14745 If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
14746
14747 @section setdar, setsar
14748
14749 The @code{setdar} filter sets the Display Aspect Ratio for the filter
14750 output video.
14751
14752 This is done by changing the specified Sample (aka Pixel) Aspect
14753 Ratio, according to the following equation:
14754 @example
14755 @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
14756 @end example
14757
14758 Keep in mind that the @code{setdar} filter does not modify the pixel
14759 dimensions of the video frame. Also, the display aspect ratio set by
14760 this filter may be changed by later filters in the filterchain,
14761 e.g. in case of scaling or if another "setdar" or a "setsar" filter is
14762 applied.
14763
14764 The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
14765 the filter output video.
14766
14767 Note that as a consequence of the application of this filter, the
14768 output display aspect ratio will change according to the equation
14769 above.
14770
14771 Keep in mind that the sample aspect ratio set by the @code{setsar}
14772 filter may be changed by later filters in the filterchain, e.g. if
14773 another "setsar" or a "setdar" filter is applied.
14774
14775 It accepts the following parameters:
14776
14777 @table @option
14778 @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
14779 Set the aspect ratio used by the filter.
14780
14781 The parameter can be a floating point number string, an expression, or
14782 a string of the form @var{num}:@var{den}, where @var{num} and
14783 @var{den} are the numerator and denominator of the aspect ratio. If
14784 the parameter is not specified, it is assumed the value "0".
14785 In case the form "@var{num}:@var{den}" is used, the @code{:} character
14786 should be escaped.
14787
14788 @item max
14789 Set the maximum integer value to use for expressing numerator and
14790 denominator when reducing the expressed aspect ratio to a rational.
14791 Default value is @code{100}.
14792
14793 @end table
14794
14795 The parameter @var{sar} is an expression containing
14796 the following constants:
14797
14798 @table @option
14799 @item E, PI, PHI
14800 These are approximated values for the mathematical constants e
14801 (Euler's number), pi (Greek pi), and phi (the golden ratio).
14802
14803 @item w, h
14804 The input width and height.
14805
14806 @item a
14807 These are the same as @var{w} / @var{h}.
14808
14809 @item sar
14810 The input sample aspect ratio.
14811
14812 @item dar
14813 The input display aspect ratio. It is the same as
14814 (@var{w} / @var{h}) * @var{sar}.
14815
14816 @item hsub, vsub
14817 Horizontal and vertical chroma subsample values. For example, for the
14818 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14819 @end table
14820
14821 @subsection Examples
14822
14823 @itemize
14824
14825 @item
14826 To change the display aspect ratio to 16:9, specify one of the following:
14827 @example
14828 setdar=dar=1.77777
14829 setdar=dar=16/9
14830 @end example
14831
14832 @item
14833 To change the sample aspect ratio to 10:11, specify:
14834 @example
14835 setsar=sar=10/11
14836 @end example
14837
14838 @item
14839 To set a display aspect ratio of 16:9, and specify a maximum integer value of
14840 1000 in the aspect ratio reduction, use the command:
14841 @example
14842 setdar=ratio=16/9:max=1000
14843 @end example
14844
14845 @end itemize
14846
14847 @anchor{setfield}
14848 @section setfield
14849
14850 Force field for the output video frame.
14851
14852 The @code{setfield} filter marks the interlace type field for the
14853 output frames. It does not change the input frame, but only sets the
14854 corresponding property, which affects how the frame is treated by
14855 following filters (e.g. @code{fieldorder} or @code{yadif}).
14856
14857 The filter accepts the following options:
14858
14859 @table @option
14860
14861 @item mode
14862 Available values are:
14863
14864 @table @samp
14865 @item auto
14866 Keep the same field property.
14867
14868 @item bff
14869 Mark the frame as bottom-field-first.
14870
14871 @item tff
14872 Mark the frame as top-field-first.
14873
14874 @item prog
14875 Mark the frame as progressive.
14876 @end table
14877 @end table
14878
14879 @section showinfo
14880
14881 Show a line containing various information for each input video frame.
14882 The input video is not modified.
14883
14884 The shown line contains a sequence of key/value pairs of the form
14885 @var{key}:@var{value}.
14886
14887 The following values are shown in the output:
14888
14889 @table @option
14890 @item n
14891 The (sequential) number of the input frame, starting from 0.
14892
14893 @item pts
14894 The Presentation TimeStamp of the input frame, expressed as a number of
14895 time base units. The time base unit depends on the filter input pad.
14896
14897 @item pts_time
14898 The Presentation TimeStamp of the input frame, expressed as a number of
14899 seconds.
14900
14901 @item pos
14902 The position of the frame in the input stream, or -1 if this information is
14903 unavailable and/or meaningless (for example in case of synthetic video).
14904
14905 @item fmt
14906 The pixel format name.
14907
14908 @item sar
14909 The sample aspect ratio of the input frame, expressed in the form
14910 @var{num}/@var{den}.
14911
14912 @item s
14913 The size of the input frame. For the syntax of this option, check the
14914 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
14915
14916 @item i
14917 The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
14918 for bottom field first).
14919
14920 @item iskey
14921 This is 1 if the frame is a key frame, 0 otherwise.
14922
14923 @item type
14924 The picture type of the input frame ("I" for an I-frame, "P" for a
14925 P-frame, "B" for a B-frame, or "?" for an unknown type).
14926 Also refer to the documentation of the @code{AVPictureType} enum and of
14927 the @code{av_get_picture_type_char} function defined in
14928 @file{libavutil/avutil.h}.
14929
14930 @item checksum
14931 The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
14932
14933 @item plane_checksum
14934 The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
14935 expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
14936 @end table
14937
14938 @section showpalette
14939
14940 Displays the 256 colors palette of each frame. This filter is only relevant for
14941 @var{pal8} pixel format frames.
14942
14943 It accepts the following option:
14944
14945 @table @option
14946 @item s
14947 Set the size of the box used to represent one palette color entry. Default is
14948 @code{30} (for a @code{30x30} pixel box).
14949 @end table
14950
14951 @section shuffleframes
14952
14953 Reorder and/or duplicate and/or drop video frames.
14954
14955 It accepts the following parameters:
14956
14957 @table @option
14958 @item mapping
14959 Set the destination indexes of input frames.
14960 This is space or '|' separated list of indexes that maps input frames to output
14961 frames. Number of indexes also sets maximal value that each index may have.
14962 '-1' index have special meaning and that is to drop frame.
14963 @end table
14964
14965 The first frame has the index 0. The default is to keep the input unchanged.
14966
14967 @subsection Examples
14968
14969 @itemize
14970 @item
14971 Swap second and third frame of every three frames of the input:
14972 @example
14973 ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
14974 @end example
14975
14976 @item
14977 Swap 10th and 1st frame of every ten frames of the input:
14978 @example
14979 ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
14980 @end example
14981 @end itemize
14982
14983 @section shuffleplanes
14984
14985 Reorder and/or duplicate video planes.
14986
14987 It accepts the following parameters:
14988
14989 @table @option
14990
14991 @item map0
14992 The index of the input plane to be used as the first output plane.
14993
14994 @item map1
14995 The index of the input plane to be used as the second output plane.
14996
14997 @item map2
14998 The index of the input plane to be used as the third output plane.
14999
15000 @item map3
15001 The index of the input plane to be used as the fourth output plane.
15002
15003 @end table
15004
15005 The first plane has the index 0. The default is to keep the input unchanged.
15006
15007 @subsection Examples
15008
15009 @itemize
15010 @item
15011 Swap the second and third planes of the input:
15012 @example
15013 ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
15014 @end example
15015 @end itemize
15016
15017 @anchor{signalstats}
15018 @section signalstats
15019 Evaluate various visual metrics that assist in determining issues associated
15020 with the digitization of analog video media.
15021
15022 By default the filter will log these metadata values:
15023
15024 @table @option
15025 @item YMIN
15026 Display the minimal Y value contained within the input frame. Expressed in
15027 range of [0-255].
15028
15029 @item YLOW
15030 Display the Y value at the 10% percentile within the input frame. Expressed in
15031 range of [0-255].
15032
15033 @item YAVG
15034 Display the average Y value within the input frame. Expressed in range of
15035 [0-255].
15036
15037 @item YHIGH
15038 Display the Y value at the 90% percentile within the input frame. Expressed in
15039 range of [0-255].
15040
15041 @item YMAX
15042 Display the maximum Y value contained within the input frame. Expressed in
15043 range of [0-255].
15044
15045 @item UMIN
15046 Display the minimal U value contained within the input frame. Expressed in
15047 range of [0-255].
15048
15049 @item ULOW
15050 Display the U value at the 10% percentile within the input frame. Expressed in
15051 range of [0-255].
15052
15053 @item UAVG
15054 Display the average U value within the input frame. Expressed in range of
15055 [0-255].
15056
15057 @item UHIGH
15058 Display the U value at the 90% percentile within the input frame. Expressed in
15059 range of [0-255].
15060
15061 @item UMAX
15062 Display the maximum U value contained within the input frame. Expressed in
15063 range of [0-255].
15064
15065 @item VMIN
15066 Display the minimal V value contained within the input frame. Expressed in
15067 range of [0-255].
15068
15069 @item VLOW
15070 Display the V value at the 10% percentile within the input frame. Expressed in
15071 range of [0-255].
15072
15073 @item VAVG
15074 Display the average V value within the input frame. Expressed in range of
15075 [0-255].
15076
15077 @item VHIGH
15078 Display the V value at the 90% percentile within the input frame. Expressed in
15079 range of [0-255].
15080
15081 @item VMAX
15082 Display the maximum V value contained within the input frame. Expressed in
15083 range of [0-255].
15084
15085 @item SATMIN
15086 Display the minimal saturation value contained within the input frame.
15087 Expressed in range of [0-~181.02].
15088
15089 @item SATLOW
15090 Display the saturation value at the 10% percentile within the input frame.
15091 Expressed in range of [0-~181.02].
15092
15093 @item SATAVG
15094 Display the average saturation value within the input frame. Expressed in range
15095 of [0-~181.02].
15096
15097 @item SATHIGH
15098 Display the saturation value at the 90% percentile within the input frame.
15099 Expressed in range of [0-~181.02].
15100
15101 @item SATMAX
15102 Display the maximum saturation value contained within the input frame.
15103 Expressed in range of [0-~181.02].
15104
15105 @item HUEMED
15106 Display the median value for hue within the input frame. Expressed in range of
15107 [0-360].
15108
15109 @item HUEAVG
15110 Display the average value for hue within the input frame. Expressed in range of
15111 [0-360].
15112
15113 @item YDIF
15114 Display the average of sample value difference between all values of the Y
15115 plane in the current frame and corresponding values of the previous input frame.
15116 Expressed in range of [0-255].
15117
15118 @item UDIF
15119 Display the average of sample value difference between all values of the U
15120 plane in the current frame and corresponding values of the previous input frame.
15121 Expressed in range of [0-255].
15122
15123 @item VDIF
15124 Display the average of sample value difference between all values of the V
15125 plane in the current frame and corresponding values of the previous input frame.
15126 Expressed in range of [0-255].
15127
15128 @item YBITDEPTH
15129 Display bit depth of Y plane in current frame.
15130 Expressed in range of [0-16].
15131
15132 @item UBITDEPTH
15133 Display bit depth of U plane in current frame.
15134 Expressed in range of [0-16].
15135
15136 @item VBITDEPTH
15137 Display bit depth of V plane in current frame.
15138 Expressed in range of [0-16].
15139 @end table
15140
15141 The filter accepts the following options:
15142
15143 @table @option
15144 @item stat
15145 @item out
15146
15147 @option{stat} specify an additional form of image analysis.
15148 @option{out} output video with the specified type of pixel highlighted.
15149
15150 Both options accept the following values:
15151
15152 @table @samp
15153 @item tout
15154 Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
15155 unlike the neighboring pixels of the same field. Examples of temporal outliers
15156 include the results of video dropouts, head clogs, or tape tracking issues.
15157
15158 @item vrep
15159 Identify @var{vertical line repetition}. Vertical line repetition includes
15160 similar rows of pixels within a frame. In born-digital video vertical line
15161 repetition is common, but this pattern is uncommon in video digitized from an
15162 analog source. When it occurs in video that results from the digitization of an
15163 analog source it can indicate concealment from a dropout compensator.
15164
15165 @item brng
15166 Identify pixels that fall outside of legal broadcast range.
15167 @end table
15168
15169 @item color, c
15170 Set the highlight color for the @option{out} option. The default color is
15171 yellow.
15172 @end table
15173
15174 @subsection Examples
15175
15176 @itemize
15177 @item
15178 Output data of various video metrics:
15179 @example
15180 ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
15181 @end example
15182
15183 @item
15184 Output specific data about the minimum and maximum values of the Y plane per frame:
15185 @example
15186 ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
15187 @end example
15188
15189 @item
15190 Playback video while highlighting pixels that are outside of broadcast range in red.
15191 @example
15192 ffplay example.mov -vf signalstats="out=brng:color=red"
15193 @end example
15194
15195 @item
15196 Playback video with signalstats metadata drawn over the frame.
15197 @example
15198 ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
15199 @end example
15200
15201 The contents of signalstat_drawtext.txt used in the command are:
15202 @example
15203 time %@{pts:hms@}
15204 Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
15205 U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
15206 V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
15207 saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
15208
15209 @end example
15210 @end itemize
15211
15212 @anchor{signature}
15213 @section signature
15214
15215 Calculates the MPEG-7 Video Signature. The filter can handle more than one
15216 input. In this case the matching between the inputs can be calculated additionally.
15217 The filter always passes through the first input. The signature of each stream can
15218 be written into a file.
15219
15220 It accepts the following options:
15221
15222 @table @option
15223 @item detectmode
15224 Enable or disable the matching process.
15225
15226 Available values are:
15227
15228 @table @samp
15229 @item off
15230 Disable the calculation of a matching (default).
15231 @item full
15232 Calculate the matching for the whole video and output whether the whole video
15233 matches or only parts.
15234 @item fast
15235 Calculate only until a matching is found or the video ends. Should be faster in
15236 some cases.
15237 @end table
15238
15239 @item nb_inputs
15240 Set the number of inputs. The option value must be a non negative integer.
15241 Default value is 1.
15242
15243 @item filename
15244 Set the path to which the output is written. If there is more than one input,
15245 the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
15246 integer), that will be replaced with the input number. If no filename is
15247 specified, no output will be written. This is the default.
15248
15249 @item format
15250 Choose the output format.
15251
15252 Available values are:
15253
15254 @table @samp
15255 @item binary
15256 Use the specified binary representation (default).
15257 @item xml
15258 Use the specified xml representation.
15259 @end table
15260
15261 @item th_d
15262 Set threshold to detect one word as similar. The option value must be an integer
15263 greater than zero. The default value is 9000.
15264
15265 @item th_dc
15266 Set threshold to detect all words as similar. The option value must be an integer
15267 greater than zero. The default value is 60000.
15268
15269 @item th_xh
15270 Set threshold to detect frames as similar. The option value must be an integer
15271 greater than zero. The default value is 116.
15272
15273 @item th_di
15274 Set the minimum length of a sequence in frames to recognize it as matching
15275 sequence. The option value must be a non negative integer value.
15276 The default value is 0.
15277
15278 @item th_it
15279 Set the minimum relation, that matching frames to all frames must have.
15280 The option value must be a double value between 0 and 1. The default value is 0.5.
15281 @end table
15282
15283 @subsection Examples
15284
15285 @itemize
15286 @item
15287 To calculate the signature of an input video and store it in signature.bin:
15288 @example
15289 ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
15290 @end example
15291
15292 @item
15293 To detect whether two videos match and store the signatures in XML format in
15294 signature0.xml and signature1.xml:
15295 @example
15296 ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
15297 @end example
15298
15299 @end itemize
15300
15301 @anchor{smartblur}
15302 @section smartblur
15303
15304 Blur the input video without impacting the outlines.
15305
15306 It accepts the following options:
15307
15308 @table @option
15309 @item luma_radius, lr
15310 Set the luma radius. The option value must be a float number in
15311 the range [0.1,5.0] that specifies the variance of the gaussian filter
15312 used to blur the image (slower if larger). Default value is 1.0.
15313
15314 @item luma_strength, ls
15315 Set the luma strength. The option value must be a float number
15316 in the range [-1.0,1.0] that configures the blurring. A value included
15317 in [0.0,1.0] will blur the image whereas a value included in
15318 [-1.0,0.0] will sharpen the image. Default value is 1.0.
15319
15320 @item luma_threshold, lt
15321 Set the luma threshold used as a coefficient to determine
15322 whether a pixel should be blurred or not. The option value must be an
15323 integer in the range [-30,30]. A value of 0 will filter all the image,
15324 a value included in [0,30] will filter flat areas and a value included
15325 in [-30,0] will filter edges. Default value is 0.
15326
15327 @item chroma_radius, cr
15328 Set the chroma radius. The option value must be a float number in
15329 the range [0.1,5.0] that specifies the variance of the gaussian filter
15330 used to blur the image (slower if larger). Default value is @option{luma_radius}.
15331
15332 @item chroma_strength, cs
15333 Set the chroma strength. The option value must be a float number
15334 in the range [-1.0,1.0] that configures the blurring. A value included
15335 in [0.0,1.0] will blur the image whereas a value included in
15336 [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
15337
15338 @item chroma_threshold, ct
15339 Set the chroma threshold used as a coefficient to determine
15340 whether a pixel should be blurred or not. The option value must be an
15341 integer in the range [-30,30]. A value of 0 will filter all the image,
15342 a value included in [0,30] will filter flat areas and a value included
15343 in [-30,0] will filter edges. Default value is @option{luma_threshold}.
15344 @end table
15345
15346 If a chroma option is not explicitly set, the corresponding luma value
15347 is set.
15348
15349 @section ssim
15350
15351 Obtain the SSIM (Structural SImilarity Metric) between two input videos.
15352
15353 This filter takes in input two input videos, the first input is
15354 considered the "main" source and is passed unchanged to the
15355 output. The second input is used as a "reference" video for computing
15356 the SSIM.
15357
15358 Both video inputs must have the same resolution and pixel format for
15359 this filter to work correctly. Also it assumes that both inputs
15360 have the same number of frames, which are compared one by one.
15361
15362 The filter stores the calculated SSIM of each frame.
15363
15364 The description of the accepted parameters follows.
15365
15366 @table @option
15367 @item stats_file, f
15368 If specified the filter will use the named file to save the SSIM of
15369 each individual frame. When filename equals "-" the data is sent to
15370 standard output.
15371 @end table
15372
15373 The file printed if @var{stats_file} is selected, contains a sequence of
15374 key/value pairs of the form @var{key}:@var{value} for each compared
15375 couple of frames.
15376
15377 A description of each shown parameter follows:
15378
15379 @table @option
15380 @item n
15381 sequential number of the input frame, starting from 1
15382
15383 @item Y, U, V, R, G, B
15384 SSIM of the compared frames for the component specified by the suffix.
15385
15386 @item All
15387 SSIM of the compared frames for the whole frame.
15388
15389 @item dB
15390 Same as above but in dB representation.
15391 @end table
15392
15393 This filter also supports the @ref{framesync} options.
15394
15395 For example:
15396 @example
15397 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
15398 [main][ref] ssim="stats_file=stats.log" [out]
15399 @end example
15400
15401 On this example the input file being processed is compared with the
15402 reference file @file{ref_movie.mpg}. The SSIM of each individual frame
15403 is stored in @file{stats.log}.
15404
15405 Another example with both psnr and ssim at same time:
15406 @example
15407 ffmpeg -i main.mpg -i ref.mpg -lavfi  "ssim;[0:v][1:v]psnr" -f null -
15408 @end example
15409
15410 @section stereo3d
15411
15412 Convert between different stereoscopic image formats.
15413
15414 The filters accept the following options:
15415
15416 @table @option
15417 @item in
15418 Set stereoscopic image format of input.
15419
15420 Available values for input image formats are:
15421 @table @samp
15422 @item sbsl
15423 side by side parallel (left eye left, right eye right)
15424
15425 @item sbsr
15426 side by side crosseye (right eye left, left eye right)
15427
15428 @item sbs2l
15429 side by side parallel with half width resolution
15430 (left eye left, right eye right)
15431
15432 @item sbs2r
15433 side by side crosseye with half width resolution
15434 (right eye left, left eye right)
15435
15436 @item abl
15437 above-below (left eye above, right eye below)
15438
15439 @item abr
15440 above-below (right eye above, left eye below)
15441
15442 @item ab2l
15443 above-below with half height resolution
15444 (left eye above, right eye below)
15445
15446 @item ab2r
15447 above-below with half height resolution
15448 (right eye above, left eye below)
15449
15450 @item al
15451 alternating frames (left eye first, right eye second)
15452
15453 @item ar
15454 alternating frames (right eye first, left eye second)
15455
15456 @item irl
15457 interleaved rows (left eye has top row, right eye starts on next row)
15458
15459 @item irr
15460 interleaved rows (right eye has top row, left eye starts on next row)
15461
15462 @item icl
15463 interleaved columns, left eye first
15464
15465 @item icr
15466 interleaved columns, right eye first
15467
15468 Default value is @samp{sbsl}.
15469 @end table
15470
15471 @item out
15472 Set stereoscopic image format of output.
15473
15474 @table @samp
15475 @item sbsl
15476 side by side parallel (left eye left, right eye right)
15477
15478 @item sbsr
15479 side by side crosseye (right eye left, left eye right)
15480
15481 @item sbs2l
15482 side by side parallel with half width resolution
15483 (left eye left, right eye right)
15484
15485 @item sbs2r
15486 side by side crosseye with half width resolution
15487 (right eye left, left eye right)
15488
15489 @item abl
15490 above-below (left eye above, right eye below)
15491
15492 @item abr
15493 above-below (right eye above, left eye below)
15494
15495 @item ab2l
15496 above-below with half height resolution
15497 (left eye above, right eye below)
15498
15499 @item ab2r
15500 above-below with half height resolution
15501 (right eye above, left eye below)
15502
15503 @item al
15504 alternating frames (left eye first, right eye second)
15505
15506 @item ar
15507 alternating frames (right eye first, left eye second)
15508
15509 @item irl
15510 interleaved rows (left eye has top row, right eye starts on next row)
15511
15512 @item irr
15513 interleaved rows (right eye has top row, left eye starts on next row)
15514
15515 @item arbg
15516 anaglyph red/blue gray
15517 (red filter on left eye, blue filter on right eye)
15518
15519 @item argg
15520 anaglyph red/green gray
15521 (red filter on left eye, green filter on right eye)
15522
15523 @item arcg
15524 anaglyph red/cyan gray
15525 (red filter on left eye, cyan filter on right eye)
15526
15527 @item arch
15528 anaglyph red/cyan half colored
15529 (red filter on left eye, cyan filter on right eye)
15530
15531 @item arcc
15532 anaglyph red/cyan color
15533 (red filter on left eye, cyan filter on right eye)
15534
15535 @item arcd
15536 anaglyph red/cyan color optimized with the least squares projection of dubois
15537 (red filter on left eye, cyan filter on right eye)
15538
15539 @item agmg
15540 anaglyph green/magenta gray
15541 (green filter on left eye, magenta filter on right eye)
15542
15543 @item agmh
15544 anaglyph green/magenta half colored
15545 (green filter on left eye, magenta filter on right eye)
15546
15547 @item agmc
15548 anaglyph green/magenta colored
15549 (green filter on left eye, magenta filter on right eye)
15550
15551 @item agmd
15552 anaglyph green/magenta color optimized with the least squares projection of dubois
15553 (green filter on left eye, magenta filter on right eye)
15554
15555 @item aybg
15556 anaglyph yellow/blue gray
15557 (yellow filter on left eye, blue filter on right eye)
15558
15559 @item aybh
15560 anaglyph yellow/blue half colored
15561 (yellow filter on left eye, blue filter on right eye)
15562
15563 @item aybc
15564 anaglyph yellow/blue colored
15565 (yellow filter on left eye, blue filter on right eye)
15566
15567 @item aybd
15568 anaglyph yellow/blue color optimized with the least squares projection of dubois
15569 (yellow filter on left eye, blue filter on right eye)
15570
15571 @item ml
15572 mono output (left eye only)
15573
15574 @item mr
15575 mono output (right eye only)
15576
15577 @item chl
15578 checkerboard, left eye first
15579
15580 @item chr
15581 checkerboard, right eye first
15582
15583 @item icl
15584 interleaved columns, left eye first
15585
15586 @item icr
15587 interleaved columns, right eye first
15588
15589 @item hdmi
15590 HDMI frame pack
15591 @end table
15592
15593 Default value is @samp{arcd}.
15594 @end table
15595
15596 @subsection Examples
15597
15598 @itemize
15599 @item
15600 Convert input video from side by side parallel to anaglyph yellow/blue dubois:
15601 @example
15602 stereo3d=sbsl:aybd
15603 @end example
15604
15605 @item
15606 Convert input video from above below (left eye above, right eye below) to side by side crosseye.
15607 @example
15608 stereo3d=abl:sbsr
15609 @end example
15610 @end itemize
15611
15612 @section streamselect, astreamselect
15613 Select video or audio streams.
15614
15615 The filter accepts the following options:
15616
15617 @table @option
15618 @item inputs
15619 Set number of inputs. Default is 2.
15620
15621 @item map
15622 Set input indexes to remap to outputs.
15623 @end table
15624
15625 @subsection Commands
15626
15627 The @code{streamselect} and @code{astreamselect} filter supports the following
15628 commands:
15629
15630 @table @option
15631 @item map
15632 Set input indexes to remap to outputs.
15633 @end table
15634
15635 @subsection Examples
15636
15637 @itemize
15638 @item
15639 Select first 5 seconds 1st stream and rest of time 2nd stream:
15640 @example
15641 sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
15642 @end example
15643
15644 @item
15645 Same as above, but for audio:
15646 @example
15647 asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
15648 @end example
15649 @end itemize
15650
15651 @section sobel
15652 Apply sobel operator to input video stream.
15653
15654 The filter accepts the following option:
15655
15656 @table @option
15657 @item planes
15658 Set which planes will be processed, unprocessed planes will be copied.
15659 By default value 0xf, all planes will be processed.
15660
15661 @item scale
15662 Set value which will be multiplied with filtered result.
15663
15664 @item delta
15665 Set value which will be added to filtered result.
15666 @end table
15667
15668 @anchor{spp}
15669 @section spp
15670
15671 Apply a simple postprocessing filter that compresses and decompresses the image
15672 at several (or - in the case of @option{quality} level @code{6} - all) shifts
15673 and average the results.
15674
15675 The filter accepts the following options:
15676
15677 @table @option
15678 @item quality
15679 Set quality. This option defines the number of levels for averaging. It accepts
15680 an integer in the range 0-6. If set to @code{0}, the filter will have no
15681 effect. A value of @code{6} means the higher quality. For each increment of
15682 that value the speed drops by a factor of approximately 2.  Default value is
15683 @code{3}.
15684
15685 @item qp
15686 Force a constant quantization parameter. If not set, the filter will use the QP
15687 from the video stream (if available).
15688
15689 @item mode
15690 Set thresholding mode. Available modes are:
15691
15692 @table @samp
15693 @item hard
15694 Set hard thresholding (default).
15695 @item soft
15696 Set soft thresholding (better de-ringing effect, but likely blurrier).
15697 @end table
15698
15699 @item use_bframe_qp
15700 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
15701 option may cause flicker since the B-Frames have often larger QP. Default is
15702 @code{0} (not enabled).
15703 @end table
15704
15705 @section sr
15706
15707 Scale the input by applying one of the super-resolution methods based on
15708 convolutional neural networks. Supported models:
15709
15710 @itemize
15711 @item
15712 Super-Resolution Convolutional Neural Network model (SRCNN).
15713 See @url{https://arxiv.org/abs/1501.00092}.
15714
15715 @item
15716 Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
15717 See @url{https://arxiv.org/abs/1609.05158}.
15718 @end itemize
15719
15720 Training scripts as well as scripts for model generation are provided in
15721 the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
15722
15723 The filter accepts the following options:
15724
15725 @table @option
15726 @item dnn_backend
15727 Specify which DNN backend to use for model loading and execution. This option accepts
15728 the following values:
15729
15730 @table @samp
15731 @item native
15732 Native implementation of DNN loading and execution.
15733
15734 @item tensorflow
15735 TensorFlow backend. To enable this backend you
15736 need to install the TensorFlow for C library (see
15737 @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
15738 @code{--enable-libtensorflow}
15739 @end table
15740
15741 Default value is @samp{native}.
15742
15743 @item model
15744 Set path to model file specifying network architecture and its parameters.
15745 Note that different backends use different file formats. TensorFlow backend
15746 can load files for both formats, while native backend can load files for only
15747 its format.
15748
15749 @item scale_factor
15750 Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
15751 Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
15752 input upscaled using bicubic upscaling with proper scale factor.
15753 @end table
15754
15755 @anchor{subtitles}
15756 @section subtitles
15757
15758 Draw subtitles on top of input video using the libass library.
15759
15760 To enable compilation of this filter you need to configure FFmpeg with
15761 @code{--enable-libass}. This filter also requires a build with libavcodec and
15762 libavformat to convert the passed subtitles file to ASS (Advanced Substation
15763 Alpha) subtitles format.
15764
15765 The filter accepts the following options:
15766
15767 @table @option
15768 @item filename, f
15769 Set the filename of the subtitle file to read. It must be specified.
15770
15771 @item original_size
15772 Specify the size of the original video, the video for which the ASS file
15773 was composed. For the syntax of this option, check the
15774 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15775 Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
15776 correctly scale the fonts if the aspect ratio has been changed.
15777
15778 @item fontsdir
15779 Set a directory path containing fonts that can be used by the filter.
15780 These fonts will be used in addition to whatever the font provider uses.
15781
15782 @item alpha
15783 Process alpha channel, by default alpha channel is untouched.
15784
15785 @item charenc
15786 Set subtitles input character encoding. @code{subtitles} filter only. Only
15787 useful if not UTF-8.
15788
15789 @item stream_index, si
15790 Set subtitles stream index. @code{subtitles} filter only.
15791
15792 @item force_style
15793 Override default style or script info parameters of the subtitles. It accepts a
15794 string containing ASS style format @code{KEY=VALUE} couples separated by ",".
15795 @end table
15796
15797 If the first key is not specified, it is assumed that the first value
15798 specifies the @option{filename}.
15799
15800 For example, to render the file @file{sub.srt} on top of the input
15801 video, use the command:
15802 @example
15803 subtitles=sub.srt
15804 @end example
15805
15806 which is equivalent to:
15807 @example
15808 subtitles=filename=sub.srt
15809 @end example
15810
15811 To render the default subtitles stream from file @file{video.mkv}, use:
15812 @example
15813 subtitles=video.mkv
15814 @end example
15815
15816 To render the second subtitles stream from that file, use:
15817 @example
15818 subtitles=video.mkv:si=1
15819 @end example
15820
15821 To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
15822 @code{DejaVu Serif}, use:
15823 @example
15824 subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
15825 @end example
15826
15827 @section super2xsai
15828
15829 Scale the input by 2x and smooth using the Super2xSaI (Scale and
15830 Interpolate) pixel art scaling algorithm.
15831
15832 Useful for enlarging pixel art images without reducing sharpness.
15833
15834 @section swaprect
15835
15836 Swap two rectangular objects in video.
15837
15838 This filter accepts the following options:
15839
15840 @table @option
15841 @item w
15842 Set object width.
15843
15844 @item h
15845 Set object height.
15846
15847 @item x1
15848 Set 1st rect x coordinate.
15849
15850 @item y1
15851 Set 1st rect y coordinate.
15852
15853 @item x2
15854 Set 2nd rect x coordinate.
15855
15856 @item y2
15857 Set 2nd rect y coordinate.
15858
15859 All expressions are evaluated once for each frame.
15860 @end table
15861
15862 The all options are expressions containing the following constants:
15863
15864 @table @option
15865 @item w
15866 @item h
15867 The input width and height.
15868
15869 @item a
15870 same as @var{w} / @var{h}
15871
15872 @item sar
15873 input sample aspect ratio
15874
15875 @item dar
15876 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
15877
15878 @item n
15879 The number of the input frame, starting from 0.
15880
15881 @item t
15882 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
15883
15884 @item pos
15885 the position in the file of the input frame, NAN if unknown
15886 @end table
15887
15888 @section swapuv
15889 Swap U & V plane.
15890
15891 @section telecine
15892
15893 Apply telecine process to the video.
15894
15895 This filter accepts the following options:
15896
15897 @table @option
15898 @item first_field
15899 @table @samp
15900 @item top, t
15901 top field first
15902 @item bottom, b
15903 bottom field first
15904 The default value is @code{top}.
15905 @end table
15906
15907 @item pattern
15908 A string of numbers representing the pulldown pattern you wish to apply.
15909 The default value is @code{23}.
15910 @end table
15911
15912 @example
15913 Some typical patterns:
15914
15915 NTSC output (30i):
15916 27.5p: 32222
15917 24p: 23 (classic)
15918 24p: 2332 (preferred)
15919 20p: 33
15920 18p: 334
15921 16p: 3444
15922
15923 PAL output (25i):
15924 27.5p: 12222
15925 24p: 222222222223 ("Euro pulldown")
15926 16.67p: 33
15927 16p: 33333334
15928 @end example
15929
15930 @section threshold
15931
15932 Apply threshold effect to video stream.
15933
15934 This filter needs four video streams to perform thresholding.
15935 First stream is stream we are filtering.
15936 Second stream is holding threshold values, third stream is holding min values,
15937 and last, fourth stream is holding max values.
15938
15939 The filter accepts the following option:
15940
15941 @table @option
15942 @item planes
15943 Set which planes will be processed, unprocessed planes will be copied.
15944 By default value 0xf, all planes will be processed.
15945 @end table
15946
15947 For example if first stream pixel's component value is less then threshold value
15948 of pixel component from 2nd threshold stream, third stream value will picked,
15949 otherwise fourth stream pixel component value will be picked.
15950
15951 Using color source filter one can perform various types of thresholding:
15952
15953 @subsection Examples
15954
15955 @itemize
15956 @item
15957 Binary threshold, using gray color as threshold:
15958 @example
15959 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
15960 @end example
15961
15962 @item
15963 Inverted binary threshold, using gray color as threshold:
15964 @example
15965 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
15966 @end example
15967
15968 @item
15969 Truncate binary threshold, using gray color as threshold:
15970 @example
15971 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
15972 @end example
15973
15974 @item
15975 Threshold to zero, using gray color as threshold:
15976 @example
15977 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
15978 @end example
15979
15980 @item
15981 Inverted threshold to zero, using gray color as threshold:
15982 @example
15983 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
15984 @end example
15985 @end itemize
15986
15987 @section thumbnail
15988 Select the most representative frame in a given sequence of consecutive frames.
15989
15990 The filter accepts the following options:
15991
15992 @table @option
15993 @item n
15994 Set the frames batch size to analyze; in a set of @var{n} frames, the filter
15995 will pick one of them, and then handle the next batch of @var{n} frames until
15996 the end. Default is @code{100}.
15997 @end table
15998
15999 Since the filter keeps track of the whole frames sequence, a bigger @var{n}
16000 value will result in a higher memory usage, so a high value is not recommended.
16001
16002 @subsection Examples
16003
16004 @itemize
16005 @item
16006 Extract one picture each 50 frames:
16007 @example
16008 thumbnail=50
16009 @end example
16010
16011 @item
16012 Complete example of a thumbnail creation with @command{ffmpeg}:
16013 @example
16014 ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
16015 @end example
16016 @end itemize
16017
16018 @section tile
16019
16020 Tile several successive frames together.
16021
16022 The filter accepts the following options:
16023
16024 @table @option
16025
16026 @item layout
16027 Set the grid size (i.e. the number of lines and columns). For the syntax of
16028 this option, check the
16029 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16030
16031 @item nb_frames
16032 Set the maximum number of frames to render in the given area. It must be less
16033 than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
16034 the area will be used.
16035
16036 @item margin
16037 Set the outer border margin in pixels.
16038
16039 @item padding
16040 Set the inner border thickness (i.e. the number of pixels between frames). For
16041 more advanced padding options (such as having different values for the edges),
16042 refer to the pad video filter.
16043
16044 @item color
16045 Specify the color of the unused area. For the syntax of this option, check the
16046 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
16047 The default value of @var{color} is "black".
16048
16049 @item overlap
16050 Set the number of frames to overlap when tiling several successive frames together.
16051 The value must be between @code{0} and @var{nb_frames - 1}.
16052
16053 @item init_padding
16054 Set the number of frames to initially be empty before displaying first output frame.
16055 This controls how soon will one get first output frame.
16056 The value must be between @code{0} and @var{nb_frames - 1}.
16057 @end table
16058
16059 @subsection Examples
16060
16061 @itemize
16062 @item
16063 Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
16064 @example
16065 ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
16066 @end example
16067 The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
16068 duplicating each output frame to accommodate the originally detected frame
16069 rate.
16070
16071 @item
16072 Display @code{5} pictures in an area of @code{3x2} frames,
16073 with @code{7} pixels between them, and @code{2} pixels of initial margin, using
16074 mixed flat and named options:
16075 @example
16076 tile=3x2:nb_frames=5:padding=7:margin=2
16077 @end example
16078 @end itemize
16079
16080 @section tinterlace
16081
16082 Perform various types of temporal field interlacing.
16083
16084 Frames are counted starting from 1, so the first input frame is
16085 considered odd.
16086
16087 The filter accepts the following options:
16088
16089 @table @option
16090
16091 @item mode
16092 Specify the mode of the interlacing. This option can also be specified
16093 as a value alone. See below for a list of values for this option.
16094
16095 Available values are:
16096
16097 @table @samp
16098 @item merge, 0
16099 Move odd frames into the upper field, even into the lower field,
16100 generating a double height frame at half frame rate.
16101 @example
16102  ------> time
16103 Input:
16104 Frame 1         Frame 2         Frame 3         Frame 4
16105
16106 11111           22222           33333           44444
16107 11111           22222           33333           44444
16108 11111           22222           33333           44444
16109 11111           22222           33333           44444
16110
16111 Output:
16112 11111                           33333
16113 22222                           44444
16114 11111                           33333
16115 22222                           44444
16116 11111                           33333
16117 22222                           44444
16118 11111                           33333
16119 22222                           44444
16120 @end example
16121
16122 @item drop_even, 1
16123 Only output odd frames, even frames are dropped, generating a frame with
16124 unchanged height at half frame rate.
16125
16126 @example
16127  ------> time
16128 Input:
16129 Frame 1         Frame 2         Frame 3         Frame 4
16130
16131 11111           22222           33333           44444
16132 11111           22222           33333           44444
16133 11111           22222           33333           44444
16134 11111           22222           33333           44444
16135
16136 Output:
16137 11111                           33333
16138 11111                           33333
16139 11111                           33333
16140 11111                           33333
16141 @end example
16142
16143 @item drop_odd, 2
16144 Only output even frames, odd frames are dropped, generating a frame with
16145 unchanged height at half frame rate.
16146
16147 @example
16148  ------> time
16149 Input:
16150 Frame 1         Frame 2         Frame 3         Frame 4
16151
16152 11111           22222           33333           44444
16153 11111           22222           33333           44444
16154 11111           22222           33333           44444
16155 11111           22222           33333           44444
16156
16157 Output:
16158                 22222                           44444
16159                 22222                           44444
16160                 22222                           44444
16161                 22222                           44444
16162 @end example
16163
16164 @item pad, 3
16165 Expand each frame to full height, but pad alternate lines with black,
16166 generating a frame with double height at the same input frame rate.
16167
16168 @example
16169  ------> time
16170 Input:
16171 Frame 1         Frame 2         Frame 3         Frame 4
16172
16173 11111           22222           33333           44444
16174 11111           22222           33333           44444
16175 11111           22222           33333           44444
16176 11111           22222           33333           44444
16177
16178 Output:
16179 11111           .....           33333           .....
16180 .....           22222           .....           44444
16181 11111           .....           33333           .....
16182 .....           22222           .....           44444
16183 11111           .....           33333           .....
16184 .....           22222           .....           44444
16185 11111           .....           33333           .....
16186 .....           22222           .....           44444
16187 @end example
16188
16189
16190 @item interleave_top, 4
16191 Interleave the upper field from odd frames with the lower field from
16192 even frames, generating a frame with unchanged height at half frame rate.
16193
16194 @example
16195  ------> time
16196 Input:
16197 Frame 1         Frame 2         Frame 3         Frame 4
16198
16199 11111<-         22222           33333<-         44444
16200 11111           22222<-         33333           44444<-
16201 11111<-         22222           33333<-         44444
16202 11111           22222<-         33333           44444<-
16203
16204 Output:
16205 11111                           33333
16206 22222                           44444
16207 11111                           33333
16208 22222                           44444
16209 @end example
16210
16211
16212 @item interleave_bottom, 5
16213 Interleave the lower field from odd frames with the upper field from
16214 even frames, generating a frame with unchanged height at half frame rate.
16215
16216 @example
16217  ------> time
16218 Input:
16219 Frame 1         Frame 2         Frame 3         Frame 4
16220
16221 11111           22222<-         33333           44444<-
16222 11111<-         22222           33333<-         44444
16223 11111           22222<-         33333           44444<-
16224 11111<-         22222           33333<-         44444
16225
16226 Output:
16227 22222                           44444
16228 11111                           33333
16229 22222                           44444
16230 11111                           33333
16231 @end example
16232
16233
16234 @item interlacex2, 6
16235 Double frame rate with unchanged height. Frames are inserted each
16236 containing the second temporal field from the previous input frame and
16237 the first temporal field from the next input frame. This mode relies on
16238 the top_field_first flag. Useful for interlaced video displays with no
16239 field synchronisation.
16240
16241 @example
16242  ------> time
16243 Input:
16244 Frame 1         Frame 2         Frame 3         Frame 4
16245
16246 11111           22222           33333           44444
16247  11111           22222           33333           44444
16248 11111           22222           33333           44444
16249  11111           22222           33333           44444
16250
16251 Output:
16252 11111   22222   22222   33333   33333   44444   44444
16253  11111   11111   22222   22222   33333   33333   44444
16254 11111   22222   22222   33333   33333   44444   44444
16255  11111   11111   22222   22222   33333   33333   44444
16256 @end example
16257
16258
16259 @item mergex2, 7
16260 Move odd frames into the upper field, even into the lower field,
16261 generating a double height frame at same frame rate.
16262
16263 @example
16264  ------> time
16265 Input:
16266 Frame 1         Frame 2         Frame 3         Frame 4
16267
16268 11111           22222           33333           44444
16269 11111           22222           33333           44444
16270 11111           22222           33333           44444
16271 11111           22222           33333           44444
16272
16273 Output:
16274 11111           33333           33333           55555
16275 22222           22222           44444           44444
16276 11111           33333           33333           55555
16277 22222           22222           44444           44444
16278 11111           33333           33333           55555
16279 22222           22222           44444           44444
16280 11111           33333           33333           55555
16281 22222           22222           44444           44444
16282 @end example
16283
16284 @end table
16285
16286 Numeric values are deprecated but are accepted for backward
16287 compatibility reasons.
16288
16289 Default mode is @code{merge}.
16290
16291 @item flags
16292 Specify flags influencing the filter process.
16293
16294 Available value for @var{flags} is:
16295
16296 @table @option
16297 @item low_pass_filter, vlfp
16298 Enable linear vertical low-pass filtering in the filter.
16299 Vertical low-pass filtering is required when creating an interlaced
16300 destination from a progressive source which contains high-frequency
16301 vertical detail. Filtering will reduce interlace 'twitter' and Moire
16302 patterning.
16303
16304 @item complex_filter, cvlfp
16305 Enable complex vertical low-pass filtering.
16306 This will slightly less reduce interlace 'twitter' and Moire
16307 patterning but better retain detail and subjective sharpness impression.
16308
16309 @end table
16310
16311 Vertical low-pass filtering can only be enabled for @option{mode}
16312 @var{interleave_top} and @var{interleave_bottom}.
16313
16314 @end table
16315
16316 @section tmix
16317
16318 Mix successive video frames.
16319
16320 A description of the accepted options follows.
16321
16322 @table @option
16323 @item frames
16324 The number of successive frames to mix. If unspecified, it defaults to 3.
16325
16326 @item weights
16327 Specify weight of each input video frame.
16328 Each weight is separated by space. If number of weights is smaller than
16329 number of @var{frames} last specified weight will be used for all remaining
16330 unset weights.
16331
16332 @item scale
16333 Specify scale, if it is set it will be multiplied with sum
16334 of each weight multiplied with pixel values to give final destination
16335 pixel value. By default @var{scale} is auto scaled to sum of weights.
16336 @end table
16337
16338 @subsection Examples
16339
16340 @itemize
16341 @item
16342 Average 7 successive frames:
16343 @example
16344 tmix=frames=7:weights="1 1 1 1 1 1 1"
16345 @end example
16346
16347 @item
16348 Apply simple temporal convolution:
16349 @example
16350 tmix=frames=3:weights="-1 3 -1"
16351 @end example
16352
16353 @item
16354 Similar as above but only showing temporal differences:
16355 @example
16356 tmix=frames=3:weights="-1 2 -1":scale=1
16357 @end example
16358 @end itemize
16359
16360 @section tonemap
16361 Tone map colors from different dynamic ranges.
16362
16363 This filter expects data in single precision floating point, as it needs to
16364 operate on (and can output) out-of-range values. Another filter, such as
16365 @ref{zscale}, is needed to convert the resulting frame to a usable format.
16366
16367 The tonemapping algorithms implemented only work on linear light, so input
16368 data should be linearized beforehand (and possibly correctly tagged).
16369
16370 @example
16371 ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
16372 @end example
16373
16374 @subsection Options
16375 The filter accepts the following options.
16376
16377 @table @option
16378 @item tonemap
16379 Set the tone map algorithm to use.
16380
16381 Possible values are:
16382 @table @var
16383 @item none
16384 Do not apply any tone map, only desaturate overbright pixels.
16385
16386 @item clip
16387 Hard-clip any out-of-range values. Use it for perfect color accuracy for
16388 in-range values, while distorting out-of-range values.
16389
16390 @item linear
16391 Stretch the entire reference gamut to a linear multiple of the display.
16392
16393 @item gamma
16394 Fit a logarithmic transfer between the tone curves.
16395
16396 @item reinhard
16397 Preserve overall image brightness with a simple curve, using nonlinear
16398 contrast, which results in flattening details and degrading color accuracy.
16399
16400 @item hable
16401 Preserve both dark and bright details better than @var{reinhard}, at the cost
16402 of slightly darkening everything. Use it when detail preservation is more
16403 important than color and brightness accuracy.
16404
16405 @item mobius
16406 Smoothly map out-of-range values, while retaining contrast and colors for
16407 in-range material as much as possible. Use it when color accuracy is more
16408 important than detail preservation.
16409 @end table
16410
16411 Default is none.
16412
16413 @item param
16414 Tune the tone mapping algorithm.
16415
16416 This affects the following algorithms:
16417 @table @var
16418 @item none
16419 Ignored.
16420
16421 @item linear
16422 Specifies the scale factor to use while stretching.
16423 Default to 1.0.
16424
16425 @item gamma
16426 Specifies the exponent of the function.
16427 Default to 1.8.
16428
16429 @item clip
16430 Specify an extra linear coefficient to multiply into the signal before clipping.
16431 Default to 1.0.
16432
16433 @item reinhard
16434 Specify the local contrast coefficient at the display peak.
16435 Default to 0.5, which means that in-gamut values will be about half as bright
16436 as when clipping.
16437
16438 @item hable
16439 Ignored.
16440
16441 @item mobius
16442 Specify the transition point from linear to mobius transform. Every value
16443 below this point is guaranteed to be mapped 1:1. The higher the value, the
16444 more accurate the result will be, at the cost of losing bright details.
16445 Default to 0.3, which due to the steep initial slope still preserves in-range
16446 colors fairly accurately.
16447 @end table
16448
16449 @item desat
16450 Apply desaturation for highlights that exceed this level of brightness. The
16451 higher the parameter, the more color information will be preserved. This
16452 setting helps prevent unnaturally blown-out colors for super-highlights, by
16453 (smoothly) turning into white instead. This makes images feel more natural,
16454 at the cost of reducing information about out-of-range colors.
16455
16456 The default of 2.0 is somewhat conservative and will mostly just apply to
16457 skies or directly sunlit surfaces. A setting of 0.0 disables this option.
16458
16459 This option works only if the input frame has a supported color tag.
16460
16461 @item peak
16462 Override signal/nominal/reference peak with this value. Useful when the
16463 embedded peak information in display metadata is not reliable or when tone
16464 mapping from a lower range to a higher range.
16465 @end table
16466
16467 @anchor{transpose}
16468 @section transpose
16469
16470 Transpose rows with columns in the input video and optionally flip it.
16471
16472 It accepts the following parameters:
16473
16474 @table @option
16475
16476 @item dir
16477 Specify the transposition direction.
16478
16479 Can assume the following values:
16480 @table @samp
16481 @item 0, 4, cclock_flip
16482 Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
16483 @example
16484 L.R     L.l
16485 . . ->  . .
16486 l.r     R.r
16487 @end example
16488
16489 @item 1, 5, clock
16490 Rotate by 90 degrees clockwise, that is:
16491 @example
16492 L.R     l.L
16493 . . ->  . .
16494 l.r     r.R
16495 @end example
16496
16497 @item 2, 6, cclock
16498 Rotate by 90 degrees counterclockwise, that is:
16499 @example
16500 L.R     R.r
16501 . . ->  . .
16502 l.r     L.l
16503 @end example
16504
16505 @item 3, 7, clock_flip
16506 Rotate by 90 degrees clockwise and vertically flip, that is:
16507 @example
16508 L.R     r.R
16509 . . ->  . .
16510 l.r     l.L
16511 @end example
16512 @end table
16513
16514 For values between 4-7, the transposition is only done if the input
16515 video geometry is portrait and not landscape. These values are
16516 deprecated, the @code{passthrough} option should be used instead.
16517
16518 Numerical values are deprecated, and should be dropped in favor of
16519 symbolic constants.
16520
16521 @item passthrough
16522 Do not apply the transposition if the input geometry matches the one
16523 specified by the specified value. It accepts the following values:
16524 @table @samp
16525 @item none
16526 Always apply transposition.
16527 @item portrait
16528 Preserve portrait geometry (when @var{height} >= @var{width}).
16529 @item landscape
16530 Preserve landscape geometry (when @var{width} >= @var{height}).
16531 @end table
16532
16533 Default value is @code{none}.
16534 @end table
16535
16536 For example to rotate by 90 degrees clockwise and preserve portrait
16537 layout:
16538 @example
16539 transpose=dir=1:passthrough=portrait
16540 @end example
16541
16542 The command above can also be specified as:
16543 @example
16544 transpose=1:portrait
16545 @end example
16546
16547 @section transpose_npp
16548
16549 Transpose rows with columns in the input video and optionally flip it.
16550 For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
16551
16552 It accepts the following parameters:
16553
16554 @table @option
16555
16556 @item dir
16557 Specify the transposition direction.
16558
16559 Can assume the following values:
16560 @table @samp
16561 @item cclock_flip
16562 Rotate by 90 degrees counterclockwise and vertically flip. (default)
16563
16564 @item clock
16565 Rotate by 90 degrees clockwise.
16566
16567 @item cclock
16568 Rotate by 90 degrees counterclockwise.
16569
16570 @item clock_flip
16571 Rotate by 90 degrees clockwise and vertically flip.
16572 @end table
16573
16574 @item passthrough
16575 Do not apply the transposition if the input geometry matches the one
16576 specified by the specified value. It accepts the following values:
16577 @table @samp
16578 @item none
16579 Always apply transposition. (default)
16580 @item portrait
16581 Preserve portrait geometry (when @var{height} >= @var{width}).
16582 @item landscape
16583 Preserve landscape geometry (when @var{width} >= @var{height}).
16584 @end table
16585
16586 @end table
16587
16588 @section trim
16589 Trim the input so that the output contains one continuous subpart of the input.
16590
16591 It accepts the following parameters:
16592 @table @option
16593 @item start
16594 Specify the time of the start of the kept section, i.e. the frame with the
16595 timestamp @var{start} will be the first frame in the output.
16596
16597 @item end
16598 Specify the time of the first frame that will be dropped, i.e. the frame
16599 immediately preceding the one with the timestamp @var{end} will be the last
16600 frame in the output.
16601
16602 @item start_pts
16603 This is the same as @var{start}, except this option sets the start timestamp
16604 in timebase units instead of seconds.
16605
16606 @item end_pts
16607 This is the same as @var{end}, except this option sets the end timestamp
16608 in timebase units instead of seconds.
16609
16610 @item duration
16611 The maximum duration of the output in seconds.
16612
16613 @item start_frame
16614 The number of the first frame that should be passed to the output.
16615
16616 @item end_frame
16617 The number of the first frame that should be dropped.
16618 @end table
16619
16620 @option{start}, @option{end}, and @option{duration} are expressed as time
16621 duration specifications; see
16622 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
16623 for the accepted syntax.
16624
16625 Note that the first two sets of the start/end options and the @option{duration}
16626 option look at the frame timestamp, while the _frame variants simply count the
16627 frames that pass through the filter. Also note that this filter does not modify
16628 the timestamps. If you wish for the output timestamps to start at zero, insert a
16629 setpts filter after the trim filter.
16630
16631 If multiple start or end options are set, this filter tries to be greedy and
16632 keep all the frames that match at least one of the specified constraints. To keep
16633 only the part that matches all the constraints at once, chain multiple trim
16634 filters.
16635
16636 The defaults are such that all the input is kept. So it is possible to set e.g.
16637 just the end values to keep everything before the specified time.
16638
16639 Examples:
16640 @itemize
16641 @item
16642 Drop everything except the second minute of input:
16643 @example
16644 ffmpeg -i INPUT -vf trim=60:120
16645 @end example
16646
16647 @item
16648 Keep only the first second:
16649 @example
16650 ffmpeg -i INPUT -vf trim=duration=1
16651 @end example
16652
16653 @end itemize
16654
16655 @section unpremultiply
16656 Apply alpha unpremultiply effect to input video stream using first plane
16657 of second stream as alpha.
16658
16659 Both streams must have same dimensions and same pixel format.
16660
16661 The filter accepts the following option:
16662
16663 @table @option
16664 @item planes
16665 Set which planes will be processed, unprocessed planes will be copied.
16666 By default value 0xf, all planes will be processed.
16667
16668 If the format has 1 or 2 components, then luma is bit 0.
16669 If the format has 3 or 4 components:
16670 for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
16671 for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
16672 If present, the alpha channel is always the last bit.
16673
16674 @item inplace
16675 Do not require 2nd input for processing, instead use alpha plane from input stream.
16676 @end table
16677
16678 @anchor{unsharp}
16679 @section unsharp
16680
16681 Sharpen or blur the input video.
16682
16683 It accepts the following parameters:
16684
16685 @table @option
16686 @item luma_msize_x, lx
16687 Set the luma matrix horizontal size. It must be an odd integer between
16688 3 and 23. The default value is 5.
16689
16690 @item luma_msize_y, ly
16691 Set the luma matrix vertical size. It must be an odd integer between 3
16692 and 23. The default value is 5.
16693
16694 @item luma_amount, la
16695 Set the luma effect strength. It must be a floating point number, reasonable
16696 values lay between -1.5 and 1.5.
16697
16698 Negative values will blur the input video, while positive values will
16699 sharpen it, a value of zero will disable the effect.
16700
16701 Default value is 1.0.
16702
16703 @item chroma_msize_x, cx
16704 Set the chroma matrix horizontal size. It must be an odd integer
16705 between 3 and 23. The default value is 5.
16706
16707 @item chroma_msize_y, cy
16708 Set the chroma matrix vertical size. It must be an odd integer
16709 between 3 and 23. The default value is 5.
16710
16711 @item chroma_amount, ca
16712 Set the chroma effect strength. It must be a floating point number, reasonable
16713 values lay between -1.5 and 1.5.
16714
16715 Negative values will blur the input video, while positive values will
16716 sharpen it, a value of zero will disable the effect.
16717
16718 Default value is 0.0.
16719
16720 @end table
16721
16722 All parameters are optional and default to the equivalent of the
16723 string '5:5:1.0:5:5:0.0'.
16724
16725 @subsection Examples
16726
16727 @itemize
16728 @item
16729 Apply strong luma sharpen effect:
16730 @example
16731 unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
16732 @end example
16733
16734 @item
16735 Apply a strong blur of both luma and chroma parameters:
16736 @example
16737 unsharp=7:7:-2:7:7:-2
16738 @end example
16739 @end itemize
16740
16741 @section uspp
16742
16743 Apply ultra slow/simple postprocessing filter that compresses and decompresses
16744 the image at several (or - in the case of @option{quality} level @code{8} - all)
16745 shifts and average the results.
16746
16747 The way this differs from the behavior of spp is that uspp actually encodes &
16748 decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
16749 DCT similar to MJPEG.
16750
16751 The filter accepts the following options:
16752
16753 @table @option
16754 @item quality
16755 Set quality. This option defines the number of levels for averaging. It accepts
16756 an integer in the range 0-8. If set to @code{0}, the filter will have no
16757 effect. A value of @code{8} means the higher quality. For each increment of
16758 that value the speed drops by a factor of approximately 2.  Default value is
16759 @code{3}.
16760
16761 @item qp
16762 Force a constant quantization parameter. If not set, the filter will use the QP
16763 from the video stream (if available).
16764 @end table
16765
16766 @section vaguedenoiser
16767
16768 Apply a wavelet based denoiser.
16769
16770 It transforms each frame from the video input into the wavelet domain,
16771 using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
16772 the obtained coefficients. It does an inverse wavelet transform after.
16773 Due to wavelet properties, it should give a nice smoothed result, and
16774 reduced noise, without blurring picture features.
16775
16776 This filter accepts the following options:
16777
16778 @table @option
16779 @item threshold
16780 The filtering strength. The higher, the more filtered the video will be.
16781 Hard thresholding can use a higher threshold than soft thresholding
16782 before the video looks overfiltered. Default value is 2.
16783
16784 @item method
16785 The filtering method the filter will use.
16786
16787 It accepts the following values:
16788 @table @samp
16789 @item hard
16790 All values under the threshold will be zeroed.
16791
16792 @item soft
16793 All values under the threshold will be zeroed. All values above will be
16794 reduced by the threshold.
16795
16796 @item garrote
16797 Scales or nullifies coefficients - intermediary between (more) soft and
16798 (less) hard thresholding.
16799 @end table
16800
16801 Default is garrote.
16802
16803 @item nsteps
16804 Number of times, the wavelet will decompose the picture. Picture can't
16805 be decomposed beyond a particular point (typically, 8 for a 640x480
16806 frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
16807
16808 @item percent
16809 Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
16810
16811 @item planes
16812 A list of the planes to process. By default all planes are processed.
16813 @end table
16814
16815 @section vectorscope
16816
16817 Display 2 color component values in the two dimensional graph (which is called
16818 a vectorscope).
16819
16820 This filter accepts the following options:
16821
16822 @table @option
16823 @item mode, m
16824 Set vectorscope mode.
16825
16826 It accepts the following values:
16827 @table @samp
16828 @item gray
16829 Gray values are displayed on graph, higher brightness means more pixels have
16830 same component color value on location in graph. This is the default mode.
16831
16832 @item color
16833 Gray values are displayed on graph. Surrounding pixels values which are not
16834 present in video frame are drawn in gradient of 2 color components which are
16835 set by option @code{x} and @code{y}. The 3rd color component is static.
16836
16837 @item color2
16838 Actual color components values present in video frame are displayed on graph.
16839
16840 @item color3
16841 Similar as color2 but higher frequency of same values @code{x} and @code{y}
16842 on graph increases value of another color component, which is luminance by
16843 default values of @code{x} and @code{y}.
16844
16845 @item color4
16846 Actual colors present in video frame are displayed on graph. If two different
16847 colors map to same position on graph then color with higher value of component
16848 not present in graph is picked.
16849
16850 @item color5
16851 Gray values are displayed on graph. Similar to @code{color} but with 3rd color
16852 component picked from radial gradient.
16853 @end table
16854
16855 @item x
16856 Set which color component will be represented on X-axis. Default is @code{1}.
16857
16858 @item y
16859 Set which color component will be represented on Y-axis. Default is @code{2}.
16860
16861 @item intensity, i
16862 Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
16863 of color component which represents frequency of (X, Y) location in graph.
16864
16865 @item envelope, e
16866 @table @samp
16867 @item none
16868 No envelope, this is default.
16869
16870 @item instant
16871 Instant envelope, even darkest single pixel will be clearly highlighted.
16872
16873 @item peak
16874 Hold maximum and minimum values presented in graph over time. This way you
16875 can still spot out of range values without constantly looking at vectorscope.
16876
16877 @item peak+instant
16878 Peak and instant envelope combined together.
16879 @end table
16880
16881 @item graticule, g
16882 Set what kind of graticule to draw.
16883 @table @samp
16884 @item none
16885 @item green
16886 @item color
16887 @end table
16888
16889 @item opacity, o
16890 Set graticule opacity.
16891
16892 @item flags, f
16893 Set graticule flags.
16894
16895 @table @samp
16896 @item white
16897 Draw graticule for white point.
16898
16899 @item black
16900 Draw graticule for black point.
16901
16902 @item name
16903 Draw color points short names.
16904 @end table
16905
16906 @item bgopacity, b
16907 Set background opacity.
16908
16909 @item lthreshold, l
16910 Set low threshold for color component not represented on X or Y axis.
16911 Values lower than this value will be ignored. Default is 0.
16912 Note this value is multiplied with actual max possible value one pixel component
16913 can have. So for 8-bit input and low threshold value of 0.1 actual threshold
16914 is 0.1 * 255 = 25.
16915
16916 @item hthreshold, h
16917 Set high threshold for color component not represented on X or Y axis.
16918 Values higher than this value will be ignored. Default is 1.
16919 Note this value is multiplied with actual max possible value one pixel component
16920 can have. So for 8-bit input and high threshold value of 0.9 actual threshold
16921 is 0.9 * 255 = 230.
16922
16923 @item colorspace, c
16924 Set what kind of colorspace to use when drawing graticule.
16925 @table @samp
16926 @item auto
16927 @item 601
16928 @item 709
16929 @end table
16930 Default is auto.
16931 @end table
16932
16933 @anchor{vidstabdetect}
16934 @section vidstabdetect
16935
16936 Analyze video stabilization/deshaking. Perform pass 1 of 2, see
16937 @ref{vidstabtransform} for pass 2.
16938
16939 This filter generates a file with relative translation and rotation
16940 transform information about subsequent frames, which is then used by
16941 the @ref{vidstabtransform} filter.
16942
16943 To enable compilation of this filter you need to configure FFmpeg with
16944 @code{--enable-libvidstab}.
16945
16946 This filter accepts the following options:
16947
16948 @table @option
16949 @item result
16950 Set the path to the file used to write the transforms information.
16951 Default value is @file{transforms.trf}.
16952
16953 @item shakiness
16954 Set how shaky the video is and how quick the camera is. It accepts an
16955 integer in the range 1-10, a value of 1 means little shakiness, a
16956 value of 10 means strong shakiness. Default value is 5.
16957
16958 @item accuracy
16959 Set the accuracy of the detection process. It must be a value in the
16960 range 1-15. A value of 1 means low accuracy, a value of 15 means high
16961 accuracy. Default value is 15.
16962
16963 @item stepsize
16964 Set stepsize of the search process. The region around minimum is
16965 scanned with 1 pixel resolution. Default value is 6.
16966
16967 @item mincontrast
16968 Set minimum contrast. Below this value a local measurement field is
16969 discarded. Must be a floating point value in the range 0-1. Default
16970 value is 0.3.
16971
16972 @item tripod
16973 Set reference frame number for tripod mode.
16974
16975 If enabled, the motion of the frames is compared to a reference frame
16976 in the filtered stream, identified by the specified number. The idea
16977 is to compensate all movements in a more-or-less static scene and keep
16978 the camera view absolutely still.
16979
16980 If set to 0, it is disabled. The frames are counted starting from 1.
16981
16982 @item show
16983 Show fields and transforms in the resulting frames. It accepts an
16984 integer in the range 0-2. Default value is 0, which disables any
16985 visualization.
16986 @end table
16987
16988 @subsection Examples
16989
16990 @itemize
16991 @item
16992 Use default values:
16993 @example
16994 vidstabdetect
16995 @end example
16996
16997 @item
16998 Analyze strongly shaky movie and put the results in file
16999 @file{mytransforms.trf}:
17000 @example
17001 vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
17002 @end example
17003
17004 @item
17005 Visualize the result of internal transformations in the resulting
17006 video:
17007 @example
17008 vidstabdetect=show=1
17009 @end example
17010
17011 @item
17012 Analyze a video with medium shakiness using @command{ffmpeg}:
17013 @example
17014 ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
17015 @end example
17016 @end itemize
17017
17018 @anchor{vidstabtransform}
17019 @section vidstabtransform
17020
17021 Video stabilization/deshaking: pass 2 of 2,
17022 see @ref{vidstabdetect} for pass 1.
17023
17024 Read a file with transform information for each frame and
17025 apply/compensate them. Together with the @ref{vidstabdetect}
17026 filter this can be used to deshake videos. See also
17027 @url{http://public.hronopik.de/vid.stab}. It is important to also use
17028 the @ref{unsharp} filter, see below.
17029
17030 To enable compilation of this filter you need to configure FFmpeg with
17031 @code{--enable-libvidstab}.
17032
17033 @subsection Options
17034
17035 @table @option
17036 @item input
17037 Set path to the file used to read the transforms. Default value is
17038 @file{transforms.trf}.
17039
17040 @item smoothing
17041 Set the number of frames (value*2 + 1) used for lowpass filtering the
17042 camera movements. Default value is 10.
17043
17044 For example a number of 10 means that 21 frames are used (10 in the
17045 past and 10 in the future) to smoothen the motion in the video. A
17046 larger value leads to a smoother video, but limits the acceleration of
17047 the camera (pan/tilt movements). 0 is a special case where a static
17048 camera is simulated.
17049
17050 @item optalgo
17051 Set the camera path optimization algorithm.
17052
17053 Accepted values are:
17054 @table @samp
17055 @item gauss
17056 gaussian kernel low-pass filter on camera motion (default)
17057 @item avg
17058 averaging on transformations
17059 @end table
17060
17061 @item maxshift
17062 Set maximal number of pixels to translate frames. Default value is -1,
17063 meaning no limit.
17064
17065 @item maxangle
17066 Set maximal angle in radians (degree*PI/180) to rotate frames. Default
17067 value is -1, meaning no limit.
17068
17069 @item crop
17070 Specify how to deal with borders that may be visible due to movement
17071 compensation.
17072
17073 Available values are:
17074 @table @samp
17075 @item keep
17076 keep image information from previous frame (default)
17077 @item black
17078 fill the border black
17079 @end table
17080
17081 @item invert
17082 Invert transforms if set to 1. Default value is 0.
17083
17084 @item relative
17085 Consider transforms as relative to previous frame if set to 1,
17086 absolute if set to 0. Default value is 0.
17087
17088 @item zoom
17089 Set percentage to zoom. A positive value will result in a zoom-in
17090 effect, a negative value in a zoom-out effect. Default value is 0 (no
17091 zoom).
17092
17093 @item optzoom
17094 Set optimal zooming to avoid borders.
17095
17096 Accepted values are:
17097 @table @samp
17098 @item 0
17099 disabled
17100 @item 1
17101 optimal static zoom value is determined (only very strong movements
17102 will lead to visible borders) (default)
17103 @item 2
17104 optimal adaptive zoom value is determined (no borders will be
17105 visible), see @option{zoomspeed}
17106 @end table
17107
17108 Note that the value given at zoom is added to the one calculated here.
17109
17110 @item zoomspeed
17111 Set percent to zoom maximally each frame (enabled when
17112 @option{optzoom} is set to 2). Range is from 0 to 5, default value is
17113 0.25.
17114
17115 @item interpol
17116 Specify type of interpolation.
17117
17118 Available values are:
17119 @table @samp
17120 @item no
17121 no interpolation
17122 @item linear
17123 linear only horizontal
17124 @item bilinear
17125 linear in both directions (default)
17126 @item bicubic
17127 cubic in both directions (slow)
17128 @end table
17129
17130 @item tripod
17131 Enable virtual tripod mode if set to 1, which is equivalent to
17132 @code{relative=0:smoothing=0}. Default value is 0.
17133
17134 Use also @code{tripod} option of @ref{vidstabdetect}.
17135
17136 @item debug
17137 Increase log verbosity if set to 1. Also the detected global motions
17138 are written to the temporary file @file{global_motions.trf}. Default
17139 value is 0.
17140 @end table
17141
17142 @subsection Examples
17143
17144 @itemize
17145 @item
17146 Use @command{ffmpeg} for a typical stabilization with default values:
17147 @example
17148 ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
17149 @end example
17150
17151 Note the use of the @ref{unsharp} filter which is always recommended.
17152
17153 @item
17154 Zoom in a bit more and load transform data from a given file:
17155 @example
17156 vidstabtransform=zoom=5:input="mytransforms.trf"
17157 @end example
17158
17159 @item
17160 Smoothen the video even more:
17161 @example
17162 vidstabtransform=smoothing=30
17163 @end example
17164 @end itemize
17165
17166 @section vflip
17167
17168 Flip the input video vertically.
17169
17170 For example, to vertically flip a video with @command{ffmpeg}:
17171 @example
17172 ffmpeg -i in.avi -vf "vflip" out.avi
17173 @end example
17174
17175 @section vfrdet
17176
17177 Detect variable frame rate video.
17178
17179 This filter tries to detect if the input is variable or constant frame rate.
17180
17181 At end it will output number of frames detected as having variable delta pts,
17182 and ones with constant delta pts.
17183 If there was frames with variable delta, than it will also show min and max delta
17184 encountered.
17185
17186 @anchor{vignette}
17187 @section vignette
17188
17189 Make or reverse a natural vignetting effect.
17190
17191 The filter accepts the following options:
17192
17193 @table @option
17194 @item angle, a
17195 Set lens angle expression as a number of radians.
17196
17197 The value is clipped in the @code{[0,PI/2]} range.
17198
17199 Default value: @code{"PI/5"}
17200
17201 @item x0
17202 @item y0
17203 Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
17204 by default.
17205
17206 @item mode
17207 Set forward/backward mode.
17208
17209 Available modes are:
17210 @table @samp
17211 @item forward
17212 The larger the distance from the central point, the darker the image becomes.
17213
17214 @item backward
17215 The larger the distance from the central point, the brighter the image becomes.
17216 This can be used to reverse a vignette effect, though there is no automatic
17217 detection to extract the lens @option{angle} and other settings (yet). It can
17218 also be used to create a burning effect.
17219 @end table
17220
17221 Default value is @samp{forward}.
17222
17223 @item eval
17224 Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
17225
17226 It accepts the following values:
17227 @table @samp
17228 @item init
17229 Evaluate expressions only once during the filter initialization.
17230
17231 @item frame
17232 Evaluate expressions for each incoming frame. This is way slower than the
17233 @samp{init} mode since it requires all the scalers to be re-computed, but it
17234 allows advanced dynamic expressions.
17235 @end table
17236
17237 Default value is @samp{init}.
17238
17239 @item dither
17240 Set dithering to reduce the circular banding effects. Default is @code{1}
17241 (enabled).
17242
17243 @item aspect
17244 Set vignette aspect. This setting allows one to adjust the shape of the vignette.
17245 Setting this value to the SAR of the input will make a rectangular vignetting
17246 following the dimensions of the video.
17247
17248 Default is @code{1/1}.
17249 @end table
17250
17251 @subsection Expressions
17252
17253 The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
17254 following parameters.
17255
17256 @table @option
17257 @item w
17258 @item h
17259 input width and height
17260
17261 @item n
17262 the number of input frame, starting from 0
17263
17264 @item pts
17265 the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
17266 @var{TB} units, NAN if undefined
17267
17268 @item r
17269 frame rate of the input video, NAN if the input frame rate is unknown
17270
17271 @item t
17272 the PTS (Presentation TimeStamp) of the filtered video frame,
17273 expressed in seconds, NAN if undefined
17274
17275 @item tb
17276 time base of the input video
17277 @end table
17278
17279
17280 @subsection Examples
17281
17282 @itemize
17283 @item
17284 Apply simple strong vignetting effect:
17285 @example
17286 vignette=PI/4
17287 @end example
17288
17289 @item
17290 Make a flickering vignetting:
17291 @example
17292 vignette='PI/4+random(1)*PI/50':eval=frame
17293 @end example
17294
17295 @end itemize
17296
17297 @section vmafmotion
17298
17299 Obtain the average vmaf motion score of a video.
17300 It is one of the component filters of VMAF.
17301
17302 The obtained average motion score is printed through the logging system.
17303
17304 In the below example the input file @file{ref.mpg} is being processed and score
17305 is computed.
17306
17307 @example
17308 ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
17309 @end example
17310
17311 @section vstack
17312 Stack input videos vertically.
17313
17314 All streams must be of same pixel format and of same width.
17315
17316 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
17317 to create same output.
17318
17319 The filter accept the following option:
17320
17321 @table @option
17322 @item inputs
17323 Set number of input streams. Default is 2.
17324
17325 @item shortest
17326 If set to 1, force the output to terminate when the shortest input
17327 terminates. Default value is 0.
17328 @end table
17329
17330 @section w3fdif
17331
17332 Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
17333 Deinterlacing Filter").
17334
17335 Based on the process described by Martin Weston for BBC R&D, and
17336 implemented based on the de-interlace algorithm written by Jim
17337 Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
17338 uses filter coefficients calculated by BBC R&D.
17339
17340 There are two sets of filter coefficients, so called "simple":
17341 and "complex". Which set of filter coefficients is used can
17342 be set by passing an optional parameter:
17343
17344 @table @option
17345 @item filter
17346 Set the interlacing filter coefficients. Accepts one of the following values:
17347
17348 @table @samp
17349 @item simple
17350 Simple filter coefficient set.
17351 @item complex
17352 More-complex filter coefficient set.
17353 @end table
17354 Default value is @samp{complex}.
17355
17356 @item deint
17357 Specify which frames to deinterlace. Accept one of the following values:
17358
17359 @table @samp
17360 @item all
17361 Deinterlace all frames,
17362 @item interlaced
17363 Only deinterlace frames marked as interlaced.
17364 @end table
17365
17366 Default value is @samp{all}.
17367 @end table
17368
17369 @section waveform
17370 Video waveform monitor.
17371
17372 The waveform monitor plots color component intensity. By default luminance
17373 only. Each column of the waveform corresponds to a column of pixels in the
17374 source video.
17375
17376 It accepts the following options:
17377
17378 @table @option
17379 @item mode, m
17380 Can be either @code{row}, or @code{column}. Default is @code{column}.
17381 In row mode, the graph on the left side represents color component value 0 and
17382 the right side represents value = 255. In column mode, the top side represents
17383 color component value = 0 and bottom side represents value = 255.
17384
17385 @item intensity, i
17386 Set intensity. Smaller values are useful to find out how many values of the same
17387 luminance are distributed across input rows/columns.
17388 Default value is @code{0.04}. Allowed range is [0, 1].
17389
17390 @item mirror, r
17391 Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
17392 In mirrored mode, higher values will be represented on the left
17393 side for @code{row} mode and at the top for @code{column} mode. Default is
17394 @code{1} (mirrored).
17395
17396 @item display, d
17397 Set display mode.
17398 It accepts the following values:
17399 @table @samp
17400 @item overlay
17401 Presents information identical to that in the @code{parade}, except
17402 that the graphs representing color components are superimposed directly
17403 over one another.
17404
17405 This display mode makes it easier to spot relative differences or similarities
17406 in overlapping areas of the color components that are supposed to be identical,
17407 such as neutral whites, grays, or blacks.
17408
17409 @item stack
17410 Display separate graph for the color components side by side in
17411 @code{row} mode or one below the other in @code{column} mode.
17412
17413 @item parade
17414 Display separate graph for the color components side by side in
17415 @code{column} mode or one below the other in @code{row} mode.
17416
17417 Using this display mode makes it easy to spot color casts in the highlights
17418 and shadows of an image, by comparing the contours of the top and the bottom
17419 graphs of each waveform. Since whites, grays, and blacks are characterized
17420 by exactly equal amounts of red, green, and blue, neutral areas of the picture
17421 should display three waveforms of roughly equal width/height. If not, the
17422 correction is easy to perform by making level adjustments the three waveforms.
17423 @end table
17424 Default is @code{stack}.
17425
17426 @item components, c
17427 Set which color components to display. Default is 1, which means only luminance
17428 or red color component if input is in RGB colorspace. If is set for example to
17429 7 it will display all 3 (if) available color components.
17430
17431 @item envelope, e
17432 @table @samp
17433 @item none
17434 No envelope, this is default.
17435
17436 @item instant
17437 Instant envelope, minimum and maximum values presented in graph will be easily
17438 visible even with small @code{step} value.
17439
17440 @item peak
17441 Hold minimum and maximum values presented in graph across time. This way you
17442 can still spot out of range values without constantly looking at waveforms.
17443
17444 @item peak+instant
17445 Peak and instant envelope combined together.
17446 @end table
17447
17448 @item filter, f
17449 @table @samp
17450 @item lowpass
17451 No filtering, this is default.
17452
17453 @item flat
17454 Luma and chroma combined together.
17455
17456 @item aflat
17457 Similar as above, but shows difference between blue and red chroma.
17458
17459 @item xflat
17460 Similar as above, but use different colors.
17461
17462 @item chroma
17463 Displays only chroma.
17464
17465 @item color
17466 Displays actual color value on waveform.
17467
17468 @item acolor
17469 Similar as above, but with luma showing frequency of chroma values.
17470 @end table
17471
17472 @item graticule, g
17473 Set which graticule to display.
17474
17475 @table @samp
17476 @item none
17477 Do not display graticule.
17478
17479 @item green
17480 Display green graticule showing legal broadcast ranges.
17481
17482 @item orange
17483 Display orange graticule showing legal broadcast ranges.
17484 @end table
17485
17486 @item opacity, o
17487 Set graticule opacity.
17488
17489 @item flags, fl
17490 Set graticule flags.
17491
17492 @table @samp
17493 @item numbers
17494 Draw numbers above lines. By default enabled.
17495
17496 @item dots
17497 Draw dots instead of lines.
17498 @end table
17499
17500 @item scale, s
17501 Set scale used for displaying graticule.
17502
17503 @table @samp
17504 @item digital
17505 @item millivolts
17506 @item ire
17507 @end table
17508 Default is digital.
17509
17510 @item bgopacity, b
17511 Set background opacity.
17512 @end table
17513
17514 @section weave, doubleweave
17515
17516 The @code{weave} takes a field-based video input and join
17517 each two sequential fields into single frame, producing a new double
17518 height clip with half the frame rate and half the frame count.
17519
17520 The @code{doubleweave} works same as @code{weave} but without
17521 halving frame rate and frame count.
17522
17523 It accepts the following option:
17524
17525 @table @option
17526 @item first_field
17527 Set first field. Available values are:
17528
17529 @table @samp
17530 @item top, t
17531 Set the frame as top-field-first.
17532
17533 @item bottom, b
17534 Set the frame as bottom-field-first.
17535 @end table
17536 @end table
17537
17538 @subsection Examples
17539
17540 @itemize
17541 @item
17542 Interlace video using @ref{select} and @ref{separatefields} filter:
17543 @example
17544 separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
17545 @end example
17546 @end itemize
17547
17548 @section xbr
17549 Apply the xBR high-quality magnification filter which is designed for pixel
17550 art. It follows a set of edge-detection rules, see
17551 @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
17552
17553 It accepts the following option:
17554
17555 @table @option
17556 @item n
17557 Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
17558 @code{3xBR} and @code{4} for @code{4xBR}.
17559 Default is @code{3}.
17560 @end table
17561
17562 @anchor{yadif}
17563 @section yadif
17564
17565 Deinterlace the input video ("yadif" means "yet another deinterlacing
17566 filter").
17567
17568 It accepts the following parameters:
17569
17570
17571 @table @option
17572
17573 @item mode
17574 The interlacing mode to adopt. It accepts one of the following values:
17575
17576 @table @option
17577 @item 0, send_frame
17578 Output one frame for each frame.
17579 @item 1, send_field
17580 Output one frame for each field.
17581 @item 2, send_frame_nospatial
17582 Like @code{send_frame}, but it skips the spatial interlacing check.
17583 @item 3, send_field_nospatial
17584 Like @code{send_field}, but it skips the spatial interlacing check.
17585 @end table
17586
17587 The default value is @code{send_frame}.
17588
17589 @item parity
17590 The picture field parity assumed for the input interlaced video. It accepts one
17591 of the following values:
17592
17593 @table @option
17594 @item 0, tff
17595 Assume the top field is first.
17596 @item 1, bff
17597 Assume the bottom field is first.
17598 @item -1, auto
17599 Enable automatic detection of field parity.
17600 @end table
17601
17602 The default value is @code{auto}.
17603 If the interlacing is unknown or the decoder does not export this information,
17604 top field first will be assumed.
17605
17606 @item deint
17607 Specify which frames to deinterlace. Accept one of the following
17608 values:
17609
17610 @table @option
17611 @item 0, all
17612 Deinterlace all frames.
17613 @item 1, interlaced
17614 Only deinterlace frames marked as interlaced.
17615 @end table
17616
17617 The default value is @code{all}.
17618 @end table
17619
17620 @section zoompan
17621
17622 Apply Zoom & Pan effect.
17623
17624 This filter accepts the following options:
17625
17626 @table @option
17627 @item zoom, z
17628 Set the zoom expression. Default is 1.
17629
17630 @item x
17631 @item y
17632 Set the x and y expression. Default is 0.
17633
17634 @item d
17635 Set the duration expression in number of frames.
17636 This sets for how many number of frames effect will last for
17637 single input image.
17638
17639 @item s
17640 Set the output image size, default is 'hd720'.
17641
17642 @item fps
17643 Set the output frame rate, default is '25'.
17644 @end table
17645
17646 Each expression can contain the following constants:
17647
17648 @table @option
17649 @item in_w, iw
17650 Input width.
17651
17652 @item in_h, ih
17653 Input height.
17654
17655 @item out_w, ow
17656 Output width.
17657
17658 @item out_h, oh
17659 Output height.
17660
17661 @item in
17662 Input frame count.
17663
17664 @item on
17665 Output frame count.
17666
17667 @item x
17668 @item y
17669 Last calculated 'x' and 'y' position from 'x' and 'y' expression
17670 for current input frame.
17671
17672 @item px
17673 @item py
17674 'x' and 'y' of last output frame of previous input frame or 0 when there was
17675 not yet such frame (first input frame).
17676
17677 @item zoom
17678 Last calculated zoom from 'z' expression for current input frame.
17679
17680 @item pzoom
17681 Last calculated zoom of last output frame of previous input frame.
17682
17683 @item duration
17684 Number of output frames for current input frame. Calculated from 'd' expression
17685 for each input frame.
17686
17687 @item pduration
17688 number of output frames created for previous input frame
17689
17690 @item a
17691 Rational number: input width / input height
17692
17693 @item sar
17694 sample aspect ratio
17695
17696 @item dar
17697 display aspect ratio
17698
17699 @end table
17700
17701 @subsection Examples
17702
17703 @itemize
17704 @item
17705 Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
17706 @example
17707 zoompan=z='min(zoom+0.0015,1.5)':d=700:x='if(gte(zoom,1.5),x,x+1/a)':y='if(gte(zoom,1.5),y,y+1)':s=640x360
17708 @end example
17709
17710 @item
17711 Zoom-in up to 1.5 and pan always at center of picture:
17712 @example
17713 zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
17714 @end example
17715
17716 @item
17717 Same as above but without pausing:
17718 @example
17719 zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
17720 @end example
17721 @end itemize
17722
17723 @anchor{zscale}
17724 @section zscale
17725 Scale (resize) the input video, using the z.lib library:
17726 @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
17727 filter, you need to configure FFmpeg with @code{--enable-libzimg}.
17728
17729 The zscale filter forces the output display aspect ratio to be the same
17730 as the input, by changing the output sample aspect ratio.
17731
17732 If the input image format is different from the format requested by
17733 the next filter, the zscale filter will convert the input to the
17734 requested format.
17735
17736 @subsection Options
17737 The filter accepts the following options.
17738
17739 @table @option
17740 @item width, w
17741 @item height, h
17742 Set the output video dimension expression. Default value is the input
17743 dimension.
17744
17745 If the @var{width} or @var{w} value is 0, the input width is used for
17746 the output. If the @var{height} or @var{h} value is 0, the input height
17747 is used for the output.
17748
17749 If one and only one of the values is -n with n >= 1, the zscale filter
17750 will use a value that maintains the aspect ratio of the input image,
17751 calculated from the other specified dimension. After that it will,
17752 however, make sure that the calculated dimension is divisible by n and
17753 adjust the value if necessary.
17754
17755 If both values are -n with n >= 1, the behavior will be identical to
17756 both values being set to 0 as previously detailed.
17757
17758 See below for the list of accepted constants for use in the dimension
17759 expression.
17760
17761 @item size, s
17762 Set the video size. For the syntax of this option, check the
17763 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17764
17765 @item dither, d
17766 Set the dither type.
17767
17768 Possible values are:
17769 @table @var
17770 @item none
17771 @item ordered
17772 @item random
17773 @item error_diffusion
17774 @end table
17775
17776 Default is none.
17777
17778 @item filter, f
17779 Set the resize filter type.
17780
17781 Possible values are:
17782 @table @var
17783 @item point
17784 @item bilinear
17785 @item bicubic
17786 @item spline16
17787 @item spline36
17788 @item lanczos
17789 @end table
17790
17791 Default is bilinear.
17792
17793 @item range, r
17794 Set the color range.
17795
17796 Possible values are:
17797 @table @var
17798 @item input
17799 @item limited
17800 @item full
17801 @end table
17802
17803 Default is same as input.
17804
17805 @item primaries, p
17806 Set the color primaries.
17807
17808 Possible values are:
17809 @table @var
17810 @item input
17811 @item 709
17812 @item unspecified
17813 @item 170m
17814 @item 240m
17815 @item 2020
17816 @end table
17817
17818 Default is same as input.
17819
17820 @item transfer, t
17821 Set the transfer characteristics.
17822
17823 Possible values are:
17824 @table @var
17825 @item input
17826 @item 709
17827 @item unspecified
17828 @item 601
17829 @item linear
17830 @item 2020_10
17831 @item 2020_12
17832 @item smpte2084
17833 @item iec61966-2-1
17834 @item arib-std-b67
17835 @end table
17836
17837 Default is same as input.
17838
17839 @item matrix, m
17840 Set the colorspace matrix.
17841
17842 Possible value are:
17843 @table @var
17844 @item input
17845 @item 709
17846 @item unspecified
17847 @item 470bg
17848 @item 170m
17849 @item 2020_ncl
17850 @item 2020_cl
17851 @end table
17852
17853 Default is same as input.
17854
17855 @item rangein, rin
17856 Set the input color range.
17857
17858 Possible values are:
17859 @table @var
17860 @item input
17861 @item limited
17862 @item full
17863 @end table
17864
17865 Default is same as input.
17866
17867 @item primariesin, pin
17868 Set the input color primaries.
17869
17870 Possible values are:
17871 @table @var
17872 @item input
17873 @item 709
17874 @item unspecified
17875 @item 170m
17876 @item 240m
17877 @item 2020
17878 @end table
17879
17880 Default is same as input.
17881
17882 @item transferin, tin
17883 Set the input transfer characteristics.
17884
17885 Possible values are:
17886 @table @var
17887 @item input
17888 @item 709
17889 @item unspecified
17890 @item 601
17891 @item linear
17892 @item 2020_10
17893 @item 2020_12
17894 @end table
17895
17896 Default is same as input.
17897
17898 @item matrixin, min
17899 Set the input colorspace matrix.
17900
17901 Possible value are:
17902 @table @var
17903 @item input
17904 @item 709
17905 @item unspecified
17906 @item 470bg
17907 @item 170m
17908 @item 2020_ncl
17909 @item 2020_cl
17910 @end table
17911
17912 @item chromal, c
17913 Set the output chroma location.
17914
17915 Possible values are:
17916 @table @var
17917 @item input
17918 @item left
17919 @item center
17920 @item topleft
17921 @item top
17922 @item bottomleft
17923 @item bottom
17924 @end table
17925
17926 @item chromalin, cin
17927 Set the input chroma location.
17928
17929 Possible values are:
17930 @table @var
17931 @item input
17932 @item left
17933 @item center
17934 @item topleft
17935 @item top
17936 @item bottomleft
17937 @item bottom
17938 @end table
17939
17940 @item npl
17941 Set the nominal peak luminance.
17942 @end table
17943
17944 The values of the @option{w} and @option{h} options are expressions
17945 containing the following constants:
17946
17947 @table @var
17948 @item in_w
17949 @item in_h
17950 The input width and height
17951
17952 @item iw
17953 @item ih
17954 These are the same as @var{in_w} and @var{in_h}.
17955
17956 @item out_w
17957 @item out_h
17958 The output (scaled) width and height
17959
17960 @item ow
17961 @item oh
17962 These are the same as @var{out_w} and @var{out_h}
17963
17964 @item a
17965 The same as @var{iw} / @var{ih}
17966
17967 @item sar
17968 input sample aspect ratio
17969
17970 @item dar
17971 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
17972
17973 @item hsub
17974 @item vsub
17975 horizontal and vertical input chroma subsample values. For example for the
17976 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
17977
17978 @item ohsub
17979 @item ovsub
17980 horizontal and vertical output chroma subsample values. For example for the
17981 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
17982 @end table
17983
17984 @table @option
17985 @end table
17986
17987 @c man end VIDEO FILTERS
17988
17989 @chapter Video Sources
17990 @c man begin VIDEO SOURCES
17991
17992 Below is a description of the currently available video sources.
17993
17994 @section buffer
17995
17996 Buffer video frames, and make them available to the filter chain.
17997
17998 This source is mainly intended for a programmatic use, in particular
17999 through the interface defined in @file{libavfilter/vsrc_buffer.h}.
18000
18001 It accepts the following parameters:
18002
18003 @table @option
18004
18005 @item video_size
18006 Specify the size (width and height) of the buffered video frames. For the
18007 syntax of this option, check the
18008 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18009
18010 @item width
18011 The input video width.
18012
18013 @item height
18014 The input video height.
18015
18016 @item pix_fmt
18017 A string representing the pixel format of the buffered video frames.
18018 It may be a number corresponding to a pixel format, or a pixel format
18019 name.
18020
18021 @item time_base
18022 Specify the timebase assumed by the timestamps of the buffered frames.
18023
18024 @item frame_rate
18025 Specify the frame rate expected for the video stream.
18026
18027 @item pixel_aspect, sar
18028 The sample (pixel) aspect ratio of the input video.
18029
18030 @item sws_param
18031 Specify the optional parameters to be used for the scale filter which
18032 is automatically inserted when an input change is detected in the
18033 input size or format.
18034
18035 @item hw_frames_ctx
18036 When using a hardware pixel format, this should be a reference to an
18037 AVHWFramesContext describing input frames.
18038 @end table
18039
18040 For example:
18041 @example
18042 buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
18043 @end example
18044
18045 will instruct the source to accept video frames with size 320x240 and
18046 with format "yuv410p", assuming 1/24 as the timestamps timebase and
18047 square pixels (1:1 sample aspect ratio).
18048 Since the pixel format with name "yuv410p" corresponds to the number 6
18049 (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
18050 this example corresponds to:
18051 @example
18052 buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
18053 @end example
18054
18055 Alternatively, the options can be specified as a flat string, but this
18056 syntax is deprecated:
18057
18058 @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}]
18059
18060 @section cellauto
18061
18062 Create a pattern generated by an elementary cellular automaton.
18063
18064 The initial state of the cellular automaton can be defined through the
18065 @option{filename} and @option{pattern} options. If such options are
18066 not specified an initial state is created randomly.
18067
18068 At each new frame a new row in the video is filled with the result of
18069 the cellular automaton next generation. The behavior when the whole
18070 frame is filled is defined by the @option{scroll} option.
18071
18072 This source accepts the following options:
18073
18074 @table @option
18075 @item filename, f
18076 Read the initial cellular automaton state, i.e. the starting row, from
18077 the specified file.
18078 In the file, each non-whitespace character is considered an alive
18079 cell, a newline will terminate the row, and further characters in the
18080 file will be ignored.
18081
18082 @item pattern, p
18083 Read the initial cellular automaton state, i.e. the starting row, from
18084 the specified string.
18085
18086 Each non-whitespace character in the string is considered an alive
18087 cell, a newline will terminate the row, and further characters in the
18088 string will be ignored.
18089
18090 @item rate, r
18091 Set the video rate, that is the number of frames generated per second.
18092 Default is 25.
18093
18094 @item random_fill_ratio, ratio
18095 Set the random fill ratio for the initial cellular automaton row. It
18096 is a floating point number value ranging from 0 to 1, defaults to
18097 1/PHI.
18098
18099 This option is ignored when a file or a pattern is specified.
18100
18101 @item random_seed, seed
18102 Set the seed for filling randomly the initial row, must be an integer
18103 included between 0 and UINT32_MAX. If not specified, or if explicitly
18104 set to -1, the filter will try to use a good random seed on a best
18105 effort basis.
18106
18107 @item rule
18108 Set the cellular automaton rule, it is a number ranging from 0 to 255.
18109 Default value is 110.
18110
18111 @item size, s
18112 Set the size of the output video. For the syntax of this option, check the
18113 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18114
18115 If @option{filename} or @option{pattern} is specified, the size is set
18116 by default to the width of the specified initial state row, and the
18117 height is set to @var{width} * PHI.
18118
18119 If @option{size} is set, it must contain the width of the specified
18120 pattern string, and the specified pattern will be centered in the
18121 larger row.
18122
18123 If a filename or a pattern string is not specified, the size value
18124 defaults to "320x518" (used for a randomly generated initial state).
18125
18126 @item scroll
18127 If set to 1, scroll the output upward when all the rows in the output
18128 have been already filled. If set to 0, the new generated row will be
18129 written over the top row just after the bottom row is filled.
18130 Defaults to 1.
18131
18132 @item start_full, full
18133 If set to 1, completely fill the output with generated rows before
18134 outputting the first frame.
18135 This is the default behavior, for disabling set the value to 0.
18136
18137 @item stitch
18138 If set to 1, stitch the left and right row edges together.
18139 This is the default behavior, for disabling set the value to 0.
18140 @end table
18141
18142 @subsection Examples
18143
18144 @itemize
18145 @item
18146 Read the initial state from @file{pattern}, and specify an output of
18147 size 200x400.
18148 @example
18149 cellauto=f=pattern:s=200x400
18150 @end example
18151
18152 @item
18153 Generate a random initial row with a width of 200 cells, with a fill
18154 ratio of 2/3:
18155 @example
18156 cellauto=ratio=2/3:s=200x200
18157 @end example
18158
18159 @item
18160 Create a pattern generated by rule 18 starting by a single alive cell
18161 centered on an initial row with width 100:
18162 @example
18163 cellauto=p=@@:s=100x400:full=0:rule=18
18164 @end example
18165
18166 @item
18167 Specify a more elaborated initial pattern:
18168 @example
18169 cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
18170 @end example
18171
18172 @end itemize
18173
18174 @anchor{coreimagesrc}
18175 @section coreimagesrc
18176 Video source generated on GPU using Apple's CoreImage API on OSX.
18177
18178 This video source is a specialized version of the @ref{coreimage} video filter.
18179 Use a core image generator at the beginning of the applied filterchain to
18180 generate the content.
18181
18182 The coreimagesrc video source accepts the following options:
18183 @table @option
18184 @item list_generators
18185 List all available generators along with all their respective options as well as
18186 possible minimum and maximum values along with the default values.
18187 @example
18188 list_generators=true
18189 @end example
18190
18191 @item size, s
18192 Specify the size of the sourced video. For the syntax of this option, check the
18193 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18194 The default value is @code{320x240}.
18195
18196 @item rate, r
18197 Specify the frame rate of the sourced video, as the number of frames
18198 generated per second. It has to be a string in the format
18199 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
18200 number or a valid video frame rate abbreviation. The default value is
18201 "25".
18202
18203 @item sar
18204 Set the sample aspect ratio of the sourced video.
18205
18206 @item duration, d
18207 Set the duration of the sourced video. See
18208 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
18209 for the accepted syntax.
18210
18211 If not specified, or the expressed duration is negative, the video is
18212 supposed to be generated forever.
18213 @end table
18214
18215 Additionally, all options of the @ref{coreimage} video filter are accepted.
18216 A complete filterchain can be used for further processing of the
18217 generated input without CPU-HOST transfer. See @ref{coreimage} documentation
18218 and examples for details.
18219
18220 @subsection Examples
18221
18222 @itemize
18223
18224 @item
18225 Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
18226 given as complete and escaped command-line for Apple's standard bash shell:
18227 @example
18228 ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
18229 @end example
18230 This example is equivalent to the QRCode example of @ref{coreimage} without the
18231 need for a nullsrc video source.
18232 @end itemize
18233
18234
18235 @section mandelbrot
18236
18237 Generate a Mandelbrot set fractal, and progressively zoom towards the
18238 point specified with @var{start_x} and @var{start_y}.
18239
18240 This source accepts the following options:
18241
18242 @table @option
18243
18244 @item end_pts
18245 Set the terminal pts value. Default value is 400.
18246
18247 @item end_scale
18248 Set the terminal scale value.
18249 Must be a floating point value. Default value is 0.3.
18250
18251 @item inner
18252 Set the inner coloring mode, that is the algorithm used to draw the
18253 Mandelbrot fractal internal region.
18254
18255 It shall assume one of the following values:
18256 @table @option
18257 @item black
18258 Set black mode.
18259 @item convergence
18260 Show time until convergence.
18261 @item mincol
18262 Set color based on point closest to the origin of the iterations.
18263 @item period
18264 Set period mode.
18265 @end table
18266
18267 Default value is @var{mincol}.
18268
18269 @item bailout
18270 Set the bailout value. Default value is 10.0.
18271
18272 @item maxiter
18273 Set the maximum of iterations performed by the rendering
18274 algorithm. Default value is 7189.
18275
18276 @item outer
18277 Set outer coloring mode.
18278 It shall assume one of following values:
18279 @table @option
18280 @item iteration_count
18281 Set iteration cound mode.
18282 @item normalized_iteration_count
18283 set normalized iteration count mode.
18284 @end table
18285 Default value is @var{normalized_iteration_count}.
18286
18287 @item rate, r
18288 Set frame rate, expressed as number of frames per second. Default
18289 value is "25".
18290
18291 @item size, s
18292 Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
18293 size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
18294
18295 @item start_scale
18296 Set the initial scale value. Default value is 3.0.
18297
18298 @item start_x
18299 Set the initial x position. Must be a floating point value between
18300 -100 and 100. Default value is -0.743643887037158704752191506114774.
18301
18302 @item start_y
18303 Set the initial y position. Must be a floating point value between
18304 -100 and 100. Default value is -0.131825904205311970493132056385139.
18305 @end table
18306
18307 @section mptestsrc
18308
18309 Generate various test patterns, as generated by the MPlayer test filter.
18310
18311 The size of the generated video is fixed, and is 256x256.
18312 This source is useful in particular for testing encoding features.
18313
18314 This source accepts the following options:
18315
18316 @table @option
18317
18318 @item rate, r
18319 Specify the frame rate of the sourced video, as the number of frames
18320 generated per second. It has to be a string in the format
18321 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
18322 number or a valid video frame rate abbreviation. The default value is
18323 "25".
18324
18325 @item duration, d
18326 Set the duration of the sourced video. See
18327 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
18328 for the accepted syntax.
18329
18330 If not specified, or the expressed duration is negative, the video is
18331 supposed to be generated forever.
18332
18333 @item test, t
18334
18335 Set the number or the name of the test to perform. Supported tests are:
18336 @table @option
18337 @item dc_luma
18338 @item dc_chroma
18339 @item freq_luma
18340 @item freq_chroma
18341 @item amp_luma
18342 @item amp_chroma
18343 @item cbp
18344 @item mv
18345 @item ring1
18346 @item ring2
18347 @item all
18348
18349 @end table
18350
18351 Default value is "all", which will cycle through the list of all tests.
18352 @end table
18353
18354 Some examples:
18355 @example
18356 mptestsrc=t=dc_luma
18357 @end example
18358
18359 will generate a "dc_luma" test pattern.
18360
18361 @section frei0r_src
18362
18363 Provide a frei0r source.
18364
18365 To enable compilation of this filter you need to install the frei0r
18366 header and configure FFmpeg with @code{--enable-frei0r}.
18367
18368 This source accepts the following parameters:
18369
18370 @table @option
18371
18372 @item size
18373 The size of the video to generate. For the syntax of this option, check the
18374 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18375
18376 @item framerate
18377 The framerate of the generated video. It may be a string of the form
18378 @var{num}/@var{den} or a frame rate abbreviation.
18379
18380 @item filter_name
18381 The name to the frei0r source to load. For more information regarding frei0r and
18382 how to set the parameters, read the @ref{frei0r} section in the video filters
18383 documentation.
18384
18385 @item filter_params
18386 A '|'-separated list of parameters to pass to the frei0r source.
18387
18388 @end table
18389
18390 For example, to generate a frei0r partik0l source with size 200x200
18391 and frame rate 10 which is overlaid on the overlay filter main input:
18392 @example
18393 frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
18394 @end example
18395
18396 @section life
18397
18398 Generate a life pattern.
18399
18400 This source is based on a generalization of John Conway's life game.
18401
18402 The sourced input represents a life grid, each pixel represents a cell
18403 which can be in one of two possible states, alive or dead. Every cell
18404 interacts with its eight neighbours, which are the cells that are
18405 horizontally, vertically, or diagonally adjacent.
18406
18407 At each interaction the grid evolves according to the adopted rule,
18408 which specifies the number of neighbor alive cells which will make a
18409 cell stay alive or born. The @option{rule} option allows one to specify
18410 the rule to adopt.
18411
18412 This source accepts the following options:
18413
18414 @table @option
18415 @item filename, f
18416 Set the file from which to read the initial grid state. In the file,
18417 each non-whitespace character is considered an alive cell, and newline
18418 is used to delimit the end of each row.
18419
18420 If this option is not specified, the initial grid is generated
18421 randomly.
18422
18423 @item rate, r
18424 Set the video rate, that is the number of frames generated per second.
18425 Default is 25.
18426
18427 @item random_fill_ratio, ratio
18428 Set the random fill ratio for the initial random grid. It is a
18429 floating point number value ranging from 0 to 1, defaults to 1/PHI.
18430 It is ignored when a file is specified.
18431
18432 @item random_seed, seed
18433 Set the seed for filling the initial random grid, must be an integer
18434 included between 0 and UINT32_MAX. If not specified, or if explicitly
18435 set to -1, the filter will try to use a good random seed on a best
18436 effort basis.
18437
18438 @item rule
18439 Set the life rule.
18440
18441 A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
18442 where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
18443 @var{NS} specifies the number of alive neighbor cells which make a
18444 live cell stay alive, and @var{NB} the number of alive neighbor cells
18445 which make a dead cell to become alive (i.e. to "born").
18446 "s" and "b" can be used in place of "S" and "B", respectively.
18447
18448 Alternatively a rule can be specified by an 18-bits integer. The 9
18449 high order bits are used to encode the next cell state if it is alive
18450 for each number of neighbor alive cells, the low order bits specify
18451 the rule for "borning" new cells. Higher order bits encode for an
18452 higher number of neighbor cells.
18453 For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
18454 rule of 12 and a born rule of 9, which corresponds to "S23/B03".
18455
18456 Default value is "S23/B3", which is the original Conway's game of life
18457 rule, and will keep a cell alive if it has 2 or 3 neighbor alive
18458 cells, and will born a new cell if there are three alive cells around
18459 a dead cell.
18460
18461 @item size, s
18462 Set the size of the output video. For the syntax of this option, check the
18463 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18464
18465 If @option{filename} is specified, the size is set by default to the
18466 same size of the input file. If @option{size} is set, it must contain
18467 the size specified in the input file, and the initial grid defined in
18468 that file is centered in the larger resulting area.
18469
18470 If a filename is not specified, the size value defaults to "320x240"
18471 (used for a randomly generated initial grid).
18472
18473 @item stitch
18474 If set to 1, stitch the left and right grid edges together, and the
18475 top and bottom edges also. Defaults to 1.
18476
18477 @item mold
18478 Set cell mold speed. If set, a dead cell will go from @option{death_color} to
18479 @option{mold_color} with a step of @option{mold}. @option{mold} can have a
18480 value from 0 to 255.
18481
18482 @item life_color
18483 Set the color of living (or new born) cells.
18484
18485 @item death_color
18486 Set the color of dead cells. If @option{mold} is set, this is the first color
18487 used to represent a dead cell.
18488
18489 @item mold_color
18490 Set mold color, for definitely dead and moldy cells.
18491
18492 For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
18493 ffmpeg-utils manual,ffmpeg-utils}.
18494 @end table
18495
18496 @subsection Examples
18497
18498 @itemize
18499 @item
18500 Read a grid from @file{pattern}, and center it on a grid of size
18501 300x300 pixels:
18502 @example
18503 life=f=pattern:s=300x300
18504 @end example
18505
18506 @item
18507 Generate a random grid of size 200x200, with a fill ratio of 2/3:
18508 @example
18509 life=ratio=2/3:s=200x200
18510 @end example
18511
18512 @item
18513 Specify a custom rule for evolving a randomly generated grid:
18514 @example
18515 life=rule=S14/B34
18516 @end example
18517
18518 @item
18519 Full example with slow death effect (mold) using @command{ffplay}:
18520 @example
18521 ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
18522 @end example
18523 @end itemize
18524
18525 @anchor{allrgb}
18526 @anchor{allyuv}
18527 @anchor{color}
18528 @anchor{haldclutsrc}
18529 @anchor{nullsrc}
18530 @anchor{pal75bars}
18531 @anchor{pal100bars}
18532 @anchor{rgbtestsrc}
18533 @anchor{smptebars}
18534 @anchor{smptehdbars}
18535 @anchor{testsrc}
18536 @anchor{testsrc2}
18537 @anchor{yuvtestsrc}
18538 @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
18539
18540 The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
18541
18542 The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
18543
18544 The @code{color} source provides an uniformly colored input.
18545
18546 The @code{haldclutsrc} source provides an identity Hald CLUT. See also
18547 @ref{haldclut} filter.
18548
18549 The @code{nullsrc} source returns unprocessed video frames. It is
18550 mainly useful to be employed in analysis / debugging tools, or as the
18551 source for filters which ignore the input data.
18552
18553 The @code{pal75bars} source generates a color bars pattern, based on
18554 EBU PAL recommendations with 75% color levels.
18555
18556 The @code{pal100bars} source generates a color bars pattern, based on
18557 EBU PAL recommendations with 100% color levels.
18558
18559 The @code{rgbtestsrc} source generates an RGB test pattern useful for
18560 detecting RGB vs BGR issues. You should see a red, green and blue
18561 stripe from top to bottom.
18562
18563 The @code{smptebars} source generates a color bars pattern, based on
18564 the SMPTE Engineering Guideline EG 1-1990.
18565
18566 The @code{smptehdbars} source generates a color bars pattern, based on
18567 the SMPTE RP 219-2002.
18568
18569 The @code{testsrc} source generates a test video pattern, showing a
18570 color pattern, a scrolling gradient and a timestamp. This is mainly
18571 intended for testing purposes.
18572
18573 The @code{testsrc2} source is similar to testsrc, but supports more
18574 pixel formats instead of just @code{rgb24}. This allows using it as an
18575 input for other tests without requiring a format conversion.
18576
18577 The @code{yuvtestsrc} source generates an YUV test pattern. You should
18578 see a y, cb and cr stripe from top to bottom.
18579
18580 The sources accept the following parameters:
18581
18582 @table @option
18583
18584 @item level
18585 Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
18586 source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
18587 pixels to be used as identity matrix for 3D lookup tables. Each component is
18588 coded on a @code{1/(N*N)} scale.
18589
18590 @item color, c
18591 Specify the color of the source, only available in the @code{color}
18592 source. For the syntax of this option, check the
18593 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
18594
18595 @item size, s
18596 Specify the size of the sourced video. For the syntax of this option, check the
18597 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18598 The default value is @code{320x240}.
18599
18600 This option is not available with the @code{allrgb}, @code{allyuv}, and
18601 @code{haldclutsrc} filters.
18602
18603 @item rate, r
18604 Specify the frame rate of the sourced video, as the number of frames
18605 generated per second. It has to be a string in the format
18606 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
18607 number or a valid video frame rate abbreviation. The default value is
18608 "25".
18609
18610 @item duration, d
18611 Set the duration of the sourced video. See
18612 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
18613 for the accepted syntax.
18614
18615 If not specified, or the expressed duration is negative, the video is
18616 supposed to be generated forever.
18617
18618 @item sar
18619 Set the sample aspect ratio of the sourced video.
18620
18621 @item alpha
18622 Specify the alpha (opacity) of the background, only available in the
18623 @code{testsrc2} source. The value must be between 0 (fully transparent) and
18624 255 (fully opaque, the default).
18625
18626 @item decimals, n
18627 Set the number of decimals to show in the timestamp, only available in the
18628 @code{testsrc} source.
18629
18630 The displayed timestamp value will correspond to the original
18631 timestamp value multiplied by the power of 10 of the specified
18632 value. Default value is 0.
18633 @end table
18634
18635 @subsection Examples
18636
18637 @itemize
18638 @item
18639 Generate a video with a duration of 5.3 seconds, with size
18640 176x144 and a frame rate of 10 frames per second:
18641 @example
18642 testsrc=duration=5.3:size=qcif:rate=10
18643 @end example
18644
18645 @item
18646 The following graph description will generate a red source
18647 with an opacity of 0.2, with size "qcif" and a frame rate of 10
18648 frames per second:
18649 @example
18650 color=c=red@@0.2:s=qcif:r=10
18651 @end example
18652
18653 @item
18654 If the input content is to be ignored, @code{nullsrc} can be used. The
18655 following command generates noise in the luminance plane by employing
18656 the @code{geq} filter:
18657 @example
18658 nullsrc=s=256x256, geq=random(1)*255:128:128
18659 @end example
18660 @end itemize
18661
18662 @subsection Commands
18663
18664 The @code{color} source supports the following commands:
18665
18666 @table @option
18667 @item c, color
18668 Set the color of the created image. Accepts the same syntax of the
18669 corresponding @option{color} option.
18670 @end table
18671
18672 @section openclsrc
18673
18674 Generate video using an OpenCL program.
18675
18676 @table @option
18677
18678 @item source
18679 OpenCL program source file.
18680
18681 @item kernel
18682 Kernel name in program.
18683
18684 @item size, s
18685 Size of frames to generate.  This must be set.
18686
18687 @item format
18688 Pixel format to use for the generated frames.  This must be set.
18689
18690 @item rate, r
18691 Number of frames generated every second.  Default value is '25'.
18692
18693 @end table
18694
18695 For details of how the program loading works, see the @ref{program_opencl}
18696 filter.
18697
18698 Example programs:
18699
18700 @itemize
18701 @item
18702 Generate a colour ramp by setting pixel values from the position of the pixel
18703 in the output image.  (Note that this will work with all pixel formats, but
18704 the generated output will not be the same.)
18705 @verbatim
18706 __kernel void ramp(__write_only image2d_t dst,
18707                    unsigned int index)
18708 {
18709     int2 loc = (int2)(get_global_id(0), get_global_id(1));
18710
18711     float4 val;
18712     val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
18713
18714     write_imagef(dst, loc, val);
18715 }
18716 @end verbatim
18717
18718 @item
18719 Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
18720 @verbatim
18721 __kernel void sierpinski_carpet(__write_only image2d_t dst,
18722                                 unsigned int index)
18723 {
18724     int2 loc = (int2)(get_global_id(0), get_global_id(1));
18725
18726     float4 value = 0.0f;
18727     int x = loc.x + index;
18728     int y = loc.y + index;
18729     while (x > 0 || y > 0) {
18730         if (x % 3 == 1 && y % 3 == 1) {
18731             value = 1.0f;
18732             break;
18733         }
18734         x /= 3;
18735         y /= 3;
18736     }
18737
18738     write_imagef(dst, loc, value);
18739 }
18740 @end verbatim
18741
18742 @end itemize
18743
18744 @c man end VIDEO SOURCES
18745
18746 @chapter Video Sinks
18747 @c man begin VIDEO SINKS
18748
18749 Below is a description of the currently available video sinks.
18750
18751 @section buffersink
18752
18753 Buffer video frames, and make them available to the end of the filter
18754 graph.
18755
18756 This sink is mainly intended for programmatic use, in particular
18757 through the interface defined in @file{libavfilter/buffersink.h}
18758 or the options system.
18759
18760 It accepts a pointer to an AVBufferSinkContext structure, which
18761 defines the incoming buffers' formats, to be passed as the opaque
18762 parameter to @code{avfilter_init_filter} for initialization.
18763
18764 @section nullsink
18765
18766 Null video sink: do absolutely nothing with the input video. It is
18767 mainly useful as a template and for use in analysis / debugging
18768 tools.
18769
18770 @c man end VIDEO SINKS
18771
18772 @chapter Multimedia Filters
18773 @c man begin MULTIMEDIA FILTERS
18774
18775 Below is a description of the currently available multimedia filters.
18776
18777 @section abitscope
18778
18779 Convert input audio to a video output, displaying the audio bit scope.
18780
18781 The filter accepts the following options:
18782
18783 @table @option
18784 @item rate, r
18785 Set frame rate, expressed as number of frames per second. Default
18786 value is "25".
18787
18788 @item size, s
18789 Specify the video size for the output. For the syntax of this option, check the
18790 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18791 Default value is @code{1024x256}.
18792
18793 @item colors
18794 Specify list of colors separated by space or by '|' which will be used to
18795 draw channels. Unrecognized or missing colors will be replaced
18796 by white color.
18797 @end table
18798
18799 @section ahistogram
18800
18801 Convert input audio to a video output, displaying the volume histogram.
18802
18803 The filter accepts the following options:
18804
18805 @table @option
18806 @item dmode
18807 Specify how histogram is calculated.
18808
18809 It accepts the following values:
18810 @table @samp
18811 @item single
18812 Use single histogram for all channels.
18813 @item separate
18814 Use separate histogram for each channel.
18815 @end table
18816 Default is @code{single}.
18817
18818 @item rate, r
18819 Set frame rate, expressed as number of frames per second. Default
18820 value is "25".
18821
18822 @item size, s
18823 Specify the video size for the output. For the syntax of this option, check the
18824 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18825 Default value is @code{hd720}.
18826
18827 @item scale
18828 Set display scale.
18829
18830 It accepts the following values:
18831 @table @samp
18832 @item log
18833 logarithmic
18834 @item sqrt
18835 square root
18836 @item cbrt
18837 cubic root
18838 @item lin
18839 linear
18840 @item rlog
18841 reverse logarithmic
18842 @end table
18843 Default is @code{log}.
18844
18845 @item ascale
18846 Set amplitude scale.
18847
18848 It accepts the following values:
18849 @table @samp
18850 @item log
18851 logarithmic
18852 @item lin
18853 linear
18854 @end table
18855 Default is @code{log}.
18856
18857 @item acount
18858 Set how much frames to accumulate in histogram.
18859 Defauls is 1. Setting this to -1 accumulates all frames.
18860
18861 @item rheight
18862 Set histogram ratio of window height.
18863
18864 @item slide
18865 Set sonogram sliding.
18866
18867 It accepts the following values:
18868 @table @samp
18869 @item replace
18870 replace old rows with new ones.
18871 @item scroll
18872 scroll from top to bottom.
18873 @end table
18874 Default is @code{replace}.
18875 @end table
18876
18877 @section aphasemeter
18878
18879 Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
18880 representing mean phase of current audio frame. A video output can also be produced and is
18881 enabled by default. The audio is passed through as first output.
18882
18883 Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
18884 range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
18885 and @code{1} means channels are in phase.
18886
18887 The filter accepts the following options, all related to its video output:
18888
18889 @table @option
18890 @item rate, r
18891 Set the output frame rate. Default value is @code{25}.
18892
18893 @item size, s
18894 Set the video size for the output. For the syntax of this option, check the
18895 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18896 Default value is @code{800x400}.
18897
18898 @item rc
18899 @item gc
18900 @item bc
18901 Specify the red, green, blue contrast. Default values are @code{2},
18902 @code{7} and @code{1}.
18903 Allowed range is @code{[0, 255]}.
18904
18905 @item mpc
18906 Set color which will be used for drawing median phase. If color is
18907 @code{none} which is default, no median phase value will be drawn.
18908
18909 @item video
18910 Enable video output. Default is enabled.
18911 @end table
18912
18913 @section avectorscope
18914
18915 Convert input audio to a video output, representing the audio vector
18916 scope.
18917
18918 The filter is used to measure the difference between channels of stereo
18919 audio stream. A monoaural signal, consisting of identical left and right
18920 signal, results in straight vertical line. Any stereo separation is visible
18921 as a deviation from this line, creating a Lissajous figure.
18922 If the straight (or deviation from it) but horizontal line appears this
18923 indicates that the left and right channels are out of phase.
18924
18925 The filter accepts the following options:
18926
18927 @table @option
18928 @item mode, m
18929 Set the vectorscope mode.
18930
18931 Available values are:
18932 @table @samp
18933 @item lissajous
18934 Lissajous rotated by 45 degrees.
18935
18936 @item lissajous_xy
18937 Same as above but not rotated.
18938
18939 @item polar
18940 Shape resembling half of circle.
18941 @end table
18942
18943 Default value is @samp{lissajous}.
18944
18945 @item size, s
18946 Set the video size for the output. For the syntax of this option, check the
18947 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18948 Default value is @code{400x400}.
18949
18950 @item rate, r
18951 Set the output frame rate. Default value is @code{25}.
18952
18953 @item rc
18954 @item gc
18955 @item bc
18956 @item ac
18957 Specify the red, green, blue and alpha contrast. Default values are @code{40},
18958 @code{160}, @code{80} and @code{255}.
18959 Allowed range is @code{[0, 255]}.
18960
18961 @item rf
18962 @item gf
18963 @item bf
18964 @item af
18965 Specify the red, green, blue and alpha fade. Default values are @code{15},
18966 @code{10}, @code{5} and @code{5}.
18967 Allowed range is @code{[0, 255]}.
18968
18969 @item zoom
18970 Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
18971 Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
18972
18973 @item draw
18974 Set the vectorscope drawing mode.
18975
18976 Available values are:
18977 @table @samp
18978 @item dot
18979 Draw dot for each sample.
18980
18981 @item line
18982 Draw line between previous and current sample.
18983 @end table
18984
18985 Default value is @samp{dot}.
18986
18987 @item scale
18988 Specify amplitude scale of audio samples.
18989
18990 Available values are:
18991 @table @samp
18992 @item lin
18993 Linear.
18994
18995 @item sqrt
18996 Square root.
18997
18998 @item cbrt
18999 Cubic root.
19000
19001 @item log
19002 Logarithmic.
19003 @end table
19004
19005 @item swap
19006 Swap left channel axis with right channel axis.
19007
19008 @item mirror
19009 Mirror axis.
19010
19011 @table @samp
19012 @item none
19013 No mirror.
19014
19015 @item x
19016 Mirror only x axis.
19017
19018 @item y
19019 Mirror only y axis.
19020
19021 @item xy
19022 Mirror both axis.
19023 @end table
19024
19025 @end table
19026
19027 @subsection Examples
19028
19029 @itemize
19030 @item
19031 Complete example using @command{ffplay}:
19032 @example
19033 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
19034              [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
19035 @end example
19036 @end itemize
19037
19038 @section bench, abench
19039
19040 Benchmark part of a filtergraph.
19041
19042 The filter accepts the following options:
19043
19044 @table @option
19045 @item action
19046 Start or stop a timer.
19047
19048 Available values are:
19049 @table @samp
19050 @item start
19051 Get the current time, set it as frame metadata (using the key
19052 @code{lavfi.bench.start_time}), and forward the frame to the next filter.
19053
19054 @item stop
19055 Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
19056 the input frame metadata to get the time difference. Time difference, average,
19057 maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
19058 @code{min}) are then printed. The timestamps are expressed in seconds.
19059 @end table
19060 @end table
19061
19062 @subsection Examples
19063
19064 @itemize
19065 @item
19066 Benchmark @ref{selectivecolor} filter:
19067 @example
19068 bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
19069 @end example
19070 @end itemize
19071
19072 @section concat
19073
19074 Concatenate audio and video streams, joining them together one after the
19075 other.
19076
19077 The filter works on segments of synchronized video and audio streams. All
19078 segments must have the same number of streams of each type, and that will
19079 also be the number of streams at output.
19080
19081 The filter accepts the following options:
19082
19083 @table @option
19084
19085 @item n
19086 Set the number of segments. Default is 2.
19087
19088 @item v
19089 Set the number of output video streams, that is also the number of video
19090 streams in each segment. Default is 1.
19091
19092 @item a
19093 Set the number of output audio streams, that is also the number of audio
19094 streams in each segment. Default is 0.
19095
19096 @item unsafe
19097 Activate unsafe mode: do not fail if segments have a different format.
19098
19099 @end table
19100
19101 The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
19102 @var{a} audio outputs.
19103
19104 There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
19105 segment, in the same order as the outputs, then the inputs for the second
19106 segment, etc.
19107
19108 Related streams do not always have exactly the same duration, for various
19109 reasons including codec frame size or sloppy authoring. For that reason,
19110 related synchronized streams (e.g. a video and its audio track) should be
19111 concatenated at once. The concat filter will use the duration of the longest
19112 stream in each segment (except the last one), and if necessary pad shorter
19113 audio streams with silence.
19114
19115 For this filter to work correctly, all segments must start at timestamp 0.
19116
19117 All corresponding streams must have the same parameters in all segments; the
19118 filtering system will automatically select a common pixel format for video
19119 streams, and a common sample format, sample rate and channel layout for
19120 audio streams, but other settings, such as resolution, must be converted
19121 explicitly by the user.
19122
19123 Different frame rates are acceptable but will result in variable frame rate
19124 at output; be sure to configure the output file to handle it.
19125
19126 @subsection Examples
19127
19128 @itemize
19129 @item
19130 Concatenate an opening, an episode and an ending, all in bilingual version
19131 (video in stream 0, audio in streams 1 and 2):
19132 @example
19133 ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
19134   '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
19135    concat=n=3:v=1:a=2 [v] [a1] [a2]' \
19136   -map '[v]' -map '[a1]' -map '[a2]' output.mkv
19137 @end example
19138
19139 @item
19140 Concatenate two parts, handling audio and video separately, using the
19141 (a)movie sources, and adjusting the resolution:
19142 @example
19143 movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
19144 movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
19145 [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
19146 @end example
19147 Note that a desync will happen at the stitch if the audio and video streams
19148 do not have exactly the same duration in the first file.
19149
19150 @end itemize
19151
19152 @subsection Commands
19153
19154 This filter supports the following commands:
19155 @table @option
19156 @item next
19157 Close the current segment and step to the next one
19158 @end table
19159
19160 @section drawgraph, adrawgraph
19161
19162 Draw a graph using input video or audio metadata.
19163
19164 It accepts the following parameters:
19165
19166 @table @option
19167 @item m1
19168 Set 1st frame metadata key from which metadata values will be used to draw a graph.
19169
19170 @item fg1
19171 Set 1st foreground color expression.
19172
19173 @item m2
19174 Set 2nd frame metadata key from which metadata values will be used to draw a graph.
19175
19176 @item fg2
19177 Set 2nd foreground color expression.
19178
19179 @item m3
19180 Set 3rd frame metadata key from which metadata values will be used to draw a graph.
19181
19182 @item fg3
19183 Set 3rd foreground color expression.
19184
19185 @item m4
19186 Set 4th frame metadata key from which metadata values will be used to draw a graph.
19187
19188 @item fg4
19189 Set 4th foreground color expression.
19190
19191 @item min
19192 Set minimal value of metadata value.
19193
19194 @item max
19195 Set maximal value of metadata value.
19196
19197 @item bg
19198 Set graph background color. Default is white.
19199
19200 @item mode
19201 Set graph mode.
19202
19203 Available values for mode is:
19204 @table @samp
19205 @item bar
19206 @item dot
19207 @item line
19208 @end table
19209
19210 Default is @code{line}.
19211
19212 @item slide
19213 Set slide mode.
19214
19215 Available values for slide is:
19216 @table @samp
19217 @item frame
19218 Draw new frame when right border is reached.
19219
19220 @item replace
19221 Replace old columns with new ones.
19222
19223 @item scroll
19224 Scroll from right to left.
19225
19226 @item rscroll
19227 Scroll from left to right.
19228
19229 @item picture
19230 Draw single picture.
19231 @end table
19232
19233 Default is @code{frame}.
19234
19235 @item size
19236 Set size of graph video. For the syntax of this option, check the
19237 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19238 The default value is @code{900x256}.
19239
19240 The foreground color expressions can use the following variables:
19241 @table @option
19242 @item MIN
19243 Minimal value of metadata value.
19244
19245 @item MAX
19246 Maximal value of metadata value.
19247
19248 @item VAL
19249 Current metadata key value.
19250 @end table
19251
19252 The color is defined as 0xAABBGGRR.
19253 @end table
19254
19255 Example using metadata from @ref{signalstats} filter:
19256 @example
19257 signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
19258 @end example
19259
19260 Example using metadata from @ref{ebur128} filter:
19261 @example
19262 ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
19263 @end example
19264
19265 @anchor{ebur128}
19266 @section ebur128
19267
19268 EBU R128 scanner filter. This filter takes an audio stream as input and outputs
19269 it unchanged. By default, it logs a message at a frequency of 10Hz with the
19270 Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
19271 Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
19272
19273 The filter also has a video output (see the @var{video} option) with a real
19274 time graph to observe the loudness evolution. The graphic contains the logged
19275 message mentioned above, so it is not printed anymore when this option is set,
19276 unless the verbose logging is set. The main graphing area contains the
19277 short-term loudness (3 seconds of analysis), and the gauge on the right is for
19278 the momentary loudness (400 milliseconds).
19279
19280 More information about the Loudness Recommendation EBU R128 on
19281 @url{http://tech.ebu.ch/loudness}.
19282
19283 The filter accepts the following options:
19284
19285 @table @option
19286
19287 @item video
19288 Activate the video output. The audio stream is passed unchanged whether this
19289 option is set or no. The video stream will be the first output stream if
19290 activated. Default is @code{0}.
19291
19292 @item size
19293 Set the video size. This option is for video only. For the syntax of this
19294 option, check the
19295 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19296 Default and minimum resolution is @code{640x480}.
19297
19298 @item meter
19299 Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
19300 @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
19301 other integer value between this range is allowed.
19302
19303 @item metadata
19304 Set metadata injection. If set to @code{1}, the audio input will be segmented
19305 into 100ms output frames, each of them containing various loudness information
19306 in metadata.  All the metadata keys are prefixed with @code{lavfi.r128.}.
19307
19308 Default is @code{0}.
19309
19310 @item framelog
19311 Force the frame logging level.
19312
19313 Available values are:
19314 @table @samp
19315 @item info
19316 information logging level
19317 @item verbose
19318 verbose logging level
19319 @end table
19320
19321 By default, the logging level is set to @var{info}. If the @option{video} or
19322 the @option{metadata} options are set, it switches to @var{verbose}.
19323
19324 @item peak
19325 Set peak mode(s).
19326
19327 Available modes can be cumulated (the option is a @code{flag} type). Possible
19328 values are:
19329 @table @samp
19330 @item none
19331 Disable any peak mode (default).
19332 @item sample
19333 Enable sample-peak mode.
19334
19335 Simple peak mode looking for the higher sample value. It logs a message
19336 for sample-peak (identified by @code{SPK}).
19337 @item true
19338 Enable true-peak mode.
19339
19340 If enabled, the peak lookup is done on an over-sampled version of the input
19341 stream for better peak accuracy. It logs a message for true-peak.
19342 (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
19343 This mode requires a build with @code{libswresample}.
19344 @end table
19345
19346 @item dualmono
19347 Treat mono input files as "dual mono". If a mono file is intended for playback
19348 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
19349 If set to @code{true}, this option will compensate for this effect.
19350 Multi-channel input files are not affected by this option.
19351
19352 @item panlaw
19353 Set a specific pan law to be used for the measurement of dual mono files.
19354 This parameter is optional, and has a default value of -3.01dB.
19355 @end table
19356
19357 @subsection Examples
19358
19359 @itemize
19360 @item
19361 Real-time graph using @command{ffplay}, with a EBU scale meter +18:
19362 @example
19363 ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
19364 @end example
19365
19366 @item
19367 Run an analysis with @command{ffmpeg}:
19368 @example
19369 ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
19370 @end example
19371 @end itemize
19372
19373 @section interleave, ainterleave
19374
19375 Temporally interleave frames from several inputs.
19376
19377 @code{interleave} works with video inputs, @code{ainterleave} with audio.
19378
19379 These filters read frames from several inputs and send the oldest
19380 queued frame to the output.
19381
19382 Input streams must have well defined, monotonically increasing frame
19383 timestamp values.
19384
19385 In order to submit one frame to output, these filters need to enqueue
19386 at least one frame for each input, so they cannot work in case one
19387 input is not yet terminated and will not receive incoming frames.
19388
19389 For example consider the case when one input is a @code{select} filter
19390 which always drops input frames. The @code{interleave} filter will keep
19391 reading from that input, but it will never be able to send new frames
19392 to output until the input sends an end-of-stream signal.
19393
19394 Also, depending on inputs synchronization, the filters will drop
19395 frames in case one input receives more frames than the other ones, and
19396 the queue is already filled.
19397
19398 These filters accept the following options:
19399
19400 @table @option
19401 @item nb_inputs, n
19402 Set the number of different inputs, it is 2 by default.
19403 @end table
19404
19405 @subsection Examples
19406
19407 @itemize
19408 @item
19409 Interleave frames belonging to different streams using @command{ffmpeg}:
19410 @example
19411 ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
19412 @end example
19413
19414 @item
19415 Add flickering blur effect:
19416 @example
19417 select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
19418 @end example
19419 @end itemize
19420
19421 @section metadata, ametadata
19422
19423 Manipulate frame metadata.
19424
19425 This filter accepts the following options:
19426
19427 @table @option
19428 @item mode
19429 Set mode of operation of the filter.
19430
19431 Can be one of the following:
19432
19433 @table @samp
19434 @item select
19435 If both @code{value} and @code{key} is set, select frames
19436 which have such metadata. If only @code{key} is set, select
19437 every frame that has such key in metadata.
19438
19439 @item add
19440 Add new metadata @code{key} and @code{value}. If key is already available
19441 do nothing.
19442
19443 @item modify
19444 Modify value of already present key.
19445
19446 @item delete
19447 If @code{value} is set, delete only keys that have such value.
19448 Otherwise, delete key. If @code{key} is not set, delete all metadata values in
19449 the frame.
19450
19451 @item print
19452 Print key and its value if metadata was found. If @code{key} is not set print all
19453 metadata values available in frame.
19454 @end table
19455
19456 @item key
19457 Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
19458
19459 @item value
19460 Set metadata value which will be used. This option is mandatory for
19461 @code{modify} and @code{add} mode.
19462
19463 @item function
19464 Which function to use when comparing metadata value and @code{value}.
19465
19466 Can be one of following:
19467
19468 @table @samp
19469 @item same_str
19470 Values are interpreted as strings, returns true if metadata value is same as @code{value}.
19471
19472 @item starts_with
19473 Values are interpreted as strings, returns true if metadata value starts with
19474 the @code{value} option string.
19475
19476 @item less
19477 Values are interpreted as floats, returns true if metadata value is less than @code{value}.
19478
19479 @item equal
19480 Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
19481
19482 @item greater
19483 Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
19484
19485 @item expr
19486 Values are interpreted as floats, returns true if expression from option @code{expr}
19487 evaluates to true.
19488 @end table
19489
19490 @item expr
19491 Set expression which is used when @code{function} is set to @code{expr}.
19492 The expression is evaluated through the eval API and can contain the following
19493 constants:
19494
19495 @table @option
19496 @item VALUE1
19497 Float representation of @code{value} from metadata key.
19498
19499 @item VALUE2
19500 Float representation of @code{value} as supplied by user in @code{value} option.
19501 @end table
19502
19503 @item file
19504 If specified in @code{print} mode, output is written to the named file. Instead of
19505 plain filename any writable url can be specified. Filename ``-'' is a shorthand
19506 for standard output. If @code{file} option is not set, output is written to the log
19507 with AV_LOG_INFO loglevel.
19508
19509 @end table
19510
19511 @subsection Examples
19512
19513 @itemize
19514 @item
19515 Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
19516 between 0 and 1.
19517 @example
19518 signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
19519 @end example
19520 @item
19521 Print silencedetect output to file @file{metadata.txt}.
19522 @example
19523 silencedetect,ametadata=mode=print:file=metadata.txt
19524 @end example
19525 @item
19526 Direct all metadata to a pipe with file descriptor 4.
19527 @example
19528 metadata=mode=print:file='pipe\:4'
19529 @end example
19530 @end itemize
19531
19532 @section perms, aperms
19533
19534 Set read/write permissions for the output frames.
19535
19536 These filters are mainly aimed at developers to test direct path in the
19537 following filter in the filtergraph.
19538
19539 The filters accept the following options:
19540
19541 @table @option
19542 @item mode
19543 Select the permissions mode.
19544
19545 It accepts the following values:
19546 @table @samp
19547 @item none
19548 Do nothing. This is the default.
19549 @item ro
19550 Set all the output frames read-only.
19551 @item rw
19552 Set all the output frames directly writable.
19553 @item toggle
19554 Make the frame read-only if writable, and writable if read-only.
19555 @item random
19556 Set each output frame read-only or writable randomly.
19557 @end table
19558
19559 @item seed
19560 Set the seed for the @var{random} mode, must be an integer included between
19561 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
19562 @code{-1}, the filter will try to use a good random seed on a best effort
19563 basis.
19564 @end table
19565
19566 Note: in case of auto-inserted filter between the permission filter and the
19567 following one, the permission might not be received as expected in that
19568 following filter. Inserting a @ref{format} or @ref{aformat} filter before the
19569 perms/aperms filter can avoid this problem.
19570
19571 @section realtime, arealtime
19572
19573 Slow down filtering to match real time approximately.
19574
19575 These filters will pause the filtering for a variable amount of time to
19576 match the output rate with the input timestamps.
19577 They are similar to the @option{re} option to @code{ffmpeg}.
19578
19579 They accept the following options:
19580
19581 @table @option
19582 @item limit
19583 Time limit for the pauses. Any pause longer than that will be considered
19584 a timestamp discontinuity and reset the timer. Default is 2 seconds.
19585 @end table
19586
19587 @anchor{select}
19588 @section select, aselect
19589
19590 Select frames to pass in output.
19591
19592 This filter accepts the following options:
19593
19594 @table @option
19595
19596 @item expr, e
19597 Set expression, which is evaluated for each input frame.
19598
19599 If the expression is evaluated to zero, the frame is discarded.
19600
19601 If the evaluation result is negative or NaN, the frame is sent to the
19602 first output; otherwise it is sent to the output with index
19603 @code{ceil(val)-1}, assuming that the input index starts from 0.
19604
19605 For example a value of @code{1.2} corresponds to the output with index
19606 @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
19607
19608 @item outputs, n
19609 Set the number of outputs. The output to which to send the selected
19610 frame is based on the result of the evaluation. Default value is 1.
19611 @end table
19612
19613 The expression can contain the following constants:
19614
19615 @table @option
19616 @item n
19617 The (sequential) number of the filtered frame, starting from 0.
19618
19619 @item selected_n
19620 The (sequential) number of the selected frame, starting from 0.
19621
19622 @item prev_selected_n
19623 The sequential number of the last selected frame. It's NAN if undefined.
19624
19625 @item TB
19626 The timebase of the input timestamps.
19627
19628 @item pts
19629 The PTS (Presentation TimeStamp) of the filtered video frame,
19630 expressed in @var{TB} units. It's NAN if undefined.
19631
19632 @item t
19633 The PTS of the filtered video frame,
19634 expressed in seconds. It's NAN if undefined.
19635
19636 @item prev_pts
19637 The PTS of the previously filtered video frame. It's NAN if undefined.
19638
19639 @item prev_selected_pts
19640 The PTS of the last previously filtered video frame. It's NAN if undefined.
19641
19642 @item prev_selected_t
19643 The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
19644
19645 @item start_pts
19646 The PTS of the first video frame in the video. It's NAN if undefined.
19647
19648 @item start_t
19649 The time of the first video frame in the video. It's NAN if undefined.
19650
19651 @item pict_type @emph{(video only)}
19652 The type of the filtered frame. It can assume one of the following
19653 values:
19654 @table @option
19655 @item I
19656 @item P
19657 @item B
19658 @item S
19659 @item SI
19660 @item SP
19661 @item BI
19662 @end table
19663
19664 @item interlace_type @emph{(video only)}
19665 The frame interlace type. It can assume one of the following values:
19666 @table @option
19667 @item PROGRESSIVE
19668 The frame is progressive (not interlaced).
19669 @item TOPFIRST
19670 The frame is top-field-first.
19671 @item BOTTOMFIRST
19672 The frame is bottom-field-first.
19673 @end table
19674
19675 @item consumed_sample_n @emph{(audio only)}
19676 the number of selected samples before the current frame
19677
19678 @item samples_n @emph{(audio only)}
19679 the number of samples in the current frame
19680
19681 @item sample_rate @emph{(audio only)}
19682 the input sample rate
19683
19684 @item key
19685 This is 1 if the filtered frame is a key-frame, 0 otherwise.
19686
19687 @item pos
19688 the position in the file of the filtered frame, -1 if the information
19689 is not available (e.g. for synthetic video)
19690
19691 @item scene @emph{(video only)}
19692 value between 0 and 1 to indicate a new scene; a low value reflects a low
19693 probability for the current frame to introduce a new scene, while a higher
19694 value means the current frame is more likely to be one (see the example below)
19695
19696 @item concatdec_select
19697 The concat demuxer can select only part of a concat input file by setting an
19698 inpoint and an outpoint, but the output packets may not be entirely contained
19699 in the selected interval. By using this variable, it is possible to skip frames
19700 generated by the concat demuxer which are not exactly contained in the selected
19701 interval.
19702
19703 This works by comparing the frame pts against the @var{lavf.concat.start_time}
19704 and the @var{lavf.concat.duration} packet metadata values which are also
19705 present in the decoded frames.
19706
19707 The @var{concatdec_select} variable is -1 if the frame pts is at least
19708 start_time and either the duration metadata is missing or the frame pts is less
19709 than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
19710 missing.
19711
19712 That basically means that an input frame is selected if its pts is within the
19713 interval set by the concat demuxer.
19714
19715 @end table
19716
19717 The default value of the select expression is "1".
19718
19719 @subsection Examples
19720
19721 @itemize
19722 @item
19723 Select all frames in input:
19724 @example
19725 select
19726 @end example
19727
19728 The example above is the same as:
19729 @example
19730 select=1
19731 @end example
19732
19733 @item
19734 Skip all frames:
19735 @example
19736 select=0
19737 @end example
19738
19739 @item
19740 Select only I-frames:
19741 @example
19742 select='eq(pict_type\,I)'
19743 @end example
19744
19745 @item
19746 Select one frame every 100:
19747 @example
19748 select='not(mod(n\,100))'
19749 @end example
19750
19751 @item
19752 Select only frames contained in the 10-20 time interval:
19753 @example
19754 select=between(t\,10\,20)
19755 @end example
19756
19757 @item
19758 Select only I-frames contained in the 10-20 time interval:
19759 @example
19760 select=between(t\,10\,20)*eq(pict_type\,I)
19761 @end example
19762
19763 @item
19764 Select frames with a minimum distance of 10 seconds:
19765 @example
19766 select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
19767 @end example
19768
19769 @item
19770 Use aselect to select only audio frames with samples number > 100:
19771 @example
19772 aselect='gt(samples_n\,100)'
19773 @end example
19774
19775 @item
19776 Create a mosaic of the first scenes:
19777 @example
19778 ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
19779 @end example
19780
19781 Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
19782 choice.
19783
19784 @item
19785 Send even and odd frames to separate outputs, and compose them:
19786 @example
19787 select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
19788 @end example
19789
19790 @item
19791 Select useful frames from an ffconcat file which is using inpoints and
19792 outpoints but where the source files are not intra frame only.
19793 @example
19794 ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
19795 @end example
19796 @end itemize
19797
19798 @section sendcmd, asendcmd
19799
19800 Send commands to filters in the filtergraph.
19801
19802 These filters read commands to be sent to other filters in the
19803 filtergraph.
19804
19805 @code{sendcmd} must be inserted between two video filters,
19806 @code{asendcmd} must be inserted between two audio filters, but apart
19807 from that they act the same way.
19808
19809 The specification of commands can be provided in the filter arguments
19810 with the @var{commands} option, or in a file specified by the
19811 @var{filename} option.
19812
19813 These filters accept the following options:
19814 @table @option
19815 @item commands, c
19816 Set the commands to be read and sent to the other filters.
19817 @item filename, f
19818 Set the filename of the commands to be read and sent to the other
19819 filters.
19820 @end table
19821
19822 @subsection Commands syntax
19823
19824 A commands description consists of a sequence of interval
19825 specifications, comprising a list of commands to be executed when a
19826 particular event related to that interval occurs. The occurring event
19827 is typically the current frame time entering or leaving a given time
19828 interval.
19829
19830 An interval is specified by the following syntax:
19831 @example
19832 @var{START}[-@var{END}] @var{COMMANDS};
19833 @end example
19834
19835 The time interval is specified by the @var{START} and @var{END} times.
19836 @var{END} is optional and defaults to the maximum time.
19837
19838 The current frame time is considered within the specified interval if
19839 it is included in the interval [@var{START}, @var{END}), that is when
19840 the time is greater or equal to @var{START} and is lesser than
19841 @var{END}.
19842
19843 @var{COMMANDS} consists of a sequence of one or more command
19844 specifications, separated by ",", relating to that interval.  The
19845 syntax of a command specification is given by:
19846 @example
19847 [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
19848 @end example
19849
19850 @var{FLAGS} is optional and specifies the type of events relating to
19851 the time interval which enable sending the specified command, and must
19852 be a non-null sequence of identifier flags separated by "+" or "|" and
19853 enclosed between "[" and "]".
19854
19855 The following flags are recognized:
19856 @table @option
19857 @item enter
19858 The command is sent when the current frame timestamp enters the
19859 specified interval. In other words, the command is sent when the
19860 previous frame timestamp was not in the given interval, and the
19861 current is.
19862
19863 @item leave
19864 The command is sent when the current frame timestamp leaves the
19865 specified interval. In other words, the command is sent when the
19866 previous frame timestamp was in the given interval, and the
19867 current is not.
19868 @end table
19869
19870 If @var{FLAGS} is not specified, a default value of @code{[enter]} is
19871 assumed.
19872
19873 @var{TARGET} specifies the target of the command, usually the name of
19874 the filter class or a specific filter instance name.
19875
19876 @var{COMMAND} specifies the name of the command for the target filter.
19877
19878 @var{ARG} is optional and specifies the optional list of argument for
19879 the given @var{COMMAND}.
19880
19881 Between one interval specification and another, whitespaces, or
19882 sequences of characters starting with @code{#} until the end of line,
19883 are ignored and can be used to annotate comments.
19884
19885 A simplified BNF description of the commands specification syntax
19886 follows:
19887 @example
19888 @var{COMMAND_FLAG}  ::= "enter" | "leave"
19889 @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
19890 @var{COMMAND}       ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
19891 @var{COMMANDS}      ::= @var{COMMAND} [,@var{COMMANDS}]
19892 @var{INTERVAL}      ::= @var{START}[-@var{END}] @var{COMMANDS}
19893 @var{INTERVALS}     ::= @var{INTERVAL}[;@var{INTERVALS}]
19894 @end example
19895
19896 @subsection Examples
19897
19898 @itemize
19899 @item
19900 Specify audio tempo change at second 4:
19901 @example
19902 asendcmd=c='4.0 atempo tempo 1.5',atempo
19903 @end example
19904
19905 @item
19906 Target a specific filter instance:
19907 @example
19908 asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
19909 @end example
19910
19911 @item
19912 Specify a list of drawtext and hue commands in a file.
19913 @example
19914 # show text in the interval 5-10
19915 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
19916          [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
19917
19918 # desaturate the image in the interval 15-20
19919 15.0-20.0 [enter] hue s 0,
19920           [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
19921           [leave] hue s 1,
19922           [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
19923
19924 # apply an exponential saturation fade-out effect, starting from time 25
19925 25 [enter] hue s exp(25-t)
19926 @end example
19927
19928 A filtergraph allowing to read and process the above command list
19929 stored in a file @file{test.cmd}, can be specified with:
19930 @example
19931 sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
19932 @end example
19933 @end itemize
19934
19935 @anchor{setpts}
19936 @section setpts, asetpts
19937
19938 Change the PTS (presentation timestamp) of the input frames.
19939
19940 @code{setpts} works on video frames, @code{asetpts} on audio frames.
19941
19942 This filter accepts the following options:
19943
19944 @table @option
19945
19946 @item expr
19947 The expression which is evaluated for each frame to construct its timestamp.
19948
19949 @end table
19950
19951 The expression is evaluated through the eval API and can contain the following
19952 constants:
19953
19954 @table @option
19955 @item FRAME_RATE, FR
19956 frame rate, only defined for constant frame-rate video
19957
19958 @item PTS
19959 The presentation timestamp in input
19960
19961 @item N
19962 The count of the input frame for video or the number of consumed samples,
19963 not including the current frame for audio, starting from 0.
19964
19965 @item NB_CONSUMED_SAMPLES
19966 The number of consumed samples, not including the current frame (only
19967 audio)
19968
19969 @item NB_SAMPLES, S
19970 The number of samples in the current frame (only audio)
19971
19972 @item SAMPLE_RATE, SR
19973 The audio sample rate.
19974
19975 @item STARTPTS
19976 The PTS of the first frame.
19977
19978 @item STARTT
19979 the time in seconds of the first frame
19980
19981 @item INTERLACED
19982 State whether the current frame is interlaced.
19983
19984 @item T
19985 the time in seconds of the current frame
19986
19987 @item POS
19988 original position in the file of the frame, or undefined if undefined
19989 for the current frame
19990
19991 @item PREV_INPTS
19992 The previous input PTS.
19993
19994 @item PREV_INT
19995 previous input time in seconds
19996
19997 @item PREV_OUTPTS
19998 The previous output PTS.
19999
20000 @item PREV_OUTT
20001 previous output time in seconds
20002
20003 @item RTCTIME
20004 The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
20005 instead.
20006
20007 @item RTCSTART
20008 The wallclock (RTC) time at the start of the movie in microseconds.
20009
20010 @item TB
20011 The timebase of the input timestamps.
20012
20013 @end table
20014
20015 @subsection Examples
20016
20017 @itemize
20018 @item
20019 Start counting PTS from zero
20020 @example
20021 setpts=PTS-STARTPTS
20022 @end example
20023
20024 @item
20025 Apply fast motion effect:
20026 @example
20027 setpts=0.5*PTS
20028 @end example
20029
20030 @item
20031 Apply slow motion effect:
20032 @example
20033 setpts=2.0*PTS
20034 @end example
20035
20036 @item
20037 Set fixed rate of 25 frames per second:
20038 @example
20039 setpts=N/(25*TB)
20040 @end example
20041
20042 @item
20043 Set fixed rate 25 fps with some jitter:
20044 @example
20045 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
20046 @end example
20047
20048 @item
20049 Apply an offset of 10 seconds to the input PTS:
20050 @example
20051 setpts=PTS+10/TB
20052 @end example
20053
20054 @item
20055 Generate timestamps from a "live source" and rebase onto the current timebase:
20056 @example
20057 setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
20058 @end example
20059
20060 @item
20061 Generate timestamps by counting samples:
20062 @example
20063 asetpts=N/SR/TB
20064 @end example
20065
20066 @end itemize
20067
20068 @section setrange
20069
20070 Force color range for the output video frame.
20071
20072 The @code{setrange} filter marks the color range property for the
20073 output frames. It does not change the input frame, but only sets the
20074 corresponding property, which affects how the frame is treated by
20075 following filters.
20076
20077 The filter accepts the following options:
20078
20079 @table @option
20080
20081 @item range
20082 Available values are:
20083
20084 @table @samp
20085 @item auto
20086 Keep the same color range property.
20087
20088 @item unspecified, unknown
20089 Set the color range as unspecified.
20090
20091 @item limited, tv, mpeg
20092 Set the color range as limited.
20093
20094 @item full, pc, jpeg
20095 Set the color range as full.
20096 @end table
20097 @end table
20098
20099 @section settb, asettb
20100
20101 Set the timebase to use for the output frames timestamps.
20102 It is mainly useful for testing timebase configuration.
20103
20104 It accepts the following parameters:
20105
20106 @table @option
20107
20108 @item expr, tb
20109 The expression which is evaluated into the output timebase.
20110
20111 @end table
20112
20113 The value for @option{tb} is an arithmetic expression representing a
20114 rational. The expression can contain the constants "AVTB" (the default
20115 timebase), "intb" (the input timebase) and "sr" (the sample rate,
20116 audio only). Default value is "intb".
20117
20118 @subsection Examples
20119
20120 @itemize
20121 @item
20122 Set the timebase to 1/25:
20123 @example
20124 settb=expr=1/25
20125 @end example
20126
20127 @item
20128 Set the timebase to 1/10:
20129 @example
20130 settb=expr=0.1
20131 @end example
20132
20133 @item
20134 Set the timebase to 1001/1000:
20135 @example
20136 settb=1+0.001
20137 @end example
20138
20139 @item
20140 Set the timebase to 2*intb:
20141 @example
20142 settb=2*intb
20143 @end example
20144
20145 @item
20146 Set the default timebase value:
20147 @example
20148 settb=AVTB
20149 @end example
20150 @end itemize
20151
20152 @section showcqt
20153 Convert input audio to a video output representing frequency spectrum
20154 logarithmically using Brown-Puckette constant Q transform algorithm with
20155 direct frequency domain coefficient calculation (but the transform itself
20156 is not really constant Q, instead the Q factor is actually variable/clamped),
20157 with musical tone scale, from E0 to D#10.
20158
20159 The filter accepts the following options:
20160
20161 @table @option
20162 @item size, s
20163 Specify the video size for the output. It must be even. For the syntax of this option,
20164 check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20165 Default value is @code{1920x1080}.
20166
20167 @item fps, rate, r
20168 Set the output frame rate. Default value is @code{25}.
20169
20170 @item bar_h
20171 Set the bargraph height. It must be even. Default value is @code{-1} which
20172 computes the bargraph height automatically.
20173
20174 @item axis_h
20175 Set the axis height. It must be even. Default value is @code{-1} which computes
20176 the axis height automatically.
20177
20178 @item sono_h
20179 Set the sonogram height. It must be even. Default value is @code{-1} which
20180 computes the sonogram height automatically.
20181
20182 @item fullhd
20183 Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
20184 instead. Default value is @code{1}.
20185
20186 @item sono_v, volume
20187 Specify the sonogram volume expression. It can contain variables:
20188 @table @option
20189 @item bar_v
20190 the @var{bar_v} evaluated expression
20191 @item frequency, freq, f
20192 the frequency where it is evaluated
20193 @item timeclamp, tc
20194 the value of @var{timeclamp} option
20195 @end table
20196 and functions:
20197 @table @option
20198 @item a_weighting(f)
20199 A-weighting of equal loudness
20200 @item b_weighting(f)
20201 B-weighting of equal loudness
20202 @item c_weighting(f)
20203 C-weighting of equal loudness.
20204 @end table
20205 Default value is @code{16}.
20206
20207 @item bar_v, volume2
20208 Specify the bargraph volume expression. It can contain variables:
20209 @table @option
20210 @item sono_v
20211 the @var{sono_v} evaluated expression
20212 @item frequency, freq, f
20213 the frequency where it is evaluated
20214 @item timeclamp, tc
20215 the value of @var{timeclamp} option
20216 @end table
20217 and functions:
20218 @table @option
20219 @item a_weighting(f)
20220 A-weighting of equal loudness
20221 @item b_weighting(f)
20222 B-weighting of equal loudness
20223 @item c_weighting(f)
20224 C-weighting of equal loudness.
20225 @end table
20226 Default value is @code{sono_v}.
20227
20228 @item sono_g, gamma
20229 Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
20230 higher gamma makes the spectrum having more range. Default value is @code{3}.
20231 Acceptable range is @code{[1, 7]}.
20232
20233 @item bar_g, gamma2
20234 Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
20235 @code{[1, 7]}.
20236
20237 @item bar_t
20238 Specify the bargraph transparency level. Lower value makes the bargraph sharper.
20239 Default value is @code{1}. Acceptable range is @code{[0, 1]}.
20240
20241 @item timeclamp, tc
20242 Specify the transform timeclamp. At low frequency, there is trade-off between
20243 accuracy in time domain and frequency domain. If timeclamp is lower,
20244 event in time domain is represented more accurately (such as fast bass drum),
20245 otherwise event in frequency domain is represented more accurately
20246 (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
20247
20248 @item attack
20249 Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
20250 limits future samples by applying asymmetric windowing in time domain, useful
20251 when low latency is required. Accepted range is @code{[0, 1]}.
20252
20253 @item basefreq
20254 Specify the transform base frequency. Default value is @code{20.01523126408007475},
20255 which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
20256
20257 @item endfreq
20258 Specify the transform end frequency. Default value is @code{20495.59681441799654},
20259 which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
20260
20261 @item coeffclamp
20262 This option is deprecated and ignored.
20263
20264 @item tlength
20265 Specify the transform length in time domain. Use this option to control accuracy
20266 trade-off between time domain and frequency domain at every frequency sample.
20267 It can contain variables:
20268 @table @option
20269 @item frequency, freq, f
20270 the frequency where it is evaluated
20271 @item timeclamp, tc
20272 the value of @var{timeclamp} option.
20273 @end table
20274 Default value is @code{384*tc/(384+tc*f)}.
20275
20276 @item count
20277 Specify the transform count for every video frame. Default value is @code{6}.
20278 Acceptable range is @code{[1, 30]}.
20279
20280 @item fcount
20281 Specify the transform count for every single pixel. Default value is @code{0},
20282 which makes it computed automatically. Acceptable range is @code{[0, 10]}.
20283
20284 @item fontfile
20285 Specify font file for use with freetype to draw the axis. If not specified,
20286 use embedded font. Note that drawing with font file or embedded font is not
20287 implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
20288 option instead.
20289
20290 @item font
20291 Specify fontconfig pattern. This has lower priority than @var{fontfile}.
20292 The : in the pattern may be replaced by | to avoid unnecessary escaping.
20293
20294 @item fontcolor
20295 Specify font color expression. This is arithmetic expression that should return
20296 integer value 0xRRGGBB. It can contain variables:
20297 @table @option
20298 @item frequency, freq, f
20299 the frequency where it is evaluated
20300 @item timeclamp, tc
20301 the value of @var{timeclamp} option
20302 @end table
20303 and functions:
20304 @table @option
20305 @item midi(f)
20306 midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
20307 @item r(x), g(x), b(x)
20308 red, green, and blue value of intensity x.
20309 @end table
20310 Default value is @code{st(0, (midi(f)-59.5)/12);
20311 st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
20312 r(1-ld(1)) + b(ld(1))}.
20313
20314 @item axisfile
20315 Specify image file to draw the axis. This option override @var{fontfile} and
20316 @var{fontcolor} option.
20317
20318 @item axis, text
20319 Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
20320 the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
20321 Default value is @code{1}.
20322
20323 @item csp
20324 Set colorspace. The accepted values are:
20325 @table @samp
20326 @item unspecified
20327 Unspecified (default)
20328
20329 @item bt709
20330 BT.709
20331
20332 @item fcc
20333 FCC
20334
20335 @item bt470bg
20336 BT.470BG or BT.601-6 625
20337
20338 @item smpte170m
20339 SMPTE-170M or BT.601-6 525
20340
20341 @item smpte240m
20342 SMPTE-240M
20343
20344 @item bt2020ncl
20345 BT.2020 with non-constant luminance
20346
20347 @end table
20348
20349 @item cscheme
20350 Set spectrogram color scheme. This is list of floating point values with format
20351 @code{left_r|left_g|left_b|right_r|right_g|right_b}.
20352 The default is @code{1|0.5|0|0|0.5|1}.
20353
20354 @end table
20355
20356 @subsection Examples
20357
20358 @itemize
20359 @item
20360 Playing audio while showing the spectrum:
20361 @example
20362 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
20363 @end example
20364
20365 @item
20366 Same as above, but with frame rate 30 fps:
20367 @example
20368 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
20369 @end example
20370
20371 @item
20372 Playing at 1280x720:
20373 @example
20374 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
20375 @end example
20376
20377 @item
20378 Disable sonogram display:
20379 @example
20380 sono_h=0
20381 @end example
20382
20383 @item
20384 A1 and its harmonics: A1, A2, (near)E3, A3:
20385 @example
20386 ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
20387                  asplit[a][out1]; [a] showcqt [out0]'
20388 @end example
20389
20390 @item
20391 Same as above, but with more accuracy in frequency domain:
20392 @example
20393 ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
20394                  asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
20395 @end example
20396
20397 @item
20398 Custom volume:
20399 @example
20400 bar_v=10:sono_v=bar_v*a_weighting(f)
20401 @end example
20402
20403 @item
20404 Custom gamma, now spectrum is linear to the amplitude.
20405 @example
20406 bar_g=2:sono_g=2
20407 @end example
20408
20409 @item
20410 Custom tlength equation:
20411 @example
20412 tc=0.33:tlength='st(0,0.17); 384*tc / (384 / ld(0) + tc*f /(1-ld(0))) + 384*tc / (tc*f / ld(0) + 384 /(1-ld(0)))'
20413 @end example
20414
20415 @item
20416 Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
20417 @example
20418 fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
20419 @end example
20420
20421 @item
20422 Custom font using fontconfig:
20423 @example
20424 font='Courier New,Monospace,mono|bold'
20425 @end example
20426
20427 @item
20428 Custom frequency range with custom axis using image file:
20429 @example
20430 axisfile=myaxis.png:basefreq=40:endfreq=10000
20431 @end example
20432 @end itemize
20433
20434 @section showfreqs
20435
20436 Convert input audio to video output representing the audio power spectrum.
20437 Audio amplitude is on Y-axis while frequency is on X-axis.
20438
20439 The filter accepts the following options:
20440
20441 @table @option
20442 @item size, s
20443 Specify size of video. For the syntax of this option, check the
20444 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20445 Default is @code{1024x512}.
20446
20447 @item mode
20448 Set display mode.
20449 This set how each frequency bin will be represented.
20450
20451 It accepts the following values:
20452 @table @samp
20453 @item line
20454 @item bar
20455 @item dot
20456 @end table
20457 Default is @code{bar}.
20458
20459 @item ascale
20460 Set amplitude scale.
20461
20462 It accepts the following values:
20463 @table @samp
20464 @item lin
20465 Linear scale.
20466
20467 @item sqrt
20468 Square root scale.
20469
20470 @item cbrt
20471 Cubic root scale.
20472
20473 @item log
20474 Logarithmic scale.
20475 @end table
20476 Default is @code{log}.
20477
20478 @item fscale
20479 Set frequency scale.
20480
20481 It accepts the following values:
20482 @table @samp
20483 @item lin
20484 Linear scale.
20485
20486 @item log
20487 Logarithmic scale.
20488
20489 @item rlog
20490 Reverse logarithmic scale.
20491 @end table
20492 Default is @code{lin}.
20493
20494 @item win_size
20495 Set window size.
20496
20497 It accepts the following values:
20498 @table @samp
20499 @item w16
20500 @item w32
20501 @item w64
20502 @item w128
20503 @item w256
20504 @item w512
20505 @item w1024
20506 @item w2048
20507 @item w4096
20508 @item w8192
20509 @item w16384
20510 @item w32768
20511 @item w65536
20512 @end table
20513 Default is @code{w2048}
20514
20515 @item win_func
20516 Set windowing function.
20517
20518 It accepts the following values:
20519 @table @samp
20520 @item rect
20521 @item bartlett
20522 @item hanning
20523 @item hamming
20524 @item blackman
20525 @item welch
20526 @item flattop
20527 @item bharris
20528 @item bnuttall
20529 @item bhann
20530 @item sine
20531 @item nuttall
20532 @item lanczos
20533 @item gauss
20534 @item tukey
20535 @item dolph
20536 @item cauchy
20537 @item parzen
20538 @item poisson
20539 @end table
20540 Default is @code{hanning}.
20541
20542 @item overlap
20543 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
20544 which means optimal overlap for selected window function will be picked.
20545
20546 @item averaging
20547 Set time averaging. Setting this to 0 will display current maximal peaks.
20548 Default is @code{1}, which means time averaging is disabled.
20549
20550 @item colors
20551 Specify list of colors separated by space or by '|' which will be used to
20552 draw channel frequencies. Unrecognized or missing colors will be replaced
20553 by white color.
20554
20555 @item cmode
20556 Set channel display mode.
20557
20558 It accepts the following values:
20559 @table @samp
20560 @item combined
20561 @item separate
20562 @end table
20563 Default is @code{combined}.
20564
20565 @item minamp
20566 Set minimum amplitude used in @code{log} amplitude scaler.
20567
20568 @end table
20569
20570 @anchor{showspectrum}
20571 @section showspectrum
20572
20573 Convert input audio to a video output, representing the audio frequency
20574 spectrum.
20575
20576 The filter accepts the following options:
20577
20578 @table @option
20579 @item size, s
20580 Specify the video size for the output. For the syntax of this option, check the
20581 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20582 Default value is @code{640x512}.
20583
20584 @item slide
20585 Specify how the spectrum should slide along the window.
20586
20587 It accepts the following values:
20588 @table @samp
20589 @item replace
20590 the samples start again on the left when they reach the right
20591 @item scroll
20592 the samples scroll from right to left
20593 @item fullframe
20594 frames are only produced when the samples reach the right
20595 @item rscroll
20596 the samples scroll from left to right
20597 @end table
20598
20599 Default value is @code{replace}.
20600
20601 @item mode
20602 Specify display mode.
20603
20604 It accepts the following values:
20605 @table @samp
20606 @item combined
20607 all channels are displayed in the same row
20608 @item separate
20609 all channels are displayed in separate rows
20610 @end table
20611
20612 Default value is @samp{combined}.
20613
20614 @item color
20615 Specify display color mode.
20616
20617 It accepts the following values:
20618 @table @samp
20619 @item channel
20620 each channel is displayed in a separate color
20621 @item intensity
20622 each channel is displayed using the same color scheme
20623 @item rainbow
20624 each channel is displayed using the rainbow color scheme
20625 @item moreland
20626 each channel is displayed using the moreland color scheme
20627 @item nebulae
20628 each channel is displayed using the nebulae color scheme
20629 @item fire
20630 each channel is displayed using the fire color scheme
20631 @item fiery
20632 each channel is displayed using the fiery color scheme
20633 @item fruit
20634 each channel is displayed using the fruit color scheme
20635 @item cool
20636 each channel is displayed using the cool color scheme
20637 @item magma
20638 each channel is displayed using the magma color scheme
20639 @end table
20640
20641 Default value is @samp{channel}.
20642
20643 @item scale
20644 Specify scale used for calculating intensity color values.
20645
20646 It accepts the following values:
20647 @table @samp
20648 @item lin
20649 linear
20650 @item sqrt
20651 square root, default
20652 @item cbrt
20653 cubic root
20654 @item log
20655 logarithmic
20656 @item 4thrt
20657 4th root
20658 @item 5thrt
20659 5th root
20660 @end table
20661
20662 Default value is @samp{sqrt}.
20663
20664 @item saturation
20665 Set saturation modifier for displayed colors. Negative values provide
20666 alternative color scheme. @code{0} is no saturation at all.
20667 Saturation must be in [-10.0, 10.0] range.
20668 Default value is @code{1}.
20669
20670 @item win_func
20671 Set window function.
20672
20673 It accepts the following values:
20674 @table @samp
20675 @item rect
20676 @item bartlett
20677 @item hann
20678 @item hanning
20679 @item hamming
20680 @item blackman
20681 @item welch
20682 @item flattop
20683 @item bharris
20684 @item bnuttall
20685 @item bhann
20686 @item sine
20687 @item nuttall
20688 @item lanczos
20689 @item gauss
20690 @item tukey
20691 @item dolph
20692 @item cauchy
20693 @item parzen
20694 @item poisson
20695 @end table
20696
20697 Default value is @code{hann}.
20698
20699 @item orientation
20700 Set orientation of time vs frequency axis. Can be @code{vertical} or
20701 @code{horizontal}. Default is @code{vertical}.
20702
20703 @item overlap
20704 Set ratio of overlap window. Default value is @code{0}.
20705 When value is @code{1} overlap is set to recommended size for specific
20706 window function currently used.
20707
20708 @item gain
20709 Set scale gain for calculating intensity color values.
20710 Default value is @code{1}.
20711
20712 @item data
20713 Set which data to display. Can be @code{magnitude}, default or @code{phase}.
20714
20715 @item rotation
20716 Set color rotation, must be in [-1.0, 1.0] range.
20717 Default value is @code{0}.
20718 @end table
20719
20720 The usage is very similar to the showwaves filter; see the examples in that
20721 section.
20722
20723 @subsection Examples
20724
20725 @itemize
20726 @item
20727 Large window with logarithmic color scaling:
20728 @example
20729 showspectrum=s=1280x480:scale=log
20730 @end example
20731
20732 @item
20733 Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
20734 @example
20735 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
20736              [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
20737 @end example
20738 @end itemize
20739
20740 @section showspectrumpic
20741
20742 Convert input audio to a single video frame, representing the audio frequency
20743 spectrum.
20744
20745 The filter accepts the following options:
20746
20747 @table @option
20748 @item size, s
20749 Specify the video size for the output. For the syntax of this option, check the
20750 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20751 Default value is @code{4096x2048}.
20752
20753 @item mode
20754 Specify display mode.
20755
20756 It accepts the following values:
20757 @table @samp
20758 @item combined
20759 all channels are displayed in the same row
20760 @item separate
20761 all channels are displayed in separate rows
20762 @end table
20763 Default value is @samp{combined}.
20764
20765 @item color
20766 Specify display color mode.
20767
20768 It accepts the following values:
20769 @table @samp
20770 @item channel
20771 each channel is displayed in a separate color
20772 @item intensity
20773 each channel is displayed using the same color scheme
20774 @item rainbow
20775 each channel is displayed using the rainbow color scheme
20776 @item moreland
20777 each channel is displayed using the moreland color scheme
20778 @item nebulae
20779 each channel is displayed using the nebulae color scheme
20780 @item fire
20781 each channel is displayed using the fire color scheme
20782 @item fiery
20783 each channel is displayed using the fiery color scheme
20784 @item fruit
20785 each channel is displayed using the fruit color scheme
20786 @item cool
20787 each channel is displayed using the cool color scheme
20788 @item magma
20789 each channel is displayed using the magma color scheme
20790 @end table
20791 Default value is @samp{intensity}.
20792
20793 @item scale
20794 Specify scale used for calculating intensity color values.
20795
20796 It accepts the following values:
20797 @table @samp
20798 @item lin
20799 linear
20800 @item sqrt
20801 square root, default
20802 @item cbrt
20803 cubic root
20804 @item log
20805 logarithmic
20806 @item 4thrt
20807 4th root
20808 @item 5thrt
20809 5th root
20810 @end table
20811 Default value is @samp{log}.
20812
20813 @item saturation
20814 Set saturation modifier for displayed colors. Negative values provide
20815 alternative color scheme. @code{0} is no saturation at all.
20816 Saturation must be in [-10.0, 10.0] range.
20817 Default value is @code{1}.
20818
20819 @item win_func
20820 Set window function.
20821
20822 It accepts the following values:
20823 @table @samp
20824 @item rect
20825 @item bartlett
20826 @item hann
20827 @item hanning
20828 @item hamming
20829 @item blackman
20830 @item welch
20831 @item flattop
20832 @item bharris
20833 @item bnuttall
20834 @item bhann
20835 @item sine
20836 @item nuttall
20837 @item lanczos
20838 @item gauss
20839 @item tukey
20840 @item dolph
20841 @item cauchy
20842 @item parzen
20843 @item poisson
20844 @end table
20845 Default value is @code{hann}.
20846
20847 @item orientation
20848 Set orientation of time vs frequency axis. Can be @code{vertical} or
20849 @code{horizontal}. Default is @code{vertical}.
20850
20851 @item gain
20852 Set scale gain for calculating intensity color values.
20853 Default value is @code{1}.
20854
20855 @item legend
20856 Draw time and frequency axes and legends. Default is enabled.
20857
20858 @item rotation
20859 Set color rotation, must be in [-1.0, 1.0] range.
20860 Default value is @code{0}.
20861 @end table
20862
20863 @subsection Examples
20864
20865 @itemize
20866 @item
20867 Extract an audio spectrogram of a whole audio track
20868 in a 1024x1024 picture using @command{ffmpeg}:
20869 @example
20870 ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
20871 @end example
20872 @end itemize
20873
20874 @section showvolume
20875
20876 Convert input audio volume to a video output.
20877
20878 The filter accepts the following options:
20879
20880 @table @option
20881 @item rate, r
20882 Set video rate.
20883
20884 @item b
20885 Set border width, allowed range is [0, 5]. Default is 1.
20886
20887 @item w
20888 Set channel width, allowed range is [80, 8192]. Default is 400.
20889
20890 @item h
20891 Set channel height, allowed range is [1, 900]. Default is 20.
20892
20893 @item f
20894 Set fade, allowed range is [0, 1]. Default is 0.95.
20895
20896 @item c
20897 Set volume color expression.
20898
20899 The expression can use the following variables:
20900
20901 @table @option
20902 @item VOLUME
20903 Current max volume of channel in dB.
20904
20905 @item PEAK
20906 Current peak.
20907
20908 @item CHANNEL
20909 Current channel number, starting from 0.
20910 @end table
20911
20912 @item t
20913 If set, displays channel names. Default is enabled.
20914
20915 @item v
20916 If set, displays volume values. Default is enabled.
20917
20918 @item o
20919 Set orientation, can be horizontal: @code{h} or vertical: @code{v},
20920 default is @code{h}.
20921
20922 @item s
20923 Set step size, allowed range is [0, 5]. Default is 0, which means
20924 step is disabled.
20925
20926 @item p
20927 Set background opacity, allowed range is [0, 1]. Default is 0.
20928
20929 @item m
20930 Set metering mode, can be peak: @code{p} or rms: @code{r},
20931 default is @code{p}.
20932
20933 @item ds
20934 Set display scale, can be linear: @code{lin} or log: @code{log},
20935 default is @code{lin}.
20936
20937 @item dm
20938 In second.
20939 If set to > 0., display a line for the max level
20940 in the previous seconds.
20941 default is disabled: @code{0.}
20942
20943 @item dmc
20944 The color of the max line. Use when @code{dm} option is set to > 0.
20945 default is: @code{orange}
20946 @end table
20947
20948 @section showwaves
20949
20950 Convert input audio to a video output, representing the samples waves.
20951
20952 The filter accepts the following options:
20953
20954 @table @option
20955 @item size, s
20956 Specify the video size for the output. For the syntax of this option, check the
20957 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20958 Default value is @code{600x240}.
20959
20960 @item mode
20961 Set display mode.
20962
20963 Available values are:
20964 @table @samp
20965 @item point
20966 Draw a point for each sample.
20967
20968 @item line
20969 Draw a vertical line for each sample.
20970
20971 @item p2p
20972 Draw a point for each sample and a line between them.
20973
20974 @item cline
20975 Draw a centered vertical line for each sample.
20976 @end table
20977
20978 Default value is @code{point}.
20979
20980 @item n
20981 Set the number of samples which are printed on the same column. A
20982 larger value will decrease the frame rate. Must be a positive
20983 integer. This option can be set only if the value for @var{rate}
20984 is not explicitly specified.
20985
20986 @item rate, r
20987 Set the (approximate) output frame rate. This is done by setting the
20988 option @var{n}. Default value is "25".
20989
20990 @item split_channels
20991 Set if channels should be drawn separately or overlap. Default value is 0.
20992
20993 @item colors
20994 Set colors separated by '|' which are going to be used for drawing of each channel.
20995
20996 @item scale
20997 Set amplitude scale.
20998
20999 Available values are:
21000 @table @samp
21001 @item lin
21002 Linear.
21003
21004 @item log
21005 Logarithmic.
21006
21007 @item sqrt
21008 Square root.
21009
21010 @item cbrt
21011 Cubic root.
21012 @end table
21013
21014 Default is linear.
21015
21016 @item draw
21017 Set the draw mode. This is mostly useful to set for high @var{n}.
21018
21019 Available values are:
21020 @table @samp
21021 @item scale
21022 Scale pixel values for each drawn sample.
21023
21024 @item full
21025 Draw every sample directly.
21026 @end table
21027
21028 Default value is @code{scale}.
21029 @end table
21030
21031 @subsection Examples
21032
21033 @itemize
21034 @item
21035 Output the input file audio and the corresponding video representation
21036 at the same time:
21037 @example
21038 amovie=a.mp3,asplit[out0],showwaves[out1]
21039 @end example
21040
21041 @item
21042 Create a synthetic signal and show it with showwaves, forcing a
21043 frame rate of 30 frames per second:
21044 @example
21045 aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
21046 @end example
21047 @end itemize
21048
21049 @section showwavespic
21050
21051 Convert input audio to a single video frame, representing the samples waves.
21052
21053 The filter accepts the following options:
21054
21055 @table @option
21056 @item size, s
21057 Specify the video size for the output. For the syntax of this option, check the
21058 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
21059 Default value is @code{600x240}.
21060
21061 @item split_channels
21062 Set if channels should be drawn separately or overlap. Default value is 0.
21063
21064 @item colors
21065 Set colors separated by '|' which are going to be used for drawing of each channel.
21066
21067 @item scale
21068 Set amplitude scale.
21069
21070 Available values are:
21071 @table @samp
21072 @item lin
21073 Linear.
21074
21075 @item log
21076 Logarithmic.
21077
21078 @item sqrt
21079 Square root.
21080
21081 @item cbrt
21082 Cubic root.
21083 @end table
21084
21085 Default is linear.
21086 @end table
21087
21088 @subsection Examples
21089
21090 @itemize
21091 @item
21092 Extract a channel split representation of the wave form of a whole audio track
21093 in a 1024x800 picture using @command{ffmpeg}:
21094 @example
21095 ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
21096 @end example
21097 @end itemize
21098
21099 @section sidedata, asidedata
21100
21101 Delete frame side data, or select frames based on it.
21102
21103 This filter accepts the following options:
21104
21105 @table @option
21106 @item mode
21107 Set mode of operation of the filter.
21108
21109 Can be one of the following:
21110
21111 @table @samp
21112 @item select
21113 Select every frame with side data of @code{type}.
21114
21115 @item delete
21116 Delete side data of @code{type}. If @code{type} is not set, delete all side
21117 data in the frame.
21118
21119 @end table
21120
21121 @item type
21122 Set side data type used with all modes. Must be set for @code{select} mode. For
21123 the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
21124 in @file{libavutil/frame.h}. For example, to choose
21125 @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
21126
21127 @end table
21128
21129 @section spectrumsynth
21130
21131 Sythesize audio from 2 input video spectrums, first input stream represents
21132 magnitude across time and second represents phase across time.
21133 The filter will transform from frequency domain as displayed in videos back
21134 to time domain as presented in audio output.
21135
21136 This filter is primarily created for reversing processed @ref{showspectrum}
21137 filter outputs, but can synthesize sound from other spectrograms too.
21138 But in such case results are going to be poor if the phase data is not
21139 available, because in such cases phase data need to be recreated, usually
21140 its just recreated from random noise.
21141 For best results use gray only output (@code{channel} color mode in
21142 @ref{showspectrum} filter) and @code{log} scale for magnitude video and
21143 @code{lin} scale for phase video. To produce phase, for 2nd video, use
21144 @code{data} option. Inputs videos should generally use @code{fullframe}
21145 slide mode as that saves resources needed for decoding video.
21146
21147 The filter accepts the following options:
21148
21149 @table @option
21150 @item sample_rate
21151 Specify sample rate of output audio, the sample rate of audio from which
21152 spectrum was generated may differ.
21153
21154 @item channels
21155 Set number of channels represented in input video spectrums.
21156
21157 @item scale
21158 Set scale which was used when generating magnitude input spectrum.
21159 Can be @code{lin} or @code{log}. Default is @code{log}.
21160
21161 @item slide
21162 Set slide which was used when generating inputs spectrums.
21163 Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
21164 Default is @code{fullframe}.
21165
21166 @item win_func
21167 Set window function used for resynthesis.
21168
21169 @item overlap
21170 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
21171 which means optimal overlap for selected window function will be picked.
21172
21173 @item orientation
21174 Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
21175 Default is @code{vertical}.
21176 @end table
21177
21178 @subsection Examples
21179
21180 @itemize
21181 @item
21182 First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
21183 then resynthesize videos back to audio with spectrumsynth:
21184 @example
21185 ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
21186 ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
21187 ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
21188 @end example
21189 @end itemize
21190
21191 @section split, asplit
21192
21193 Split input into several identical outputs.
21194
21195 @code{asplit} works with audio input, @code{split} with video.
21196
21197 The filter accepts a single parameter which specifies the number of outputs. If
21198 unspecified, it defaults to 2.
21199
21200 @subsection Examples
21201
21202 @itemize
21203 @item
21204 Create two separate outputs from the same input:
21205 @example
21206 [in] split [out0][out1]
21207 @end example
21208
21209 @item
21210 To create 3 or more outputs, you need to specify the number of
21211 outputs, like in:
21212 @example
21213 [in] asplit=3 [out0][out1][out2]
21214 @end example
21215
21216 @item
21217 Create two separate outputs from the same input, one cropped and
21218 one padded:
21219 @example
21220 [in] split [splitout1][splitout2];
21221 [splitout1] crop=100:100:0:0    [cropout];
21222 [splitout2] pad=200:200:100:100 [padout];
21223 @end example
21224
21225 @item
21226 Create 5 copies of the input audio with @command{ffmpeg}:
21227 @example
21228 ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
21229 @end example
21230 @end itemize
21231
21232 @section zmq, azmq
21233
21234 Receive commands sent through a libzmq client, and forward them to
21235 filters in the filtergraph.
21236
21237 @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
21238 must be inserted between two video filters, @code{azmq} between two
21239 audio filters. Both are capable to send messages to any filter type.
21240
21241 To enable these filters you need to install the libzmq library and
21242 headers and configure FFmpeg with @code{--enable-libzmq}.
21243
21244 For more information about libzmq see:
21245 @url{http://www.zeromq.org/}
21246
21247 The @code{zmq} and @code{azmq} filters work as a libzmq server, which
21248 receives messages sent through a network interface defined by the
21249 @option{bind_address} (or the abbreviation "@option{b}") option.
21250 Default value of this option is @file{tcp://localhost:5555}. You may
21251 want to alter this value to your needs, but do not forget to escape any
21252 ':' signs (see @ref{filtergraph escaping}).
21253
21254 The received message must be in the form:
21255 @example
21256 @var{TARGET} @var{COMMAND} [@var{ARG}]
21257 @end example
21258
21259 @var{TARGET} specifies the target of the command, usually the name of
21260 the filter class or a specific filter instance name. The default
21261 filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
21262 but you can override this by using the @samp{filter_name@@id} syntax
21263 (see @ref{Filtergraph syntax}).
21264
21265 @var{COMMAND} specifies the name of the command for the target filter.
21266
21267 @var{ARG} is optional and specifies the optional argument list for the
21268 given @var{COMMAND}.
21269
21270 Upon reception, the message is processed and the corresponding command
21271 is injected into the filtergraph. Depending on the result, the filter
21272 will send a reply to the client, adopting the format:
21273 @example
21274 @var{ERROR_CODE} @var{ERROR_REASON}
21275 @var{MESSAGE}
21276 @end example
21277
21278 @var{MESSAGE} is optional.
21279
21280 @subsection Examples
21281
21282 Look at @file{tools/zmqsend} for an example of a zmq client which can
21283 be used to send commands processed by these filters.
21284
21285 Consider the following filtergraph generated by @command{ffplay}.
21286 In this example the last overlay filter has an instance name. All other
21287 filters will have default instance names.
21288
21289 @example
21290 ffplay -dumpgraph 1 -f lavfi "
21291 color=s=100x100:c=red  [l];
21292 color=s=100x100:c=blue [r];
21293 nullsrc=s=200x100, zmq [bg];
21294 [bg][l]   overlay     [bg+l];
21295 [bg+l][r] overlay@@my=x=100 "
21296 @end example
21297
21298 To change the color of the left side of the video, the following
21299 command can be used:
21300 @example
21301 echo Parsed_color_0 c yellow | tools/zmqsend
21302 @end example
21303
21304 To change the right side:
21305 @example
21306 echo Parsed_color_1 c pink | tools/zmqsend
21307 @end example
21308
21309 To change the position of the right side:
21310 @example
21311 echo overlay@@my x 150 | tools/zmqsend
21312 @end example
21313
21314
21315 @c man end MULTIMEDIA FILTERS
21316
21317 @chapter Multimedia Sources
21318 @c man begin MULTIMEDIA SOURCES
21319
21320 Below is a description of the currently available multimedia sources.
21321
21322 @section amovie
21323
21324 This is the same as @ref{movie} source, except it selects an audio
21325 stream by default.
21326
21327 @anchor{movie}
21328 @section movie
21329
21330 Read audio and/or video stream(s) from a movie container.
21331
21332 It accepts the following parameters:
21333
21334 @table @option
21335 @item filename
21336 The name of the resource to read (not necessarily a file; it can also be a
21337 device or a stream accessed through some protocol).
21338
21339 @item format_name, f
21340 Specifies the format assumed for the movie to read, and can be either
21341 the name of a container or an input device. If not specified, the
21342 format is guessed from @var{movie_name} or by probing.
21343
21344 @item seek_point, sp
21345 Specifies the seek point in seconds. The frames will be output
21346 starting from this seek point. The parameter is evaluated with
21347 @code{av_strtod}, so the numerical value may be suffixed by an IS
21348 postfix. The default value is "0".
21349
21350 @item streams, s
21351 Specifies the streams to read. Several streams can be specified,
21352 separated by "+". The source will then have as many outputs, in the
21353 same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
21354 section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
21355 respectively the default (best suited) video and audio stream. Default
21356 is "dv", or "da" if the filter is called as "amovie".
21357
21358 @item stream_index, si
21359 Specifies the index of the video stream to read. If the value is -1,
21360 the most suitable video stream will be automatically selected. The default
21361 value is "-1". Deprecated. If the filter is called "amovie", it will select
21362 audio instead of video.
21363
21364 @item loop
21365 Specifies how many times to read the stream in sequence.
21366 If the value is 0, the stream will be looped infinitely.
21367 Default value is "1".
21368
21369 Note that when the movie is looped the source timestamps are not
21370 changed, so it will generate non monotonically increasing timestamps.
21371
21372 @item discontinuity
21373 Specifies the time difference between frames above which the point is
21374 considered a timestamp discontinuity which is removed by adjusting the later
21375 timestamps.
21376 @end table
21377
21378 It allows overlaying a second video on top of the main input of
21379 a filtergraph, as shown in this graph:
21380 @example
21381 input -----------> deltapts0 --> overlay --> output
21382                                     ^
21383                                     |
21384 movie --> scale--> deltapts1 -------+
21385 @end example
21386 @subsection Examples
21387
21388 @itemize
21389 @item
21390 Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
21391 on top of the input labelled "in":
21392 @example
21393 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
21394 [in] setpts=PTS-STARTPTS [main];
21395 [main][over] overlay=16:16 [out]
21396 @end example
21397
21398 @item
21399 Read from a video4linux2 device, and overlay it on top of the input
21400 labelled "in":
21401 @example
21402 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
21403 [in] setpts=PTS-STARTPTS [main];
21404 [main][over] overlay=16:16 [out]
21405 @end example
21406
21407 @item
21408 Read the first video stream and the audio stream with id 0x81 from
21409 dvd.vob; the video is connected to the pad named "video" and the audio is
21410 connected to the pad named "audio":
21411 @example
21412 movie=dvd.vob:s=v:0+#0x81 [video] [audio]
21413 @end example
21414 @end itemize
21415
21416 @subsection Commands
21417
21418 Both movie and amovie support the following commands:
21419 @table @option
21420 @item seek
21421 Perform seek using "av_seek_frame".
21422 The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
21423 @itemize
21424 @item
21425 @var{stream_index}: If stream_index is -1, a default
21426 stream is selected, and @var{timestamp} is automatically converted
21427 from AV_TIME_BASE units to the stream specific time_base.
21428 @item
21429 @var{timestamp}: Timestamp in AVStream.time_base units
21430 or, if no stream is specified, in AV_TIME_BASE units.
21431 @item
21432 @var{flags}: Flags which select direction and seeking mode.
21433 @end itemize
21434
21435 @item get_duration
21436 Get movie duration in AV_TIME_BASE units.
21437
21438 @end table
21439
21440 @c man end MULTIMEDIA SOURCES