]> git.sesse.net Git - ffmpeg/blob - doc/filters.texi
85d8f6c85bbe17323e903ea1ca1ccbf366c8977a
[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 If you want instead to delay in seconds, append 's' to number.
687 @end table
688
689 @subsection Examples
690
691 @itemize
692 @item
693 Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
694 the second channel (and any other channels that may be present) unchanged.
695 @example
696 adelay=1500|0|500
697 @end example
698
699 @item
700 Delay second channel by 500 samples, the third channel by 700 samples and leave
701 the first channel (and any other channels that may be present) unchanged.
702 @example
703 adelay=0|500S|700S
704 @end example
705 @end itemize
706
707 @section aderivative, aintegral
708
709 Compute derivative/integral of audio stream.
710
711 Applying both filters one after another produces original audio.
712
713 @section aecho
714
715 Apply echoing to the input audio.
716
717 Echoes are reflected sound and can occur naturally amongst mountains
718 (and sometimes large buildings) when talking or shouting; digital echo
719 effects emulate this behaviour and are often used to help fill out the
720 sound of a single instrument or vocal. The time difference between the
721 original signal and the reflection is the @code{delay}, and the
722 loudness of the reflected signal is the @code{decay}.
723 Multiple echoes can have different delays and decays.
724
725 A description of the accepted parameters follows.
726
727 @table @option
728 @item in_gain
729 Set input gain of reflected signal. Default is @code{0.6}.
730
731 @item out_gain
732 Set output gain of reflected signal. Default is @code{0.3}.
733
734 @item delays
735 Set list of time intervals in milliseconds between original signal and reflections
736 separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
737 Default is @code{1000}.
738
739 @item decays
740 Set list of loudness of reflected signals separated by '|'.
741 Allowed range for each @code{decay} is @code{(0 - 1.0]}.
742 Default is @code{0.5}.
743 @end table
744
745 @subsection Examples
746
747 @itemize
748 @item
749 Make it sound as if there are twice as many instruments as are actually playing:
750 @example
751 aecho=0.8:0.88:60:0.4
752 @end example
753
754 @item
755 If delay is very short, then it sound like a (metallic) robot playing music:
756 @example
757 aecho=0.8:0.88:6:0.4
758 @end example
759
760 @item
761 A longer delay will sound like an open air concert in the mountains:
762 @example
763 aecho=0.8:0.9:1000:0.3
764 @end example
765
766 @item
767 Same as above but with one more mountain:
768 @example
769 aecho=0.8:0.9:1000|1800:0.3|0.25
770 @end example
771 @end itemize
772
773 @section aemphasis
774 Audio emphasis filter creates or restores material directly taken from LPs or
775 emphased CDs with different filter curves. E.g. to store music on vinyl the
776 signal has to be altered by a filter first to even out the disadvantages of
777 this recording medium.
778 Once the material is played back the inverse filter has to be applied to
779 restore the distortion of the frequency response.
780
781 The filter accepts the following options:
782
783 @table @option
784 @item level_in
785 Set input gain.
786
787 @item level_out
788 Set output gain.
789
790 @item mode
791 Set filter mode. For restoring material use @code{reproduction} mode, otherwise
792 use @code{production} mode. Default is @code{reproduction} mode.
793
794 @item type
795 Set filter type. Selects medium. Can be one of the following:
796
797 @table @option
798 @item col
799 select Columbia.
800 @item emi
801 select EMI.
802 @item bsi
803 select BSI (78RPM).
804 @item riaa
805 select RIAA.
806 @item cd
807 select Compact Disc (CD).
808 @item 50fm
809 select 50µs (FM).
810 @item 75fm
811 select 75µs (FM).
812 @item 50kf
813 select 50µs (FM-KF).
814 @item 75kf
815 select 75µs (FM-KF).
816 @end table
817 @end table
818
819 @section aeval
820
821 Modify an audio signal according to the specified expressions.
822
823 This filter accepts one or more expressions (one for each channel),
824 which are evaluated and used to modify a corresponding audio signal.
825
826 It accepts the following parameters:
827
828 @table @option
829 @item exprs
830 Set the '|'-separated expressions list for each separate channel. If
831 the number of input channels is greater than the number of
832 expressions, the last specified expression is used for the remaining
833 output channels.
834
835 @item channel_layout, c
836 Set output channel layout. If not specified, the channel layout is
837 specified by the number of expressions. If set to @samp{same}, it will
838 use by default the same input channel layout.
839 @end table
840
841 Each expression in @var{exprs} can contain the following constants and functions:
842
843 @table @option
844 @item ch
845 channel number of the current expression
846
847 @item n
848 number of the evaluated sample, starting from 0
849
850 @item s
851 sample rate
852
853 @item t
854 time of the evaluated sample expressed in seconds
855
856 @item nb_in_channels
857 @item nb_out_channels
858 input and output number of channels
859
860 @item val(CH)
861 the value of input channel with number @var{CH}
862 @end table
863
864 Note: this filter is slow. For faster processing you should use a
865 dedicated filter.
866
867 @subsection Examples
868
869 @itemize
870 @item
871 Half volume:
872 @example
873 aeval=val(ch)/2:c=same
874 @end example
875
876 @item
877 Invert phase of the second channel:
878 @example
879 aeval=val(0)|-val(1)
880 @end example
881 @end itemize
882
883 @anchor{afade}
884 @section afade
885
886 Apply fade-in/out effect to input audio.
887
888 A description of the accepted parameters follows.
889
890 @table @option
891 @item type, t
892 Specify the effect type, can be either @code{in} for fade-in, or
893 @code{out} for a fade-out effect. Default is @code{in}.
894
895 @item start_sample, ss
896 Specify the number of the start sample for starting to apply the fade
897 effect. Default is 0.
898
899 @item nb_samples, ns
900 Specify the number of samples for which the fade effect has to last. At
901 the end of the fade-in effect the output audio will have the same
902 volume as the input audio, at the end of the fade-out transition
903 the output audio will be silence. Default is 44100.
904
905 @item start_time, st
906 Specify the start time of the fade effect. Default is 0.
907 The value must be specified as a time duration; see
908 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
909 for the accepted syntax.
910 If set this option is used instead of @var{start_sample}.
911
912 @item duration, d
913 Specify the duration of the fade effect. See
914 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
915 for the accepted syntax.
916 At the end of the fade-in effect the output audio will have the same
917 volume as the input audio, at the end of the fade-out transition
918 the output audio will be silence.
919 By default the duration is determined by @var{nb_samples}.
920 If set this option is used instead of @var{nb_samples}.
921
922 @item curve
923 Set curve for fade transition.
924
925 It accepts the following values:
926 @table @option
927 @item tri
928 select triangular, linear slope (default)
929 @item qsin
930 select quarter of sine wave
931 @item hsin
932 select half of sine wave
933 @item esin
934 select exponential sine wave
935 @item log
936 select logarithmic
937 @item ipar
938 select inverted parabola
939 @item qua
940 select quadratic
941 @item cub
942 select cubic
943 @item squ
944 select square root
945 @item cbr
946 select cubic root
947 @item par
948 select parabola
949 @item exp
950 select exponential
951 @item iqsin
952 select inverted quarter of sine wave
953 @item ihsin
954 select inverted half of sine wave
955 @item dese
956 select double-exponential seat
957 @item desi
958 select double-exponential sigmoid
959 @item losi
960 select logistic sigmoid
961 @end table
962 @end table
963
964 @subsection Examples
965
966 @itemize
967 @item
968 Fade in first 15 seconds of audio:
969 @example
970 afade=t=in:ss=0:d=15
971 @end example
972
973 @item
974 Fade out last 25 seconds of a 900 seconds audio:
975 @example
976 afade=t=out:st=875:d=25
977 @end example
978 @end itemize
979
980 @section afftdn
981 Denoise audio samples with FFT.
982
983 A description of the accepted parameters follows.
984
985 @table @option
986 @item nr
987 Set the noise reduction in dB, allowed range is 0.01 to 97.
988 Default value is 12 dB.
989
990 @item nf
991 Set the noise floor in dB, allowed range is -80 to -20.
992 Default value is -50 dB.
993
994 @item nt
995 Set the noise type.
996
997 It accepts the following values:
998 @table @option
999 @item w
1000 Select white noise.
1001
1002 @item v
1003 Select vinyl noise.
1004
1005 @item s
1006 Select shellac noise.
1007
1008 @item c
1009 Select custom noise, defined in @code{bn} option.
1010
1011 Default value is white noise.
1012 @end table
1013
1014 @item bn
1015 Set custom band noise for every one of 15 bands.
1016 Bands are separated by ' ' or '|'.
1017
1018 @item rf
1019 Set the residual floor in dB, allowed range is -80 to -20.
1020 Default value is -38 dB.
1021
1022 @item tn
1023 Enable noise tracking. By default is disabled.
1024 With this enabled, noise floor is automatically adjusted.
1025
1026 @item tr
1027 Enable residual tracking. By default is disabled.
1028
1029 @item om
1030 Set the output mode.
1031
1032 It accepts the following values:
1033 @table @option
1034 @item i
1035 Pass input unchanged.
1036
1037 @item o
1038 Pass noise filtered out.
1039
1040 @item n
1041 Pass only noise.
1042
1043 Default value is @var{o}.
1044 @end table
1045 @end table
1046
1047 @subsection Commands
1048
1049 This filter supports the following commands:
1050 @table @option
1051 @item sample_noise, sn
1052 Start or stop measuring noise profile.
1053 Syntax for the command is : "start" or "stop" string.
1054 After measuring noise profile is stopped it will be
1055 automatically applied in filtering.
1056
1057 @item noise_reduction, nr
1058 Change noise reduction. Argument is single float number.
1059 Syntax for the command is : "@var{noise_reduction}"
1060
1061 @item noise_floor, nf
1062 Change noise floor. Argument is single float number.
1063 Syntax for the command is : "@var{noise_floor}"
1064
1065 @item output_mode, om
1066 Change output mode operation.
1067 Syntax for the command is : "i", "o" or "n" string.
1068 @end table
1069
1070 @section afftfilt
1071 Apply arbitrary expressions to samples in frequency domain.
1072
1073 @table @option
1074 @item real
1075 Set frequency domain real expression for each separate channel separated
1076 by '|'. Default is "re".
1077 If the number of input channels is greater than the number of
1078 expressions, the last specified expression is used for the remaining
1079 output channels.
1080
1081 @item imag
1082 Set frequency domain imaginary expression for each separate channel
1083 separated by '|'. Default is "im".
1084
1085 Each expression in @var{real} and @var{imag} can contain the following
1086 constants and functions:
1087
1088 @table @option
1089 @item sr
1090 sample rate
1091
1092 @item b
1093 current frequency bin number
1094
1095 @item nb
1096 number of available bins
1097
1098 @item ch
1099 channel number of the current expression
1100
1101 @item chs
1102 number of channels
1103
1104 @item pts
1105 current frame pts
1106
1107 @item re
1108 current real part of frequency bin of current channel
1109
1110 @item im
1111 current imaginary part of frequency bin of current channel
1112
1113 @item real(b, ch)
1114 Return the value of real part of frequency bin at location (@var{bin},@var{channel})
1115
1116 @item imag(b, ch)
1117 Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
1118 @end table
1119
1120 @item win_size
1121 Set window size.
1122
1123 It accepts the following values:
1124 @table @samp
1125 @item w16
1126 @item w32
1127 @item w64
1128 @item w128
1129 @item w256
1130 @item w512
1131 @item w1024
1132 @item w2048
1133 @item w4096
1134 @item w8192
1135 @item w16384
1136 @item w32768
1137 @item w65536
1138 @end table
1139 Default is @code{w4096}
1140
1141 @item win_func
1142 Set window function. Default is @code{hann}.
1143
1144 @item overlap
1145 Set window overlap. If set to 1, the recommended overlap for selected
1146 window function will be picked. Default is @code{0.75}.
1147 @end table
1148
1149 @subsection Examples
1150
1151 @itemize
1152 @item
1153 Leave almost only low frequencies in audio:
1154 @example
1155 afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
1156 @end example
1157 @end itemize
1158
1159 @anchor{afir}
1160 @section afir
1161
1162 Apply an arbitrary Frequency Impulse Response filter.
1163
1164 This filter is designed for applying long FIR filters,
1165 up to 60 seconds long.
1166
1167 It can be used as component for digital crossover filters,
1168 room equalization, cross talk cancellation, wavefield synthesis,
1169 auralization, ambiophonics, ambisonics and spatialization.
1170
1171 This filter uses second stream as FIR coefficients.
1172 If second stream holds single channel, it will be used
1173 for all input channels in first stream, otherwise
1174 number of channels in second stream must be same as
1175 number of channels in first stream.
1176
1177 It accepts the following parameters:
1178
1179 @table @option
1180 @item dry
1181 Set dry gain. This sets input gain.
1182
1183 @item wet
1184 Set wet gain. This sets final output gain.
1185
1186 @item length
1187 Set Impulse Response filter length. Default is 1, which means whole IR is processed.
1188
1189 @item gtype
1190 Enable applying gain measured from power of IR.
1191
1192 Set which approach to use for auto gain measurement.
1193
1194 @table @option
1195 @item none
1196 Do not apply any gain.
1197
1198 @item peak
1199 select peak gain, very conservative approach. This is default value.
1200
1201 @item dc
1202 select DC gain, limited application.
1203
1204 @item gn
1205 select gain to noise approach, this is most popular one.
1206 @end table
1207
1208 @item irgain
1209 Set gain to be applied to IR coefficients before filtering.
1210 Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
1211
1212 @item irfmt
1213 Set format of IR stream. Can be @code{mono} or @code{input}.
1214 Default is @code{input}.
1215
1216 @item maxir
1217 Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
1218 Allowed range is 0.1 to 60 seconds.
1219
1220 @item response
1221 Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.
1222 By default it is disabled.
1223
1224 @item channel
1225 Set for which IR channel to display frequency response. By default is first channel
1226 displayed. This option is used only when @var{response} is enabled.
1227
1228 @item size
1229 Set video stream size. This option is used only when @var{response} is enabled.
1230
1231 @item rate
1232 Set video stream frame rate. This option is used only when @var{response} is enabled.
1233
1234 @item minp
1235 Set minimal partition size used for convolution. Default is @var{8192}.
1236 Allowed range is from @var{8} to @var{32768}.
1237 Lower values decreases latency at cost of higher CPU usage.
1238
1239 @item maxp
1240 Set maximal partition size used for convolution. Default is @var{8192}.
1241 Allowed range is from @var{8} to @var{32768}.
1242 Lower values may increase CPU usage.
1243 @end table
1244
1245 @subsection Examples
1246
1247 @itemize
1248 @item
1249 Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
1250 @example
1251 ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
1252 @end example
1253 @end itemize
1254
1255 @anchor{aformat}
1256 @section aformat
1257
1258 Set output format constraints for the input audio. The framework will
1259 negotiate the most appropriate format to minimize conversions.
1260
1261 It accepts the following parameters:
1262 @table @option
1263
1264 @item sample_fmts
1265 A '|'-separated list of requested sample formats.
1266
1267 @item sample_rates
1268 A '|'-separated list of requested sample rates.
1269
1270 @item channel_layouts
1271 A '|'-separated list of requested channel layouts.
1272
1273 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
1274 for the required syntax.
1275 @end table
1276
1277 If a parameter is omitted, all values are allowed.
1278
1279 Force the output to either unsigned 8-bit or signed 16-bit stereo
1280 @example
1281 aformat=sample_fmts=u8|s16:channel_layouts=stereo
1282 @end example
1283
1284 @section agate
1285
1286 A gate is mainly used to reduce lower parts of a signal. This kind of signal
1287 processing reduces disturbing noise between useful signals.
1288
1289 Gating is done by detecting the volume below a chosen level @var{threshold}
1290 and dividing it by the factor set with @var{ratio}. The bottom of the noise
1291 floor is set via @var{range}. Because an exact manipulation of the signal
1292 would cause distortion of the waveform the reduction can be levelled over
1293 time. This is done by setting @var{attack} and @var{release}.
1294
1295 @var{attack} determines how long the signal has to fall below the threshold
1296 before any reduction will occur and @var{release} sets the time the signal
1297 has to rise above the threshold to reduce the reduction again.
1298 Shorter signals than the chosen attack time will be left untouched.
1299
1300 @table @option
1301 @item level_in
1302 Set input level before filtering.
1303 Default is 1. Allowed range is from 0.015625 to 64.
1304
1305 @item range
1306 Set the level of gain reduction when the signal is below the threshold.
1307 Default is 0.06125. Allowed range is from 0 to 1.
1308
1309 @item threshold
1310 If a signal rises above this level the gain reduction is released.
1311 Default is 0.125. Allowed range is from 0 to 1.
1312
1313 @item ratio
1314 Set a ratio by which the signal is reduced.
1315 Default is 2. Allowed range is from 1 to 9000.
1316
1317 @item attack
1318 Amount of milliseconds the signal has to rise above the threshold before gain
1319 reduction stops.
1320 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
1321
1322 @item release
1323 Amount of milliseconds the signal has to fall below the threshold before the
1324 reduction is increased again. Default is 250 milliseconds.
1325 Allowed range is from 0.01 to 9000.
1326
1327 @item makeup
1328 Set amount of amplification of signal after processing.
1329 Default is 1. Allowed range is from 1 to 64.
1330
1331 @item knee
1332 Curve the sharp knee around the threshold to enter gain reduction more softly.
1333 Default is 2.828427125. Allowed range is from 1 to 8.
1334
1335 @item detection
1336 Choose if exact signal should be taken for detection or an RMS like one.
1337 Default is @code{rms}. Can be @code{peak} or @code{rms}.
1338
1339 @item link
1340 Choose if the average level between all channels or the louder channel affects
1341 the reduction.
1342 Default is @code{average}. Can be @code{average} or @code{maximum}.
1343 @end table
1344
1345 @section aiir
1346
1347 Apply an arbitrary Infinite Impulse Response filter.
1348
1349 It accepts the following parameters:
1350
1351 @table @option
1352 @item z
1353 Set numerator/zeros coefficients.
1354
1355 @item p
1356 Set denominator/poles coefficients.
1357
1358 @item k
1359 Set channels gains.
1360
1361 @item dry_gain
1362 Set input gain.
1363
1364 @item wet_gain
1365 Set output gain.
1366
1367 @item f
1368 Set coefficients format.
1369
1370 @table @samp
1371 @item tf
1372 transfer function
1373 @item zp
1374 Z-plane zeros/poles, cartesian (default)
1375 @item pr
1376 Z-plane zeros/poles, polar radians
1377 @item pd
1378 Z-plane zeros/poles, polar degrees
1379 @end table
1380
1381 @item r
1382 Set kind of processing.
1383 Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
1384
1385 @item e
1386 Set filtering precision.
1387
1388 @table @samp
1389 @item dbl
1390 double-precision floating-point (default)
1391 @item flt
1392 single-precision floating-point
1393 @item i32
1394 32-bit integers
1395 @item i16
1396 16-bit integers
1397 @end table
1398
1399 @item response
1400 Show IR frequency reponse, magnitude and phase in additional video stream.
1401 By default it is disabled.
1402
1403 @item channel
1404 Set for which IR channel to display frequency response. By default is first channel
1405 displayed. This option is used only when @var{response} is enabled.
1406
1407 @item size
1408 Set video stream size. This option is used only when @var{response} is enabled.
1409 @end table
1410
1411 Coefficients in @code{tf} format are separated by spaces and are in ascending
1412 order.
1413
1414 Coefficients in @code{zp} format are separated by spaces and order of coefficients
1415 doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
1416 imaginary unit.
1417
1418 Different coefficients and gains can be provided for every channel, in such case
1419 use '|' to separate coefficients or gains. Last provided coefficients will be
1420 used for all remaining channels.
1421
1422 @subsection Examples
1423
1424 @itemize
1425 @item
1426 Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
1427 @example
1428 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
1429 @end example
1430
1431 @item
1432 Same as above but in @code{zp} format:
1433 @example
1434 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
1435 @end example
1436 @end itemize
1437
1438 @section alimiter
1439
1440 The limiter prevents an input signal from rising over a desired threshold.
1441 This limiter uses lookahead technology to prevent your signal from distorting.
1442 It means that there is a small delay after the signal is processed. Keep in mind
1443 that the delay it produces is the attack time you set.
1444
1445 The filter accepts the following options:
1446
1447 @table @option
1448 @item level_in
1449 Set input gain. Default is 1.
1450
1451 @item level_out
1452 Set output gain. Default is 1.
1453
1454 @item limit
1455 Don't let signals above this level pass the limiter. Default is 1.
1456
1457 @item attack
1458 The limiter will reach its attenuation level in this amount of time in
1459 milliseconds. Default is 5 milliseconds.
1460
1461 @item release
1462 Come back from limiting to attenuation 1.0 in this amount of milliseconds.
1463 Default is 50 milliseconds.
1464
1465 @item asc
1466 When gain reduction is always needed ASC takes care of releasing to an
1467 average reduction level rather than reaching a reduction of 0 in the release
1468 time.
1469
1470 @item asc_level
1471 Select how much the release time is affected by ASC, 0 means nearly no changes
1472 in release time while 1 produces higher release times.
1473
1474 @item level
1475 Auto level output signal. Default is enabled.
1476 This normalizes audio back to 0dB if enabled.
1477 @end table
1478
1479 Depending on picked setting it is recommended to upsample input 2x or 4x times
1480 with @ref{aresample} before applying this filter.
1481
1482 @section allpass
1483
1484 Apply a two-pole all-pass filter with central frequency (in Hz)
1485 @var{frequency}, and filter-width @var{width}.
1486 An all-pass filter changes the audio's frequency to phase relationship
1487 without changing its frequency to amplitude relationship.
1488
1489 The filter accepts the following options:
1490
1491 @table @option
1492 @item frequency, f
1493 Set frequency in Hz.
1494
1495 @item width_type, t
1496 Set method to specify band-width of filter.
1497 @table @option
1498 @item h
1499 Hz
1500 @item q
1501 Q-Factor
1502 @item o
1503 octave
1504 @item s
1505 slope
1506 @item k
1507 kHz
1508 @end table
1509
1510 @item width, w
1511 Specify the band-width of a filter in width_type units.
1512
1513 @item channels, c
1514 Specify which channels to filter, by default all available are filtered.
1515 @end table
1516
1517 @subsection Commands
1518
1519 This filter supports the following commands:
1520 @table @option
1521 @item frequency, f
1522 Change allpass frequency.
1523 Syntax for the command is : "@var{frequency}"
1524
1525 @item width_type, t
1526 Change allpass width_type.
1527 Syntax for the command is : "@var{width_type}"
1528
1529 @item width, w
1530 Change allpass width.
1531 Syntax for the command is : "@var{width}"
1532 @end table
1533
1534 @section aloop
1535
1536 Loop audio samples.
1537
1538 The filter accepts the following options:
1539
1540 @table @option
1541 @item loop
1542 Set the number of loops. Setting this value to -1 will result in infinite loops.
1543 Default is 0.
1544
1545 @item size
1546 Set maximal number of samples. Default is 0.
1547
1548 @item start
1549 Set first sample of loop. Default is 0.
1550 @end table
1551
1552 @anchor{amerge}
1553 @section amerge
1554
1555 Merge two or more audio streams into a single multi-channel stream.
1556
1557 The filter accepts the following options:
1558
1559 @table @option
1560
1561 @item inputs
1562 Set the number of inputs. Default is 2.
1563
1564 @end table
1565
1566 If the channel layouts of the inputs are disjoint, and therefore compatible,
1567 the channel layout of the output will be set accordingly and the channels
1568 will be reordered as necessary. If the channel layouts of the inputs are not
1569 disjoint, the output will have all the channels of the first input then all
1570 the channels of the second input, in that order, and the channel layout of
1571 the output will be the default value corresponding to the total number of
1572 channels.
1573
1574 For example, if the first input is in 2.1 (FL+FR+LF) and the second input
1575 is FC+BL+BR, then the output will be in 5.1, with the channels in the
1576 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
1577 first input, b1 is the first channel of the second input).
1578
1579 On the other hand, if both input are in stereo, the output channels will be
1580 in the default order: a1, a2, b1, b2, and the channel layout will be
1581 arbitrarily set to 4.0, which may or may not be the expected value.
1582
1583 All inputs must have the same sample rate, and format.
1584
1585 If inputs do not have the same duration, the output will stop with the
1586 shortest.
1587
1588 @subsection Examples
1589
1590 @itemize
1591 @item
1592 Merge two mono files into a stereo stream:
1593 @example
1594 amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
1595 @end example
1596
1597 @item
1598 Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
1599 @example
1600 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
1601 @end example
1602 @end itemize
1603
1604 @section amix
1605
1606 Mixes multiple audio inputs into a single output.
1607
1608 Note that this filter only supports float samples (the @var{amerge}
1609 and @var{pan} audio filters support many formats). If the @var{amix}
1610 input has integer samples then @ref{aresample} will be automatically
1611 inserted to perform the conversion to float samples.
1612
1613 For example
1614 @example
1615 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
1616 @end example
1617 will mix 3 input audio streams to a single output with the same duration as the
1618 first input and a dropout transition time of 3 seconds.
1619
1620 It accepts the following parameters:
1621 @table @option
1622
1623 @item inputs
1624 The number of inputs. If unspecified, it defaults to 2.
1625
1626 @item duration
1627 How to determine the end-of-stream.
1628 @table @option
1629
1630 @item longest
1631 The duration of the longest input. (default)
1632
1633 @item shortest
1634 The duration of the shortest input.
1635
1636 @item first
1637 The duration of the first input.
1638
1639 @end table
1640
1641 @item dropout_transition
1642 The transition time, in seconds, for volume renormalization when an input
1643 stream ends. The default value is 2 seconds.
1644
1645 @item weights
1646 Specify weight of each input audio stream as sequence.
1647 Each weight is separated by space. By default all inputs have same weight.
1648 @end table
1649
1650 @section amultiply
1651
1652 Multiply first audio stream with second audio stream and store result
1653 in output audio stream. Multiplication is done by multiplying each
1654 sample from first stream with sample at same position from second stream.
1655
1656 With this element-wise multiplication one can create amplitude fades and
1657 amplitude modulations.
1658
1659 @section anequalizer
1660
1661 High-order parametric multiband equalizer for each channel.
1662
1663 It accepts the following parameters:
1664 @table @option
1665 @item params
1666
1667 This option string is in format:
1668 "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
1669 Each equalizer band is separated by '|'.
1670
1671 @table @option
1672 @item chn
1673 Set channel number to which equalization will be applied.
1674 If input doesn't have that channel the entry is ignored.
1675
1676 @item f
1677 Set central frequency for band.
1678 If input doesn't have that frequency the entry is ignored.
1679
1680 @item w
1681 Set band width in hertz.
1682
1683 @item g
1684 Set band gain in dB.
1685
1686 @item t
1687 Set filter type for band, optional, can be:
1688
1689 @table @samp
1690 @item 0
1691 Butterworth, this is default.
1692
1693 @item 1
1694 Chebyshev type 1.
1695
1696 @item 2
1697 Chebyshev type 2.
1698 @end table
1699 @end table
1700
1701 @item curves
1702 With this option activated frequency response of anequalizer is displayed
1703 in video stream.
1704
1705 @item size
1706 Set video stream size. Only useful if curves option is activated.
1707
1708 @item mgain
1709 Set max gain that will be displayed. Only useful if curves option is activated.
1710 Setting this to a reasonable value makes it possible to display gain which is derived from
1711 neighbour bands which are too close to each other and thus produce higher gain
1712 when both are activated.
1713
1714 @item fscale
1715 Set frequency scale used to draw frequency response in video output.
1716 Can be linear or logarithmic. Default is logarithmic.
1717
1718 @item colors
1719 Set color for each channel curve which is going to be displayed in video stream.
1720 This is list of color names separated by space or by '|'.
1721 Unrecognised or missing colors will be replaced by white color.
1722 @end table
1723
1724 @subsection Examples
1725
1726 @itemize
1727 @item
1728 Lower gain by 10 of central frequency 200Hz and width 100 Hz
1729 for first 2 channels using Chebyshev type 1 filter:
1730 @example
1731 anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
1732 @end example
1733 @end itemize
1734
1735 @subsection Commands
1736
1737 This filter supports the following commands:
1738 @table @option
1739 @item change
1740 Alter existing filter parameters.
1741 Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
1742
1743 @var{fN} is existing filter number, starting from 0, if no such filter is available
1744 error is returned.
1745 @var{freq} set new frequency parameter.
1746 @var{width} set new width parameter in herz.
1747 @var{gain} set new gain parameter in dB.
1748
1749 Full filter invocation with asendcmd may look like this:
1750 asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
1751 @end table
1752
1753 @section anlmdn
1754
1755 Reduce broadband noise in audio samples using Non-Local Means algorithm.
1756
1757 Each sample is adjusted by looking for other samples with similar contexts. This
1758 context similarity is defined by comparing their surrounding patches of size
1759 @option{p}. Patches are searched in an area of @option{r} around the sample.
1760
1761 The filter accepts the following options.
1762
1763 @table @option
1764 @item s
1765 Set denoising strength. Allowed range is from 1 to 9999. Default value is 1.
1766
1767 @item p
1768 Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
1769 Default value is 2 milliseconds.
1770
1771 @item r
1772 Set research radius duration. Allowed range is from 2 to 300 milliseconds.
1773 Default value is 6 milliseconds.
1774 @end table
1775
1776 @section anull
1777
1778 Pass the audio source unchanged to the output.
1779
1780 @section apad
1781
1782 Pad the end of an audio stream with silence.
1783
1784 This can be used together with @command{ffmpeg} @option{-shortest} to
1785 extend audio streams to the same length as the video stream.
1786
1787 A description of the accepted options follows.
1788
1789 @table @option
1790 @item packet_size
1791 Set silence packet size. Default value is 4096.
1792
1793 @item pad_len
1794 Set the number of samples of silence to add to the end. After the
1795 value is reached, the stream is terminated. This option is mutually
1796 exclusive with @option{whole_len}.
1797
1798 @item whole_len
1799 Set the minimum total number of samples in the output audio stream. If
1800 the value is longer than the input audio length, silence is added to
1801 the end, until the value is reached. This option is mutually exclusive
1802 with @option{pad_len}.
1803
1804 @item pad_dur
1805 Specify the duration of samples of silence to add. See
1806 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
1807 for the accepted syntax. Used only if set to non-zero value.
1808
1809 @item whole_dur
1810 Specify the minimum total duration in the output audio stream. See
1811 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
1812 for the accepted syntax. Used only if set to non-zero value. If the value is longer than
1813 the input audio length, silence is added to the end, until the value is reached.
1814 This option is mutually exclusive with @option{pad_dur}
1815 @end table
1816
1817 If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
1818 nor @option{whole_dur} option is set, the filter will add silence to the end of
1819 the input stream indefinitely.
1820
1821 @subsection Examples
1822
1823 @itemize
1824 @item
1825 Add 1024 samples of silence to the end of the input:
1826 @example
1827 apad=pad_len=1024
1828 @end example
1829
1830 @item
1831 Make sure the audio output will contain at least 10000 samples, pad
1832 the input with silence if required:
1833 @example
1834 apad=whole_len=10000
1835 @end example
1836
1837 @item
1838 Use @command{ffmpeg} to pad the audio input with silence, so that the
1839 video stream will always result the shortest and will be converted
1840 until the end in the output file when using the @option{shortest}
1841 option:
1842 @example
1843 ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
1844 @end example
1845 @end itemize
1846
1847 @section aphaser
1848 Add a phasing effect to the input audio.
1849
1850 A phaser filter creates series of peaks and troughs in the frequency spectrum.
1851 The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
1852
1853 A description of the accepted parameters follows.
1854
1855 @table @option
1856 @item in_gain
1857 Set input gain. Default is 0.4.
1858
1859 @item out_gain
1860 Set output gain. Default is 0.74
1861
1862 @item delay
1863 Set delay in milliseconds. Default is 3.0.
1864
1865 @item decay
1866 Set decay. Default is 0.4.
1867
1868 @item speed
1869 Set modulation speed in Hz. Default is 0.5.
1870
1871 @item type
1872 Set modulation type. Default is triangular.
1873
1874 It accepts the following values:
1875 @table @samp
1876 @item triangular, t
1877 @item sinusoidal, s
1878 @end table
1879 @end table
1880
1881 @section apulsator
1882
1883 Audio pulsator is something between an autopanner and a tremolo.
1884 But it can produce funny stereo effects as well. Pulsator changes the volume
1885 of the left and right channel based on a LFO (low frequency oscillator) with
1886 different waveforms and shifted phases.
1887 This filter have the ability to define an offset between left and right
1888 channel. An offset of 0 means that both LFO shapes match each other.
1889 The left and right channel are altered equally - a conventional tremolo.
1890 An offset of 50% means that the shape of the right channel is exactly shifted
1891 in phase (or moved backwards about half of the frequency) - pulsator acts as
1892 an autopanner. At 1 both curves match again. Every setting in between moves the
1893 phase shift gapless between all stages and produces some "bypassing" sounds with
1894 sine and triangle waveforms. The more you set the offset near 1 (starting from
1895 the 0.5) the faster the signal passes from the left to the right speaker.
1896
1897 The filter accepts the following options:
1898
1899 @table @option
1900 @item level_in
1901 Set input gain. By default it is 1. Range is [0.015625 - 64].
1902
1903 @item level_out
1904 Set output gain. By default it is 1. Range is [0.015625 - 64].
1905
1906 @item mode
1907 Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
1908 sawup or sawdown. Default is sine.
1909
1910 @item amount
1911 Set modulation. Define how much of original signal is affected by the LFO.
1912
1913 @item offset_l
1914 Set left channel offset. Default is 0. Allowed range is [0 - 1].
1915
1916 @item offset_r
1917 Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
1918
1919 @item width
1920 Set pulse width. Default is 1. Allowed range is [0 - 2].
1921
1922 @item timing
1923 Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
1924
1925 @item bpm
1926 Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
1927 is set to bpm.
1928
1929 @item ms
1930 Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
1931 is set to ms.
1932
1933 @item hz
1934 Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
1935 if timing is set to hz.
1936 @end table
1937
1938 @anchor{aresample}
1939 @section aresample
1940
1941 Resample the input audio to the specified parameters, using the
1942 libswresample library. If none are specified then the filter will
1943 automatically convert between its input and output.
1944
1945 This filter is also able to stretch/squeeze the audio data to make it match
1946 the timestamps or to inject silence / cut out audio to make it match the
1947 timestamps, do a combination of both or do neither.
1948
1949 The filter accepts the syntax
1950 [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
1951 expresses a sample rate and @var{resampler_options} is a list of
1952 @var{key}=@var{value} pairs, separated by ":". See the
1953 @ref{Resampler Options,,"Resampler Options" section in the
1954 ffmpeg-resampler(1) manual,ffmpeg-resampler}
1955 for the complete list of supported options.
1956
1957 @subsection Examples
1958
1959 @itemize
1960 @item
1961 Resample the input audio to 44100Hz:
1962 @example
1963 aresample=44100
1964 @end example
1965
1966 @item
1967 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
1968 samples per second compensation:
1969 @example
1970 aresample=async=1000
1971 @end example
1972 @end itemize
1973
1974 @section areverse
1975
1976 Reverse an audio clip.
1977
1978 Warning: This filter requires memory to buffer the entire clip, so trimming
1979 is suggested.
1980
1981 @subsection Examples
1982
1983 @itemize
1984 @item
1985 Take the first 5 seconds of a clip, and reverse it.
1986 @example
1987 atrim=end=5,areverse
1988 @end example
1989 @end itemize
1990
1991 @section asetnsamples
1992
1993 Set the number of samples per each output audio frame.
1994
1995 The last output packet may contain a different number of samples, as
1996 the filter will flush all the remaining samples when the input audio
1997 signals its end.
1998
1999 The filter accepts the following options:
2000
2001 @table @option
2002
2003 @item nb_out_samples, n
2004 Set the number of frames per each output audio frame. The number is
2005 intended as the number of samples @emph{per each channel}.
2006 Default value is 1024.
2007
2008 @item pad, p
2009 If set to 1, the filter will pad the last audio frame with zeroes, so
2010 that the last frame will contain the same number of samples as the
2011 previous ones. Default value is 1.
2012 @end table
2013
2014 For example, to set the number of per-frame samples to 1234 and
2015 disable padding for the last frame, use:
2016 @example
2017 asetnsamples=n=1234:p=0
2018 @end example
2019
2020 @section asetrate
2021
2022 Set the sample rate without altering the PCM data.
2023 This will result in a change of speed and pitch.
2024
2025 The filter accepts the following options:
2026
2027 @table @option
2028 @item sample_rate, r
2029 Set the output sample rate. Default is 44100 Hz.
2030 @end table
2031
2032 @section ashowinfo
2033
2034 Show a line containing various information for each input audio frame.
2035 The input audio is not modified.
2036
2037 The shown line contains a sequence of key/value pairs of the form
2038 @var{key}:@var{value}.
2039
2040 The following values are shown in the output:
2041
2042 @table @option
2043 @item n
2044 The (sequential) number of the input frame, starting from 0.
2045
2046 @item pts
2047 The presentation timestamp of the input frame, in time base units; the time base
2048 depends on the filter input pad, and is usually 1/@var{sample_rate}.
2049
2050 @item pts_time
2051 The presentation timestamp of the input frame in seconds.
2052
2053 @item pos
2054 position of the frame in the input stream, -1 if this information in
2055 unavailable and/or meaningless (for example in case of synthetic audio)
2056
2057 @item fmt
2058 The sample format.
2059
2060 @item chlayout
2061 The channel layout.
2062
2063 @item rate
2064 The sample rate for the audio frame.
2065
2066 @item nb_samples
2067 The number of samples (per channel) in the frame.
2068
2069 @item checksum
2070 The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
2071 audio, the data is treated as if all the planes were concatenated.
2072
2073 @item plane_checksums
2074 A list of Adler-32 checksums for each data plane.
2075 @end table
2076
2077 @anchor{astats}
2078 @section astats
2079
2080 Display time domain statistical information about the audio channels.
2081 Statistics are calculated and displayed for each audio channel and,
2082 where applicable, an overall figure is also given.
2083
2084 It accepts the following option:
2085 @table @option
2086 @item length
2087 Short window length in seconds, used for peak and trough RMS measurement.
2088 Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
2089
2090 @item metadata
2091
2092 Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
2093 where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
2094 disabled.
2095
2096 Available keys for each channel are:
2097 DC_offset
2098 Min_level
2099 Max_level
2100 Min_difference
2101 Max_difference
2102 Mean_difference
2103 RMS_difference
2104 Peak_level
2105 RMS_peak
2106 RMS_trough
2107 Crest_factor
2108 Flat_factor
2109 Peak_count
2110 Bit_depth
2111 Dynamic_range
2112 Zero_crossings
2113 Zero_crossings_rate
2114
2115 and for Overall:
2116 DC_offset
2117 Min_level
2118 Max_level
2119 Min_difference
2120 Max_difference
2121 Mean_difference
2122 RMS_difference
2123 Peak_level
2124 RMS_level
2125 RMS_peak
2126 RMS_trough
2127 Flat_factor
2128 Peak_count
2129 Bit_depth
2130 Number_of_samples
2131
2132 For example full key look like this @code{lavfi.astats.1.DC_offset} or
2133 this @code{lavfi.astats.Overall.Peak_count}.
2134
2135 For description what each key means read below.
2136
2137 @item reset
2138 Set number of frame after which stats are going to be recalculated.
2139 Default is disabled.
2140 @end table
2141
2142 A description of each shown parameter follows:
2143
2144 @table @option
2145 @item DC offset
2146 Mean amplitude displacement from zero.
2147
2148 @item Min level
2149 Minimal sample level.
2150
2151 @item Max level
2152 Maximal sample level.
2153
2154 @item Min difference
2155 Minimal difference between two consecutive samples.
2156
2157 @item Max difference
2158 Maximal difference between two consecutive samples.
2159
2160 @item Mean difference
2161 Mean difference between two consecutive samples.
2162 The average of each difference between two consecutive samples.
2163
2164 @item RMS difference
2165 Root Mean Square difference between two consecutive samples.
2166
2167 @item Peak level dB
2168 @item RMS level dB
2169 Standard peak and RMS level measured in dBFS.
2170
2171 @item RMS peak dB
2172 @item RMS trough dB
2173 Peak and trough values for RMS level measured over a short window.
2174
2175 @item Crest factor
2176 Standard ratio of peak to RMS level (note: not in dB).
2177
2178 @item Flat factor
2179 Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
2180 (i.e. either @var{Min level} or @var{Max level}).
2181
2182 @item Peak count
2183 Number of occasions (not the number of samples) that the signal attained either
2184 @var{Min level} or @var{Max level}.
2185
2186 @item Bit depth
2187 Overall bit depth of audio. Number of bits used for each sample.
2188
2189 @item Dynamic range
2190 Measured dynamic range of audio in dB.
2191
2192 @item Zero crossings
2193 Number of points where the waveform crosses the zero level axis.
2194
2195 @item Zero crossings rate
2196 Rate of Zero crossings and number of audio samples.
2197 @end table
2198
2199 @section atempo
2200
2201 Adjust audio tempo.
2202
2203 The filter accepts exactly one parameter, the audio tempo. If not
2204 specified then the filter will assume nominal 1.0 tempo. Tempo must
2205 be in the [0.5, 100.0] range.
2206
2207 Note that tempo greater than 2 will skip some samples rather than
2208 blend them in.  If for any reason this is a concern it is always
2209 possible to daisy-chain several instances of atempo to achieve the
2210 desired product tempo.
2211
2212 @subsection Examples
2213
2214 @itemize
2215 @item
2216 Slow down audio to 80% tempo:
2217 @example
2218 atempo=0.8
2219 @end example
2220
2221 @item
2222 To speed up audio to 300% tempo:
2223 @example
2224 atempo=3
2225 @end example
2226
2227 @item
2228 To speed up audio to 300% tempo by daisy-chaining two atempo instances:
2229 @example
2230 atempo=sqrt(3),atempo=sqrt(3)
2231 @end example
2232 @end itemize
2233
2234 @section atrim
2235
2236 Trim the input so that the output contains one continuous subpart of the input.
2237
2238 It accepts the following parameters:
2239 @table @option
2240 @item start
2241 Timestamp (in seconds) of the start of the section to keep. I.e. the audio
2242 sample with the timestamp @var{start} will be the first sample in the output.
2243
2244 @item end
2245 Specify time of the first audio sample that will be dropped, i.e. the
2246 audio sample immediately preceding the one with the timestamp @var{end} will be
2247 the last sample in the output.
2248
2249 @item start_pts
2250 Same as @var{start}, except this option sets the start timestamp in samples
2251 instead of seconds.
2252
2253 @item end_pts
2254 Same as @var{end}, except this option sets the end timestamp in samples instead
2255 of seconds.
2256
2257 @item duration
2258 The maximum duration of the output in seconds.
2259
2260 @item start_sample
2261 The number of the first sample that should be output.
2262
2263 @item end_sample
2264 The number of the first sample that should be dropped.
2265 @end table
2266
2267 @option{start}, @option{end}, and @option{duration} are expressed as time
2268 duration specifications; see
2269 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
2270
2271 Note that the first two sets of the start/end options and the @option{duration}
2272 option look at the frame timestamp, while the _sample options simply count the
2273 samples that pass through the filter. So start/end_pts and start/end_sample will
2274 give different results when the timestamps are wrong, inexact or do not start at
2275 zero. Also note that this filter does not modify the timestamps. If you wish
2276 to have the output timestamps start at zero, insert the asetpts filter after the
2277 atrim filter.
2278
2279 If multiple start or end options are set, this filter tries to be greedy and
2280 keep all samples that match at least one of the specified constraints. To keep
2281 only the part that matches all the constraints at once, chain multiple atrim
2282 filters.
2283
2284 The defaults are such that all the input is kept. So it is possible to set e.g.
2285 just the end values to keep everything before the specified time.
2286
2287 Examples:
2288 @itemize
2289 @item
2290 Drop everything except the second minute of input:
2291 @example
2292 ffmpeg -i INPUT -af atrim=60:120
2293 @end example
2294
2295 @item
2296 Keep only the first 1000 samples:
2297 @example
2298 ffmpeg -i INPUT -af atrim=end_sample=1000
2299 @end example
2300
2301 @end itemize
2302
2303 @section bandpass
2304
2305 Apply a two-pole Butterworth band-pass filter with central
2306 frequency @var{frequency}, and (3dB-point) band-width width.
2307 The @var{csg} option selects a constant skirt gain (peak gain = Q)
2308 instead of the default: constant 0dB peak gain.
2309 The filter roll off at 6dB per octave (20dB per decade).
2310
2311 The filter accepts the following options:
2312
2313 @table @option
2314 @item frequency, f
2315 Set the filter's central frequency. Default is @code{3000}.
2316
2317 @item csg
2318 Constant skirt gain if set to 1. Defaults to 0.
2319
2320 @item width_type, t
2321 Set method to specify band-width of filter.
2322 @table @option
2323 @item h
2324 Hz
2325 @item q
2326 Q-Factor
2327 @item o
2328 octave
2329 @item s
2330 slope
2331 @item k
2332 kHz
2333 @end table
2334
2335 @item width, w
2336 Specify the band-width of a filter in width_type units.
2337
2338 @item channels, c
2339 Specify which channels to filter, by default all available are filtered.
2340 @end table
2341
2342 @subsection Commands
2343
2344 This filter supports the following commands:
2345 @table @option
2346 @item frequency, f
2347 Change bandpass frequency.
2348 Syntax for the command is : "@var{frequency}"
2349
2350 @item width_type, t
2351 Change bandpass width_type.
2352 Syntax for the command is : "@var{width_type}"
2353
2354 @item width, w
2355 Change bandpass width.
2356 Syntax for the command is : "@var{width}"
2357 @end table
2358
2359 @section bandreject
2360
2361 Apply a two-pole Butterworth band-reject filter with central
2362 frequency @var{frequency}, and (3dB-point) band-width @var{width}.
2363 The filter roll off at 6dB per octave (20dB per decade).
2364
2365 The filter accepts the following options:
2366
2367 @table @option
2368 @item frequency, f
2369 Set the filter's central frequency. Default is @code{3000}.
2370
2371 @item width_type, t
2372 Set method to specify band-width of filter.
2373 @table @option
2374 @item h
2375 Hz
2376 @item q
2377 Q-Factor
2378 @item o
2379 octave
2380 @item s
2381 slope
2382 @item k
2383 kHz
2384 @end table
2385
2386 @item width, w
2387 Specify the band-width of a filter in width_type units.
2388
2389 @item channels, c
2390 Specify which channels to filter, by default all available are filtered.
2391 @end table
2392
2393 @subsection Commands
2394
2395 This filter supports the following commands:
2396 @table @option
2397 @item frequency, f
2398 Change bandreject frequency.
2399 Syntax for the command is : "@var{frequency}"
2400
2401 @item width_type, t
2402 Change bandreject width_type.
2403 Syntax for the command is : "@var{width_type}"
2404
2405 @item width, w
2406 Change bandreject width.
2407 Syntax for the command is : "@var{width}"
2408 @end table
2409
2410 @section bass, lowshelf
2411
2412 Boost or cut the bass (lower) frequencies of the audio using a two-pole
2413 shelving filter with a response similar to that of a standard
2414 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
2415
2416 The filter accepts the following options:
2417
2418 @table @option
2419 @item gain, g
2420 Give the gain at 0 Hz. Its useful range is about -20
2421 (for a large cut) to +20 (for a large boost).
2422 Beware of clipping when using a positive gain.
2423
2424 @item frequency, f
2425 Set the filter's central frequency and so can be used
2426 to extend or reduce the frequency range to be boosted or cut.
2427 The default value is @code{100} Hz.
2428
2429 @item width_type, t
2430 Set method to specify band-width of filter.
2431 @table @option
2432 @item h
2433 Hz
2434 @item q
2435 Q-Factor
2436 @item o
2437 octave
2438 @item s
2439 slope
2440 @item k
2441 kHz
2442 @end table
2443
2444 @item width, w
2445 Determine how steep is the filter's shelf transition.
2446
2447 @item channels, c
2448 Specify which channels to filter, by default all available are filtered.
2449 @end table
2450
2451 @subsection Commands
2452
2453 This filter supports the following commands:
2454 @table @option
2455 @item frequency, f
2456 Change bass frequency.
2457 Syntax for the command is : "@var{frequency}"
2458
2459 @item width_type, t
2460 Change bass width_type.
2461 Syntax for the command is : "@var{width_type}"
2462
2463 @item width, w
2464 Change bass width.
2465 Syntax for the command is : "@var{width}"
2466
2467 @item gain, g
2468 Change bass gain.
2469 Syntax for the command is : "@var{gain}"
2470 @end table
2471
2472 @section biquad
2473
2474 Apply a biquad IIR filter with the given coefficients.
2475 Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
2476 are the numerator and denominator coefficients respectively.
2477 and @var{channels}, @var{c} specify which channels to filter, by default all
2478 available are filtered.
2479
2480 @subsection Commands
2481
2482 This filter supports the following commands:
2483 @table @option
2484 @item a0
2485 @item a1
2486 @item a2
2487 @item b0
2488 @item b1
2489 @item b2
2490 Change biquad parameter.
2491 Syntax for the command is : "@var{value}"
2492 @end table
2493
2494 @section bs2b
2495 Bauer stereo to binaural transformation, which improves headphone listening of
2496 stereo audio records.
2497
2498 To enable compilation of this filter you need to configure FFmpeg with
2499 @code{--enable-libbs2b}.
2500
2501 It accepts the following parameters:
2502 @table @option
2503
2504 @item profile
2505 Pre-defined crossfeed level.
2506 @table @option
2507
2508 @item default
2509 Default level (fcut=700, feed=50).
2510
2511 @item cmoy
2512 Chu Moy circuit (fcut=700, feed=60).
2513
2514 @item jmeier
2515 Jan Meier circuit (fcut=650, feed=95).
2516
2517 @end table
2518
2519 @item fcut
2520 Cut frequency (in Hz).
2521
2522 @item feed
2523 Feed level (in Hz).
2524
2525 @end table
2526
2527 @section channelmap
2528
2529 Remap input channels to new locations.
2530
2531 It accepts the following parameters:
2532 @table @option
2533 @item map
2534 Map channels from input to output. The argument is a '|'-separated list of
2535 mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
2536 @var{in_channel} form. @var{in_channel} can be either the name of the input
2537 channel (e.g. FL for front left) or its index in the input channel layout.
2538 @var{out_channel} is the name of the output channel or its index in the output
2539 channel layout. If @var{out_channel} is not given then it is implicitly an
2540 index, starting with zero and increasing by one for each mapping.
2541
2542 @item channel_layout
2543 The channel layout of the output stream.
2544 @end table
2545
2546 If no mapping is present, the filter will implicitly map input channels to
2547 output channels, preserving indices.
2548
2549 @subsection Examples
2550
2551 @itemize
2552 @item
2553 For example, assuming a 5.1+downmix input MOV file,
2554 @example
2555 ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
2556 @end example
2557 will create an output WAV file tagged as stereo from the downmix channels of
2558 the input.
2559
2560 @item
2561 To fix a 5.1 WAV improperly encoded in AAC's native channel order
2562 @example
2563 ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
2564 @end example
2565 @end itemize
2566
2567 @section channelsplit
2568
2569 Split each channel from an input audio stream into a separate output stream.
2570
2571 It accepts the following parameters:
2572 @table @option
2573 @item channel_layout
2574 The channel layout of the input stream. The default is "stereo".
2575 @item channels
2576 A channel layout describing the channels to be extracted as separate output streams
2577 or "all" to extract each input channel as a separate stream. The default is "all".
2578
2579 Choosing channels not present in channel layout in the input will result in an error.
2580 @end table
2581
2582 @subsection Examples
2583
2584 @itemize
2585 @item
2586 For example, assuming a stereo input MP3 file,
2587 @example
2588 ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
2589 @end example
2590 will create an output Matroska file with two audio streams, one containing only
2591 the left channel and the other the right channel.
2592
2593 @item
2594 Split a 5.1 WAV file into per-channel files:
2595 @example
2596 ffmpeg -i in.wav -filter_complex
2597 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
2598 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
2599 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
2600 side_right.wav
2601 @end example
2602
2603 @item
2604 Extract only LFE from a 5.1 WAV file:
2605 @example
2606 ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
2607 -map '[LFE]' lfe.wav
2608 @end example
2609 @end itemize
2610
2611 @section chorus
2612 Add a chorus effect to the audio.
2613
2614 Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
2615
2616 Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
2617 constant, with chorus, it is varied using using sinusoidal or triangular modulation.
2618 The modulation depth defines the range the modulated delay is played before or after
2619 the delay. Hence the delayed sound will sound slower or faster, that is the delayed
2620 sound tuned around the original one, like in a chorus where some vocals are slightly
2621 off key.
2622
2623 It accepts the following parameters:
2624 @table @option
2625 @item in_gain
2626 Set input gain. Default is 0.4.
2627
2628 @item out_gain
2629 Set output gain. Default is 0.4.
2630
2631 @item delays
2632 Set delays. A typical delay is around 40ms to 60ms.
2633
2634 @item decays
2635 Set decays.
2636
2637 @item speeds
2638 Set speeds.
2639
2640 @item depths
2641 Set depths.
2642 @end table
2643
2644 @subsection Examples
2645
2646 @itemize
2647 @item
2648 A single delay:
2649 @example
2650 chorus=0.7:0.9:55:0.4:0.25:2
2651 @end example
2652
2653 @item
2654 Two delays:
2655 @example
2656 chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
2657 @end example
2658
2659 @item
2660 Fuller sounding chorus with three delays:
2661 @example
2662 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
2663 @end example
2664 @end itemize
2665
2666 @section compand
2667 Compress or expand the audio's dynamic range.
2668
2669 It accepts the following parameters:
2670
2671 @table @option
2672
2673 @item attacks
2674 @item decays
2675 A list of times in seconds for each channel over which the instantaneous level
2676 of the input signal is averaged to determine its volume. @var{attacks} refers to
2677 increase of volume and @var{decays} refers to decrease of volume. For most
2678 situations, the attack time (response to the audio getting louder) should be
2679 shorter than the decay time, because the human ear is more sensitive to sudden
2680 loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
2681 a typical value for decay is 0.8 seconds.
2682 If specified number of attacks & decays is lower than number of channels, the last
2683 set attack/decay will be used for all remaining channels.
2684
2685 @item points
2686 A list of points for the transfer function, specified in dB relative to the
2687 maximum possible signal amplitude. Each key points list must be defined using
2688 the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
2689 @code{x0/y0 x1/y1 x2/y2 ....}
2690
2691 The input values must be in strictly increasing order but the transfer function
2692 does not have to be monotonically rising. The point @code{0/0} is assumed but
2693 may be overridden (by @code{0/out-dBn}). Typical values for the transfer
2694 function are @code{-70/-70|-60/-20|1/0}.
2695
2696 @item soft-knee
2697 Set the curve radius in dB for all joints. It defaults to 0.01.
2698
2699 @item gain
2700 Set the additional gain in dB to be applied at all points on the transfer
2701 function. This allows for easy adjustment of the overall gain.
2702 It defaults to 0.
2703
2704 @item volume
2705 Set an initial volume, in dB, to be assumed for each channel when filtering
2706 starts. This permits the user to supply a nominal level initially, so that, for
2707 example, a very large gain is not applied to initial signal levels before the
2708 companding has begun to operate. A typical value for audio which is initially
2709 quiet is -90 dB. It defaults to 0.
2710
2711 @item delay
2712 Set a delay, in seconds. The input audio is analyzed immediately, but audio is
2713 delayed before being fed to the volume adjuster. Specifying a delay
2714 approximately equal to the attack/decay times allows the filter to effectively
2715 operate in predictive rather than reactive mode. It defaults to 0.
2716
2717 @end table
2718
2719 @subsection Examples
2720
2721 @itemize
2722 @item
2723 Make music with both quiet and loud passages suitable for listening to in a
2724 noisy environment:
2725 @example
2726 compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
2727 @end example
2728
2729 Another example for audio with whisper and explosion parts:
2730 @example
2731 compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
2732 @end example
2733
2734 @item
2735 A noise gate for when the noise is at a lower level than the signal:
2736 @example
2737 compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
2738 @end example
2739
2740 @item
2741 Here is another noise gate, this time for when the noise is at a higher level
2742 than the signal (making it, in some ways, similar to squelch):
2743 @example
2744 compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
2745 @end example
2746
2747 @item
2748 2:1 compression starting at -6dB:
2749 @example
2750 compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
2751 @end example
2752
2753 @item
2754 2:1 compression starting at -9dB:
2755 @example
2756 compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
2757 @end example
2758
2759 @item
2760 2:1 compression starting at -12dB:
2761 @example
2762 compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
2763 @end example
2764
2765 @item
2766 2:1 compression starting at -18dB:
2767 @example
2768 compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
2769 @end example
2770
2771 @item
2772 3:1 compression starting at -15dB:
2773 @example
2774 compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
2775 @end example
2776
2777 @item
2778 Compressor/Gate:
2779 @example
2780 compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
2781 @end example
2782
2783 @item
2784 Expander:
2785 @example
2786 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
2787 @end example
2788
2789 @item
2790 Hard limiter at -6dB:
2791 @example
2792 compand=attacks=0:points=-80/-80|-6/-6|20/-6
2793 @end example
2794
2795 @item
2796 Hard limiter at -12dB:
2797 @example
2798 compand=attacks=0:points=-80/-80|-12/-12|20/-12
2799 @end example
2800
2801 @item
2802 Hard noise gate at -35 dB:
2803 @example
2804 compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
2805 @end example
2806
2807 @item
2808 Soft limiter:
2809 @example
2810 compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
2811 @end example
2812 @end itemize
2813
2814 @section compensationdelay
2815
2816 Compensation Delay Line is a metric based delay to compensate differing
2817 positions of microphones or speakers.
2818
2819 For example, you have recorded guitar with two microphones placed in
2820 different location. Because the front of sound wave has fixed speed in
2821 normal conditions, the phasing of microphones can vary and depends on
2822 their location and interposition. The best sound mix can be achieved when
2823 these microphones are in phase (synchronized). Note that distance of
2824 ~30 cm between microphones makes one microphone to capture signal in
2825 antiphase to another microphone. That makes the final mix sounding moody.
2826 This filter helps to solve phasing problems by adding different delays
2827 to each microphone track and make them synchronized.
2828
2829 The best result can be reached when you take one track as base and
2830 synchronize other tracks one by one with it.
2831 Remember that synchronization/delay tolerance depends on sample rate, too.
2832 Higher sample rates will give more tolerance.
2833
2834 It accepts the following parameters:
2835
2836 @table @option
2837 @item mm
2838 Set millimeters distance. This is compensation distance for fine tuning.
2839 Default is 0.
2840
2841 @item cm
2842 Set cm distance. This is compensation distance for tightening distance setup.
2843 Default is 0.
2844
2845 @item m
2846 Set meters distance. This is compensation distance for hard distance setup.
2847 Default is 0.
2848
2849 @item dry
2850 Set dry amount. Amount of unprocessed (dry) signal.
2851 Default is 0.
2852
2853 @item wet
2854 Set wet amount. Amount of processed (wet) signal.
2855 Default is 1.
2856
2857 @item temp
2858 Set temperature degree in Celsius. This is the temperature of the environment.
2859 Default is 20.
2860 @end table
2861
2862 @section crossfeed
2863 Apply headphone crossfeed filter.
2864
2865 Crossfeed is the process of blending the left and right channels of stereo
2866 audio recording.
2867 It is mainly used to reduce extreme stereo separation of low frequencies.
2868
2869 The intent is to produce more speaker like sound to the listener.
2870
2871 The filter accepts the following options:
2872
2873 @table @option
2874 @item strength
2875 Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
2876 This sets gain of low shelf filter for side part of stereo image.
2877 Default is -6dB. Max allowed is -30db when strength is set to 1.
2878
2879 @item range
2880 Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
2881 This sets cut off frequency of low shelf filter. Default is cut off near
2882 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
2883
2884 @item level_in
2885 Set input gain. Default is 0.9.
2886
2887 @item level_out
2888 Set output gain. Default is 1.
2889 @end table
2890
2891 @section crystalizer
2892 Simple algorithm to expand audio dynamic range.
2893
2894 The filter accepts the following options:
2895
2896 @table @option
2897 @item i
2898 Sets the intensity of effect (default: 2.0). Must be in range between 0.0
2899 (unchanged sound) to 10.0 (maximum effect).
2900
2901 @item c
2902 Enable clipping. By default is enabled.
2903 @end table
2904
2905 @section dcshift
2906 Apply a DC shift to the audio.
2907
2908 This can be useful to remove a DC offset (caused perhaps by a hardware problem
2909 in the recording chain) from the audio. The effect of a DC offset is reduced
2910 headroom and hence volume. The @ref{astats} filter can be used to determine if
2911 a signal has a DC offset.
2912
2913 @table @option
2914 @item shift
2915 Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
2916 the audio.
2917
2918 @item limitergain
2919 Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
2920 used to prevent clipping.
2921 @end table
2922
2923 @section drmeter
2924 Measure audio dynamic range.
2925
2926 DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
2927 is found in transition material. And anything less that 8 have very poor dynamics
2928 and is very compressed.
2929
2930 The filter accepts the following options:
2931
2932 @table @option
2933 @item length
2934 Set window length in seconds used to split audio into segments of equal length.
2935 Default is 3 seconds.
2936 @end table
2937
2938 @section dynaudnorm
2939 Dynamic Audio Normalizer.
2940
2941 This filter applies a certain amount of gain to the input audio in order
2942 to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
2943 contrast to more "simple" normalization algorithms, the Dynamic Audio
2944 Normalizer *dynamically* re-adjusts the gain factor to the input audio.
2945 This allows for applying extra gain to the "quiet" sections of the audio
2946 while avoiding distortions or clipping the "loud" sections. In other words:
2947 The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
2948 sections, in the sense that the volume of each section is brought to the
2949 same target level. Note, however, that the Dynamic Audio Normalizer achieves
2950 this goal *without* applying "dynamic range compressing". It will retain 100%
2951 of the dynamic range *within* each section of the audio file.
2952
2953 @table @option
2954 @item f
2955 Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
2956 Default is 500 milliseconds.
2957 The Dynamic Audio Normalizer processes the input audio in small chunks,
2958 referred to as frames. This is required, because a peak magnitude has no
2959 meaning for just a single sample value. Instead, we need to determine the
2960 peak magnitude for a contiguous sequence of sample values. While a "standard"
2961 normalizer would simply use the peak magnitude of the complete file, the
2962 Dynamic Audio Normalizer determines the peak magnitude individually for each
2963 frame. The length of a frame is specified in milliseconds. By default, the
2964 Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
2965 been found to give good results with most files.
2966 Note that the exact frame length, in number of samples, will be determined
2967 automatically, based on the sampling rate of the individual input audio file.
2968
2969 @item g
2970 Set the Gaussian filter window size. In range from 3 to 301, must be odd
2971 number. Default is 31.
2972 Probably the most important parameter of the Dynamic Audio Normalizer is the
2973 @code{window size} of the Gaussian smoothing filter. The filter's window size
2974 is specified in frames, centered around the current frame. For the sake of
2975 simplicity, this must be an odd number. Consequently, the default value of 31
2976 takes into account the current frame, as well as the 15 preceding frames and
2977 the 15 subsequent frames. Using a larger window results in a stronger
2978 smoothing effect and thus in less gain variation, i.e. slower gain
2979 adaptation. Conversely, using a smaller window results in a weaker smoothing
2980 effect and thus in more gain variation, i.e. faster gain adaptation.
2981 In other words, the more you increase this value, the more the Dynamic Audio
2982 Normalizer will behave like a "traditional" normalization filter. On the
2983 contrary, the more you decrease this value, the more the Dynamic Audio
2984 Normalizer will behave like a dynamic range compressor.
2985
2986 @item p
2987 Set the target peak value. This specifies the highest permissible magnitude
2988 level for the normalized audio input. This filter will try to approach the
2989 target peak magnitude as closely as possible, but at the same time it also
2990 makes sure that the normalized signal will never exceed the peak magnitude.
2991 A frame's maximum local gain factor is imposed directly by the target peak
2992 magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
2993 It is not recommended to go above this value.
2994
2995 @item m
2996 Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
2997 The Dynamic Audio Normalizer determines the maximum possible (local) gain
2998 factor for each input frame, i.e. the maximum gain factor that does not
2999 result in clipping or distortion. The maximum gain factor is determined by
3000 the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
3001 additionally bounds the frame's maximum gain factor by a predetermined
3002 (global) maximum gain factor. This is done in order to avoid excessive gain
3003 factors in "silent" or almost silent frames. By default, the maximum gain
3004 factor is 10.0, For most inputs the default value should be sufficient and
3005 it usually is not recommended to increase this value. Though, for input
3006 with an extremely low overall volume level, it may be necessary to allow even
3007 higher gain factors. Note, however, that the Dynamic Audio Normalizer does
3008 not simply apply a "hard" threshold (i.e. cut off values above the threshold).
3009 Instead, a "sigmoid" threshold function will be applied. This way, the
3010 gain factors will smoothly approach the threshold value, but never exceed that
3011 value.
3012
3013 @item r
3014 Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
3015 By default, the Dynamic Audio Normalizer performs "peak" normalization.
3016 This means that the maximum local gain factor for each frame is defined
3017 (only) by the frame's highest magnitude sample. This way, the samples can
3018 be amplified as much as possible without exceeding the maximum signal
3019 level, i.e. without clipping. Optionally, however, the Dynamic Audio
3020 Normalizer can also take into account the frame's root mean square,
3021 abbreviated RMS. In electrical engineering, the RMS is commonly used to
3022 determine the power of a time-varying signal. It is therefore considered
3023 that the RMS is a better approximation of the "perceived loudness" than
3024 just looking at the signal's peak magnitude. Consequently, by adjusting all
3025 frames to a constant RMS value, a uniform "perceived loudness" can be
3026 established. If a target RMS value has been specified, a frame's local gain
3027 factor is defined as the factor that would result in exactly that RMS value.
3028 Note, however, that the maximum local gain factor is still restricted by the
3029 frame's highest magnitude sample, in order to prevent clipping.
3030
3031 @item n
3032 Enable channels coupling. By default is enabled.
3033 By default, the Dynamic Audio Normalizer will amplify all channels by the same
3034 amount. This means the same gain factor will be applied to all channels, i.e.
3035 the maximum possible gain factor is determined by the "loudest" channel.
3036 However, in some recordings, it may happen that the volume of the different
3037 channels is uneven, e.g. one channel may be "quieter" than the other one(s).
3038 In this case, this option can be used to disable the channel coupling. This way,
3039 the gain factor will be determined independently for each channel, depending
3040 only on the individual channel's highest magnitude sample. This allows for
3041 harmonizing the volume of the different channels.
3042
3043 @item c
3044 Enable DC bias correction. By default is disabled.
3045 An audio signal (in the time domain) is a sequence of sample values.
3046 In the Dynamic Audio Normalizer these sample values are represented in the
3047 -1.0 to 1.0 range, regardless of the original input format. Normally, the
3048 audio signal, or "waveform", should be centered around the zero point.
3049 That means if we calculate the mean value of all samples in a file, or in a
3050 single frame, then the result should be 0.0 or at least very close to that
3051 value. If, however, there is a significant deviation of the mean value from
3052 0.0, in either positive or negative direction, this is referred to as a
3053 DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
3054 Audio Normalizer provides optional DC bias correction.
3055 With DC bias correction enabled, the Dynamic Audio Normalizer will determine
3056 the mean value, or "DC correction" offset, of each input frame and subtract
3057 that value from all of the frame's sample values which ensures those samples
3058 are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
3059 boundaries, the DC correction offset values will be interpolated smoothly
3060 between neighbouring frames.
3061
3062 @item b
3063 Enable alternative boundary mode. By default is disabled.
3064 The Dynamic Audio Normalizer takes into account a certain neighbourhood
3065 around each frame. This includes the preceding frames as well as the
3066 subsequent frames. However, for the "boundary" frames, located at the very
3067 beginning and at the very end of the audio file, not all neighbouring
3068 frames are available. In particular, for the first few frames in the audio
3069 file, the preceding frames are not known. And, similarly, for the last few
3070 frames in the audio file, the subsequent frames are not known. Thus, the
3071 question arises which gain factors should be assumed for the missing frames
3072 in the "boundary" region. The Dynamic Audio Normalizer implements two modes
3073 to deal with this situation. The default boundary mode assumes a gain factor
3074 of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
3075 "fade out" at the beginning and at the end of the input, respectively.
3076
3077 @item s
3078 Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
3079 By default, the Dynamic Audio Normalizer does not apply "traditional"
3080 compression. This means that signal peaks will not be pruned and thus the
3081 full dynamic range will be retained within each local neighbourhood. However,
3082 in some cases it may be desirable to combine the Dynamic Audio Normalizer's
3083 normalization algorithm with a more "traditional" compression.
3084 For this purpose, the Dynamic Audio Normalizer provides an optional compression
3085 (thresholding) function. If (and only if) the compression feature is enabled,
3086 all input frames will be processed by a soft knee thresholding function prior
3087 to the actual normalization process. Put simply, the thresholding function is
3088 going to prune all samples whose magnitude exceeds a certain threshold value.
3089 However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
3090 value. Instead, the threshold value will be adjusted for each individual
3091 frame.
3092 In general, smaller parameters result in stronger compression, and vice versa.
3093 Values below 3.0 are not recommended, because audible distortion may appear.
3094 @end table
3095
3096 @section earwax
3097
3098 Make audio easier to listen to on headphones.
3099
3100 This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
3101 so that when listened to on headphones the stereo image is moved from
3102 inside your head (standard for headphones) to outside and in front of
3103 the listener (standard for speakers).
3104
3105 Ported from SoX.
3106
3107 @section equalizer
3108
3109 Apply a two-pole peaking equalisation (EQ) filter. With this
3110 filter, the signal-level at and around a selected frequency can
3111 be increased or decreased, whilst (unlike bandpass and bandreject
3112 filters) that at all other frequencies is unchanged.
3113
3114 In order to produce complex equalisation curves, this filter can
3115 be given several times, each with a different central frequency.
3116
3117 The filter accepts the following options:
3118
3119 @table @option
3120 @item frequency, f
3121 Set the filter's central frequency in Hz.
3122
3123 @item width_type, t
3124 Set method to specify band-width of filter.
3125 @table @option
3126 @item h
3127 Hz
3128 @item q
3129 Q-Factor
3130 @item o
3131 octave
3132 @item s
3133 slope
3134 @item k
3135 kHz
3136 @end table
3137
3138 @item width, w
3139 Specify the band-width of a filter in width_type units.
3140
3141 @item gain, g
3142 Set the required gain or attenuation in dB.
3143 Beware of clipping when using a positive gain.
3144
3145 @item channels, c
3146 Specify which channels to filter, by default all available are filtered.
3147 @end table
3148
3149 @subsection Examples
3150 @itemize
3151 @item
3152 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
3153 @example
3154 equalizer=f=1000:t=h:width=200:g=-10
3155 @end example
3156
3157 @item
3158 Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
3159 @example
3160 equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
3161 @end example
3162 @end itemize
3163
3164 @subsection Commands
3165
3166 This filter supports the following commands:
3167 @table @option
3168 @item frequency, f
3169 Change equalizer frequency.
3170 Syntax for the command is : "@var{frequency}"
3171
3172 @item width_type, t
3173 Change equalizer width_type.
3174 Syntax for the command is : "@var{width_type}"
3175
3176 @item width, w
3177 Change equalizer width.
3178 Syntax for the command is : "@var{width}"
3179
3180 @item gain, g
3181 Change equalizer gain.
3182 Syntax for the command is : "@var{gain}"
3183 @end table
3184
3185 @section extrastereo
3186
3187 Linearly increases the difference between left and right channels which
3188 adds some sort of "live" effect to playback.
3189
3190 The filter accepts the following options:
3191
3192 @table @option
3193 @item m
3194 Sets the difference coefficient (default: 2.5). 0.0 means mono sound
3195 (average of both channels), with 1.0 sound will be unchanged, with
3196 -1.0 left and right channels will be swapped.
3197
3198 @item c
3199 Enable clipping. By default is enabled.
3200 @end table
3201
3202 @section firequalizer
3203 Apply FIR Equalization using arbitrary frequency response.
3204
3205 The filter accepts the following option:
3206
3207 @table @option
3208 @item gain
3209 Set gain curve equation (in dB). The expression can contain variables:
3210 @table @option
3211 @item f
3212 the evaluated frequency
3213 @item sr
3214 sample rate
3215 @item ch
3216 channel number, set to 0 when multichannels evaluation is disabled
3217 @item chid
3218 channel id, see libavutil/channel_layout.h, set to the first channel id when
3219 multichannels evaluation is disabled
3220 @item chs
3221 number of channels
3222 @item chlayout
3223 channel_layout, see libavutil/channel_layout.h
3224
3225 @end table
3226 and functions:
3227 @table @option
3228 @item gain_interpolate(f)
3229 interpolate gain on frequency f based on gain_entry
3230 @item cubic_interpolate(f)
3231 same as gain_interpolate, but smoother
3232 @end table
3233 This option is also available as command. Default is @code{gain_interpolate(f)}.
3234
3235 @item gain_entry
3236 Set gain entry for gain_interpolate function. The expression can
3237 contain functions:
3238 @table @option
3239 @item entry(f, g)
3240 store gain entry at frequency f with value g
3241 @end table
3242 This option is also available as command.
3243
3244 @item delay
3245 Set filter delay in seconds. Higher value means more accurate.
3246 Default is @code{0.01}.
3247
3248 @item accuracy
3249 Set filter accuracy in Hz. Lower value means more accurate.
3250 Default is @code{5}.
3251
3252 @item wfunc
3253 Set window function. Acceptable values are:
3254 @table @option
3255 @item rectangular
3256 rectangular window, useful when gain curve is already smooth
3257 @item hann
3258 hann window (default)
3259 @item hamming
3260 hamming window
3261 @item blackman
3262 blackman window
3263 @item nuttall3
3264 3-terms continuous 1st derivative nuttall window
3265 @item mnuttall3
3266 minimum 3-terms discontinuous nuttall window
3267 @item nuttall
3268 4-terms continuous 1st derivative nuttall window
3269 @item bnuttall
3270 minimum 4-terms discontinuous nuttall (blackman-nuttall) window
3271 @item bharris
3272 blackman-harris window
3273 @item tukey
3274 tukey window
3275 @end table
3276
3277 @item fixed
3278 If enabled, use fixed number of audio samples. This improves speed when
3279 filtering with large delay. Default is disabled.
3280
3281 @item multi
3282 Enable multichannels evaluation on gain. Default is disabled.
3283
3284 @item zero_phase
3285 Enable zero phase mode by subtracting timestamp to compensate delay.
3286 Default is disabled.
3287
3288 @item scale
3289 Set scale used by gain. Acceptable values are:
3290 @table @option
3291 @item linlin
3292 linear frequency, linear gain
3293 @item linlog
3294 linear frequency, logarithmic (in dB) gain (default)
3295 @item loglin
3296 logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
3297 @item loglog
3298 logarithmic frequency, logarithmic gain
3299 @end table
3300
3301 @item dumpfile
3302 Set file for dumping, suitable for gnuplot.
3303
3304 @item dumpscale
3305 Set scale for dumpfile. Acceptable values are same with scale option.
3306 Default is linlog.
3307
3308 @item fft2
3309 Enable 2-channel convolution using complex FFT. This improves speed significantly.
3310 Default is disabled.
3311
3312 @item min_phase
3313 Enable minimum phase impulse response. Default is disabled.
3314 @end table
3315
3316 @subsection Examples
3317 @itemize
3318 @item
3319 lowpass at 1000 Hz:
3320 @example
3321 firequalizer=gain='if(lt(f,1000), 0, -INF)'
3322 @end example
3323 @item
3324 lowpass at 1000 Hz with gain_entry:
3325 @example
3326 firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
3327 @end example
3328 @item
3329 custom equalization:
3330 @example
3331 firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
3332 @end example
3333 @item
3334 higher delay with zero phase to compensate delay:
3335 @example
3336 firequalizer=delay=0.1:fixed=on:zero_phase=on
3337 @end example
3338 @item
3339 lowpass on left channel, highpass on right channel:
3340 @example
3341 firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
3342 :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
3343 @end example
3344 @end itemize
3345
3346 @section flanger
3347 Apply a flanging effect to the audio.
3348
3349 The filter accepts the following options:
3350
3351 @table @option
3352 @item delay
3353 Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
3354
3355 @item depth
3356 Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
3357
3358 @item regen
3359 Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
3360 Default value is 0.
3361
3362 @item width
3363 Set percentage of delayed signal mixed with original. Range from 0 to 100.
3364 Default value is 71.
3365
3366 @item speed
3367 Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
3368
3369 @item shape
3370 Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
3371 Default value is @var{sinusoidal}.
3372
3373 @item phase
3374 Set swept wave percentage-shift for multi channel. Range from 0 to 100.
3375 Default value is 25.
3376
3377 @item interp
3378 Set delay-line interpolation, @var{linear} or @var{quadratic}.
3379 Default is @var{linear}.
3380 @end table
3381
3382 @section haas
3383 Apply Haas effect to audio.
3384
3385 Note that this makes most sense to apply on mono signals.
3386 With this filter applied to mono signals it give some directionality and
3387 stretches its stereo image.
3388
3389 The filter accepts the following options:
3390
3391 @table @option
3392 @item level_in
3393 Set input level. By default is @var{1}, or 0dB
3394
3395 @item level_out
3396 Set output level. By default is @var{1}, or 0dB.
3397
3398 @item side_gain
3399 Set gain applied to side part of signal. By default is @var{1}.
3400
3401 @item middle_source
3402 Set kind of middle source. Can be one of the following:
3403
3404 @table @samp
3405 @item left
3406 Pick left channel.
3407
3408 @item right
3409 Pick right channel.
3410
3411 @item mid
3412 Pick middle part signal of stereo image.
3413
3414 @item side
3415 Pick side part signal of stereo image.
3416 @end table
3417
3418 @item middle_phase
3419 Change middle phase. By default is disabled.
3420
3421 @item left_delay
3422 Set left channel delay. By default is @var{2.05} milliseconds.
3423
3424 @item left_balance
3425 Set left channel balance. By default is @var{-1}.
3426
3427 @item left_gain
3428 Set left channel gain. By default is @var{1}.
3429
3430 @item left_phase
3431 Change left phase. By default is disabled.
3432
3433 @item right_delay
3434 Set right channel delay. By defaults is @var{2.12} milliseconds.
3435
3436 @item right_balance
3437 Set right channel balance. By default is @var{1}.
3438
3439 @item right_gain
3440 Set right channel gain. By default is @var{1}.
3441
3442 @item right_phase
3443 Change right phase. By default is enabled.
3444 @end table
3445
3446 @section hdcd
3447
3448 Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
3449 embedded HDCD codes is expanded into a 20-bit PCM stream.
3450
3451 The filter supports the Peak Extend and Low-level Gain Adjustment features
3452 of HDCD, and detects the Transient Filter flag.
3453
3454 @example
3455 ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
3456 @end example
3457
3458 When using the filter with wav, note the default encoding for wav is 16-bit,
3459 so the resulting 20-bit stream will be truncated back to 16-bit. Use something
3460 like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
3461 @example
3462 ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
3463 ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
3464 @end example
3465
3466 The filter accepts the following options:
3467
3468 @table @option
3469 @item disable_autoconvert
3470 Disable any automatic format conversion or resampling in the filter graph.
3471
3472 @item process_stereo
3473 Process the stereo channels together. If target_gain does not match between
3474 channels, consider it invalid and use the last valid target_gain.
3475
3476 @item cdt_ms
3477 Set the code detect timer period in ms.
3478
3479 @item force_pe
3480 Always extend peaks above -3dBFS even if PE isn't signaled.
3481
3482 @item analyze_mode
3483 Replace audio with a solid tone and adjust the amplitude to signal some
3484 specific aspect of the decoding process. The output file can be loaded in
3485 an audio editor alongside the original to aid analysis.
3486
3487 @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
3488
3489 Modes are:
3490 @table @samp
3491 @item 0, off
3492 Disabled
3493 @item 1, lle
3494 Gain adjustment level at each sample
3495 @item 2, pe
3496 Samples where peak extend occurs
3497 @item 3, cdt
3498 Samples where the code detect timer is active
3499 @item 4, tgm
3500 Samples where the target gain does not match between channels
3501 @end table
3502 @end table
3503
3504 @section headphone
3505
3506 Apply head-related transfer functions (HRTFs) to create virtual
3507 loudspeakers around the user for binaural listening via headphones.
3508 The HRIRs are provided via additional streams, for each channel
3509 one stereo input stream is needed.
3510
3511 The filter accepts the following options:
3512
3513 @table @option
3514 @item map
3515 Set mapping of input streams for convolution.
3516 The argument is a '|'-separated list of channel names in order as they
3517 are given as additional stream inputs for filter.
3518 This also specify number of input streams. Number of input streams
3519 must be not less than number of channels in first stream plus one.
3520
3521 @item gain
3522 Set gain applied to audio. Value is in dB. Default is 0.
3523
3524 @item type
3525 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
3526 processing audio in time domain which is slow.
3527 @var{freq} is processing audio in frequency domain which is fast.
3528 Default is @var{freq}.
3529
3530 @item lfe
3531 Set custom gain for LFE channels. Value is in dB. Default is 0.
3532
3533 @item size
3534 Set size of frame in number of samples which will be processed at once.
3535 Default value is @var{1024}. Allowed range is from 1024 to 96000.
3536
3537 @item hrir
3538 Set format of hrir stream.
3539 Default value is @var{stereo}. Alternative value is @var{multich}.
3540 If value is set to @var{stereo}, number of additional streams should
3541 be greater or equal to number of input channels in first input stream.
3542 Also each additional stream should have stereo number of channels.
3543 If value is set to @var{multich}, number of additional streams should
3544 be exactly one. Also number of input channels of additional stream
3545 should be equal or greater than twice number of channels of first input
3546 stream.
3547 @end table
3548
3549 @subsection Examples
3550
3551 @itemize
3552 @item
3553 Full example using wav files as coefficients with amovie filters for 7.1 downmix,
3554 each amovie filter use stereo file with IR coefficients as input.
3555 The files give coefficients for each position of virtual loudspeaker:
3556 @example
3557 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"
3558 output.wav
3559 @end example
3560
3561 @item
3562 Full example using wav files as coefficients with amovie filters for 7.1 downmix,
3563 but now in @var{multich} @var{hrir} format.
3564 @example
3565 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"
3566 output.wav
3567 @end example
3568 @end itemize
3569
3570 @section highpass
3571
3572 Apply a high-pass filter with 3dB point frequency.
3573 The filter can be either single-pole, or double-pole (the default).
3574 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
3575
3576 The filter accepts the following options:
3577
3578 @table @option
3579 @item frequency, f
3580 Set frequency in Hz. Default is 3000.
3581
3582 @item poles, p
3583 Set number of poles. Default is 2.
3584
3585 @item width_type, t
3586 Set method to specify band-width of filter.
3587 @table @option
3588 @item h
3589 Hz
3590 @item q
3591 Q-Factor
3592 @item o
3593 octave
3594 @item s
3595 slope
3596 @item k
3597 kHz
3598 @end table
3599
3600 @item width, w
3601 Specify the band-width of a filter in width_type units.
3602 Applies only to double-pole filter.
3603 The default is 0.707q and gives a Butterworth response.
3604
3605 @item channels, c
3606 Specify which channels to filter, by default all available are filtered.
3607 @end table
3608
3609 @subsection Commands
3610
3611 This filter supports the following commands:
3612 @table @option
3613 @item frequency, f
3614 Change highpass frequency.
3615 Syntax for the command is : "@var{frequency}"
3616
3617 @item width_type, t
3618 Change highpass width_type.
3619 Syntax for the command is : "@var{width_type}"
3620
3621 @item width, w
3622 Change highpass width.
3623 Syntax for the command is : "@var{width}"
3624 @end table
3625
3626 @section join
3627
3628 Join multiple input streams into one multi-channel stream.
3629
3630 It accepts the following parameters:
3631 @table @option
3632
3633 @item inputs
3634 The number of input streams. It defaults to 2.
3635
3636 @item channel_layout
3637 The desired output channel layout. It defaults to stereo.
3638
3639 @item map
3640 Map channels from inputs to output. The argument is a '|'-separated list of
3641 mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
3642 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
3643 can be either the name of the input channel (e.g. FL for front left) or its
3644 index in the specified input stream. @var{out_channel} is the name of the output
3645 channel.
3646 @end table
3647
3648 The filter will attempt to guess the mappings when they are not specified
3649 explicitly. It does so by first trying to find an unused matching input channel
3650 and if that fails it picks the first unused input channel.
3651
3652 Join 3 inputs (with properly set channel layouts):
3653 @example
3654 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
3655 @end example
3656
3657 Build a 5.1 output from 6 single-channel streams:
3658 @example
3659 ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
3660 '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'
3661 out
3662 @end example
3663
3664 @section ladspa
3665
3666 Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
3667
3668 To enable compilation of this filter you need to configure FFmpeg with
3669 @code{--enable-ladspa}.
3670
3671 @table @option
3672 @item file, f
3673 Specifies the name of LADSPA plugin library to load. If the environment
3674 variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
3675 each one of the directories specified by the colon separated list in
3676 @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
3677 this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
3678 @file{/usr/lib/ladspa/}.
3679
3680 @item plugin, p
3681 Specifies the plugin within the library. Some libraries contain only
3682 one plugin, but others contain many of them. If this is not set filter
3683 will list all available plugins within the specified library.
3684
3685 @item controls, c
3686 Set the '|' separated list of controls which are zero or more floating point
3687 values that determine the behavior of the loaded plugin (for example delay,
3688 threshold or gain).
3689 Controls need to be defined using the following syntax:
3690 c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
3691 @var{valuei} is the value set on the @var{i}-th control.
3692 Alternatively they can be also defined using the following syntax:
3693 @var{value0}|@var{value1}|@var{value2}|..., where
3694 @var{valuei} is the value set on the @var{i}-th control.
3695 If @option{controls} is set to @code{help}, all available controls and
3696 their valid ranges are printed.
3697
3698 @item sample_rate, s
3699 Specify the sample rate, default to 44100. Only used if plugin have
3700 zero inputs.
3701
3702 @item nb_samples, n
3703 Set the number of samples per channel per each output frame, default
3704 is 1024. Only used if plugin have zero inputs.
3705
3706 @item duration, d
3707 Set the minimum duration of the sourced audio. See
3708 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3709 for the accepted syntax.
3710 Note that the resulting duration may be greater than the specified duration,
3711 as the generated audio is always cut at the end of a complete frame.
3712 If not specified, or the expressed duration is negative, the audio is
3713 supposed to be generated forever.
3714 Only used if plugin have zero inputs.
3715
3716 @end table
3717
3718 @subsection Examples
3719
3720 @itemize
3721 @item
3722 List all available plugins within amp (LADSPA example plugin) library:
3723 @example
3724 ladspa=file=amp
3725 @end example
3726
3727 @item
3728 List all available controls and their valid ranges for @code{vcf_notch}
3729 plugin from @code{VCF} library:
3730 @example
3731 ladspa=f=vcf:p=vcf_notch:c=help
3732 @end example
3733
3734 @item
3735 Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
3736 plugin library:
3737 @example
3738 ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
3739 @end example
3740
3741 @item
3742 Add reverberation to the audio using TAP-plugins
3743 (Tom's Audio Processing plugins):
3744 @example
3745 ladspa=file=tap_reverb:tap_reverb
3746 @end example
3747
3748 @item
3749 Generate white noise, with 0.2 amplitude:
3750 @example
3751 ladspa=file=cmt:noise_source_white:c=c0=.2
3752 @end example
3753
3754 @item
3755 Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
3756 @code{C* Audio Plugin Suite} (CAPS) library:
3757 @example
3758 ladspa=file=caps:Click:c=c1=20'
3759 @end example
3760
3761 @item
3762 Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
3763 @example
3764 ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
3765 @end example
3766
3767 @item
3768 Increase volume by 20dB using fast lookahead limiter from Steve Harris
3769 @code{SWH Plugins} collection:
3770 @example
3771 ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
3772 @end example
3773
3774 @item
3775 Attenuate low frequencies using Multiband EQ from Steve Harris
3776 @code{SWH Plugins} collection:
3777 @example
3778 ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
3779 @end example
3780
3781 @item
3782 Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
3783 (CAPS) library:
3784 @example
3785 ladspa=caps:Narrower
3786 @end example
3787
3788 @item
3789 Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
3790 @example
3791 ladspa=caps:White:.2
3792 @end example
3793
3794 @item
3795 Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
3796 @example
3797 ladspa=caps:Fractal:c=c1=1
3798 @end example
3799
3800 @item
3801 Dynamic volume normalization using @code{VLevel} plugin:
3802 @example
3803 ladspa=vlevel-ladspa:vlevel_mono
3804 @end example
3805 @end itemize
3806
3807 @subsection Commands
3808
3809 This filter supports the following commands:
3810 @table @option
3811 @item cN
3812 Modify the @var{N}-th control value.
3813
3814 If the specified value is not valid, it is ignored and prior one is kept.
3815 @end table
3816
3817 @section loudnorm
3818
3819 EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
3820 Support for both single pass (livestreams, files) and double pass (files) modes.
3821 This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
3822 the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
3823 Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
3824
3825 The filter accepts the following options:
3826
3827 @table @option
3828 @item I, i
3829 Set integrated loudness target.
3830 Range is -70.0 - -5.0. Default value is -24.0.
3831
3832 @item LRA, lra
3833 Set loudness range target.
3834 Range is 1.0 - 20.0. Default value is 7.0.
3835
3836 @item TP, tp
3837 Set maximum true peak.
3838 Range is -9.0 - +0.0. Default value is -2.0.
3839
3840 @item measured_I, measured_i
3841 Measured IL of input file.
3842 Range is -99.0 - +0.0.
3843
3844 @item measured_LRA, measured_lra
3845 Measured LRA of input file.
3846 Range is  0.0 - 99.0.
3847
3848 @item measured_TP, measured_tp
3849 Measured true peak of input file.
3850 Range is  -99.0 - +99.0.
3851
3852 @item measured_thresh
3853 Measured threshold of input file.
3854 Range is -99.0 - +0.0.
3855
3856 @item offset
3857 Set offset gain. Gain is applied before the true-peak limiter.
3858 Range is  -99.0 - +99.0. Default is +0.0.
3859
3860 @item linear
3861 Normalize linearly if possible.
3862 measured_I, measured_LRA, measured_TP, and measured_thresh must also
3863 to be specified in order to use this mode.
3864 Options are true or false. Default is true.
3865
3866 @item dual_mono
3867 Treat mono input files as "dual-mono". If a mono file is intended for playback
3868 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
3869 If set to @code{true}, this option will compensate for this effect.
3870 Multi-channel input files are not affected by this option.
3871 Options are true or false. Default is false.
3872
3873 @item print_format
3874 Set print format for stats. Options are summary, json, or none.
3875 Default value is none.
3876 @end table
3877
3878 @section lowpass
3879
3880 Apply a low-pass filter with 3dB point frequency.
3881 The filter can be either single-pole or double-pole (the default).
3882 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
3883
3884 The filter accepts the following options:
3885
3886 @table @option
3887 @item frequency, f
3888 Set frequency in Hz. Default is 500.
3889
3890 @item poles, p
3891 Set number of poles. Default is 2.
3892
3893 @item width_type, t
3894 Set method to specify band-width of filter.
3895 @table @option
3896 @item h
3897 Hz
3898 @item q
3899 Q-Factor
3900 @item o
3901 octave
3902 @item s
3903 slope
3904 @item k
3905 kHz
3906 @end table
3907
3908 @item width, w
3909 Specify the band-width of a filter in width_type units.
3910 Applies only to double-pole filter.
3911 The default is 0.707q and gives a Butterworth response.
3912
3913 @item channels, c
3914 Specify which channels to filter, by default all available are filtered.
3915 @end table
3916
3917 @subsection Examples
3918 @itemize
3919 @item
3920 Lowpass only LFE channel, it LFE is not present it does nothing:
3921 @example
3922 lowpass=c=LFE
3923 @end example
3924 @end itemize
3925
3926 @subsection Commands
3927
3928 This filter supports the following commands:
3929 @table @option
3930 @item frequency, f
3931 Change lowpass frequency.
3932 Syntax for the command is : "@var{frequency}"
3933
3934 @item width_type, t
3935 Change lowpass width_type.
3936 Syntax for the command is : "@var{width_type}"
3937
3938 @item width, w
3939 Change lowpass width.
3940 Syntax for the command is : "@var{width}"
3941 @end table
3942
3943 @section lv2
3944
3945 Load a LV2 (LADSPA Version 2) plugin.
3946
3947 To enable compilation of this filter you need to configure FFmpeg with
3948 @code{--enable-lv2}.
3949
3950 @table @option
3951 @item plugin, p
3952 Specifies the plugin URI. You may need to escape ':'.
3953
3954 @item controls, c
3955 Set the '|' separated list of controls which are zero or more floating point
3956 values that determine the behavior of the loaded plugin (for example delay,
3957 threshold or gain).
3958 If @option{controls} is set to @code{help}, all available controls and
3959 their valid ranges are printed.
3960
3961 @item sample_rate, s
3962 Specify the sample rate, default to 44100. Only used if plugin have
3963 zero inputs.
3964
3965 @item nb_samples, n
3966 Set the number of samples per channel per each output frame, default
3967 is 1024. Only used if plugin have zero inputs.
3968
3969 @item duration, d
3970 Set the minimum duration of the sourced audio. See
3971 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3972 for the accepted syntax.
3973 Note that the resulting duration may be greater than the specified duration,
3974 as the generated audio is always cut at the end of a complete frame.
3975 If not specified, or the expressed duration is negative, the audio is
3976 supposed to be generated forever.
3977 Only used if plugin have zero inputs.
3978 @end table
3979
3980 @subsection Examples
3981
3982 @itemize
3983 @item
3984 Apply bass enhancer plugin from Calf:
3985 @example
3986 lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
3987 @end example
3988
3989 @item
3990 Apply vinyl plugin from Calf:
3991 @example
3992 lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
3993 @end example
3994
3995 @item
3996 Apply bit crusher plugin from ArtyFX:
3997 @example
3998 lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
3999 @end example
4000 @end itemize
4001
4002 @section mcompand
4003 Multiband Compress or expand the audio's dynamic range.
4004
4005 The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
4006 This is akin to the crossover of a loudspeaker, and results in flat frequency
4007 response when absent compander action.
4008
4009 It accepts the following parameters:
4010
4011 @table @option
4012 @item args
4013 This option syntax is:
4014 attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
4015 For explanation of each item refer to compand filter documentation.
4016 @end table
4017
4018 @anchor{pan}
4019 @section pan
4020
4021 Mix channels with specific gain levels. The filter accepts the output
4022 channel layout followed by a set of channels definitions.
4023
4024 This filter is also designed to efficiently remap the channels of an audio
4025 stream.
4026
4027 The filter accepts parameters of the form:
4028 "@var{l}|@var{outdef}|@var{outdef}|..."
4029
4030 @table @option
4031 @item l
4032 output channel layout or number of channels
4033
4034 @item outdef
4035 output channel specification, of the form:
4036 "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
4037
4038 @item out_name
4039 output channel to define, either a channel name (FL, FR, etc.) or a channel
4040 number (c0, c1, etc.)
4041
4042 @item gain
4043 multiplicative coefficient for the channel, 1 leaving the volume unchanged
4044
4045 @item in_name
4046 input channel to use, see out_name for details; it is not possible to mix
4047 named and numbered input channels
4048 @end table
4049
4050 If the `=' in a channel specification is replaced by `<', then the gains for
4051 that specification will be renormalized so that the total is 1, thus
4052 avoiding clipping noise.
4053
4054 @subsection Mixing examples
4055
4056 For example, if you want to down-mix from stereo to mono, but with a bigger
4057 factor for the left channel:
4058 @example
4059 pan=1c|c0=0.9*c0+0.1*c1
4060 @end example
4061
4062 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
4063 7-channels surround:
4064 @example
4065 pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
4066 @end example
4067
4068 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
4069 that should be preferred (see "-ac" option) unless you have very specific
4070 needs.
4071
4072 @subsection Remapping examples
4073
4074 The channel remapping will be effective if, and only if:
4075
4076 @itemize
4077 @item gain coefficients are zeroes or ones,
4078 @item only one input per channel output,
4079 @end itemize
4080
4081 If all these conditions are satisfied, the filter will notify the user ("Pure
4082 channel mapping detected"), and use an optimized and lossless method to do the
4083 remapping.
4084
4085 For example, if you have a 5.1 source and want a stereo audio stream by
4086 dropping the extra channels:
4087 @example
4088 pan="stereo| c0=FL | c1=FR"
4089 @end example
4090
4091 Given the same source, you can also switch front left and front right channels
4092 and keep the input channel layout:
4093 @example
4094 pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
4095 @end example
4096
4097 If the input is a stereo audio stream, you can mute the front left channel (and
4098 still keep the stereo channel layout) with:
4099 @example
4100 pan="stereo|c1=c1"
4101 @end example
4102
4103 Still with a stereo audio stream input, you can copy the right channel in both
4104 front left and right:
4105 @example
4106 pan="stereo| c0=FR | c1=FR"
4107 @end example
4108
4109 @section replaygain
4110
4111 ReplayGain scanner filter. This filter takes an audio stream as an input and
4112 outputs it unchanged.
4113 At end of filtering it displays @code{track_gain} and @code{track_peak}.
4114
4115 @section resample
4116
4117 Convert the audio sample format, sample rate and channel layout. It is
4118 not meant to be used directly.
4119
4120 @section rubberband
4121 Apply time-stretching and pitch-shifting with librubberband.
4122
4123 To enable compilation of this filter, you need to configure FFmpeg with
4124 @code{--enable-librubberband}.
4125
4126 The filter accepts the following options:
4127
4128 @table @option
4129 @item tempo
4130 Set tempo scale factor.
4131
4132 @item pitch
4133 Set pitch scale factor.
4134
4135 @item transients
4136 Set transients detector.
4137 Possible values are:
4138 @table @var
4139 @item crisp
4140 @item mixed
4141 @item smooth
4142 @end table
4143
4144 @item detector
4145 Set detector.
4146 Possible values are:
4147 @table @var
4148 @item compound
4149 @item percussive
4150 @item soft
4151 @end table
4152
4153 @item phase
4154 Set phase.
4155 Possible values are:
4156 @table @var
4157 @item laminar
4158 @item independent
4159 @end table
4160
4161 @item window
4162 Set processing window size.
4163 Possible values are:
4164 @table @var
4165 @item standard
4166 @item short
4167 @item long
4168 @end table
4169
4170 @item smoothing
4171 Set smoothing.
4172 Possible values are:
4173 @table @var
4174 @item off
4175 @item on
4176 @end table
4177
4178 @item formant
4179 Enable formant preservation when shift pitching.
4180 Possible values are:
4181 @table @var
4182 @item shifted
4183 @item preserved
4184 @end table
4185
4186 @item pitchq
4187 Set pitch quality.
4188 Possible values are:
4189 @table @var
4190 @item quality
4191 @item speed
4192 @item consistency
4193 @end table
4194
4195 @item channels
4196 Set channels.
4197 Possible values are:
4198 @table @var
4199 @item apart
4200 @item together
4201 @end table
4202 @end table
4203
4204 @section sidechaincompress
4205
4206 This filter acts like normal compressor but has the ability to compress
4207 detected signal using second input signal.
4208 It needs two input streams and returns one output stream.
4209 First input stream will be processed depending on second stream signal.
4210 The filtered signal then can be filtered with other filters in later stages of
4211 processing. See @ref{pan} and @ref{amerge} filter.
4212
4213 The filter accepts the following options:
4214
4215 @table @option
4216 @item level_in
4217 Set input gain. Default is 1. Range is between 0.015625 and 64.
4218
4219 @item threshold
4220 If a signal of second stream raises above this level it will affect the gain
4221 reduction of first stream.
4222 By default is 0.125. Range is between 0.00097563 and 1.
4223
4224 @item ratio
4225 Set a ratio about which the signal is reduced. 1:2 means that if the level
4226 raised 4dB above the threshold, it will be only 2dB above after the reduction.
4227 Default is 2. Range is between 1 and 20.
4228
4229 @item attack
4230 Amount of milliseconds the signal has to rise above the threshold before gain
4231 reduction starts. Default is 20. Range is between 0.01 and 2000.
4232
4233 @item release
4234 Amount of milliseconds the signal has to fall below the threshold before
4235 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
4236
4237 @item makeup
4238 Set the amount by how much signal will be amplified after processing.
4239 Default is 1. Range is from 1 to 64.
4240
4241 @item knee
4242 Curve the sharp knee around the threshold to enter gain reduction more softly.
4243 Default is 2.82843. Range is between 1 and 8.
4244
4245 @item link
4246 Choose if the @code{average} level between all channels of side-chain stream
4247 or the louder(@code{maximum}) channel of side-chain stream affects the
4248 reduction. Default is @code{average}.
4249
4250 @item detection
4251 Should the exact signal be taken in case of @code{peak} or an RMS one in case
4252 of @code{rms}. Default is @code{rms} which is mainly smoother.
4253
4254 @item level_sc
4255 Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
4256
4257 @item mix
4258 How much to use compressed signal in output. Default is 1.
4259 Range is between 0 and 1.
4260 @end table
4261
4262 @subsection Examples
4263
4264 @itemize
4265 @item
4266 Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
4267 depending on the signal of 2nd input and later compressed signal to be
4268 merged with 2nd input:
4269 @example
4270 ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
4271 @end example
4272 @end itemize
4273
4274 @section sidechaingate
4275
4276 A sidechain gate acts like a normal (wideband) gate but has the ability to
4277 filter the detected signal before sending it to the gain reduction stage.
4278 Normally a gate uses the full range signal to detect a level above the
4279 threshold.
4280 For example: If you cut all lower frequencies from your sidechain signal
4281 the gate will decrease the volume of your track only if not enough highs
4282 appear. With this technique you are able to reduce the resonation of a
4283 natural drum or remove "rumbling" of muted strokes from a heavily distorted
4284 guitar.
4285 It needs two input streams and returns one output stream.
4286 First input stream will be processed depending on second stream signal.
4287
4288 The filter accepts the following options:
4289
4290 @table @option
4291 @item level_in
4292 Set input level before filtering.
4293 Default is 1. Allowed range is from 0.015625 to 64.
4294
4295 @item range
4296 Set the level of gain reduction when the signal is below the threshold.
4297 Default is 0.06125. Allowed range is from 0 to 1.
4298
4299 @item threshold
4300 If a signal rises above this level the gain reduction is released.
4301 Default is 0.125. Allowed range is from 0 to 1.
4302
4303 @item ratio
4304 Set a ratio about which the signal is reduced.
4305 Default is 2. Allowed range is from 1 to 9000.
4306
4307 @item attack
4308 Amount of milliseconds the signal has to rise above the threshold before gain
4309 reduction stops.
4310 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
4311
4312 @item release
4313 Amount of milliseconds the signal has to fall below the threshold before the
4314 reduction is increased again. Default is 250 milliseconds.
4315 Allowed range is from 0.01 to 9000.
4316
4317 @item makeup
4318 Set amount of amplification of signal after processing.
4319 Default is 1. Allowed range is from 1 to 64.
4320
4321 @item knee
4322 Curve the sharp knee around the threshold to enter gain reduction more softly.
4323 Default is 2.828427125. Allowed range is from 1 to 8.
4324
4325 @item detection
4326 Choose if exact signal should be taken for detection or an RMS like one.
4327 Default is rms. Can be peak or rms.
4328
4329 @item link
4330 Choose if the average level between all channels or the louder channel affects
4331 the reduction.
4332 Default is average. Can be average or maximum.
4333
4334 @item level_sc
4335 Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
4336 @end table
4337
4338 @section silencedetect
4339
4340 Detect silence in an audio stream.
4341
4342 This filter logs a message when it detects that the input audio volume is less
4343 or equal to a noise tolerance value for a duration greater or equal to the
4344 minimum detected noise duration.
4345
4346 The printed times and duration are expressed in seconds.
4347
4348 The filter accepts the following options:
4349
4350 @table @option
4351 @item noise, n
4352 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
4353 specified value) or amplitude ratio. Default is -60dB, or 0.001.
4354
4355 @item duration, d
4356 Set silence duration until notification (default is 2 seconds).
4357
4358 @item mono, m
4359 Process each channel separately, instead of combined. By default is disabled.
4360 @end table
4361
4362 @subsection Examples
4363
4364 @itemize
4365 @item
4366 Detect 5 seconds of silence with -50dB noise tolerance:
4367 @example
4368 silencedetect=n=-50dB:d=5
4369 @end example
4370
4371 @item
4372 Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
4373 tolerance in @file{silence.mp3}:
4374 @example
4375 ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
4376 @end example
4377 @end itemize
4378
4379 @section silenceremove
4380
4381 Remove silence from the beginning, middle or end of the audio.
4382
4383 The filter accepts the following options:
4384
4385 @table @option
4386 @item start_periods
4387 This value is used to indicate if audio should be trimmed at beginning of
4388 the audio. A value of zero indicates no silence should be trimmed from the
4389 beginning. When specifying a non-zero value, it trims audio up until it
4390 finds non-silence. Normally, when trimming silence from beginning of audio
4391 the @var{start_periods} will be @code{1} but it can be increased to higher
4392 values to trim all audio up to specific count of non-silence periods.
4393 Default value is @code{0}.
4394
4395 @item start_duration
4396 Specify the amount of time that non-silence must be detected before it stops
4397 trimming audio. By increasing the duration, bursts of noises can be treated
4398 as silence and trimmed off. Default value is @code{0}.
4399
4400 @item start_threshold
4401 This indicates what sample value should be treated as silence. For digital
4402 audio, a value of @code{0} may be fine but for audio recorded from analog,
4403 you may wish to increase the value to account for background noise.
4404 Can be specified in dB (in case "dB" is appended to the specified value)
4405 or amplitude ratio. Default value is @code{0}.
4406
4407 @item start_silence
4408 Specify max duration of silence at beginning that will be kept after
4409 trimming. Default is 0, which is equal to trimming all samples detected
4410 as silence.
4411
4412 @item start_mode
4413 Specify mode of detection of silence end in start of multi-channel audio.
4414 Can be @var{any} or @var{all}. Default is @var{any}.
4415 With @var{any}, any sample that is detected as non-silence will cause
4416 stopped trimming of silence.
4417 With @var{all}, only if all channels are detected as non-silence will cause
4418 stopped trimming of silence.
4419
4420 @item stop_periods
4421 Set the count for trimming silence from the end of audio.
4422 To remove silence from the middle of a file, specify a @var{stop_periods}
4423 that is negative. This value is then treated as a positive value and is
4424 used to indicate the effect should restart processing as specified by
4425 @var{start_periods}, making it suitable for removing periods of silence
4426 in the middle of the audio.
4427 Default value is @code{0}.
4428
4429 @item stop_duration
4430 Specify a duration of silence that must exist before audio is not copied any
4431 more. By specifying a higher duration, silence that is wanted can be left in
4432 the audio.
4433 Default value is @code{0}.
4434
4435 @item stop_threshold
4436 This is the same as @option{start_threshold} but for trimming silence from
4437 the end of audio.
4438 Can be specified in dB (in case "dB" is appended to the specified value)
4439 or amplitude ratio. Default value is @code{0}.
4440
4441 @item stop_silence
4442 Specify max duration of silence at end that will be kept after
4443 trimming. Default is 0, which is equal to trimming all samples detected
4444 as silence.
4445
4446 @item stop_mode
4447 Specify mode of detection of silence start in end of multi-channel audio.
4448 Can be @var{any} or @var{all}. Default is @var{any}.
4449 With @var{any}, any sample that is detected as non-silence will cause
4450 stopped trimming of silence.
4451 With @var{all}, only if all channels are detected as non-silence will cause
4452 stopped trimming of silence.
4453
4454 @item detection
4455 Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
4456 and works better with digital silence which is exactly 0.
4457 Default value is @code{rms}.
4458
4459 @item window
4460 Set duration in number of seconds used to calculate size of window in number
4461 of samples for detecting silence.
4462 Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
4463 @end table
4464
4465 @subsection Examples
4466
4467 @itemize
4468 @item
4469 The following example shows how this filter can be used to start a recording
4470 that does not contain the delay at the start which usually occurs between
4471 pressing the record button and the start of the performance:
4472 @example
4473 silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
4474 @end example
4475
4476 @item
4477 Trim all silence encountered from beginning to end where there is more than 1
4478 second of silence in audio:
4479 @example
4480 silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
4481 @end example
4482 @end itemize
4483
4484 @section sofalizer
4485
4486 SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
4487 loudspeakers around the user for binaural listening via headphones (audio
4488 formats up to 9 channels supported).
4489 The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
4490 SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
4491 Austrian Academy of Sciences.
4492
4493 To enable compilation of this filter you need to configure FFmpeg with
4494 @code{--enable-libmysofa}.
4495
4496 The filter accepts the following options:
4497
4498 @table @option
4499 @item sofa
4500 Set the SOFA file used for rendering.
4501
4502 @item gain
4503 Set gain applied to audio. Value is in dB. Default is 0.
4504
4505 @item rotation
4506 Set rotation of virtual loudspeakers in deg. Default is 0.
4507
4508 @item elevation
4509 Set elevation of virtual speakers in deg. Default is 0.
4510
4511 @item radius
4512 Set distance in meters between loudspeakers and the listener with near-field
4513 HRTFs. Default is 1.
4514
4515 @item type
4516 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
4517 processing audio in time domain which is slow.
4518 @var{freq} is processing audio in frequency domain which is fast.
4519 Default is @var{freq}.
4520
4521 @item speakers
4522 Set custom positions of virtual loudspeakers. Syntax for this option is:
4523 <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
4524 Each virtual loudspeaker is described with short channel name following with
4525 azimuth and elevation in degrees.
4526 Each virtual loudspeaker description is separated by '|'.
4527 For example to override front left and front right channel positions use:
4528 'speakers=FL 45 15|FR 345 15'.
4529 Descriptions with unrecognised channel names are ignored.
4530
4531 @item lfegain
4532 Set custom gain for LFE channels. Value is in dB. Default is 0.
4533
4534 @item framesize
4535 Set custom frame size in number of samples. Default is 1024.
4536 Allowed range is from 1024 to 96000. Only used if option @samp{type}
4537 is set to @var{freq}.
4538
4539 @item normalize
4540 Should all IRs be normalized upon importing SOFA file.
4541 By default is enabled.
4542
4543 @item interpolate
4544 Should nearest IRs be interpolated with neighbor IRs if exact position
4545 does not match. By default is disabled.
4546
4547 @item minphase
4548 Minphase all IRs upon loading of SOFA file. By default is disabled.
4549
4550 @item anglestep
4551 Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
4552
4553 @item radstep
4554 Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
4555 @end table
4556
4557 @subsection Examples
4558
4559 @itemize
4560 @item
4561 Using ClubFritz6 sofa file:
4562 @example
4563 sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
4564 @end example
4565
4566 @item
4567 Using ClubFritz12 sofa file and bigger radius with small rotation:
4568 @example
4569 sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
4570 @end example
4571
4572 @item
4573 Similar as above but with custom speaker positions for front left, front right, back left and back right
4574 and also with custom gain:
4575 @example
4576 "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
4577 @end example
4578 @end itemize
4579
4580 @section stereotools
4581
4582 This filter has some handy utilities to manage stereo signals, for converting
4583 M/S stereo recordings to L/R signal while having control over the parameters
4584 or spreading the stereo image of master track.
4585
4586 The filter accepts the following options:
4587
4588 @table @option
4589 @item level_in
4590 Set input level before filtering for both channels. Defaults is 1.
4591 Allowed range is from 0.015625 to 64.
4592
4593 @item level_out
4594 Set output level after filtering for both channels. Defaults is 1.
4595 Allowed range is from 0.015625 to 64.
4596
4597 @item balance_in
4598 Set input balance between both channels. Default is 0.
4599 Allowed range is from -1 to 1.
4600
4601 @item balance_out
4602 Set output balance between both channels. Default is 0.
4603 Allowed range is from -1 to 1.
4604
4605 @item softclip
4606 Enable softclipping. Results in analog distortion instead of harsh digital 0dB
4607 clipping. Disabled by default.
4608
4609 @item mutel
4610 Mute the left channel. Disabled by default.
4611
4612 @item muter
4613 Mute the right channel. Disabled by default.
4614
4615 @item phasel
4616 Change the phase of the left channel. Disabled by default.
4617
4618 @item phaser
4619 Change the phase of the right channel. Disabled by default.
4620
4621 @item mode
4622 Set stereo mode. Available values are:
4623
4624 @table @samp
4625 @item lr>lr
4626 Left/Right to Left/Right, this is default.
4627
4628 @item lr>ms
4629 Left/Right to Mid/Side.
4630
4631 @item ms>lr
4632 Mid/Side to Left/Right.
4633
4634 @item lr>ll
4635 Left/Right to Left/Left.
4636
4637 @item lr>rr
4638 Left/Right to Right/Right.
4639
4640 @item lr>l+r
4641 Left/Right to Left + Right.
4642
4643 @item lr>rl
4644 Left/Right to Right/Left.
4645
4646 @item ms>ll
4647 Mid/Side to Left/Left.
4648
4649 @item ms>rr
4650 Mid/Side to Right/Right.
4651 @end table
4652
4653 @item slev
4654 Set level of side signal. Default is 1.
4655 Allowed range is from 0.015625 to 64.
4656
4657 @item sbal
4658 Set balance of side signal. Default is 0.
4659 Allowed range is from -1 to 1.
4660
4661 @item mlev
4662 Set level of the middle signal. Default is 1.
4663 Allowed range is from 0.015625 to 64.
4664
4665 @item mpan
4666 Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
4667
4668 @item base
4669 Set stereo base between mono and inversed channels. Default is 0.
4670 Allowed range is from -1 to 1.
4671
4672 @item delay
4673 Set delay in milliseconds how much to delay left from right channel and
4674 vice versa. Default is 0. Allowed range is from -20 to 20.
4675
4676 @item sclevel
4677 Set S/C level. Default is 1. Allowed range is from 1 to 100.
4678
4679 @item phase
4680 Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
4681
4682 @item bmode_in, bmode_out
4683 Set balance mode for balance_in/balance_out option.
4684
4685 Can be one of the following:
4686
4687 @table @samp
4688 @item balance
4689 Classic balance mode. Attenuate one channel at time.
4690 Gain is raised up to 1.
4691
4692 @item amplitude
4693 Similar as classic mode above but gain is raised up to 2.
4694
4695 @item power
4696 Equal power distribution, from -6dB to +6dB range.
4697 @end table
4698 @end table
4699
4700 @subsection Examples
4701
4702 @itemize
4703 @item
4704 Apply karaoke like effect:
4705 @example
4706 stereotools=mlev=0.015625
4707 @end example
4708
4709 @item
4710 Convert M/S signal to L/R:
4711 @example
4712 "stereotools=mode=ms>lr"
4713 @end example
4714 @end itemize
4715
4716 @section stereowiden
4717
4718 This filter enhance the stereo effect by suppressing signal common to both
4719 channels and by delaying the signal of left into right and vice versa,
4720 thereby widening the stereo effect.
4721
4722 The filter accepts the following options:
4723
4724 @table @option
4725 @item delay
4726 Time in milliseconds of the delay of left signal into right and vice versa.
4727 Default is 20 milliseconds.
4728
4729 @item feedback
4730 Amount of gain in delayed signal into right and vice versa. Gives a delay
4731 effect of left signal in right output and vice versa which gives widening
4732 effect. Default is 0.3.
4733
4734 @item crossfeed
4735 Cross feed of left into right with inverted phase. This helps in suppressing
4736 the mono. If the value is 1 it will cancel all the signal common to both
4737 channels. Default is 0.3.
4738
4739 @item drymix
4740 Set level of input signal of original channel. Default is 0.8.
4741 @end table
4742
4743 @section superequalizer
4744 Apply 18 band equalizer.
4745
4746 The filter accepts the following options:
4747 @table @option
4748 @item 1b
4749 Set 65Hz band gain.
4750 @item 2b
4751 Set 92Hz band gain.
4752 @item 3b
4753 Set 131Hz band gain.
4754 @item 4b
4755 Set 185Hz band gain.
4756 @item 5b
4757 Set 262Hz band gain.
4758 @item 6b
4759 Set 370Hz band gain.
4760 @item 7b
4761 Set 523Hz band gain.
4762 @item 8b
4763 Set 740Hz band gain.
4764 @item 9b
4765 Set 1047Hz band gain.
4766 @item 10b
4767 Set 1480Hz band gain.
4768 @item 11b
4769 Set 2093Hz band gain.
4770 @item 12b
4771 Set 2960Hz band gain.
4772 @item 13b
4773 Set 4186Hz band gain.
4774 @item 14b
4775 Set 5920Hz band gain.
4776 @item 15b
4777 Set 8372Hz band gain.
4778 @item 16b
4779 Set 11840Hz band gain.
4780 @item 17b
4781 Set 16744Hz band gain.
4782 @item 18b
4783 Set 20000Hz band gain.
4784 @end table
4785
4786 @section surround
4787 Apply audio surround upmix filter.
4788
4789 This filter allows to produce multichannel output from audio stream.
4790
4791 The filter accepts the following options:
4792
4793 @table @option
4794 @item chl_out
4795 Set output channel layout. By default, this is @var{5.1}.
4796
4797 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4798 for the required syntax.
4799
4800 @item chl_in
4801 Set input channel layout. By default, this is @var{stereo}.
4802
4803 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4804 for the required syntax.
4805
4806 @item level_in
4807 Set input volume level. By default, this is @var{1}.
4808
4809 @item level_out
4810 Set output volume level. By default, this is @var{1}.
4811
4812 @item lfe
4813 Enable LFE channel output if output channel layout has it. By default, this is enabled.
4814
4815 @item lfe_low
4816 Set LFE low cut off frequency. By default, this is @var{128} Hz.
4817
4818 @item lfe_high
4819 Set LFE high cut off frequency. By default, this is @var{256} Hz.
4820
4821 @item fc_in
4822 Set front center input volume. By default, this is @var{1}.
4823
4824 @item fc_out
4825 Set front center output volume. By default, this is @var{1}.
4826
4827 @item lfe_in
4828 Set LFE input volume. By default, this is @var{1}.
4829
4830 @item lfe_out
4831 Set LFE output volume. By default, this is @var{1}.
4832 @end table
4833
4834 @section treble, highshelf
4835
4836 Boost or cut treble (upper) frequencies of the audio using a two-pole
4837 shelving filter with a response similar to that of a standard
4838 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
4839
4840 The filter accepts the following options:
4841
4842 @table @option
4843 @item gain, g
4844 Give the gain at whichever is the lower of ~22 kHz and the
4845 Nyquist frequency. Its useful range is about -20 (for a large cut)
4846 to +20 (for a large boost). Beware of clipping when using a positive gain.
4847
4848 @item frequency, f
4849 Set the filter's central frequency and so can be used
4850 to extend or reduce the frequency range to be boosted or cut.
4851 The default value is @code{3000} Hz.
4852
4853 @item width_type, t
4854 Set method to specify band-width of filter.
4855 @table @option
4856 @item h
4857 Hz
4858 @item q
4859 Q-Factor
4860 @item o
4861 octave
4862 @item s
4863 slope
4864 @item k
4865 kHz
4866 @end table
4867
4868 @item width, w
4869 Determine how steep is the filter's shelf transition.
4870
4871 @item channels, c
4872 Specify which channels to filter, by default all available are filtered.
4873 @end table
4874
4875 @subsection Commands
4876
4877 This filter supports the following commands:
4878 @table @option
4879 @item frequency, f
4880 Change treble frequency.
4881 Syntax for the command is : "@var{frequency}"
4882
4883 @item width_type, t
4884 Change treble width_type.
4885 Syntax for the command is : "@var{width_type}"
4886
4887 @item width, w
4888 Change treble width.
4889 Syntax for the command is : "@var{width}"
4890
4891 @item gain, g
4892 Change treble gain.
4893 Syntax for the command is : "@var{gain}"
4894 @end table
4895
4896 @section tremolo
4897
4898 Sinusoidal amplitude modulation.
4899
4900 The filter accepts the following options:
4901
4902 @table @option
4903 @item f
4904 Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
4905 (20 Hz or lower) will result in a tremolo effect.
4906 This filter may also be used as a ring modulator by specifying
4907 a modulation frequency higher than 20 Hz.
4908 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
4909
4910 @item d
4911 Depth of modulation as a percentage. Range is 0.0 - 1.0.
4912 Default value is 0.5.
4913 @end table
4914
4915 @section vibrato
4916
4917 Sinusoidal phase modulation.
4918
4919 The filter accepts the following options:
4920
4921 @table @option
4922 @item f
4923 Modulation frequency in Hertz.
4924 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
4925
4926 @item d
4927 Depth of modulation as a percentage. Range is 0.0 - 1.0.
4928 Default value is 0.5.
4929 @end table
4930
4931 @section volume
4932
4933 Adjust the input audio volume.
4934
4935 It accepts the following parameters:
4936 @table @option
4937
4938 @item volume
4939 Set audio volume expression.
4940
4941 Output values are clipped to the maximum value.
4942
4943 The output audio volume is given by the relation:
4944 @example
4945 @var{output_volume} = @var{volume} * @var{input_volume}
4946 @end example
4947
4948 The default value for @var{volume} is "1.0".
4949
4950 @item precision
4951 This parameter represents the mathematical precision.
4952
4953 It determines which input sample formats will be allowed, which affects the
4954 precision of the volume scaling.
4955
4956 @table @option
4957 @item fixed
4958 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
4959 @item float
4960 32-bit floating-point; this limits input sample format to FLT. (default)
4961 @item double
4962 64-bit floating-point; this limits input sample format to DBL.
4963 @end table
4964
4965 @item replaygain
4966 Choose the behaviour on encountering ReplayGain side data in input frames.
4967
4968 @table @option
4969 @item drop
4970 Remove ReplayGain side data, ignoring its contents (the default).
4971
4972 @item ignore
4973 Ignore ReplayGain side data, but leave it in the frame.
4974
4975 @item track
4976 Prefer the track gain, if present.
4977
4978 @item album
4979 Prefer the album gain, if present.
4980 @end table
4981
4982 @item replaygain_preamp
4983 Pre-amplification gain in dB to apply to the selected replaygain gain.
4984
4985 Default value for @var{replaygain_preamp} is 0.0.
4986
4987 @item eval
4988 Set when the volume expression is evaluated.
4989
4990 It accepts the following values:
4991 @table @samp
4992 @item once
4993 only evaluate expression once during the filter initialization, or
4994 when the @samp{volume} command is sent
4995
4996 @item frame
4997 evaluate expression for each incoming frame
4998 @end table
4999
5000 Default value is @samp{once}.
5001 @end table
5002
5003 The volume expression can contain the following parameters.
5004
5005 @table @option
5006 @item n
5007 frame number (starting at zero)
5008 @item nb_channels
5009 number of channels
5010 @item nb_consumed_samples
5011 number of samples consumed by the filter
5012 @item nb_samples
5013 number of samples in the current frame
5014 @item pos
5015 original frame position in the file
5016 @item pts
5017 frame PTS
5018 @item sample_rate
5019 sample rate
5020 @item startpts
5021 PTS at start of stream
5022 @item startt
5023 time at start of stream
5024 @item t
5025 frame time
5026 @item tb
5027 timestamp timebase
5028 @item volume
5029 last set volume value
5030 @end table
5031
5032 Note that when @option{eval} is set to @samp{once} only the
5033 @var{sample_rate} and @var{tb} variables are available, all other
5034 variables will evaluate to NAN.
5035
5036 @subsection Commands
5037
5038 This filter supports the following commands:
5039 @table @option
5040 @item volume
5041 Modify the volume expression.
5042 The command accepts the same syntax of the corresponding option.
5043
5044 If the specified expression is not valid, it is kept at its current
5045 value.
5046 @item replaygain_noclip
5047 Prevent clipping by limiting the gain applied.
5048
5049 Default value for @var{replaygain_noclip} is 1.
5050
5051 @end table
5052
5053 @subsection Examples
5054
5055 @itemize
5056 @item
5057 Halve the input audio volume:
5058 @example
5059 volume=volume=0.5
5060 volume=volume=1/2
5061 volume=volume=-6.0206dB
5062 @end example
5063
5064 In all the above example the named key for @option{volume} can be
5065 omitted, for example like in:
5066 @example
5067 volume=0.5
5068 @end example
5069
5070 @item
5071 Increase input audio power by 6 decibels using fixed-point precision:
5072 @example
5073 volume=volume=6dB:precision=fixed
5074 @end example
5075
5076 @item
5077 Fade volume after time 10 with an annihilation period of 5 seconds:
5078 @example
5079 volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
5080 @end example
5081 @end itemize
5082
5083 @section volumedetect
5084
5085 Detect the volume of the input video.
5086
5087 The filter has no parameters. The input is not modified. Statistics about
5088 the volume will be printed in the log when the input stream end is reached.
5089
5090 In particular it will show the mean volume (root mean square), maximum
5091 volume (on a per-sample basis), and the beginning of a histogram of the
5092 registered volume values (from the maximum value to a cumulated 1/1000 of
5093 the samples).
5094
5095 All volumes are in decibels relative to the maximum PCM value.
5096
5097 @subsection Examples
5098
5099 Here is an excerpt of the output:
5100 @example
5101 [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
5102 [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
5103 [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
5104 [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
5105 [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
5106 [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
5107 [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
5108 [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
5109 [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
5110 @end example
5111
5112 It means that:
5113 @itemize
5114 @item
5115 The mean square energy is approximately -27 dB, or 10^-2.7.
5116 @item
5117 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
5118 @item
5119 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
5120 @end itemize
5121
5122 In other words, raising the volume by +4 dB does not cause any clipping,
5123 raising it by +5 dB causes clipping for 6 samples, etc.
5124
5125 @c man end AUDIO FILTERS
5126
5127 @chapter Audio Sources
5128 @c man begin AUDIO SOURCES
5129
5130 Below is a description of the currently available audio sources.
5131
5132 @section abuffer
5133
5134 Buffer audio frames, and make them available to the filter chain.
5135
5136 This source is mainly intended for a programmatic use, in particular
5137 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
5138
5139 It accepts the following parameters:
5140 @table @option
5141
5142 @item time_base
5143 The timebase which will be used for timestamps of submitted frames. It must be
5144 either a floating-point number or in @var{numerator}/@var{denominator} form.
5145
5146 @item sample_rate
5147 The sample rate of the incoming audio buffers.
5148
5149 @item sample_fmt
5150 The sample format of the incoming audio buffers.
5151 Either a sample format name or its corresponding integer representation from
5152 the enum AVSampleFormat in @file{libavutil/samplefmt.h}
5153
5154 @item channel_layout
5155 The channel layout of the incoming audio buffers.
5156 Either a channel layout name from channel_layout_map in
5157 @file{libavutil/channel_layout.c} or its corresponding integer representation
5158 from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
5159
5160 @item channels
5161 The number of channels of the incoming audio buffers.
5162 If both @var{channels} and @var{channel_layout} are specified, then they
5163 must be consistent.
5164
5165 @end table
5166
5167 @subsection Examples
5168
5169 @example
5170 abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
5171 @end example
5172
5173 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
5174 Since the sample format with name "s16p" corresponds to the number
5175 6 and the "stereo" channel layout corresponds to the value 0x3, this is
5176 equivalent to:
5177 @example
5178 abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
5179 @end example
5180
5181 @section aevalsrc
5182
5183 Generate an audio signal specified by an expression.
5184
5185 This source accepts in input one or more expressions (one for each
5186 channel), which are evaluated and used to generate a corresponding
5187 audio signal.
5188
5189 This source accepts the following options:
5190
5191 @table @option
5192 @item exprs
5193 Set the '|'-separated expressions list for each separate channel. In case the
5194 @option{channel_layout} option is not specified, the selected channel layout
5195 depends on the number of provided expressions. Otherwise the last
5196 specified expression is applied to the remaining output channels.
5197
5198 @item channel_layout, c
5199 Set the channel layout. The number of channels in the specified layout
5200 must be equal to the number of specified expressions.
5201
5202 @item duration, d
5203 Set the minimum duration of the sourced audio. See
5204 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
5205 for the accepted syntax.
5206 Note that the resulting duration may be greater than the specified
5207 duration, as the generated audio is always cut at the end of a
5208 complete frame.
5209
5210 If not specified, or the expressed duration is negative, the audio is
5211 supposed to be generated forever.
5212
5213 @item nb_samples, n
5214 Set the number of samples per channel per each output frame,
5215 default to 1024.
5216
5217 @item sample_rate, s
5218 Specify the sample rate, default to 44100.
5219 @end table
5220
5221 Each expression in @var{exprs} can contain the following constants:
5222
5223 @table @option
5224 @item n
5225 number of the evaluated sample, starting from 0
5226
5227 @item t
5228 time of the evaluated sample expressed in seconds, starting from 0
5229
5230 @item s
5231 sample rate
5232
5233 @end table
5234
5235 @subsection Examples
5236
5237 @itemize
5238 @item
5239 Generate silence:
5240 @example
5241 aevalsrc=0
5242 @end example
5243
5244 @item
5245 Generate a sin signal with frequency of 440 Hz, set sample rate to
5246 8000 Hz:
5247 @example
5248 aevalsrc="sin(440*2*PI*t):s=8000"
5249 @end example
5250
5251 @item
5252 Generate a two channels signal, specify the channel layout (Front
5253 Center + Back Center) explicitly:
5254 @example
5255 aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
5256 @end example
5257
5258 @item
5259 Generate white noise:
5260 @example
5261 aevalsrc="-2+random(0)"
5262 @end example
5263
5264 @item
5265 Generate an amplitude modulated signal:
5266 @example
5267 aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
5268 @end example
5269
5270 @item
5271 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
5272 @example
5273 aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
5274 @end example
5275
5276 @end itemize
5277
5278 @section anullsrc
5279
5280 The null audio source, return unprocessed audio frames. It is mainly useful
5281 as a template and to be employed in analysis / debugging tools, or as
5282 the source for filters which ignore the input data (for example the sox
5283 synth filter).
5284
5285 This source accepts the following options:
5286
5287 @table @option
5288
5289 @item channel_layout, cl
5290
5291 Specifies the channel layout, and can be either an integer or a string
5292 representing a channel layout. The default value of @var{channel_layout}
5293 is "stereo".
5294
5295 Check the channel_layout_map definition in
5296 @file{libavutil/channel_layout.c} for the mapping between strings and
5297 channel layout values.
5298
5299 @item sample_rate, r
5300 Specifies the sample rate, and defaults to 44100.
5301
5302 @item nb_samples, n
5303 Set the number of samples per requested frames.
5304
5305 @end table
5306
5307 @subsection Examples
5308
5309 @itemize
5310 @item
5311 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
5312 @example
5313 anullsrc=r=48000:cl=4
5314 @end example
5315
5316 @item
5317 Do the same operation with a more obvious syntax:
5318 @example
5319 anullsrc=r=48000:cl=mono
5320 @end example
5321 @end itemize
5322
5323 All the parameters need to be explicitly defined.
5324
5325 @section flite
5326
5327 Synthesize a voice utterance using the libflite library.
5328
5329 To enable compilation of this filter you need to configure FFmpeg with
5330 @code{--enable-libflite}.
5331
5332 Note that versions of the flite library prior to 2.0 are not thread-safe.
5333
5334 The filter accepts the following options:
5335
5336 @table @option
5337
5338 @item list_voices
5339 If set to 1, list the names of the available voices and exit
5340 immediately. Default value is 0.
5341
5342 @item nb_samples, n
5343 Set the maximum number of samples per frame. Default value is 512.
5344
5345 @item textfile
5346 Set the filename containing the text to speak.
5347
5348 @item text
5349 Set the text to speak.
5350
5351 @item voice, v
5352 Set the voice to use for the speech synthesis. Default value is
5353 @code{kal}. See also the @var{list_voices} option.
5354 @end table
5355
5356 @subsection Examples
5357
5358 @itemize
5359 @item
5360 Read from file @file{speech.txt}, and synthesize the text using the
5361 standard flite voice:
5362 @example
5363 flite=textfile=speech.txt
5364 @end example
5365
5366 @item
5367 Read the specified text selecting the @code{slt} voice:
5368 @example
5369 flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
5370 @end example
5371
5372 @item
5373 Input text to ffmpeg:
5374 @example
5375 ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
5376 @end example
5377
5378 @item
5379 Make @file{ffplay} speak the specified text, using @code{flite} and
5380 the @code{lavfi} device:
5381 @example
5382 ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
5383 @end example
5384 @end itemize
5385
5386 For more information about libflite, check:
5387 @url{http://www.festvox.org/flite/}
5388
5389 @section anoisesrc
5390
5391 Generate a noise audio signal.
5392
5393 The filter accepts the following options:
5394
5395 @table @option
5396 @item sample_rate, r
5397 Specify the sample rate. Default value is 48000 Hz.
5398
5399 @item amplitude, a
5400 Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
5401 is 1.0.
5402
5403 @item duration, d
5404 Specify the duration of the generated audio stream. Not specifying this option
5405 results in noise with an infinite length.
5406
5407 @item color, colour, c
5408 Specify the color of noise. Available noise colors are white, pink, brown,
5409 blue and violet. Default color is white.
5410
5411 @item seed, s
5412 Specify a value used to seed the PRNG.
5413
5414 @item nb_samples, n
5415 Set the number of samples per each output frame, default is 1024.
5416 @end table
5417
5418 @subsection Examples
5419
5420 @itemize
5421
5422 @item
5423 Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
5424 @example
5425 anoisesrc=d=60:c=pink:r=44100:a=0.5
5426 @end example
5427 @end itemize
5428
5429 @section hilbert
5430
5431 Generate odd-tap Hilbert transform FIR coefficients.
5432
5433 The resulting stream can be used with @ref{afir} filter for phase-shifting
5434 the signal by 90 degrees.
5435
5436 This is used in many matrix coding schemes and for analytic signal generation.
5437 The process is often written as a multiplication by i (or j), the imaginary unit.
5438
5439 The filter accepts the following options:
5440
5441 @table @option
5442
5443 @item sample_rate, s
5444 Set sample rate, default is 44100.
5445
5446 @item taps, t
5447 Set length of FIR filter, default is 22051.
5448
5449 @item nb_samples, n
5450 Set number of samples per each frame.
5451
5452 @item win_func, w
5453 Set window function to be used when generating FIR coefficients.
5454 @end table
5455
5456 @section sinc
5457
5458 Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
5459
5460 The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
5461
5462 The filter accepts the following options:
5463
5464 @table @option
5465 @item sample_rate, r
5466 Set sample rate, default is 44100.
5467
5468 @item nb_samples, n
5469 Set number of samples per each frame. Default is 1024.
5470
5471 @item hp
5472 Set high-pass frequency. Default is 0.
5473
5474 @item lp
5475 Set low-pass frequency. Default is 0.
5476 If high-pass frequency is lower than low-pass frequency and low-pass frequency
5477 is higher than 0 then filter will create band-pass filter coefficients,
5478 otherwise band-reject filter coefficients.
5479
5480 @item phase
5481 Set filter phase response. Default is 50. Allowed range is from 0 to 100.
5482
5483 @item beta
5484 Set Kaiser window beta.
5485
5486 @item att
5487 Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
5488
5489 @item round
5490 Enable rounding, by default is disabled.
5491
5492 @item hptaps
5493 Set number of taps for high-pass filter.
5494
5495 @item lptaps
5496 Set number of taps for low-pass filter.
5497 @end table
5498
5499 @section sine
5500
5501 Generate an audio signal made of a sine wave with amplitude 1/8.
5502
5503 The audio signal is bit-exact.
5504
5505 The filter accepts the following options:
5506
5507 @table @option
5508
5509 @item frequency, f
5510 Set the carrier frequency. Default is 440 Hz.
5511
5512 @item beep_factor, b
5513 Enable a periodic beep every second with frequency @var{beep_factor} times
5514 the carrier frequency. Default is 0, meaning the beep is disabled.
5515
5516 @item sample_rate, r
5517 Specify the sample rate, default is 44100.
5518
5519 @item duration, d
5520 Specify the duration of the generated audio stream.
5521
5522 @item samples_per_frame
5523 Set the number of samples per output frame.
5524
5525 The expression can contain the following constants:
5526
5527 @table @option
5528 @item n
5529 The (sequential) number of the output audio frame, starting from 0.
5530
5531 @item pts
5532 The PTS (Presentation TimeStamp) of the output audio frame,
5533 expressed in @var{TB} units.
5534
5535 @item t
5536 The PTS of the output audio frame, expressed in seconds.
5537
5538 @item TB
5539 The timebase of the output audio frames.
5540 @end table
5541
5542 Default is @code{1024}.
5543 @end table
5544
5545 @subsection Examples
5546
5547 @itemize
5548
5549 @item
5550 Generate a simple 440 Hz sine wave:
5551 @example
5552 sine
5553 @end example
5554
5555 @item
5556 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
5557 @example
5558 sine=220:4:d=5
5559 sine=f=220:b=4:d=5
5560 sine=frequency=220:beep_factor=4:duration=5
5561 @end example
5562
5563 @item
5564 Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
5565 pattern:
5566 @example
5567 sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
5568 @end example
5569 @end itemize
5570
5571 @c man end AUDIO SOURCES
5572
5573 @chapter Audio Sinks
5574 @c man begin AUDIO SINKS
5575
5576 Below is a description of the currently available audio sinks.
5577
5578 @section abuffersink
5579
5580 Buffer audio frames, and make them available to the end of filter chain.
5581
5582 This sink is mainly intended for programmatic use, in particular
5583 through the interface defined in @file{libavfilter/buffersink.h}
5584 or the options system.
5585
5586 It accepts a pointer to an AVABufferSinkContext structure, which
5587 defines the incoming buffers' formats, to be passed as the opaque
5588 parameter to @code{avfilter_init_filter} for initialization.
5589 @section anullsink
5590
5591 Null audio sink; do absolutely nothing with the input audio. It is
5592 mainly useful as a template and for use in analysis / debugging
5593 tools.
5594
5595 @c man end AUDIO SINKS
5596
5597 @chapter Video Filters
5598 @c man begin VIDEO FILTERS
5599
5600 When you configure your FFmpeg build, you can disable any of the
5601 existing filters using @code{--disable-filters}.
5602 The configure output will show the video filters included in your
5603 build.
5604
5605 Below is a description of the currently available video filters.
5606
5607 @section alphaextract
5608
5609 Extract the alpha component from the input as a grayscale video. This
5610 is especially useful with the @var{alphamerge} filter.
5611
5612 @section alphamerge
5613
5614 Add or replace the alpha component of the primary input with the
5615 grayscale value of a second input. This is intended for use with
5616 @var{alphaextract} to allow the transmission or storage of frame
5617 sequences that have alpha in a format that doesn't support an alpha
5618 channel.
5619
5620 For example, to reconstruct full frames from a normal YUV-encoded video
5621 and a separate video created with @var{alphaextract}, you might use:
5622 @example
5623 movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
5624 @end example
5625
5626 Since this filter is designed for reconstruction, it operates on frame
5627 sequences without considering timestamps, and terminates when either
5628 input reaches end of stream. This will cause problems if your encoding
5629 pipeline drops frames. If you're trying to apply an image as an
5630 overlay to a video stream, consider the @var{overlay} filter instead.
5631
5632 @section amplify
5633
5634 Amplify differences between current pixel and pixels of adjacent frames in
5635 same pixel location.
5636
5637 This filter accepts the following options:
5638
5639 @table @option
5640 @item radius
5641 Set frame radius. Default is 2. Allowed range is from 1 to 63.
5642 For example radius of 3 will instruct filter to calculate average of 7 frames.
5643
5644 @item factor
5645 Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
5646
5647 @item threshold
5648 Set threshold for difference amplification. Any differrence greater or equal to
5649 this value will not alter source pixel. Default is 10.
5650 Allowed range is from 0 to 65535.
5651
5652 @item low
5653 Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
5654 This option controls maximum possible value that will decrease source pixel value.
5655
5656 @item high
5657 Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
5658 This option controls maximum possible value that will increase source pixel value.
5659
5660 @item planes
5661 Set which planes to filter. Default is all. Allowed range is from 0 to 15.
5662 @end table
5663
5664 @section ass
5665
5666 Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
5667 and libavformat to work. On the other hand, it is limited to ASS (Advanced
5668 Substation Alpha) subtitles files.
5669
5670 This filter accepts the following option in addition to the common options from
5671 the @ref{subtitles} filter:
5672
5673 @table @option
5674 @item shaping
5675 Set the shaping engine
5676
5677 Available values are:
5678 @table @samp
5679 @item auto
5680 The default libass shaping engine, which is the best available.
5681 @item simple
5682 Fast, font-agnostic shaper that can do only substitutions
5683 @item complex
5684 Slower shaper using OpenType for substitutions and positioning
5685 @end table
5686
5687 The default is @code{auto}.
5688 @end table
5689
5690 @section atadenoise
5691 Apply an Adaptive Temporal Averaging Denoiser to the video input.
5692
5693 The filter accepts the following options:
5694
5695 @table @option
5696 @item 0a
5697 Set threshold A for 1st plane. Default is 0.02.
5698 Valid range is 0 to 0.3.
5699
5700 @item 0b
5701 Set threshold B for 1st plane. Default is 0.04.
5702 Valid range is 0 to 5.
5703
5704 @item 1a
5705 Set threshold A for 2nd plane. Default is 0.02.
5706 Valid range is 0 to 0.3.
5707
5708 @item 1b
5709 Set threshold B for 2nd plane. Default is 0.04.
5710 Valid range is 0 to 5.
5711
5712 @item 2a
5713 Set threshold A for 3rd plane. Default is 0.02.
5714 Valid range is 0 to 0.3.
5715
5716 @item 2b
5717 Set threshold B for 3rd plane. Default is 0.04.
5718 Valid range is 0 to 5.
5719
5720 Threshold A is designed to react on abrupt changes in the input signal and
5721 threshold B is designed to react on continuous changes in the input signal.
5722
5723 @item s
5724 Set number of frames filter will use for averaging. Default is 9. Must be odd
5725 number in range [5, 129].
5726
5727 @item p
5728 Set what planes of frame filter will use for averaging. Default is all.
5729 @end table
5730
5731 @section avgblur
5732
5733 Apply average blur filter.
5734
5735 The filter accepts the following options:
5736
5737 @table @option
5738 @item sizeX
5739 Set horizontal radius size.
5740
5741 @item planes
5742 Set which planes to filter. By default all planes are filtered.
5743
5744 @item sizeY
5745 Set vertical radius size, if zero it will be same as @code{sizeX}.
5746 Default is @code{0}.
5747 @end table
5748
5749 @section bbox
5750
5751 Compute the bounding box for the non-black pixels in the input frame
5752 luminance plane.
5753
5754 This filter computes the bounding box containing all the pixels with a
5755 luminance value greater than the minimum allowed value.
5756 The parameters describing the bounding box are printed on the filter
5757 log.
5758
5759 The filter accepts the following option:
5760
5761 @table @option
5762 @item min_val
5763 Set the minimal luminance value. Default is @code{16}.
5764 @end table
5765
5766 @section bitplanenoise
5767
5768 Show and measure bit plane noise.
5769
5770 The filter accepts the following options:
5771
5772 @table @option
5773 @item bitplane
5774 Set which plane to analyze. Default is @code{1}.
5775
5776 @item filter
5777 Filter out noisy pixels from @code{bitplane} set above.
5778 Default is disabled.
5779 @end table
5780
5781 @section blackdetect
5782
5783 Detect video intervals that are (almost) completely black. Can be
5784 useful to detect chapter transitions, commercials, or invalid
5785 recordings. Output lines contains the time for the start, end and
5786 duration of the detected black interval expressed in seconds.
5787
5788 In order to display the output lines, you need to set the loglevel at
5789 least to the AV_LOG_INFO value.
5790
5791 The filter accepts the following options:
5792
5793 @table @option
5794 @item black_min_duration, d
5795 Set the minimum detected black duration expressed in seconds. It must
5796 be a non-negative floating point number.
5797
5798 Default value is 2.0.
5799
5800 @item picture_black_ratio_th, pic_th
5801 Set the threshold for considering a picture "black".
5802 Express the minimum value for the ratio:
5803 @example
5804 @var{nb_black_pixels} / @var{nb_pixels}
5805 @end example
5806
5807 for which a picture is considered black.
5808 Default value is 0.98.
5809
5810 @item pixel_black_th, pix_th
5811 Set the threshold for considering a pixel "black".
5812
5813 The threshold expresses the maximum pixel luminance value for which a
5814 pixel is considered "black". The provided value is scaled according to
5815 the following equation:
5816 @example
5817 @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
5818 @end example
5819
5820 @var{luminance_range_size} and @var{luminance_minimum_value} depend on
5821 the input video format, the range is [0-255] for YUV full-range
5822 formats and [16-235] for YUV non full-range formats.
5823
5824 Default value is 0.10.
5825 @end table
5826
5827 The following example sets the maximum pixel threshold to the minimum
5828 value, and detects only black intervals of 2 or more seconds:
5829 @example
5830 blackdetect=d=2:pix_th=0.00
5831 @end example
5832
5833 @section blackframe
5834
5835 Detect frames that are (almost) completely black. Can be useful to
5836 detect chapter transitions or commercials. Output lines consist of
5837 the frame number of the detected frame, the percentage of blackness,
5838 the position in the file if known or -1 and the timestamp in seconds.
5839
5840 In order to display the output lines, you need to set the loglevel at
5841 least to the AV_LOG_INFO value.
5842
5843 This filter exports frame metadata @code{lavfi.blackframe.pblack}.
5844 The value represents the percentage of pixels in the picture that
5845 are below the threshold value.
5846
5847 It accepts the following parameters:
5848
5849 @table @option
5850
5851 @item amount
5852 The percentage of the pixels that have to be below the threshold; it defaults to
5853 @code{98}.
5854
5855 @item threshold, thresh
5856 The threshold below which a pixel value is considered black; it defaults to
5857 @code{32}.
5858
5859 @end table
5860
5861 @section blend, tblend
5862
5863 Blend two video frames into each other.
5864
5865 The @code{blend} filter takes two input streams and outputs one
5866 stream, the first input is the "top" layer and second input is
5867 "bottom" layer.  By default, the output terminates when the longest input terminates.
5868
5869 The @code{tblend} (time blend) filter takes two consecutive frames
5870 from one single stream, and outputs the result obtained by blending
5871 the new frame on top of the old frame.
5872
5873 A description of the accepted options follows.
5874
5875 @table @option
5876 @item c0_mode
5877 @item c1_mode
5878 @item c2_mode
5879 @item c3_mode
5880 @item all_mode
5881 Set blend mode for specific pixel component or all pixel components in case
5882 of @var{all_mode}. Default value is @code{normal}.
5883
5884 Available values for component modes are:
5885 @table @samp
5886 @item addition
5887 @item grainmerge
5888 @item and
5889 @item average
5890 @item burn
5891 @item darken
5892 @item difference
5893 @item grainextract
5894 @item divide
5895 @item dodge
5896 @item freeze
5897 @item exclusion
5898 @item extremity
5899 @item glow
5900 @item hardlight
5901 @item hardmix
5902 @item heat
5903 @item lighten
5904 @item linearlight
5905 @item multiply
5906 @item multiply128
5907 @item negation
5908 @item normal
5909 @item or
5910 @item overlay
5911 @item phoenix
5912 @item pinlight
5913 @item reflect
5914 @item screen
5915 @item softlight
5916 @item subtract
5917 @item vividlight
5918 @item xor
5919 @end table
5920
5921 @item c0_opacity
5922 @item c1_opacity
5923 @item c2_opacity
5924 @item c3_opacity
5925 @item all_opacity
5926 Set blend opacity for specific pixel component or all pixel components in case
5927 of @var{all_opacity}. Only used in combination with pixel component blend modes.
5928
5929 @item c0_expr
5930 @item c1_expr
5931 @item c2_expr
5932 @item c3_expr
5933 @item all_expr
5934 Set blend expression for specific pixel component or all pixel components in case
5935 of @var{all_expr}. Note that related mode options will be ignored if those are set.
5936
5937 The expressions can use the following variables:
5938
5939 @table @option
5940 @item N
5941 The sequential number of the filtered frame, starting from @code{0}.
5942
5943 @item X
5944 @item Y
5945 the coordinates of the current sample
5946
5947 @item W
5948 @item H
5949 the width and height of currently filtered plane
5950
5951 @item SW
5952 @item SH
5953 Width and height scale for the plane being filtered. It is the
5954 ratio between the dimensions of the current plane to the luma plane,
5955 e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
5956 the luma plane and @code{0.5,0.5} for the chroma planes.
5957
5958 @item T
5959 Time of the current frame, expressed in seconds.
5960
5961 @item TOP, A
5962 Value of pixel component at current location for first video frame (top layer).
5963
5964 @item BOTTOM, B
5965 Value of pixel component at current location for second video frame (bottom layer).
5966 @end table
5967 @end table
5968
5969 The @code{blend} filter also supports the @ref{framesync} options.
5970
5971 @subsection Examples
5972
5973 @itemize
5974 @item
5975 Apply transition from bottom layer to top layer in first 10 seconds:
5976 @example
5977 blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
5978 @end example
5979
5980 @item
5981 Apply linear horizontal transition from top layer to bottom layer:
5982 @example
5983 blend=all_expr='A*(X/W)+B*(1-X/W)'
5984 @end example
5985
5986 @item
5987 Apply 1x1 checkerboard effect:
5988 @example
5989 blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
5990 @end example
5991
5992 @item
5993 Apply uncover left effect:
5994 @example
5995 blend=all_expr='if(gte(N*SW+X,W),A,B)'
5996 @end example
5997
5998 @item
5999 Apply uncover down effect:
6000 @example
6001 blend=all_expr='if(gte(Y-N*SH,0),A,B)'
6002 @end example
6003
6004 @item
6005 Apply uncover up-left effect:
6006 @example
6007 blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
6008 @end example
6009
6010 @item
6011 Split diagonally video and shows top and bottom layer on each side:
6012 @example
6013 blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
6014 @end example
6015
6016 @item
6017 Display differences between the current and the previous frame:
6018 @example
6019 tblend=all_mode=grainextract
6020 @end example
6021 @end itemize
6022
6023 @section bm3d
6024
6025 Denoise frames using Block-Matching 3D algorithm.
6026
6027 The filter accepts the following options.
6028
6029 @table @option
6030 @item sigma
6031 Set denoising strength. Default value is 1.
6032 Allowed range is from 0 to 999.9.
6033 The denoising algorith is very sensitive to sigma, so adjust it
6034 according to the source.
6035
6036 @item block
6037 Set local patch size. This sets dimensions in 2D.
6038
6039 @item bstep
6040 Set sliding step for processing blocks. Default value is 4.
6041 Allowed range is from 1 to 64.
6042 Smaller values allows processing more reference blocks and is slower.
6043
6044 @item group
6045 Set maximal number of similar blocks for 3rd dimension. Default value is 1.
6046 When set to 1, no block matching is done. Larger values allows more blocks
6047 in single group.
6048 Allowed range is from 1 to 256.
6049
6050 @item range
6051 Set radius for search block matching. Default is 9.
6052 Allowed range is from 1 to INT32_MAX.
6053
6054 @item mstep
6055 Set step between two search locations for block matching. Default is 1.
6056 Allowed range is from 1 to 64. Smaller is slower.
6057
6058 @item thmse
6059 Set threshold of mean square error for block matching. Valid range is 0 to
6060 INT32_MAX.
6061
6062 @item hdthr
6063 Set thresholding parameter for hard thresholding in 3D transformed domain.
6064 Larger values results in stronger hard-thresholding filtering in frequency
6065 domain.
6066
6067 @item estim
6068 Set filtering estimation mode. Can be @code{basic} or @code{final}.
6069 Default is @code{basic}.
6070
6071 @item ref
6072 If enabled, filter will use 2nd stream for block matching.
6073 Default is disabled for @code{basic} value of @var{estim} option,
6074 and always enabled if value of @var{estim} is @code{final}.
6075
6076 @item planes
6077 Set planes to filter. Default is all available except alpha.
6078 @end table
6079
6080 @subsection Examples
6081
6082 @itemize
6083 @item
6084 Basic filtering with bm3d:
6085 @example
6086 bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
6087 @end example
6088
6089 @item
6090 Same as above, but filtering only luma:
6091 @example
6092 bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
6093 @end example
6094
6095 @item
6096 Same as above, but with both estimation modes:
6097 @example
6098 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
6099 @end example
6100
6101 @item
6102 Same as above, but prefilter with @ref{nlmeans} filter instead:
6103 @example
6104 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
6105 @end example
6106 @end itemize
6107
6108 @section boxblur
6109
6110 Apply a boxblur algorithm to the input video.
6111
6112 It accepts the following parameters:
6113
6114 @table @option
6115
6116 @item luma_radius, lr
6117 @item luma_power, lp
6118 @item chroma_radius, cr
6119 @item chroma_power, cp
6120 @item alpha_radius, ar
6121 @item alpha_power, ap
6122
6123 @end table
6124
6125 A description of the accepted options follows.
6126
6127 @table @option
6128 @item luma_radius, lr
6129 @item chroma_radius, cr
6130 @item alpha_radius, ar
6131 Set an expression for the box radius in pixels used for blurring the
6132 corresponding input plane.
6133
6134 The radius value must be a non-negative number, and must not be
6135 greater than the value of the expression @code{min(w,h)/2} for the
6136 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
6137 planes.
6138
6139 Default value for @option{luma_radius} is "2". If not specified,
6140 @option{chroma_radius} and @option{alpha_radius} default to the
6141 corresponding value set for @option{luma_radius}.
6142
6143 The expressions can contain the following constants:
6144 @table @option
6145 @item w
6146 @item h
6147 The input width and height in pixels.
6148
6149 @item cw
6150 @item ch
6151 The input chroma image width and height in pixels.
6152
6153 @item hsub
6154 @item vsub
6155 The horizontal and vertical chroma subsample values. For example, for the
6156 pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
6157 @end table
6158
6159 @item luma_power, lp
6160 @item chroma_power, cp
6161 @item alpha_power, ap
6162 Specify how many times the boxblur filter is applied to the
6163 corresponding plane.
6164
6165 Default value for @option{luma_power} is 2. If not specified,
6166 @option{chroma_power} and @option{alpha_power} default to the
6167 corresponding value set for @option{luma_power}.
6168
6169 A value of 0 will disable the effect.
6170 @end table
6171
6172 @subsection Examples
6173
6174 @itemize
6175 @item
6176 Apply a boxblur filter with the luma, chroma, and alpha radii
6177 set to 2:
6178 @example
6179 boxblur=luma_radius=2:luma_power=1
6180 boxblur=2:1
6181 @end example
6182
6183 @item
6184 Set the luma radius to 2, and alpha and chroma radius to 0:
6185 @example
6186 boxblur=2:1:cr=0:ar=0
6187 @end example
6188
6189 @item
6190 Set the luma and chroma radii to a fraction of the video dimension:
6191 @example
6192 boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
6193 @end example
6194 @end itemize
6195
6196 @section bwdif
6197
6198 Deinterlace the input video ("bwdif" stands for "Bob Weaver
6199 Deinterlacing Filter").
6200
6201 Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
6202 interpolation algorithms.
6203 It accepts the following parameters:
6204
6205 @table @option
6206 @item mode
6207 The interlacing mode to adopt. It accepts one of the following values:
6208
6209 @table @option
6210 @item 0, send_frame
6211 Output one frame for each frame.
6212 @item 1, send_field
6213 Output one frame for each field.
6214 @end table
6215
6216 The default value is @code{send_field}.
6217
6218 @item parity
6219 The picture field parity assumed for the input interlaced video. It accepts one
6220 of the following values:
6221
6222 @table @option
6223 @item 0, tff
6224 Assume the top field is first.
6225 @item 1, bff
6226 Assume the bottom field is first.
6227 @item -1, auto
6228 Enable automatic detection of field parity.
6229 @end table
6230
6231 The default value is @code{auto}.
6232 If the interlacing is unknown or the decoder does not export this information,
6233 top field first will be assumed.
6234
6235 @item deint
6236 Specify which frames to deinterlace. Accept one of the following
6237 values:
6238
6239 @table @option
6240 @item 0, all
6241 Deinterlace all frames.
6242 @item 1, interlaced
6243 Only deinterlace frames marked as interlaced.
6244 @end table
6245
6246 The default value is @code{all}.
6247 @end table
6248
6249 @section chromahold
6250 Remove all color information for all colors except for certain one.
6251
6252 The filter accepts the following options:
6253
6254 @table @option
6255 @item color
6256 The color which will not be replaced with neutral chroma.
6257
6258 @item similarity
6259 Similarity percentage with the above color.
6260 0.01 matches only the exact key color, while 1.0 matches everything.
6261
6262 @item yuv
6263 Signals that the color passed is already in YUV instead of RGB.
6264
6265 Literal colors like "green" or "red" don't make sense with this enabled anymore.
6266 This can be used to pass exact YUV values as hexadecimal numbers.
6267 @end table
6268
6269 @section chromakey
6270 YUV colorspace color/chroma keying.
6271
6272 The filter accepts the following options:
6273
6274 @table @option
6275 @item color
6276 The color which will be replaced with transparency.
6277
6278 @item similarity
6279 Similarity percentage with the key color.
6280
6281 0.01 matches only the exact key color, while 1.0 matches everything.
6282
6283 @item blend
6284 Blend percentage.
6285
6286 0.0 makes pixels either fully transparent, or not transparent at all.
6287
6288 Higher values result in semi-transparent pixels, with a higher transparency
6289 the more similar the pixels color is to the key color.
6290
6291 @item yuv
6292 Signals that the color passed is already in YUV instead of RGB.
6293
6294 Literal colors like "green" or "red" don't make sense with this enabled anymore.
6295 This can be used to pass exact YUV values as hexadecimal numbers.
6296 @end table
6297
6298 @subsection Examples
6299
6300 @itemize
6301 @item
6302 Make every green pixel in the input image transparent:
6303 @example
6304 ffmpeg -i input.png -vf chromakey=green out.png
6305 @end example
6306
6307 @item
6308 Overlay a greenscreen-video on top of a static black background.
6309 @example
6310 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
6311 @end example
6312 @end itemize
6313
6314 @section chromashift
6315 Shift chroma pixels horizontally and/or vertically.
6316
6317 The filter accepts the following options:
6318 @table @option
6319 @item cbh
6320 Set amount to shift chroma-blue horizontally.
6321 @item cbv
6322 Set amount to shift chroma-blue vertically.
6323 @item crh
6324 Set amount to shift chroma-red horizontally.
6325 @item crv
6326 Set amount to shift chroma-red vertically.
6327 @item edge
6328 Set edge mode, can be @var{smear}, default, or @var{warp}.
6329 @end table
6330
6331 @section ciescope
6332
6333 Display CIE color diagram with pixels overlaid onto it.
6334
6335 The filter accepts the following options:
6336
6337 @table @option
6338 @item system
6339 Set color system.
6340
6341 @table @samp
6342 @item ntsc, 470m
6343 @item ebu, 470bg
6344 @item smpte
6345 @item 240m
6346 @item apple
6347 @item widergb
6348 @item cie1931
6349 @item rec709, hdtv
6350 @item uhdtv, rec2020
6351 @end table
6352
6353 @item cie
6354 Set CIE system.
6355
6356 @table @samp
6357 @item xyy
6358 @item ucs
6359 @item luv
6360 @end table
6361
6362 @item gamuts
6363 Set what gamuts to draw.
6364
6365 See @code{system} option for available values.
6366
6367 @item size, s
6368 Set ciescope size, by default set to 512.
6369
6370 @item intensity, i
6371 Set intensity used to map input pixel values to CIE diagram.
6372
6373 @item contrast
6374 Set contrast used to draw tongue colors that are out of active color system gamut.
6375
6376 @item corrgamma
6377 Correct gamma displayed on scope, by default enabled.
6378
6379 @item showwhite
6380 Show white point on CIE diagram, by default disabled.
6381
6382 @item gamma
6383 Set input gamma. Used only with XYZ input color space.
6384 @end table
6385
6386 @section codecview
6387
6388 Visualize information exported by some codecs.
6389
6390 Some codecs can export information through frames using side-data or other
6391 means. For example, some MPEG based codecs export motion vectors through the
6392 @var{export_mvs} flag in the codec @option{flags2} option.
6393
6394 The filter accepts the following option:
6395
6396 @table @option
6397 @item mv
6398 Set motion vectors to visualize.
6399
6400 Available flags for @var{mv} are:
6401
6402 @table @samp
6403 @item pf
6404 forward predicted MVs of P-frames
6405 @item bf
6406 forward predicted MVs of B-frames
6407 @item bb
6408 backward predicted MVs of B-frames
6409 @end table
6410
6411 @item qp
6412 Display quantization parameters using the chroma planes.
6413
6414 @item mv_type, mvt
6415 Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
6416
6417 Available flags for @var{mv_type} are:
6418
6419 @table @samp
6420 @item fp
6421 forward predicted MVs
6422 @item bp
6423 backward predicted MVs
6424 @end table
6425
6426 @item frame_type, ft
6427 Set frame type to visualize motion vectors of.
6428
6429 Available flags for @var{frame_type} are:
6430
6431 @table @samp
6432 @item if
6433 intra-coded frames (I-frames)
6434 @item pf
6435 predicted frames (P-frames)
6436 @item bf
6437 bi-directionally predicted frames (B-frames)
6438 @end table
6439 @end table
6440
6441 @subsection Examples
6442
6443 @itemize
6444 @item
6445 Visualize forward predicted MVs of all frames using @command{ffplay}:
6446 @example
6447 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
6448 @end example
6449
6450 @item
6451 Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
6452 @example
6453 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
6454 @end example
6455 @end itemize
6456
6457 @section colorbalance
6458 Modify intensity of primary colors (red, green and blue) of input frames.
6459
6460 The filter allows an input frame to be adjusted in the shadows, midtones or highlights
6461 regions for the red-cyan, green-magenta or blue-yellow balance.
6462
6463 A positive adjustment value shifts the balance towards the primary color, a negative
6464 value towards the complementary color.
6465
6466 The filter accepts the following options:
6467
6468 @table @option
6469 @item rs
6470 @item gs
6471 @item bs
6472 Adjust red, green and blue shadows (darkest pixels).
6473
6474 @item rm
6475 @item gm
6476 @item bm
6477 Adjust red, green and blue midtones (medium pixels).
6478
6479 @item rh
6480 @item gh
6481 @item bh
6482 Adjust red, green and blue highlights (brightest pixels).
6483
6484 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
6485 @end table
6486
6487 @subsection Examples
6488
6489 @itemize
6490 @item
6491 Add red color cast to shadows:
6492 @example
6493 colorbalance=rs=.3
6494 @end example
6495 @end itemize
6496
6497 @section colorkey
6498 RGB colorspace color keying.
6499
6500 The filter accepts the following options:
6501
6502 @table @option
6503 @item color
6504 The color which will be replaced with transparency.
6505
6506 @item similarity
6507 Similarity percentage with the key color.
6508
6509 0.01 matches only the exact key color, while 1.0 matches everything.
6510
6511 @item blend
6512 Blend percentage.
6513
6514 0.0 makes pixels either fully transparent, or not transparent at all.
6515
6516 Higher values result in semi-transparent pixels, with a higher transparency
6517 the more similar the pixels color is to the key color.
6518 @end table
6519
6520 @subsection Examples
6521
6522 @itemize
6523 @item
6524 Make every green pixel in the input image transparent:
6525 @example
6526 ffmpeg -i input.png -vf colorkey=green out.png
6527 @end example
6528
6529 @item
6530 Overlay a greenscreen-video on top of a static background image.
6531 @example
6532 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
6533 @end example
6534 @end itemize
6535
6536 @section colorlevels
6537
6538 Adjust video input frames using levels.
6539
6540 The filter accepts the following options:
6541
6542 @table @option
6543 @item rimin
6544 @item gimin
6545 @item bimin
6546 @item aimin
6547 Adjust red, green, blue and alpha input black point.
6548 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
6549
6550 @item rimax
6551 @item gimax
6552 @item bimax
6553 @item aimax
6554 Adjust red, green, blue and alpha input white point.
6555 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
6556
6557 Input levels are used to lighten highlights (bright tones), darken shadows
6558 (dark tones), change the balance of bright and dark tones.
6559
6560 @item romin
6561 @item gomin
6562 @item bomin
6563 @item aomin
6564 Adjust red, green, blue and alpha output black point.
6565 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
6566
6567 @item romax
6568 @item gomax
6569 @item bomax
6570 @item aomax
6571 Adjust red, green, blue and alpha output white point.
6572 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
6573
6574 Output levels allows manual selection of a constrained output level range.
6575 @end table
6576
6577 @subsection Examples
6578
6579 @itemize
6580 @item
6581 Make video output darker:
6582 @example
6583 colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
6584 @end example
6585
6586 @item
6587 Increase contrast:
6588 @example
6589 colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
6590 @end example
6591
6592 @item
6593 Make video output lighter:
6594 @example
6595 colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
6596 @end example
6597
6598 @item
6599 Increase brightness:
6600 @example
6601 colorlevels=romin=0.5:gomin=0.5:bomin=0.5
6602 @end example
6603 @end itemize
6604
6605 @section colorchannelmixer
6606
6607 Adjust video input frames by re-mixing color channels.
6608
6609 This filter modifies a color channel by adding the values associated to
6610 the other channels of the same pixels. For example if the value to
6611 modify is red, the output value will be:
6612 @example
6613 @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
6614 @end example
6615
6616 The filter accepts the following options:
6617
6618 @table @option
6619 @item rr
6620 @item rg
6621 @item rb
6622 @item ra
6623 Adjust contribution of input red, green, blue and alpha channels for output red channel.
6624 Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
6625
6626 @item gr
6627 @item gg
6628 @item gb
6629 @item ga
6630 Adjust contribution of input red, green, blue and alpha channels for output green channel.
6631 Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
6632
6633 @item br
6634 @item bg
6635 @item bb
6636 @item ba
6637 Adjust contribution of input red, green, blue and alpha channels for output blue channel.
6638 Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
6639
6640 @item ar
6641 @item ag
6642 @item ab
6643 @item aa
6644 Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
6645 Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
6646
6647 Allowed ranges for options are @code{[-2.0, 2.0]}.
6648 @end table
6649
6650 @subsection Examples
6651
6652 @itemize
6653 @item
6654 Convert source to grayscale:
6655 @example
6656 colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
6657 @end example
6658 @item
6659 Simulate sepia tones:
6660 @example
6661 colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
6662 @end example
6663 @end itemize
6664
6665 @section colormatrix
6666
6667 Convert color matrix.
6668
6669 The filter accepts the following options:
6670
6671 @table @option
6672 @item src
6673 @item dst
6674 Specify the source and destination color matrix. Both values must be
6675 specified.
6676
6677 The accepted values are:
6678 @table @samp
6679 @item bt709
6680 BT.709
6681
6682 @item fcc
6683 FCC
6684
6685 @item bt601
6686 BT.601
6687
6688 @item bt470
6689 BT.470
6690
6691 @item bt470bg
6692 BT.470BG
6693
6694 @item smpte170m
6695 SMPTE-170M
6696
6697 @item smpte240m
6698 SMPTE-240M
6699
6700 @item bt2020
6701 BT.2020
6702 @end table
6703 @end table
6704
6705 For example to convert from BT.601 to SMPTE-240M, use the command:
6706 @example
6707 colormatrix=bt601:smpte240m
6708 @end example
6709
6710 @section colorspace
6711
6712 Convert colorspace, transfer characteristics or color primaries.
6713 Input video needs to have an even size.
6714
6715 The filter accepts the following options:
6716
6717 @table @option
6718 @anchor{all}
6719 @item all
6720 Specify all color properties at once.
6721
6722 The accepted values are:
6723 @table @samp
6724 @item bt470m
6725 BT.470M
6726
6727 @item bt470bg
6728 BT.470BG
6729
6730 @item bt601-6-525
6731 BT.601-6 525
6732
6733 @item bt601-6-625
6734 BT.601-6 625
6735
6736 @item bt709
6737 BT.709
6738
6739 @item smpte170m
6740 SMPTE-170M
6741
6742 @item smpte240m
6743 SMPTE-240M
6744
6745 @item bt2020
6746 BT.2020
6747
6748 @end table
6749
6750 @anchor{space}
6751 @item space
6752 Specify output colorspace.
6753
6754 The accepted values are:
6755 @table @samp
6756 @item bt709
6757 BT.709
6758
6759 @item fcc
6760 FCC
6761
6762 @item bt470bg
6763 BT.470BG or BT.601-6 625
6764
6765 @item smpte170m
6766 SMPTE-170M or BT.601-6 525
6767
6768 @item smpte240m
6769 SMPTE-240M
6770
6771 @item ycgco
6772 YCgCo
6773
6774 @item bt2020ncl
6775 BT.2020 with non-constant luminance
6776
6777 @end table
6778
6779 @anchor{trc}
6780 @item trc
6781 Specify output transfer characteristics.
6782
6783 The accepted values are:
6784 @table @samp
6785 @item bt709
6786 BT.709
6787
6788 @item bt470m
6789 BT.470M
6790
6791 @item bt470bg
6792 BT.470BG
6793
6794 @item gamma22
6795 Constant gamma of 2.2
6796
6797 @item gamma28
6798 Constant gamma of 2.8
6799
6800 @item smpte170m
6801 SMPTE-170M, BT.601-6 625 or BT.601-6 525
6802
6803 @item smpte240m
6804 SMPTE-240M
6805
6806 @item srgb
6807 SRGB
6808
6809 @item iec61966-2-1
6810 iec61966-2-1
6811
6812 @item iec61966-2-4
6813 iec61966-2-4
6814
6815 @item xvycc
6816 xvycc
6817
6818 @item bt2020-10
6819 BT.2020 for 10-bits content
6820
6821 @item bt2020-12
6822 BT.2020 for 12-bits content
6823
6824 @end table
6825
6826 @anchor{primaries}
6827 @item primaries
6828 Specify output color primaries.
6829
6830 The accepted values are:
6831 @table @samp
6832 @item bt709
6833 BT.709
6834
6835 @item bt470m
6836 BT.470M
6837
6838 @item bt470bg
6839 BT.470BG or BT.601-6 625
6840
6841 @item smpte170m
6842 SMPTE-170M or BT.601-6 525
6843
6844 @item smpte240m
6845 SMPTE-240M
6846
6847 @item film
6848 film
6849
6850 @item smpte431
6851 SMPTE-431
6852
6853 @item smpte432
6854 SMPTE-432
6855
6856 @item bt2020
6857 BT.2020
6858
6859 @item jedec-p22
6860 JEDEC P22 phosphors
6861
6862 @end table
6863
6864 @anchor{range}
6865 @item range
6866 Specify output color range.
6867
6868 The accepted values are:
6869 @table @samp
6870 @item tv
6871 TV (restricted) range
6872
6873 @item mpeg
6874 MPEG (restricted) range
6875
6876 @item pc
6877 PC (full) range
6878
6879 @item jpeg
6880 JPEG (full) range
6881
6882 @end table
6883
6884 @item format
6885 Specify output color format.
6886
6887 The accepted values are:
6888 @table @samp
6889 @item yuv420p
6890 YUV 4:2:0 planar 8-bits
6891
6892 @item yuv420p10
6893 YUV 4:2:0 planar 10-bits
6894
6895 @item yuv420p12
6896 YUV 4:2:0 planar 12-bits
6897
6898 @item yuv422p
6899 YUV 4:2:2 planar 8-bits
6900
6901 @item yuv422p10
6902 YUV 4:2:2 planar 10-bits
6903
6904 @item yuv422p12
6905 YUV 4:2:2 planar 12-bits
6906
6907 @item yuv444p
6908 YUV 4:4:4 planar 8-bits
6909
6910 @item yuv444p10
6911 YUV 4:4:4 planar 10-bits
6912
6913 @item yuv444p12
6914 YUV 4:4:4 planar 12-bits
6915
6916 @end table
6917
6918 @item fast
6919 Do a fast conversion, which skips gamma/primary correction. This will take
6920 significantly less CPU, but will be mathematically incorrect. To get output
6921 compatible with that produced by the colormatrix filter, use fast=1.
6922
6923 @item dither
6924 Specify dithering mode.
6925
6926 The accepted values are:
6927 @table @samp
6928 @item none
6929 No dithering
6930
6931 @item fsb
6932 Floyd-Steinberg dithering
6933 @end table
6934
6935 @item wpadapt
6936 Whitepoint adaptation mode.
6937
6938 The accepted values are:
6939 @table @samp
6940 @item bradford
6941 Bradford whitepoint adaptation
6942
6943 @item vonkries
6944 von Kries whitepoint adaptation
6945
6946 @item identity
6947 identity whitepoint adaptation (i.e. no whitepoint adaptation)
6948 @end table
6949
6950 @item iall
6951 Override all input properties at once. Same accepted values as @ref{all}.
6952
6953 @item ispace
6954 Override input colorspace. Same accepted values as @ref{space}.
6955
6956 @item iprimaries
6957 Override input color primaries. Same accepted values as @ref{primaries}.
6958
6959 @item itrc
6960 Override input transfer characteristics. Same accepted values as @ref{trc}.
6961
6962 @item irange
6963 Override input color range. Same accepted values as @ref{range}.
6964
6965 @end table
6966
6967 The filter converts the transfer characteristics, color space and color
6968 primaries to the specified user values. The output value, if not specified,
6969 is set to a default value based on the "all" property. If that property is
6970 also not specified, the filter will log an error. The output color range and
6971 format default to the same value as the input color range and format. The
6972 input transfer characteristics, color space, color primaries and color range
6973 should be set on the input data. If any of these are missing, the filter will
6974 log an error and no conversion will take place.
6975
6976 For example to convert the input to SMPTE-240M, use the command:
6977 @example
6978 colorspace=smpte240m
6979 @end example
6980
6981 @section convolution
6982
6983 Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
6984
6985 The filter accepts the following options:
6986
6987 @table @option
6988 @item 0m
6989 @item 1m
6990 @item 2m
6991 @item 3m
6992 Set matrix for each plane.
6993 Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
6994 and from 1 to 49 odd number of signed integers in @var{row} mode.
6995
6996 @item 0rdiv
6997 @item 1rdiv
6998 @item 2rdiv
6999 @item 3rdiv
7000 Set multiplier for calculated value for each plane.
7001 If unset or 0, it will be sum of all matrix elements.
7002
7003 @item 0bias
7004 @item 1bias
7005 @item 2bias
7006 @item 3bias
7007 Set bias for each plane. This value is added to the result of the multiplication.
7008 Useful for making the overall image brighter or darker. Default is 0.0.
7009
7010 @item 0mode
7011 @item 1mode
7012 @item 2mode
7013 @item 3mode
7014 Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
7015 Default is @var{square}.
7016 @end table
7017
7018 @subsection Examples
7019
7020 @itemize
7021 @item
7022 Apply sharpen:
7023 @example
7024 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"
7025 @end example
7026
7027 @item
7028 Apply blur:
7029 @example
7030 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"
7031 @end example
7032
7033 @item
7034 Apply edge enhance:
7035 @example
7036 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"
7037 @end example
7038
7039 @item
7040 Apply edge detect:
7041 @example
7042 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"
7043 @end example
7044
7045 @item
7046 Apply laplacian edge detector which includes diagonals:
7047 @example
7048 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"
7049 @end example
7050
7051 @item
7052 Apply emboss:
7053 @example
7054 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"
7055 @end example
7056 @end itemize
7057
7058 @section convolve
7059
7060 Apply 2D convolution of video stream in frequency domain using second stream
7061 as impulse.
7062
7063 The filter accepts the following options:
7064
7065 @table @option
7066 @item planes
7067 Set which planes to process.
7068
7069 @item impulse
7070 Set which impulse video frames will be processed, can be @var{first}
7071 or @var{all}. Default is @var{all}.
7072 @end table
7073
7074 The @code{convolve} filter also supports the @ref{framesync} options.
7075
7076 @section copy
7077
7078 Copy the input video source unchanged to the output. This is mainly useful for
7079 testing purposes.
7080
7081 @anchor{coreimage}
7082 @section coreimage
7083 Video filtering on GPU using Apple's CoreImage API on OSX.
7084
7085 Hardware acceleration is based on an OpenGL context. Usually, this means it is
7086 processed by video hardware. However, software-based OpenGL implementations
7087 exist which means there is no guarantee for hardware processing. It depends on
7088 the respective OSX.
7089
7090 There are many filters and image generators provided by Apple that come with a
7091 large variety of options. The filter has to be referenced by its name along
7092 with its options.
7093
7094 The coreimage filter accepts the following options:
7095 @table @option
7096 @item list_filters
7097 List all available filters and generators along with all their respective
7098 options as well as possible minimum and maximum values along with the default
7099 values.
7100 @example
7101 list_filters=true
7102 @end example
7103
7104 @item filter
7105 Specify all filters by their respective name and options.
7106 Use @var{list_filters} to determine all valid filter names and options.
7107 Numerical options are specified by a float value and are automatically clamped
7108 to their respective value range.  Vector and color options have to be specified
7109 by a list of space separated float values. Character escaping has to be done.
7110 A special option name @code{default} is available to use default options for a
7111 filter.
7112
7113 It is required to specify either @code{default} or at least one of the filter options.
7114 All omitted options are used with their default values.
7115 The syntax of the filter string is as follows:
7116 @example
7117 filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
7118 @end example
7119
7120 @item output_rect
7121 Specify a rectangle where the output of the filter chain is copied into the
7122 input image. It is given by a list of space separated float values:
7123 @example
7124 output_rect=x\ y\ width\ height
7125 @end example
7126 If not given, the output rectangle equals the dimensions of the input image.
7127 The output rectangle is automatically cropped at the borders of the input
7128 image. Negative values are valid for each component.
7129 @example
7130 output_rect=25\ 25\ 100\ 100
7131 @end example
7132 @end table
7133
7134 Several filters can be chained for successive processing without GPU-HOST
7135 transfers allowing for fast processing of complex filter chains.
7136 Currently, only filters with zero (generators) or exactly one (filters) input
7137 image and one output image are supported. Also, transition filters are not yet
7138 usable as intended.
7139
7140 Some filters generate output images with additional padding depending on the
7141 respective filter kernel. The padding is automatically removed to ensure the
7142 filter output has the same size as the input image.
7143
7144 For image generators, the size of the output image is determined by the
7145 previous output image of the filter chain or the input image of the whole
7146 filterchain, respectively. The generators do not use the pixel information of
7147 this image to generate their output. However, the generated output is
7148 blended onto this image, resulting in partial or complete coverage of the
7149 output image.
7150
7151 The @ref{coreimagesrc} video source can be used for generating input images
7152 which are directly fed into the filter chain. By using it, providing input
7153 images by another video source or an input video is not required.
7154
7155 @subsection Examples
7156
7157 @itemize
7158
7159 @item
7160 List all filters available:
7161 @example
7162 coreimage=list_filters=true
7163 @end example
7164
7165 @item
7166 Use the CIBoxBlur filter with default options to blur an image:
7167 @example
7168 coreimage=filter=CIBoxBlur@@default
7169 @end example
7170
7171 @item
7172 Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
7173 its center at 100x100 and a radius of 50 pixels:
7174 @example
7175 coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
7176 @end example
7177
7178 @item
7179 Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
7180 given as complete and escaped command-line for Apple's standard bash shell:
7181 @example
7182 ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
7183 @end example
7184 @end itemize
7185
7186 @section crop
7187
7188 Crop the input video to given dimensions.
7189
7190 It accepts the following parameters:
7191
7192 @table @option
7193 @item w, out_w
7194 The width of the output video. It defaults to @code{iw}.
7195 This expression is evaluated only once during the filter
7196 configuration, or when the @samp{w} or @samp{out_w} command is sent.
7197
7198 @item h, out_h
7199 The height of the output video. It defaults to @code{ih}.
7200 This expression is evaluated only once during the filter
7201 configuration, or when the @samp{h} or @samp{out_h} command is sent.
7202
7203 @item x
7204 The horizontal position, in the input video, of the left edge of the output
7205 video. It defaults to @code{(in_w-out_w)/2}.
7206 This expression is evaluated per-frame.
7207
7208 @item y
7209 The vertical position, in the input video, of the top edge of the output video.
7210 It defaults to @code{(in_h-out_h)/2}.
7211 This expression is evaluated per-frame.
7212
7213 @item keep_aspect
7214 If set to 1 will force the output display aspect ratio
7215 to be the same of the input, by changing the output sample aspect
7216 ratio. It defaults to 0.
7217
7218 @item exact
7219 Enable exact cropping. If enabled, subsampled videos will be cropped at exact
7220 width/height/x/y as specified and will not be rounded to nearest smaller value.
7221 It defaults to 0.
7222 @end table
7223
7224 The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
7225 expressions containing the following constants:
7226
7227 @table @option
7228 @item x
7229 @item y
7230 The computed values for @var{x} and @var{y}. They are evaluated for
7231 each new frame.
7232
7233 @item in_w
7234 @item in_h
7235 The input width and height.
7236
7237 @item iw
7238 @item ih
7239 These are the same as @var{in_w} and @var{in_h}.
7240
7241 @item out_w
7242 @item out_h
7243 The output (cropped) width and height.
7244
7245 @item ow
7246 @item oh
7247 These are the same as @var{out_w} and @var{out_h}.
7248
7249 @item a
7250 same as @var{iw} / @var{ih}
7251
7252 @item sar
7253 input sample aspect ratio
7254
7255 @item dar
7256 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
7257
7258 @item hsub
7259 @item vsub
7260 horizontal and vertical chroma subsample values. For example for the
7261 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
7262
7263 @item n
7264 The number of the input frame, starting from 0.
7265
7266 @item pos
7267 the position in the file of the input frame, NAN if unknown
7268
7269 @item t
7270 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
7271
7272 @end table
7273
7274 The expression for @var{out_w} may depend on the value of @var{out_h},
7275 and the expression for @var{out_h} may depend on @var{out_w}, but they
7276 cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
7277 evaluated after @var{out_w} and @var{out_h}.
7278
7279 The @var{x} and @var{y} parameters specify the expressions for the
7280 position of the top-left corner of the output (non-cropped) area. They
7281 are evaluated for each frame. If the evaluated value is not valid, it
7282 is approximated to the nearest valid value.
7283
7284 The expression for @var{x} may depend on @var{y}, and the expression
7285 for @var{y} may depend on @var{x}.
7286
7287 @subsection Examples
7288
7289 @itemize
7290 @item
7291 Crop area with size 100x100 at position (12,34).
7292 @example
7293 crop=100:100:12:34
7294 @end example
7295
7296 Using named options, the example above becomes:
7297 @example
7298 crop=w=100:h=100:x=12:y=34
7299 @end example
7300
7301 @item
7302 Crop the central input area with size 100x100:
7303 @example
7304 crop=100:100
7305 @end example
7306
7307 @item
7308 Crop the central input area with size 2/3 of the input video:
7309 @example
7310 crop=2/3*in_w:2/3*in_h
7311 @end example
7312
7313 @item
7314 Crop the input video central square:
7315 @example
7316 crop=out_w=in_h
7317 crop=in_h
7318 @end example
7319
7320 @item
7321 Delimit the rectangle with the top-left corner placed at position
7322 100:100 and the right-bottom corner corresponding to the right-bottom
7323 corner of the input image.
7324 @example
7325 crop=in_w-100:in_h-100:100:100
7326 @end example
7327
7328 @item
7329 Crop 10 pixels from the left and right borders, and 20 pixels from
7330 the top and bottom borders
7331 @example
7332 crop=in_w-2*10:in_h-2*20
7333 @end example
7334
7335 @item
7336 Keep only the bottom right quarter of the input image:
7337 @example
7338 crop=in_w/2:in_h/2:in_w/2:in_h/2
7339 @end example
7340
7341 @item
7342 Crop height for getting Greek harmony:
7343 @example
7344 crop=in_w:1/PHI*in_w
7345 @end example
7346
7347 @item
7348 Apply trembling effect:
7349 @example
7350 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)
7351 @end example
7352
7353 @item
7354 Apply erratic camera effect depending on timestamp:
7355 @example
7356 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)"
7357 @end example
7358
7359 @item
7360 Set x depending on the value of y:
7361 @example
7362 crop=in_w/2:in_h/2:y:10+10*sin(n/10)
7363 @end example
7364 @end itemize
7365
7366 @subsection Commands
7367
7368 This filter supports the following commands:
7369 @table @option
7370 @item w, out_w
7371 @item h, out_h
7372 @item x
7373 @item y
7374 Set width/height of the output video and the horizontal/vertical position
7375 in the input video.
7376 The command accepts the same syntax of the corresponding option.
7377
7378 If the specified expression is not valid, it is kept at its current
7379 value.
7380 @end table
7381
7382 @section cropdetect
7383
7384 Auto-detect the crop size.
7385
7386 It calculates the necessary cropping parameters and prints the
7387 recommended parameters via the logging system. The detected dimensions
7388 correspond to the non-black area of the input video.
7389
7390 It accepts the following parameters:
7391
7392 @table @option
7393
7394 @item limit
7395 Set higher black value threshold, which can be optionally specified
7396 from nothing (0) to everything (255 for 8-bit based formats). An intensity
7397 value greater to the set value is considered non-black. It defaults to 24.
7398 You can also specify a value between 0.0 and 1.0 which will be scaled depending
7399 on the bitdepth of the pixel format.
7400
7401 @item round
7402 The value which the width/height should be divisible by. It defaults to
7403 16. The offset is automatically adjusted to center the video. Use 2 to
7404 get only even dimensions (needed for 4:2:2 video). 16 is best when
7405 encoding to most video codecs.
7406
7407 @item reset_count, reset
7408 Set the counter that determines after how many frames cropdetect will
7409 reset the previously detected largest video area and start over to
7410 detect the current optimal crop area. Default value is 0.
7411
7412 This can be useful when channel logos distort the video area. 0
7413 indicates 'never reset', and returns the largest area encountered during
7414 playback.
7415 @end table
7416
7417 @anchor{cue}
7418 @section cue
7419
7420 Delay video filtering until a given wallclock timestamp. The filter first
7421 passes on @option{preroll} amount of frames, then it buffers at most
7422 @option{buffer} amount of frames and waits for the cue. After reaching the cue
7423 it forwards the buffered frames and also any subsequent frames coming in its
7424 input.
7425
7426 The filter can be used synchronize the output of multiple ffmpeg processes for
7427 realtime output devices like decklink. By putting the delay in the filtering
7428 chain and pre-buffering frames the process can pass on data to output almost
7429 immediately after the target wallclock timestamp is reached.
7430
7431 Perfect frame accuracy cannot be guaranteed, but the result is good enough for
7432 some use cases.
7433
7434 @table @option
7435
7436 @item cue
7437 The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
7438
7439 @item preroll
7440 The duration of content to pass on as preroll expressed in seconds. Default is 0.
7441
7442 @item buffer
7443 The maximum duration of content to buffer before waiting for the cue expressed
7444 in seconds. Default is 0.
7445
7446 @end table
7447
7448 @anchor{curves}
7449 @section curves
7450
7451 Apply color adjustments using curves.
7452
7453 This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
7454 component (red, green and blue) has its values defined by @var{N} key points
7455 tied from each other using a smooth curve. The x-axis represents the pixel
7456 values from the input frame, and the y-axis the new pixel values to be set for
7457 the output frame.
7458
7459 By default, a component curve is defined by the two points @var{(0;0)} and
7460 @var{(1;1)}. This creates a straight line where each original pixel value is
7461 "adjusted" to its own value, which means no change to the image.
7462
7463 The filter allows you to redefine these two points and add some more. A new
7464 curve (using a natural cubic spline interpolation) will be define to pass
7465 smoothly through all these new coordinates. The new defined points needs to be
7466 strictly increasing over the x-axis, and their @var{x} and @var{y} values must
7467 be in the @var{[0;1]} interval.  If the computed curves happened to go outside
7468 the vector spaces, the values will be clipped accordingly.
7469
7470 The filter accepts the following options:
7471
7472 @table @option
7473 @item preset
7474 Select one of the available color presets. This option can be used in addition
7475 to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
7476 options takes priority on the preset values.
7477 Available presets are:
7478 @table @samp
7479 @item none
7480 @item color_negative
7481 @item cross_process
7482 @item darker
7483 @item increase_contrast
7484 @item lighter
7485 @item linear_contrast
7486 @item medium_contrast
7487 @item negative
7488 @item strong_contrast
7489 @item vintage
7490 @end table
7491 Default is @code{none}.
7492 @item master, m
7493 Set the master key points. These points will define a second pass mapping. It
7494 is sometimes called a "luminance" or "value" mapping. It can be used with
7495 @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
7496 post-processing LUT.
7497 @item red, r
7498 Set the key points for the red component.
7499 @item green, g
7500 Set the key points for the green component.
7501 @item blue, b
7502 Set the key points for the blue component.
7503 @item all
7504 Set the key points for all components (not including master).
7505 Can be used in addition to the other key points component
7506 options. In this case, the unset component(s) will fallback on this
7507 @option{all} setting.
7508 @item psfile
7509 Specify a Photoshop curves file (@code{.acv}) to import the settings from.
7510 @item plot
7511 Save Gnuplot script of the curves in specified file.
7512 @end table
7513
7514 To avoid some filtergraph syntax conflicts, each key points list need to be
7515 defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
7516
7517 @subsection Examples
7518
7519 @itemize
7520 @item
7521 Increase slightly the middle level of blue:
7522 @example
7523 curves=blue='0/0 0.5/0.58 1/1'
7524 @end example
7525
7526 @item
7527 Vintage effect:
7528 @example
7529 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'
7530 @end example
7531 Here we obtain the following coordinates for each components:
7532 @table @var
7533 @item red
7534 @code{(0;0.11) (0.42;0.51) (1;0.95)}
7535 @item green
7536 @code{(0;0) (0.50;0.48) (1;1)}
7537 @item blue
7538 @code{(0;0.22) (0.49;0.44) (1;0.80)}
7539 @end table
7540
7541 @item
7542 The previous example can also be achieved with the associated built-in preset:
7543 @example
7544 curves=preset=vintage
7545 @end example
7546
7547 @item
7548 Or simply:
7549 @example
7550 curves=vintage
7551 @end example
7552
7553 @item
7554 Use a Photoshop preset and redefine the points of the green component:
7555 @example
7556 curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
7557 @end example
7558
7559 @item
7560 Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
7561 and @command{gnuplot}:
7562 @example
7563 ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
7564 gnuplot -p /tmp/curves.plt
7565 @end example
7566 @end itemize
7567
7568 @section datascope
7569
7570 Video data analysis filter.
7571
7572 This filter shows hexadecimal pixel values of part of video.
7573
7574 The filter accepts the following options:
7575
7576 @table @option
7577 @item size, s
7578 Set output video size.
7579
7580 @item x
7581 Set x offset from where to pick pixels.
7582
7583 @item y
7584 Set y offset from where to pick pixels.
7585
7586 @item mode
7587 Set scope mode, can be one of the following:
7588 @table @samp
7589 @item mono
7590 Draw hexadecimal pixel values with white color on black background.
7591
7592 @item color
7593 Draw hexadecimal pixel values with input video pixel color on black
7594 background.
7595
7596 @item color2
7597 Draw hexadecimal pixel values on color background picked from input video,
7598 the text color is picked in such way so its always visible.
7599 @end table
7600
7601 @item axis
7602 Draw rows and columns numbers on left and top of video.
7603
7604 @item opacity
7605 Set background opacity.
7606 @end table
7607
7608 @section dctdnoiz
7609
7610 Denoise frames using 2D DCT (frequency domain filtering).
7611
7612 This filter is not designed for real time.
7613
7614 The filter accepts the following options:
7615
7616 @table @option
7617 @item sigma, s
7618 Set the noise sigma constant.
7619
7620 This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
7621 coefficient (absolute value) below this threshold with be dropped.
7622
7623 If you need a more advanced filtering, see @option{expr}.
7624
7625 Default is @code{0}.
7626
7627 @item overlap
7628 Set number overlapping pixels for each block. Since the filter can be slow, you
7629 may want to reduce this value, at the cost of a less effective filter and the
7630 risk of various artefacts.
7631
7632 If the overlapping value doesn't permit processing the whole input width or
7633 height, a warning will be displayed and according borders won't be denoised.
7634
7635 Default value is @var{blocksize}-1, which is the best possible setting.
7636
7637 @item expr, e
7638 Set the coefficient factor expression.
7639
7640 For each coefficient of a DCT block, this expression will be evaluated as a
7641 multiplier value for the coefficient.
7642
7643 If this is option is set, the @option{sigma} option will be ignored.
7644
7645 The absolute value of the coefficient can be accessed through the @var{c}
7646 variable.
7647
7648 @item n
7649 Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
7650 @var{blocksize}, which is the width and height of the processed blocks.
7651
7652 The default value is @var{3} (8x8) and can be raised to @var{4} for a
7653 @var{blocksize} of 16x16. Note that changing this setting has huge consequences
7654 on the speed processing. Also, a larger block size does not necessarily means a
7655 better de-noising.
7656 @end table
7657
7658 @subsection Examples
7659
7660 Apply a denoise with a @option{sigma} of @code{4.5}:
7661 @example
7662 dctdnoiz=4.5
7663 @end example
7664
7665 The same operation can be achieved using the expression system:
7666 @example
7667 dctdnoiz=e='gte(c, 4.5*3)'
7668 @end example
7669
7670 Violent denoise using a block size of @code{16x16}:
7671 @example
7672 dctdnoiz=15:n=4
7673 @end example
7674
7675 @section deband
7676
7677 Remove banding artifacts from input video.
7678 It works by replacing banded pixels with average value of referenced pixels.
7679
7680 The filter accepts the following options:
7681
7682 @table @option
7683 @item 1thr
7684 @item 2thr
7685 @item 3thr
7686 @item 4thr
7687 Set banding detection threshold for each plane. Default is 0.02.
7688 Valid range is 0.00003 to 0.5.
7689 If difference between current pixel and reference pixel is less than threshold,
7690 it will be considered as banded.
7691
7692 @item range, r
7693 Banding detection range in pixels. Default is 16. If positive, random number
7694 in range 0 to set value will be used. If negative, exact absolute value
7695 will be used.
7696 The range defines square of four pixels around current pixel.
7697
7698 @item direction, d
7699 Set direction in radians from which four pixel will be compared. If positive,
7700 random direction from 0 to set direction will be picked. If negative, exact of
7701 absolute value will be picked. For example direction 0, -PI or -2*PI radians
7702 will pick only pixels on same row and -PI/2 will pick only pixels on same
7703 column.
7704
7705 @item blur, b
7706 If enabled, current pixel is compared with average value of all four
7707 surrounding pixels. The default is enabled. If disabled current pixel is
7708 compared with all four surrounding pixels. The pixel is considered banded
7709 if only all four differences with surrounding pixels are less than threshold.
7710
7711 @item coupling, c
7712 If enabled, current pixel is changed if and only if all pixel components are banded,
7713 e.g. banding detection threshold is triggered for all color components.
7714 The default is disabled.
7715 @end table
7716
7717 @section deblock
7718
7719 Remove blocking artifacts from input video.
7720
7721 The filter accepts the following options:
7722
7723 @table @option
7724 @item filter
7725 Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
7726 This controls what kind of deblocking is applied.
7727
7728 @item block
7729 Set size of block, allowed range is from 4 to 512. Default is @var{8}.
7730
7731 @item alpha
7732 @item beta
7733 @item gamma
7734 @item delta
7735 Set blocking detection thresholds. Allowed range is 0 to 1.
7736 Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
7737 Using higher threshold gives more deblocking strength.
7738 Setting @var{alpha} controls threshold detection at exact edge of block.
7739 Remaining options controls threshold detection near the edge. Each one for
7740 below/above or left/right. Setting any of those to @var{0} disables
7741 deblocking.
7742
7743 @item planes
7744 Set planes to filter. Default is to filter all available planes.
7745 @end table
7746
7747 @subsection Examples
7748
7749 @itemize
7750 @item
7751 Deblock using weak filter and block size of 4 pixels.
7752 @example
7753 deblock=filter=weak:block=4
7754 @end example
7755
7756 @item
7757 Deblock using strong filter, block size of 4 pixels and custom thresholds for
7758 deblocking more edges.
7759 @example
7760 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
7761 @end example
7762
7763 @item
7764 Similar as above, but filter only first plane.
7765 @example
7766 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
7767 @end example
7768
7769 @item
7770 Similar as above, but filter only second and third plane.
7771 @example
7772 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
7773 @end example
7774 @end itemize
7775
7776 @anchor{decimate}
7777 @section decimate
7778
7779 Drop duplicated frames at regular intervals.
7780
7781 The filter accepts the following options:
7782
7783 @table @option
7784 @item cycle
7785 Set the number of frames from which one will be dropped. Setting this to
7786 @var{N} means one frame in every batch of @var{N} frames will be dropped.
7787 Default is @code{5}.
7788
7789 @item dupthresh
7790 Set the threshold for duplicate detection. If the difference metric for a frame
7791 is less than or equal to this value, then it is declared as duplicate. Default
7792 is @code{1.1}
7793
7794 @item scthresh
7795 Set scene change threshold. Default is @code{15}.
7796
7797 @item blockx
7798 @item blocky
7799 Set the size of the x and y-axis blocks used during metric calculations.
7800 Larger blocks give better noise suppression, but also give worse detection of
7801 small movements. Must be a power of two. Default is @code{32}.
7802
7803 @item ppsrc
7804 Mark main input as a pre-processed input and activate clean source input
7805 stream. This allows the input to be pre-processed with various filters to help
7806 the metrics calculation while keeping the frame selection lossless. When set to
7807 @code{1}, the first stream is for the pre-processed input, and the second
7808 stream is the clean source from where the kept frames are chosen. Default is
7809 @code{0}.
7810
7811 @item chroma
7812 Set whether or not chroma is considered in the metric calculations. Default is
7813 @code{1}.
7814 @end table
7815
7816 @section deconvolve
7817
7818 Apply 2D deconvolution of video stream in frequency domain using second stream
7819 as impulse.
7820
7821 The filter accepts the following options:
7822
7823 @table @option
7824 @item planes
7825 Set which planes to process.
7826
7827 @item impulse
7828 Set which impulse video frames will be processed, can be @var{first}
7829 or @var{all}. Default is @var{all}.
7830
7831 @item noise
7832 Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
7833 and height are not same and not power of 2 or if stream prior to convolving
7834 had noise.
7835 @end table
7836
7837 The @code{deconvolve} filter also supports the @ref{framesync} options.
7838
7839 @section dedot
7840
7841 Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
7842
7843 It accepts the following options:
7844
7845 @table @option
7846 @item m
7847 Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
7848 @var{rainbows} for cross-color reduction.
7849
7850 @item lt
7851 Set spatial luma threshold. Lower values increases reduction of cross-luminance.
7852
7853 @item tl
7854 Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
7855
7856 @item tc
7857 Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
7858
7859 @item ct
7860 Set temporal chroma threshold. Lower values increases reduction of cross-color.
7861 @end table
7862
7863 @section deflate
7864
7865 Apply deflate effect to the video.
7866
7867 This filter replaces the pixel by the local(3x3) average by taking into account
7868 only values lower than the pixel.
7869
7870 It accepts the following options:
7871
7872 @table @option
7873 @item threshold0
7874 @item threshold1
7875 @item threshold2
7876 @item threshold3
7877 Limit the maximum change for each plane, default is 65535.
7878 If 0, plane will remain unchanged.
7879 @end table
7880
7881 @section deflicker
7882
7883 Remove temporal frame luminance variations.
7884
7885 It accepts the following options:
7886
7887 @table @option
7888 @item size, s
7889 Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
7890
7891 @item mode, m
7892 Set averaging mode to smooth temporal luminance variations.
7893
7894 Available values are:
7895 @table @samp
7896 @item am
7897 Arithmetic mean
7898
7899 @item gm
7900 Geometric mean
7901
7902 @item hm
7903 Harmonic mean
7904
7905 @item qm
7906 Quadratic mean
7907
7908 @item cm
7909 Cubic mean
7910
7911 @item pm
7912 Power mean
7913
7914 @item median
7915 Median
7916 @end table
7917
7918 @item bypass
7919 Do not actually modify frame. Useful when one only wants metadata.
7920 @end table
7921
7922 @section dejudder
7923
7924 Remove judder produced by partially interlaced telecined content.
7925
7926 Judder can be introduced, for instance, by @ref{pullup} filter. If the original
7927 source was partially telecined content then the output of @code{pullup,dejudder}
7928 will have a variable frame rate. May change the recorded frame rate of the
7929 container. Aside from that change, this filter will not affect constant frame
7930 rate video.
7931
7932 The option available in this filter is:
7933 @table @option
7934
7935 @item cycle
7936 Specify the length of the window over which the judder repeats.
7937
7938 Accepts any integer greater than 1. Useful values are:
7939 @table @samp
7940
7941 @item 4
7942 If the original was telecined from 24 to 30 fps (Film to NTSC).
7943
7944 @item 5
7945 If the original was telecined from 25 to 30 fps (PAL to NTSC).
7946
7947 @item 20
7948 If a mixture of the two.
7949 @end table
7950
7951 The default is @samp{4}.
7952 @end table
7953
7954 @section delogo
7955
7956 Suppress a TV station logo by a simple interpolation of the surrounding
7957 pixels. Just set a rectangle covering the logo and watch it disappear
7958 (and sometimes something even uglier appear - your mileage may vary).
7959
7960 It accepts the following parameters:
7961 @table @option
7962
7963 @item x
7964 @item y
7965 Specify the top left corner coordinates of the logo. They must be
7966 specified.
7967
7968 @item w
7969 @item h
7970 Specify the width and height of the logo to clear. They must be
7971 specified.
7972
7973 @item band, t
7974 Specify the thickness of the fuzzy edge of the rectangle (added to
7975 @var{w} and @var{h}). The default value is 1. This option is
7976 deprecated, setting higher values should no longer be necessary and
7977 is not recommended.
7978
7979 @item show
7980 When set to 1, a green rectangle is drawn on the screen to simplify
7981 finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
7982 The default value is 0.
7983
7984 The rectangle is drawn on the outermost pixels which will be (partly)
7985 replaced with interpolated values. The values of the next pixels
7986 immediately outside this rectangle in each direction will be used to
7987 compute the interpolated pixel values inside the rectangle.
7988
7989 @end table
7990
7991 @subsection Examples
7992
7993 @itemize
7994 @item
7995 Set a rectangle covering the area with top left corner coordinates 0,0
7996 and size 100x77, and a band of size 10:
7997 @example
7998 delogo=x=0:y=0:w=100:h=77:band=10
7999 @end example
8000
8001 @end itemize
8002
8003 @section deshake
8004
8005 Attempt to fix small changes in horizontal and/or vertical shift. This
8006 filter helps remove camera shake from hand-holding a camera, bumping a
8007 tripod, moving on a vehicle, etc.
8008
8009 The filter accepts the following options:
8010
8011 @table @option
8012
8013 @item x
8014 @item y
8015 @item w
8016 @item h
8017 Specify a rectangular area where to limit the search for motion
8018 vectors.
8019 If desired the search for motion vectors can be limited to a
8020 rectangular area of the frame defined by its top left corner, width
8021 and height. These parameters have the same meaning as the drawbox
8022 filter which can be used to visualise the position of the bounding
8023 box.
8024
8025 This is useful when simultaneous movement of subjects within the frame
8026 might be confused for camera motion by the motion vector search.
8027
8028 If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
8029 then the full frame is used. This allows later options to be set
8030 without specifying the bounding box for the motion vector search.
8031
8032 Default - search the whole frame.
8033
8034 @item rx
8035 @item ry
8036 Specify the maximum extent of movement in x and y directions in the
8037 range 0-64 pixels. Default 16.
8038
8039 @item edge
8040 Specify how to generate pixels to fill blanks at the edge of the
8041 frame. Available values are:
8042 @table @samp
8043 @item blank, 0
8044 Fill zeroes at blank locations
8045 @item original, 1
8046 Original image at blank locations
8047 @item clamp, 2
8048 Extruded edge value at blank locations
8049 @item mirror, 3
8050 Mirrored edge at blank locations
8051 @end table
8052 Default value is @samp{mirror}.
8053
8054 @item blocksize
8055 Specify the blocksize to use for motion search. Range 4-128 pixels,
8056 default 8.
8057
8058 @item contrast
8059 Specify the contrast threshold for blocks. Only blocks with more than
8060 the specified contrast (difference between darkest and lightest
8061 pixels) will be considered. Range 1-255, default 125.
8062
8063 @item search
8064 Specify the search strategy. Available values are:
8065 @table @samp
8066 @item exhaustive, 0
8067 Set exhaustive search
8068 @item less, 1
8069 Set less exhaustive search.
8070 @end table
8071 Default value is @samp{exhaustive}.
8072
8073 @item filename
8074 If set then a detailed log of the motion search is written to the
8075 specified file.
8076
8077 @end table
8078
8079 @section despill
8080
8081 Remove unwanted contamination of foreground colors, caused by reflected color of
8082 greenscreen or bluescreen.
8083
8084 This filter accepts the following options:
8085
8086 @table @option
8087 @item type
8088 Set what type of despill to use.
8089
8090 @item mix
8091 Set how spillmap will be generated.
8092
8093 @item expand
8094 Set how much to get rid of still remaining spill.
8095
8096 @item red
8097 Controls amount of red in spill area.
8098
8099 @item green
8100 Controls amount of green in spill area.
8101 Should be -1 for greenscreen.
8102
8103 @item blue
8104 Controls amount of blue in spill area.
8105 Should be -1 for bluescreen.
8106
8107 @item brightness
8108 Controls brightness of spill area, preserving colors.
8109
8110 @item alpha
8111 Modify alpha from generated spillmap.
8112 @end table
8113
8114 @section detelecine
8115
8116 Apply an exact inverse of the telecine operation. It requires a predefined
8117 pattern specified using the pattern option which must be the same as that passed
8118 to the telecine filter.
8119
8120 This filter accepts the following options:
8121
8122 @table @option
8123 @item first_field
8124 @table @samp
8125 @item top, t
8126 top field first
8127 @item bottom, b
8128 bottom field first
8129 The default value is @code{top}.
8130 @end table
8131
8132 @item pattern
8133 A string of numbers representing the pulldown pattern you wish to apply.
8134 The default value is @code{23}.
8135
8136 @item start_frame
8137 A number representing position of the first frame with respect to the telecine
8138 pattern. This is to be used if the stream is cut. The default value is @code{0}.
8139 @end table
8140
8141 @section dilation
8142
8143 Apply dilation effect to the video.
8144
8145 This filter replaces the pixel by the local(3x3) maximum.
8146
8147 It accepts the following options:
8148
8149 @table @option
8150 @item threshold0
8151 @item threshold1
8152 @item threshold2
8153 @item threshold3
8154 Limit the maximum change for each plane, default is 65535.
8155 If 0, plane will remain unchanged.
8156
8157 @item coordinates
8158 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
8159 pixels are used.
8160
8161 Flags to local 3x3 coordinates maps like this:
8162
8163     1 2 3
8164     4   5
8165     6 7 8
8166 @end table
8167
8168 @section displace
8169
8170 Displace pixels as indicated by second and third input stream.
8171
8172 It takes three input streams and outputs one stream, the first input is the
8173 source, and second and third input are displacement maps.
8174
8175 The second input specifies how much to displace pixels along the
8176 x-axis, while the third input specifies how much to displace pixels
8177 along the y-axis.
8178 If one of displacement map streams terminates, last frame from that
8179 displacement map will be used.
8180
8181 Note that once generated, displacements maps can be reused over and over again.
8182
8183 A description of the accepted options follows.
8184
8185 @table @option
8186 @item edge
8187 Set displace behavior for pixels that are out of range.
8188
8189 Available values are:
8190 @table @samp
8191 @item blank
8192 Missing pixels are replaced by black pixels.
8193
8194 @item smear
8195 Adjacent pixels will spread out to replace missing pixels.
8196
8197 @item wrap
8198 Out of range pixels are wrapped so they point to pixels of other side.
8199
8200 @item mirror
8201 Out of range pixels will be replaced with mirrored pixels.
8202 @end table
8203 Default is @samp{smear}.
8204
8205 @end table
8206
8207 @subsection Examples
8208
8209 @itemize
8210 @item
8211 Add ripple effect to rgb input of video size hd720:
8212 @example
8213 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
8214 @end example
8215
8216 @item
8217 Add wave effect to rgb input of video size hd720:
8218 @example
8219 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
8220 @end example
8221 @end itemize
8222
8223 @section drawbox
8224
8225 Draw a colored box on the input image.
8226
8227 It accepts the following parameters:
8228
8229 @table @option
8230 @item x
8231 @item y
8232 The expressions which specify the top left corner coordinates of the box. It defaults to 0.
8233
8234 @item width, w
8235 @item height, h
8236 The expressions which specify the width and height of the box; if 0 they are interpreted as
8237 the input width and height. It defaults to 0.
8238
8239 @item color, c
8240 Specify the color of the box to write. For the general syntax of this option,
8241 check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
8242 value @code{invert} is used, the box edge color is the same as the
8243 video with inverted luma.
8244
8245 @item thickness, t
8246 The expression which sets the thickness of the box edge.
8247 A value of @code{fill} will create a filled box. Default value is @code{3}.
8248
8249 See below for the list of accepted constants.
8250
8251 @item replace
8252 Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
8253 will overwrite the video's color and alpha pixels.
8254 Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
8255 @end table
8256
8257 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
8258 following constants:
8259
8260 @table @option
8261 @item dar
8262 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
8263
8264 @item hsub
8265 @item vsub
8266 horizontal and vertical chroma subsample values. For example for the
8267 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8268
8269 @item in_h, ih
8270 @item in_w, iw
8271 The input width and height.
8272
8273 @item sar
8274 The input sample aspect ratio.
8275
8276 @item x
8277 @item y
8278 The x and y offset coordinates where the box is drawn.
8279
8280 @item w
8281 @item h
8282 The width and height of the drawn box.
8283
8284 @item t
8285 The thickness of the drawn box.
8286
8287 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
8288 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
8289
8290 @end table
8291
8292 @subsection Examples
8293
8294 @itemize
8295 @item
8296 Draw a black box around the edge of the input image:
8297 @example
8298 drawbox
8299 @end example
8300
8301 @item
8302 Draw a box with color red and an opacity of 50%:
8303 @example
8304 drawbox=10:20:200:60:red@@0.5
8305 @end example
8306
8307 The previous example can be specified as:
8308 @example
8309 drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
8310 @end example
8311
8312 @item
8313 Fill the box with pink color:
8314 @example
8315 drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
8316 @end example
8317
8318 @item
8319 Draw a 2-pixel red 2.40:1 mask:
8320 @example
8321 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
8322 @end example
8323 @end itemize
8324
8325 @section drawgrid
8326
8327 Draw a grid on the input image.
8328
8329 It accepts the following parameters:
8330
8331 @table @option
8332 @item x
8333 @item y
8334 The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
8335
8336 @item width, w
8337 @item height, h
8338 The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
8339 input width and height, respectively, minus @code{thickness}, so image gets
8340 framed. Default to 0.
8341
8342 @item color, c
8343 Specify the color of the grid. For the general syntax of this option,
8344 check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
8345 value @code{invert} is used, the grid color is the same as the
8346 video with inverted luma.
8347
8348 @item thickness, t
8349 The expression which sets the thickness of the grid line. Default value is @code{1}.
8350
8351 See below for the list of accepted constants.
8352
8353 @item replace
8354 Applicable if the input has alpha. With @code{1} the pixels of the painted grid
8355 will overwrite the video's color and alpha pixels.
8356 Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
8357 @end table
8358
8359 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
8360 following constants:
8361
8362 @table @option
8363 @item dar
8364 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
8365
8366 @item hsub
8367 @item vsub
8368 horizontal and vertical chroma subsample values. For example for the
8369 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8370
8371 @item in_h, ih
8372 @item in_w, iw
8373 The input grid cell width and height.
8374
8375 @item sar
8376 The input sample aspect ratio.
8377
8378 @item x
8379 @item y
8380 The x and y coordinates of some point of grid intersection (meant to configure offset).
8381
8382 @item w
8383 @item h
8384 The width and height of the drawn cell.
8385
8386 @item t
8387 The thickness of the drawn cell.
8388
8389 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
8390 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
8391
8392 @end table
8393
8394 @subsection Examples
8395
8396 @itemize
8397 @item
8398 Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
8399 @example
8400 drawgrid=width=100:height=100:thickness=2:color=red@@0.5
8401 @end example
8402
8403 @item
8404 Draw a white 3x3 grid with an opacity of 50%:
8405 @example
8406 drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
8407 @end example
8408 @end itemize
8409
8410 @anchor{drawtext}
8411 @section drawtext
8412
8413 Draw a text string or text from a specified file on top of a video, using the
8414 libfreetype library.
8415
8416 To enable compilation of this filter, you need to configure FFmpeg with
8417 @code{--enable-libfreetype}.
8418 To enable default font fallback and the @var{font} option you need to
8419 configure FFmpeg with @code{--enable-libfontconfig}.
8420 To enable the @var{text_shaping} option, you need to configure FFmpeg with
8421 @code{--enable-libfribidi}.
8422
8423 @subsection Syntax
8424
8425 It accepts the following parameters:
8426
8427 @table @option
8428
8429 @item box
8430 Used to draw a box around text using the background color.
8431 The value must be either 1 (enable) or 0 (disable).
8432 The default value of @var{box} is 0.
8433
8434 @item boxborderw
8435 Set the width of the border to be drawn around the box using @var{boxcolor}.
8436 The default value of @var{boxborderw} is 0.
8437
8438 @item boxcolor
8439 The color to be used for drawing box around text. For the syntax of this
8440 option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8441
8442 The default value of @var{boxcolor} is "white".
8443
8444 @item line_spacing
8445 Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
8446 The default value of @var{line_spacing} is 0.
8447
8448 @item borderw
8449 Set the width of the border to be drawn around the text using @var{bordercolor}.
8450 The default value of @var{borderw} is 0.
8451
8452 @item bordercolor
8453 Set the color to be used for drawing border around text. For the syntax of this
8454 option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8455
8456 The default value of @var{bordercolor} is "black".
8457
8458 @item expansion
8459 Select how the @var{text} is expanded. Can be either @code{none},
8460 @code{strftime} (deprecated) or
8461 @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
8462 below for details.
8463
8464 @item basetime
8465 Set a start time for the count. Value is in microseconds. Only applied
8466 in the deprecated strftime expansion mode. To emulate in normal expansion
8467 mode use the @code{pts} function, supplying the start time (in seconds)
8468 as the second argument.
8469
8470 @item fix_bounds
8471 If true, check and fix text coords to avoid clipping.
8472
8473 @item fontcolor
8474 The color to be used for drawing fonts. For the syntax of this option, check
8475 the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8476
8477 The default value of @var{fontcolor} is "black".
8478
8479 @item fontcolor_expr
8480 String which is expanded the same way as @var{text} to obtain dynamic
8481 @var{fontcolor} value. By default this option has empty value and is not
8482 processed. When this option is set, it overrides @var{fontcolor} option.
8483
8484 @item font
8485 The font family to be used for drawing text. By default Sans.
8486
8487 @item fontfile
8488 The font file to be used for drawing text. The path must be included.
8489 This parameter is mandatory if the fontconfig support is disabled.
8490
8491 @item alpha
8492 Draw the text applying alpha blending. The value can
8493 be a number between 0.0 and 1.0.
8494 The expression accepts the same variables @var{x, y} as well.
8495 The default value is 1.
8496 Please see @var{fontcolor_expr}.
8497
8498 @item fontsize
8499 The font size to be used for drawing text.
8500 The default value of @var{fontsize} is 16.
8501
8502 @item text_shaping
8503 If set to 1, attempt to shape the text (for example, reverse the order of
8504 right-to-left text and join Arabic characters) before drawing it.
8505 Otherwise, just draw the text exactly as given.
8506 By default 1 (if supported).
8507
8508 @item ft_load_flags
8509 The flags to be used for loading the fonts.
8510
8511 The flags map the corresponding flags supported by libfreetype, and are
8512 a combination of the following values:
8513 @table @var
8514 @item default
8515 @item no_scale
8516 @item no_hinting
8517 @item render
8518 @item no_bitmap
8519 @item vertical_layout
8520 @item force_autohint
8521 @item crop_bitmap
8522 @item pedantic
8523 @item ignore_global_advance_width
8524 @item no_recurse
8525 @item ignore_transform
8526 @item monochrome
8527 @item linear_design
8528 @item no_autohint
8529 @end table
8530
8531 Default value is "default".
8532
8533 For more information consult the documentation for the FT_LOAD_*
8534 libfreetype flags.
8535
8536 @item shadowcolor
8537 The color to be used for drawing a shadow behind the drawn text. For the
8538 syntax of this option, check the @ref{color syntax,,"Color" section in the
8539 ffmpeg-utils manual,ffmpeg-utils}.
8540
8541 The default value of @var{shadowcolor} is "black".
8542
8543 @item shadowx
8544 @item shadowy
8545 The x and y offsets for the text shadow position with respect to the
8546 position of the text. They can be either positive or negative
8547 values. The default value for both is "0".
8548
8549 @item start_number
8550 The starting frame number for the n/frame_num variable. The default value
8551 is "0".
8552
8553 @item tabsize
8554 The size in number of spaces to use for rendering the tab.
8555 Default value is 4.
8556
8557 @item timecode
8558 Set the initial timecode representation in "hh:mm:ss[:;.]ff"
8559 format. It can be used with or without text parameter. @var{timecode_rate}
8560 option must be specified.
8561
8562 @item timecode_rate, rate, r
8563 Set the timecode frame rate (timecode only). Value will be rounded to nearest
8564 integer. Minimum value is "1".
8565 Drop-frame timecode is supported for frame rates 30 & 60.
8566
8567 @item tc24hmax
8568 If set to 1, the output of the timecode option will wrap around at 24 hours.
8569 Default is 0 (disabled).
8570
8571 @item text
8572 The text string to be drawn. The text must be a sequence of UTF-8
8573 encoded characters.
8574 This parameter is mandatory if no file is specified with the parameter
8575 @var{textfile}.
8576
8577 @item textfile
8578 A text file containing text to be drawn. The text must be a sequence
8579 of UTF-8 encoded characters.
8580
8581 This parameter is mandatory if no text string is specified with the
8582 parameter @var{text}.
8583
8584 If both @var{text} and @var{textfile} are specified, an error is thrown.
8585
8586 @item reload
8587 If set to 1, the @var{textfile} will be reloaded before each frame.
8588 Be sure to update it atomically, or it may be read partially, or even fail.
8589
8590 @item x
8591 @item y
8592 The expressions which specify the offsets where text will be drawn
8593 within the video frame. They are relative to the top/left border of the
8594 output image.
8595
8596 The default value of @var{x} and @var{y} is "0".
8597
8598 See below for the list of accepted constants and functions.
8599 @end table
8600
8601 The parameters for @var{x} and @var{y} are expressions containing the
8602 following constants and functions:
8603
8604 @table @option
8605 @item dar
8606 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
8607
8608 @item hsub
8609 @item vsub
8610 horizontal and vertical chroma subsample values. For example for the
8611 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8612
8613 @item line_h, lh
8614 the height of each text line
8615
8616 @item main_h, h, H
8617 the input height
8618
8619 @item main_w, w, W
8620 the input width
8621
8622 @item max_glyph_a, ascent
8623 the maximum distance from the baseline to the highest/upper grid
8624 coordinate used to place a glyph outline point, for all the rendered
8625 glyphs.
8626 It is a positive value, due to the grid's orientation with the Y axis
8627 upwards.
8628
8629 @item max_glyph_d, descent
8630 the maximum distance from the baseline to the lowest grid coordinate
8631 used to place a glyph outline point, for all the rendered glyphs.
8632 This is a negative value, due to the grid's orientation, with the Y axis
8633 upwards.
8634
8635 @item max_glyph_h
8636 maximum glyph height, that is the maximum height for all the glyphs
8637 contained in the rendered text, it is equivalent to @var{ascent} -
8638 @var{descent}.
8639
8640 @item max_glyph_w
8641 maximum glyph width, that is the maximum width for all the glyphs
8642 contained in the rendered text
8643
8644 @item n
8645 the number of input frame, starting from 0
8646
8647 @item rand(min, max)
8648 return a random number included between @var{min} and @var{max}
8649
8650 @item sar
8651 The input sample aspect ratio.
8652
8653 @item t
8654 timestamp expressed in seconds, NAN if the input timestamp is unknown
8655
8656 @item text_h, th
8657 the height of the rendered text
8658
8659 @item text_w, tw
8660 the width of the rendered text
8661
8662 @item x
8663 @item y
8664 the x and y offset coordinates where the text is drawn.
8665
8666 These parameters allow the @var{x} and @var{y} expressions to refer
8667 each other, so you can for example specify @code{y=x/dar}.
8668 @end table
8669
8670 @anchor{drawtext_expansion}
8671 @subsection Text expansion
8672
8673 If @option{expansion} is set to @code{strftime},
8674 the filter recognizes strftime() sequences in the provided text and
8675 expands them accordingly. Check the documentation of strftime(). This
8676 feature is deprecated.
8677
8678 If @option{expansion} is set to @code{none}, the text is printed verbatim.
8679
8680 If @option{expansion} is set to @code{normal} (which is the default),
8681 the following expansion mechanism is used.
8682
8683 The backslash character @samp{\}, followed by any character, always expands to
8684 the second character.
8685
8686 Sequences of the form @code{%@{...@}} are expanded. The text between the
8687 braces is a function name, possibly followed by arguments separated by ':'.
8688 If the arguments contain special characters or delimiters (':' or '@}'),
8689 they should be escaped.
8690
8691 Note that they probably must also be escaped as the value for the
8692 @option{text} option in the filter argument string and as the filter
8693 argument in the filtergraph description, and possibly also for the shell,
8694 that makes up to four levels of escaping; using a text file avoids these
8695 problems.
8696
8697 The following functions are available:
8698
8699 @table @command
8700
8701 @item expr, e
8702 The expression evaluation result.
8703
8704 It must take one argument specifying the expression to be evaluated,
8705 which accepts the same constants and functions as the @var{x} and
8706 @var{y} values. Note that not all constants should be used, for
8707 example the text size is not known when evaluating the expression, so
8708 the constants @var{text_w} and @var{text_h} will have an undefined
8709 value.
8710
8711 @item expr_int_format, eif
8712 Evaluate the expression's value and output as formatted integer.
8713
8714 The first argument is the expression to be evaluated, just as for the @var{expr} function.
8715 The second argument specifies the output format. Allowed values are @samp{x},
8716 @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
8717 @code{printf} function.
8718 The third parameter is optional and sets the number of positions taken by the output.
8719 It can be used to add padding with zeros from the left.
8720
8721 @item gmtime
8722 The time at which the filter is running, expressed in UTC.
8723 It can accept an argument: a strftime() format string.
8724
8725 @item localtime
8726 The time at which the filter is running, expressed in the local time zone.
8727 It can accept an argument: a strftime() format string.
8728
8729 @item metadata
8730 Frame metadata. Takes one or two arguments.
8731
8732 The first argument is mandatory and specifies the metadata key.
8733
8734 The second argument is optional and specifies a default value, used when the
8735 metadata key is not found or empty.
8736
8737 @item n, frame_num
8738 The frame number, starting from 0.
8739
8740 @item pict_type
8741 A 1 character description of the current picture type.
8742
8743 @item pts
8744 The timestamp of the current frame.
8745 It can take up to three arguments.
8746
8747 The first argument is the format of the timestamp; it defaults to @code{flt}
8748 for seconds as a decimal number with microsecond accuracy; @code{hms} stands
8749 for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
8750 @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
8751 @code{localtime} stands for the timestamp of the frame formatted as
8752 local time zone time.
8753
8754 The second argument is an offset added to the timestamp.
8755
8756 If the format is set to @code{hms}, a third argument @code{24HH} may be
8757 supplied to present the hour part of the formatted timestamp in 24h format
8758 (00-23).
8759
8760 If the format is set to @code{localtime} or @code{gmtime},
8761 a third argument may be supplied: a strftime() format string.
8762 By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
8763 @end table
8764
8765 @subsection Examples
8766
8767 @itemize
8768 @item
8769 Draw "Test Text" with font FreeSerif, using the default values for the
8770 optional parameters.
8771
8772 @example
8773 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
8774 @end example
8775
8776 @item
8777 Draw 'Test Text' with font FreeSerif of size 24 at position x=100
8778 and y=50 (counting from the top-left corner of the screen), text is
8779 yellow with a red box around it. Both the text and the box have an
8780 opacity of 20%.
8781
8782 @example
8783 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
8784           x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
8785 @end example
8786
8787 Note that the double quotes are not necessary if spaces are not used
8788 within the parameter list.
8789
8790 @item
8791 Show the text at the center of the video frame:
8792 @example
8793 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
8794 @end example
8795
8796 @item
8797 Show the text at a random position, switching to a new position every 30 seconds:
8798 @example
8799 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)"
8800 @end example
8801
8802 @item
8803 Show a text line sliding from right to left in the last row of the video
8804 frame. The file @file{LONG_LINE} is assumed to contain a single line
8805 with no newlines.
8806 @example
8807 drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
8808 @end example
8809
8810 @item
8811 Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
8812 @example
8813 drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
8814 @end example
8815
8816 @item
8817 Draw a single green letter "g", at the center of the input video.
8818 The glyph baseline is placed at half screen height.
8819 @example
8820 drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
8821 @end example
8822
8823 @item
8824 Show text for 1 second every 3 seconds:
8825 @example
8826 drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
8827 @end example
8828
8829 @item
8830 Use fontconfig to set the font. Note that the colons need to be escaped.
8831 @example
8832 drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
8833 @end example
8834
8835 @item
8836 Print the date of a real-time encoding (see strftime(3)):
8837 @example
8838 drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
8839 @end example
8840
8841 @item
8842 Show text fading in and out (appearing/disappearing):
8843 @example
8844 #!/bin/sh
8845 DS=1.0 # display start
8846 DE=10.0 # display end
8847 FID=1.5 # fade in duration
8848 FOD=5 # fade out duration
8849 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 @}"
8850 @end example
8851
8852 @item
8853 Horizontally align multiple separate texts. Note that @option{max_glyph_a}
8854 and the @option{fontsize} value are included in the @option{y} offset.
8855 @example
8856 drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
8857 drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
8858 @end example
8859
8860 @end itemize
8861
8862 For more information about libfreetype, check:
8863 @url{http://www.freetype.org/}.
8864
8865 For more information about fontconfig, check:
8866 @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
8867
8868 For more information about libfribidi, check:
8869 @url{http://fribidi.org/}.
8870
8871 @section edgedetect
8872
8873 Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
8874
8875 The filter accepts the following options:
8876
8877 @table @option
8878 @item low
8879 @item high
8880 Set low and high threshold values used by the Canny thresholding
8881 algorithm.
8882
8883 The high threshold selects the "strong" edge pixels, which are then
8884 connected through 8-connectivity with the "weak" edge pixels selected
8885 by the low threshold.
8886
8887 @var{low} and @var{high} threshold values must be chosen in the range
8888 [0,1], and @var{low} should be lesser or equal to @var{high}.
8889
8890 Default value for @var{low} is @code{20/255}, and default value for @var{high}
8891 is @code{50/255}.
8892
8893 @item mode
8894 Define the drawing mode.
8895
8896 @table @samp
8897 @item wires
8898 Draw white/gray wires on black background.
8899
8900 @item colormix
8901 Mix the colors to create a paint/cartoon effect.
8902
8903 @item canny
8904 Apply Canny edge detector on all selected planes.
8905 @end table
8906 Default value is @var{wires}.
8907
8908 @item planes
8909 Select planes for filtering. By default all available planes are filtered.
8910 @end table
8911
8912 @subsection Examples
8913
8914 @itemize
8915 @item
8916 Standard edge detection with custom values for the hysteresis thresholding:
8917 @example
8918 edgedetect=low=0.1:high=0.4
8919 @end example
8920
8921 @item
8922 Painting effect without thresholding:
8923 @example
8924 edgedetect=mode=colormix:high=0
8925 @end example
8926 @end itemize
8927
8928 @section eq
8929 Set brightness, contrast, saturation and approximate gamma adjustment.
8930
8931 The filter accepts the following options:
8932
8933 @table @option
8934 @item contrast
8935 Set the contrast expression. The value must be a float value in range
8936 @code{-2.0} to @code{2.0}. The default value is "1".
8937
8938 @item brightness
8939 Set the brightness expression. The value must be a float value in
8940 range @code{-1.0} to @code{1.0}. The default value is "0".
8941
8942 @item saturation
8943 Set the saturation expression. The value must be a float in
8944 range @code{0.0} to @code{3.0}. The default value is "1".
8945
8946 @item gamma
8947 Set the gamma expression. The value must be a float in range
8948 @code{0.1} to @code{10.0}.  The default value is "1".
8949
8950 @item gamma_r
8951 Set the gamma expression for red. The value must be a float in
8952 range @code{0.1} to @code{10.0}. The default value is "1".
8953
8954 @item gamma_g
8955 Set the gamma expression for green. The value must be a float in range
8956 @code{0.1} to @code{10.0}. The default value is "1".
8957
8958 @item gamma_b
8959 Set the gamma expression for blue. The value must be a float in range
8960 @code{0.1} to @code{10.0}. The default value is "1".
8961
8962 @item gamma_weight
8963 Set the gamma weight expression. It can be used to reduce the effect
8964 of a high gamma value on bright image areas, e.g. keep them from
8965 getting overamplified and just plain white. The value must be a float
8966 in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
8967 gamma correction all the way down while @code{1.0} leaves it at its
8968 full strength. Default is "1".
8969
8970 @item eval
8971 Set when the expressions for brightness, contrast, saturation and
8972 gamma expressions are evaluated.
8973
8974 It accepts the following values:
8975 @table @samp
8976 @item init
8977 only evaluate expressions once during the filter initialization or
8978 when a command is processed
8979
8980 @item frame
8981 evaluate expressions for each incoming frame
8982 @end table
8983
8984 Default value is @samp{init}.
8985 @end table
8986
8987 The expressions accept the following parameters:
8988 @table @option
8989 @item n
8990 frame count of the input frame starting from 0
8991
8992 @item pos
8993 byte position of the corresponding packet in the input file, NAN if
8994 unspecified
8995
8996 @item r
8997 frame rate of the input video, NAN if the input frame rate is unknown
8998
8999 @item t
9000 timestamp expressed in seconds, NAN if the input timestamp is unknown
9001 @end table
9002
9003 @subsection Commands
9004 The filter supports the following commands:
9005
9006 @table @option
9007 @item contrast
9008 Set the contrast expression.
9009
9010 @item brightness
9011 Set the brightness expression.
9012
9013 @item saturation
9014 Set the saturation expression.
9015
9016 @item gamma
9017 Set the gamma expression.
9018
9019 @item gamma_r
9020 Set the gamma_r expression.
9021
9022 @item gamma_g
9023 Set gamma_g expression.
9024
9025 @item gamma_b
9026 Set gamma_b expression.
9027
9028 @item gamma_weight
9029 Set gamma_weight expression.
9030
9031 The command accepts the same syntax of the corresponding option.
9032
9033 If the specified expression is not valid, it is kept at its current
9034 value.
9035
9036 @end table
9037
9038 @section erosion
9039
9040 Apply erosion effect to the video.
9041
9042 This filter replaces the pixel by the local(3x3) minimum.
9043
9044 It accepts the following options:
9045
9046 @table @option
9047 @item threshold0
9048 @item threshold1
9049 @item threshold2
9050 @item threshold3
9051 Limit the maximum change for each plane, default is 65535.
9052 If 0, plane will remain unchanged.
9053
9054 @item coordinates
9055 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
9056 pixels are used.
9057
9058 Flags to local 3x3 coordinates maps like this:
9059
9060     1 2 3
9061     4   5
9062     6 7 8
9063 @end table
9064
9065 @section extractplanes
9066
9067 Extract color channel components from input video stream into
9068 separate grayscale video streams.
9069
9070 The filter accepts the following option:
9071
9072 @table @option
9073 @item planes
9074 Set plane(s) to extract.
9075
9076 Available values for planes are:
9077 @table @samp
9078 @item y
9079 @item u
9080 @item v
9081 @item a
9082 @item r
9083 @item g
9084 @item b
9085 @end table
9086
9087 Choosing planes not available in the input will result in an error.
9088 That means you cannot select @code{r}, @code{g}, @code{b} planes
9089 with @code{y}, @code{u}, @code{v} planes at same time.
9090 @end table
9091
9092 @subsection Examples
9093
9094 @itemize
9095 @item
9096 Extract luma, u and v color channel component from input video frame
9097 into 3 grayscale outputs:
9098 @example
9099 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
9100 @end example
9101 @end itemize
9102
9103 @section elbg
9104
9105 Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
9106
9107 For each input image, the filter will compute the optimal mapping from
9108 the input to the output given the codebook length, that is the number
9109 of distinct output colors.
9110
9111 This filter accepts the following options.
9112
9113 @table @option
9114 @item codebook_length, l
9115 Set codebook length. The value must be a positive integer, and
9116 represents the number of distinct output colors. Default value is 256.
9117
9118 @item nb_steps, n
9119 Set the maximum number of iterations to apply for computing the optimal
9120 mapping. The higher the value the better the result and the higher the
9121 computation time. Default value is 1.
9122
9123 @item seed, s
9124 Set a random seed, must be an integer included between 0 and
9125 UINT32_MAX. If not specified, or if explicitly set to -1, the filter
9126 will try to use a good random seed on a best effort basis.
9127
9128 @item pal8
9129 Set pal8 output pixel format. This option does not work with codebook
9130 length greater than 256.
9131 @end table
9132
9133 @section entropy
9134
9135 Measure graylevel entropy in histogram of color channels of video frames.
9136
9137 It accepts the following parameters:
9138
9139 @table @option
9140 @item mode
9141 Can be either @var{normal} or @var{diff}. Default is @var{normal}.
9142
9143 @var{diff} mode measures entropy of histogram delta values, absolute differences
9144 between neighbour histogram values.
9145 @end table
9146
9147 @section fade
9148
9149 Apply a fade-in/out effect to the input video.
9150
9151 It accepts the following parameters:
9152
9153 @table @option
9154 @item type, t
9155 The effect type can be either "in" for a fade-in, or "out" for a fade-out
9156 effect.
9157 Default is @code{in}.
9158
9159 @item start_frame, s
9160 Specify the number of the frame to start applying the fade
9161 effect at. Default is 0.
9162
9163 @item nb_frames, n
9164 The number of frames that the fade effect lasts. At the end of the
9165 fade-in effect, the output video will have the same intensity as the input video.
9166 At the end of the fade-out transition, the output video will be filled with the
9167 selected @option{color}.
9168 Default is 25.
9169
9170 @item alpha
9171 If set to 1, fade only alpha channel, if one exists on the input.
9172 Default value is 0.
9173
9174 @item start_time, st
9175 Specify the timestamp (in seconds) of the frame to start to apply the fade
9176 effect. If both start_frame and start_time are specified, the fade will start at
9177 whichever comes last.  Default is 0.
9178
9179 @item duration, d
9180 The number of seconds for which the fade effect has to last. At the end of the
9181 fade-in effect the output video will have the same intensity as the input video,
9182 at the end of the fade-out transition the output video will be filled with the
9183 selected @option{color}.
9184 If both duration and nb_frames are specified, duration is used. Default is 0
9185 (nb_frames is used by default).
9186
9187 @item color, c
9188 Specify the color of the fade. Default is "black".
9189 @end table
9190
9191 @subsection Examples
9192
9193 @itemize
9194 @item
9195 Fade in the first 30 frames of video:
9196 @example
9197 fade=in:0:30
9198 @end example
9199
9200 The command above is equivalent to:
9201 @example
9202 fade=t=in:s=0:n=30
9203 @end example
9204
9205 @item
9206 Fade out the last 45 frames of a 200-frame video:
9207 @example
9208 fade=out:155:45
9209 fade=type=out:start_frame=155:nb_frames=45
9210 @end example
9211
9212 @item
9213 Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
9214 @example
9215 fade=in:0:25, fade=out:975:25
9216 @end example
9217
9218 @item
9219 Make the first 5 frames yellow, then fade in from frame 5-24:
9220 @example
9221 fade=in:5:20:color=yellow
9222 @end example
9223
9224 @item
9225 Fade in alpha over first 25 frames of video:
9226 @example
9227 fade=in:0:25:alpha=1
9228 @end example
9229
9230 @item
9231 Make the first 5.5 seconds black, then fade in for 0.5 seconds:
9232 @example
9233 fade=t=in:st=5.5:d=0.5
9234 @end example
9235
9236 @end itemize
9237
9238 @section fftfilt
9239 Apply arbitrary expressions to samples in frequency domain
9240
9241 @table @option
9242 @item dc_Y
9243 Adjust the dc value (gain) of the luma plane of the image. The filter
9244 accepts an integer value in range @code{0} to @code{1000}. The default
9245 value is set to @code{0}.
9246
9247 @item dc_U
9248 Adjust the dc value (gain) of the 1st chroma plane of the image. The
9249 filter accepts an integer value in range @code{0} to @code{1000}. The
9250 default value is set to @code{0}.
9251
9252 @item dc_V
9253 Adjust the dc value (gain) of the 2nd chroma plane of the image. The
9254 filter accepts an integer value in range @code{0} to @code{1000}. The
9255 default value is set to @code{0}.
9256
9257 @item weight_Y
9258 Set the frequency domain weight expression for the luma plane.
9259
9260 @item weight_U
9261 Set the frequency domain weight expression for the 1st chroma plane.
9262
9263 @item weight_V
9264 Set the frequency domain weight expression for the 2nd chroma plane.
9265
9266 @item eval
9267 Set when the expressions are evaluated.
9268
9269 It accepts the following values:
9270 @table @samp
9271 @item init
9272 Only evaluate expressions once during the filter initialization.
9273
9274 @item frame
9275 Evaluate expressions for each incoming frame.
9276 @end table
9277
9278 Default value is @samp{init}.
9279
9280 The filter accepts the following variables:
9281 @item X
9282 @item Y
9283 The coordinates of the current sample.
9284
9285 @item W
9286 @item H
9287 The width and height of the image.
9288
9289 @item N
9290 The number of input frame, starting from 0.
9291 @end table
9292
9293 @subsection Examples
9294
9295 @itemize
9296 @item
9297 High-pass:
9298 @example
9299 fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
9300 @end example
9301
9302 @item
9303 Low-pass:
9304 @example
9305 fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
9306 @end example
9307
9308 @item
9309 Sharpen:
9310 @example
9311 fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
9312 @end example
9313
9314 @item
9315 Blur:
9316 @example
9317 fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
9318 @end example
9319
9320 @end itemize
9321
9322 @section fftdnoiz
9323 Denoise frames using 3D FFT (frequency domain filtering).
9324
9325 The filter accepts the following options:
9326
9327 @table @option
9328 @item sigma
9329 Set the noise sigma constant. This sets denoising strength.
9330 Default value is 1. Allowed range is from 0 to 30.
9331 Using very high sigma with low overlap may give blocking artifacts.
9332
9333 @item amount
9334 Set amount of denoising. By default all detected noise is reduced.
9335 Default value is 1. Allowed range is from 0 to 1.
9336
9337 @item block
9338 Set size of block, Default is 4, can be 3, 4, 5 or 6.
9339 Actual size of block in pixels is 2 to power of @var{block}, so by default
9340 block size in pixels is 2^4 which is 16.
9341
9342 @item overlap
9343 Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
9344
9345 @item prev
9346 Set number of previous frames to use for denoising. By default is set to 0.
9347
9348 @item next
9349 Set number of next frames to to use for denoising. By default is set to 0.
9350
9351 @item planes
9352 Set planes which will be filtered, by default are all available filtered
9353 except alpha.
9354 @end table
9355
9356 @section field
9357
9358 Extract a single field from an interlaced image using stride
9359 arithmetic to avoid wasting CPU time. The output frames are marked as
9360 non-interlaced.
9361
9362 The filter accepts the following options:
9363
9364 @table @option
9365 @item type
9366 Specify whether to extract the top (if the value is @code{0} or
9367 @code{top}) or the bottom field (if the value is @code{1} or
9368 @code{bottom}).
9369 @end table
9370
9371 @section fieldhint
9372
9373 Create new frames by copying the top and bottom fields from surrounding frames
9374 supplied as numbers by the hint file.
9375
9376 @table @option
9377 @item hint
9378 Set file containing hints: absolute/relative frame numbers.
9379
9380 There must be one line for each frame in a clip. Each line must contain two
9381 numbers separated by the comma, optionally followed by @code{-} or @code{+}.
9382 Numbers supplied on each line of file can not be out of [N-1,N+1] where N
9383 is current frame number for @code{absolute} mode or out of [-1, 1] range
9384 for @code{relative} mode. First number tells from which frame to pick up top
9385 field and second number tells from which frame to pick up bottom field.
9386
9387 If optionally followed by @code{+} output frame will be marked as interlaced,
9388 else if followed by @code{-} output frame will be marked as progressive, else
9389 it will be marked same as input frame.
9390 If line starts with @code{#} or @code{;} that line is skipped.
9391
9392 @item mode
9393 Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
9394 @end table
9395
9396 Example of first several lines of @code{hint} file for @code{relative} mode:
9397 @example
9398 0,0 - # first frame
9399 1,0 - # second frame, use third's frame top field and second's frame bottom field
9400 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
9401 1,0 -
9402 0,0 -
9403 0,0 -
9404 1,0 -
9405 1,0 -
9406 1,0 -
9407 0,0 -
9408 0,0 -
9409 1,0 -
9410 1,0 -
9411 1,0 -
9412 0,0 -
9413 @end example
9414
9415 @section fieldmatch
9416
9417 Field matching filter for inverse telecine. It is meant to reconstruct the
9418 progressive frames from a telecined stream. The filter does not drop duplicated
9419 frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
9420 followed by a decimation filter such as @ref{decimate} in the filtergraph.
9421
9422 The separation of the field matching and the decimation is notably motivated by
9423 the possibility of inserting a de-interlacing filter fallback between the two.
9424 If the source has mixed telecined and real interlaced content,
9425 @code{fieldmatch} will not be able to match fields for the interlaced parts.
9426 But these remaining combed frames will be marked as interlaced, and thus can be
9427 de-interlaced by a later filter such as @ref{yadif} before decimation.
9428
9429 In addition to the various configuration options, @code{fieldmatch} can take an
9430 optional second stream, activated through the @option{ppsrc} option. If
9431 enabled, the frames reconstruction will be based on the fields and frames from
9432 this second stream. This allows the first input to be pre-processed in order to
9433 help the various algorithms of the filter, while keeping the output lossless
9434 (assuming the fields are matched properly). Typically, a field-aware denoiser,
9435 or brightness/contrast adjustments can help.
9436
9437 Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
9438 and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
9439 which @code{fieldmatch} is based on. While the semantic and usage are very
9440 close, some behaviour and options names can differ.
9441
9442 The @ref{decimate} filter currently only works for constant frame rate input.
9443 If your input has mixed telecined (30fps) and progressive content with a lower
9444 framerate like 24fps use the following filterchain to produce the necessary cfr
9445 stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
9446
9447 The filter accepts the following options:
9448
9449 @table @option
9450 @item order
9451 Specify the assumed field order of the input stream. Available values are:
9452
9453 @table @samp
9454 @item auto
9455 Auto detect parity (use FFmpeg's internal parity value).
9456 @item bff
9457 Assume bottom field first.
9458 @item tff
9459 Assume top field first.
9460 @end table
9461
9462 Note that it is sometimes recommended not to trust the parity announced by the
9463 stream.
9464
9465 Default value is @var{auto}.
9466
9467 @item mode
9468 Set the matching mode or strategy to use. @option{pc} mode is the safest in the
9469 sense that it won't risk creating jerkiness due to duplicate frames when
9470 possible, but if there are bad edits or blended fields it will end up
9471 outputting combed frames when a good match might actually exist. On the other
9472 hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
9473 but will almost always find a good frame if there is one. The other values are
9474 all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
9475 jerkiness and creating duplicate frames versus finding good matches in sections
9476 with bad edits, orphaned fields, blended fields, etc.
9477
9478 More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
9479
9480 Available values are:
9481
9482 @table @samp
9483 @item pc
9484 2-way matching (p/c)
9485 @item pc_n
9486 2-way matching, and trying 3rd match if still combed (p/c + n)
9487 @item pc_u
9488 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
9489 @item pc_n_ub
9490 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
9491 still combed (p/c + n + u/b)
9492 @item pcn
9493 3-way matching (p/c/n)
9494 @item pcn_ub
9495 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
9496 detected as combed (p/c/n + u/b)
9497 @end table
9498
9499 The parenthesis at the end indicate the matches that would be used for that
9500 mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
9501 @var{top}).
9502
9503 In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
9504 the slowest.
9505
9506 Default value is @var{pc_n}.
9507
9508 @item ppsrc
9509 Mark the main input stream as a pre-processed input, and enable the secondary
9510 input stream as the clean source to pick the fields from. See the filter
9511 introduction for more details. It is similar to the @option{clip2} feature from
9512 VFM/TFM.
9513
9514 Default value is @code{0} (disabled).
9515
9516 @item field
9517 Set the field to match from. It is recommended to set this to the same value as
9518 @option{order} unless you experience matching failures with that setting. In
9519 certain circumstances changing the field that is used to match from can have a
9520 large impact on matching performance. Available values are:
9521
9522 @table @samp
9523 @item auto
9524 Automatic (same value as @option{order}).
9525 @item bottom
9526 Match from the bottom field.
9527 @item top
9528 Match from the top field.
9529 @end table
9530
9531 Default value is @var{auto}.
9532
9533 @item mchroma
9534 Set whether or not chroma is included during the match comparisons. In most
9535 cases it is recommended to leave this enabled. You should set this to @code{0}
9536 only if your clip has bad chroma problems such as heavy rainbowing or other
9537 artifacts. Setting this to @code{0} could also be used to speed things up at
9538 the cost of some accuracy.
9539
9540 Default value is @code{1}.
9541
9542 @item y0
9543 @item y1
9544 These define an exclusion band which excludes the lines between @option{y0} and
9545 @option{y1} from being included in the field matching decision. An exclusion
9546 band can be used to ignore subtitles, a logo, or other things that may
9547 interfere with the matching. @option{y0} sets the starting scan line and
9548 @option{y1} sets the ending line; all lines in between @option{y0} and
9549 @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
9550 @option{y0} and @option{y1} to the same value will disable the feature.
9551 @option{y0} and @option{y1} defaults to @code{0}.
9552
9553 @item scthresh
9554 Set the scene change detection threshold as a percentage of maximum change on
9555 the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
9556 detection is only relevant in case @option{combmatch}=@var{sc}.  The range for
9557 @option{scthresh} is @code{[0.0, 100.0]}.
9558
9559 Default value is @code{12.0}.
9560
9561 @item combmatch
9562 When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
9563 account the combed scores of matches when deciding what match to use as the
9564 final match. Available values are:
9565
9566 @table @samp
9567 @item none
9568 No final matching based on combed scores.
9569 @item sc
9570 Combed scores are only used when a scene change is detected.
9571 @item full
9572 Use combed scores all the time.
9573 @end table
9574
9575 Default is @var{sc}.
9576
9577 @item combdbg
9578 Force @code{fieldmatch} to calculate the combed metrics for certain matches and
9579 print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
9580 Available values are:
9581
9582 @table @samp
9583 @item none
9584 No forced calculation.
9585 @item pcn
9586 Force p/c/n calculations.
9587 @item pcnub
9588 Force p/c/n/u/b calculations.
9589 @end table
9590
9591 Default value is @var{none}.
9592
9593 @item cthresh
9594 This is the area combing threshold used for combed frame detection. This
9595 essentially controls how "strong" or "visible" combing must be to be detected.
9596 Larger values mean combing must be more visible and smaller values mean combing
9597 can be less visible or strong and still be detected. Valid settings are from
9598 @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
9599 be detected as combed). This is basically a pixel difference value. A good
9600 range is @code{[8, 12]}.
9601
9602 Default value is @code{9}.
9603
9604 @item chroma
9605 Sets whether or not chroma is considered in the combed frame decision.  Only
9606 disable this if your source has chroma problems (rainbowing, etc.) that are
9607 causing problems for the combed frame detection with chroma enabled. Actually,
9608 using @option{chroma}=@var{0} is usually more reliable, except for the case
9609 where there is chroma only combing in the source.
9610
9611 Default value is @code{0}.
9612
9613 @item blockx
9614 @item blocky
9615 Respectively set the x-axis and y-axis size of the window used during combed
9616 frame detection. This has to do with the size of the area in which
9617 @option{combpel} pixels are required to be detected as combed for a frame to be
9618 declared combed. See the @option{combpel} parameter description for more info.
9619 Possible values are any number that is a power of 2 starting at 4 and going up
9620 to 512.
9621
9622 Default value is @code{16}.
9623
9624 @item combpel
9625 The number of combed pixels inside any of the @option{blocky} by
9626 @option{blockx} size blocks on the frame for the frame to be detected as
9627 combed. While @option{cthresh} controls how "visible" the combing must be, this
9628 setting controls "how much" combing there must be in any localized area (a
9629 window defined by the @option{blockx} and @option{blocky} settings) on the
9630 frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
9631 which point no frames will ever be detected as combed). This setting is known
9632 as @option{MI} in TFM/VFM vocabulary.
9633
9634 Default value is @code{80}.
9635 @end table
9636
9637 @anchor{p/c/n/u/b meaning}
9638 @subsection p/c/n/u/b meaning
9639
9640 @subsubsection p/c/n
9641
9642 We assume the following telecined stream:
9643
9644 @example
9645 Top fields:     1 2 2 3 4
9646 Bottom fields:  1 2 3 4 4
9647 @end example
9648
9649 The numbers correspond to the progressive frame the fields relate to. Here, the
9650 first two frames are progressive, the 3rd and 4th are combed, and so on.
9651
9652 When @code{fieldmatch} is configured to run a matching from bottom
9653 (@option{field}=@var{bottom}) this is how this input stream get transformed:
9654
9655 @example
9656 Input stream:
9657                 T     1 2 2 3 4
9658                 B     1 2 3 4 4   <-- matching reference
9659
9660 Matches:              c c n n c
9661
9662 Output stream:
9663                 T     1 2 3 4 4
9664                 B     1 2 3 4 4
9665 @end example
9666
9667 As a result of the field matching, we can see that some frames get duplicated.
9668 To perform a complete inverse telecine, you need to rely on a decimation filter
9669 after this operation. See for instance the @ref{decimate} filter.
9670
9671 The same operation now matching from top fields (@option{field}=@var{top})
9672 looks like this:
9673
9674 @example
9675 Input stream:
9676                 T     1 2 2 3 4   <-- matching reference
9677                 B     1 2 3 4 4
9678
9679 Matches:              c c p p c
9680
9681 Output stream:
9682                 T     1 2 2 3 4
9683                 B     1 2 2 3 4
9684 @end example
9685
9686 In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
9687 basically, they refer to the frame and field of the opposite parity:
9688
9689 @itemize
9690 @item @var{p} matches the field of the opposite parity in the previous frame
9691 @item @var{c} matches the field of the opposite parity in the current frame
9692 @item @var{n} matches the field of the opposite parity in the next frame
9693 @end itemize
9694
9695 @subsubsection u/b
9696
9697 The @var{u} and @var{b} matching are a bit special in the sense that they match
9698 from the opposite parity flag. In the following examples, we assume that we are
9699 currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
9700 'x' is placed above and below each matched fields.
9701
9702 With bottom matching (@option{field}=@var{bottom}):
9703 @example
9704 Match:           c         p           n          b          u
9705
9706                  x       x               x        x          x
9707   Top          1 2 2     1 2 2       1 2 2      1 2 2      1 2 2
9708   Bottom       1 2 3     1 2 3       1 2 3      1 2 3      1 2 3
9709                  x         x           x        x              x
9710
9711 Output frames:
9712                  2          1          2          2          2
9713                  2          2          2          1          3
9714 @end example
9715
9716 With top matching (@option{field}=@var{top}):
9717 @example
9718 Match:           c         p           n          b          u
9719
9720                  x         x           x        x              x
9721   Top          1 2 2     1 2 2       1 2 2      1 2 2      1 2 2
9722   Bottom       1 2 3     1 2 3       1 2 3      1 2 3      1 2 3
9723                  x       x               x        x          x
9724
9725 Output frames:
9726                  2          2          2          1          2
9727                  2          1          3          2          2
9728 @end example
9729
9730 @subsection Examples
9731
9732 Simple IVTC of a top field first telecined stream:
9733 @example
9734 fieldmatch=order=tff:combmatch=none, decimate
9735 @end example
9736
9737 Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
9738 @example
9739 fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
9740 @end example
9741
9742 @section fieldorder
9743
9744 Transform the field order of the input video.
9745
9746 It accepts the following parameters:
9747
9748 @table @option
9749
9750 @item order
9751 The output field order. Valid values are @var{tff} for top field first or @var{bff}
9752 for bottom field first.
9753 @end table
9754
9755 The default value is @samp{tff}.
9756
9757 The transformation is done by shifting the picture content up or down
9758 by one line, and filling the remaining line with appropriate picture content.
9759 This method is consistent with most broadcast field order converters.
9760
9761 If the input video is not flagged as being interlaced, or it is already
9762 flagged as being of the required output field order, then this filter does
9763 not alter the incoming video.
9764
9765 It is very useful when converting to or from PAL DV material,
9766 which is bottom field first.
9767
9768 For example:
9769 @example
9770 ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
9771 @end example
9772
9773 @section fifo, afifo
9774
9775 Buffer input images and send them when they are requested.
9776
9777 It is mainly useful when auto-inserted by the libavfilter
9778 framework.
9779
9780 It does not take parameters.
9781
9782 @section fillborders
9783
9784 Fill borders of the input video, without changing video stream dimensions.
9785 Sometimes video can have garbage at the four edges and you may not want to
9786 crop video input to keep size multiple of some number.
9787
9788 This filter accepts the following options:
9789
9790 @table @option
9791 @item left
9792 Number of pixels to fill from left border.
9793
9794 @item right
9795 Number of pixels to fill from right border.
9796
9797 @item top
9798 Number of pixels to fill from top border.
9799
9800 @item bottom
9801 Number of pixels to fill from bottom border.
9802
9803 @item mode
9804 Set fill mode.
9805
9806 It accepts the following values:
9807 @table @samp
9808 @item smear
9809 fill pixels using outermost pixels
9810
9811 @item mirror
9812 fill pixels using mirroring
9813
9814 @item fixed
9815 fill pixels with constant value
9816 @end table
9817
9818 Default is @var{smear}.
9819
9820 @item color
9821 Set color for pixels in fixed mode. Default is @var{black}.
9822 @end table
9823
9824 @section find_rect
9825
9826 Find a rectangular object
9827
9828 It accepts the following options:
9829
9830 @table @option
9831 @item object
9832 Filepath of the object image, needs to be in gray8.
9833
9834 @item threshold
9835 Detection threshold, default is 0.5.
9836
9837 @item mipmaps
9838 Number of mipmaps, default is 3.
9839
9840 @item xmin, ymin, xmax, ymax
9841 Specifies the rectangle in which to search.
9842 @end table
9843
9844 @subsection Examples
9845
9846 @itemize
9847 @item
9848 Generate a representative palette of a given video using @command{ffmpeg}:
9849 @example
9850 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
9851 @end example
9852 @end itemize
9853
9854 @section cover_rect
9855
9856 Cover a rectangular object
9857
9858 It accepts the following options:
9859
9860 @table @option
9861 @item cover
9862 Filepath of the optional cover image, needs to be in yuv420.
9863
9864 @item mode
9865 Set covering mode.
9866
9867 It accepts the following values:
9868 @table @samp
9869 @item cover
9870 cover it by the supplied image
9871 @item blur
9872 cover it by interpolating the surrounding pixels
9873 @end table
9874
9875 Default value is @var{blur}.
9876 @end table
9877
9878 @subsection Examples
9879
9880 @itemize
9881 @item
9882 Generate a representative palette of a given video using @command{ffmpeg}:
9883 @example
9884 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
9885 @end example
9886 @end itemize
9887
9888 @section floodfill
9889
9890 Flood area with values of same pixel components with another values.
9891
9892 It accepts the following options:
9893 @table @option
9894 @item x
9895 Set pixel x coordinate.
9896
9897 @item y
9898 Set pixel y coordinate.
9899
9900 @item s0
9901 Set source #0 component value.
9902
9903 @item s1
9904 Set source #1 component value.
9905
9906 @item s2
9907 Set source #2 component value.
9908
9909 @item s3
9910 Set source #3 component value.
9911
9912 @item d0
9913 Set destination #0 component value.
9914
9915 @item d1
9916 Set destination #1 component value.
9917
9918 @item d2
9919 Set destination #2 component value.
9920
9921 @item d3
9922 Set destination #3 component value.
9923 @end table
9924
9925 @anchor{format}
9926 @section format
9927
9928 Convert the input video to one of the specified pixel formats.
9929 Libavfilter will try to pick one that is suitable as input to
9930 the next filter.
9931
9932 It accepts the following parameters:
9933 @table @option
9934
9935 @item pix_fmts
9936 A '|'-separated list of pixel format names, such as
9937 "pix_fmts=yuv420p|monow|rgb24".
9938
9939 @end table
9940
9941 @subsection Examples
9942
9943 @itemize
9944 @item
9945 Convert the input video to the @var{yuv420p} format
9946 @example
9947 format=pix_fmts=yuv420p
9948 @end example
9949
9950 Convert the input video to any of the formats in the list
9951 @example
9952 format=pix_fmts=yuv420p|yuv444p|yuv410p
9953 @end example
9954 @end itemize
9955
9956 @anchor{fps}
9957 @section fps
9958
9959 Convert the video to specified constant frame rate by duplicating or dropping
9960 frames as necessary.
9961
9962 It accepts the following parameters:
9963 @table @option
9964
9965 @item fps
9966 The desired output frame rate. The default is @code{25}.
9967
9968 @item start_time
9969 Assume the first PTS should be the given value, in seconds. This allows for
9970 padding/trimming at the start of stream. By default, no assumption is made
9971 about the first frame's expected PTS, so no padding or trimming is done.
9972 For example, this could be set to 0 to pad the beginning with duplicates of
9973 the first frame if a video stream starts after the audio stream or to trim any
9974 frames with a negative PTS.
9975
9976 @item round
9977 Timestamp (PTS) rounding method.
9978
9979 Possible values are:
9980 @table @option
9981 @item zero
9982 round towards 0
9983 @item inf
9984 round away from 0
9985 @item down
9986 round towards -infinity
9987 @item up
9988 round towards +infinity
9989 @item near
9990 round to nearest
9991 @end table
9992 The default is @code{near}.
9993
9994 @item eof_action
9995 Action performed when reading the last frame.
9996
9997 Possible values are:
9998 @table @option
9999 @item round
10000 Use same timestamp rounding method as used for other frames.
10001 @item pass
10002 Pass through last frame if input duration has not been reached yet.
10003 @end table
10004 The default is @code{round}.
10005
10006 @end table
10007
10008 Alternatively, the options can be specified as a flat string:
10009 @var{fps}[:@var{start_time}[:@var{round}]].
10010
10011 See also the @ref{setpts} filter.
10012
10013 @subsection Examples
10014
10015 @itemize
10016 @item
10017 A typical usage in order to set the fps to 25:
10018 @example
10019 fps=fps=25
10020 @end example
10021
10022 @item
10023 Sets the fps to 24, using abbreviation and rounding method to round to nearest:
10024 @example
10025 fps=fps=film:round=near
10026 @end example
10027 @end itemize
10028
10029 @section framepack
10030
10031 Pack two different video streams into a stereoscopic video, setting proper
10032 metadata on supported codecs. The two views should have the same size and
10033 framerate and processing will stop when the shorter video ends. Please note
10034 that you may conveniently adjust view properties with the @ref{scale} and
10035 @ref{fps} filters.
10036
10037 It accepts the following parameters:
10038 @table @option
10039
10040 @item format
10041 The desired packing format. Supported values are:
10042
10043 @table @option
10044
10045 @item sbs
10046 The views are next to each other (default).
10047
10048 @item tab
10049 The views are on top of each other.
10050
10051 @item lines
10052 The views are packed by line.
10053
10054 @item columns
10055 The views are packed by column.
10056
10057 @item frameseq
10058 The views are temporally interleaved.
10059
10060 @end table
10061
10062 @end table
10063
10064 Some examples:
10065
10066 @example
10067 # Convert left and right views into a frame-sequential video
10068 ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
10069
10070 # Convert views into a side-by-side video with the same output resolution as the input
10071 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
10072 @end example
10073
10074 @section framerate
10075
10076 Change the frame rate by interpolating new video output frames from the source
10077 frames.
10078
10079 This filter is not designed to function correctly with interlaced media. If
10080 you wish to change the frame rate of interlaced media then you are required
10081 to deinterlace before this filter and re-interlace after this filter.
10082
10083 A description of the accepted options follows.
10084
10085 @table @option
10086 @item fps
10087 Specify the output frames per second. This option can also be specified
10088 as a value alone. The default is @code{50}.
10089
10090 @item interp_start
10091 Specify the start of a range where the output frame will be created as a
10092 linear interpolation of two frames. The range is [@code{0}-@code{255}],
10093 the default is @code{15}.
10094
10095 @item interp_end
10096 Specify the end of a range where the output frame will be created as a
10097 linear interpolation of two frames. The range is [@code{0}-@code{255}],
10098 the default is @code{240}.
10099
10100 @item scene
10101 Specify the level at which a scene change is detected as a value between
10102 0 and 100 to indicate a new scene; a low value reflects a low
10103 probability for the current frame to introduce a new scene, while a higher
10104 value means the current frame is more likely to be one.
10105 The default is @code{8.2}.
10106
10107 @item flags
10108 Specify flags influencing the filter process.
10109
10110 Available value for @var{flags} is:
10111
10112 @table @option
10113 @item scene_change_detect, scd
10114 Enable scene change detection using the value of the option @var{scene}.
10115 This flag is enabled by default.
10116 @end table
10117 @end table
10118
10119 @section framestep
10120
10121 Select one frame every N-th frame.
10122
10123 This filter accepts the following option:
10124 @table @option
10125 @item step
10126 Select frame after every @code{step} frames.
10127 Allowed values are positive integers higher than 0. Default value is @code{1}.
10128 @end table
10129
10130 @section freezedetect
10131
10132 Detect frozen video.
10133
10134 This filter logs a message and sets frame metadata when it detects that the
10135 input video has no significant change in content during a specified duration.
10136 Video freeze detection calculates the mean average absolute difference of all
10137 the components of video frames and compares it to a noise floor.
10138
10139 The printed times and duration are expressed in seconds. The
10140 @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
10141 whose timestamp equals or exceeds the detection duration and it contains the
10142 timestamp of the first frame of the freeze. The
10143 @code{lavfi.freezedetect.freeze_duration} and
10144 @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
10145 after the freeze.
10146
10147 The filter accepts the following options:
10148
10149 @table @option
10150 @item noise, n
10151 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
10152 specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
10153 0.001.
10154
10155 @item duration, d
10156 Set freeze duration until notification (default is 2 seconds).
10157 @end table
10158
10159 @anchor{frei0r}
10160 @section frei0r
10161
10162 Apply a frei0r effect to the input video.
10163
10164 To enable the compilation of this filter, you need to install the frei0r
10165 header and configure FFmpeg with @code{--enable-frei0r}.
10166
10167 It accepts the following parameters:
10168
10169 @table @option
10170
10171 @item filter_name
10172 The name of the frei0r effect to load. If the environment variable
10173 @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
10174 directories specified by the colon-separated list in @env{FREI0R_PATH}.
10175 Otherwise, the standard frei0r paths are searched, in this order:
10176 @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
10177 @file{/usr/lib/frei0r-1/}.
10178
10179 @item filter_params
10180 A '|'-separated list of parameters to pass to the frei0r effect.
10181
10182 @end table
10183
10184 A frei0r effect parameter can be a boolean (its value is either
10185 "y" or "n"), a double, a color (specified as
10186 @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
10187 numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
10188 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
10189 a position (specified as @var{X}/@var{Y}, where
10190 @var{X} and @var{Y} are floating point numbers) and/or a string.
10191
10192 The number and types of parameters depend on the loaded effect. If an
10193 effect parameter is not specified, the default value is set.
10194
10195 @subsection Examples
10196
10197 @itemize
10198 @item
10199 Apply the distort0r effect, setting the first two double parameters:
10200 @example
10201 frei0r=filter_name=distort0r:filter_params=0.5|0.01
10202 @end example
10203
10204 @item
10205 Apply the colordistance effect, taking a color as the first parameter:
10206 @example
10207 frei0r=colordistance:0.2/0.3/0.4
10208 frei0r=colordistance:violet
10209 frei0r=colordistance:0x112233
10210 @end example
10211
10212 @item
10213 Apply the perspective effect, specifying the top left and top right image
10214 positions:
10215 @example
10216 frei0r=perspective:0.2/0.2|0.8/0.2
10217 @end example
10218 @end itemize
10219
10220 For more information, see
10221 @url{http://frei0r.dyne.org}
10222
10223 @section fspp
10224
10225 Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
10226
10227 It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
10228 processing filter, one of them is performed once per block, not per pixel.
10229 This allows for much higher speed.
10230
10231 The filter accepts the following options:
10232
10233 @table @option
10234 @item quality
10235 Set quality. This option defines the number of levels for averaging. It accepts
10236 an integer in the range 4-5. Default value is @code{4}.
10237
10238 @item qp
10239 Force a constant quantization parameter. It accepts an integer in range 0-63.
10240 If not set, the filter will use the QP from the video stream (if available).
10241
10242 @item strength
10243 Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
10244 more details but also more artifacts, while higher values make the image smoother
10245 but also blurrier. Default value is @code{0} âˆ’ PSNR optimal.
10246
10247 @item use_bframe_qp
10248 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
10249 option may cause flicker since the B-Frames have often larger QP. Default is
10250 @code{0} (not enabled).
10251
10252 @end table
10253
10254 @section gblur
10255
10256 Apply Gaussian blur filter.
10257
10258 The filter accepts the following options:
10259
10260 @table @option
10261 @item sigma
10262 Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
10263
10264 @item steps
10265 Set number of steps for Gaussian approximation. Defauls is @code{1}.
10266
10267 @item planes
10268 Set which planes to filter. By default all planes are filtered.
10269
10270 @item sigmaV
10271 Set vertical sigma, if negative it will be same as @code{sigma}.
10272 Default is @code{-1}.
10273 @end table
10274
10275 @section geq
10276
10277 Apply generic equation to each pixel.
10278
10279 The filter accepts the following options:
10280
10281 @table @option
10282 @item lum_expr, lum
10283 Set the luminance expression.
10284 @item cb_expr, cb
10285 Set the chrominance blue expression.
10286 @item cr_expr, cr
10287 Set the chrominance red expression.
10288 @item alpha_expr, a
10289 Set the alpha expression.
10290 @item red_expr, r
10291 Set the red expression.
10292 @item green_expr, g
10293 Set the green expression.
10294 @item blue_expr, b
10295 Set the blue expression.
10296 @end table
10297
10298 The colorspace is selected according to the specified options. If one
10299 of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
10300 options is specified, the filter will automatically select a YCbCr
10301 colorspace. If one of the @option{red_expr}, @option{green_expr}, or
10302 @option{blue_expr} options is specified, it will select an RGB
10303 colorspace.
10304
10305 If one of the chrominance expression is not defined, it falls back on the other
10306 one. If no alpha expression is specified it will evaluate to opaque value.
10307 If none of chrominance expressions are specified, they will evaluate
10308 to the luminance expression.
10309
10310 The expressions can use the following variables and functions:
10311
10312 @table @option
10313 @item N
10314 The sequential number of the filtered frame, starting from @code{0}.
10315
10316 @item X
10317 @item Y
10318 The coordinates of the current sample.
10319
10320 @item W
10321 @item H
10322 The width and height of the image.
10323
10324 @item SW
10325 @item SH
10326 Width and height scale depending on the currently filtered plane. It is the
10327 ratio between the corresponding luma plane number of pixels and the current
10328 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
10329 @code{0.5,0.5} for chroma planes.
10330
10331 @item T
10332 Time of the current frame, expressed in seconds.
10333
10334 @item p(x, y)
10335 Return the value of the pixel at location (@var{x},@var{y}) of the current
10336 plane.
10337
10338 @item lum(x, y)
10339 Return the value of the pixel at location (@var{x},@var{y}) of the luminance
10340 plane.
10341
10342 @item cb(x, y)
10343 Return the value of the pixel at location (@var{x},@var{y}) of the
10344 blue-difference chroma plane. Return 0 if there is no such plane.
10345
10346 @item cr(x, y)
10347 Return the value of the pixel at location (@var{x},@var{y}) of the
10348 red-difference chroma plane. Return 0 if there is no such plane.
10349
10350 @item r(x, y)
10351 @item g(x, y)
10352 @item b(x, y)
10353 Return the value of the pixel at location (@var{x},@var{y}) of the
10354 red/green/blue component. Return 0 if there is no such component.
10355
10356 @item alpha(x, y)
10357 Return the value of the pixel at location (@var{x},@var{y}) of the alpha
10358 plane. Return 0 if there is no such plane.
10359 @end table
10360
10361 For functions, if @var{x} and @var{y} are outside the area, the value will be
10362 automatically clipped to the closer edge.
10363
10364 @subsection Examples
10365
10366 @itemize
10367 @item
10368 Flip the image horizontally:
10369 @example
10370 geq=p(W-X\,Y)
10371 @end example
10372
10373 @item
10374 Generate a bidimensional sine wave, with angle @code{PI/3} and a
10375 wavelength of 100 pixels:
10376 @example
10377 geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
10378 @end example
10379
10380 @item
10381 Generate a fancy enigmatic moving light:
10382 @example
10383 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
10384 @end example
10385
10386 @item
10387 Generate a quick emboss effect:
10388 @example
10389 format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
10390 @end example
10391
10392 @item
10393 Modify RGB components depending on pixel position:
10394 @example
10395 geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
10396 @end example
10397
10398 @item
10399 Create a radial gradient that is the same size as the input (also see
10400 the @ref{vignette} filter):
10401 @example
10402 geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
10403 @end example
10404 @end itemize
10405
10406 @section gradfun
10407
10408 Fix the banding artifacts that are sometimes introduced into nearly flat
10409 regions by truncation to 8-bit color depth.
10410 Interpolate the gradients that should go where the bands are, and
10411 dither them.
10412
10413 It is designed for playback only.  Do not use it prior to
10414 lossy compression, because compression tends to lose the dither and
10415 bring back the bands.
10416
10417 It accepts the following parameters:
10418
10419 @table @option
10420
10421 @item strength
10422 The maximum amount by which the filter will change any one pixel. This is also
10423 the threshold for detecting nearly flat regions. Acceptable values range from
10424 .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
10425 valid range.
10426
10427 @item radius
10428 The neighborhood to fit the gradient to. A larger radius makes for smoother
10429 gradients, but also prevents the filter from modifying the pixels near detailed
10430 regions. Acceptable values are 8-32; the default value is 16. Out-of-range
10431 values will be clipped to the valid range.
10432
10433 @end table
10434
10435 Alternatively, the options can be specified as a flat string:
10436 @var{strength}[:@var{radius}]
10437
10438 @subsection Examples
10439
10440 @itemize
10441 @item
10442 Apply the filter with a @code{3.5} strength and radius of @code{8}:
10443 @example
10444 gradfun=3.5:8
10445 @end example
10446
10447 @item
10448 Specify radius, omitting the strength (which will fall-back to the default
10449 value):
10450 @example
10451 gradfun=radius=8
10452 @end example
10453
10454 @end itemize
10455
10456 @section graphmonitor, agraphmonitor
10457 Show various filtergraph stats.
10458
10459 With this filter one can debug complete filtergraph.
10460 Especially issues with links filling with queued frames.
10461
10462 The filter accepts the following options:
10463
10464 @table @option
10465 @item size, s
10466 Set video output size. Default is @var{hd720}.
10467
10468 @item opacity, o
10469 Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
10470
10471 @item mode, m
10472 Set output mode, can be @var{fulll} or @var{compact}.
10473 In @var{compact} mode only filters with some queued frames have displayed stats.
10474
10475 @item flags, f
10476 Set flags which enable which stats are shown in video.
10477
10478 Available values for flags are:
10479 @table @samp
10480 @item queue
10481 Display number of queued frames in each link.
10482
10483 @item frame_count_in
10484 Display number of frames taken from filter.
10485
10486 @item frame_count_out
10487 Display number of frames given out from filter.
10488
10489 @item pts
10490 Display current filtered frame pts.
10491
10492 @item time
10493 Display current filtered frame time.
10494
10495 @item timebase
10496 Display time base for filter link.
10497
10498 @item format
10499 Display used format for filter link.
10500
10501 @item size
10502 Display video size or number of audio channels in case of audio used by filter link.
10503
10504 @item rate
10505 Display video frame rate or sample rate in case of audio used by filter link.
10506 @end table
10507
10508 @item rate, r
10509 Set upper limit for video rate of output stream, Default value is @var{25}.
10510 This guarantee that output video frame rate will not be higher than this value.
10511 @end table
10512
10513 @section greyedge
10514 A color constancy variation filter which estimates scene illumination via grey edge algorithm
10515 and corrects the scene colors accordingly.
10516
10517 See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
10518
10519 The filter accepts the following options:
10520
10521 @table @option
10522 @item difford
10523 The order of differentiation to be applied on the scene. Must be chosen in the range
10524 [0,2] and default value is 1.
10525
10526 @item minknorm
10527 The Minkowski parameter to be used for calculating the Minkowski distance. Must
10528 be chosen in the range [0,20] and default value is 1. Set to 0 for getting
10529 max value instead of calculating Minkowski distance.
10530
10531 @item sigma
10532 The standard deviation of Gaussian blur to be applied on the scene. Must be
10533 chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
10534 can't be euqal to 0 if @var{difford} is greater than 0.
10535 @end table
10536
10537 @subsection Examples
10538 @itemize
10539
10540 @item
10541 Grey Edge:
10542 @example
10543 greyedge=difford=1:minknorm=5:sigma=2
10544 @end example
10545
10546 @item
10547 Max Edge:
10548 @example
10549 greyedge=difford=1:minknorm=0:sigma=2
10550 @end example
10551
10552 @end itemize
10553
10554 @anchor{haldclut}
10555 @section haldclut
10556
10557 Apply a Hald CLUT to a video stream.
10558
10559 First input is the video stream to process, and second one is the Hald CLUT.
10560 The Hald CLUT input can be a simple picture or a complete video stream.
10561
10562 The filter accepts the following options:
10563
10564 @table @option
10565 @item shortest
10566 Force termination when the shortest input terminates. Default is @code{0}.
10567 @item repeatlast
10568 Continue applying the last CLUT after the end of the stream. A value of
10569 @code{0} disable the filter after the last frame of the CLUT is reached.
10570 Default is @code{1}.
10571 @end table
10572
10573 @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
10574 filters share the same internals).
10575
10576 More information about the Hald CLUT can be found on Eskil Steenberg's website
10577 (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
10578
10579 @subsection Workflow examples
10580
10581 @subsubsection Hald CLUT video stream
10582
10583 Generate an identity Hald CLUT stream altered with various effects:
10584 @example
10585 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
10586 @end example
10587
10588 Note: make sure you use a lossless codec.
10589
10590 Then use it with @code{haldclut} to apply it on some random stream:
10591 @example
10592 ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
10593 @end example
10594
10595 The Hald CLUT will be applied to the 10 first seconds (duration of
10596 @file{clut.nut}), then the latest picture of that CLUT stream will be applied
10597 to the remaining frames of the @code{mandelbrot} stream.
10598
10599 @subsubsection Hald CLUT with preview
10600
10601 A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
10602 @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
10603 biggest possible square starting at the top left of the picture. The remaining
10604 padding pixels (bottom or right) will be ignored. This area can be used to add
10605 a preview of the Hald CLUT.
10606
10607 Typically, the following generated Hald CLUT will be supported by the
10608 @code{haldclut} filter:
10609
10610 @example
10611 ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
10612    pad=iw+320 [padded_clut];
10613    smptebars=s=320x256, split [a][b];
10614    [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
10615    [main][b] overlay=W-320" -frames:v 1 clut.png
10616 @end example
10617
10618 It contains the original and a preview of the effect of the CLUT: SMPTE color
10619 bars are displayed on the right-top, and below the same color bars processed by
10620 the color changes.
10621
10622 Then, the effect of this Hald CLUT can be visualized with:
10623 @example
10624 ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
10625 @end example
10626
10627 @section hflip
10628
10629 Flip the input video horizontally.
10630
10631 For example, to horizontally flip the input video with @command{ffmpeg}:
10632 @example
10633 ffmpeg -i in.avi -vf "hflip" out.avi
10634 @end example
10635
10636 @section histeq
10637 This filter applies a global color histogram equalization on a
10638 per-frame basis.
10639
10640 It can be used to correct video that has a compressed range of pixel
10641 intensities.  The filter redistributes the pixel intensities to
10642 equalize their distribution across the intensity range. It may be
10643 viewed as an "automatically adjusting contrast filter". This filter is
10644 useful only for correcting degraded or poorly captured source
10645 video.
10646
10647 The filter accepts the following options:
10648
10649 @table @option
10650 @item strength
10651 Determine the amount of equalization to be applied.  As the strength
10652 is reduced, the distribution of pixel intensities more-and-more
10653 approaches that of the input frame. The value must be a float number
10654 in the range [0,1] and defaults to 0.200.
10655
10656 @item intensity
10657 Set the maximum intensity that can generated and scale the output
10658 values appropriately.  The strength should be set as desired and then
10659 the intensity can be limited if needed to avoid washing-out. The value
10660 must be a float number in the range [0,1] and defaults to 0.210.
10661
10662 @item antibanding
10663 Set the antibanding level. If enabled the filter will randomly vary
10664 the luminance of output pixels by a small amount to avoid banding of
10665 the histogram. Possible values are @code{none}, @code{weak} or
10666 @code{strong}. It defaults to @code{none}.
10667 @end table
10668
10669 @section histogram
10670
10671 Compute and draw a color distribution histogram for the input video.
10672
10673 The computed histogram is a representation of the color component
10674 distribution in an image.
10675
10676 Standard histogram displays the color components distribution in an image.
10677 Displays color graph for each color component. Shows distribution of
10678 the Y, U, V, A or R, G, B components, depending on input format, in the
10679 current frame. Below each graph a color component scale meter is shown.
10680
10681 The filter accepts the following options:
10682
10683 @table @option
10684 @item level_height
10685 Set height of level. Default value is @code{200}.
10686 Allowed range is [50, 2048].
10687
10688 @item scale_height
10689 Set height of color scale. Default value is @code{12}.
10690 Allowed range is [0, 40].
10691
10692 @item display_mode
10693 Set display mode.
10694 It accepts the following values:
10695 @table @samp
10696 @item stack
10697 Per color component graphs are placed below each other.
10698
10699 @item parade
10700 Per color component graphs are placed side by side.
10701
10702 @item overlay
10703 Presents information identical to that in the @code{parade}, except
10704 that the graphs representing color components are superimposed directly
10705 over one another.
10706 @end table
10707 Default is @code{stack}.
10708
10709 @item levels_mode
10710 Set mode. Can be either @code{linear}, or @code{logarithmic}.
10711 Default is @code{linear}.
10712
10713 @item components
10714 Set what color components to display.
10715 Default is @code{7}.
10716
10717 @item fgopacity
10718 Set foreground opacity. Default is @code{0.7}.
10719
10720 @item bgopacity
10721 Set background opacity. Default is @code{0.5}.
10722 @end table
10723
10724 @subsection Examples
10725
10726 @itemize
10727
10728 @item
10729 Calculate and draw histogram:
10730 @example
10731 ffplay -i input -vf histogram
10732 @end example
10733
10734 @end itemize
10735
10736 @anchor{hqdn3d}
10737 @section hqdn3d
10738
10739 This is a high precision/quality 3d denoise filter. It aims to reduce
10740 image noise, producing smooth images and making still images really
10741 still. It should enhance compressibility.
10742
10743 It accepts the following optional parameters:
10744
10745 @table @option
10746 @item luma_spatial
10747 A non-negative floating point number which specifies spatial luma strength.
10748 It defaults to 4.0.
10749
10750 @item chroma_spatial
10751 A non-negative floating point number which specifies spatial chroma strength.
10752 It defaults to 3.0*@var{luma_spatial}/4.0.
10753
10754 @item luma_tmp
10755 A floating point number which specifies luma temporal strength. It defaults to
10756 6.0*@var{luma_spatial}/4.0.
10757
10758 @item chroma_tmp
10759 A floating point number which specifies chroma temporal strength. It defaults to
10760 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
10761 @end table
10762
10763 @anchor{hwdownload}
10764 @section hwdownload
10765
10766 Download hardware frames to system memory.
10767
10768 The input must be in hardware frames, and the output a non-hardware format.
10769 Not all formats will be supported on the output - it may be necessary to insert
10770 an additional @option{format} filter immediately following in the graph to get
10771 the output in a supported format.
10772
10773 @section hwmap
10774
10775 Map hardware frames to system memory or to another device.
10776
10777 This filter has several different modes of operation; which one is used depends
10778 on the input and output formats:
10779 @itemize
10780 @item
10781 Hardware frame input, normal frame output
10782
10783 Map the input frames to system memory and pass them to the output.  If the
10784 original hardware frame is later required (for example, after overlaying
10785 something else on part of it), the @option{hwmap} filter can be used again
10786 in the next mode to retrieve it.
10787 @item
10788 Normal frame input, hardware frame output
10789
10790 If the input is actually a software-mapped hardware frame, then unmap it -
10791 that is, return the original hardware frame.
10792
10793 Otherwise, a device must be provided.  Create new hardware surfaces on that
10794 device for the output, then map them back to the software format at the input
10795 and give those frames to the preceding filter.  This will then act like the
10796 @option{hwupload} filter, but may be able to avoid an additional copy when
10797 the input is already in a compatible format.
10798 @item
10799 Hardware frame input and output
10800
10801 A device must be supplied for the output, either directly or with the
10802 @option{derive_device} option.  The input and output devices must be of
10803 different types and compatible - the exact meaning of this is
10804 system-dependent, but typically it means that they must refer to the same
10805 underlying hardware context (for example, refer to the same graphics card).
10806
10807 If the input frames were originally created on the output device, then unmap
10808 to retrieve the original frames.
10809
10810 Otherwise, map the frames to the output device - create new hardware frames
10811 on the output corresponding to the frames on the input.
10812 @end itemize
10813
10814 The following additional parameters are accepted:
10815
10816 @table @option
10817 @item mode
10818 Set the frame mapping mode.  Some combination of:
10819 @table @var
10820 @item read
10821 The mapped frame should be readable.
10822 @item write
10823 The mapped frame should be writeable.
10824 @item overwrite
10825 The mapping will always overwrite the entire frame.
10826
10827 This may improve performance in some cases, as the original contents of the
10828 frame need not be loaded.
10829 @item direct
10830 The mapping must not involve any copying.
10831
10832 Indirect mappings to copies of frames are created in some cases where either
10833 direct mapping is not possible or it would have unexpected properties.
10834 Setting this flag ensures that the mapping is direct and will fail if that is
10835 not possible.
10836 @end table
10837 Defaults to @var{read+write} if not specified.
10838
10839 @item derive_device @var{type}
10840 Rather than using the device supplied at initialisation, instead derive a new
10841 device of type @var{type} from the device the input frames exist on.
10842
10843 @item reverse
10844 In a hardware to hardware mapping, map in reverse - create frames in the sink
10845 and map them back to the source.  This may be necessary in some cases where
10846 a mapping in one direction is required but only the opposite direction is
10847 supported by the devices being used.
10848
10849 This option is dangerous - it may break the preceding filter in undefined
10850 ways if there are any additional constraints on that filter's output.
10851 Do not use it without fully understanding the implications of its use.
10852 @end table
10853
10854 @anchor{hwupload}
10855 @section hwupload
10856
10857 Upload system memory frames to hardware surfaces.
10858
10859 The device to upload to must be supplied when the filter is initialised.  If
10860 using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
10861 option.
10862
10863 @anchor{hwupload_cuda}
10864 @section hwupload_cuda
10865
10866 Upload system memory frames to a CUDA device.
10867
10868 It accepts the following optional parameters:
10869
10870 @table @option
10871 @item device
10872 The number of the CUDA device to use
10873 @end table
10874
10875 @section hqx
10876
10877 Apply a high-quality magnification filter designed for pixel art. This filter
10878 was originally created by Maxim Stepin.
10879
10880 It accepts the following option:
10881
10882 @table @option
10883 @item n
10884 Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
10885 @code{hq3x} and @code{4} for @code{hq4x}.
10886 Default is @code{3}.
10887 @end table
10888
10889 @section hstack
10890 Stack input videos horizontally.
10891
10892 All streams must be of same pixel format and of same height.
10893
10894 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
10895 to create same output.
10896
10897 The filter accept the following option:
10898
10899 @table @option
10900 @item inputs
10901 Set number of input streams. Default is 2.
10902
10903 @item shortest
10904 If set to 1, force the output to terminate when the shortest input
10905 terminates. Default value is 0.
10906 @end table
10907
10908 @section hue
10909
10910 Modify the hue and/or the saturation of the input.
10911
10912 It accepts the following parameters:
10913
10914 @table @option
10915 @item h
10916 Specify the hue angle as a number of degrees. It accepts an expression,
10917 and defaults to "0".
10918
10919 @item s
10920 Specify the saturation in the [-10,10] range. It accepts an expression and
10921 defaults to "1".
10922
10923 @item H
10924 Specify the hue angle as a number of radians. It accepts an
10925 expression, and defaults to "0".
10926
10927 @item b
10928 Specify the brightness in the [-10,10] range. It accepts an expression and
10929 defaults to "0".
10930 @end table
10931
10932 @option{h} and @option{H} are mutually exclusive, and can't be
10933 specified at the same time.
10934
10935 The @option{b}, @option{h}, @option{H} and @option{s} option values are
10936 expressions containing the following constants:
10937
10938 @table @option
10939 @item n
10940 frame count of the input frame starting from 0
10941
10942 @item pts
10943 presentation timestamp of the input frame expressed in time base units
10944
10945 @item r
10946 frame rate of the input video, NAN if the input frame rate is unknown
10947
10948 @item t
10949 timestamp expressed in seconds, NAN if the input timestamp is unknown
10950
10951 @item tb
10952 time base of the input video
10953 @end table
10954
10955 @subsection Examples
10956
10957 @itemize
10958 @item
10959 Set the hue to 90 degrees and the saturation to 1.0:
10960 @example
10961 hue=h=90:s=1
10962 @end example
10963
10964 @item
10965 Same command but expressing the hue in radians:
10966 @example
10967 hue=H=PI/2:s=1
10968 @end example
10969
10970 @item
10971 Rotate hue and make the saturation swing between 0
10972 and 2 over a period of 1 second:
10973 @example
10974 hue="H=2*PI*t: s=sin(2*PI*t)+1"
10975 @end example
10976
10977 @item
10978 Apply a 3 seconds saturation fade-in effect starting at 0:
10979 @example
10980 hue="s=min(t/3\,1)"
10981 @end example
10982
10983 The general fade-in expression can be written as:
10984 @example
10985 hue="s=min(0\, max((t-START)/DURATION\, 1))"
10986 @end example
10987
10988 @item
10989 Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
10990 @example
10991 hue="s=max(0\, min(1\, (8-t)/3))"
10992 @end example
10993
10994 The general fade-out expression can be written as:
10995 @example
10996 hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
10997 @end example
10998
10999 @end itemize
11000
11001 @subsection Commands
11002
11003 This filter supports the following commands:
11004 @table @option
11005 @item b
11006 @item s
11007 @item h
11008 @item H
11009 Modify the hue and/or the saturation and/or brightness of the input video.
11010 The command accepts the same syntax of the corresponding option.
11011
11012 If the specified expression is not valid, it is kept at its current
11013 value.
11014 @end table
11015
11016 @section hysteresis
11017
11018 Grow first stream into second stream by connecting components.
11019 This makes it possible to build more robust edge masks.
11020
11021 This filter accepts the following options:
11022
11023 @table @option
11024 @item planes
11025 Set which planes will be processed as bitmap, unprocessed planes will be
11026 copied from first stream.
11027 By default value 0xf, all planes will be processed.
11028
11029 @item threshold
11030 Set threshold which is used in filtering. If pixel component value is higher than
11031 this value filter algorithm for connecting components is activated.
11032 By default value is 0.
11033 @end table
11034
11035 @section idet
11036
11037 Detect video interlacing type.
11038
11039 This filter tries to detect if the input frames are interlaced, progressive,
11040 top or bottom field first. It will also try to detect fields that are
11041 repeated between adjacent frames (a sign of telecine).
11042
11043 Single frame detection considers only immediately adjacent frames when classifying each frame.
11044 Multiple frame detection incorporates the classification history of previous frames.
11045
11046 The filter will log these metadata values:
11047
11048 @table @option
11049 @item single.current_frame
11050 Detected type of current frame using single-frame detection. One of:
11051 ``tff'' (top field first), ``bff'' (bottom field first),
11052 ``progressive'', or ``undetermined''
11053
11054 @item single.tff
11055 Cumulative number of frames detected as top field first using single-frame detection.
11056
11057 @item multiple.tff
11058 Cumulative number of frames detected as top field first using multiple-frame detection.
11059
11060 @item single.bff
11061 Cumulative number of frames detected as bottom field first using single-frame detection.
11062
11063 @item multiple.current_frame
11064 Detected type of current frame using multiple-frame detection. One of:
11065 ``tff'' (top field first), ``bff'' (bottom field first),
11066 ``progressive'', or ``undetermined''
11067
11068 @item multiple.bff
11069 Cumulative number of frames detected as bottom field first using multiple-frame detection.
11070
11071 @item single.progressive
11072 Cumulative number of frames detected as progressive using single-frame detection.
11073
11074 @item multiple.progressive
11075 Cumulative number of frames detected as progressive using multiple-frame detection.
11076
11077 @item single.undetermined
11078 Cumulative number of frames that could not be classified using single-frame detection.
11079
11080 @item multiple.undetermined
11081 Cumulative number of frames that could not be classified using multiple-frame detection.
11082
11083 @item repeated.current_frame
11084 Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
11085
11086 @item repeated.neither
11087 Cumulative number of frames with no repeated field.
11088
11089 @item repeated.top
11090 Cumulative number of frames with the top field repeated from the previous frame's top field.
11091
11092 @item repeated.bottom
11093 Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
11094 @end table
11095
11096 The filter accepts the following options:
11097
11098 @table @option
11099 @item intl_thres
11100 Set interlacing threshold.
11101 @item prog_thres
11102 Set progressive threshold.
11103 @item rep_thres
11104 Threshold for repeated field detection.
11105 @item half_life
11106 Number of frames after which a given frame's contribution to the
11107 statistics is halved (i.e., it contributes only 0.5 to its
11108 classification). The default of 0 means that all frames seen are given
11109 full weight of 1.0 forever.
11110 @item analyze_interlaced_flag
11111 When this is not 0 then idet will use the specified number of frames to determine
11112 if the interlaced flag is accurate, it will not count undetermined frames.
11113 If the flag is found to be accurate it will be used without any further
11114 computations, if it is found to be inaccurate it will be cleared without any
11115 further computations. This allows inserting the idet filter as a low computational
11116 method to clean up the interlaced flag
11117 @end table
11118
11119 @section il
11120
11121 Deinterleave or interleave fields.
11122
11123 This filter allows one to process interlaced images fields without
11124 deinterlacing them. Deinterleaving splits the input frame into 2
11125 fields (so called half pictures). Odd lines are moved to the top
11126 half of the output image, even lines to the bottom half.
11127 You can process (filter) them independently and then re-interleave them.
11128
11129 The filter accepts the following options:
11130
11131 @table @option
11132 @item luma_mode, l
11133 @item chroma_mode, c
11134 @item alpha_mode, a
11135 Available values for @var{luma_mode}, @var{chroma_mode} and
11136 @var{alpha_mode} are:
11137
11138 @table @samp
11139 @item none
11140 Do nothing.
11141
11142 @item deinterleave, d
11143 Deinterleave fields, placing one above the other.
11144
11145 @item interleave, i
11146 Interleave fields. Reverse the effect of deinterleaving.
11147 @end table
11148 Default value is @code{none}.
11149
11150 @item luma_swap, ls
11151 @item chroma_swap, cs
11152 @item alpha_swap, as
11153 Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
11154 @end table
11155
11156 @section inflate
11157
11158 Apply inflate effect to the video.
11159
11160 This filter replaces the pixel by the local(3x3) average by taking into account
11161 only values higher than the pixel.
11162
11163 It accepts the following options:
11164
11165 @table @option
11166 @item threshold0
11167 @item threshold1
11168 @item threshold2
11169 @item threshold3
11170 Limit the maximum change for each plane, default is 65535.
11171 If 0, plane will remain unchanged.
11172 @end table
11173
11174 @section interlace
11175
11176 Simple interlacing filter from progressive contents. This interleaves upper (or
11177 lower) lines from odd frames with lower (or upper) lines from even frames,
11178 halving the frame rate and preserving image height.
11179
11180 @example
11181    Original        Original             New Frame
11182    Frame 'j'      Frame 'j+1'             (tff)
11183   ==========      ===========       ==================
11184     Line 0  -------------------->    Frame 'j' Line 0
11185     Line 1          Line 1  ---->   Frame 'j+1' Line 1
11186     Line 2 --------------------->    Frame 'j' Line 2
11187     Line 3          Line 3  ---->   Frame 'j+1' Line 3
11188      ...             ...                   ...
11189 New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
11190 @end example
11191
11192 It accepts the following optional parameters:
11193
11194 @table @option
11195 @item scan
11196 This determines whether the interlaced frame is taken from the even
11197 (tff - default) or odd (bff) lines of the progressive frame.
11198
11199 @item lowpass
11200 Vertical lowpass filter to avoid twitter interlacing and
11201 reduce moire patterns.
11202
11203 @table @samp
11204 @item 0, off
11205 Disable vertical lowpass filter
11206
11207 @item 1, linear
11208 Enable linear filter (default)
11209
11210 @item 2, complex
11211 Enable complex filter. This will slightly less reduce twitter and moire
11212 but better retain detail and subjective sharpness impression.
11213
11214 @end table
11215 @end table
11216
11217 @section kerndeint
11218
11219 Deinterlace input video by applying Donald Graft's adaptive kernel
11220 deinterling. Work on interlaced parts of a video to produce
11221 progressive frames.
11222
11223 The description of the accepted parameters follows.
11224
11225 @table @option
11226 @item thresh
11227 Set the threshold which affects the filter's tolerance when
11228 determining if a pixel line must be processed. It must be an integer
11229 in the range [0,255] and defaults to 10. A value of 0 will result in
11230 applying the process on every pixels.
11231
11232 @item map
11233 Paint pixels exceeding the threshold value to white if set to 1.
11234 Default is 0.
11235
11236 @item order
11237 Set the fields order. Swap fields if set to 1, leave fields alone if
11238 0. Default is 0.
11239
11240 @item sharp
11241 Enable additional sharpening if set to 1. Default is 0.
11242
11243 @item twoway
11244 Enable twoway sharpening if set to 1. Default is 0.
11245 @end table
11246
11247 @subsection Examples
11248
11249 @itemize
11250 @item
11251 Apply default values:
11252 @example
11253 kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
11254 @end example
11255
11256 @item
11257 Enable additional sharpening:
11258 @example
11259 kerndeint=sharp=1
11260 @end example
11261
11262 @item
11263 Paint processed pixels in white:
11264 @example
11265 kerndeint=map=1
11266 @end example
11267 @end itemize
11268
11269 @section lenscorrection
11270
11271 Correct radial lens distortion
11272
11273 This filter can be used to correct for radial distortion as can result from the use
11274 of wide angle lenses, and thereby re-rectify the image. To find the right parameters
11275 one can use tools available for example as part of opencv or simply trial-and-error.
11276 To use opencv use the calibration sample (under samples/cpp) from the opencv sources
11277 and extract the k1 and k2 coefficients from the resulting matrix.
11278
11279 Note that effectively the same filter is available in the open-source tools Krita and
11280 Digikam from the KDE project.
11281
11282 In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
11283 this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
11284 brightness distribution, so you may want to use both filters together in certain
11285 cases, though you will have to take care of ordering, i.e. whether vignetting should
11286 be applied before or after lens correction.
11287
11288 @subsection Options
11289
11290 The filter accepts the following options:
11291
11292 @table @option
11293 @item cx
11294 Relative x-coordinate of the focal point of the image, and thereby the center of the
11295 distortion. This value has a range [0,1] and is expressed as fractions of the image
11296 width. Default is 0.5.
11297 @item cy
11298 Relative y-coordinate of the focal point of the image, and thereby the center of the
11299 distortion. This value has a range [0,1] and is expressed as fractions of the image
11300 height. Default is 0.5.
11301 @item k1
11302 Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
11303 no correction. Default is 0.
11304 @item k2
11305 Coefficient of the double quadratic correction term. This value has a range [-1,1].
11306 0 means no correction. Default is 0.
11307 @end table
11308
11309 The formula that generates the correction is:
11310
11311 @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)
11312
11313 where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
11314 distances from the focal point in the source and target images, respectively.
11315
11316 @section lensfun
11317
11318 Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
11319
11320 The @code{lensfun} filter requires the camera make, camera model, and lens model
11321 to apply the lens correction. The filter will load the lensfun database and
11322 query it to find the corresponding camera and lens entries in the database. As
11323 long as these entries can be found with the given options, the filter can
11324 perform corrections on frames. Note that incomplete strings will result in the
11325 filter choosing the best match with the given options, and the filter will
11326 output the chosen camera and lens models (logged with level "info"). You must
11327 provide the make, camera model, and lens model as they are required.
11328
11329 The filter accepts the following options:
11330
11331 @table @option
11332 @item make
11333 The make of the camera (for example, "Canon"). This option is required.
11334
11335 @item model
11336 The model of the camera (for example, "Canon EOS 100D"). This option is
11337 required.
11338
11339 @item lens_model
11340 The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
11341 option is required.
11342
11343 @item mode
11344 The type of correction to apply. The following values are valid options:
11345
11346 @table @samp
11347 @item vignetting
11348 Enables fixing lens vignetting.
11349
11350 @item geometry
11351 Enables fixing lens geometry. This is the default.
11352
11353 @item subpixel
11354 Enables fixing chromatic aberrations.
11355
11356 @item vig_geo
11357 Enables fixing lens vignetting and lens geometry.
11358
11359 @item vig_subpixel
11360 Enables fixing lens vignetting and chromatic aberrations.
11361
11362 @item distortion
11363 Enables fixing both lens geometry and chromatic aberrations.
11364
11365 @item all
11366 Enables all possible corrections.
11367
11368 @end table
11369 @item focal_length
11370 The focal length of the image/video (zoom; expected constant for video). For
11371 example, a 18--55mm lens has focal length range of [18--55], so a value in that
11372 range should be chosen when using that lens. Default 18.
11373
11374 @item aperture
11375 The aperture of the image/video (expected constant for video). Note that
11376 aperture is only used for vignetting correction. Default 3.5.
11377
11378 @item focus_distance
11379 The focus distance of the image/video (expected constant for video). Note that
11380 focus distance is only used for vignetting and only slightly affects the
11381 vignetting correction process. If unknown, leave it at the default value (which
11382 is 1000).
11383
11384 @item target_geometry
11385 The target geometry of the output image/video. The following values are valid
11386 options:
11387
11388 @table @samp
11389 @item rectilinear (default)
11390 @item fisheye
11391 @item panoramic
11392 @item equirectangular
11393 @item fisheye_orthographic
11394 @item fisheye_stereographic
11395 @item fisheye_equisolid
11396 @item fisheye_thoby
11397 @end table
11398 @item reverse
11399 Apply the reverse of image correction (instead of correcting distortion, apply
11400 it).
11401
11402 @item interpolation
11403 The type of interpolation used when correcting distortion. The following values
11404 are valid options:
11405
11406 @table @samp
11407 @item nearest
11408 @item linear (default)
11409 @item lanczos
11410 @end table
11411 @end table
11412
11413 @subsection Examples
11414
11415 @itemize
11416 @item
11417 Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
11418 model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
11419 aperture of "8.0".
11420
11421 @example
11422 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
11423 @end example
11424
11425 @item
11426 Apply the same as before, but only for the first 5 seconds of video.
11427
11428 @example
11429 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
11430 @end example
11431
11432 @end itemize
11433
11434 @section libvmaf
11435
11436 Obtain the VMAF (Video Multi-Method Assessment Fusion)
11437 score between two input videos.
11438
11439 The obtained VMAF score is printed through the logging system.
11440
11441 It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
11442 After installing the library it can be enabled using:
11443 @code{./configure --enable-libvmaf --enable-version3}.
11444 If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
11445
11446 The filter has following options:
11447
11448 @table @option
11449 @item model_path
11450 Set the model path which is to be used for SVM.
11451 Default value: @code{"vmaf_v0.6.1.pkl"}
11452
11453 @item log_path
11454 Set the file path to be used to store logs.
11455
11456 @item log_fmt
11457 Set the format of the log file (xml or json).
11458
11459 @item enable_transform
11460 This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
11461 if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
11462 Default value: @code{false}
11463
11464 @item phone_model
11465 Invokes the phone model which will generate VMAF scores higher than in the
11466 regular model, which is more suitable for laptop, TV, etc. viewing conditions.
11467
11468 @item psnr
11469 Enables computing psnr along with vmaf.
11470
11471 @item ssim
11472 Enables computing ssim along with vmaf.
11473
11474 @item ms_ssim
11475 Enables computing ms_ssim along with vmaf.
11476
11477 @item pool
11478 Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
11479
11480 @item n_threads
11481 Set number of threads to be used when computing vmaf.
11482
11483 @item n_subsample
11484 Set interval for frame subsampling used when computing vmaf.
11485
11486 @item enable_conf_interval
11487 Enables confidence interval.
11488 @end table
11489
11490 This filter also supports the @ref{framesync} options.
11491
11492 On the below examples the input file @file{main.mpg} being processed is
11493 compared with the reference file @file{ref.mpg}.
11494
11495 @example
11496 ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
11497 @end example
11498
11499 Example with options:
11500 @example
11501 ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
11502 @end example
11503
11504 @section limiter
11505
11506 Limits the pixel components values to the specified range [min, max].
11507
11508 The filter accepts the following options:
11509
11510 @table @option
11511 @item min
11512 Lower bound. Defaults to the lowest allowed value for the input.
11513
11514 @item max
11515 Upper bound. Defaults to the highest allowed value for the input.
11516
11517 @item planes
11518 Specify which planes will be processed. Defaults to all available.
11519 @end table
11520
11521 @section loop
11522
11523 Loop video frames.
11524
11525 The filter accepts the following options:
11526
11527 @table @option
11528 @item loop
11529 Set the number of loops. Setting this value to -1 will result in infinite loops.
11530 Default is 0.
11531
11532 @item size
11533 Set maximal size in number of frames. Default is 0.
11534
11535 @item start
11536 Set first frame of loop. Default is 0.
11537 @end table
11538
11539 @subsection Examples
11540
11541 @itemize
11542 @item
11543 Loop single first frame infinitely:
11544 @example
11545 loop=loop=-1:size=1:start=0
11546 @end example
11547
11548 @item
11549 Loop single first frame 10 times:
11550 @example
11551 loop=loop=10:size=1:start=0
11552 @end example
11553
11554 @item
11555 Loop 10 first frames 5 times:
11556 @example
11557 loop=loop=5:size=10:start=0
11558 @end example
11559 @end itemize
11560
11561 @section lut1d
11562
11563 Apply a 1D LUT to an input video.
11564
11565 The filter accepts the following options:
11566
11567 @table @option
11568 @item file
11569 Set the 1D LUT file name.
11570
11571 Currently supported formats:
11572 @table @samp
11573 @item cube
11574 Iridas
11575 @end table
11576
11577 @item interp
11578 Select interpolation mode.
11579
11580 Available values are:
11581
11582 @table @samp
11583 @item nearest
11584 Use values from the nearest defined point.
11585 @item linear
11586 Interpolate values using the linear interpolation.
11587 @item cosine
11588 Interpolate values using the cosine interpolation.
11589 @item cubic
11590 Interpolate values using the cubic interpolation.
11591 @item spline
11592 Interpolate values using the spline interpolation.
11593 @end table
11594 @end table
11595
11596 @anchor{lut3d}
11597 @section lut3d
11598
11599 Apply a 3D LUT to an input video.
11600
11601 The filter accepts the following options:
11602
11603 @table @option
11604 @item file
11605 Set the 3D LUT file name.
11606
11607 Currently supported formats:
11608 @table @samp
11609 @item 3dl
11610 AfterEffects
11611 @item cube
11612 Iridas
11613 @item dat
11614 DaVinci
11615 @item m3d
11616 Pandora
11617 @end table
11618 @item interp
11619 Select interpolation mode.
11620
11621 Available values are:
11622
11623 @table @samp
11624 @item nearest
11625 Use values from the nearest defined point.
11626 @item trilinear
11627 Interpolate values using the 8 points defining a cube.
11628 @item tetrahedral
11629 Interpolate values using a tetrahedron.
11630 @end table
11631 @end table
11632
11633 This filter also supports the @ref{framesync} options.
11634
11635 @section lumakey
11636
11637 Turn certain luma values into transparency.
11638
11639 The filter accepts the following options:
11640
11641 @table @option
11642 @item threshold
11643 Set the luma which will be used as base for transparency.
11644 Default value is @code{0}.
11645
11646 @item tolerance
11647 Set the range of luma values to be keyed out.
11648 Default value is @code{0}.
11649
11650 @item softness
11651 Set the range of softness. Default value is @code{0}.
11652 Use this to control gradual transition from zero to full transparency.
11653 @end table
11654
11655 @section lut, lutrgb, lutyuv
11656
11657 Compute a look-up table for binding each pixel component input value
11658 to an output value, and apply it to the input video.
11659
11660 @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
11661 to an RGB input video.
11662
11663 These filters accept the following parameters:
11664 @table @option
11665 @item c0
11666 set first pixel component expression
11667 @item c1
11668 set second pixel component expression
11669 @item c2
11670 set third pixel component expression
11671 @item c3
11672 set fourth pixel component expression, corresponds to the alpha component
11673
11674 @item r
11675 set red component expression
11676 @item g
11677 set green component expression
11678 @item b
11679 set blue component expression
11680 @item a
11681 alpha component expression
11682
11683 @item y
11684 set Y/luminance component expression
11685 @item u
11686 set U/Cb component expression
11687 @item v
11688 set V/Cr component expression
11689 @end table
11690
11691 Each of them specifies the expression to use for computing the lookup table for
11692 the corresponding pixel component values.
11693
11694 The exact component associated to each of the @var{c*} options depends on the
11695 format in input.
11696
11697 The @var{lut} filter requires either YUV or RGB pixel formats in input,
11698 @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
11699
11700 The expressions can contain the following constants and functions:
11701
11702 @table @option
11703 @item w
11704 @item h
11705 The input width and height.
11706
11707 @item val
11708 The input value for the pixel component.
11709
11710 @item clipval
11711 The input value, clipped to the @var{minval}-@var{maxval} range.
11712
11713 @item maxval
11714 The maximum value for the pixel component.
11715
11716 @item minval
11717 The minimum value for the pixel component.
11718
11719 @item negval
11720 The negated value for the pixel component value, clipped to the
11721 @var{minval}-@var{maxval} range; it corresponds to the expression
11722 "maxval-clipval+minval".
11723
11724 @item clip(val)
11725 The computed value in @var{val}, clipped to the
11726 @var{minval}-@var{maxval} range.
11727
11728 @item gammaval(gamma)
11729 The computed gamma correction value of the pixel component value,
11730 clipped to the @var{minval}-@var{maxval} range. It corresponds to the
11731 expression
11732 "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
11733
11734 @end table
11735
11736 All expressions default to "val".
11737
11738 @subsection Examples
11739
11740 @itemize
11741 @item
11742 Negate input video:
11743 @example
11744 lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
11745 lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
11746 @end example
11747
11748 The above is the same as:
11749 @example
11750 lutrgb="r=negval:g=negval:b=negval"
11751 lutyuv="y=negval:u=negval:v=negval"
11752 @end example
11753
11754 @item
11755 Negate luminance:
11756 @example
11757 lutyuv=y=negval
11758 @end example
11759
11760 @item
11761 Remove chroma components, turning the video into a graytone image:
11762 @example
11763 lutyuv="u=128:v=128"
11764 @end example
11765
11766 @item
11767 Apply a luma burning effect:
11768 @example
11769 lutyuv="y=2*val"
11770 @end example
11771
11772 @item
11773 Remove green and blue components:
11774 @example
11775 lutrgb="g=0:b=0"
11776 @end example
11777
11778 @item
11779 Set a constant alpha channel value on input:
11780 @example
11781 format=rgba,lutrgb=a="maxval-minval/2"
11782 @end example
11783
11784 @item
11785 Correct luminance gamma by a factor of 0.5:
11786 @example
11787 lutyuv=y=gammaval(0.5)
11788 @end example
11789
11790 @item
11791 Discard least significant bits of luma:
11792 @example
11793 lutyuv=y='bitand(val, 128+64+32)'
11794 @end example
11795
11796 @item
11797 Technicolor like effect:
11798 @example
11799 lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
11800 @end example
11801 @end itemize
11802
11803 @section lut2, tlut2
11804
11805 The @code{lut2} filter takes two input streams and outputs one
11806 stream.
11807
11808 The @code{tlut2} (time lut2) filter takes two consecutive frames
11809 from one single stream.
11810
11811 This filter accepts the following parameters:
11812 @table @option
11813 @item c0
11814 set first pixel component expression
11815 @item c1
11816 set second pixel component expression
11817 @item c2
11818 set third pixel component expression
11819 @item c3
11820 set fourth pixel component expression, corresponds to the alpha component
11821
11822 @item d
11823 set output bit depth, only available for @code{lut2} filter. By default is 0,
11824 which means bit depth is automatically picked from first input format.
11825 @end table
11826
11827 Each of them specifies the expression to use for computing the lookup table for
11828 the corresponding pixel component values.
11829
11830 The exact component associated to each of the @var{c*} options depends on the
11831 format in inputs.
11832
11833 The expressions can contain the following constants:
11834
11835 @table @option
11836 @item w
11837 @item h
11838 The input width and height.
11839
11840 @item x
11841 The first input value for the pixel component.
11842
11843 @item y
11844 The second input value for the pixel component.
11845
11846 @item bdx
11847 The first input video bit depth.
11848
11849 @item bdy
11850 The second input video bit depth.
11851 @end table
11852
11853 All expressions default to "x".
11854
11855 @subsection Examples
11856
11857 @itemize
11858 @item
11859 Highlight differences between two RGB video streams:
11860 @example
11861 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)'
11862 @end example
11863
11864 @item
11865 Highlight differences between two YUV video streams:
11866 @example
11867 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)'
11868 @end example
11869
11870 @item
11871 Show max difference between two video streams:
11872 @example
11873 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)))'
11874 @end example
11875 @end itemize
11876
11877 @section maskedclamp
11878
11879 Clamp the first input stream with the second input and third input stream.
11880
11881 Returns the value of first stream to be between second input
11882 stream - @code{undershoot} and third input stream + @code{overshoot}.
11883
11884 This filter accepts the following options:
11885 @table @option
11886 @item undershoot
11887 Default value is @code{0}.
11888
11889 @item overshoot
11890 Default value is @code{0}.
11891
11892 @item planes
11893 Set which planes will be processed as bitmap, unprocessed planes will be
11894 copied from first stream.
11895 By default value 0xf, all planes will be processed.
11896 @end table
11897
11898 @section maskedmerge
11899
11900 Merge the first input stream with the second input stream using per pixel
11901 weights in the third input stream.
11902
11903 A value of 0 in the third stream pixel component means that pixel component
11904 from first stream is returned unchanged, while maximum value (eg. 255 for
11905 8-bit videos) means that pixel component from second stream is returned
11906 unchanged. Intermediate values define the amount of merging between both
11907 input stream's pixel components.
11908
11909 This filter accepts the following options:
11910 @table @option
11911 @item planes
11912 Set which planes will be processed as bitmap, unprocessed planes will be
11913 copied from first stream.
11914 By default value 0xf, all planes will be processed.
11915 @end table
11916
11917 @section mcdeint
11918
11919 Apply motion-compensation deinterlacing.
11920
11921 It needs one field per frame as input and must thus be used together
11922 with yadif=1/3 or equivalent.
11923
11924 This filter accepts the following options:
11925 @table @option
11926 @item mode
11927 Set the deinterlacing mode.
11928
11929 It accepts one of the following values:
11930 @table @samp
11931 @item fast
11932 @item medium
11933 @item slow
11934 use iterative motion estimation
11935 @item extra_slow
11936 like @samp{slow}, but use multiple reference frames.
11937 @end table
11938 Default value is @samp{fast}.
11939
11940 @item parity
11941 Set the picture field parity assumed for the input video. It must be
11942 one of the following values:
11943
11944 @table @samp
11945 @item 0, tff
11946 assume top field first
11947 @item 1, bff
11948 assume bottom field first
11949 @end table
11950
11951 Default value is @samp{bff}.
11952
11953 @item qp
11954 Set per-block quantization parameter (QP) used by the internal
11955 encoder.
11956
11957 Higher values should result in a smoother motion vector field but less
11958 optimal individual vectors. Default value is 1.
11959 @end table
11960
11961 @section mergeplanes
11962
11963 Merge color channel components from several video streams.
11964
11965 The filter accepts up to 4 input streams, and merge selected input
11966 planes to the output video.
11967
11968 This filter accepts the following options:
11969 @table @option
11970 @item mapping
11971 Set input to output plane mapping. Default is @code{0}.
11972
11973 The mappings is specified as a bitmap. It should be specified as a
11974 hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
11975 mapping for the first plane of the output stream. 'A' sets the number of
11976 the input stream to use (from 0 to 3), and 'a' the plane number of the
11977 corresponding input to use (from 0 to 3). The rest of the mappings is
11978 similar, 'Bb' describes the mapping for the output stream second
11979 plane, 'Cc' describes the mapping for the output stream third plane and
11980 'Dd' describes the mapping for the output stream fourth plane.
11981
11982 @item format
11983 Set output pixel format. Default is @code{yuva444p}.
11984 @end table
11985
11986 @subsection Examples
11987
11988 @itemize
11989 @item
11990 Merge three gray video streams of same width and height into single video stream:
11991 @example
11992 [a0][a1][a2]mergeplanes=0x001020:yuv444p
11993 @end example
11994
11995 @item
11996 Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
11997 @example
11998 [a0][a1]mergeplanes=0x00010210:yuva444p
11999 @end example
12000
12001 @item
12002 Swap Y and A plane in yuva444p stream:
12003 @example
12004 format=yuva444p,mergeplanes=0x03010200:yuva444p
12005 @end example
12006
12007 @item
12008 Swap U and V plane in yuv420p stream:
12009 @example
12010 format=yuv420p,mergeplanes=0x000201:yuv420p
12011 @end example
12012
12013 @item
12014 Cast a rgb24 clip to yuv444p:
12015 @example
12016 format=rgb24,mergeplanes=0x000102:yuv444p
12017 @end example
12018 @end itemize
12019
12020 @section mestimate
12021
12022 Estimate and export motion vectors using block matching algorithms.
12023 Motion vectors are stored in frame side data to be used by other filters.
12024
12025 This filter accepts the following options:
12026 @table @option
12027 @item method
12028 Specify the motion estimation method. Accepts one of the following values:
12029
12030 @table @samp
12031 @item esa
12032 Exhaustive search algorithm.
12033 @item tss
12034 Three step search algorithm.
12035 @item tdls
12036 Two dimensional logarithmic search algorithm.
12037 @item ntss
12038 New three step search algorithm.
12039 @item fss
12040 Four step search algorithm.
12041 @item ds
12042 Diamond search algorithm.
12043 @item hexbs
12044 Hexagon-based search algorithm.
12045 @item epzs
12046 Enhanced predictive zonal search algorithm.
12047 @item umh
12048 Uneven multi-hexagon search algorithm.
12049 @end table
12050 Default value is @samp{esa}.
12051
12052 @item mb_size
12053 Macroblock size. Default @code{16}.
12054
12055 @item search_param
12056 Search parameter. Default @code{7}.
12057 @end table
12058
12059 @section midequalizer
12060
12061 Apply Midway Image Equalization effect using two video streams.
12062
12063 Midway Image Equalization adjusts a pair of images to have the same
12064 histogram, while maintaining their dynamics as much as possible. It's
12065 useful for e.g. matching exposures from a pair of stereo cameras.
12066
12067 This filter has two inputs and one output, which must be of same pixel format, but
12068 may be of different sizes. The output of filter is first input adjusted with
12069 midway histogram of both inputs.
12070
12071 This filter accepts the following option:
12072
12073 @table @option
12074 @item planes
12075 Set which planes to process. Default is @code{15}, which is all available planes.
12076 @end table
12077
12078 @section minterpolate
12079
12080 Convert the video to specified frame rate using motion interpolation.
12081
12082 This filter accepts the following options:
12083 @table @option
12084 @item fps
12085 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}.
12086
12087 @item mi_mode
12088 Motion interpolation mode. Following values are accepted:
12089 @table @samp
12090 @item dup
12091 Duplicate previous or next frame for interpolating new ones.
12092 @item blend
12093 Blend source frames. Interpolated frame is mean of previous and next frames.
12094 @item mci
12095 Motion compensated interpolation. Following options are effective when this mode is selected:
12096
12097 @table @samp
12098 @item mc_mode
12099 Motion compensation mode. Following values are accepted:
12100 @table @samp
12101 @item obmc
12102 Overlapped block motion compensation.
12103 @item aobmc
12104 Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
12105 @end table
12106 Default mode is @samp{obmc}.
12107
12108 @item me_mode
12109 Motion estimation mode. Following values are accepted:
12110 @table @samp
12111 @item bidir
12112 Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
12113 @item bilat
12114 Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
12115 @end table
12116 Default mode is @samp{bilat}.
12117
12118 @item me
12119 The algorithm to be used for motion estimation. Following values are accepted:
12120 @table @samp
12121 @item esa
12122 Exhaustive search algorithm.
12123 @item tss
12124 Three step search algorithm.
12125 @item tdls
12126 Two dimensional logarithmic search algorithm.
12127 @item ntss
12128 New three step search algorithm.
12129 @item fss
12130 Four step search algorithm.
12131 @item ds
12132 Diamond search algorithm.
12133 @item hexbs
12134 Hexagon-based search algorithm.
12135 @item epzs
12136 Enhanced predictive zonal search algorithm.
12137 @item umh
12138 Uneven multi-hexagon search algorithm.
12139 @end table
12140 Default algorithm is @samp{epzs}.
12141
12142 @item mb_size
12143 Macroblock size. Default @code{16}.
12144
12145 @item search_param
12146 Motion estimation search parameter. Default @code{32}.
12147
12148 @item vsbmc
12149 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).
12150 @end table
12151 @end table
12152
12153 @item scd
12154 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:
12155 @table @samp
12156 @item none
12157 Disable scene change detection.
12158 @item fdiff
12159 Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
12160 @end table
12161 Default method is @samp{fdiff}.
12162
12163 @item scd_threshold
12164 Scene change detection threshold. Default is @code{5.0}.
12165 @end table
12166
12167 @section mix
12168
12169 Mix several video input streams into one video stream.
12170
12171 A description of the accepted options follows.
12172
12173 @table @option
12174 @item nb_inputs
12175 The number of inputs. If unspecified, it defaults to 2.
12176
12177 @item weights
12178 Specify weight of each input video stream as sequence.
12179 Each weight is separated by space. If number of weights
12180 is smaller than number of @var{frames} last specified
12181 weight will be used for all remaining unset weights.
12182
12183 @item scale
12184 Specify scale, if it is set it will be multiplied with sum
12185 of each weight multiplied with pixel values to give final destination
12186 pixel value. By default @var{scale} is auto scaled to sum of weights.
12187
12188 @item duration
12189 Specify how end of stream is determined.
12190 @table @samp
12191 @item longest
12192 The duration of the longest input. (default)
12193
12194 @item shortest
12195 The duration of the shortest input.
12196
12197 @item first
12198 The duration of the first input.
12199 @end table
12200 @end table
12201
12202 @section mpdecimate
12203
12204 Drop frames that do not differ greatly from the previous frame in
12205 order to reduce frame rate.
12206
12207 The main use of this filter is for very-low-bitrate encoding
12208 (e.g. streaming over dialup modem), but it could in theory be used for
12209 fixing movies that were inverse-telecined incorrectly.
12210
12211 A description of the accepted options follows.
12212
12213 @table @option
12214 @item max
12215 Set the maximum number of consecutive frames which can be dropped (if
12216 positive), or the minimum interval between dropped frames (if
12217 negative). If the value is 0, the frame is dropped disregarding the
12218 number of previous sequentially dropped frames.
12219
12220 Default value is 0.
12221
12222 @item hi
12223 @item lo
12224 @item frac
12225 Set the dropping threshold values.
12226
12227 Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
12228 represent actual pixel value differences, so a threshold of 64
12229 corresponds to 1 unit of difference for each pixel, or the same spread
12230 out differently over the block.
12231
12232 A frame is a candidate for dropping if no 8x8 blocks differ by more
12233 than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
12234 meaning the whole image) differ by more than a threshold of @option{lo}.
12235
12236 Default value for @option{hi} is 64*12, default value for @option{lo} is
12237 64*5, and default value for @option{frac} is 0.33.
12238 @end table
12239
12240
12241 @section negate
12242
12243 Negate (invert) the input video.
12244
12245 It accepts the following option:
12246
12247 @table @option
12248
12249 @item negate_alpha
12250 With value 1, it negates the alpha component, if present. Default value is 0.
12251 @end table
12252
12253 @anchor{nlmeans}
12254 @section nlmeans
12255
12256 Denoise frames using Non-Local Means algorithm.
12257
12258 Each pixel is adjusted by looking for other pixels with similar contexts. This
12259 context similarity is defined by comparing their surrounding patches of size
12260 @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
12261 around the pixel.
12262
12263 Note that the research area defines centers for patches, which means some
12264 patches will be made of pixels outside that research area.
12265
12266 The filter accepts the following options.
12267
12268 @table @option
12269 @item s
12270 Set denoising strength.
12271
12272 @item p
12273 Set patch size.
12274
12275 @item pc
12276 Same as @option{p} but for chroma planes.
12277
12278 The default value is @var{0} and means automatic.
12279
12280 @item r
12281 Set research size.
12282
12283 @item rc
12284 Same as @option{r} but for chroma planes.
12285
12286 The default value is @var{0} and means automatic.
12287 @end table
12288
12289 @section nnedi
12290
12291 Deinterlace video using neural network edge directed interpolation.
12292
12293 This filter accepts the following options:
12294
12295 @table @option
12296 @item weights
12297 Mandatory option, without binary file filter can not work.
12298 Currently file can be found here:
12299 https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
12300
12301 @item deint
12302 Set which frames to deinterlace, by default it is @code{all}.
12303 Can be @code{all} or @code{interlaced}.
12304
12305 @item field
12306 Set mode of operation.
12307
12308 Can be one of the following:
12309
12310 @table @samp
12311 @item af
12312 Use frame flags, both fields.
12313 @item a
12314 Use frame flags, single field.
12315 @item t
12316 Use top field only.
12317 @item b
12318 Use bottom field only.
12319 @item tf
12320 Use both fields, top first.
12321 @item bf
12322 Use both fields, bottom first.
12323 @end table
12324
12325 @item planes
12326 Set which planes to process, by default filter process all frames.
12327
12328 @item nsize
12329 Set size of local neighborhood around each pixel, used by the predictor neural
12330 network.
12331
12332 Can be one of the following:
12333
12334 @table @samp
12335 @item s8x6
12336 @item s16x6
12337 @item s32x6
12338 @item s48x6
12339 @item s8x4
12340 @item s16x4
12341 @item s32x4
12342 @end table
12343
12344 @item nns
12345 Set the number of neurons in predictor neural network.
12346 Can be one of the following:
12347
12348 @table @samp
12349 @item n16
12350 @item n32
12351 @item n64
12352 @item n128
12353 @item n256
12354 @end table
12355
12356 @item qual
12357 Controls the number of different neural network predictions that are blended
12358 together to compute the final output value. Can be @code{fast}, default or
12359 @code{slow}.
12360
12361 @item etype
12362 Set which set of weights to use in the predictor.
12363 Can be one of the following:
12364
12365 @table @samp
12366 @item a
12367 weights trained to minimize absolute error
12368 @item s
12369 weights trained to minimize squared error
12370 @end table
12371
12372 @item pscrn
12373 Controls whether or not the prescreener neural network is used to decide
12374 which pixels should be processed by the predictor neural network and which
12375 can be handled by simple cubic interpolation.
12376 The prescreener is trained to know whether cubic interpolation will be
12377 sufficient for a pixel or whether it should be predicted by the predictor nn.
12378 The computational complexity of the prescreener nn is much less than that of
12379 the predictor nn. Since most pixels can be handled by cubic interpolation,
12380 using the prescreener generally results in much faster processing.
12381 The prescreener is pretty accurate, so the difference between using it and not
12382 using it is almost always unnoticeable.
12383
12384 Can be one of the following:
12385
12386 @table @samp
12387 @item none
12388 @item original
12389 @item new
12390 @end table
12391
12392 Default is @code{new}.
12393
12394 @item fapprox
12395 Set various debugging flags.
12396 @end table
12397
12398 @section noformat
12399
12400 Force libavfilter not to use any of the specified pixel formats for the
12401 input to the next filter.
12402
12403 It accepts the following parameters:
12404 @table @option
12405
12406 @item pix_fmts
12407 A '|'-separated list of pixel format names, such as
12408 pix_fmts=yuv420p|monow|rgb24".
12409
12410 @end table
12411
12412 @subsection Examples
12413
12414 @itemize
12415 @item
12416 Force libavfilter to use a format different from @var{yuv420p} for the
12417 input to the vflip filter:
12418 @example
12419 noformat=pix_fmts=yuv420p,vflip
12420 @end example
12421
12422 @item
12423 Convert the input video to any of the formats not contained in the list:
12424 @example
12425 noformat=yuv420p|yuv444p|yuv410p
12426 @end example
12427 @end itemize
12428
12429 @section noise
12430
12431 Add noise on video input frame.
12432
12433 The filter accepts the following options:
12434
12435 @table @option
12436 @item all_seed
12437 @item c0_seed
12438 @item c1_seed
12439 @item c2_seed
12440 @item c3_seed
12441 Set noise seed for specific pixel component or all pixel components in case
12442 of @var{all_seed}. Default value is @code{123457}.
12443
12444 @item all_strength, alls
12445 @item c0_strength, c0s
12446 @item c1_strength, c1s
12447 @item c2_strength, c2s
12448 @item c3_strength, c3s
12449 Set noise strength for specific pixel component or all pixel components in case
12450 @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
12451
12452 @item all_flags, allf
12453 @item c0_flags, c0f
12454 @item c1_flags, c1f
12455 @item c2_flags, c2f
12456 @item c3_flags, c3f
12457 Set pixel component flags or set flags for all components if @var{all_flags}.
12458 Available values for component flags are:
12459 @table @samp
12460 @item a
12461 averaged temporal noise (smoother)
12462 @item p
12463 mix random noise with a (semi)regular pattern
12464 @item t
12465 temporal noise (noise pattern changes between frames)
12466 @item u
12467 uniform noise (gaussian otherwise)
12468 @end table
12469 @end table
12470
12471 @subsection Examples
12472
12473 Add temporal and uniform noise to input video:
12474 @example
12475 noise=alls=20:allf=t+u
12476 @end example
12477
12478 @section normalize
12479
12480 Normalize RGB video (aka histogram stretching, contrast stretching).
12481 See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
12482
12483 For each channel of each frame, the filter computes the input range and maps
12484 it linearly to the user-specified output range. The output range defaults
12485 to the full dynamic range from pure black to pure white.
12486
12487 Temporal smoothing can be used on the input range to reduce flickering (rapid
12488 changes in brightness) caused when small dark or bright objects enter or leave
12489 the scene. This is similar to the auto-exposure (automatic gain control) on a
12490 video camera, and, like a video camera, it may cause a period of over- or
12491 under-exposure of the video.
12492
12493 The R,G,B channels can be normalized independently, which may cause some
12494 color shifting, or linked together as a single channel, which prevents
12495 color shifting. Linked normalization preserves hue. Independent normalization
12496 does not, so it can be used to remove some color casts. Independent and linked
12497 normalization can be combined in any ratio.
12498
12499 The normalize filter accepts the following options:
12500
12501 @table @option
12502 @item blackpt
12503 @item whitept
12504 Colors which define the output range. The minimum input value is mapped to
12505 the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
12506 The defaults are black and white respectively. Specifying white for
12507 @var{blackpt} and black for @var{whitept} will give color-inverted,
12508 normalized video. Shades of grey can be used to reduce the dynamic range
12509 (contrast). Specifying saturated colors here can create some interesting
12510 effects.
12511
12512 @item smoothing
12513 The number of previous frames to use for temporal smoothing. The input range
12514 of each channel is smoothed using a rolling average over the current frame
12515 and the @var{smoothing} previous frames. The default is 0 (no temporal
12516 smoothing).
12517
12518 @item independence
12519 Controls the ratio of independent (color shifting) channel normalization to
12520 linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
12521 independent. Defaults to 1.0 (fully independent).
12522
12523 @item strength
12524 Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
12525 expensive no-op. Defaults to 1.0 (full strength).
12526
12527 @end table
12528
12529 @subsection Examples
12530
12531 Stretch video contrast to use the full dynamic range, with no temporal
12532 smoothing; may flicker depending on the source content:
12533 @example
12534 normalize=blackpt=black:whitept=white:smoothing=0
12535 @end example
12536
12537 As above, but with 50 frames of temporal smoothing; flicker should be
12538 reduced, depending on the source content:
12539 @example
12540 normalize=blackpt=black:whitept=white:smoothing=50
12541 @end example
12542
12543 As above, but with hue-preserving linked channel normalization:
12544 @example
12545 normalize=blackpt=black:whitept=white:smoothing=50:independence=0
12546 @end example
12547
12548 As above, but with half strength:
12549 @example
12550 normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
12551 @end example
12552
12553 Map the darkest input color to red, the brightest input color to cyan:
12554 @example
12555 normalize=blackpt=red:whitept=cyan
12556 @end example
12557
12558 @section null
12559
12560 Pass the video source unchanged to the output.
12561
12562 @section ocr
12563 Optical Character Recognition
12564
12565 This filter uses Tesseract for optical character recognition. To enable
12566 compilation of this filter, you need to configure FFmpeg with
12567 @code{--enable-libtesseract}.
12568
12569 It accepts the following options:
12570
12571 @table @option
12572 @item datapath
12573 Set datapath to tesseract data. Default is to use whatever was
12574 set at installation.
12575
12576 @item language
12577 Set language, default is "eng".
12578
12579 @item whitelist
12580 Set character whitelist.
12581
12582 @item blacklist
12583 Set character blacklist.
12584 @end table
12585
12586 The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
12587
12588 @section ocv
12589
12590 Apply a video transform using libopencv.
12591
12592 To enable this filter, install the libopencv library and headers and
12593 configure FFmpeg with @code{--enable-libopencv}.
12594
12595 It accepts the following parameters:
12596
12597 @table @option
12598
12599 @item filter_name
12600 The name of the libopencv filter to apply.
12601
12602 @item filter_params
12603 The parameters to pass to the libopencv filter. If not specified, the default
12604 values are assumed.
12605
12606 @end table
12607
12608 Refer to the official libopencv documentation for more precise
12609 information:
12610 @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
12611
12612 Several libopencv filters are supported; see the following subsections.
12613
12614 @anchor{dilate}
12615 @subsection dilate
12616
12617 Dilate an image by using a specific structuring element.
12618 It corresponds to the libopencv function @code{cvDilate}.
12619
12620 It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
12621
12622 @var{struct_el} represents a structuring element, and has the syntax:
12623 @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
12624
12625 @var{cols} and @var{rows} represent the number of columns and rows of
12626 the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
12627 point, and @var{shape} the shape for the structuring element. @var{shape}
12628 must be "rect", "cross", "ellipse", or "custom".
12629
12630 If the value for @var{shape} is "custom", it must be followed by a
12631 string of the form "=@var{filename}". The file with name
12632 @var{filename} is assumed to represent a binary image, with each
12633 printable character corresponding to a bright pixel. When a custom
12634 @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
12635 or columns and rows of the read file are assumed instead.
12636
12637 The default value for @var{struct_el} is "3x3+0x0/rect".
12638
12639 @var{nb_iterations} specifies the number of times the transform is
12640 applied to the image, and defaults to 1.
12641
12642 Some examples:
12643 @example
12644 # Use the default values
12645 ocv=dilate
12646
12647 # Dilate using a structuring element with a 5x5 cross, iterating two times
12648 ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
12649
12650 # Read the shape from the file diamond.shape, iterating two times.
12651 # The file diamond.shape may contain a pattern of characters like this
12652 #   *
12653 #  ***
12654 # *****
12655 #  ***
12656 #   *
12657 # The specified columns and rows are ignored
12658 # but the anchor point coordinates are not
12659 ocv=dilate:0x0+2x2/custom=diamond.shape|2
12660 @end example
12661
12662 @subsection erode
12663
12664 Erode an image by using a specific structuring element.
12665 It corresponds to the libopencv function @code{cvErode}.
12666
12667 It accepts the parameters: @var{struct_el}:@var{nb_iterations},
12668 with the same syntax and semantics as the @ref{dilate} filter.
12669
12670 @subsection smooth
12671
12672 Smooth the input video.
12673
12674 The filter takes the following parameters:
12675 @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
12676
12677 @var{type} is the type of smooth filter to apply, and must be one of
12678 the following values: "blur", "blur_no_scale", "median", "gaussian",
12679 or "bilateral". The default value is "gaussian".
12680
12681 The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
12682 depend on the smooth type. @var{param1} and
12683 @var{param2} accept integer positive values or 0. @var{param3} and
12684 @var{param4} accept floating point values.
12685
12686 The default value for @var{param1} is 3. The default value for the
12687 other parameters is 0.
12688
12689 These parameters correspond to the parameters assigned to the
12690 libopencv function @code{cvSmooth}.
12691
12692 @section oscilloscope
12693
12694 2D Video Oscilloscope.
12695
12696 Useful to measure spatial impulse, step responses, chroma delays, etc.
12697
12698 It accepts the following parameters:
12699
12700 @table @option
12701 @item x
12702 Set scope center x position.
12703
12704 @item y
12705 Set scope center y position.
12706
12707 @item s
12708 Set scope size, relative to frame diagonal.
12709
12710 @item t
12711 Set scope tilt/rotation.
12712
12713 @item o
12714 Set trace opacity.
12715
12716 @item tx
12717 Set trace center x position.
12718
12719 @item ty
12720 Set trace center y position.
12721
12722 @item tw
12723 Set trace width, relative to width of frame.
12724
12725 @item th
12726 Set trace height, relative to height of frame.
12727
12728 @item c
12729 Set which components to trace. By default it traces first three components.
12730
12731 @item g
12732 Draw trace grid. By default is enabled.
12733
12734 @item st
12735 Draw some statistics. By default is enabled.
12736
12737 @item sc
12738 Draw scope. By default is enabled.
12739 @end table
12740
12741 @subsection Examples
12742
12743 @itemize
12744 @item
12745 Inspect full first row of video frame.
12746 @example
12747 oscilloscope=x=0.5:y=0:s=1
12748 @end example
12749
12750 @item
12751 Inspect full last row of video frame.
12752 @example
12753 oscilloscope=x=0.5:y=1:s=1
12754 @end example
12755
12756 @item
12757 Inspect full 5th line of video frame of height 1080.
12758 @example
12759 oscilloscope=x=0.5:y=5/1080:s=1
12760 @end example
12761
12762 @item
12763 Inspect full last column of video frame.
12764 @example
12765 oscilloscope=x=1:y=0.5:s=1:t=1
12766 @end example
12767
12768 @end itemize
12769
12770 @anchor{overlay}
12771 @section overlay
12772
12773 Overlay one video on top of another.
12774
12775 It takes two inputs and has one output. The first input is the "main"
12776 video on which the second input is overlaid.
12777
12778 It accepts the following parameters:
12779
12780 A description of the accepted options follows.
12781
12782 @table @option
12783 @item x
12784 @item y
12785 Set the expression for the x and y coordinates of the overlaid video
12786 on the main video. Default value is "0" for both expressions. In case
12787 the expression is invalid, it is set to a huge value (meaning that the
12788 overlay will not be displayed within the output visible area).
12789
12790 @item eof_action
12791 See @ref{framesync}.
12792
12793 @item eval
12794 Set when the expressions for @option{x}, and @option{y} are evaluated.
12795
12796 It accepts the following values:
12797 @table @samp
12798 @item init
12799 only evaluate expressions once during the filter initialization or
12800 when a command is processed
12801
12802 @item frame
12803 evaluate expressions for each incoming frame
12804 @end table
12805
12806 Default value is @samp{frame}.
12807
12808 @item shortest
12809 See @ref{framesync}.
12810
12811 @item format
12812 Set the format for the output video.
12813
12814 It accepts the following values:
12815 @table @samp
12816 @item yuv420
12817 force YUV420 output
12818
12819 @item yuv422
12820 force YUV422 output
12821
12822 @item yuv444
12823 force YUV444 output
12824
12825 @item rgb
12826 force packed RGB output
12827
12828 @item gbrp
12829 force planar RGB output
12830
12831 @item auto
12832 automatically pick format
12833 @end table
12834
12835 Default value is @samp{yuv420}.
12836
12837 @item repeatlast
12838 See @ref{framesync}.
12839
12840 @item alpha
12841 Set format of alpha of the overlaid video, it can be @var{straight} or
12842 @var{premultiplied}. Default is @var{straight}.
12843 @end table
12844
12845 The @option{x}, and @option{y} expressions can contain the following
12846 parameters.
12847
12848 @table @option
12849 @item main_w, W
12850 @item main_h, H
12851 The main input width and height.
12852
12853 @item overlay_w, w
12854 @item overlay_h, h
12855 The overlay input width and height.
12856
12857 @item x
12858 @item y
12859 The computed values for @var{x} and @var{y}. They are evaluated for
12860 each new frame.
12861
12862 @item hsub
12863 @item vsub
12864 horizontal and vertical chroma subsample values of the output
12865 format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
12866 @var{vsub} is 1.
12867
12868 @item n
12869 the number of input frame, starting from 0
12870
12871 @item pos
12872 the position in the file of the input frame, NAN if unknown
12873
12874 @item t
12875 The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
12876
12877 @end table
12878
12879 This filter also supports the @ref{framesync} options.
12880
12881 Note that the @var{n}, @var{pos}, @var{t} variables are available only
12882 when evaluation is done @emph{per frame}, and will evaluate to NAN
12883 when @option{eval} is set to @samp{init}.
12884
12885 Be aware that frames are taken from each input video in timestamp
12886 order, hence, if their initial timestamps differ, it is a good idea
12887 to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
12888 have them begin in the same zero timestamp, as the example for
12889 the @var{movie} filter does.
12890
12891 You can chain together more overlays but you should test the
12892 efficiency of such approach.
12893
12894 @subsection Commands
12895
12896 This filter supports the following commands:
12897 @table @option
12898 @item x
12899 @item y
12900 Modify the x and y of the overlay input.
12901 The command accepts the same syntax of the corresponding option.
12902
12903 If the specified expression is not valid, it is kept at its current
12904 value.
12905 @end table
12906
12907 @subsection Examples
12908
12909 @itemize
12910 @item
12911 Draw the overlay at 10 pixels from the bottom right corner of the main
12912 video:
12913 @example
12914 overlay=main_w-overlay_w-10:main_h-overlay_h-10
12915 @end example
12916
12917 Using named options the example above becomes:
12918 @example
12919 overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
12920 @end example
12921
12922 @item
12923 Insert a transparent PNG logo in the bottom left corner of the input,
12924 using the @command{ffmpeg} tool with the @code{-filter_complex} option:
12925 @example
12926 ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
12927 @end example
12928
12929 @item
12930 Insert 2 different transparent PNG logos (second logo on bottom
12931 right corner) using the @command{ffmpeg} tool:
12932 @example
12933 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
12934 @end example
12935
12936 @item
12937 Add a transparent color layer on top of the main video; @code{WxH}
12938 must specify the size of the main input to the overlay filter:
12939 @example
12940 color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
12941 @end example
12942
12943 @item
12944 Play an original video and a filtered version (here with the deshake
12945 filter) side by side using the @command{ffplay} tool:
12946 @example
12947 ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
12948 @end example
12949
12950 The above command is the same as:
12951 @example
12952 ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
12953 @end example
12954
12955 @item
12956 Make a sliding overlay appearing from the left to the right top part of the
12957 screen starting since time 2:
12958 @example
12959 overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
12960 @end example
12961
12962 @item
12963 Compose output by putting two input videos side to side:
12964 @example
12965 ffmpeg -i left.avi -i right.avi -filter_complex "
12966 nullsrc=size=200x100 [background];
12967 [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
12968 [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
12969 [background][left]       overlay=shortest=1       [background+left];
12970 [background+left][right] overlay=shortest=1:x=100 [left+right]
12971 "
12972 @end example
12973
12974 @item
12975 Mask 10-20 seconds of a video by applying the delogo filter to a section
12976 @example
12977 ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
12978 -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]'
12979 masked.avi
12980 @end example
12981
12982 @item
12983 Chain several overlays in cascade:
12984 @example
12985 nullsrc=s=200x200 [bg];
12986 testsrc=s=100x100, split=4 [in0][in1][in2][in3];
12987 [in0] lutrgb=r=0, [bg]   overlay=0:0     [mid0];
12988 [in1] lutrgb=g=0, [mid0] overlay=100:0   [mid1];
12989 [in2] lutrgb=b=0, [mid1] overlay=0:100   [mid2];
12990 [in3] null,       [mid2] overlay=100:100 [out0]
12991 @end example
12992
12993 @end itemize
12994
12995 @section owdenoise
12996
12997 Apply Overcomplete Wavelet denoiser.
12998
12999 The filter accepts the following options:
13000
13001 @table @option
13002 @item depth
13003 Set depth.
13004
13005 Larger depth values will denoise lower frequency components more, but
13006 slow down filtering.
13007
13008 Must be an int in the range 8-16, default is @code{8}.
13009
13010 @item luma_strength, ls
13011 Set luma strength.
13012
13013 Must be a double value in the range 0-1000, default is @code{1.0}.
13014
13015 @item chroma_strength, cs
13016 Set chroma strength.
13017
13018 Must be a double value in the range 0-1000, default is @code{1.0}.
13019 @end table
13020
13021 @anchor{pad}
13022 @section pad
13023
13024 Add paddings to the input image, and place the original input at the
13025 provided @var{x}, @var{y} coordinates.
13026
13027 It accepts the following parameters:
13028
13029 @table @option
13030 @item width, w
13031 @item height, h
13032 Specify an expression for the size of the output image with the
13033 paddings added. If the value for @var{width} or @var{height} is 0, the
13034 corresponding input size is used for the output.
13035
13036 The @var{width} expression can reference the value set by the
13037 @var{height} expression, and vice versa.
13038
13039 The default value of @var{width} and @var{height} is 0.
13040
13041 @item x
13042 @item y
13043 Specify the offsets to place the input image at within the padded area,
13044 with respect to the top/left border of the output image.
13045
13046 The @var{x} expression can reference the value set by the @var{y}
13047 expression, and vice versa.
13048
13049 The default value of @var{x} and @var{y} is 0.
13050
13051 If @var{x} or @var{y} evaluate to a negative number, they'll be changed
13052 so the input image is centered on the padded area.
13053
13054 @item color
13055 Specify the color of the padded area. For the syntax of this option,
13056 check the @ref{color syntax,,"Color" section in the ffmpeg-utils
13057 manual,ffmpeg-utils}.
13058
13059 The default value of @var{color} is "black".
13060
13061 @item eval
13062 Specify when to evaluate  @var{width}, @var{height}, @var{x} and @var{y} expression.
13063
13064 It accepts the following values:
13065
13066 @table @samp
13067 @item init
13068 Only evaluate expressions once during the filter initialization or when
13069 a command is processed.
13070
13071 @item frame
13072 Evaluate expressions for each incoming frame.
13073
13074 @end table
13075
13076 Default value is @samp{init}.
13077
13078 @item aspect
13079 Pad to aspect instead to a resolution.
13080
13081 @end table
13082
13083 The value for the @var{width}, @var{height}, @var{x}, and @var{y}
13084 options are expressions containing the following constants:
13085
13086 @table @option
13087 @item in_w
13088 @item in_h
13089 The input video width and height.
13090
13091 @item iw
13092 @item ih
13093 These are the same as @var{in_w} and @var{in_h}.
13094
13095 @item out_w
13096 @item out_h
13097 The output width and height (the size of the padded area), as
13098 specified by the @var{width} and @var{height} expressions.
13099
13100 @item ow
13101 @item oh
13102 These are the same as @var{out_w} and @var{out_h}.
13103
13104 @item x
13105 @item y
13106 The x and y offsets as specified by the @var{x} and @var{y}
13107 expressions, or NAN if not yet specified.
13108
13109 @item a
13110 same as @var{iw} / @var{ih}
13111
13112 @item sar
13113 input sample aspect ratio
13114
13115 @item dar
13116 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
13117
13118 @item hsub
13119 @item vsub
13120 The horizontal and vertical chroma subsample values. For example for the
13121 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
13122 @end table
13123
13124 @subsection Examples
13125
13126 @itemize
13127 @item
13128 Add paddings with the color "violet" to the input video. The output video
13129 size is 640x480, and the top-left corner of the input video is placed at
13130 column 0, row 40
13131 @example
13132 pad=640:480:0:40:violet
13133 @end example
13134
13135 The example above is equivalent to the following command:
13136 @example
13137 pad=width=640:height=480:x=0:y=40:color=violet
13138 @end example
13139
13140 @item
13141 Pad the input to get an output with dimensions increased by 3/2,
13142 and put the input video at the center of the padded area:
13143 @example
13144 pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
13145 @end example
13146
13147 @item
13148 Pad the input to get a squared output with size equal to the maximum
13149 value between the input width and height, and put the input video at
13150 the center of the padded area:
13151 @example
13152 pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
13153 @end example
13154
13155 @item
13156 Pad the input to get a final w/h ratio of 16:9:
13157 @example
13158 pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
13159 @end example
13160
13161 @item
13162 In case of anamorphic video, in order to set the output display aspect
13163 correctly, it is necessary to use @var{sar} in the expression,
13164 according to the relation:
13165 @example
13166 (ih * X / ih) * sar = output_dar
13167 X = output_dar / sar
13168 @end example
13169
13170 Thus the previous example needs to be modified to:
13171 @example
13172 pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
13173 @end example
13174
13175 @item
13176 Double the output size and put the input video in the bottom-right
13177 corner of the output padded area:
13178 @example
13179 pad="2*iw:2*ih:ow-iw:oh-ih"
13180 @end example
13181 @end itemize
13182
13183 @anchor{palettegen}
13184 @section palettegen
13185
13186 Generate one palette for a whole video stream.
13187
13188 It accepts the following options:
13189
13190 @table @option
13191 @item max_colors
13192 Set the maximum number of colors to quantize in the palette.
13193 Note: the palette will still contain 256 colors; the unused palette entries
13194 will be black.
13195
13196 @item reserve_transparent
13197 Create a palette of 255 colors maximum and reserve the last one for
13198 transparency. Reserving the transparency color is useful for GIF optimization.
13199 If not set, the maximum of colors in the palette will be 256. You probably want
13200 to disable this option for a standalone image.
13201 Set by default.
13202
13203 @item transparency_color
13204 Set the color that will be used as background for transparency.
13205
13206 @item stats_mode
13207 Set statistics mode.
13208
13209 It accepts the following values:
13210 @table @samp
13211 @item full
13212 Compute full frame histograms.
13213 @item diff
13214 Compute histograms only for the part that differs from previous frame. This
13215 might be relevant to give more importance to the moving part of your input if
13216 the background is static.
13217 @item single
13218 Compute new histogram for each frame.
13219 @end table
13220
13221 Default value is @var{full}.
13222 @end table
13223
13224 The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
13225 (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
13226 color quantization of the palette. This information is also visible at
13227 @var{info} logging level.
13228
13229 @subsection Examples
13230
13231 @itemize
13232 @item
13233 Generate a representative palette of a given video using @command{ffmpeg}:
13234 @example
13235 ffmpeg -i input.mkv -vf palettegen palette.png
13236 @end example
13237 @end itemize
13238
13239 @section paletteuse
13240
13241 Use a palette to downsample an input video stream.
13242
13243 The filter takes two inputs: one video stream and a palette. The palette must
13244 be a 256 pixels image.
13245
13246 It accepts the following options:
13247
13248 @table @option
13249 @item dither
13250 Select dithering mode. Available algorithms are:
13251 @table @samp
13252 @item bayer
13253 Ordered 8x8 bayer dithering (deterministic)
13254 @item heckbert
13255 Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
13256 Note: this dithering is sometimes considered "wrong" and is included as a
13257 reference.
13258 @item floyd_steinberg
13259 Floyd and Steingberg dithering (error diffusion)
13260 @item sierra2
13261 Frankie Sierra dithering v2 (error diffusion)
13262 @item sierra2_4a
13263 Frankie Sierra dithering v2 "Lite" (error diffusion)
13264 @end table
13265
13266 Default is @var{sierra2_4a}.
13267
13268 @item bayer_scale
13269 When @var{bayer} dithering is selected, this option defines the scale of the
13270 pattern (how much the crosshatch pattern is visible). A low value means more
13271 visible pattern for less banding, and higher value means less visible pattern
13272 at the cost of more banding.
13273
13274 The option must be an integer value in the range [0,5]. Default is @var{2}.
13275
13276 @item diff_mode
13277 If set, define the zone to process
13278
13279 @table @samp
13280 @item rectangle
13281 Only the changing rectangle will be reprocessed. This is similar to GIF
13282 cropping/offsetting compression mechanism. This option can be useful for speed
13283 if only a part of the image is changing, and has use cases such as limiting the
13284 scope of the error diffusal @option{dither} to the rectangle that bounds the
13285 moving scene (it leads to more deterministic output if the scene doesn't change
13286 much, and as a result less moving noise and better GIF compression).
13287 @end table
13288
13289 Default is @var{none}.
13290
13291 @item new
13292 Take new palette for each output frame.
13293
13294 @item alpha_threshold
13295 Sets the alpha threshold for transparency. Alpha values above this threshold
13296 will be treated as completely opaque, and values below this threshold will be
13297 treated as completely transparent.
13298
13299 The option must be an integer value in the range [0,255]. Default is @var{128}.
13300 @end table
13301
13302 @subsection Examples
13303
13304 @itemize
13305 @item
13306 Use a palette (generated for example with @ref{palettegen}) to encode a GIF
13307 using @command{ffmpeg}:
13308 @example
13309 ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
13310 @end example
13311 @end itemize
13312
13313 @section perspective
13314
13315 Correct perspective of video not recorded perpendicular to the screen.
13316
13317 A description of the accepted parameters follows.
13318
13319 @table @option
13320 @item x0
13321 @item y0
13322 @item x1
13323 @item y1
13324 @item x2
13325 @item y2
13326 @item x3
13327 @item y3
13328 Set coordinates expression for top left, top right, bottom left and bottom right corners.
13329 Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
13330 If the @code{sense} option is set to @code{source}, then the specified points will be sent
13331 to the corners of the destination. If the @code{sense} option is set to @code{destination},
13332 then the corners of the source will be sent to the specified coordinates.
13333
13334 The expressions can use the following variables:
13335
13336 @table @option
13337 @item W
13338 @item H
13339 the width and height of video frame.
13340 @item in
13341 Input frame count.
13342 @item on
13343 Output frame count.
13344 @end table
13345
13346 @item interpolation
13347 Set interpolation for perspective correction.
13348
13349 It accepts the following values:
13350 @table @samp
13351 @item linear
13352 @item cubic
13353 @end table
13354
13355 Default value is @samp{linear}.
13356
13357 @item sense
13358 Set interpretation of coordinate options.
13359
13360 It accepts the following values:
13361 @table @samp
13362 @item 0, source
13363
13364 Send point in the source specified by the given coordinates to
13365 the corners of the destination.
13366
13367 @item 1, destination
13368
13369 Send the corners of the source to the point in the destination specified
13370 by the given coordinates.
13371
13372 Default value is @samp{source}.
13373 @end table
13374
13375 @item eval
13376 Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
13377
13378 It accepts the following values:
13379 @table @samp
13380 @item init
13381 only evaluate expressions once during the filter initialization or
13382 when a command is processed
13383
13384 @item frame
13385 evaluate expressions for each incoming frame
13386 @end table
13387
13388 Default value is @samp{init}.
13389 @end table
13390
13391 @section phase
13392
13393 Delay interlaced video by one field time so that the field order changes.
13394
13395 The intended use is to fix PAL movies that have been captured with the
13396 opposite field order to the film-to-video transfer.
13397
13398 A description of the accepted parameters follows.
13399
13400 @table @option
13401 @item mode
13402 Set phase mode.
13403
13404 It accepts the following values:
13405 @table @samp
13406 @item t
13407 Capture field order top-first, transfer bottom-first.
13408 Filter will delay the bottom field.
13409
13410 @item b
13411 Capture field order bottom-first, transfer top-first.
13412 Filter will delay the top field.
13413
13414 @item p
13415 Capture and transfer with the same field order. This mode only exists
13416 for the documentation of the other options to refer to, but if you
13417 actually select it, the filter will faithfully do nothing.
13418
13419 @item a
13420 Capture field order determined automatically by field flags, transfer
13421 opposite.
13422 Filter selects among @samp{t} and @samp{b} modes on a frame by frame
13423 basis using field flags. If no field information is available,
13424 then this works just like @samp{u}.
13425
13426 @item u
13427 Capture unknown or varying, transfer opposite.
13428 Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
13429 analyzing the images and selecting the alternative that produces best
13430 match between the fields.
13431
13432 @item T
13433 Capture top-first, transfer unknown or varying.
13434 Filter selects among @samp{t} and @samp{p} using image analysis.
13435
13436 @item B
13437 Capture bottom-first, transfer unknown or varying.
13438 Filter selects among @samp{b} and @samp{p} using image analysis.
13439
13440 @item A
13441 Capture determined by field flags, transfer unknown or varying.
13442 Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
13443 image analysis. If no field information is available, then this works just
13444 like @samp{U}. This is the default mode.
13445
13446 @item U
13447 Both capture and transfer unknown or varying.
13448 Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
13449 @end table
13450 @end table
13451
13452 @section pixdesctest
13453
13454 Pixel format descriptor test filter, mainly useful for internal
13455 testing. The output video should be equal to the input video.
13456
13457 For example:
13458 @example
13459 format=monow, pixdesctest
13460 @end example
13461
13462 can be used to test the monowhite pixel format descriptor definition.
13463
13464 @section pixscope
13465
13466 Display sample values of color channels. Mainly useful for checking color
13467 and levels. Minimum supported resolution is 640x480.
13468
13469 The filters accept the following options:
13470
13471 @table @option
13472 @item x
13473 Set scope X position, relative offset on X axis.
13474
13475 @item y
13476 Set scope Y position, relative offset on Y axis.
13477
13478 @item w
13479 Set scope width.
13480
13481 @item h
13482 Set scope height.
13483
13484 @item o
13485 Set window opacity. This window also holds statistics about pixel area.
13486
13487 @item wx
13488 Set window X position, relative offset on X axis.
13489
13490 @item wy
13491 Set window Y position, relative offset on Y axis.
13492 @end table
13493
13494 @section pp
13495
13496 Enable the specified chain of postprocessing subfilters using libpostproc. This
13497 library should be automatically selected with a GPL build (@code{--enable-gpl}).
13498 Subfilters must be separated by '/' and can be disabled by prepending a '-'.
13499 Each subfilter and some options have a short and a long name that can be used
13500 interchangeably, i.e. dr/dering are the same.
13501
13502 The filters accept the following options:
13503
13504 @table @option
13505 @item subfilters
13506 Set postprocessing subfilters string.
13507 @end table
13508
13509 All subfilters share common options to determine their scope:
13510
13511 @table @option
13512 @item a/autoq
13513 Honor the quality commands for this subfilter.
13514
13515 @item c/chrom
13516 Do chrominance filtering, too (default).
13517
13518 @item y/nochrom
13519 Do luminance filtering only (no chrominance).
13520
13521 @item n/noluma
13522 Do chrominance filtering only (no luminance).
13523 @end table
13524
13525 These options can be appended after the subfilter name, separated by a '|'.
13526
13527 Available subfilters are:
13528
13529 @table @option
13530 @item hb/hdeblock[|difference[|flatness]]
13531 Horizontal deblocking filter
13532 @table @option
13533 @item difference
13534 Difference factor where higher values mean more deblocking (default: @code{32}).
13535 @item flatness
13536 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13537 @end table
13538
13539 @item vb/vdeblock[|difference[|flatness]]
13540 Vertical deblocking filter
13541 @table @option
13542 @item difference
13543 Difference factor where higher values mean more deblocking (default: @code{32}).
13544 @item flatness
13545 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13546 @end table
13547
13548 @item ha/hadeblock[|difference[|flatness]]
13549 Accurate horizontal deblocking filter
13550 @table @option
13551 @item difference
13552 Difference factor where higher values mean more deblocking (default: @code{32}).
13553 @item flatness
13554 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13555 @end table
13556
13557 @item va/vadeblock[|difference[|flatness]]
13558 Accurate vertical deblocking filter
13559 @table @option
13560 @item difference
13561 Difference factor where higher values mean more deblocking (default: @code{32}).
13562 @item flatness
13563 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13564 @end table
13565 @end table
13566
13567 The horizontal and vertical deblocking filters share the difference and
13568 flatness values so you cannot set different horizontal and vertical
13569 thresholds.
13570
13571 @table @option
13572 @item h1/x1hdeblock
13573 Experimental horizontal deblocking filter
13574
13575 @item v1/x1vdeblock
13576 Experimental vertical deblocking filter
13577
13578 @item dr/dering
13579 Deringing filter
13580
13581 @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
13582 @table @option
13583 @item threshold1
13584 larger -> stronger filtering
13585 @item threshold2
13586 larger -> stronger filtering
13587 @item threshold3
13588 larger -> stronger filtering
13589 @end table
13590
13591 @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
13592 @table @option
13593 @item f/fullyrange
13594 Stretch luminance to @code{0-255}.
13595 @end table
13596
13597 @item lb/linblenddeint
13598 Linear blend deinterlacing filter that deinterlaces the given block by
13599 filtering all lines with a @code{(1 2 1)} filter.
13600
13601 @item li/linipoldeint
13602 Linear interpolating deinterlacing filter that deinterlaces the given block by
13603 linearly interpolating every second line.
13604
13605 @item ci/cubicipoldeint
13606 Cubic interpolating deinterlacing filter deinterlaces the given block by
13607 cubically interpolating every second line.
13608
13609 @item md/mediandeint
13610 Median deinterlacing filter that deinterlaces the given block by applying a
13611 median filter to every second line.
13612
13613 @item fd/ffmpegdeint
13614 FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
13615 second line with a @code{(-1 4 2 4 -1)} filter.
13616
13617 @item l5/lowpass5
13618 Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
13619 block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
13620
13621 @item fq/forceQuant[|quantizer]
13622 Overrides the quantizer table from the input with the constant quantizer you
13623 specify.
13624 @table @option
13625 @item quantizer
13626 Quantizer to use
13627 @end table
13628
13629 @item de/default
13630 Default pp filter combination (@code{hb|a,vb|a,dr|a})
13631
13632 @item fa/fast
13633 Fast pp filter combination (@code{h1|a,v1|a,dr|a})
13634
13635 @item ac
13636 High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
13637 @end table
13638
13639 @subsection Examples
13640
13641 @itemize
13642 @item
13643 Apply horizontal and vertical deblocking, deringing and automatic
13644 brightness/contrast:
13645 @example
13646 pp=hb/vb/dr/al
13647 @end example
13648
13649 @item
13650 Apply default filters without brightness/contrast correction:
13651 @example
13652 pp=de/-al
13653 @end example
13654
13655 @item
13656 Apply default filters and temporal denoiser:
13657 @example
13658 pp=default/tmpnoise|1|2|3
13659 @end example
13660
13661 @item
13662 Apply deblocking on luminance only, and switch vertical deblocking on or off
13663 automatically depending on available CPU time:
13664 @example
13665 pp=hb|y/vb|a
13666 @end example
13667 @end itemize
13668
13669 @section pp7
13670 Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
13671 similar to spp = 6 with 7 point DCT, where only the center sample is
13672 used after IDCT.
13673
13674 The filter accepts the following options:
13675
13676 @table @option
13677 @item qp
13678 Force a constant quantization parameter. It accepts an integer in range
13679 0 to 63. If not set, the filter will use the QP from the video stream
13680 (if available).
13681
13682 @item mode
13683 Set thresholding mode. Available modes are:
13684
13685 @table @samp
13686 @item hard
13687 Set hard thresholding.
13688 @item soft
13689 Set soft thresholding (better de-ringing effect, but likely blurrier).
13690 @item medium
13691 Set medium thresholding (good results, default).
13692 @end table
13693 @end table
13694
13695 @section premultiply
13696 Apply alpha premultiply effect to input video stream using first plane
13697 of second stream as alpha.
13698
13699 Both streams must have same dimensions and same pixel format.
13700
13701 The filter accepts the following option:
13702
13703 @table @option
13704 @item planes
13705 Set which planes will be processed, unprocessed planes will be copied.
13706 By default value 0xf, all planes will be processed.
13707
13708 @item inplace
13709 Do not require 2nd input for processing, instead use alpha plane from input stream.
13710 @end table
13711
13712 @section prewitt
13713 Apply prewitt operator to input video stream.
13714
13715 The filter accepts the following option:
13716
13717 @table @option
13718 @item planes
13719 Set which planes will be processed, unprocessed planes will be copied.
13720 By default value 0xf, all planes will be processed.
13721
13722 @item scale
13723 Set value which will be multiplied with filtered result.
13724
13725 @item delta
13726 Set value which will be added to filtered result.
13727 @end table
13728
13729 @anchor{program_opencl}
13730 @section program_opencl
13731
13732 Filter video using an OpenCL program.
13733
13734 @table @option
13735
13736 @item source
13737 OpenCL program source file.
13738
13739 @item kernel
13740 Kernel name in program.
13741
13742 @item inputs
13743 Number of inputs to the filter.  Defaults to 1.
13744
13745 @item size, s
13746 Size of output frames.  Defaults to the same as the first input.
13747
13748 @end table
13749
13750 The program source file must contain a kernel function with the given name,
13751 which will be run once for each plane of the output.  Each run on a plane
13752 gets enqueued as a separate 2D global NDRange with one work-item for each
13753 pixel to be generated.  The global ID offset for each work-item is therefore
13754 the coordinates of a pixel in the destination image.
13755
13756 The kernel function needs to take the following arguments:
13757 @itemize
13758 @item
13759 Destination image, @var{__write_only image2d_t}.
13760
13761 This image will become the output; the kernel should write all of it.
13762 @item
13763 Frame index, @var{unsigned int}.
13764
13765 This is a counter starting from zero and increasing by one for each frame.
13766 @item
13767 Source images, @var{__read_only image2d_t}.
13768
13769 These are the most recent images on each input.  The kernel may read from
13770 them to generate the output, but they can't be written to.
13771 @end itemize
13772
13773 Example programs:
13774
13775 @itemize
13776 @item
13777 Copy the input to the output (output must be the same size as the input).
13778 @verbatim
13779 __kernel void copy(__write_only image2d_t destination,
13780                    unsigned int index,
13781                    __read_only  image2d_t source)
13782 {
13783     const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
13784
13785     int2 location = (int2)(get_global_id(0), get_global_id(1));
13786
13787     float4 value = read_imagef(source, sampler, location);
13788
13789     write_imagef(destination, location, value);
13790 }
13791 @end verbatim
13792
13793 @item
13794 Apply a simple transformation, rotating the input by an amount increasing
13795 with the index counter.  Pixel values are linearly interpolated by the
13796 sampler, and the output need not have the same dimensions as the input.
13797 @verbatim
13798 __kernel void rotate_image(__write_only image2d_t dst,
13799                            unsigned int index,
13800                            __read_only  image2d_t src)
13801 {
13802     const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
13803                                CLK_FILTER_LINEAR);
13804
13805     float angle = (float)index / 100.0f;
13806
13807     float2 dst_dim = convert_float2(get_image_dim(dst));
13808     float2 src_dim = convert_float2(get_image_dim(src));
13809
13810     float2 dst_cen = dst_dim / 2.0f;
13811     float2 src_cen = src_dim / 2.0f;
13812
13813     int2   dst_loc = (int2)(get_global_id(0), get_global_id(1));
13814
13815     float2 dst_pos = convert_float2(dst_loc) - dst_cen;
13816     float2 src_pos = {
13817         cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
13818         sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
13819     };
13820     src_pos = src_pos * src_dim / dst_dim;
13821
13822     float2 src_loc = src_pos + src_cen;
13823
13824     if (src_loc.x < 0.0f      || src_loc.y < 0.0f ||
13825         src_loc.x > src_dim.x || src_loc.y > src_dim.y)
13826         write_imagef(dst, dst_loc, 0.5f);
13827     else
13828         write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
13829 }
13830 @end verbatim
13831
13832 @item
13833 Blend two inputs together, with the amount of each input used varying
13834 with the index counter.
13835 @verbatim
13836 __kernel void blend_images(__write_only image2d_t dst,
13837                            unsigned int index,
13838                            __read_only  image2d_t src1,
13839                            __read_only  image2d_t src2)
13840 {
13841     const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
13842                                CLK_FILTER_LINEAR);
13843
13844     float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
13845
13846     int2  dst_loc = (int2)(get_global_id(0), get_global_id(1));
13847     int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
13848     int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
13849
13850     float4 val1 = read_imagef(src1, sampler, src1_loc);
13851     float4 val2 = read_imagef(src2, sampler, src2_loc);
13852
13853     write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
13854 }
13855 @end verbatim
13856
13857 @end itemize
13858
13859 @section pseudocolor
13860
13861 Alter frame colors in video with pseudocolors.
13862
13863 This filter accept the following options:
13864
13865 @table @option
13866 @item c0
13867 set pixel first component expression
13868
13869 @item c1
13870 set pixel second component expression
13871
13872 @item c2
13873 set pixel third component expression
13874
13875 @item c3
13876 set pixel fourth component expression, corresponds to the alpha component
13877
13878 @item i
13879 set component to use as base for altering colors
13880 @end table
13881
13882 Each of them specifies the expression to use for computing the lookup table for
13883 the corresponding pixel component values.
13884
13885 The expressions can contain the following constants and functions:
13886
13887 @table @option
13888 @item w
13889 @item h
13890 The input width and height.
13891
13892 @item val
13893 The input value for the pixel component.
13894
13895 @item ymin, umin, vmin, amin
13896 The minimum allowed component value.
13897
13898 @item ymax, umax, vmax, amax
13899 The maximum allowed component value.
13900 @end table
13901
13902 All expressions default to "val".
13903
13904 @subsection Examples
13905
13906 @itemize
13907 @item
13908 Change too high luma values to gradient:
13909 @example
13910 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'"
13911 @end example
13912 @end itemize
13913
13914 @section psnr
13915
13916 Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
13917 Ratio) between two input videos.
13918
13919 This filter takes in input two input videos, the first input is
13920 considered the "main" source and is passed unchanged to the
13921 output. The second input is used as a "reference" video for computing
13922 the PSNR.
13923
13924 Both video inputs must have the same resolution and pixel format for
13925 this filter to work correctly. Also it assumes that both inputs
13926 have the same number of frames, which are compared one by one.
13927
13928 The obtained average PSNR is printed through the logging system.
13929
13930 The filter stores the accumulated MSE (mean squared error) of each
13931 frame, and at the end of the processing it is averaged across all frames
13932 equally, and the following formula is applied to obtain the PSNR:
13933
13934 @example
13935 PSNR = 10*log10(MAX^2/MSE)
13936 @end example
13937
13938 Where MAX is the average of the maximum values of each component of the
13939 image.
13940
13941 The description of the accepted parameters follows.
13942
13943 @table @option
13944 @item stats_file, f
13945 If specified the filter will use the named file to save the PSNR of
13946 each individual frame. When filename equals "-" the data is sent to
13947 standard output.
13948
13949 @item stats_version
13950 Specifies which version of the stats file format to use. Details of
13951 each format are written below.
13952 Default value is 1.
13953
13954 @item stats_add_max
13955 Determines whether the max value is output to the stats log.
13956 Default value is 0.
13957 Requires stats_version >= 2. If this is set and stats_version < 2,
13958 the filter will return an error.
13959 @end table
13960
13961 This filter also supports the @ref{framesync} options.
13962
13963 The file printed if @var{stats_file} is selected, contains a sequence of
13964 key/value pairs of the form @var{key}:@var{value} for each compared
13965 couple of frames.
13966
13967 If a @var{stats_version} greater than 1 is specified, a header line precedes
13968 the list of per-frame-pair stats, with key value pairs following the frame
13969 format with the following parameters:
13970
13971 @table @option
13972 @item psnr_log_version
13973 The version of the log file format. Will match @var{stats_version}.
13974
13975 @item fields
13976 A comma separated list of the per-frame-pair parameters included in
13977 the log.
13978 @end table
13979
13980 A description of each shown per-frame-pair parameter follows:
13981
13982 @table @option
13983 @item n
13984 sequential number of the input frame, starting from 1
13985
13986 @item mse_avg
13987 Mean Square Error pixel-by-pixel average difference of the compared
13988 frames, averaged over all the image components.
13989
13990 @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
13991 Mean Square Error pixel-by-pixel average difference of the compared
13992 frames for the component specified by the suffix.
13993
13994 @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
13995 Peak Signal to Noise ratio of the compared frames for the component
13996 specified by the suffix.
13997
13998 @item max_avg, max_y, max_u, max_v
13999 Maximum allowed value for each channel, and average over all
14000 channels.
14001 @end table
14002
14003 For example:
14004 @example
14005 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
14006 [main][ref] psnr="stats_file=stats.log" [out]
14007 @end example
14008
14009 On this example the input file being processed is compared with the
14010 reference file @file{ref_movie.mpg}. The PSNR of each individual frame
14011 is stored in @file{stats.log}.
14012
14013 @anchor{pullup}
14014 @section pullup
14015
14016 Pulldown reversal (inverse telecine) filter, capable of handling mixed
14017 hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
14018 content.
14019
14020 The pullup filter is designed to take advantage of future context in making
14021 its decisions. This filter is stateless in the sense that it does not lock
14022 onto a pattern to follow, but it instead looks forward to the following
14023 fields in order to identify matches and rebuild progressive frames.
14024
14025 To produce content with an even framerate, insert the fps filter after
14026 pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
14027 @code{fps=24} for 30fps and the (rare) telecined 25fps input.
14028
14029 The filter accepts the following options:
14030
14031 @table @option
14032 @item jl
14033 @item jr
14034 @item jt
14035 @item jb
14036 These options set the amount of "junk" to ignore at the left, right, top, and
14037 bottom of the image, respectively. Left and right are in units of 8 pixels,
14038 while top and bottom are in units of 2 lines.
14039 The default is 8 pixels on each side.
14040
14041 @item sb
14042 Set the strict breaks. Setting this option to 1 will reduce the chances of
14043 filter generating an occasional mismatched frame, but it may also cause an
14044 excessive number of frames to be dropped during high motion sequences.
14045 Conversely, setting it to -1 will make filter match fields more easily.
14046 This may help processing of video where there is slight blurring between
14047 the fields, but may also cause there to be interlaced frames in the output.
14048 Default value is @code{0}.
14049
14050 @item mp
14051 Set the metric plane to use. It accepts the following values:
14052 @table @samp
14053 @item l
14054 Use luma plane.
14055
14056 @item u
14057 Use chroma blue plane.
14058
14059 @item v
14060 Use chroma red plane.
14061 @end table
14062
14063 This option may be set to use chroma plane instead of the default luma plane
14064 for doing filter's computations. This may improve accuracy on very clean
14065 source material, but more likely will decrease accuracy, especially if there
14066 is chroma noise (rainbow effect) or any grayscale video.
14067 The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
14068 load and make pullup usable in realtime on slow machines.
14069 @end table
14070
14071 For best results (without duplicated frames in the output file) it is
14072 necessary to change the output frame rate. For example, to inverse
14073 telecine NTSC input:
14074 @example
14075 ffmpeg -i input -vf pullup -r 24000/1001 ...
14076 @end example
14077
14078 @section qp
14079
14080 Change video quantization parameters (QP).
14081
14082 The filter accepts the following option:
14083
14084 @table @option
14085 @item qp
14086 Set expression for quantization parameter.
14087 @end table
14088
14089 The expression is evaluated through the eval API and can contain, among others,
14090 the following constants:
14091
14092 @table @var
14093 @item known
14094 1 if index is not 129, 0 otherwise.
14095
14096 @item qp
14097 Sequential index starting from -129 to 128.
14098 @end table
14099
14100 @subsection Examples
14101
14102 @itemize
14103 @item
14104 Some equation like:
14105 @example
14106 qp=2+2*sin(PI*qp)
14107 @end example
14108 @end itemize
14109
14110 @section random
14111
14112 Flush video frames from internal cache of frames into a random order.
14113 No frame is discarded.
14114 Inspired by @ref{frei0r} nervous filter.
14115
14116 @table @option
14117 @item frames
14118 Set size in number of frames of internal cache, in range from @code{2} to
14119 @code{512}. Default is @code{30}.
14120
14121 @item seed
14122 Set seed for random number generator, must be an integer included between
14123 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
14124 less than @code{0}, the filter will try to use a good random seed on a
14125 best effort basis.
14126 @end table
14127
14128 @section readeia608
14129
14130 Read closed captioning (EIA-608) information from the top lines of a video frame.
14131
14132 This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
14133 @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
14134 with EIA-608 data (starting from 0). A description of each metadata value follows:
14135
14136 @table @option
14137 @item lavfi.readeia608.X.cc
14138 The two bytes stored as EIA-608 data (printed in hexadecimal).
14139
14140 @item lavfi.readeia608.X.line
14141 The number of the line on which the EIA-608 data was identified and read.
14142 @end table
14143
14144 This filter accepts the following options:
14145
14146 @table @option
14147 @item scan_min
14148 Set the line to start scanning for EIA-608 data. Default is @code{0}.
14149
14150 @item scan_max
14151 Set the line to end scanning for EIA-608 data. Default is @code{29}.
14152
14153 @item mac
14154 Set minimal acceptable amplitude change for sync codes detection.
14155 Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
14156
14157 @item spw
14158 Set the ratio of width reserved for sync code detection.
14159 Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
14160
14161 @item mhd
14162 Set the max peaks height difference for sync code detection.
14163 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
14164
14165 @item mpd
14166 Set max peaks period difference for sync code detection.
14167 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
14168
14169 @item msd
14170 Set the first two max start code bits differences.
14171 Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
14172
14173 @item bhd
14174 Set the minimum ratio of bits height compared to 3rd start code bit.
14175 Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
14176
14177 @item th_w
14178 Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
14179
14180 @item th_b
14181 Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
14182
14183 @item chp
14184 Enable checking the parity bit. In the event of a parity error, the filter will output
14185 @code{0x00} for that character. Default is false.
14186 @end table
14187
14188 @subsection Examples
14189
14190 @itemize
14191 @item
14192 Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
14193 @example
14194 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
14195 @end example
14196 @end itemize
14197
14198 @section readvitc
14199
14200 Read vertical interval timecode (VITC) information from the top lines of a
14201 video frame.
14202
14203 The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
14204 timecode value, if a valid timecode has been detected. Further metadata key
14205 @code{lavfi.readvitc.found} is set to 0/1 depending on whether
14206 timecode data has been found or not.
14207
14208 This filter accepts the following options:
14209
14210 @table @option
14211 @item scan_max
14212 Set the maximum number of lines to scan for VITC data. If the value is set to
14213 @code{-1} the full video frame is scanned. Default is @code{45}.
14214
14215 @item thr_b
14216 Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
14217 default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
14218
14219 @item thr_w
14220 Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
14221 default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
14222 @end table
14223
14224 @subsection Examples
14225
14226 @itemize
14227 @item
14228 Detect and draw VITC data onto the video frame; if no valid VITC is detected,
14229 draw @code{--:--:--:--} as a placeholder:
14230 @example
14231 ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
14232 @end example
14233 @end itemize
14234
14235 @section remap
14236
14237 Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
14238
14239 Destination pixel at position (X, Y) will be picked from source (x, y) position
14240 where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
14241 value for pixel will be used for destination pixel.
14242
14243 Xmap and Ymap input video streams must be of same dimensions. Output video stream
14244 will have Xmap/Ymap video stream dimensions.
14245 Xmap and Ymap input video streams are 16bit depth, single channel.
14246
14247 @section removegrain
14248
14249 The removegrain filter is a spatial denoiser for progressive video.
14250
14251 @table @option
14252 @item m0
14253 Set mode for the first plane.
14254
14255 @item m1
14256 Set mode for the second plane.
14257
14258 @item m2
14259 Set mode for the third plane.
14260
14261 @item m3
14262 Set mode for the fourth plane.
14263 @end table
14264
14265 Range of mode is from 0 to 24. Description of each mode follows:
14266
14267 @table @var
14268 @item 0
14269 Leave input plane unchanged. Default.
14270
14271 @item 1
14272 Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
14273
14274 @item 2
14275 Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
14276
14277 @item 3
14278 Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
14279
14280 @item 4
14281 Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
14282 This is equivalent to a median filter.
14283
14284 @item 5
14285 Line-sensitive clipping giving the minimal change.
14286
14287 @item 6
14288 Line-sensitive clipping, intermediate.
14289
14290 @item 7
14291 Line-sensitive clipping, intermediate.
14292
14293 @item 8
14294 Line-sensitive clipping, intermediate.
14295
14296 @item 9
14297 Line-sensitive clipping on a line where the neighbours pixels are the closest.
14298
14299 @item 10
14300 Replaces the target pixel with the closest neighbour.
14301
14302 @item 11
14303 [1 2 1] horizontal and vertical kernel blur.
14304
14305 @item 12
14306 Same as mode 11.
14307
14308 @item 13
14309 Bob mode, interpolates top field from the line where the neighbours
14310 pixels are the closest.
14311
14312 @item 14
14313 Bob mode, interpolates bottom field from the line where the neighbours
14314 pixels are the closest.
14315
14316 @item 15
14317 Bob mode, interpolates top field. Same as 13 but with a more complicated
14318 interpolation formula.
14319
14320 @item 16
14321 Bob mode, interpolates bottom field. Same as 14 but with a more complicated
14322 interpolation formula.
14323
14324 @item 17
14325 Clips the pixel with the minimum and maximum of respectively the maximum and
14326 minimum of each pair of opposite neighbour pixels.
14327
14328 @item 18
14329 Line-sensitive clipping using opposite neighbours whose greatest distance from
14330 the current pixel is minimal.
14331
14332 @item 19
14333 Replaces the pixel with the average of its 8 neighbours.
14334
14335 @item 20
14336 Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
14337
14338 @item 21
14339 Clips pixels using the averages of opposite neighbour.
14340
14341 @item 22
14342 Same as mode 21 but simpler and faster.
14343
14344 @item 23
14345 Small edge and halo removal, but reputed useless.
14346
14347 @item 24
14348 Similar as 23.
14349 @end table
14350
14351 @section removelogo
14352
14353 Suppress a TV station logo, using an image file to determine which
14354 pixels comprise the logo. It works by filling in the pixels that
14355 comprise the logo with neighboring pixels.
14356
14357 The filter accepts the following options:
14358
14359 @table @option
14360 @item filename, f
14361 Set the filter bitmap file, which can be any image format supported by
14362 libavformat. The width and height of the image file must match those of the
14363 video stream being processed.
14364 @end table
14365
14366 Pixels in the provided bitmap image with a value of zero are not
14367 considered part of the logo, non-zero pixels are considered part of
14368 the logo. If you use white (255) for the logo and black (0) for the
14369 rest, you will be safe. For making the filter bitmap, it is
14370 recommended to take a screen capture of a black frame with the logo
14371 visible, and then using a threshold filter followed by the erode
14372 filter once or twice.
14373
14374 If needed, little splotches can be fixed manually. Remember that if
14375 logo pixels are not covered, the filter quality will be much
14376 reduced. Marking too many pixels as part of the logo does not hurt as
14377 much, but it will increase the amount of blurring needed to cover over
14378 the image and will destroy more information than necessary, and extra
14379 pixels will slow things down on a large logo.
14380
14381 @section repeatfields
14382
14383 This filter uses the repeat_field flag from the Video ES headers and hard repeats
14384 fields based on its value.
14385
14386 @section reverse
14387
14388 Reverse a video clip.
14389
14390 Warning: This filter requires memory to buffer the entire clip, so trimming
14391 is suggested.
14392
14393 @subsection Examples
14394
14395 @itemize
14396 @item
14397 Take the first 5 seconds of a clip, and reverse it.
14398 @example
14399 trim=end=5,reverse
14400 @end example
14401 @end itemize
14402
14403 @section rgbashift
14404 Shift R/G/B/A pixels horizontally and/or vertically.
14405
14406 The filter accepts the following options:
14407 @table @option
14408 @item rh
14409 Set amount to shift red horizontally.
14410 @item rv
14411 Set amount to shift red vertically.
14412 @item gh
14413 Set amount to shift green horizontally.
14414 @item gv
14415 Set amount to shift green vertically.
14416 @item bh
14417 Set amount to shift blue horizontally.
14418 @item bv
14419 Set amount to shift blue vertically.
14420 @item ah
14421 Set amount to shift alpha horizontally.
14422 @item av
14423 Set amount to shift alpha vertically.
14424 @item edge
14425 Set edge mode, can be @var{smear}, default, or @var{warp}.
14426 @end table
14427
14428 @section roberts
14429 Apply roberts cross operator to input video stream.
14430
14431 The filter accepts the following option:
14432
14433 @table @option
14434 @item planes
14435 Set which planes will be processed, unprocessed planes will be copied.
14436 By default value 0xf, all planes will be processed.
14437
14438 @item scale
14439 Set value which will be multiplied with filtered result.
14440
14441 @item delta
14442 Set value which will be added to filtered result.
14443 @end table
14444
14445 @section rotate
14446
14447 Rotate video by an arbitrary angle expressed in radians.
14448
14449 The filter accepts the following options:
14450
14451 A description of the optional parameters follows.
14452 @table @option
14453 @item angle, a
14454 Set an expression for the angle by which to rotate the input video
14455 clockwise, expressed as a number of radians. A negative value will
14456 result in a counter-clockwise rotation. By default it is set to "0".
14457
14458 This expression is evaluated for each frame.
14459
14460 @item out_w, ow
14461 Set the output width expression, default value is "iw".
14462 This expression is evaluated just once during configuration.
14463
14464 @item out_h, oh
14465 Set the output height expression, default value is "ih".
14466 This expression is evaluated just once during configuration.
14467
14468 @item bilinear
14469 Enable bilinear interpolation if set to 1, a value of 0 disables
14470 it. Default value is 1.
14471
14472 @item fillcolor, c
14473 Set the color used to fill the output area not covered by the rotated
14474 image. For the general syntax of this option, check the
14475 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
14476 If the special value "none" is selected then no
14477 background is printed (useful for example if the background is never shown).
14478
14479 Default value is "black".
14480 @end table
14481
14482 The expressions for the angle and the output size can contain the
14483 following constants and functions:
14484
14485 @table @option
14486 @item n
14487 sequential number of the input frame, starting from 0. It is always NAN
14488 before the first frame is filtered.
14489
14490 @item t
14491 time in seconds of the input frame, it is set to 0 when the filter is
14492 configured. It is always NAN before the first frame is filtered.
14493
14494 @item hsub
14495 @item vsub
14496 horizontal and vertical chroma subsample values. For example for the
14497 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14498
14499 @item in_w, iw
14500 @item in_h, ih
14501 the input video width and height
14502
14503 @item out_w, ow
14504 @item out_h, oh
14505 the output width and height, that is the size of the padded area as
14506 specified by the @var{width} and @var{height} expressions
14507
14508 @item rotw(a)
14509 @item roth(a)
14510 the minimal width/height required for completely containing the input
14511 video rotated by @var{a} radians.
14512
14513 These are only available when computing the @option{out_w} and
14514 @option{out_h} expressions.
14515 @end table
14516
14517 @subsection Examples
14518
14519 @itemize
14520 @item
14521 Rotate the input by PI/6 radians clockwise:
14522 @example
14523 rotate=PI/6
14524 @end example
14525
14526 @item
14527 Rotate the input by PI/6 radians counter-clockwise:
14528 @example
14529 rotate=-PI/6
14530 @end example
14531
14532 @item
14533 Rotate the input by 45 degrees clockwise:
14534 @example
14535 rotate=45*PI/180
14536 @end example
14537
14538 @item
14539 Apply a constant rotation with period T, starting from an angle of PI/3:
14540 @example
14541 rotate=PI/3+2*PI*t/T
14542 @end example
14543
14544 @item
14545 Make the input video rotation oscillating with a period of T
14546 seconds and an amplitude of A radians:
14547 @example
14548 rotate=A*sin(2*PI/T*t)
14549 @end example
14550
14551 @item
14552 Rotate the video, output size is chosen so that the whole rotating
14553 input video is always completely contained in the output:
14554 @example
14555 rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
14556 @end example
14557
14558 @item
14559 Rotate the video, reduce the output size so that no background is ever
14560 shown:
14561 @example
14562 rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
14563 @end example
14564 @end itemize
14565
14566 @subsection Commands
14567
14568 The filter supports the following commands:
14569
14570 @table @option
14571 @item a, angle
14572 Set the angle expression.
14573 The command accepts the same syntax of the corresponding option.
14574
14575 If the specified expression is not valid, it is kept at its current
14576 value.
14577 @end table
14578
14579 @section sab
14580
14581 Apply Shape Adaptive Blur.
14582
14583 The filter accepts the following options:
14584
14585 @table @option
14586 @item luma_radius, lr
14587 Set luma blur filter strength, must be a value in range 0.1-4.0, default
14588 value is 1.0. A greater value will result in a more blurred image, and
14589 in slower processing.
14590
14591 @item luma_pre_filter_radius, lpfr
14592 Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
14593 value is 1.0.
14594
14595 @item luma_strength, ls
14596 Set luma maximum difference between pixels to still be considered, must
14597 be a value in the 0.1-100.0 range, default value is 1.0.
14598
14599 @item chroma_radius, cr
14600 Set chroma blur filter strength, must be a value in range -0.9-4.0. A
14601 greater value will result in a more blurred image, and in slower
14602 processing.
14603
14604 @item chroma_pre_filter_radius, cpfr
14605 Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
14606
14607 @item chroma_strength, cs
14608 Set chroma maximum difference between pixels to still be considered,
14609 must be a value in the -0.9-100.0 range.
14610 @end table
14611
14612 Each chroma option value, if not explicitly specified, is set to the
14613 corresponding luma option value.
14614
14615 @anchor{scale}
14616 @section scale
14617
14618 Scale (resize) the input video, using the libswscale library.
14619
14620 The scale filter forces the output display aspect ratio to be the same
14621 of the input, by changing the output sample aspect ratio.
14622
14623 If the input image format is different from the format requested by
14624 the next filter, the scale filter will convert the input to the
14625 requested format.
14626
14627 @subsection Options
14628 The filter accepts the following options, or any of the options
14629 supported by the libswscale scaler.
14630
14631 See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
14632 the complete list of scaler options.
14633
14634 @table @option
14635 @item width, w
14636 @item height, h
14637 Set the output video dimension expression. Default value is the input
14638 dimension.
14639
14640 If the @var{width} or @var{w} value is 0, the input width is used for
14641 the output. If the @var{height} or @var{h} value is 0, the input height
14642 is used for the output.
14643
14644 If one and only one of the values is -n with n >= 1, the scale filter
14645 will use a value that maintains the aspect ratio of the input image,
14646 calculated from the other specified dimension. After that it will,
14647 however, make sure that the calculated dimension is divisible by n and
14648 adjust the value if necessary.
14649
14650 If both values are -n with n >= 1, the behavior will be identical to
14651 both values being set to 0 as previously detailed.
14652
14653 See below for the list of accepted constants for use in the dimension
14654 expression.
14655
14656 @item eval
14657 Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
14658
14659 @table @samp
14660 @item init
14661 Only evaluate expressions once during the filter initialization or when a command is processed.
14662
14663 @item frame
14664 Evaluate expressions for each incoming frame.
14665
14666 @end table
14667
14668 Default value is @samp{init}.
14669
14670
14671 @item interl
14672 Set the interlacing mode. It accepts the following values:
14673
14674 @table @samp
14675 @item 1
14676 Force interlaced aware scaling.
14677
14678 @item 0
14679 Do not apply interlaced scaling.
14680
14681 @item -1
14682 Select interlaced aware scaling depending on whether the source frames
14683 are flagged as interlaced or not.
14684 @end table
14685
14686 Default value is @samp{0}.
14687
14688 @item flags
14689 Set libswscale scaling flags. See
14690 @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
14691 complete list of values. If not explicitly specified the filter applies
14692 the default flags.
14693
14694
14695 @item param0, param1
14696 Set libswscale input parameters for scaling algorithms that need them. See
14697 @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
14698 complete documentation. If not explicitly specified the filter applies
14699 empty parameters.
14700
14701
14702
14703 @item size, s
14704 Set the video size. For the syntax of this option, check the
14705 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
14706
14707 @item in_color_matrix
14708 @item out_color_matrix
14709 Set in/output YCbCr color space type.
14710
14711 This allows the autodetected value to be overridden as well as allows forcing
14712 a specific value used for the output and encoder.
14713
14714 If not specified, the color space type depends on the pixel format.
14715
14716 Possible values:
14717
14718 @table @samp
14719 @item auto
14720 Choose automatically.
14721
14722 @item bt709
14723 Format conforming to International Telecommunication Union (ITU)
14724 Recommendation BT.709.
14725
14726 @item fcc
14727 Set color space conforming to the United States Federal Communications
14728 Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
14729
14730 @item bt601
14731 Set color space conforming to:
14732
14733 @itemize
14734 @item
14735 ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
14736
14737 @item
14738 ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
14739
14740 @item
14741 Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
14742
14743 @end itemize
14744
14745 @item smpte240m
14746 Set color space conforming to SMPTE ST 240:1999.
14747 @end table
14748
14749 @item in_range
14750 @item out_range
14751 Set in/output YCbCr sample range.
14752
14753 This allows the autodetected value to be overridden as well as allows forcing
14754 a specific value used for the output and encoder. If not specified, the
14755 range depends on the pixel format. Possible values:
14756
14757 @table @samp
14758 @item auto/unknown
14759 Choose automatically.
14760
14761 @item jpeg/full/pc
14762 Set full range (0-255 in case of 8-bit luma).
14763
14764 @item mpeg/limited/tv
14765 Set "MPEG" range (16-235 in case of 8-bit luma).
14766 @end table
14767
14768 @item force_original_aspect_ratio
14769 Enable decreasing or increasing output video width or height if necessary to
14770 keep the original aspect ratio. Possible values:
14771
14772 @table @samp
14773 @item disable
14774 Scale the video as specified and disable this feature.
14775
14776 @item decrease
14777 The output video dimensions will automatically be decreased if needed.
14778
14779 @item increase
14780 The output video dimensions will automatically be increased if needed.
14781
14782 @end table
14783
14784 One useful instance of this option is that when you know a specific device's
14785 maximum allowed resolution, you can use this to limit the output video to
14786 that, while retaining the aspect ratio. For example, device A allows
14787 1280x720 playback, and your video is 1920x800. Using this option (set it to
14788 decrease) and specifying 1280x720 to the command line makes the output
14789 1280x533.
14790
14791 Please note that this is a different thing than specifying -1 for @option{w}
14792 or @option{h}, you still need to specify the output resolution for this option
14793 to work.
14794
14795 @end table
14796
14797 The values of the @option{w} and @option{h} options are expressions
14798 containing the following constants:
14799
14800 @table @var
14801 @item in_w
14802 @item in_h
14803 The input width and height
14804
14805 @item iw
14806 @item ih
14807 These are the same as @var{in_w} and @var{in_h}.
14808
14809 @item out_w
14810 @item out_h
14811 The output (scaled) width and height
14812
14813 @item ow
14814 @item oh
14815 These are the same as @var{out_w} and @var{out_h}
14816
14817 @item a
14818 The same as @var{iw} / @var{ih}
14819
14820 @item sar
14821 input sample aspect ratio
14822
14823 @item dar
14824 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
14825
14826 @item hsub
14827 @item vsub
14828 horizontal and vertical input chroma subsample values. For example for the
14829 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14830
14831 @item ohsub
14832 @item ovsub
14833 horizontal and vertical output chroma subsample values. For example for the
14834 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14835 @end table
14836
14837 @subsection Examples
14838
14839 @itemize
14840 @item
14841 Scale the input video to a size of 200x100
14842 @example
14843 scale=w=200:h=100
14844 @end example
14845
14846 This is equivalent to:
14847 @example
14848 scale=200:100
14849 @end example
14850
14851 or:
14852 @example
14853 scale=200x100
14854 @end example
14855
14856 @item
14857 Specify a size abbreviation for the output size:
14858 @example
14859 scale=qcif
14860 @end example
14861
14862 which can also be written as:
14863 @example
14864 scale=size=qcif
14865 @end example
14866
14867 @item
14868 Scale the input to 2x:
14869 @example
14870 scale=w=2*iw:h=2*ih
14871 @end example
14872
14873 @item
14874 The above is the same as:
14875 @example
14876 scale=2*in_w:2*in_h
14877 @end example
14878
14879 @item
14880 Scale the input to 2x with forced interlaced scaling:
14881 @example
14882 scale=2*iw:2*ih:interl=1
14883 @end example
14884
14885 @item
14886 Scale the input to half size:
14887 @example
14888 scale=w=iw/2:h=ih/2
14889 @end example
14890
14891 @item
14892 Increase the width, and set the height to the same size:
14893 @example
14894 scale=3/2*iw:ow
14895 @end example
14896
14897 @item
14898 Seek Greek harmony:
14899 @example
14900 scale=iw:1/PHI*iw
14901 scale=ih*PHI:ih
14902 @end example
14903
14904 @item
14905 Increase the height, and set the width to 3/2 of the height:
14906 @example
14907 scale=w=3/2*oh:h=3/5*ih
14908 @end example
14909
14910 @item
14911 Increase the size, making the size a multiple of the chroma
14912 subsample values:
14913 @example
14914 scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
14915 @end example
14916
14917 @item
14918 Increase the width to a maximum of 500 pixels,
14919 keeping the same aspect ratio as the input:
14920 @example
14921 scale=w='min(500\, iw*3/2):h=-1'
14922 @end example
14923
14924 @item
14925 Make pixels square by combining scale and setsar:
14926 @example
14927 scale='trunc(ih*dar):ih',setsar=1/1
14928 @end example
14929
14930 @item
14931 Make pixels square by combining scale and setsar,
14932 making sure the resulting resolution is even (required by some codecs):
14933 @example
14934 scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
14935 @end example
14936 @end itemize
14937
14938 @subsection Commands
14939
14940 This filter supports the following commands:
14941 @table @option
14942 @item width, w
14943 @item height, h
14944 Set the output video dimension expression.
14945 The command accepts the same syntax of the corresponding option.
14946
14947 If the specified expression is not valid, it is kept at its current
14948 value.
14949 @end table
14950
14951 @section scale_npp
14952
14953 Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
14954 format conversion on CUDA video frames. Setting the output width and height
14955 works in the same way as for the @var{scale} filter.
14956
14957 The following additional options are accepted:
14958 @table @option
14959 @item format
14960 The pixel format of the output CUDA frames. If set to the string "same" (the
14961 default), the input format will be kept. Note that automatic format negotiation
14962 and conversion is not yet supported for hardware frames
14963
14964 @item interp_algo
14965 The interpolation algorithm used for resizing. One of the following:
14966 @table @option
14967 @item nn
14968 Nearest neighbour.
14969
14970 @item linear
14971 @item cubic
14972 @item cubic2p_bspline
14973 2-parameter cubic (B=1, C=0)
14974
14975 @item cubic2p_catmullrom
14976 2-parameter cubic (B=0, C=1/2)
14977
14978 @item cubic2p_b05c03
14979 2-parameter cubic (B=1/2, C=3/10)
14980
14981 @item super
14982 Supersampling
14983
14984 @item lanczos
14985 @end table
14986
14987 @end table
14988
14989 @section scale2ref
14990
14991 Scale (resize) the input video, based on a reference video.
14992
14993 See the scale filter for available options, scale2ref supports the same but
14994 uses the reference video instead of the main input as basis. scale2ref also
14995 supports the following additional constants for the @option{w} and
14996 @option{h} options:
14997
14998 @table @var
14999 @item main_w
15000 @item main_h
15001 The main input video's width and height
15002
15003 @item main_a
15004 The same as @var{main_w} / @var{main_h}
15005
15006 @item main_sar
15007 The main input video's sample aspect ratio
15008
15009 @item main_dar, mdar
15010 The main input video's display aspect ratio. Calculated from
15011 @code{(main_w / main_h) * main_sar}.
15012
15013 @item main_hsub
15014 @item main_vsub
15015 The main input video's horizontal and vertical chroma subsample values.
15016 For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
15017 is 1.
15018 @end table
15019
15020 @subsection Examples
15021
15022 @itemize
15023 @item
15024 Scale a subtitle stream (b) to match the main video (a) in size before overlaying
15025 @example
15026 'scale2ref[b][a];[a][b]overlay'
15027 @end example
15028 @end itemize
15029
15030 @anchor{selectivecolor}
15031 @section selectivecolor
15032
15033 Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
15034 as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
15035 by the "purity" of the color (that is, how saturated it already is).
15036
15037 This filter is similar to the Adobe Photoshop Selective Color tool.
15038
15039 The filter accepts the following options:
15040
15041 @table @option
15042 @item correction_method
15043 Select color correction method.
15044
15045 Available values are:
15046 @table @samp
15047 @item absolute
15048 Specified adjustments are applied "as-is" (added/subtracted to original pixel
15049 component value).
15050 @item relative
15051 Specified adjustments are relative to the original component value.
15052 @end table
15053 Default is @code{absolute}.
15054 @item reds
15055 Adjustments for red pixels (pixels where the red component is the maximum)
15056 @item yellows
15057 Adjustments for yellow pixels (pixels where the blue component is the minimum)
15058 @item greens
15059 Adjustments for green pixels (pixels where the green component is the maximum)
15060 @item cyans
15061 Adjustments for cyan pixels (pixels where the red component is the minimum)
15062 @item blues
15063 Adjustments for blue pixels (pixels where the blue component is the maximum)
15064 @item magentas
15065 Adjustments for magenta pixels (pixels where the green component is the minimum)
15066 @item whites
15067 Adjustments for white pixels (pixels where all components are greater than 128)
15068 @item neutrals
15069 Adjustments for all pixels except pure black and pure white
15070 @item blacks
15071 Adjustments for black pixels (pixels where all components are lesser than 128)
15072 @item psfile
15073 Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
15074 @end table
15075
15076 All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
15077 4 space separated floating point adjustment values in the [-1,1] range,
15078 respectively to adjust the amount of cyan, magenta, yellow and black for the
15079 pixels of its range.
15080
15081 @subsection Examples
15082
15083 @itemize
15084 @item
15085 Increase cyan by 50% and reduce yellow by 33% in every green areas, and
15086 increase magenta by 27% in blue areas:
15087 @example
15088 selectivecolor=greens=.5 0 -.33 0:blues=0 .27
15089 @end example
15090
15091 @item
15092 Use a Photoshop selective color preset:
15093 @example
15094 selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
15095 @end example
15096 @end itemize
15097
15098 @anchor{separatefields}
15099 @section separatefields
15100
15101 The @code{separatefields} takes a frame-based video input and splits
15102 each frame into its components fields, producing a new half height clip
15103 with twice the frame rate and twice the frame count.
15104
15105 This filter use field-dominance information in frame to decide which
15106 of each pair of fields to place first in the output.
15107 If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
15108
15109 @section setdar, setsar
15110
15111 The @code{setdar} filter sets the Display Aspect Ratio for the filter
15112 output video.
15113
15114 This is done by changing the specified Sample (aka Pixel) Aspect
15115 Ratio, according to the following equation:
15116 @example
15117 @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
15118 @end example
15119
15120 Keep in mind that the @code{setdar} filter does not modify the pixel
15121 dimensions of the video frame. Also, the display aspect ratio set by
15122 this filter may be changed by later filters in the filterchain,
15123 e.g. in case of scaling or if another "setdar" or a "setsar" filter is
15124 applied.
15125
15126 The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
15127 the filter output video.
15128
15129 Note that as a consequence of the application of this filter, the
15130 output display aspect ratio will change according to the equation
15131 above.
15132
15133 Keep in mind that the sample aspect ratio set by the @code{setsar}
15134 filter may be changed by later filters in the filterchain, e.g. if
15135 another "setsar" or a "setdar" filter is applied.
15136
15137 It accepts the following parameters:
15138
15139 @table @option
15140 @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
15141 Set the aspect ratio used by the filter.
15142
15143 The parameter can be a floating point number string, an expression, or
15144 a string of the form @var{num}:@var{den}, where @var{num} and
15145 @var{den} are the numerator and denominator of the aspect ratio. If
15146 the parameter is not specified, it is assumed the value "0".
15147 In case the form "@var{num}:@var{den}" is used, the @code{:} character
15148 should be escaped.
15149
15150 @item max
15151 Set the maximum integer value to use for expressing numerator and
15152 denominator when reducing the expressed aspect ratio to a rational.
15153 Default value is @code{100}.
15154
15155 @end table
15156
15157 The parameter @var{sar} is an expression containing
15158 the following constants:
15159
15160 @table @option
15161 @item E, PI, PHI
15162 These are approximated values for the mathematical constants e
15163 (Euler's number), pi (Greek pi), and phi (the golden ratio).
15164
15165 @item w, h
15166 The input width and height.
15167
15168 @item a
15169 These are the same as @var{w} / @var{h}.
15170
15171 @item sar
15172 The input sample aspect ratio.
15173
15174 @item dar
15175 The input display aspect ratio. It is the same as
15176 (@var{w} / @var{h}) * @var{sar}.
15177
15178 @item hsub, vsub
15179 Horizontal and vertical chroma subsample values. For example, for the
15180 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
15181 @end table
15182
15183 @subsection Examples
15184
15185 @itemize
15186
15187 @item
15188 To change the display aspect ratio to 16:9, specify one of the following:
15189 @example
15190 setdar=dar=1.77777
15191 setdar=dar=16/9
15192 @end example
15193
15194 @item
15195 To change the sample aspect ratio to 10:11, specify:
15196 @example
15197 setsar=sar=10/11
15198 @end example
15199
15200 @item
15201 To set a display aspect ratio of 16:9, and specify a maximum integer value of
15202 1000 in the aspect ratio reduction, use the command:
15203 @example
15204 setdar=ratio=16/9:max=1000
15205 @end example
15206
15207 @end itemize
15208
15209 @anchor{setfield}
15210 @section setfield
15211
15212 Force field for the output video frame.
15213
15214 The @code{setfield} filter marks the interlace type field for the
15215 output frames. It does not change the input frame, but only sets the
15216 corresponding property, which affects how the frame is treated by
15217 following filters (e.g. @code{fieldorder} or @code{yadif}).
15218
15219 The filter accepts the following options:
15220
15221 @table @option
15222
15223 @item mode
15224 Available values are:
15225
15226 @table @samp
15227 @item auto
15228 Keep the same field property.
15229
15230 @item bff
15231 Mark the frame as bottom-field-first.
15232
15233 @item tff
15234 Mark the frame as top-field-first.
15235
15236 @item prog
15237 Mark the frame as progressive.
15238 @end table
15239 @end table
15240
15241 @anchor{setparams}
15242 @section setparams
15243
15244 Force frame parameter for the output video frame.
15245
15246 The @code{setparams} filter marks interlace and color range for the
15247 output frames. It does not change the input frame, but only sets the
15248 corresponding property, which affects how the frame is treated by
15249 filters/encoders.
15250
15251 @table @option
15252 @item field_mode
15253 Available values are:
15254
15255 @table @samp
15256 @item auto
15257 Keep the same field property (default).
15258
15259 @item bff
15260 Mark the frame as bottom-field-first.
15261
15262 @item tff
15263 Mark the frame as top-field-first.
15264
15265 @item prog
15266 Mark the frame as progressive.
15267 @end table
15268
15269 @item range
15270 Available values are:
15271
15272 @table @samp
15273 @item auto
15274 Keep the same color range property (default).
15275
15276 @item unspecified, unknown
15277 Mark the frame as unspecified color range.
15278
15279 @item limited, tv, mpeg
15280 Mark the frame as limited range.
15281
15282 @item full, pc, jpeg
15283 Mark the frame as full range.
15284 @end table
15285
15286 @item color_primaries
15287 Set the color primaries.
15288 Available values are:
15289
15290 @table @samp
15291 @item auto
15292 Keep the same color primaries property (default).
15293
15294 @item bt709
15295 @item unknown
15296 @item bt470m
15297 @item bt470bg
15298 @item smpte170m
15299 @item smpte240m
15300 @item film
15301 @item bt2020
15302 @item smpte428
15303 @item smpte431
15304 @item smpte432
15305 @item jedec-p22
15306 @end table
15307
15308 @item color_trc
15309 Set the color transfert.
15310 Available values are:
15311
15312 @table @samp
15313 @item auto
15314 Keep the same color trc property (default).
15315
15316 @item bt709
15317 @item unknown
15318 @item bt470m
15319 @item bt470bg
15320 @item smpte170m
15321 @item smpte240m
15322 @item linear
15323 @item log100
15324 @item log316
15325 @item iec61966-2-4
15326 @item bt1361e
15327 @item iec61966-2-1
15328 @item bt2020-10
15329 @item bt2020-12
15330 @item smpte2084
15331 @item smpte428
15332 @item arib-std-b67
15333 @end table
15334
15335 @item colorspace
15336 Set the colorspace.
15337 Available values are:
15338
15339 @table @samp
15340 @item auto
15341 Keep the same colorspace property (default).
15342
15343 @item gbr
15344 @item bt709
15345 @item unknown
15346 @item fcc
15347 @item bt470bg
15348 @item smpte170m
15349 @item smpte240m
15350 @item ycgco
15351 @item bt2020nc
15352 @item bt2020c
15353 @item smpte2085
15354 @item chroma-derived-nc
15355 @item chroma-derived-c
15356 @item ictcp
15357 @end table
15358 @end table
15359
15360 @section showinfo
15361
15362 Show a line containing various information for each input video frame.
15363 The input video is not modified.
15364
15365 This filter supports the following options:
15366
15367 @table @option
15368 @item checksum
15369 Calculate checksums of each plane. By default enabled.
15370 @end table
15371
15372 The shown line contains a sequence of key/value pairs of the form
15373 @var{key}:@var{value}.
15374
15375 The following values are shown in the output:
15376
15377 @table @option
15378 @item n
15379 The (sequential) number of the input frame, starting from 0.
15380
15381 @item pts
15382 The Presentation TimeStamp of the input frame, expressed as a number of
15383 time base units. The time base unit depends on the filter input pad.
15384
15385 @item pts_time
15386 The Presentation TimeStamp of the input frame, expressed as a number of
15387 seconds.
15388
15389 @item pos
15390 The position of the frame in the input stream, or -1 if this information is
15391 unavailable and/or meaningless (for example in case of synthetic video).
15392
15393 @item fmt
15394 The pixel format name.
15395
15396 @item sar
15397 The sample aspect ratio of the input frame, expressed in the form
15398 @var{num}/@var{den}.
15399
15400 @item s
15401 The size of the input frame. For the syntax of this option, check the
15402 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15403
15404 @item i
15405 The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
15406 for bottom field first).
15407
15408 @item iskey
15409 This is 1 if the frame is a key frame, 0 otherwise.
15410
15411 @item type
15412 The picture type of the input frame ("I" for an I-frame, "P" for a
15413 P-frame, "B" for a B-frame, or "?" for an unknown type).
15414 Also refer to the documentation of the @code{AVPictureType} enum and of
15415 the @code{av_get_picture_type_char} function defined in
15416 @file{libavutil/avutil.h}.
15417
15418 @item checksum
15419 The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
15420
15421 @item plane_checksum
15422 The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
15423 expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
15424 @end table
15425
15426 @section showpalette
15427
15428 Displays the 256 colors palette of each frame. This filter is only relevant for
15429 @var{pal8} pixel format frames.
15430
15431 It accepts the following option:
15432
15433 @table @option
15434 @item s
15435 Set the size of the box used to represent one palette color entry. Default is
15436 @code{30} (for a @code{30x30} pixel box).
15437 @end table
15438
15439 @section shuffleframes
15440
15441 Reorder and/or duplicate and/or drop video frames.
15442
15443 It accepts the following parameters:
15444
15445 @table @option
15446 @item mapping
15447 Set the destination indexes of input frames.
15448 This is space or '|' separated list of indexes that maps input frames to output
15449 frames. Number of indexes also sets maximal value that each index may have.
15450 '-1' index have special meaning and that is to drop frame.
15451 @end table
15452
15453 The first frame has the index 0. The default is to keep the input unchanged.
15454
15455 @subsection Examples
15456
15457 @itemize
15458 @item
15459 Swap second and third frame of every three frames of the input:
15460 @example
15461 ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
15462 @end example
15463
15464 @item
15465 Swap 10th and 1st frame of every ten frames of the input:
15466 @example
15467 ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
15468 @end example
15469 @end itemize
15470
15471 @section shuffleplanes
15472
15473 Reorder and/or duplicate video planes.
15474
15475 It accepts the following parameters:
15476
15477 @table @option
15478
15479 @item map0
15480 The index of the input plane to be used as the first output plane.
15481
15482 @item map1
15483 The index of the input plane to be used as the second output plane.
15484
15485 @item map2
15486 The index of the input plane to be used as the third output plane.
15487
15488 @item map3
15489 The index of the input plane to be used as the fourth output plane.
15490
15491 @end table
15492
15493 The first plane has the index 0. The default is to keep the input unchanged.
15494
15495 @subsection Examples
15496
15497 @itemize
15498 @item
15499 Swap the second and third planes of the input:
15500 @example
15501 ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
15502 @end example
15503 @end itemize
15504
15505 @anchor{signalstats}
15506 @section signalstats
15507 Evaluate various visual metrics that assist in determining issues associated
15508 with the digitization of analog video media.
15509
15510 By default the filter will log these metadata values:
15511
15512 @table @option
15513 @item YMIN
15514 Display the minimal Y value contained within the input frame. Expressed in
15515 range of [0-255].
15516
15517 @item YLOW
15518 Display the Y value at the 10% percentile within the input frame. Expressed in
15519 range of [0-255].
15520
15521 @item YAVG
15522 Display the average Y value within the input frame. Expressed in range of
15523 [0-255].
15524
15525 @item YHIGH
15526 Display the Y value at the 90% percentile within the input frame. Expressed in
15527 range of [0-255].
15528
15529 @item YMAX
15530 Display the maximum Y value contained within the input frame. Expressed in
15531 range of [0-255].
15532
15533 @item UMIN
15534 Display the minimal U value contained within the input frame. Expressed in
15535 range of [0-255].
15536
15537 @item ULOW
15538 Display the U value at the 10% percentile within the input frame. Expressed in
15539 range of [0-255].
15540
15541 @item UAVG
15542 Display the average U value within the input frame. Expressed in range of
15543 [0-255].
15544
15545 @item UHIGH
15546 Display the U value at the 90% percentile within the input frame. Expressed in
15547 range of [0-255].
15548
15549 @item UMAX
15550 Display the maximum U value contained within the input frame. Expressed in
15551 range of [0-255].
15552
15553 @item VMIN
15554 Display the minimal V value contained within the input frame. Expressed in
15555 range of [0-255].
15556
15557 @item VLOW
15558 Display the V value at the 10% percentile within the input frame. Expressed in
15559 range of [0-255].
15560
15561 @item VAVG
15562 Display the average V value within the input frame. Expressed in range of
15563 [0-255].
15564
15565 @item VHIGH
15566 Display the V value at the 90% percentile within the input frame. Expressed in
15567 range of [0-255].
15568
15569 @item VMAX
15570 Display the maximum V value contained within the input frame. Expressed in
15571 range of [0-255].
15572
15573 @item SATMIN
15574 Display the minimal saturation value contained within the input frame.
15575 Expressed in range of [0-~181.02].
15576
15577 @item SATLOW
15578 Display the saturation value at the 10% percentile within the input frame.
15579 Expressed in range of [0-~181.02].
15580
15581 @item SATAVG
15582 Display the average saturation value within the input frame. Expressed in range
15583 of [0-~181.02].
15584
15585 @item SATHIGH
15586 Display the saturation value at the 90% percentile within the input frame.
15587 Expressed in range of [0-~181.02].
15588
15589 @item SATMAX
15590 Display the maximum saturation value contained within the input frame.
15591 Expressed in range of [0-~181.02].
15592
15593 @item HUEMED
15594 Display the median value for hue within the input frame. Expressed in range of
15595 [0-360].
15596
15597 @item HUEAVG
15598 Display the average value for hue within the input frame. Expressed in range of
15599 [0-360].
15600
15601 @item YDIF
15602 Display the average of sample value difference between all values of the Y
15603 plane in the current frame and corresponding values of the previous input frame.
15604 Expressed in range of [0-255].
15605
15606 @item UDIF
15607 Display the average of sample value difference between all values of the U
15608 plane in the current frame and corresponding values of the previous input frame.
15609 Expressed in range of [0-255].
15610
15611 @item VDIF
15612 Display the average of sample value difference between all values of the V
15613 plane in the current frame and corresponding values of the previous input frame.
15614 Expressed in range of [0-255].
15615
15616 @item YBITDEPTH
15617 Display bit depth of Y plane in current frame.
15618 Expressed in range of [0-16].
15619
15620 @item UBITDEPTH
15621 Display bit depth of U plane in current frame.
15622 Expressed in range of [0-16].
15623
15624 @item VBITDEPTH
15625 Display bit depth of V plane in current frame.
15626 Expressed in range of [0-16].
15627 @end table
15628
15629 The filter accepts the following options:
15630
15631 @table @option
15632 @item stat
15633 @item out
15634
15635 @option{stat} specify an additional form of image analysis.
15636 @option{out} output video with the specified type of pixel highlighted.
15637
15638 Both options accept the following values:
15639
15640 @table @samp
15641 @item tout
15642 Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
15643 unlike the neighboring pixels of the same field. Examples of temporal outliers
15644 include the results of video dropouts, head clogs, or tape tracking issues.
15645
15646 @item vrep
15647 Identify @var{vertical line repetition}. Vertical line repetition includes
15648 similar rows of pixels within a frame. In born-digital video vertical line
15649 repetition is common, but this pattern is uncommon in video digitized from an
15650 analog source. When it occurs in video that results from the digitization of an
15651 analog source it can indicate concealment from a dropout compensator.
15652
15653 @item brng
15654 Identify pixels that fall outside of legal broadcast range.
15655 @end table
15656
15657 @item color, c
15658 Set the highlight color for the @option{out} option. The default color is
15659 yellow.
15660 @end table
15661
15662 @subsection Examples
15663
15664 @itemize
15665 @item
15666 Output data of various video metrics:
15667 @example
15668 ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
15669 @end example
15670
15671 @item
15672 Output specific data about the minimum and maximum values of the Y plane per frame:
15673 @example
15674 ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
15675 @end example
15676
15677 @item
15678 Playback video while highlighting pixels that are outside of broadcast range in red.
15679 @example
15680 ffplay example.mov -vf signalstats="out=brng:color=red"
15681 @end example
15682
15683 @item
15684 Playback video with signalstats metadata drawn over the frame.
15685 @example
15686 ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
15687 @end example
15688
15689 The contents of signalstat_drawtext.txt used in the command are:
15690 @example
15691 time %@{pts:hms@}
15692 Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
15693 U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
15694 V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
15695 saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
15696
15697 @end example
15698 @end itemize
15699
15700 @anchor{signature}
15701 @section signature
15702
15703 Calculates the MPEG-7 Video Signature. The filter can handle more than one
15704 input. In this case the matching between the inputs can be calculated additionally.
15705 The filter always passes through the first input. The signature of each stream can
15706 be written into a file.
15707
15708 It accepts the following options:
15709
15710 @table @option
15711 @item detectmode
15712 Enable or disable the matching process.
15713
15714 Available values are:
15715
15716 @table @samp
15717 @item off
15718 Disable the calculation of a matching (default).
15719 @item full
15720 Calculate the matching for the whole video and output whether the whole video
15721 matches or only parts.
15722 @item fast
15723 Calculate only until a matching is found or the video ends. Should be faster in
15724 some cases.
15725 @end table
15726
15727 @item nb_inputs
15728 Set the number of inputs. The option value must be a non negative integer.
15729 Default value is 1.
15730
15731 @item filename
15732 Set the path to which the output is written. If there is more than one input,
15733 the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
15734 integer), that will be replaced with the input number. If no filename is
15735 specified, no output will be written. This is the default.
15736
15737 @item format
15738 Choose the output format.
15739
15740 Available values are:
15741
15742 @table @samp
15743 @item binary
15744 Use the specified binary representation (default).
15745 @item xml
15746 Use the specified xml representation.
15747 @end table
15748
15749 @item th_d
15750 Set threshold to detect one word as similar. The option value must be an integer
15751 greater than zero. The default value is 9000.
15752
15753 @item th_dc
15754 Set threshold to detect all words as similar. The option value must be an integer
15755 greater than zero. The default value is 60000.
15756
15757 @item th_xh
15758 Set threshold to detect frames as similar. The option value must be an integer
15759 greater than zero. The default value is 116.
15760
15761 @item th_di
15762 Set the minimum length of a sequence in frames to recognize it as matching
15763 sequence. The option value must be a non negative integer value.
15764 The default value is 0.
15765
15766 @item th_it
15767 Set the minimum relation, that matching frames to all frames must have.
15768 The option value must be a double value between 0 and 1. The default value is 0.5.
15769 @end table
15770
15771 @subsection Examples
15772
15773 @itemize
15774 @item
15775 To calculate the signature of an input video and store it in signature.bin:
15776 @example
15777 ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
15778 @end example
15779
15780 @item
15781 To detect whether two videos match and store the signatures in XML format in
15782 signature0.xml and signature1.xml:
15783 @example
15784 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 -
15785 @end example
15786
15787 @end itemize
15788
15789 @anchor{smartblur}
15790 @section smartblur
15791
15792 Blur the input video without impacting the outlines.
15793
15794 It accepts the following options:
15795
15796 @table @option
15797 @item luma_radius, lr
15798 Set the luma radius. The option value must be a float number in
15799 the range [0.1,5.0] that specifies the variance of the gaussian filter
15800 used to blur the image (slower if larger). Default value is 1.0.
15801
15802 @item luma_strength, ls
15803 Set the luma strength. The option value must be a float number
15804 in the range [-1.0,1.0] that configures the blurring. A value included
15805 in [0.0,1.0] will blur the image whereas a value included in
15806 [-1.0,0.0] will sharpen the image. Default value is 1.0.
15807
15808 @item luma_threshold, lt
15809 Set the luma threshold used as a coefficient to determine
15810 whether a pixel should be blurred or not. The option value must be an
15811 integer in the range [-30,30]. A value of 0 will filter all the image,
15812 a value included in [0,30] will filter flat areas and a value included
15813 in [-30,0] will filter edges. Default value is 0.
15814
15815 @item chroma_radius, cr
15816 Set the chroma radius. The option value must be a float number in
15817 the range [0.1,5.0] that specifies the variance of the gaussian filter
15818 used to blur the image (slower if larger). Default value is @option{luma_radius}.
15819
15820 @item chroma_strength, cs
15821 Set the chroma strength. The option value must be a float number
15822 in the range [-1.0,1.0] that configures the blurring. A value included
15823 in [0.0,1.0] will blur the image whereas a value included in
15824 [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
15825
15826 @item chroma_threshold, ct
15827 Set the chroma threshold used as a coefficient to determine
15828 whether a pixel should be blurred or not. The option value must be an
15829 integer in the range [-30,30]. A value of 0 will filter all the image,
15830 a value included in [0,30] will filter flat areas and a value included
15831 in [-30,0] will filter edges. Default value is @option{luma_threshold}.
15832 @end table
15833
15834 If a chroma option is not explicitly set, the corresponding luma value
15835 is set.
15836
15837 @section ssim
15838
15839 Obtain the SSIM (Structural SImilarity Metric) between two input videos.
15840
15841 This filter takes in input two input videos, the first input is
15842 considered the "main" source and is passed unchanged to the
15843 output. The second input is used as a "reference" video for computing
15844 the SSIM.
15845
15846 Both video inputs must have the same resolution and pixel format for
15847 this filter to work correctly. Also it assumes that both inputs
15848 have the same number of frames, which are compared one by one.
15849
15850 The filter stores the calculated SSIM of each frame.
15851
15852 The description of the accepted parameters follows.
15853
15854 @table @option
15855 @item stats_file, f
15856 If specified the filter will use the named file to save the SSIM of
15857 each individual frame. When filename equals "-" the data is sent to
15858 standard output.
15859 @end table
15860
15861 The file printed if @var{stats_file} is selected, contains a sequence of
15862 key/value pairs of the form @var{key}:@var{value} for each compared
15863 couple of frames.
15864
15865 A description of each shown parameter follows:
15866
15867 @table @option
15868 @item n
15869 sequential number of the input frame, starting from 1
15870
15871 @item Y, U, V, R, G, B
15872 SSIM of the compared frames for the component specified by the suffix.
15873
15874 @item All
15875 SSIM of the compared frames for the whole frame.
15876
15877 @item dB
15878 Same as above but in dB representation.
15879 @end table
15880
15881 This filter also supports the @ref{framesync} options.
15882
15883 For example:
15884 @example
15885 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
15886 [main][ref] ssim="stats_file=stats.log" [out]
15887 @end example
15888
15889 On this example the input file being processed is compared with the
15890 reference file @file{ref_movie.mpg}. The SSIM of each individual frame
15891 is stored in @file{stats.log}.
15892
15893 Another example with both psnr and ssim at same time:
15894 @example
15895 ffmpeg -i main.mpg -i ref.mpg -lavfi  "ssim;[0:v][1:v]psnr" -f null -
15896 @end example
15897
15898 @section stereo3d
15899
15900 Convert between different stereoscopic image formats.
15901
15902 The filters accept the following options:
15903
15904 @table @option
15905 @item in
15906 Set stereoscopic image format of input.
15907
15908 Available values for input image formats are:
15909 @table @samp
15910 @item sbsl
15911 side by side parallel (left eye left, right eye right)
15912
15913 @item sbsr
15914 side by side crosseye (right eye left, left eye right)
15915
15916 @item sbs2l
15917 side by side parallel with half width resolution
15918 (left eye left, right eye right)
15919
15920 @item sbs2r
15921 side by side crosseye with half width resolution
15922 (right eye left, left eye right)
15923
15924 @item abl
15925 above-below (left eye above, right eye below)
15926
15927 @item abr
15928 above-below (right eye above, left eye below)
15929
15930 @item ab2l
15931 above-below with half height resolution
15932 (left eye above, right eye below)
15933
15934 @item ab2r
15935 above-below with half height resolution
15936 (right eye above, left eye below)
15937
15938 @item al
15939 alternating frames (left eye first, right eye second)
15940
15941 @item ar
15942 alternating frames (right eye first, left eye second)
15943
15944 @item irl
15945 interleaved rows (left eye has top row, right eye starts on next row)
15946
15947 @item irr
15948 interleaved rows (right eye has top row, left eye starts on next row)
15949
15950 @item icl
15951 interleaved columns, left eye first
15952
15953 @item icr
15954 interleaved columns, right eye first
15955
15956 Default value is @samp{sbsl}.
15957 @end table
15958
15959 @item out
15960 Set stereoscopic image format of output.
15961
15962 @table @samp
15963 @item sbsl
15964 side by side parallel (left eye left, right eye right)
15965
15966 @item sbsr
15967 side by side crosseye (right eye left, left eye right)
15968
15969 @item sbs2l
15970 side by side parallel with half width resolution
15971 (left eye left, right eye right)
15972
15973 @item sbs2r
15974 side by side crosseye with half width resolution
15975 (right eye left, left eye right)
15976
15977 @item abl
15978 above-below (left eye above, right eye below)
15979
15980 @item abr
15981 above-below (right eye above, left eye below)
15982
15983 @item ab2l
15984 above-below with half height resolution
15985 (left eye above, right eye below)
15986
15987 @item ab2r
15988 above-below with half height resolution
15989 (right eye above, left eye below)
15990
15991 @item al
15992 alternating frames (left eye first, right eye second)
15993
15994 @item ar
15995 alternating frames (right eye first, left eye second)
15996
15997 @item irl
15998 interleaved rows (left eye has top row, right eye starts on next row)
15999
16000 @item irr
16001 interleaved rows (right eye has top row, left eye starts on next row)
16002
16003 @item arbg
16004 anaglyph red/blue gray
16005 (red filter on left eye, blue filter on right eye)
16006
16007 @item argg
16008 anaglyph red/green gray
16009 (red filter on left eye, green filter on right eye)
16010
16011 @item arcg
16012 anaglyph red/cyan gray
16013 (red filter on left eye, cyan filter on right eye)
16014
16015 @item arch
16016 anaglyph red/cyan half colored
16017 (red filter on left eye, cyan filter on right eye)
16018
16019 @item arcc
16020 anaglyph red/cyan color
16021 (red filter on left eye, cyan filter on right eye)
16022
16023 @item arcd
16024 anaglyph red/cyan color optimized with the least squares projection of dubois
16025 (red filter on left eye, cyan filter on right eye)
16026
16027 @item agmg
16028 anaglyph green/magenta gray
16029 (green filter on left eye, magenta filter on right eye)
16030
16031 @item agmh
16032 anaglyph green/magenta half colored
16033 (green filter on left eye, magenta filter on right eye)
16034
16035 @item agmc
16036 anaglyph green/magenta colored
16037 (green filter on left eye, magenta filter on right eye)
16038
16039 @item agmd
16040 anaglyph green/magenta color optimized with the least squares projection of dubois
16041 (green filter on left eye, magenta filter on right eye)
16042
16043 @item aybg
16044 anaglyph yellow/blue gray
16045 (yellow filter on left eye, blue filter on right eye)
16046
16047 @item aybh
16048 anaglyph yellow/blue half colored
16049 (yellow filter on left eye, blue filter on right eye)
16050
16051 @item aybc
16052 anaglyph yellow/blue colored
16053 (yellow filter on left eye, blue filter on right eye)
16054
16055 @item aybd
16056 anaglyph yellow/blue color optimized with the least squares projection of dubois
16057 (yellow filter on left eye, blue filter on right eye)
16058
16059 @item ml
16060 mono output (left eye only)
16061
16062 @item mr
16063 mono output (right eye only)
16064
16065 @item chl
16066 checkerboard, left eye first
16067
16068 @item chr
16069 checkerboard, right eye first
16070
16071 @item icl
16072 interleaved columns, left eye first
16073
16074 @item icr
16075 interleaved columns, right eye first
16076
16077 @item hdmi
16078 HDMI frame pack
16079 @end table
16080
16081 Default value is @samp{arcd}.
16082 @end table
16083
16084 @subsection Examples
16085
16086 @itemize
16087 @item
16088 Convert input video from side by side parallel to anaglyph yellow/blue dubois:
16089 @example
16090 stereo3d=sbsl:aybd
16091 @end example
16092
16093 @item
16094 Convert input video from above below (left eye above, right eye below) to side by side crosseye.
16095 @example
16096 stereo3d=abl:sbsr
16097 @end example
16098 @end itemize
16099
16100 @section streamselect, astreamselect
16101 Select video or audio streams.
16102
16103 The filter accepts the following options:
16104
16105 @table @option
16106 @item inputs
16107 Set number of inputs. Default is 2.
16108
16109 @item map
16110 Set input indexes to remap to outputs.
16111 @end table
16112
16113 @subsection Commands
16114
16115 The @code{streamselect} and @code{astreamselect} filter supports the following
16116 commands:
16117
16118 @table @option
16119 @item map
16120 Set input indexes to remap to outputs.
16121 @end table
16122
16123 @subsection Examples
16124
16125 @itemize
16126 @item
16127 Select first 5 seconds 1st stream and rest of time 2nd stream:
16128 @example
16129 sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
16130 @end example
16131
16132 @item
16133 Same as above, but for audio:
16134 @example
16135 asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
16136 @end example
16137 @end itemize
16138
16139 @section sobel
16140 Apply sobel operator to input video stream.
16141
16142 The filter accepts the following option:
16143
16144 @table @option
16145 @item planes
16146 Set which planes will be processed, unprocessed planes will be copied.
16147 By default value 0xf, all planes will be processed.
16148
16149 @item scale
16150 Set value which will be multiplied with filtered result.
16151
16152 @item delta
16153 Set value which will be added to filtered result.
16154 @end table
16155
16156 @anchor{spp}
16157 @section spp
16158
16159 Apply a simple postprocessing filter that compresses and decompresses the image
16160 at several (or - in the case of @option{quality} level @code{6} - all) shifts
16161 and average the results.
16162
16163 The filter accepts the following options:
16164
16165 @table @option
16166 @item quality
16167 Set quality. This option defines the number of levels for averaging. It accepts
16168 an integer in the range 0-6. If set to @code{0}, the filter will have no
16169 effect. A value of @code{6} means the higher quality. For each increment of
16170 that value the speed drops by a factor of approximately 2.  Default value is
16171 @code{3}.
16172
16173 @item qp
16174 Force a constant quantization parameter. If not set, the filter will use the QP
16175 from the video stream (if available).
16176
16177 @item mode
16178 Set thresholding mode. Available modes are:
16179
16180 @table @samp
16181 @item hard
16182 Set hard thresholding (default).
16183 @item soft
16184 Set soft thresholding (better de-ringing effect, but likely blurrier).
16185 @end table
16186
16187 @item use_bframe_qp
16188 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
16189 option may cause flicker since the B-Frames have often larger QP. Default is
16190 @code{0} (not enabled).
16191 @end table
16192
16193 @section sr
16194
16195 Scale the input by applying one of the super-resolution methods based on
16196 convolutional neural networks. Supported models:
16197
16198 @itemize
16199 @item
16200 Super-Resolution Convolutional Neural Network model (SRCNN).
16201 See @url{https://arxiv.org/abs/1501.00092}.
16202
16203 @item
16204 Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
16205 See @url{https://arxiv.org/abs/1609.05158}.
16206 @end itemize
16207
16208 Training scripts as well as scripts for model generation are provided in
16209 the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
16210
16211 The filter accepts the following options:
16212
16213 @table @option
16214 @item dnn_backend
16215 Specify which DNN backend to use for model loading and execution. This option accepts
16216 the following values:
16217
16218 @table @samp
16219 @item native
16220 Native implementation of DNN loading and execution.
16221
16222 @item tensorflow
16223 TensorFlow backend. To enable this backend you
16224 need to install the TensorFlow for C library (see
16225 @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
16226 @code{--enable-libtensorflow}
16227 @end table
16228
16229 Default value is @samp{native}.
16230
16231 @item model
16232 Set path to model file specifying network architecture and its parameters.
16233 Note that different backends use different file formats. TensorFlow backend
16234 can load files for both formats, while native backend can load files for only
16235 its format.
16236
16237 @item scale_factor
16238 Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
16239 Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
16240 input upscaled using bicubic upscaling with proper scale factor.
16241 @end table
16242
16243 @anchor{subtitles}
16244 @section subtitles
16245
16246 Draw subtitles on top of input video using the libass library.
16247
16248 To enable compilation of this filter you need to configure FFmpeg with
16249 @code{--enable-libass}. This filter also requires a build with libavcodec and
16250 libavformat to convert the passed subtitles file to ASS (Advanced Substation
16251 Alpha) subtitles format.
16252
16253 The filter accepts the following options:
16254
16255 @table @option
16256 @item filename, f
16257 Set the filename of the subtitle file to read. It must be specified.
16258
16259 @item original_size
16260 Specify the size of the original video, the video for which the ASS file
16261 was composed. For the syntax of this option, check the
16262 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16263 Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
16264 correctly scale the fonts if the aspect ratio has been changed.
16265
16266 @item fontsdir
16267 Set a directory path containing fonts that can be used by the filter.
16268 These fonts will be used in addition to whatever the font provider uses.
16269
16270 @item alpha
16271 Process alpha channel, by default alpha channel is untouched.
16272
16273 @item charenc
16274 Set subtitles input character encoding. @code{subtitles} filter only. Only
16275 useful if not UTF-8.
16276
16277 @item stream_index, si
16278 Set subtitles stream index. @code{subtitles} filter only.
16279
16280 @item force_style
16281 Override default style or script info parameters of the subtitles. It accepts a
16282 string containing ASS style format @code{KEY=VALUE} couples separated by ",".
16283 @end table
16284
16285 If the first key is not specified, it is assumed that the first value
16286 specifies the @option{filename}.
16287
16288 For example, to render the file @file{sub.srt} on top of the input
16289 video, use the command:
16290 @example
16291 subtitles=sub.srt
16292 @end example
16293
16294 which is equivalent to:
16295 @example
16296 subtitles=filename=sub.srt
16297 @end example
16298
16299 To render the default subtitles stream from file @file{video.mkv}, use:
16300 @example
16301 subtitles=video.mkv
16302 @end example
16303
16304 To render the second subtitles stream from that file, use:
16305 @example
16306 subtitles=video.mkv:si=1
16307 @end example
16308
16309 To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
16310 @code{DejaVu Serif}, use:
16311 @example
16312 subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
16313 @end example
16314
16315 @section super2xsai
16316
16317 Scale the input by 2x and smooth using the Super2xSaI (Scale and
16318 Interpolate) pixel art scaling algorithm.
16319
16320 Useful for enlarging pixel art images without reducing sharpness.
16321
16322 @section swaprect
16323
16324 Swap two rectangular objects in video.
16325
16326 This filter accepts the following options:
16327
16328 @table @option
16329 @item w
16330 Set object width.
16331
16332 @item h
16333 Set object height.
16334
16335 @item x1
16336 Set 1st rect x coordinate.
16337
16338 @item y1
16339 Set 1st rect y coordinate.
16340
16341 @item x2
16342 Set 2nd rect x coordinate.
16343
16344 @item y2
16345 Set 2nd rect y coordinate.
16346
16347 All expressions are evaluated once for each frame.
16348 @end table
16349
16350 The all options are expressions containing the following constants:
16351
16352 @table @option
16353 @item w
16354 @item h
16355 The input width and height.
16356
16357 @item a
16358 same as @var{w} / @var{h}
16359
16360 @item sar
16361 input sample aspect ratio
16362
16363 @item dar
16364 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
16365
16366 @item n
16367 The number of the input frame, starting from 0.
16368
16369 @item t
16370 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
16371
16372 @item pos
16373 the position in the file of the input frame, NAN if unknown
16374 @end table
16375
16376 @section swapuv
16377 Swap U & V plane.
16378
16379 @section telecine
16380
16381 Apply telecine process to the video.
16382
16383 This filter accepts the following options:
16384
16385 @table @option
16386 @item first_field
16387 @table @samp
16388 @item top, t
16389 top field first
16390 @item bottom, b
16391 bottom field first
16392 The default value is @code{top}.
16393 @end table
16394
16395 @item pattern
16396 A string of numbers representing the pulldown pattern you wish to apply.
16397 The default value is @code{23}.
16398 @end table
16399
16400 @example
16401 Some typical patterns:
16402
16403 NTSC output (30i):
16404 27.5p: 32222
16405 24p: 23 (classic)
16406 24p: 2332 (preferred)
16407 20p: 33
16408 18p: 334
16409 16p: 3444
16410
16411 PAL output (25i):
16412 27.5p: 12222
16413 24p: 222222222223 ("Euro pulldown")
16414 16.67p: 33
16415 16p: 33333334
16416 @end example
16417
16418 @section threshold
16419
16420 Apply threshold effect to video stream.
16421
16422 This filter needs four video streams to perform thresholding.
16423 First stream is stream we are filtering.
16424 Second stream is holding threshold values, third stream is holding min values,
16425 and last, fourth stream is holding max values.
16426
16427 The filter accepts the following option:
16428
16429 @table @option
16430 @item planes
16431 Set which planes will be processed, unprocessed planes will be copied.
16432 By default value 0xf, all planes will be processed.
16433 @end table
16434
16435 For example if first stream pixel's component value is less then threshold value
16436 of pixel component from 2nd threshold stream, third stream value will picked,
16437 otherwise fourth stream pixel component value will be picked.
16438
16439 Using color source filter one can perform various types of thresholding:
16440
16441 @subsection Examples
16442
16443 @itemize
16444 @item
16445 Binary threshold, using gray color as threshold:
16446 @example
16447 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
16448 @end example
16449
16450 @item
16451 Inverted binary threshold, using gray color as threshold:
16452 @example
16453 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
16454 @end example
16455
16456 @item
16457 Truncate binary threshold, using gray color as threshold:
16458 @example
16459 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
16460 @end example
16461
16462 @item
16463 Threshold to zero, using gray color as threshold:
16464 @example
16465 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
16466 @end example
16467
16468 @item
16469 Inverted threshold to zero, using gray color as threshold:
16470 @example
16471 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
16472 @end example
16473 @end itemize
16474
16475 @section thumbnail
16476 Select the most representative frame in a given sequence of consecutive frames.
16477
16478 The filter accepts the following options:
16479
16480 @table @option
16481 @item n
16482 Set the frames batch size to analyze; in a set of @var{n} frames, the filter
16483 will pick one of them, and then handle the next batch of @var{n} frames until
16484 the end. Default is @code{100}.
16485 @end table
16486
16487 Since the filter keeps track of the whole frames sequence, a bigger @var{n}
16488 value will result in a higher memory usage, so a high value is not recommended.
16489
16490 @subsection Examples
16491
16492 @itemize
16493 @item
16494 Extract one picture each 50 frames:
16495 @example
16496 thumbnail=50
16497 @end example
16498
16499 @item
16500 Complete example of a thumbnail creation with @command{ffmpeg}:
16501 @example
16502 ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
16503 @end example
16504 @end itemize
16505
16506 @section tile
16507
16508 Tile several successive frames together.
16509
16510 The filter accepts the following options:
16511
16512 @table @option
16513
16514 @item layout
16515 Set the grid size (i.e. the number of lines and columns). For the syntax of
16516 this option, check the
16517 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16518
16519 @item nb_frames
16520 Set the maximum number of frames to render in the given area. It must be less
16521 than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
16522 the area will be used.
16523
16524 @item margin
16525 Set the outer border margin in pixels.
16526
16527 @item padding
16528 Set the inner border thickness (i.e. the number of pixels between frames). For
16529 more advanced padding options (such as having different values for the edges),
16530 refer to the pad video filter.
16531
16532 @item color
16533 Specify the color of the unused area. For the syntax of this option, check the
16534 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
16535 The default value of @var{color} is "black".
16536
16537 @item overlap
16538 Set the number of frames to overlap when tiling several successive frames together.
16539 The value must be between @code{0} and @var{nb_frames - 1}.
16540
16541 @item init_padding
16542 Set the number of frames to initially be empty before displaying first output frame.
16543 This controls how soon will one get first output frame.
16544 The value must be between @code{0} and @var{nb_frames - 1}.
16545 @end table
16546
16547 @subsection Examples
16548
16549 @itemize
16550 @item
16551 Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
16552 @example
16553 ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
16554 @end example
16555 The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
16556 duplicating each output frame to accommodate the originally detected frame
16557 rate.
16558
16559 @item
16560 Display @code{5} pictures in an area of @code{3x2} frames,
16561 with @code{7} pixels between them, and @code{2} pixels of initial margin, using
16562 mixed flat and named options:
16563 @example
16564 tile=3x2:nb_frames=5:padding=7:margin=2
16565 @end example
16566 @end itemize
16567
16568 @section tinterlace
16569
16570 Perform various types of temporal field interlacing.
16571
16572 Frames are counted starting from 1, so the first input frame is
16573 considered odd.
16574
16575 The filter accepts the following options:
16576
16577 @table @option
16578
16579 @item mode
16580 Specify the mode of the interlacing. This option can also be specified
16581 as a value alone. See below for a list of values for this option.
16582
16583 Available values are:
16584
16585 @table @samp
16586 @item merge, 0
16587 Move odd frames into the upper field, even into the lower field,
16588 generating a double height frame at half frame rate.
16589 @example
16590  ------> time
16591 Input:
16592 Frame 1         Frame 2         Frame 3         Frame 4
16593
16594 11111           22222           33333           44444
16595 11111           22222           33333           44444
16596 11111           22222           33333           44444
16597 11111           22222           33333           44444
16598
16599 Output:
16600 11111                           33333
16601 22222                           44444
16602 11111                           33333
16603 22222                           44444
16604 11111                           33333
16605 22222                           44444
16606 11111                           33333
16607 22222                           44444
16608 @end example
16609
16610 @item drop_even, 1
16611 Only output odd frames, even frames are dropped, generating a frame with
16612 unchanged height at half frame rate.
16613
16614 @example
16615  ------> time
16616 Input:
16617 Frame 1         Frame 2         Frame 3         Frame 4
16618
16619 11111           22222           33333           44444
16620 11111           22222           33333           44444
16621 11111           22222           33333           44444
16622 11111           22222           33333           44444
16623
16624 Output:
16625 11111                           33333
16626 11111                           33333
16627 11111                           33333
16628 11111                           33333
16629 @end example
16630
16631 @item drop_odd, 2
16632 Only output even frames, odd frames are dropped, generating a frame with
16633 unchanged height at half frame rate.
16634
16635 @example
16636  ------> time
16637 Input:
16638 Frame 1         Frame 2         Frame 3         Frame 4
16639
16640 11111           22222           33333           44444
16641 11111           22222           33333           44444
16642 11111           22222           33333           44444
16643 11111           22222           33333           44444
16644
16645 Output:
16646                 22222                           44444
16647                 22222                           44444
16648                 22222                           44444
16649                 22222                           44444
16650 @end example
16651
16652 @item pad, 3
16653 Expand each frame to full height, but pad alternate lines with black,
16654 generating a frame with double height at the same input frame rate.
16655
16656 @example
16657  ------> time
16658 Input:
16659 Frame 1         Frame 2         Frame 3         Frame 4
16660
16661 11111           22222           33333           44444
16662 11111           22222           33333           44444
16663 11111           22222           33333           44444
16664 11111           22222           33333           44444
16665
16666 Output:
16667 11111           .....           33333           .....
16668 .....           22222           .....           44444
16669 11111           .....           33333           .....
16670 .....           22222           .....           44444
16671 11111           .....           33333           .....
16672 .....           22222           .....           44444
16673 11111           .....           33333           .....
16674 .....           22222           .....           44444
16675 @end example
16676
16677
16678 @item interleave_top, 4
16679 Interleave the upper field from odd frames with the lower field from
16680 even frames, generating a frame with unchanged height at half frame rate.
16681
16682 @example
16683  ------> time
16684 Input:
16685 Frame 1         Frame 2         Frame 3         Frame 4
16686
16687 11111<-         22222           33333<-         44444
16688 11111           22222<-         33333           44444<-
16689 11111<-         22222           33333<-         44444
16690 11111           22222<-         33333           44444<-
16691
16692 Output:
16693 11111                           33333
16694 22222                           44444
16695 11111                           33333
16696 22222                           44444
16697 @end example
16698
16699
16700 @item interleave_bottom, 5
16701 Interleave the lower field from odd frames with the upper field from
16702 even frames, generating a frame with unchanged height at half frame rate.
16703
16704 @example
16705  ------> time
16706 Input:
16707 Frame 1         Frame 2         Frame 3         Frame 4
16708
16709 11111           22222<-         33333           44444<-
16710 11111<-         22222           33333<-         44444
16711 11111           22222<-         33333           44444<-
16712 11111<-         22222           33333<-         44444
16713
16714 Output:
16715 22222                           44444
16716 11111                           33333
16717 22222                           44444
16718 11111                           33333
16719 @end example
16720
16721
16722 @item interlacex2, 6
16723 Double frame rate with unchanged height. Frames are inserted each
16724 containing the second temporal field from the previous input frame and
16725 the first temporal field from the next input frame. This mode relies on
16726 the top_field_first flag. Useful for interlaced video displays with no
16727 field synchronisation.
16728
16729 @example
16730  ------> time
16731 Input:
16732 Frame 1         Frame 2         Frame 3         Frame 4
16733
16734 11111           22222           33333           44444
16735  11111           22222           33333           44444
16736 11111           22222           33333           44444
16737  11111           22222           33333           44444
16738
16739 Output:
16740 11111   22222   22222   33333   33333   44444   44444
16741  11111   11111   22222   22222   33333   33333   44444
16742 11111   22222   22222   33333   33333   44444   44444
16743  11111   11111   22222   22222   33333   33333   44444
16744 @end example
16745
16746
16747 @item mergex2, 7
16748 Move odd frames into the upper field, even into the lower field,
16749 generating a double height frame at same frame rate.
16750
16751 @example
16752  ------> time
16753 Input:
16754 Frame 1         Frame 2         Frame 3         Frame 4
16755
16756 11111           22222           33333           44444
16757 11111           22222           33333           44444
16758 11111           22222           33333           44444
16759 11111           22222           33333           44444
16760
16761 Output:
16762 11111           33333           33333           55555
16763 22222           22222           44444           44444
16764 11111           33333           33333           55555
16765 22222           22222           44444           44444
16766 11111           33333           33333           55555
16767 22222           22222           44444           44444
16768 11111           33333           33333           55555
16769 22222           22222           44444           44444
16770 @end example
16771
16772 @end table
16773
16774 Numeric values are deprecated but are accepted for backward
16775 compatibility reasons.
16776
16777 Default mode is @code{merge}.
16778
16779 @item flags
16780 Specify flags influencing the filter process.
16781
16782 Available value for @var{flags} is:
16783
16784 @table @option
16785 @item low_pass_filter, vlfp
16786 Enable linear vertical low-pass filtering in the filter.
16787 Vertical low-pass filtering is required when creating an interlaced
16788 destination from a progressive source which contains high-frequency
16789 vertical detail. Filtering will reduce interlace 'twitter' and Moire
16790 patterning.
16791
16792 @item complex_filter, cvlfp
16793 Enable complex vertical low-pass filtering.
16794 This will slightly less reduce interlace 'twitter' and Moire
16795 patterning but better retain detail and subjective sharpness impression.
16796
16797 @end table
16798
16799 Vertical low-pass filtering can only be enabled for @option{mode}
16800 @var{interleave_top} and @var{interleave_bottom}.
16801
16802 @end table
16803
16804 @section tmix
16805
16806 Mix successive video frames.
16807
16808 A description of the accepted options follows.
16809
16810 @table @option
16811 @item frames
16812 The number of successive frames to mix. If unspecified, it defaults to 3.
16813
16814 @item weights
16815 Specify weight of each input video frame.
16816 Each weight is separated by space. If number of weights is smaller than
16817 number of @var{frames} last specified weight will be used for all remaining
16818 unset weights.
16819
16820 @item scale
16821 Specify scale, if it is set it will be multiplied with sum
16822 of each weight multiplied with pixel values to give final destination
16823 pixel value. By default @var{scale} is auto scaled to sum of weights.
16824 @end table
16825
16826 @subsection Examples
16827
16828 @itemize
16829 @item
16830 Average 7 successive frames:
16831 @example
16832 tmix=frames=7:weights="1 1 1 1 1 1 1"
16833 @end example
16834
16835 @item
16836 Apply simple temporal convolution:
16837 @example
16838 tmix=frames=3:weights="-1 3 -1"
16839 @end example
16840
16841 @item
16842 Similar as above but only showing temporal differences:
16843 @example
16844 tmix=frames=3:weights="-1 2 -1":scale=1
16845 @end example
16846 @end itemize
16847
16848 @anchor{tonemap}
16849 @section tonemap
16850 Tone map colors from different dynamic ranges.
16851
16852 This filter expects data in single precision floating point, as it needs to
16853 operate on (and can output) out-of-range values. Another filter, such as
16854 @ref{zscale}, is needed to convert the resulting frame to a usable format.
16855
16856 The tonemapping algorithms implemented only work on linear light, so input
16857 data should be linearized beforehand (and possibly correctly tagged).
16858
16859 @example
16860 ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
16861 @end example
16862
16863 @subsection Options
16864 The filter accepts the following options.
16865
16866 @table @option
16867 @item tonemap
16868 Set the tone map algorithm to use.
16869
16870 Possible values are:
16871 @table @var
16872 @item none
16873 Do not apply any tone map, only desaturate overbright pixels.
16874
16875 @item clip
16876 Hard-clip any out-of-range values. Use it for perfect color accuracy for
16877 in-range values, while distorting out-of-range values.
16878
16879 @item linear
16880 Stretch the entire reference gamut to a linear multiple of the display.
16881
16882 @item gamma
16883 Fit a logarithmic transfer between the tone curves.
16884
16885 @item reinhard
16886 Preserve overall image brightness with a simple curve, using nonlinear
16887 contrast, which results in flattening details and degrading color accuracy.
16888
16889 @item hable
16890 Preserve both dark and bright details better than @var{reinhard}, at the cost
16891 of slightly darkening everything. Use it when detail preservation is more
16892 important than color and brightness accuracy.
16893
16894 @item mobius
16895 Smoothly map out-of-range values, while retaining contrast and colors for
16896 in-range material as much as possible. Use it when color accuracy is more
16897 important than detail preservation.
16898 @end table
16899
16900 Default is none.
16901
16902 @item param
16903 Tune the tone mapping algorithm.
16904
16905 This affects the following algorithms:
16906 @table @var
16907 @item none
16908 Ignored.
16909
16910 @item linear
16911 Specifies the scale factor to use while stretching.
16912 Default to 1.0.
16913
16914 @item gamma
16915 Specifies the exponent of the function.
16916 Default to 1.8.
16917
16918 @item clip
16919 Specify an extra linear coefficient to multiply into the signal before clipping.
16920 Default to 1.0.
16921
16922 @item reinhard
16923 Specify the local contrast coefficient at the display peak.
16924 Default to 0.5, which means that in-gamut values will be about half as bright
16925 as when clipping.
16926
16927 @item hable
16928 Ignored.
16929
16930 @item mobius
16931 Specify the transition point from linear to mobius transform. Every value
16932 below this point is guaranteed to be mapped 1:1. The higher the value, the
16933 more accurate the result will be, at the cost of losing bright details.
16934 Default to 0.3, which due to the steep initial slope still preserves in-range
16935 colors fairly accurately.
16936 @end table
16937
16938 @item desat
16939 Apply desaturation for highlights that exceed this level of brightness. The
16940 higher the parameter, the more color information will be preserved. This
16941 setting helps prevent unnaturally blown-out colors for super-highlights, by
16942 (smoothly) turning into white instead. This makes images feel more natural,
16943 at the cost of reducing information about out-of-range colors.
16944
16945 The default of 2.0 is somewhat conservative and will mostly just apply to
16946 skies or directly sunlit surfaces. A setting of 0.0 disables this option.
16947
16948 This option works only if the input frame has a supported color tag.
16949
16950 @item peak
16951 Override signal/nominal/reference peak with this value. Useful when the
16952 embedded peak information in display metadata is not reliable or when tone
16953 mapping from a lower range to a higher range.
16954 @end table
16955
16956 @section tpad
16957
16958 Temporarily pad video frames.
16959
16960 The filter accepts the following options:
16961
16962 @table @option
16963 @item start
16964 Specify number of delay frames before input video stream.
16965
16966 @item stop
16967 Specify number of padding frames after input video stream.
16968 Set to -1 to pad indefinitely.
16969
16970 @item start_mode
16971 Set kind of frames added to beginning of stream.
16972 Can be either @var{add} or @var{clone}.
16973 With @var{add} frames of solid-color are added.
16974 With @var{clone} frames are clones of first frame.
16975
16976 @item stop_mode
16977 Set kind of frames added to end of stream.
16978 Can be either @var{add} or @var{clone}.
16979 With @var{add} frames of solid-color are added.
16980 With @var{clone} frames are clones of last frame.
16981
16982 @item start_duration, stop_duration
16983 Specify the duration of the start/stop delay. See
16984 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
16985 for the accepted syntax.
16986 These options override @var{start} and @var{stop}.
16987
16988 @item color
16989 Specify the color of the padded area. For the syntax of this option,
16990 check the @ref{color syntax,,"Color" section in the ffmpeg-utils
16991 manual,ffmpeg-utils}.
16992
16993 The default value of @var{color} is "black".
16994 @end table
16995
16996 @anchor{transpose}
16997 @section transpose
16998
16999 Transpose rows with columns in the input video and optionally flip it.
17000
17001 It accepts the following parameters:
17002
17003 @table @option
17004
17005 @item dir
17006 Specify the transposition direction.
17007
17008 Can assume the following values:
17009 @table @samp
17010 @item 0, 4, cclock_flip
17011 Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
17012 @example
17013 L.R     L.l
17014 . . ->  . .
17015 l.r     R.r
17016 @end example
17017
17018 @item 1, 5, clock
17019 Rotate by 90 degrees clockwise, that is:
17020 @example
17021 L.R     l.L
17022 . . ->  . .
17023 l.r     r.R
17024 @end example
17025
17026 @item 2, 6, cclock
17027 Rotate by 90 degrees counterclockwise, that is:
17028 @example
17029 L.R     R.r
17030 . . ->  . .
17031 l.r     L.l
17032 @end example
17033
17034 @item 3, 7, clock_flip
17035 Rotate by 90 degrees clockwise and vertically flip, that is:
17036 @example
17037 L.R     r.R
17038 . . ->  . .
17039 l.r     l.L
17040 @end example
17041 @end table
17042
17043 For values between 4-7, the transposition is only done if the input
17044 video geometry is portrait and not landscape. These values are
17045 deprecated, the @code{passthrough} option should be used instead.
17046
17047 Numerical values are deprecated, and should be dropped in favor of
17048 symbolic constants.
17049
17050 @item passthrough
17051 Do not apply the transposition if the input geometry matches the one
17052 specified by the specified value. It accepts the following values:
17053 @table @samp
17054 @item none
17055 Always apply transposition.
17056 @item portrait
17057 Preserve portrait geometry (when @var{height} >= @var{width}).
17058 @item landscape
17059 Preserve landscape geometry (when @var{width} >= @var{height}).
17060 @end table
17061
17062 Default value is @code{none}.
17063 @end table
17064
17065 For example to rotate by 90 degrees clockwise and preserve portrait
17066 layout:
17067 @example
17068 transpose=dir=1:passthrough=portrait
17069 @end example
17070
17071 The command above can also be specified as:
17072 @example
17073 transpose=1:portrait
17074 @end example
17075
17076 @section transpose_npp
17077
17078 Transpose rows with columns in the input video and optionally flip it.
17079 For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
17080
17081 It accepts the following parameters:
17082
17083 @table @option
17084
17085 @item dir
17086 Specify the transposition direction.
17087
17088 Can assume the following values:
17089 @table @samp
17090 @item cclock_flip
17091 Rotate by 90 degrees counterclockwise and vertically flip. (default)
17092
17093 @item clock
17094 Rotate by 90 degrees clockwise.
17095
17096 @item cclock
17097 Rotate by 90 degrees counterclockwise.
17098
17099 @item clock_flip
17100 Rotate by 90 degrees clockwise and vertically flip.
17101 @end table
17102
17103 @item passthrough
17104 Do not apply the transposition if the input geometry matches the one
17105 specified by the specified value. It accepts the following values:
17106 @table @samp
17107 @item none
17108 Always apply transposition. (default)
17109 @item portrait
17110 Preserve portrait geometry (when @var{height} >= @var{width}).
17111 @item landscape
17112 Preserve landscape geometry (when @var{width} >= @var{height}).
17113 @end table
17114
17115 @end table
17116
17117 @section trim
17118 Trim the input so that the output contains one continuous subpart of the input.
17119
17120 It accepts the following parameters:
17121 @table @option
17122 @item start
17123 Specify the time of the start of the kept section, i.e. the frame with the
17124 timestamp @var{start} will be the first frame in the output.
17125
17126 @item end
17127 Specify the time of the first frame that will be dropped, i.e. the frame
17128 immediately preceding the one with the timestamp @var{end} will be the last
17129 frame in the output.
17130
17131 @item start_pts
17132 This is the same as @var{start}, except this option sets the start timestamp
17133 in timebase units instead of seconds.
17134
17135 @item end_pts
17136 This is the same as @var{end}, except this option sets the end timestamp
17137 in timebase units instead of seconds.
17138
17139 @item duration
17140 The maximum duration of the output in seconds.
17141
17142 @item start_frame
17143 The number of the first frame that should be passed to the output.
17144
17145 @item end_frame
17146 The number of the first frame that should be dropped.
17147 @end table
17148
17149 @option{start}, @option{end}, and @option{duration} are expressed as time
17150 duration specifications; see
17151 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
17152 for the accepted syntax.
17153
17154 Note that the first two sets of the start/end options and the @option{duration}
17155 option look at the frame timestamp, while the _frame variants simply count the
17156 frames that pass through the filter. Also note that this filter does not modify
17157 the timestamps. If you wish for the output timestamps to start at zero, insert a
17158 setpts filter after the trim filter.
17159
17160 If multiple start or end options are set, this filter tries to be greedy and
17161 keep all the frames that match at least one of the specified constraints. To keep
17162 only the part that matches all the constraints at once, chain multiple trim
17163 filters.
17164
17165 The defaults are such that all the input is kept. So it is possible to set e.g.
17166 just the end values to keep everything before the specified time.
17167
17168 Examples:
17169 @itemize
17170 @item
17171 Drop everything except the second minute of input:
17172 @example
17173 ffmpeg -i INPUT -vf trim=60:120
17174 @end example
17175
17176 @item
17177 Keep only the first second:
17178 @example
17179 ffmpeg -i INPUT -vf trim=duration=1
17180 @end example
17181
17182 @end itemize
17183
17184 @section unpremultiply
17185 Apply alpha unpremultiply effect to input video stream using first plane
17186 of second stream as alpha.
17187
17188 Both streams must have same dimensions and same pixel format.
17189
17190 The filter accepts the following option:
17191
17192 @table @option
17193 @item planes
17194 Set which planes will be processed, unprocessed planes will be copied.
17195 By default value 0xf, all planes will be processed.
17196
17197 If the format has 1 or 2 components, then luma is bit 0.
17198 If the format has 3 or 4 components:
17199 for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
17200 for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
17201 If present, the alpha channel is always the last bit.
17202
17203 @item inplace
17204 Do not require 2nd input for processing, instead use alpha plane from input stream.
17205 @end table
17206
17207 @anchor{unsharp}
17208 @section unsharp
17209
17210 Sharpen or blur the input video.
17211
17212 It accepts the following parameters:
17213
17214 @table @option
17215 @item luma_msize_x, lx
17216 Set the luma matrix horizontal size. It must be an odd integer between
17217 3 and 23. The default value is 5.
17218
17219 @item luma_msize_y, ly
17220 Set the luma matrix vertical size. It must be an odd integer between 3
17221 and 23. The default value is 5.
17222
17223 @item luma_amount, la
17224 Set the luma effect strength. It must be a floating point number, reasonable
17225 values lay between -1.5 and 1.5.
17226
17227 Negative values will blur the input video, while positive values will
17228 sharpen it, a value of zero will disable the effect.
17229
17230 Default value is 1.0.
17231
17232 @item chroma_msize_x, cx
17233 Set the chroma matrix horizontal size. It must be an odd integer
17234 between 3 and 23. The default value is 5.
17235
17236 @item chroma_msize_y, cy
17237 Set the chroma matrix vertical size. It must be an odd integer
17238 between 3 and 23. The default value is 5.
17239
17240 @item chroma_amount, ca
17241 Set the chroma effect strength. It must be a floating point number, reasonable
17242 values lay between -1.5 and 1.5.
17243
17244 Negative values will blur the input video, while positive values will
17245 sharpen it, a value of zero will disable the effect.
17246
17247 Default value is 0.0.
17248
17249 @end table
17250
17251 All parameters are optional and default to the equivalent of the
17252 string '5:5:1.0:5:5:0.0'.
17253
17254 @subsection Examples
17255
17256 @itemize
17257 @item
17258 Apply strong luma sharpen effect:
17259 @example
17260 unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
17261 @end example
17262
17263 @item
17264 Apply a strong blur of both luma and chroma parameters:
17265 @example
17266 unsharp=7:7:-2:7:7:-2
17267 @end example
17268 @end itemize
17269
17270 @section uspp
17271
17272 Apply ultra slow/simple postprocessing filter that compresses and decompresses
17273 the image at several (or - in the case of @option{quality} level @code{8} - all)
17274 shifts and average the results.
17275
17276 The way this differs from the behavior of spp is that uspp actually encodes &
17277 decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
17278 DCT similar to MJPEG.
17279
17280 The filter accepts the following options:
17281
17282 @table @option
17283 @item quality
17284 Set quality. This option defines the number of levels for averaging. It accepts
17285 an integer in the range 0-8. If set to @code{0}, the filter will have no
17286 effect. A value of @code{8} means the higher quality. For each increment of
17287 that value the speed drops by a factor of approximately 2.  Default value is
17288 @code{3}.
17289
17290 @item qp
17291 Force a constant quantization parameter. If not set, the filter will use the QP
17292 from the video stream (if available).
17293 @end table
17294
17295 @section vaguedenoiser
17296
17297 Apply a wavelet based denoiser.
17298
17299 It transforms each frame from the video input into the wavelet domain,
17300 using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
17301 the obtained coefficients. It does an inverse wavelet transform after.
17302 Due to wavelet properties, it should give a nice smoothed result, and
17303 reduced noise, without blurring picture features.
17304
17305 This filter accepts the following options:
17306
17307 @table @option
17308 @item threshold
17309 The filtering strength. The higher, the more filtered the video will be.
17310 Hard thresholding can use a higher threshold than soft thresholding
17311 before the video looks overfiltered. Default value is 2.
17312
17313 @item method
17314 The filtering method the filter will use.
17315
17316 It accepts the following values:
17317 @table @samp
17318 @item hard
17319 All values under the threshold will be zeroed.
17320
17321 @item soft
17322 All values under the threshold will be zeroed. All values above will be
17323 reduced by the threshold.
17324
17325 @item garrote
17326 Scales or nullifies coefficients - intermediary between (more) soft and
17327 (less) hard thresholding.
17328 @end table
17329
17330 Default is garrote.
17331
17332 @item nsteps
17333 Number of times, the wavelet will decompose the picture. Picture can't
17334 be decomposed beyond a particular point (typically, 8 for a 640x480
17335 frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
17336
17337 @item percent
17338 Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
17339
17340 @item planes
17341 A list of the planes to process. By default all planes are processed.
17342 @end table
17343
17344 @section vectorscope
17345
17346 Display 2 color component values in the two dimensional graph (which is called
17347 a vectorscope).
17348
17349 This filter accepts the following options:
17350
17351 @table @option
17352 @item mode, m
17353 Set vectorscope mode.
17354
17355 It accepts the following values:
17356 @table @samp
17357 @item gray
17358 Gray values are displayed on graph, higher brightness means more pixels have
17359 same component color value on location in graph. This is the default mode.
17360
17361 @item color
17362 Gray values are displayed on graph. Surrounding pixels values which are not
17363 present in video frame are drawn in gradient of 2 color components which are
17364 set by option @code{x} and @code{y}. The 3rd color component is static.
17365
17366 @item color2
17367 Actual color components values present in video frame are displayed on graph.
17368
17369 @item color3
17370 Similar as color2 but higher frequency of same values @code{x} and @code{y}
17371 on graph increases value of another color component, which is luminance by
17372 default values of @code{x} and @code{y}.
17373
17374 @item color4
17375 Actual colors present in video frame are displayed on graph. If two different
17376 colors map to same position on graph then color with higher value of component
17377 not present in graph is picked.
17378
17379 @item color5
17380 Gray values are displayed on graph. Similar to @code{color} but with 3rd color
17381 component picked from radial gradient.
17382 @end table
17383
17384 @item x
17385 Set which color component will be represented on X-axis. Default is @code{1}.
17386
17387 @item y
17388 Set which color component will be represented on Y-axis. Default is @code{2}.
17389
17390 @item intensity, i
17391 Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
17392 of color component which represents frequency of (X, Y) location in graph.
17393
17394 @item envelope, e
17395 @table @samp
17396 @item none
17397 No envelope, this is default.
17398
17399 @item instant
17400 Instant envelope, even darkest single pixel will be clearly highlighted.
17401
17402 @item peak
17403 Hold maximum and minimum values presented in graph over time. This way you
17404 can still spot out of range values without constantly looking at vectorscope.
17405
17406 @item peak+instant
17407 Peak and instant envelope combined together.
17408 @end table
17409
17410 @item graticule, g
17411 Set what kind of graticule to draw.
17412 @table @samp
17413 @item none
17414 @item green
17415 @item color
17416 @end table
17417
17418 @item opacity, o
17419 Set graticule opacity.
17420
17421 @item flags, f
17422 Set graticule flags.
17423
17424 @table @samp
17425 @item white
17426 Draw graticule for white point.
17427
17428 @item black
17429 Draw graticule for black point.
17430
17431 @item name
17432 Draw color points short names.
17433 @end table
17434
17435 @item bgopacity, b
17436 Set background opacity.
17437
17438 @item lthreshold, l
17439 Set low threshold for color component not represented on X or Y axis.
17440 Values lower than this value will be ignored. Default is 0.
17441 Note this value is multiplied with actual max possible value one pixel component
17442 can have. So for 8-bit input and low threshold value of 0.1 actual threshold
17443 is 0.1 * 255 = 25.
17444
17445 @item hthreshold, h
17446 Set high threshold for color component not represented on X or Y axis.
17447 Values higher than this value will be ignored. Default is 1.
17448 Note this value is multiplied with actual max possible value one pixel component
17449 can have. So for 8-bit input and high threshold value of 0.9 actual threshold
17450 is 0.9 * 255 = 230.
17451
17452 @item colorspace, c
17453 Set what kind of colorspace to use when drawing graticule.
17454 @table @samp
17455 @item auto
17456 @item 601
17457 @item 709
17458 @end table
17459 Default is auto.
17460 @end table
17461
17462 @anchor{vidstabdetect}
17463 @section vidstabdetect
17464
17465 Analyze video stabilization/deshaking. Perform pass 1 of 2, see
17466 @ref{vidstabtransform} for pass 2.
17467
17468 This filter generates a file with relative translation and rotation
17469 transform information about subsequent frames, which is then used by
17470 the @ref{vidstabtransform} filter.
17471
17472 To enable compilation of this filter you need to configure FFmpeg with
17473 @code{--enable-libvidstab}.
17474
17475 This filter accepts the following options:
17476
17477 @table @option
17478 @item result
17479 Set the path to the file used to write the transforms information.
17480 Default value is @file{transforms.trf}.
17481
17482 @item shakiness
17483 Set how shaky the video is and how quick the camera is. It accepts an
17484 integer in the range 1-10, a value of 1 means little shakiness, a
17485 value of 10 means strong shakiness. Default value is 5.
17486
17487 @item accuracy
17488 Set the accuracy of the detection process. It must be a value in the
17489 range 1-15. A value of 1 means low accuracy, a value of 15 means high
17490 accuracy. Default value is 15.
17491
17492 @item stepsize
17493 Set stepsize of the search process. The region around minimum is
17494 scanned with 1 pixel resolution. Default value is 6.
17495
17496 @item mincontrast
17497 Set minimum contrast. Below this value a local measurement field is
17498 discarded. Must be a floating point value in the range 0-1. Default
17499 value is 0.3.
17500
17501 @item tripod
17502 Set reference frame number for tripod mode.
17503
17504 If enabled, the motion of the frames is compared to a reference frame
17505 in the filtered stream, identified by the specified number. The idea
17506 is to compensate all movements in a more-or-less static scene and keep
17507 the camera view absolutely still.
17508
17509 If set to 0, it is disabled. The frames are counted starting from 1.
17510
17511 @item show
17512 Show fields and transforms in the resulting frames. It accepts an
17513 integer in the range 0-2. Default value is 0, which disables any
17514 visualization.
17515 @end table
17516
17517 @subsection Examples
17518
17519 @itemize
17520 @item
17521 Use default values:
17522 @example
17523 vidstabdetect
17524 @end example
17525
17526 @item
17527 Analyze strongly shaky movie and put the results in file
17528 @file{mytransforms.trf}:
17529 @example
17530 vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
17531 @end example
17532
17533 @item
17534 Visualize the result of internal transformations in the resulting
17535 video:
17536 @example
17537 vidstabdetect=show=1
17538 @end example
17539
17540 @item
17541 Analyze a video with medium shakiness using @command{ffmpeg}:
17542 @example
17543 ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
17544 @end example
17545 @end itemize
17546
17547 @anchor{vidstabtransform}
17548 @section vidstabtransform
17549
17550 Video stabilization/deshaking: pass 2 of 2,
17551 see @ref{vidstabdetect} for pass 1.
17552
17553 Read a file with transform information for each frame and
17554 apply/compensate them. Together with the @ref{vidstabdetect}
17555 filter this can be used to deshake videos. See also
17556 @url{http://public.hronopik.de/vid.stab}. It is important to also use
17557 the @ref{unsharp} filter, see below.
17558
17559 To enable compilation of this filter you need to configure FFmpeg with
17560 @code{--enable-libvidstab}.
17561
17562 @subsection Options
17563
17564 @table @option
17565 @item input
17566 Set path to the file used to read the transforms. Default value is
17567 @file{transforms.trf}.
17568
17569 @item smoothing
17570 Set the number of frames (value*2 + 1) used for lowpass filtering the
17571 camera movements. Default value is 10.
17572
17573 For example a number of 10 means that 21 frames are used (10 in the
17574 past and 10 in the future) to smoothen the motion in the video. A
17575 larger value leads to a smoother video, but limits the acceleration of
17576 the camera (pan/tilt movements). 0 is a special case where a static
17577 camera is simulated.
17578
17579 @item optalgo
17580 Set the camera path optimization algorithm.
17581
17582 Accepted values are:
17583 @table @samp
17584 @item gauss
17585 gaussian kernel low-pass filter on camera motion (default)
17586 @item avg
17587 averaging on transformations
17588 @end table
17589
17590 @item maxshift
17591 Set maximal number of pixels to translate frames. Default value is -1,
17592 meaning no limit.
17593
17594 @item maxangle
17595 Set maximal angle in radians (degree*PI/180) to rotate frames. Default
17596 value is -1, meaning no limit.
17597
17598 @item crop
17599 Specify how to deal with borders that may be visible due to movement
17600 compensation.
17601
17602 Available values are:
17603 @table @samp
17604 @item keep
17605 keep image information from previous frame (default)
17606 @item black
17607 fill the border black
17608 @end table
17609
17610 @item invert
17611 Invert transforms if set to 1. Default value is 0.
17612
17613 @item relative
17614 Consider transforms as relative to previous frame if set to 1,
17615 absolute if set to 0. Default value is 0.
17616
17617 @item zoom
17618 Set percentage to zoom. A positive value will result in a zoom-in
17619 effect, a negative value in a zoom-out effect. Default value is 0 (no
17620 zoom).
17621
17622 @item optzoom
17623 Set optimal zooming to avoid borders.
17624
17625 Accepted values are:
17626 @table @samp
17627 @item 0
17628 disabled
17629 @item 1
17630 optimal static zoom value is determined (only very strong movements
17631 will lead to visible borders) (default)
17632 @item 2
17633 optimal adaptive zoom value is determined (no borders will be
17634 visible), see @option{zoomspeed}
17635 @end table
17636
17637 Note that the value given at zoom is added to the one calculated here.
17638
17639 @item zoomspeed
17640 Set percent to zoom maximally each frame (enabled when
17641 @option{optzoom} is set to 2). Range is from 0 to 5, default value is
17642 0.25.
17643
17644 @item interpol
17645 Specify type of interpolation.
17646
17647 Available values are:
17648 @table @samp
17649 @item no
17650 no interpolation
17651 @item linear
17652 linear only horizontal
17653 @item bilinear
17654 linear in both directions (default)
17655 @item bicubic
17656 cubic in both directions (slow)
17657 @end table
17658
17659 @item tripod
17660 Enable virtual tripod mode if set to 1, which is equivalent to
17661 @code{relative=0:smoothing=0}. Default value is 0.
17662
17663 Use also @code{tripod} option of @ref{vidstabdetect}.
17664
17665 @item debug
17666 Increase log verbosity if set to 1. Also the detected global motions
17667 are written to the temporary file @file{global_motions.trf}. Default
17668 value is 0.
17669 @end table
17670
17671 @subsection Examples
17672
17673 @itemize
17674 @item
17675 Use @command{ffmpeg} for a typical stabilization with default values:
17676 @example
17677 ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
17678 @end example
17679
17680 Note the use of the @ref{unsharp} filter which is always recommended.
17681
17682 @item
17683 Zoom in a bit more and load transform data from a given file:
17684 @example
17685 vidstabtransform=zoom=5:input="mytransforms.trf"
17686 @end example
17687
17688 @item
17689 Smoothen the video even more:
17690 @example
17691 vidstabtransform=smoothing=30
17692 @end example
17693 @end itemize
17694
17695 @section vflip
17696
17697 Flip the input video vertically.
17698
17699 For example, to vertically flip a video with @command{ffmpeg}:
17700 @example
17701 ffmpeg -i in.avi -vf "vflip" out.avi
17702 @end example
17703
17704 @section vfrdet
17705
17706 Detect variable frame rate video.
17707
17708 This filter tries to detect if the input is variable or constant frame rate.
17709
17710 At end it will output number of frames detected as having variable delta pts,
17711 and ones with constant delta pts.
17712 If there was frames with variable delta, than it will also show min and max delta
17713 encountered.
17714
17715 @section vibrance
17716
17717 Boost or alter saturation.
17718
17719 The filter accepts the following options:
17720 @table @option
17721 @item intensity
17722 Set strength of boost if positive value or strength of alter if negative value.
17723 Default is 0. Allowed range is from -2 to 2.
17724
17725 @item rbal
17726 Set the red balance. Default is 1. Allowed range is from -10 to 10.
17727
17728 @item gbal
17729 Set the green balance. Default is 1. Allowed range is from -10 to 10.
17730
17731 @item bbal
17732 Set the blue balance. Default is 1. Allowed range is from -10 to 10.
17733
17734 @item rlum
17735 Set the red luma coefficient.
17736
17737 @item glum
17738 Set the green luma coefficient.
17739
17740 @item blum
17741 Set the blue luma coefficient.
17742 @end table
17743
17744 @anchor{vignette}
17745 @section vignette
17746
17747 Make or reverse a natural vignetting effect.
17748
17749 The filter accepts the following options:
17750
17751 @table @option
17752 @item angle, a
17753 Set lens angle expression as a number of radians.
17754
17755 The value is clipped in the @code{[0,PI/2]} range.
17756
17757 Default value: @code{"PI/5"}
17758
17759 @item x0
17760 @item y0
17761 Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
17762 by default.
17763
17764 @item mode
17765 Set forward/backward mode.
17766
17767 Available modes are:
17768 @table @samp
17769 @item forward
17770 The larger the distance from the central point, the darker the image becomes.
17771
17772 @item backward
17773 The larger the distance from the central point, the brighter the image becomes.
17774 This can be used to reverse a vignette effect, though there is no automatic
17775 detection to extract the lens @option{angle} and other settings (yet). It can
17776 also be used to create a burning effect.
17777 @end table
17778
17779 Default value is @samp{forward}.
17780
17781 @item eval
17782 Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
17783
17784 It accepts the following values:
17785 @table @samp
17786 @item init
17787 Evaluate expressions only once during the filter initialization.
17788
17789 @item frame
17790 Evaluate expressions for each incoming frame. This is way slower than the
17791 @samp{init} mode since it requires all the scalers to be re-computed, but it
17792 allows advanced dynamic expressions.
17793 @end table
17794
17795 Default value is @samp{init}.
17796
17797 @item dither
17798 Set dithering to reduce the circular banding effects. Default is @code{1}
17799 (enabled).
17800
17801 @item aspect
17802 Set vignette aspect. This setting allows one to adjust the shape of the vignette.
17803 Setting this value to the SAR of the input will make a rectangular vignetting
17804 following the dimensions of the video.
17805
17806 Default is @code{1/1}.
17807 @end table
17808
17809 @subsection Expressions
17810
17811 The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
17812 following parameters.
17813
17814 @table @option
17815 @item w
17816 @item h
17817 input width and height
17818
17819 @item n
17820 the number of input frame, starting from 0
17821
17822 @item pts
17823 the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
17824 @var{TB} units, NAN if undefined
17825
17826 @item r
17827 frame rate of the input video, NAN if the input frame rate is unknown
17828
17829 @item t
17830 the PTS (Presentation TimeStamp) of the filtered video frame,
17831 expressed in seconds, NAN if undefined
17832
17833 @item tb
17834 time base of the input video
17835 @end table
17836
17837
17838 @subsection Examples
17839
17840 @itemize
17841 @item
17842 Apply simple strong vignetting effect:
17843 @example
17844 vignette=PI/4
17845 @end example
17846
17847 @item
17848 Make a flickering vignetting:
17849 @example
17850 vignette='PI/4+random(1)*PI/50':eval=frame
17851 @end example
17852
17853 @end itemize
17854
17855 @section vmafmotion
17856
17857 Obtain the average vmaf motion score of a video.
17858 It is one of the component filters of VMAF.
17859
17860 The obtained average motion score is printed through the logging system.
17861
17862 In the below example the input file @file{ref.mpg} is being processed and score
17863 is computed.
17864
17865 @example
17866 ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
17867 @end example
17868
17869 @section vstack
17870 Stack input videos vertically.
17871
17872 All streams must be of same pixel format and of same width.
17873
17874 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
17875 to create same output.
17876
17877 The filter accept the following option:
17878
17879 @table @option
17880 @item inputs
17881 Set number of input streams. Default is 2.
17882
17883 @item shortest
17884 If set to 1, force the output to terminate when the shortest input
17885 terminates. Default value is 0.
17886 @end table
17887
17888 @section w3fdif
17889
17890 Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
17891 Deinterlacing Filter").
17892
17893 Based on the process described by Martin Weston for BBC R&D, and
17894 implemented based on the de-interlace algorithm written by Jim
17895 Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
17896 uses filter coefficients calculated by BBC R&D.
17897
17898 There are two sets of filter coefficients, so called "simple":
17899 and "complex". Which set of filter coefficients is used can
17900 be set by passing an optional parameter:
17901
17902 @table @option
17903 @item filter
17904 Set the interlacing filter coefficients. Accepts one of the following values:
17905
17906 @table @samp
17907 @item simple
17908 Simple filter coefficient set.
17909 @item complex
17910 More-complex filter coefficient set.
17911 @end table
17912 Default value is @samp{complex}.
17913
17914 @item deint
17915 Specify which frames to deinterlace. Accept one of the following values:
17916
17917 @table @samp
17918 @item all
17919 Deinterlace all frames,
17920 @item interlaced
17921 Only deinterlace frames marked as interlaced.
17922 @end table
17923
17924 Default value is @samp{all}.
17925 @end table
17926
17927 @section waveform
17928 Video waveform monitor.
17929
17930 The waveform monitor plots color component intensity. By default luminance
17931 only. Each column of the waveform corresponds to a column of pixels in the
17932 source video.
17933
17934 It accepts the following options:
17935
17936 @table @option
17937 @item mode, m
17938 Can be either @code{row}, or @code{column}. Default is @code{column}.
17939 In row mode, the graph on the left side represents color component value 0 and
17940 the right side represents value = 255. In column mode, the top side represents
17941 color component value = 0 and bottom side represents value = 255.
17942
17943 @item intensity, i
17944 Set intensity. Smaller values are useful to find out how many values of the same
17945 luminance are distributed across input rows/columns.
17946 Default value is @code{0.04}. Allowed range is [0, 1].
17947
17948 @item mirror, r
17949 Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
17950 In mirrored mode, higher values will be represented on the left
17951 side for @code{row} mode and at the top for @code{column} mode. Default is
17952 @code{1} (mirrored).
17953
17954 @item display, d
17955 Set display mode.
17956 It accepts the following values:
17957 @table @samp
17958 @item overlay
17959 Presents information identical to that in the @code{parade}, except
17960 that the graphs representing color components are superimposed directly
17961 over one another.
17962
17963 This display mode makes it easier to spot relative differences or similarities
17964 in overlapping areas of the color components that are supposed to be identical,
17965 such as neutral whites, grays, or blacks.
17966
17967 @item stack
17968 Display separate graph for the color components side by side in
17969 @code{row} mode or one below the other in @code{column} mode.
17970
17971 @item parade
17972 Display separate graph for the color components side by side in
17973 @code{column} mode or one below the other in @code{row} mode.
17974
17975 Using this display mode makes it easy to spot color casts in the highlights
17976 and shadows of an image, by comparing the contours of the top and the bottom
17977 graphs of each waveform. Since whites, grays, and blacks are characterized
17978 by exactly equal amounts of red, green, and blue, neutral areas of the picture
17979 should display three waveforms of roughly equal width/height. If not, the
17980 correction is easy to perform by making level adjustments the three waveforms.
17981 @end table
17982 Default is @code{stack}.
17983
17984 @item components, c
17985 Set which color components to display. Default is 1, which means only luminance
17986 or red color component if input is in RGB colorspace. If is set for example to
17987 7 it will display all 3 (if) available color components.
17988
17989 @item envelope, e
17990 @table @samp
17991 @item none
17992 No envelope, this is default.
17993
17994 @item instant
17995 Instant envelope, minimum and maximum values presented in graph will be easily
17996 visible even with small @code{step} value.
17997
17998 @item peak
17999 Hold minimum and maximum values presented in graph across time. This way you
18000 can still spot out of range values without constantly looking at waveforms.
18001
18002 @item peak+instant
18003 Peak and instant envelope combined together.
18004 @end table
18005
18006 @item filter, f
18007 @table @samp
18008 @item lowpass
18009 No filtering, this is default.
18010
18011 @item flat
18012 Luma and chroma combined together.
18013
18014 @item aflat
18015 Similar as above, but shows difference between blue and red chroma.
18016
18017 @item xflat
18018 Similar as above, but use different colors.
18019
18020 @item chroma
18021 Displays only chroma.
18022
18023 @item color
18024 Displays actual color value on waveform.
18025
18026 @item acolor
18027 Similar as above, but with luma showing frequency of chroma values.
18028 @end table
18029
18030 @item graticule, g
18031 Set which graticule to display.
18032
18033 @table @samp
18034 @item none
18035 Do not display graticule.
18036
18037 @item green
18038 Display green graticule showing legal broadcast ranges.
18039
18040 @item orange
18041 Display orange graticule showing legal broadcast ranges.
18042 @end table
18043
18044 @item opacity, o
18045 Set graticule opacity.
18046
18047 @item flags, fl
18048 Set graticule flags.
18049
18050 @table @samp
18051 @item numbers
18052 Draw numbers above lines. By default enabled.
18053
18054 @item dots
18055 Draw dots instead of lines.
18056 @end table
18057
18058 @item scale, s
18059 Set scale used for displaying graticule.
18060
18061 @table @samp
18062 @item digital
18063 @item millivolts
18064 @item ire
18065 @end table
18066 Default is digital.
18067
18068 @item bgopacity, b
18069 Set background opacity.
18070 @end table
18071
18072 @section weave, doubleweave
18073
18074 The @code{weave} takes a field-based video input and join
18075 each two sequential fields into single frame, producing a new double
18076 height clip with half the frame rate and half the frame count.
18077
18078 The @code{doubleweave} works same as @code{weave} but without
18079 halving frame rate and frame count.
18080
18081 It accepts the following option:
18082
18083 @table @option
18084 @item first_field
18085 Set first field. Available values are:
18086
18087 @table @samp
18088 @item top, t
18089 Set the frame as top-field-first.
18090
18091 @item bottom, b
18092 Set the frame as bottom-field-first.
18093 @end table
18094 @end table
18095
18096 @subsection Examples
18097
18098 @itemize
18099 @item
18100 Interlace video using @ref{select} and @ref{separatefields} filter:
18101 @example
18102 separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
18103 @end example
18104 @end itemize
18105
18106 @section xbr
18107 Apply the xBR high-quality magnification filter which is designed for pixel
18108 art. It follows a set of edge-detection rules, see
18109 @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
18110
18111 It accepts the following option:
18112
18113 @table @option
18114 @item n
18115 Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
18116 @code{3xBR} and @code{4} for @code{4xBR}.
18117 Default is @code{3}.
18118 @end table
18119
18120 @section xstack
18121 Stack video inputs into custom layout.
18122
18123 All streams must be of same pixel format.
18124
18125 The filter accept the following option:
18126
18127 @table @option
18128 @item inputs
18129 Set number of input streams. Default is 2.
18130
18131 @item layout
18132 Specify layout of inputs.
18133 This option requires the desired layout configuration to be explicitly set by the user.
18134 This sets position of each video input in output. Each input
18135 is separated by '|'.
18136 The first number represents the column, and the second number represents the row.
18137 Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
18138 where X is video input from which to take width or height.
18139 Multiple values can be used when separated by '+'. In such
18140 case values are summed together.
18141
18142 @item shortest
18143 If set to 1, force the output to terminate when the shortest input
18144 terminates. Default value is 0.
18145 @end table
18146
18147 @subsection Examples
18148
18149 @itemize
18150 @item
18151 Display 4 inputs into 2x2 grid,
18152 note that if inputs are of different sizes unused gaps might appear,
18153 as not all of output video is used.
18154 @example
18155 xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
18156 @end example
18157
18158 @item
18159 Display 4 inputs into 1x4 grid,
18160 note that if inputs are of different sizes unused gaps might appear,
18161 as not all of output video is used.
18162 @example
18163 xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
18164 @end example
18165
18166 @item
18167 Display 9 inputs into 3x3 grid,
18168 note that if inputs are of different sizes unused gaps might appear,
18169 as not all of output video is used.
18170 @example
18171 xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
18172 @end example
18173 @end itemize
18174
18175 @anchor{yadif}
18176 @section yadif
18177
18178 Deinterlace the input video ("yadif" means "yet another deinterlacing
18179 filter").
18180
18181 It accepts the following parameters:
18182
18183
18184 @table @option
18185
18186 @item mode
18187 The interlacing mode to adopt. It accepts one of the following values:
18188
18189 @table @option
18190 @item 0, send_frame
18191 Output one frame for each frame.
18192 @item 1, send_field
18193 Output one frame for each field.
18194 @item 2, send_frame_nospatial
18195 Like @code{send_frame}, but it skips the spatial interlacing check.
18196 @item 3, send_field_nospatial
18197 Like @code{send_field}, but it skips the spatial interlacing check.
18198 @end table
18199
18200 The default value is @code{send_frame}.
18201
18202 @item parity
18203 The picture field parity assumed for the input interlaced video. It accepts one
18204 of the following values:
18205
18206 @table @option
18207 @item 0, tff
18208 Assume the top field is first.
18209 @item 1, bff
18210 Assume the bottom field is first.
18211 @item -1, auto
18212 Enable automatic detection of field parity.
18213 @end table
18214
18215 The default value is @code{auto}.
18216 If the interlacing is unknown or the decoder does not export this information,
18217 top field first will be assumed.
18218
18219 @item deint
18220 Specify which frames to deinterlace. Accept one of the following
18221 values:
18222
18223 @table @option
18224 @item 0, all
18225 Deinterlace all frames.
18226 @item 1, interlaced
18227 Only deinterlace frames marked as interlaced.
18228 @end table
18229
18230 The default value is @code{all}.
18231 @end table
18232
18233 @section yadif_cuda
18234
18235 Deinterlace the input video using the @ref{yadif} algorithm, but implemented
18236 in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
18237 and/or nvenc.
18238
18239 It accepts the following parameters:
18240
18241
18242 @table @option
18243
18244 @item mode
18245 The interlacing mode to adopt. It accepts one of the following values:
18246
18247 @table @option
18248 @item 0, send_frame
18249 Output one frame for each frame.
18250 @item 1, send_field
18251 Output one frame for each field.
18252 @item 2, send_frame_nospatial
18253 Like @code{send_frame}, but it skips the spatial interlacing check.
18254 @item 3, send_field_nospatial
18255 Like @code{send_field}, but it skips the spatial interlacing check.
18256 @end table
18257
18258 The default value is @code{send_frame}.
18259
18260 @item parity
18261 The picture field parity assumed for the input interlaced video. It accepts one
18262 of the following values:
18263
18264 @table @option
18265 @item 0, tff
18266 Assume the top field is first.
18267 @item 1, bff
18268 Assume the bottom field is first.
18269 @item -1, auto
18270 Enable automatic detection of field parity.
18271 @end table
18272
18273 The default value is @code{auto}.
18274 If the interlacing is unknown or the decoder does not export this information,
18275 top field first will be assumed.
18276
18277 @item deint
18278 Specify which frames to deinterlace. Accept one of the following
18279 values:
18280
18281 @table @option
18282 @item 0, all
18283 Deinterlace all frames.
18284 @item 1, interlaced
18285 Only deinterlace frames marked as interlaced.
18286 @end table
18287
18288 The default value is @code{all}.
18289 @end table
18290
18291 @section zoompan
18292
18293 Apply Zoom & Pan effect.
18294
18295 This filter accepts the following options:
18296
18297 @table @option
18298 @item zoom, z
18299 Set the zoom expression. Default is 1.
18300
18301 @item x
18302 @item y
18303 Set the x and y expression. Default is 0.
18304
18305 @item d
18306 Set the duration expression in number of frames.
18307 This sets for how many number of frames effect will last for
18308 single input image.
18309
18310 @item s
18311 Set the output image size, default is 'hd720'.
18312
18313 @item fps
18314 Set the output frame rate, default is '25'.
18315 @end table
18316
18317 Each expression can contain the following constants:
18318
18319 @table @option
18320 @item in_w, iw
18321 Input width.
18322
18323 @item in_h, ih
18324 Input height.
18325
18326 @item out_w, ow
18327 Output width.
18328
18329 @item out_h, oh
18330 Output height.
18331
18332 @item in
18333 Input frame count.
18334
18335 @item on
18336 Output frame count.
18337
18338 @item x
18339 @item y
18340 Last calculated 'x' and 'y' position from 'x' and 'y' expression
18341 for current input frame.
18342
18343 @item px
18344 @item py
18345 'x' and 'y' of last output frame of previous input frame or 0 when there was
18346 not yet such frame (first input frame).
18347
18348 @item zoom
18349 Last calculated zoom from 'z' expression for current input frame.
18350
18351 @item pzoom
18352 Last calculated zoom of last output frame of previous input frame.
18353
18354 @item duration
18355 Number of output frames for current input frame. Calculated from 'd' expression
18356 for each input frame.
18357
18358 @item pduration
18359 number of output frames created for previous input frame
18360
18361 @item a
18362 Rational number: input width / input height
18363
18364 @item sar
18365 sample aspect ratio
18366
18367 @item dar
18368 display aspect ratio
18369
18370 @end table
18371
18372 @subsection Examples
18373
18374 @itemize
18375 @item
18376 Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
18377 @example
18378 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
18379 @end example
18380
18381 @item
18382 Zoom-in up to 1.5 and pan always at center of picture:
18383 @example
18384 zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
18385 @end example
18386
18387 @item
18388 Same as above but without pausing:
18389 @example
18390 zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
18391 @end example
18392 @end itemize
18393
18394 @anchor{zscale}
18395 @section zscale
18396 Scale (resize) the input video, using the z.lib library:
18397 @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
18398 filter, you need to configure FFmpeg with @code{--enable-libzimg}.
18399
18400 The zscale filter forces the output display aspect ratio to be the same
18401 as the input, by changing the output sample aspect ratio.
18402
18403 If the input image format is different from the format requested by
18404 the next filter, the zscale filter will convert the input to the
18405 requested format.
18406
18407 @subsection Options
18408 The filter accepts the following options.
18409
18410 @table @option
18411 @item width, w
18412 @item height, h
18413 Set the output video dimension expression. Default value is the input
18414 dimension.
18415
18416 If the @var{width} or @var{w} value is 0, the input width is used for
18417 the output. If the @var{height} or @var{h} value is 0, the input height
18418 is used for the output.
18419
18420 If one and only one of the values is -n with n >= 1, the zscale filter
18421 will use a value that maintains the aspect ratio of the input image,
18422 calculated from the other specified dimension. After that it will,
18423 however, make sure that the calculated dimension is divisible by n and
18424 adjust the value if necessary.
18425
18426 If both values are -n with n >= 1, the behavior will be identical to
18427 both values being set to 0 as previously detailed.
18428
18429 See below for the list of accepted constants for use in the dimension
18430 expression.
18431
18432 @item size, s
18433 Set the video size. For the syntax of this option, check the
18434 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18435
18436 @item dither, d
18437 Set the dither type.
18438
18439 Possible values are:
18440 @table @var
18441 @item none
18442 @item ordered
18443 @item random
18444 @item error_diffusion
18445 @end table
18446
18447 Default is none.
18448
18449 @item filter, f
18450 Set the resize filter type.
18451
18452 Possible values are:
18453 @table @var
18454 @item point
18455 @item bilinear
18456 @item bicubic
18457 @item spline16
18458 @item spline36
18459 @item lanczos
18460 @end table
18461
18462 Default is bilinear.
18463
18464 @item range, r
18465 Set the color range.
18466
18467 Possible values are:
18468 @table @var
18469 @item input
18470 @item limited
18471 @item full
18472 @end table
18473
18474 Default is same as input.
18475
18476 @item primaries, p
18477 Set the color primaries.
18478
18479 Possible values are:
18480 @table @var
18481 @item input
18482 @item 709
18483 @item unspecified
18484 @item 170m
18485 @item 240m
18486 @item 2020
18487 @end table
18488
18489 Default is same as input.
18490
18491 @item transfer, t
18492 Set the transfer characteristics.
18493
18494 Possible values are:
18495 @table @var
18496 @item input
18497 @item 709
18498 @item unspecified
18499 @item 601
18500 @item linear
18501 @item 2020_10
18502 @item 2020_12
18503 @item smpte2084
18504 @item iec61966-2-1
18505 @item arib-std-b67
18506 @end table
18507
18508 Default is same as input.
18509
18510 @item matrix, m
18511 Set the colorspace matrix.
18512
18513 Possible value are:
18514 @table @var
18515 @item input
18516 @item 709
18517 @item unspecified
18518 @item 470bg
18519 @item 170m
18520 @item 2020_ncl
18521 @item 2020_cl
18522 @end table
18523
18524 Default is same as input.
18525
18526 @item rangein, rin
18527 Set the input color range.
18528
18529 Possible values are:
18530 @table @var
18531 @item input
18532 @item limited
18533 @item full
18534 @end table
18535
18536 Default is same as input.
18537
18538 @item primariesin, pin
18539 Set the input color primaries.
18540
18541 Possible values are:
18542 @table @var
18543 @item input
18544 @item 709
18545 @item unspecified
18546 @item 170m
18547 @item 240m
18548 @item 2020
18549 @end table
18550
18551 Default is same as input.
18552
18553 @item transferin, tin
18554 Set the input transfer characteristics.
18555
18556 Possible values are:
18557 @table @var
18558 @item input
18559 @item 709
18560 @item unspecified
18561 @item 601
18562 @item linear
18563 @item 2020_10
18564 @item 2020_12
18565 @end table
18566
18567 Default is same as input.
18568
18569 @item matrixin, min
18570 Set the input colorspace matrix.
18571
18572 Possible value are:
18573 @table @var
18574 @item input
18575 @item 709
18576 @item unspecified
18577 @item 470bg
18578 @item 170m
18579 @item 2020_ncl
18580 @item 2020_cl
18581 @end table
18582
18583 @item chromal, c
18584 Set the output chroma location.
18585
18586 Possible values are:
18587 @table @var
18588 @item input
18589 @item left
18590 @item center
18591 @item topleft
18592 @item top
18593 @item bottomleft
18594 @item bottom
18595 @end table
18596
18597 @item chromalin, cin
18598 Set the input chroma location.
18599
18600 Possible values are:
18601 @table @var
18602 @item input
18603 @item left
18604 @item center
18605 @item topleft
18606 @item top
18607 @item bottomleft
18608 @item bottom
18609 @end table
18610
18611 @item npl
18612 Set the nominal peak luminance.
18613 @end table
18614
18615 The values of the @option{w} and @option{h} options are expressions
18616 containing the following constants:
18617
18618 @table @var
18619 @item in_w
18620 @item in_h
18621 The input width and height
18622
18623 @item iw
18624 @item ih
18625 These are the same as @var{in_w} and @var{in_h}.
18626
18627 @item out_w
18628 @item out_h
18629 The output (scaled) width and height
18630
18631 @item ow
18632 @item oh
18633 These are the same as @var{out_w} and @var{out_h}
18634
18635 @item a
18636 The same as @var{iw} / @var{ih}
18637
18638 @item sar
18639 input sample aspect ratio
18640
18641 @item dar
18642 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
18643
18644 @item hsub
18645 @item vsub
18646 horizontal and vertical input chroma subsample values. For example for the
18647 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
18648
18649 @item ohsub
18650 @item ovsub
18651 horizontal and vertical output chroma subsample values. For example for the
18652 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
18653 @end table
18654
18655 @table @option
18656 @end table
18657
18658 @c man end VIDEO FILTERS
18659
18660 @chapter OpenCL Video Filters
18661 @c man begin OPENCL VIDEO FILTERS
18662
18663 Below is a description of the currently available OpenCL video filters.
18664
18665 To enable compilation of these filters you need to configure FFmpeg with
18666 @code{--enable-opencl}.
18667
18668 Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
18669 @table @option
18670
18671 @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
18672 Initialise a new hardware device of type @var{opencl} called @var{name}, using the
18673 given device parameters.
18674
18675 @item -filter_hw_device @var{name}
18676 Pass the hardware device called @var{name} to all filters in any filter graph.
18677
18678 @end table
18679
18680 For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
18681
18682 @itemize
18683 @item
18684 Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
18685 @example
18686 -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
18687 @end example
18688 @end itemize
18689
18690 Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it may be necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
18691
18692 @section avgblur_opencl
18693
18694 Apply average blur filter.
18695
18696 The filter accepts the following options:
18697
18698 @table @option
18699 @item sizeX
18700 Set horizontal radius size.
18701 Range is @code{[1, 1024]} and default value is @code{1}.
18702
18703 @item planes
18704 Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
18705
18706 @item sizeY
18707 Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
18708 @end table
18709
18710 @subsection Example
18711
18712 @itemize
18713 @item
18714 Apply average blur filter with horizontal and vertical size of 3, setting each pixel of the output to the average value of the 7x7 region centered on it in the input. For pixels on the edges of the image, the region does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
18715 @example
18716 -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
18717 @end example
18718 @end itemize
18719
18720 @section boxblur_opencl
18721
18722 Apply a boxblur algorithm to the input video.
18723
18724 It accepts the following parameters:
18725
18726 @table @option
18727
18728 @item luma_radius, lr
18729 @item luma_power, lp
18730 @item chroma_radius, cr
18731 @item chroma_power, cp
18732 @item alpha_radius, ar
18733 @item alpha_power, ap
18734
18735 @end table
18736
18737 A description of the accepted options follows.
18738
18739 @table @option
18740 @item luma_radius, lr
18741 @item chroma_radius, cr
18742 @item alpha_radius, ar
18743 Set an expression for the box radius in pixels used for blurring the
18744 corresponding input plane.
18745
18746 The radius value must be a non-negative number, and must not be
18747 greater than the value of the expression @code{min(w,h)/2} for the
18748 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
18749 planes.
18750
18751 Default value for @option{luma_radius} is "2". If not specified,
18752 @option{chroma_radius} and @option{alpha_radius} default to the
18753 corresponding value set for @option{luma_radius}.
18754
18755 The expressions can contain the following constants:
18756 @table @option
18757 @item w
18758 @item h
18759 The input width and height in pixels.
18760
18761 @item cw
18762 @item ch
18763 The input chroma image width and height in pixels.
18764
18765 @item hsub
18766 @item vsub
18767 The horizontal and vertical chroma subsample values. For example, for the
18768 pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
18769 @end table
18770
18771 @item luma_power, lp
18772 @item chroma_power, cp
18773 @item alpha_power, ap
18774 Specify how many times the boxblur filter is applied to the
18775 corresponding plane.
18776
18777 Default value for @option{luma_power} is 2. If not specified,
18778 @option{chroma_power} and @option{alpha_power} default to the
18779 corresponding value set for @option{luma_power}.
18780
18781 A value of 0 will disable the effect.
18782 @end table
18783
18784 @subsection Examples
18785
18786 Apply boxblur filter, setting each pixel of the output to the average value of box-radiuses @var{luma_radius}, @var{chroma_radius}, @var{alpha_radius} for each plane respectively. The filter will apply @var{luma_power}, @var{chroma_power}, @var{alpha_power} times onto the corresponding plane. For pixels on the edges of the image, the radius does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
18787
18788 @itemize
18789 @item
18790 Apply a boxblur filter with the luma, chroma, and alpha radius
18791 set to 2 and luma, chroma, and alpha power set to 3. The filter will run 3 times with box-radius set to 2 for every plane of the image.
18792 @example
18793 -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
18794 -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
18795 @end example
18796
18797 @item
18798 Apply a boxblur filter with luma radius set to 2, luma_power to 1, chroma_radius to 4, chroma_power to 5, alpha_radius to 3 and alpha_power to 7.
18799
18800 For the luma plane, a 2x2 box radius will be run once.
18801
18802 For the chroma plane, a 4x4 box radius will be run 5 times.
18803
18804 For the alpha plane, a 3x3 box radius will be run 7 times.
18805 @example
18806 -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
18807 @end example
18808 @end itemize
18809
18810 @section convolution_opencl
18811
18812 Apply convolution of 3x3, 5x5, 7x7 matrix.
18813
18814 The filter accepts the following options:
18815
18816 @table @option
18817 @item 0m
18818 @item 1m
18819 @item 2m
18820 @item 3m
18821 Set matrix for each plane.
18822 Matrix is sequence of 9, 25 or 49 signed numbers.
18823 Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
18824
18825 @item 0rdiv
18826 @item 1rdiv
18827 @item 2rdiv
18828 @item 3rdiv
18829 Set multiplier for calculated value for each plane.
18830 If unset or 0, it will be sum of all matrix elements.
18831 The option value must be an float number greater or equal to @code{0.0}. Default value is @code{1.0}.
18832
18833 @item 0bias
18834 @item 1bias
18835 @item 2bias
18836 @item 3bias
18837 Set bias for each plane. This value is added to the result of the multiplication.
18838 Useful for making the overall image brighter or darker.
18839 The option value must be an float number greater or equal to @code{0.0}. Default value is @code{0.0}.
18840
18841 @end table
18842
18843 @subsection Examples
18844
18845 @itemize
18846 @item
18847 Apply sharpen:
18848 @example
18849 -i INPUT -vf "hwupload, convolution_opencl=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, hwdownload" OUTPUT
18850 @end example
18851
18852 @item
18853 Apply blur:
18854 @example
18855 -i INPUT -vf "hwupload, convolution_opencl=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, hwdownload" OUTPUT
18856 @end example
18857
18858 @item
18859 Apply edge enhance:
18860 @example
18861 -i INPUT -vf "hwupload, convolution_opencl=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, hwdownload" OUTPUT
18862 @end example
18863
18864 @item
18865 Apply edge detect:
18866 @example
18867 -i INPUT -vf "hwupload, convolution_opencl=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, hwdownload" OUTPUT
18868 @end example
18869
18870 @item
18871 Apply laplacian edge detector which includes diagonals:
18872 @example
18873 -i INPUT -vf "hwupload, convolution_opencl=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, hwdownload" OUTPUT
18874 @end example
18875
18876 @item
18877 Apply emboss:
18878 @example
18879 -i INPUT -vf "hwupload, convolution_opencl=-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, hwdownload" OUTPUT
18880 @end example
18881 @end itemize
18882
18883 @section dilation_opencl
18884
18885 Apply dilation effect to the video.
18886
18887 This filter replaces the pixel by the local(3x3) maximum.
18888
18889 It accepts the following options:
18890
18891 @table @option
18892 @item threshold0
18893 @item threshold1
18894 @item threshold2
18895 @item threshold3
18896 Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
18897 If @code{0}, plane will remain unchanged.
18898
18899 @item coordinates
18900 Flag which specifies the pixel to refer to.
18901 Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
18902
18903 Flags to local 3x3 coordinates region centered on @code{x}:
18904
18905     1 2 3
18906
18907     4 x 5
18908
18909     6 7 8
18910 @end table
18911
18912 @subsection Example
18913
18914 @itemize
18915 @item
18916 Apply dilation filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local maximum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local maximum is more then threshold of the corresponding plane, output pixel will be set to input pixel + threshold of corresponding plane.
18917 @example
18918 -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
18919 @end example
18920 @end itemize
18921
18922 @section erosion_opencl
18923
18924 Apply erosion effect to the video.
18925
18926 This filter replaces the pixel by the local(3x3) minimum.
18927
18928 It accepts the following options:
18929
18930 @table @option
18931 @item threshold0
18932 @item threshold1
18933 @item threshold2
18934 @item threshold3
18935 Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
18936 If @code{0}, plane will remain unchanged.
18937
18938 @item coordinates
18939 Flag which specifies the pixel to refer to.
18940 Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
18941
18942 Flags to local 3x3 coordinates region centered on @code{x}:
18943
18944     1 2 3
18945
18946     4 x 5
18947
18948     6 7 8
18949 @end table
18950
18951 @subsection Example
18952
18953 @itemize
18954 @item
18955 Apply erosion filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local minimum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local minimum is more then threshold of the corresponding plane, output pixel will be set to input pixel - threshold of corresponding plane.
18956 @example
18957 -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
18958 @end example
18959 @end itemize
18960
18961 @section overlay_opencl
18962
18963 Overlay one video on top of another.
18964
18965 It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
18966 This filter requires same memory layout for all the inputs. So, format conversion may be needed.
18967
18968 The filter accepts the following options:
18969
18970 @table @option
18971
18972 @item x
18973 Set the x coordinate of the overlaid video on the main video.
18974 Default value is @code{0}.
18975
18976 @item y
18977 Set the x coordinate of the overlaid video on the main video.
18978 Default value is @code{0}.
18979
18980 @end table
18981
18982 @subsection Examples
18983
18984 @itemize
18985 @item
18986 Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
18987 @example
18988 -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
18989 @end example
18990 @item
18991 The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
18992 @example
18993 -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
18994 @end example
18995
18996 @end itemize
18997
18998 @section prewitt_opencl
18999
19000 Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
19001
19002 The filter accepts the following option:
19003
19004 @table @option
19005 @item planes
19006 Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
19007
19008 @item scale
19009 Set value which will be multiplied with filtered result.
19010 Range is @code{[0.0, 65535]} and default value is @code{1.0}.
19011
19012 @item delta
19013 Set value which will be added to filtered result.
19014 Range is @code{[-65535, 65535]} and default value is @code{0.0}.
19015 @end table
19016
19017 @subsection Example
19018
19019 @itemize
19020 @item
19021 Apply the Prewitt operator with scale set to 2 and delta set to 10.
19022 @example
19023 -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
19024 @end example
19025 @end itemize
19026
19027 @section roberts_opencl
19028 Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
19029
19030 The filter accepts the following option:
19031
19032 @table @option
19033 @item planes
19034 Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
19035
19036 @item scale
19037 Set value which will be multiplied with filtered result.
19038 Range is @code{[0.0, 65535]} and default value is @code{1.0}.
19039
19040 @item delta
19041 Set value which will be added to filtered result.
19042 Range is @code{[-65535, 65535]} and default value is @code{0.0}.
19043 @end table
19044
19045 @subsection Example
19046
19047 @itemize
19048 @item
19049 Apply the Roberts cross operator with scale set to 2 and delta set to 10
19050 @example
19051 -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
19052 @end example
19053 @end itemize
19054
19055 @section sobel_opencl
19056
19057 Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
19058
19059 The filter accepts the following option:
19060
19061 @table @option
19062 @item planes
19063 Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
19064
19065 @item scale
19066 Set value which will be multiplied with filtered result.
19067 Range is @code{[0.0, 65535]} and default value is @code{1.0}.
19068
19069 @item delta
19070 Set value which will be added to filtered result.
19071 Range is @code{[-65535, 65535]} and default value is @code{0.0}.
19072 @end table
19073
19074 @subsection Example
19075
19076 @itemize
19077 @item
19078 Apply sobel operator with scale set to 2 and delta set to 10
19079 @example
19080 -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
19081 @end example
19082 @end itemize
19083
19084 @section tonemap_opencl
19085
19086 Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
19087
19088 It accepts the following parameters:
19089
19090 @table @option
19091 @item tonemap
19092 Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
19093
19094 @item param
19095 Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
19096
19097 @item desat
19098 Apply desaturation for highlights that exceed this level of brightness. The
19099 higher the parameter, the more color information will be preserved. This
19100 setting helps prevent unnaturally blown-out colors for super-highlights, by
19101 (smoothly) turning into white instead. This makes images feel more natural,
19102 at the cost of reducing information about out-of-range colors.
19103
19104 The default value is 0.5, and the algorithm here is a little different from
19105 the cpu version tonemap currently. A setting of 0.0 disables this option.
19106
19107 @item threshold
19108 The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
19109 is used to detect whether the scene has changed or not. If the distance beween
19110 the current frame average brightness and the current running average exceeds
19111 a threshold value, we would re-calculate scene average and peak brightness.
19112 The default value is 0.2.
19113
19114 @item format
19115 Specify the output pixel format.
19116
19117 Currently supported formats are:
19118 @table @var
19119 @item p010
19120 @item nv12
19121 @end table
19122
19123 @item range, r
19124 Set the output color range.
19125
19126 Possible values are:
19127 @table @var
19128 @item tv/mpeg
19129 @item pc/jpeg
19130 @end table
19131
19132 Default is same as input.
19133
19134 @item primaries, p
19135 Set the output color primaries.
19136
19137 Possible values are:
19138 @table @var
19139 @item bt709
19140 @item bt2020
19141 @end table
19142
19143 Default is same as input.
19144
19145 @item transfer, t
19146 Set the output transfer characteristics.
19147
19148 Possible values are:
19149 @table @var
19150 @item bt709
19151 @item bt2020
19152 @end table
19153
19154 Default is bt709.
19155
19156 @item matrix, m
19157 Set the output colorspace matrix.
19158
19159 Possible value are:
19160 @table @var
19161 @item bt709
19162 @item bt2020
19163 @end table
19164
19165 Default is same as input.
19166
19167 @end table
19168
19169 @subsection Example
19170
19171 @itemize
19172 @item
19173 Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
19174 @example
19175 -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
19176 @end example
19177 @end itemize
19178
19179 @section unsharp_opencl
19180
19181 Sharpen or blur the input video.
19182
19183 It accepts the following parameters:
19184
19185 @table @option
19186 @item luma_msize_x, lx
19187 Set the luma matrix horizontal size.
19188 Range is @code{[1, 23]} and default value is @code{5}.
19189
19190 @item luma_msize_y, ly
19191 Set the luma matrix vertical size.
19192 Range is @code{[1, 23]} and default value is @code{5}.
19193
19194 @item luma_amount, la
19195 Set the luma effect strength.
19196 Range is @code{[-10, 10]} and default value is @code{1.0}.
19197
19198 Negative values will blur the input video, while positive values will
19199 sharpen it, a value of zero will disable the effect.
19200
19201 @item chroma_msize_x, cx
19202 Set the chroma matrix horizontal size.
19203 Range is @code{[1, 23]} and default value is @code{5}.
19204
19205 @item chroma_msize_y, cy
19206 Set the chroma matrix vertical size.
19207 Range is @code{[1, 23]} and default value is @code{5}.
19208
19209 @item chroma_amount, ca
19210 Set the chroma effect strength.
19211 Range is @code{[-10, 10]} and default value is @code{0.0}.
19212
19213 Negative values will blur the input video, while positive values will
19214 sharpen it, a value of zero will disable the effect.
19215
19216 @end table
19217
19218 All parameters are optional and default to the equivalent of the
19219 string '5:5:1.0:5:5:0.0'.
19220
19221 @subsection Examples
19222
19223 @itemize
19224 @item
19225 Apply strong luma sharpen effect:
19226 @example
19227 -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
19228 @end example
19229
19230 @item
19231 Apply a strong blur of both luma and chroma parameters:
19232 @example
19233 -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
19234 @end example
19235 @end itemize
19236
19237 @c man end OPENCL VIDEO FILTERS
19238
19239 @chapter Video Sources
19240 @c man begin VIDEO SOURCES
19241
19242 Below is a description of the currently available video sources.
19243
19244 @section buffer
19245
19246 Buffer video frames, and make them available to the filter chain.
19247
19248 This source is mainly intended for a programmatic use, in particular
19249 through the interface defined in @file{libavfilter/vsrc_buffer.h}.
19250
19251 It accepts the following parameters:
19252
19253 @table @option
19254
19255 @item video_size
19256 Specify the size (width and height) of the buffered video frames. For the
19257 syntax of this option, check the
19258 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19259
19260 @item width
19261 The input video width.
19262
19263 @item height
19264 The input video height.
19265
19266 @item pix_fmt
19267 A string representing the pixel format of the buffered video frames.
19268 It may be a number corresponding to a pixel format, or a pixel format
19269 name.
19270
19271 @item time_base
19272 Specify the timebase assumed by the timestamps of the buffered frames.
19273
19274 @item frame_rate
19275 Specify the frame rate expected for the video stream.
19276
19277 @item pixel_aspect, sar
19278 The sample (pixel) aspect ratio of the input video.
19279
19280 @item sws_param
19281 Specify the optional parameters to be used for the scale filter which
19282 is automatically inserted when an input change is detected in the
19283 input size or format.
19284
19285 @item hw_frames_ctx
19286 When using a hardware pixel format, this should be a reference to an
19287 AVHWFramesContext describing input frames.
19288 @end table
19289
19290 For example:
19291 @example
19292 buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
19293 @end example
19294
19295 will instruct the source to accept video frames with size 320x240 and
19296 with format "yuv410p", assuming 1/24 as the timestamps timebase and
19297 square pixels (1:1 sample aspect ratio).
19298 Since the pixel format with name "yuv410p" corresponds to the number 6
19299 (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
19300 this example corresponds to:
19301 @example
19302 buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
19303 @end example
19304
19305 Alternatively, the options can be specified as a flat string, but this
19306 syntax is deprecated:
19307
19308 @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}]
19309
19310 @section cellauto
19311
19312 Create a pattern generated by an elementary cellular automaton.
19313
19314 The initial state of the cellular automaton can be defined through the
19315 @option{filename} and @option{pattern} options. If such options are
19316 not specified an initial state is created randomly.
19317
19318 At each new frame a new row in the video is filled with the result of
19319 the cellular automaton next generation. The behavior when the whole
19320 frame is filled is defined by the @option{scroll} option.
19321
19322 This source accepts the following options:
19323
19324 @table @option
19325 @item filename, f
19326 Read the initial cellular automaton state, i.e. the starting row, from
19327 the specified file.
19328 In the file, each non-whitespace character is considered an alive
19329 cell, a newline will terminate the row, and further characters in the
19330 file will be ignored.
19331
19332 @item pattern, p
19333 Read the initial cellular automaton state, i.e. the starting row, from
19334 the specified string.
19335
19336 Each non-whitespace character in the string is considered an alive
19337 cell, a newline will terminate the row, and further characters in the
19338 string will be ignored.
19339
19340 @item rate, r
19341 Set the video rate, that is the number of frames generated per second.
19342 Default is 25.
19343
19344 @item random_fill_ratio, ratio
19345 Set the random fill ratio for the initial cellular automaton row. It
19346 is a floating point number value ranging from 0 to 1, defaults to
19347 1/PHI.
19348
19349 This option is ignored when a file or a pattern is specified.
19350
19351 @item random_seed, seed
19352 Set the seed for filling randomly the initial row, must be an integer
19353 included between 0 and UINT32_MAX. If not specified, or if explicitly
19354 set to -1, the filter will try to use a good random seed on a best
19355 effort basis.
19356
19357 @item rule
19358 Set the cellular automaton rule, it is a number ranging from 0 to 255.
19359 Default value is 110.
19360
19361 @item size, s
19362 Set the size of the output video. For the syntax of this option, check the
19363 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19364
19365 If @option{filename} or @option{pattern} is specified, the size is set
19366 by default to the width of the specified initial state row, and the
19367 height is set to @var{width} * PHI.
19368
19369 If @option{size} is set, it must contain the width of the specified
19370 pattern string, and the specified pattern will be centered in the
19371 larger row.
19372
19373 If a filename or a pattern string is not specified, the size value
19374 defaults to "320x518" (used for a randomly generated initial state).
19375
19376 @item scroll
19377 If set to 1, scroll the output upward when all the rows in the output
19378 have been already filled. If set to 0, the new generated row will be
19379 written over the top row just after the bottom row is filled.
19380 Defaults to 1.
19381
19382 @item start_full, full
19383 If set to 1, completely fill the output with generated rows before
19384 outputting the first frame.
19385 This is the default behavior, for disabling set the value to 0.
19386
19387 @item stitch
19388 If set to 1, stitch the left and right row edges together.
19389 This is the default behavior, for disabling set the value to 0.
19390 @end table
19391
19392 @subsection Examples
19393
19394 @itemize
19395 @item
19396 Read the initial state from @file{pattern}, and specify an output of
19397 size 200x400.
19398 @example
19399 cellauto=f=pattern:s=200x400
19400 @end example
19401
19402 @item
19403 Generate a random initial row with a width of 200 cells, with a fill
19404 ratio of 2/3:
19405 @example
19406 cellauto=ratio=2/3:s=200x200
19407 @end example
19408
19409 @item
19410 Create a pattern generated by rule 18 starting by a single alive cell
19411 centered on an initial row with width 100:
19412 @example
19413 cellauto=p=@@:s=100x400:full=0:rule=18
19414 @end example
19415
19416 @item
19417 Specify a more elaborated initial pattern:
19418 @example
19419 cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
19420 @end example
19421
19422 @end itemize
19423
19424 @anchor{coreimagesrc}
19425 @section coreimagesrc
19426 Video source generated on GPU using Apple's CoreImage API on OSX.
19427
19428 This video source is a specialized version of the @ref{coreimage} video filter.
19429 Use a core image generator at the beginning of the applied filterchain to
19430 generate the content.
19431
19432 The coreimagesrc video source accepts the following options:
19433 @table @option
19434 @item list_generators
19435 List all available generators along with all their respective options as well as
19436 possible minimum and maximum values along with the default values.
19437 @example
19438 list_generators=true
19439 @end example
19440
19441 @item size, s
19442 Specify the size of the sourced video. For the syntax of this option, check the
19443 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19444 The default value is @code{320x240}.
19445
19446 @item rate, r
19447 Specify the frame rate of the sourced video, as the number of frames
19448 generated per second. It has to be a string in the format
19449 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
19450 number or a valid video frame rate abbreviation. The default value is
19451 "25".
19452
19453 @item sar
19454 Set the sample aspect ratio of the sourced video.
19455
19456 @item duration, d
19457 Set the duration of the sourced video. See
19458 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
19459 for the accepted syntax.
19460
19461 If not specified, or the expressed duration is negative, the video is
19462 supposed to be generated forever.
19463 @end table
19464
19465 Additionally, all options of the @ref{coreimage} video filter are accepted.
19466 A complete filterchain can be used for further processing of the
19467 generated input without CPU-HOST transfer. See @ref{coreimage} documentation
19468 and examples for details.
19469
19470 @subsection Examples
19471
19472 @itemize
19473
19474 @item
19475 Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
19476 given as complete and escaped command-line for Apple's standard bash shell:
19477 @example
19478 ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
19479 @end example
19480 This example is equivalent to the QRCode example of @ref{coreimage} without the
19481 need for a nullsrc video source.
19482 @end itemize
19483
19484
19485 @section mandelbrot
19486
19487 Generate a Mandelbrot set fractal, and progressively zoom towards the
19488 point specified with @var{start_x} and @var{start_y}.
19489
19490 This source accepts the following options:
19491
19492 @table @option
19493
19494 @item end_pts
19495 Set the terminal pts value. Default value is 400.
19496
19497 @item end_scale
19498 Set the terminal scale value.
19499 Must be a floating point value. Default value is 0.3.
19500
19501 @item inner
19502 Set the inner coloring mode, that is the algorithm used to draw the
19503 Mandelbrot fractal internal region.
19504
19505 It shall assume one of the following values:
19506 @table @option
19507 @item black
19508 Set black mode.
19509 @item convergence
19510 Show time until convergence.
19511 @item mincol
19512 Set color based on point closest to the origin of the iterations.
19513 @item period
19514 Set period mode.
19515 @end table
19516
19517 Default value is @var{mincol}.
19518
19519 @item bailout
19520 Set the bailout value. Default value is 10.0.
19521
19522 @item maxiter
19523 Set the maximum of iterations performed by the rendering
19524 algorithm. Default value is 7189.
19525
19526 @item outer
19527 Set outer coloring mode.
19528 It shall assume one of following values:
19529 @table @option
19530 @item iteration_count
19531 Set iteration cound mode.
19532 @item normalized_iteration_count
19533 set normalized iteration count mode.
19534 @end table
19535 Default value is @var{normalized_iteration_count}.
19536
19537 @item rate, r
19538 Set frame rate, expressed as number of frames per second. Default
19539 value is "25".
19540
19541 @item size, s
19542 Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
19543 size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
19544
19545 @item start_scale
19546 Set the initial scale value. Default value is 3.0.
19547
19548 @item start_x
19549 Set the initial x position. Must be a floating point value between
19550 -100 and 100. Default value is -0.743643887037158704752191506114774.
19551
19552 @item start_y
19553 Set the initial y position. Must be a floating point value between
19554 -100 and 100. Default value is -0.131825904205311970493132056385139.
19555 @end table
19556
19557 @section mptestsrc
19558
19559 Generate various test patterns, as generated by the MPlayer test filter.
19560
19561 The size of the generated video is fixed, and is 256x256.
19562 This source is useful in particular for testing encoding features.
19563
19564 This source accepts the following options:
19565
19566 @table @option
19567
19568 @item rate, r
19569 Specify the frame rate of the sourced video, as the number of frames
19570 generated per second. It has to be a string in the format
19571 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
19572 number or a valid video frame rate abbreviation. The default value is
19573 "25".
19574
19575 @item duration, d
19576 Set the duration of the sourced video. See
19577 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
19578 for the accepted syntax.
19579
19580 If not specified, or the expressed duration is negative, the video is
19581 supposed to be generated forever.
19582
19583 @item test, t
19584
19585 Set the number or the name of the test to perform. Supported tests are:
19586 @table @option
19587 @item dc_luma
19588 @item dc_chroma
19589 @item freq_luma
19590 @item freq_chroma
19591 @item amp_luma
19592 @item amp_chroma
19593 @item cbp
19594 @item mv
19595 @item ring1
19596 @item ring2
19597 @item all
19598
19599 @end table
19600
19601 Default value is "all", which will cycle through the list of all tests.
19602 @end table
19603
19604 Some examples:
19605 @example
19606 mptestsrc=t=dc_luma
19607 @end example
19608
19609 will generate a "dc_luma" test pattern.
19610
19611 @section frei0r_src
19612
19613 Provide a frei0r source.
19614
19615 To enable compilation of this filter you need to install the frei0r
19616 header and configure FFmpeg with @code{--enable-frei0r}.
19617
19618 This source accepts the following parameters:
19619
19620 @table @option
19621
19622 @item size
19623 The size of the video to generate. For the syntax of this option, check the
19624 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19625
19626 @item framerate
19627 The framerate of the generated video. It may be a string of the form
19628 @var{num}/@var{den} or a frame rate abbreviation.
19629
19630 @item filter_name
19631 The name to the frei0r source to load. For more information regarding frei0r and
19632 how to set the parameters, read the @ref{frei0r} section in the video filters
19633 documentation.
19634
19635 @item filter_params
19636 A '|'-separated list of parameters to pass to the frei0r source.
19637
19638 @end table
19639
19640 For example, to generate a frei0r partik0l source with size 200x200
19641 and frame rate 10 which is overlaid on the overlay filter main input:
19642 @example
19643 frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
19644 @end example
19645
19646 @section life
19647
19648 Generate a life pattern.
19649
19650 This source is based on a generalization of John Conway's life game.
19651
19652 The sourced input represents a life grid, each pixel represents a cell
19653 which can be in one of two possible states, alive or dead. Every cell
19654 interacts with its eight neighbours, which are the cells that are
19655 horizontally, vertically, or diagonally adjacent.
19656
19657 At each interaction the grid evolves according to the adopted rule,
19658 which specifies the number of neighbor alive cells which will make a
19659 cell stay alive or born. The @option{rule} option allows one to specify
19660 the rule to adopt.
19661
19662 This source accepts the following options:
19663
19664 @table @option
19665 @item filename, f
19666 Set the file from which to read the initial grid state. In the file,
19667 each non-whitespace character is considered an alive cell, and newline
19668 is used to delimit the end of each row.
19669
19670 If this option is not specified, the initial grid is generated
19671 randomly.
19672
19673 @item rate, r
19674 Set the video rate, that is the number of frames generated per second.
19675 Default is 25.
19676
19677 @item random_fill_ratio, ratio
19678 Set the random fill ratio for the initial random grid. It is a
19679 floating point number value ranging from 0 to 1, defaults to 1/PHI.
19680 It is ignored when a file is specified.
19681
19682 @item random_seed, seed
19683 Set the seed for filling the initial random grid, must be an integer
19684 included between 0 and UINT32_MAX. If not specified, or if explicitly
19685 set to -1, the filter will try to use a good random seed on a best
19686 effort basis.
19687
19688 @item rule
19689 Set the life rule.
19690
19691 A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
19692 where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
19693 @var{NS} specifies the number of alive neighbor cells which make a
19694 live cell stay alive, and @var{NB} the number of alive neighbor cells
19695 which make a dead cell to become alive (i.e. to "born").
19696 "s" and "b" can be used in place of "S" and "B", respectively.
19697
19698 Alternatively a rule can be specified by an 18-bits integer. The 9
19699 high order bits are used to encode the next cell state if it is alive
19700 for each number of neighbor alive cells, the low order bits specify
19701 the rule for "borning" new cells. Higher order bits encode for an
19702 higher number of neighbor cells.
19703 For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
19704 rule of 12 and a born rule of 9, which corresponds to "S23/B03".
19705
19706 Default value is "S23/B3", which is the original Conway's game of life
19707 rule, and will keep a cell alive if it has 2 or 3 neighbor alive
19708 cells, and will born a new cell if there are three alive cells around
19709 a dead cell.
19710
19711 @item size, s
19712 Set the size of the output video. For the syntax of this option, check the
19713 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19714
19715 If @option{filename} is specified, the size is set by default to the
19716 same size of the input file. If @option{size} is set, it must contain
19717 the size specified in the input file, and the initial grid defined in
19718 that file is centered in the larger resulting area.
19719
19720 If a filename is not specified, the size value defaults to "320x240"
19721 (used for a randomly generated initial grid).
19722
19723 @item stitch
19724 If set to 1, stitch the left and right grid edges together, and the
19725 top and bottom edges also. Defaults to 1.
19726
19727 @item mold
19728 Set cell mold speed. If set, a dead cell will go from @option{death_color} to
19729 @option{mold_color} with a step of @option{mold}. @option{mold} can have a
19730 value from 0 to 255.
19731
19732 @item life_color
19733 Set the color of living (or new born) cells.
19734
19735 @item death_color
19736 Set the color of dead cells. If @option{mold} is set, this is the first color
19737 used to represent a dead cell.
19738
19739 @item mold_color
19740 Set mold color, for definitely dead and moldy cells.
19741
19742 For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
19743 ffmpeg-utils manual,ffmpeg-utils}.
19744 @end table
19745
19746 @subsection Examples
19747
19748 @itemize
19749 @item
19750 Read a grid from @file{pattern}, and center it on a grid of size
19751 300x300 pixels:
19752 @example
19753 life=f=pattern:s=300x300
19754 @end example
19755
19756 @item
19757 Generate a random grid of size 200x200, with a fill ratio of 2/3:
19758 @example
19759 life=ratio=2/3:s=200x200
19760 @end example
19761
19762 @item
19763 Specify a custom rule for evolving a randomly generated grid:
19764 @example
19765 life=rule=S14/B34
19766 @end example
19767
19768 @item
19769 Full example with slow death effect (mold) using @command{ffplay}:
19770 @example
19771 ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
19772 @end example
19773 @end itemize
19774
19775 @anchor{allrgb}
19776 @anchor{allyuv}
19777 @anchor{color}
19778 @anchor{haldclutsrc}
19779 @anchor{nullsrc}
19780 @anchor{pal75bars}
19781 @anchor{pal100bars}
19782 @anchor{rgbtestsrc}
19783 @anchor{smptebars}
19784 @anchor{smptehdbars}
19785 @anchor{testsrc}
19786 @anchor{testsrc2}
19787 @anchor{yuvtestsrc}
19788 @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
19789
19790 The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
19791
19792 The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
19793
19794 The @code{color} source provides an uniformly colored input.
19795
19796 The @code{haldclutsrc} source provides an identity Hald CLUT. See also
19797 @ref{haldclut} filter.
19798
19799 The @code{nullsrc} source returns unprocessed video frames. It is
19800 mainly useful to be employed in analysis / debugging tools, or as the
19801 source for filters which ignore the input data.
19802
19803 The @code{pal75bars} source generates a color bars pattern, based on
19804 EBU PAL recommendations with 75% color levels.
19805
19806 The @code{pal100bars} source generates a color bars pattern, based on
19807 EBU PAL recommendations with 100% color levels.
19808
19809 The @code{rgbtestsrc} source generates an RGB test pattern useful for
19810 detecting RGB vs BGR issues. You should see a red, green and blue
19811 stripe from top to bottom.
19812
19813 The @code{smptebars} source generates a color bars pattern, based on
19814 the SMPTE Engineering Guideline EG 1-1990.
19815
19816 The @code{smptehdbars} source generates a color bars pattern, based on
19817 the SMPTE RP 219-2002.
19818
19819 The @code{testsrc} source generates a test video pattern, showing a
19820 color pattern, a scrolling gradient and a timestamp. This is mainly
19821 intended for testing purposes.
19822
19823 The @code{testsrc2} source is similar to testsrc, but supports more
19824 pixel formats instead of just @code{rgb24}. This allows using it as an
19825 input for other tests without requiring a format conversion.
19826
19827 The @code{yuvtestsrc} source generates an YUV test pattern. You should
19828 see a y, cb and cr stripe from top to bottom.
19829
19830 The sources accept the following parameters:
19831
19832 @table @option
19833
19834 @item level
19835 Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
19836 source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
19837 pixels to be used as identity matrix for 3D lookup tables. Each component is
19838 coded on a @code{1/(N*N)} scale.
19839
19840 @item color, c
19841 Specify the color of the source, only available in the @code{color}
19842 source. For the syntax of this option, check the
19843 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
19844
19845 @item size, s
19846 Specify the size of the sourced video. For the syntax of this option, check the
19847 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19848 The default value is @code{320x240}.
19849
19850 This option is not available with the @code{allrgb}, @code{allyuv}, and
19851 @code{haldclutsrc} filters.
19852
19853 @item rate, r
19854 Specify the frame rate of the sourced video, as the number of frames
19855 generated per second. It has to be a string in the format
19856 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
19857 number or a valid video frame rate abbreviation. The default value is
19858 "25".
19859
19860 @item duration, d
19861 Set the duration of the sourced video. See
19862 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
19863 for the accepted syntax.
19864
19865 If not specified, or the expressed duration is negative, the video is
19866 supposed to be generated forever.
19867
19868 @item sar
19869 Set the sample aspect ratio of the sourced video.
19870
19871 @item alpha
19872 Specify the alpha (opacity) of the background, only available in the
19873 @code{testsrc2} source. The value must be between 0 (fully transparent) and
19874 255 (fully opaque, the default).
19875
19876 @item decimals, n
19877 Set the number of decimals to show in the timestamp, only available in the
19878 @code{testsrc} source.
19879
19880 The displayed timestamp value will correspond to the original
19881 timestamp value multiplied by the power of 10 of the specified
19882 value. Default value is 0.
19883 @end table
19884
19885 @subsection Examples
19886
19887 @itemize
19888 @item
19889 Generate a video with a duration of 5.3 seconds, with size
19890 176x144 and a frame rate of 10 frames per second:
19891 @example
19892 testsrc=duration=5.3:size=qcif:rate=10
19893 @end example
19894
19895 @item
19896 The following graph description will generate a red source
19897 with an opacity of 0.2, with size "qcif" and a frame rate of 10
19898 frames per second:
19899 @example
19900 color=c=red@@0.2:s=qcif:r=10
19901 @end example
19902
19903 @item
19904 If the input content is to be ignored, @code{nullsrc} can be used. The
19905 following command generates noise in the luminance plane by employing
19906 the @code{geq} filter:
19907 @example
19908 nullsrc=s=256x256, geq=random(1)*255:128:128
19909 @end example
19910 @end itemize
19911
19912 @subsection Commands
19913
19914 The @code{color} source supports the following commands:
19915
19916 @table @option
19917 @item c, color
19918 Set the color of the created image. Accepts the same syntax of the
19919 corresponding @option{color} option.
19920 @end table
19921
19922 @section openclsrc
19923
19924 Generate video using an OpenCL program.
19925
19926 @table @option
19927
19928 @item source
19929 OpenCL program source file.
19930
19931 @item kernel
19932 Kernel name in program.
19933
19934 @item size, s
19935 Size of frames to generate.  This must be set.
19936
19937 @item format
19938 Pixel format to use for the generated frames.  This must be set.
19939
19940 @item rate, r
19941 Number of frames generated every second.  Default value is '25'.
19942
19943 @end table
19944
19945 For details of how the program loading works, see the @ref{program_opencl}
19946 filter.
19947
19948 Example programs:
19949
19950 @itemize
19951 @item
19952 Generate a colour ramp by setting pixel values from the position of the pixel
19953 in the output image.  (Note that this will work with all pixel formats, but
19954 the generated output will not be the same.)
19955 @verbatim
19956 __kernel void ramp(__write_only image2d_t dst,
19957                    unsigned int index)
19958 {
19959     int2 loc = (int2)(get_global_id(0), get_global_id(1));
19960
19961     float4 val;
19962     val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
19963
19964     write_imagef(dst, loc, val);
19965 }
19966 @end verbatim
19967
19968 @item
19969 Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
19970 @verbatim
19971 __kernel void sierpinski_carpet(__write_only image2d_t dst,
19972                                 unsigned int index)
19973 {
19974     int2 loc = (int2)(get_global_id(0), get_global_id(1));
19975
19976     float4 value = 0.0f;
19977     int x = loc.x + index;
19978     int y = loc.y + index;
19979     while (x > 0 || y > 0) {
19980         if (x % 3 == 1 && y % 3 == 1) {
19981             value = 1.0f;
19982             break;
19983         }
19984         x /= 3;
19985         y /= 3;
19986     }
19987
19988     write_imagef(dst, loc, value);
19989 }
19990 @end verbatim
19991
19992 @end itemize
19993
19994 @c man end VIDEO SOURCES
19995
19996 @chapter Video Sinks
19997 @c man begin VIDEO SINKS
19998
19999 Below is a description of the currently available video sinks.
20000
20001 @section buffersink
20002
20003 Buffer video frames, and make them available to the end of the filter
20004 graph.
20005
20006 This sink is mainly intended for programmatic use, in particular
20007 through the interface defined in @file{libavfilter/buffersink.h}
20008 or the options system.
20009
20010 It accepts a pointer to an AVBufferSinkContext structure, which
20011 defines the incoming buffers' formats, to be passed as the opaque
20012 parameter to @code{avfilter_init_filter} for initialization.
20013
20014 @section nullsink
20015
20016 Null video sink: do absolutely nothing with the input video. It is
20017 mainly useful as a template and for use in analysis / debugging
20018 tools.
20019
20020 @c man end VIDEO SINKS
20021
20022 @chapter Multimedia Filters
20023 @c man begin MULTIMEDIA FILTERS
20024
20025 Below is a description of the currently available multimedia filters.
20026
20027 @section abitscope
20028
20029 Convert input audio to a video output, displaying the audio bit scope.
20030
20031 The filter accepts the following options:
20032
20033 @table @option
20034 @item rate, r
20035 Set frame rate, expressed as number of frames per second. Default
20036 value is "25".
20037
20038 @item size, s
20039 Specify the video size for the output. For the syntax of this option, check the
20040 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20041 Default value is @code{1024x256}.
20042
20043 @item colors
20044 Specify list of colors separated by space or by '|' which will be used to
20045 draw channels. Unrecognized or missing colors will be replaced
20046 by white color.
20047 @end table
20048
20049 @section ahistogram
20050
20051 Convert input audio to a video output, displaying the volume histogram.
20052
20053 The filter accepts the following options:
20054
20055 @table @option
20056 @item dmode
20057 Specify how histogram is calculated.
20058
20059 It accepts the following values:
20060 @table @samp
20061 @item single
20062 Use single histogram for all channels.
20063 @item separate
20064 Use separate histogram for each channel.
20065 @end table
20066 Default is @code{single}.
20067
20068 @item rate, r
20069 Set frame rate, expressed as number of frames per second. Default
20070 value is "25".
20071
20072 @item size, s
20073 Specify the video size for the output. For the syntax of this option, check the
20074 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20075 Default value is @code{hd720}.
20076
20077 @item scale
20078 Set display scale.
20079
20080 It accepts the following values:
20081 @table @samp
20082 @item log
20083 logarithmic
20084 @item sqrt
20085 square root
20086 @item cbrt
20087 cubic root
20088 @item lin
20089 linear
20090 @item rlog
20091 reverse logarithmic
20092 @end table
20093 Default is @code{log}.
20094
20095 @item ascale
20096 Set amplitude scale.
20097
20098 It accepts the following values:
20099 @table @samp
20100 @item log
20101 logarithmic
20102 @item lin
20103 linear
20104 @end table
20105 Default is @code{log}.
20106
20107 @item acount
20108 Set how much frames to accumulate in histogram.
20109 Defauls is 1. Setting this to -1 accumulates all frames.
20110
20111 @item rheight
20112 Set histogram ratio of window height.
20113
20114 @item slide
20115 Set sonogram sliding.
20116
20117 It accepts the following values:
20118 @table @samp
20119 @item replace
20120 replace old rows with new ones.
20121 @item scroll
20122 scroll from top to bottom.
20123 @end table
20124 Default is @code{replace}.
20125 @end table
20126
20127 @section aphasemeter
20128
20129 Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
20130 representing mean phase of current audio frame. A video output can also be produced and is
20131 enabled by default. The audio is passed through as first output.
20132
20133 Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
20134 range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
20135 and @code{1} means channels are in phase.
20136
20137 The filter accepts the following options, all related to its video output:
20138
20139 @table @option
20140 @item rate, r
20141 Set the output frame rate. Default value is @code{25}.
20142
20143 @item size, s
20144 Set the video size for the output. For the syntax of this option, check the
20145 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20146 Default value is @code{800x400}.
20147
20148 @item rc
20149 @item gc
20150 @item bc
20151 Specify the red, green, blue contrast. Default values are @code{2},
20152 @code{7} and @code{1}.
20153 Allowed range is @code{[0, 255]}.
20154
20155 @item mpc
20156 Set color which will be used for drawing median phase. If color is
20157 @code{none} which is default, no median phase value will be drawn.
20158
20159 @item video
20160 Enable video output. Default is enabled.
20161 @end table
20162
20163 @section avectorscope
20164
20165 Convert input audio to a video output, representing the audio vector
20166 scope.
20167
20168 The filter is used to measure the difference between channels of stereo
20169 audio stream. A monoaural signal, consisting of identical left and right
20170 signal, results in straight vertical line. Any stereo separation is visible
20171 as a deviation from this line, creating a Lissajous figure.
20172 If the straight (or deviation from it) but horizontal line appears this
20173 indicates that the left and right channels are out of phase.
20174
20175 The filter accepts the following options:
20176
20177 @table @option
20178 @item mode, m
20179 Set the vectorscope mode.
20180
20181 Available values are:
20182 @table @samp
20183 @item lissajous
20184 Lissajous rotated by 45 degrees.
20185
20186 @item lissajous_xy
20187 Same as above but not rotated.
20188
20189 @item polar
20190 Shape resembling half of circle.
20191 @end table
20192
20193 Default value is @samp{lissajous}.
20194
20195 @item size, s
20196 Set the video size for the output. For the syntax of this option, check the
20197 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20198 Default value is @code{400x400}.
20199
20200 @item rate, r
20201 Set the output frame rate. Default value is @code{25}.
20202
20203 @item rc
20204 @item gc
20205 @item bc
20206 @item ac
20207 Specify the red, green, blue and alpha contrast. Default values are @code{40},
20208 @code{160}, @code{80} and @code{255}.
20209 Allowed range is @code{[0, 255]}.
20210
20211 @item rf
20212 @item gf
20213 @item bf
20214 @item af
20215 Specify the red, green, blue and alpha fade. Default values are @code{15},
20216 @code{10}, @code{5} and @code{5}.
20217 Allowed range is @code{[0, 255]}.
20218
20219 @item zoom
20220 Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
20221 Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
20222
20223 @item draw
20224 Set the vectorscope drawing mode.
20225
20226 Available values are:
20227 @table @samp
20228 @item dot
20229 Draw dot for each sample.
20230
20231 @item line
20232 Draw line between previous and current sample.
20233 @end table
20234
20235 Default value is @samp{dot}.
20236
20237 @item scale
20238 Specify amplitude scale of audio samples.
20239
20240 Available values are:
20241 @table @samp
20242 @item lin
20243 Linear.
20244
20245 @item sqrt
20246 Square root.
20247
20248 @item cbrt
20249 Cubic root.
20250
20251 @item log
20252 Logarithmic.
20253 @end table
20254
20255 @item swap
20256 Swap left channel axis with right channel axis.
20257
20258 @item mirror
20259 Mirror axis.
20260
20261 @table @samp
20262 @item none
20263 No mirror.
20264
20265 @item x
20266 Mirror only x axis.
20267
20268 @item y
20269 Mirror only y axis.
20270
20271 @item xy
20272 Mirror both axis.
20273 @end table
20274
20275 @end table
20276
20277 @subsection Examples
20278
20279 @itemize
20280 @item
20281 Complete example using @command{ffplay}:
20282 @example
20283 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
20284              [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
20285 @end example
20286 @end itemize
20287
20288 @section bench, abench
20289
20290 Benchmark part of a filtergraph.
20291
20292 The filter accepts the following options:
20293
20294 @table @option
20295 @item action
20296 Start or stop a timer.
20297
20298 Available values are:
20299 @table @samp
20300 @item start
20301 Get the current time, set it as frame metadata (using the key
20302 @code{lavfi.bench.start_time}), and forward the frame to the next filter.
20303
20304 @item stop
20305 Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
20306 the input frame metadata to get the time difference. Time difference, average,
20307 maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
20308 @code{min}) are then printed. The timestamps are expressed in seconds.
20309 @end table
20310 @end table
20311
20312 @subsection Examples
20313
20314 @itemize
20315 @item
20316 Benchmark @ref{selectivecolor} filter:
20317 @example
20318 bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
20319 @end example
20320 @end itemize
20321
20322 @section concat
20323
20324 Concatenate audio and video streams, joining them together one after the
20325 other.
20326
20327 The filter works on segments of synchronized video and audio streams. All
20328 segments must have the same number of streams of each type, and that will
20329 also be the number of streams at output.
20330
20331 The filter accepts the following options:
20332
20333 @table @option
20334
20335 @item n
20336 Set the number of segments. Default is 2.
20337
20338 @item v
20339 Set the number of output video streams, that is also the number of video
20340 streams in each segment. Default is 1.
20341
20342 @item a
20343 Set the number of output audio streams, that is also the number of audio
20344 streams in each segment. Default is 0.
20345
20346 @item unsafe
20347 Activate unsafe mode: do not fail if segments have a different format.
20348
20349 @end table
20350
20351 The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
20352 @var{a} audio outputs.
20353
20354 There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
20355 segment, in the same order as the outputs, then the inputs for the second
20356 segment, etc.
20357
20358 Related streams do not always have exactly the same duration, for various
20359 reasons including codec frame size or sloppy authoring. For that reason,
20360 related synchronized streams (e.g. a video and its audio track) should be
20361 concatenated at once. The concat filter will use the duration of the longest
20362 stream in each segment (except the last one), and if necessary pad shorter
20363 audio streams with silence.
20364
20365 For this filter to work correctly, all segments must start at timestamp 0.
20366
20367 All corresponding streams must have the same parameters in all segments; the
20368 filtering system will automatically select a common pixel format for video
20369 streams, and a common sample format, sample rate and channel layout for
20370 audio streams, but other settings, such as resolution, must be converted
20371 explicitly by the user.
20372
20373 Different frame rates are acceptable but will result in variable frame rate
20374 at output; be sure to configure the output file to handle it.
20375
20376 @subsection Examples
20377
20378 @itemize
20379 @item
20380 Concatenate an opening, an episode and an ending, all in bilingual version
20381 (video in stream 0, audio in streams 1 and 2):
20382 @example
20383 ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
20384   '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
20385    concat=n=3:v=1:a=2 [v] [a1] [a2]' \
20386   -map '[v]' -map '[a1]' -map '[a2]' output.mkv
20387 @end example
20388
20389 @item
20390 Concatenate two parts, handling audio and video separately, using the
20391 (a)movie sources, and adjusting the resolution:
20392 @example
20393 movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
20394 movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
20395 [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
20396 @end example
20397 Note that a desync will happen at the stitch if the audio and video streams
20398 do not have exactly the same duration in the first file.
20399
20400 @end itemize
20401
20402 @subsection Commands
20403
20404 This filter supports the following commands:
20405 @table @option
20406 @item next
20407 Close the current segment and step to the next one
20408 @end table
20409
20410 @section drawgraph, adrawgraph
20411
20412 Draw a graph using input video or audio metadata.
20413
20414 It accepts the following parameters:
20415
20416 @table @option
20417 @item m1
20418 Set 1st frame metadata key from which metadata values will be used to draw a graph.
20419
20420 @item fg1
20421 Set 1st foreground color expression.
20422
20423 @item m2
20424 Set 2nd frame metadata key from which metadata values will be used to draw a graph.
20425
20426 @item fg2
20427 Set 2nd foreground color expression.
20428
20429 @item m3
20430 Set 3rd frame metadata key from which metadata values will be used to draw a graph.
20431
20432 @item fg3
20433 Set 3rd foreground color expression.
20434
20435 @item m4
20436 Set 4th frame metadata key from which metadata values will be used to draw a graph.
20437
20438 @item fg4
20439 Set 4th foreground color expression.
20440
20441 @item min
20442 Set minimal value of metadata value.
20443
20444 @item max
20445 Set maximal value of metadata value.
20446
20447 @item bg
20448 Set graph background color. Default is white.
20449
20450 @item mode
20451 Set graph mode.
20452
20453 Available values for mode is:
20454 @table @samp
20455 @item bar
20456 @item dot
20457 @item line
20458 @end table
20459
20460 Default is @code{line}.
20461
20462 @item slide
20463 Set slide mode.
20464
20465 Available values for slide is:
20466 @table @samp
20467 @item frame
20468 Draw new frame when right border is reached.
20469
20470 @item replace
20471 Replace old columns with new ones.
20472
20473 @item scroll
20474 Scroll from right to left.
20475
20476 @item rscroll
20477 Scroll from left to right.
20478
20479 @item picture
20480 Draw single picture.
20481 @end table
20482
20483 Default is @code{frame}.
20484
20485 @item size
20486 Set size of graph video. For the syntax of this option, check the
20487 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20488 The default value is @code{900x256}.
20489
20490 The foreground color expressions can use the following variables:
20491 @table @option
20492 @item MIN
20493 Minimal value of metadata value.
20494
20495 @item MAX
20496 Maximal value of metadata value.
20497
20498 @item VAL
20499 Current metadata key value.
20500 @end table
20501
20502 The color is defined as 0xAABBGGRR.
20503 @end table
20504
20505 Example using metadata from @ref{signalstats} filter:
20506 @example
20507 signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
20508 @end example
20509
20510 Example using metadata from @ref{ebur128} filter:
20511 @example
20512 ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
20513 @end example
20514
20515 @anchor{ebur128}
20516 @section ebur128
20517
20518 EBU R128 scanner filter. This filter takes an audio stream as input and outputs
20519 it unchanged. By default, it logs a message at a frequency of 10Hz with the
20520 Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
20521 Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
20522
20523 The filter also has a video output (see the @var{video} option) with a real
20524 time graph to observe the loudness evolution. The graphic contains the logged
20525 message mentioned above, so it is not printed anymore when this option is set,
20526 unless the verbose logging is set. The main graphing area contains the
20527 short-term loudness (3 seconds of analysis), and the gauge on the right is for
20528 the momentary loudness (400 milliseconds), but can optionally be configured
20529 to instead display short-term loudness (see @var{gauge}).
20530
20531 The green area marks a  +/- 1LU target range around the target loudness
20532 (-23LUFS by default, unless modified through @var{target}).
20533
20534 More information about the Loudness Recommendation EBU R128 on
20535 @url{http://tech.ebu.ch/loudness}.
20536
20537 The filter accepts the following options:
20538
20539 @table @option
20540
20541 @item video
20542 Activate the video output. The audio stream is passed unchanged whether this
20543 option is set or no. The video stream will be the first output stream if
20544 activated. Default is @code{0}.
20545
20546 @item size
20547 Set the video size. This option is for video only. For the syntax of this
20548 option, check the
20549 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20550 Default and minimum resolution is @code{640x480}.
20551
20552 @item meter
20553 Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
20554 @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
20555 other integer value between this range is allowed.
20556
20557 @item metadata
20558 Set metadata injection. If set to @code{1}, the audio input will be segmented
20559 into 100ms output frames, each of them containing various loudness information
20560 in metadata.  All the metadata keys are prefixed with @code{lavfi.r128.}.
20561
20562 Default is @code{0}.
20563
20564 @item framelog
20565 Force the frame logging level.
20566
20567 Available values are:
20568 @table @samp
20569 @item info
20570 information logging level
20571 @item verbose
20572 verbose logging level
20573 @end table
20574
20575 By default, the logging level is set to @var{info}. If the @option{video} or
20576 the @option{metadata} options are set, it switches to @var{verbose}.
20577
20578 @item peak
20579 Set peak mode(s).
20580
20581 Available modes can be cumulated (the option is a @code{flag} type). Possible
20582 values are:
20583 @table @samp
20584 @item none
20585 Disable any peak mode (default).
20586 @item sample
20587 Enable sample-peak mode.
20588
20589 Simple peak mode looking for the higher sample value. It logs a message
20590 for sample-peak (identified by @code{SPK}).
20591 @item true
20592 Enable true-peak mode.
20593
20594 If enabled, the peak lookup is done on an over-sampled version of the input
20595 stream for better peak accuracy. It logs a message for true-peak.
20596 (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
20597 This mode requires a build with @code{libswresample}.
20598 @end table
20599
20600 @item dualmono
20601 Treat mono input files as "dual mono". If a mono file is intended for playback
20602 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
20603 If set to @code{true}, this option will compensate for this effect.
20604 Multi-channel input files are not affected by this option.
20605
20606 @item panlaw
20607 Set a specific pan law to be used for the measurement of dual mono files.
20608 This parameter is optional, and has a default value of -3.01dB.
20609
20610 @item target
20611 Set a specific target level (in LUFS) used as relative zero in the visualization.
20612 This parameter is optional and has a default value of -23LUFS as specified
20613 by EBU R128. However, material published online may prefer a level of -16LUFS
20614 (e.g. for use with podcasts or video platforms).
20615
20616 @item gauge
20617 Set the value displayed by the gauge. Valid values are @code{momentary} and s
20618 @code{shortterm}. By default the momentary value will be used, but in certain
20619 scenarios it may be more useful to observe the short term value instead (e.g.
20620 live mixing).
20621
20622 @item scale
20623 Sets the display scale for the loudness. Valid parameters are @code{absolute}
20624 (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
20625 video output, not the summary or continuous log output.
20626 @end table
20627
20628 @subsection Examples
20629
20630 @itemize
20631 @item
20632 Real-time graph using @command{ffplay}, with a EBU scale meter +18:
20633 @example
20634 ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
20635 @end example
20636
20637 @item
20638 Run an analysis with @command{ffmpeg}:
20639 @example
20640 ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
20641 @end example
20642 @end itemize
20643
20644 @section interleave, ainterleave
20645
20646 Temporally interleave frames from several inputs.
20647
20648 @code{interleave} works with video inputs, @code{ainterleave} with audio.
20649
20650 These filters read frames from several inputs and send the oldest
20651 queued frame to the output.
20652
20653 Input streams must have well defined, monotonically increasing frame
20654 timestamp values.
20655
20656 In order to submit one frame to output, these filters need to enqueue
20657 at least one frame for each input, so they cannot work in case one
20658 input is not yet terminated and will not receive incoming frames.
20659
20660 For example consider the case when one input is a @code{select} filter
20661 which always drops input frames. The @code{interleave} filter will keep
20662 reading from that input, but it will never be able to send new frames
20663 to output until the input sends an end-of-stream signal.
20664
20665 Also, depending on inputs synchronization, the filters will drop
20666 frames in case one input receives more frames than the other ones, and
20667 the queue is already filled.
20668
20669 These filters accept the following options:
20670
20671 @table @option
20672 @item nb_inputs, n
20673 Set the number of different inputs, it is 2 by default.
20674 @end table
20675
20676 @subsection Examples
20677
20678 @itemize
20679 @item
20680 Interleave frames belonging to different streams using @command{ffmpeg}:
20681 @example
20682 ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
20683 @end example
20684
20685 @item
20686 Add flickering blur effect:
20687 @example
20688 select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
20689 @end example
20690 @end itemize
20691
20692 @section metadata, ametadata
20693
20694 Manipulate frame metadata.
20695
20696 This filter accepts the following options:
20697
20698 @table @option
20699 @item mode
20700 Set mode of operation of the filter.
20701
20702 Can be one of the following:
20703
20704 @table @samp
20705 @item select
20706 If both @code{value} and @code{key} is set, select frames
20707 which have such metadata. If only @code{key} is set, select
20708 every frame that has such key in metadata.
20709
20710 @item add
20711 Add new metadata @code{key} and @code{value}. If key is already available
20712 do nothing.
20713
20714 @item modify
20715 Modify value of already present key.
20716
20717 @item delete
20718 If @code{value} is set, delete only keys that have such value.
20719 Otherwise, delete key. If @code{key} is not set, delete all metadata values in
20720 the frame.
20721
20722 @item print
20723 Print key and its value if metadata was found. If @code{key} is not set print all
20724 metadata values available in frame.
20725 @end table
20726
20727 @item key
20728 Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
20729
20730 @item value
20731 Set metadata value which will be used. This option is mandatory for
20732 @code{modify} and @code{add} mode.
20733
20734 @item function
20735 Which function to use when comparing metadata value and @code{value}.
20736
20737 Can be one of following:
20738
20739 @table @samp
20740 @item same_str
20741 Values are interpreted as strings, returns true if metadata value is same as @code{value}.
20742
20743 @item starts_with
20744 Values are interpreted as strings, returns true if metadata value starts with
20745 the @code{value} option string.
20746
20747 @item less
20748 Values are interpreted as floats, returns true if metadata value is less than @code{value}.
20749
20750 @item equal
20751 Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
20752
20753 @item greater
20754 Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
20755
20756 @item expr
20757 Values are interpreted as floats, returns true if expression from option @code{expr}
20758 evaluates to true.
20759 @end table
20760
20761 @item expr
20762 Set expression which is used when @code{function} is set to @code{expr}.
20763 The expression is evaluated through the eval API and can contain the following
20764 constants:
20765
20766 @table @option
20767 @item VALUE1
20768 Float representation of @code{value} from metadata key.
20769
20770 @item VALUE2
20771 Float representation of @code{value} as supplied by user in @code{value} option.
20772 @end table
20773
20774 @item file
20775 If specified in @code{print} mode, output is written to the named file. Instead of
20776 plain filename any writable url can be specified. Filename ``-'' is a shorthand
20777 for standard output. If @code{file} option is not set, output is written to the log
20778 with AV_LOG_INFO loglevel.
20779
20780 @end table
20781
20782 @subsection Examples
20783
20784 @itemize
20785 @item
20786 Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
20787 between 0 and 1.
20788 @example
20789 signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
20790 @end example
20791 @item
20792 Print silencedetect output to file @file{metadata.txt}.
20793 @example
20794 silencedetect,ametadata=mode=print:file=metadata.txt
20795 @end example
20796 @item
20797 Direct all metadata to a pipe with file descriptor 4.
20798 @example
20799 metadata=mode=print:file='pipe\:4'
20800 @end example
20801 @end itemize
20802
20803 @section perms, aperms
20804
20805 Set read/write permissions for the output frames.
20806
20807 These filters are mainly aimed at developers to test direct path in the
20808 following filter in the filtergraph.
20809
20810 The filters accept the following options:
20811
20812 @table @option
20813 @item mode
20814 Select the permissions mode.
20815
20816 It accepts the following values:
20817 @table @samp
20818 @item none
20819 Do nothing. This is the default.
20820 @item ro
20821 Set all the output frames read-only.
20822 @item rw
20823 Set all the output frames directly writable.
20824 @item toggle
20825 Make the frame read-only if writable, and writable if read-only.
20826 @item random
20827 Set each output frame read-only or writable randomly.
20828 @end table
20829
20830 @item seed
20831 Set the seed for the @var{random} mode, must be an integer included between
20832 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
20833 @code{-1}, the filter will try to use a good random seed on a best effort
20834 basis.
20835 @end table
20836
20837 Note: in case of auto-inserted filter between the permission filter and the
20838 following one, the permission might not be received as expected in that
20839 following filter. Inserting a @ref{format} or @ref{aformat} filter before the
20840 perms/aperms filter can avoid this problem.
20841
20842 @section realtime, arealtime
20843
20844 Slow down filtering to match real time approximately.
20845
20846 These filters will pause the filtering for a variable amount of time to
20847 match the output rate with the input timestamps.
20848 They are similar to the @option{re} option to @code{ffmpeg}.
20849
20850 They accept the following options:
20851
20852 @table @option
20853 @item limit
20854 Time limit for the pauses. Any pause longer than that will be considered
20855 a timestamp discontinuity and reset the timer. Default is 2 seconds.
20856 @end table
20857
20858 @anchor{select}
20859 @section select, aselect
20860
20861 Select frames to pass in output.
20862
20863 This filter accepts the following options:
20864
20865 @table @option
20866
20867 @item expr, e
20868 Set expression, which is evaluated for each input frame.
20869
20870 If the expression is evaluated to zero, the frame is discarded.
20871
20872 If the evaluation result is negative or NaN, the frame is sent to the
20873 first output; otherwise it is sent to the output with index
20874 @code{ceil(val)-1}, assuming that the input index starts from 0.
20875
20876 For example a value of @code{1.2} corresponds to the output with index
20877 @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
20878
20879 @item outputs, n
20880 Set the number of outputs. The output to which to send the selected
20881 frame is based on the result of the evaluation. Default value is 1.
20882 @end table
20883
20884 The expression can contain the following constants:
20885
20886 @table @option
20887 @item n
20888 The (sequential) number of the filtered frame, starting from 0.
20889
20890 @item selected_n
20891 The (sequential) number of the selected frame, starting from 0.
20892
20893 @item prev_selected_n
20894 The sequential number of the last selected frame. It's NAN if undefined.
20895
20896 @item TB
20897 The timebase of the input timestamps.
20898
20899 @item pts
20900 The PTS (Presentation TimeStamp) of the filtered video frame,
20901 expressed in @var{TB} units. It's NAN if undefined.
20902
20903 @item t
20904 The PTS of the filtered video frame,
20905 expressed in seconds. It's NAN if undefined.
20906
20907 @item prev_pts
20908 The PTS of the previously filtered video frame. It's NAN if undefined.
20909
20910 @item prev_selected_pts
20911 The PTS of the last previously filtered video frame. It's NAN if undefined.
20912
20913 @item prev_selected_t
20914 The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
20915
20916 @item start_pts
20917 The PTS of the first video frame in the video. It's NAN if undefined.
20918
20919 @item start_t
20920 The time of the first video frame in the video. It's NAN if undefined.
20921
20922 @item pict_type @emph{(video only)}
20923 The type of the filtered frame. It can assume one of the following
20924 values:
20925 @table @option
20926 @item I
20927 @item P
20928 @item B
20929 @item S
20930 @item SI
20931 @item SP
20932 @item BI
20933 @end table
20934
20935 @item interlace_type @emph{(video only)}
20936 The frame interlace type. It can assume one of the following values:
20937 @table @option
20938 @item PROGRESSIVE
20939 The frame is progressive (not interlaced).
20940 @item TOPFIRST
20941 The frame is top-field-first.
20942 @item BOTTOMFIRST
20943 The frame is bottom-field-first.
20944 @end table
20945
20946 @item consumed_sample_n @emph{(audio only)}
20947 the number of selected samples before the current frame
20948
20949 @item samples_n @emph{(audio only)}
20950 the number of samples in the current frame
20951
20952 @item sample_rate @emph{(audio only)}
20953 the input sample rate
20954
20955 @item key
20956 This is 1 if the filtered frame is a key-frame, 0 otherwise.
20957
20958 @item pos
20959 the position in the file of the filtered frame, -1 if the information
20960 is not available (e.g. for synthetic video)
20961
20962 @item scene @emph{(video only)}
20963 value between 0 and 1 to indicate a new scene; a low value reflects a low
20964 probability for the current frame to introduce a new scene, while a higher
20965 value means the current frame is more likely to be one (see the example below)
20966
20967 @item concatdec_select
20968 The concat demuxer can select only part of a concat input file by setting an
20969 inpoint and an outpoint, but the output packets may not be entirely contained
20970 in the selected interval. By using this variable, it is possible to skip frames
20971 generated by the concat demuxer which are not exactly contained in the selected
20972 interval.
20973
20974 This works by comparing the frame pts against the @var{lavf.concat.start_time}
20975 and the @var{lavf.concat.duration} packet metadata values which are also
20976 present in the decoded frames.
20977
20978 The @var{concatdec_select} variable is -1 if the frame pts is at least
20979 start_time and either the duration metadata is missing or the frame pts is less
20980 than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
20981 missing.
20982
20983 That basically means that an input frame is selected if its pts is within the
20984 interval set by the concat demuxer.
20985
20986 @end table
20987
20988 The default value of the select expression is "1".
20989
20990 @subsection Examples
20991
20992 @itemize
20993 @item
20994 Select all frames in input:
20995 @example
20996 select
20997 @end example
20998
20999 The example above is the same as:
21000 @example
21001 select=1
21002 @end example
21003
21004 @item
21005 Skip all frames:
21006 @example
21007 select=0
21008 @end example
21009
21010 @item
21011 Select only I-frames:
21012 @example
21013 select='eq(pict_type\,I)'
21014 @end example
21015
21016 @item
21017 Select one frame every 100:
21018 @example
21019 select='not(mod(n\,100))'
21020 @end example
21021
21022 @item
21023 Select only frames contained in the 10-20 time interval:
21024 @example
21025 select=between(t\,10\,20)
21026 @end example
21027
21028 @item
21029 Select only I-frames contained in the 10-20 time interval:
21030 @example
21031 select=between(t\,10\,20)*eq(pict_type\,I)
21032 @end example
21033
21034 @item
21035 Select frames with a minimum distance of 10 seconds:
21036 @example
21037 select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
21038 @end example
21039
21040 @item
21041 Use aselect to select only audio frames with samples number > 100:
21042 @example
21043 aselect='gt(samples_n\,100)'
21044 @end example
21045
21046 @item
21047 Create a mosaic of the first scenes:
21048 @example
21049 ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
21050 @end example
21051
21052 Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
21053 choice.
21054
21055 @item
21056 Send even and odd frames to separate outputs, and compose them:
21057 @example
21058 select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
21059 @end example
21060
21061 @item
21062 Select useful frames from an ffconcat file which is using inpoints and
21063 outpoints but where the source files are not intra frame only.
21064 @example
21065 ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
21066 @end example
21067 @end itemize
21068
21069 @section sendcmd, asendcmd
21070
21071 Send commands to filters in the filtergraph.
21072
21073 These filters read commands to be sent to other filters in the
21074 filtergraph.
21075
21076 @code{sendcmd} must be inserted between two video filters,
21077 @code{asendcmd} must be inserted between two audio filters, but apart
21078 from that they act the same way.
21079
21080 The specification of commands can be provided in the filter arguments
21081 with the @var{commands} option, or in a file specified by the
21082 @var{filename} option.
21083
21084 These filters accept the following options:
21085 @table @option
21086 @item commands, c
21087 Set the commands to be read and sent to the other filters.
21088 @item filename, f
21089 Set the filename of the commands to be read and sent to the other
21090 filters.
21091 @end table
21092
21093 @subsection Commands syntax
21094
21095 A commands description consists of a sequence of interval
21096 specifications, comprising a list of commands to be executed when a
21097 particular event related to that interval occurs. The occurring event
21098 is typically the current frame time entering or leaving a given time
21099 interval.
21100
21101 An interval is specified by the following syntax:
21102 @example
21103 @var{START}[-@var{END}] @var{COMMANDS};
21104 @end example
21105
21106 The time interval is specified by the @var{START} and @var{END} times.
21107 @var{END} is optional and defaults to the maximum time.
21108
21109 The current frame time is considered within the specified interval if
21110 it is included in the interval [@var{START}, @var{END}), that is when
21111 the time is greater or equal to @var{START} and is lesser than
21112 @var{END}.
21113
21114 @var{COMMANDS} consists of a sequence of one or more command
21115 specifications, separated by ",", relating to that interval.  The
21116 syntax of a command specification is given by:
21117 @example
21118 [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
21119 @end example
21120
21121 @var{FLAGS} is optional and specifies the type of events relating to
21122 the time interval which enable sending the specified command, and must
21123 be a non-null sequence of identifier flags separated by "+" or "|" and
21124 enclosed between "[" and "]".
21125
21126 The following flags are recognized:
21127 @table @option
21128 @item enter
21129 The command is sent when the current frame timestamp enters the
21130 specified interval. In other words, the command is sent when the
21131 previous frame timestamp was not in the given interval, and the
21132 current is.
21133
21134 @item leave
21135 The command is sent when the current frame timestamp leaves the
21136 specified interval. In other words, the command is sent when the
21137 previous frame timestamp was in the given interval, and the
21138 current is not.
21139 @end table
21140
21141 If @var{FLAGS} is not specified, a default value of @code{[enter]} is
21142 assumed.
21143
21144 @var{TARGET} specifies the target of the command, usually the name of
21145 the filter class or a specific filter instance name.
21146
21147 @var{COMMAND} specifies the name of the command for the target filter.
21148
21149 @var{ARG} is optional and specifies the optional list of argument for
21150 the given @var{COMMAND}.
21151
21152 Between one interval specification and another, whitespaces, or
21153 sequences of characters starting with @code{#} until the end of line,
21154 are ignored and can be used to annotate comments.
21155
21156 A simplified BNF description of the commands specification syntax
21157 follows:
21158 @example
21159 @var{COMMAND_FLAG}  ::= "enter" | "leave"
21160 @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
21161 @var{COMMAND}       ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
21162 @var{COMMANDS}      ::= @var{COMMAND} [,@var{COMMANDS}]
21163 @var{INTERVAL}      ::= @var{START}[-@var{END}] @var{COMMANDS}
21164 @var{INTERVALS}     ::= @var{INTERVAL}[;@var{INTERVALS}]
21165 @end example
21166
21167 @subsection Examples
21168
21169 @itemize
21170 @item
21171 Specify audio tempo change at second 4:
21172 @example
21173 asendcmd=c='4.0 atempo tempo 1.5',atempo
21174 @end example
21175
21176 @item
21177 Target a specific filter instance:
21178 @example
21179 asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
21180 @end example
21181
21182 @item
21183 Specify a list of drawtext and hue commands in a file.
21184 @example
21185 # show text in the interval 5-10
21186 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
21187          [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
21188
21189 # desaturate the image in the interval 15-20
21190 15.0-20.0 [enter] hue s 0,
21191           [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
21192           [leave] hue s 1,
21193           [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
21194
21195 # apply an exponential saturation fade-out effect, starting from time 25
21196 25 [enter] hue s exp(25-t)
21197 @end example
21198
21199 A filtergraph allowing to read and process the above command list
21200 stored in a file @file{test.cmd}, can be specified with:
21201 @example
21202 sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
21203 @end example
21204 @end itemize
21205
21206 @anchor{setpts}
21207 @section setpts, asetpts
21208
21209 Change the PTS (presentation timestamp) of the input frames.
21210
21211 @code{setpts} works on video frames, @code{asetpts} on audio frames.
21212
21213 This filter accepts the following options:
21214
21215 @table @option
21216
21217 @item expr
21218 The expression which is evaluated for each frame to construct its timestamp.
21219
21220 @end table
21221
21222 The expression is evaluated through the eval API and can contain the following
21223 constants:
21224
21225 @table @option
21226 @item FRAME_RATE, FR
21227 frame rate, only defined for constant frame-rate video
21228
21229 @item PTS
21230 The presentation timestamp in input
21231
21232 @item N
21233 The count of the input frame for video or the number of consumed samples,
21234 not including the current frame for audio, starting from 0.
21235
21236 @item NB_CONSUMED_SAMPLES
21237 The number of consumed samples, not including the current frame (only
21238 audio)
21239
21240 @item NB_SAMPLES, S
21241 The number of samples in the current frame (only audio)
21242
21243 @item SAMPLE_RATE, SR
21244 The audio sample rate.
21245
21246 @item STARTPTS
21247 The PTS of the first frame.
21248
21249 @item STARTT
21250 the time in seconds of the first frame
21251
21252 @item INTERLACED
21253 State whether the current frame is interlaced.
21254
21255 @item T
21256 the time in seconds of the current frame
21257
21258 @item POS
21259 original position in the file of the frame, or undefined if undefined
21260 for the current frame
21261
21262 @item PREV_INPTS
21263 The previous input PTS.
21264
21265 @item PREV_INT
21266 previous input time in seconds
21267
21268 @item PREV_OUTPTS
21269 The previous output PTS.
21270
21271 @item PREV_OUTT
21272 previous output time in seconds
21273
21274 @item RTCTIME
21275 The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
21276 instead.
21277
21278 @item RTCSTART
21279 The wallclock (RTC) time at the start of the movie in microseconds.
21280
21281 @item TB
21282 The timebase of the input timestamps.
21283
21284 @end table
21285
21286 @subsection Examples
21287
21288 @itemize
21289 @item
21290 Start counting PTS from zero
21291 @example
21292 setpts=PTS-STARTPTS
21293 @end example
21294
21295 @item
21296 Apply fast motion effect:
21297 @example
21298 setpts=0.5*PTS
21299 @end example
21300
21301 @item
21302 Apply slow motion effect:
21303 @example
21304 setpts=2.0*PTS
21305 @end example
21306
21307 @item
21308 Set fixed rate of 25 frames per second:
21309 @example
21310 setpts=N/(25*TB)
21311 @end example
21312
21313 @item
21314 Set fixed rate 25 fps with some jitter:
21315 @example
21316 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
21317 @end example
21318
21319 @item
21320 Apply an offset of 10 seconds to the input PTS:
21321 @example
21322 setpts=PTS+10/TB
21323 @end example
21324
21325 @item
21326 Generate timestamps from a "live source" and rebase onto the current timebase:
21327 @example
21328 setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
21329 @end example
21330
21331 @item
21332 Generate timestamps by counting samples:
21333 @example
21334 asetpts=N/SR/TB
21335 @end example
21336
21337 @end itemize
21338
21339 @section setrange
21340
21341 Force color range for the output video frame.
21342
21343 The @code{setrange} filter marks the color range property for the
21344 output frames. It does not change the input frame, but only sets the
21345 corresponding property, which affects how the frame is treated by
21346 following filters.
21347
21348 The filter accepts the following options:
21349
21350 @table @option
21351
21352 @item range
21353 Available values are:
21354
21355 @table @samp
21356 @item auto
21357 Keep the same color range property.
21358
21359 @item unspecified, unknown
21360 Set the color range as unspecified.
21361
21362 @item limited, tv, mpeg
21363 Set the color range as limited.
21364
21365 @item full, pc, jpeg
21366 Set the color range as full.
21367 @end table
21368 @end table
21369
21370 @section settb, asettb
21371
21372 Set the timebase to use for the output frames timestamps.
21373 It is mainly useful for testing timebase configuration.
21374
21375 It accepts the following parameters:
21376
21377 @table @option
21378
21379 @item expr, tb
21380 The expression which is evaluated into the output timebase.
21381
21382 @end table
21383
21384 The value for @option{tb} is an arithmetic expression representing a
21385 rational. The expression can contain the constants "AVTB" (the default
21386 timebase), "intb" (the input timebase) and "sr" (the sample rate,
21387 audio only). Default value is "intb".
21388
21389 @subsection Examples
21390
21391 @itemize
21392 @item
21393 Set the timebase to 1/25:
21394 @example
21395 settb=expr=1/25
21396 @end example
21397
21398 @item
21399 Set the timebase to 1/10:
21400 @example
21401 settb=expr=0.1
21402 @end example
21403
21404 @item
21405 Set the timebase to 1001/1000:
21406 @example
21407 settb=1+0.001
21408 @end example
21409
21410 @item
21411 Set the timebase to 2*intb:
21412 @example
21413 settb=2*intb
21414 @end example
21415
21416 @item
21417 Set the default timebase value:
21418 @example
21419 settb=AVTB
21420 @end example
21421 @end itemize
21422
21423 @section showcqt
21424 Convert input audio to a video output representing frequency spectrum
21425 logarithmically using Brown-Puckette constant Q transform algorithm with
21426 direct frequency domain coefficient calculation (but the transform itself
21427 is not really constant Q, instead the Q factor is actually variable/clamped),
21428 with musical tone scale, from E0 to D#10.
21429
21430 The filter accepts the following options:
21431
21432 @table @option
21433 @item size, s
21434 Specify the video size for the output. It must be even. For the syntax of this option,
21435 check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
21436 Default value is @code{1920x1080}.
21437
21438 @item fps, rate, r
21439 Set the output frame rate. Default value is @code{25}.
21440
21441 @item bar_h
21442 Set the bargraph height. It must be even. Default value is @code{-1} which
21443 computes the bargraph height automatically.
21444
21445 @item axis_h
21446 Set the axis height. It must be even. Default value is @code{-1} which computes
21447 the axis height automatically.
21448
21449 @item sono_h
21450 Set the sonogram height. It must be even. Default value is @code{-1} which
21451 computes the sonogram height automatically.
21452
21453 @item fullhd
21454 Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
21455 instead. Default value is @code{1}.
21456
21457 @item sono_v, volume
21458 Specify the sonogram volume expression. It can contain variables:
21459 @table @option
21460 @item bar_v
21461 the @var{bar_v} evaluated expression
21462 @item frequency, freq, f
21463 the frequency where it is evaluated
21464 @item timeclamp, tc
21465 the value of @var{timeclamp} option
21466 @end table
21467 and functions:
21468 @table @option
21469 @item a_weighting(f)
21470 A-weighting of equal loudness
21471 @item b_weighting(f)
21472 B-weighting of equal loudness
21473 @item c_weighting(f)
21474 C-weighting of equal loudness.
21475 @end table
21476 Default value is @code{16}.
21477
21478 @item bar_v, volume2
21479 Specify the bargraph volume expression. It can contain variables:
21480 @table @option
21481 @item sono_v
21482 the @var{sono_v} evaluated expression
21483 @item frequency, freq, f
21484 the frequency where it is evaluated
21485 @item timeclamp, tc
21486 the value of @var{timeclamp} option
21487 @end table
21488 and functions:
21489 @table @option
21490 @item a_weighting(f)
21491 A-weighting of equal loudness
21492 @item b_weighting(f)
21493 B-weighting of equal loudness
21494 @item c_weighting(f)
21495 C-weighting of equal loudness.
21496 @end table
21497 Default value is @code{sono_v}.
21498
21499 @item sono_g, gamma
21500 Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
21501 higher gamma makes the spectrum having more range. Default value is @code{3}.
21502 Acceptable range is @code{[1, 7]}.
21503
21504 @item bar_g, gamma2
21505 Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
21506 @code{[1, 7]}.
21507
21508 @item bar_t
21509 Specify the bargraph transparency level. Lower value makes the bargraph sharper.
21510 Default value is @code{1}. Acceptable range is @code{[0, 1]}.
21511
21512 @item timeclamp, tc
21513 Specify the transform timeclamp. At low frequency, there is trade-off between
21514 accuracy in time domain and frequency domain. If timeclamp is lower,
21515 event in time domain is represented more accurately (such as fast bass drum),
21516 otherwise event in frequency domain is represented more accurately
21517 (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
21518
21519 @item attack
21520 Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
21521 limits future samples by applying asymmetric windowing in time domain, useful
21522 when low latency is required. Accepted range is @code{[0, 1]}.
21523
21524 @item basefreq
21525 Specify the transform base frequency. Default value is @code{20.01523126408007475},
21526 which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
21527
21528 @item endfreq
21529 Specify the transform end frequency. Default value is @code{20495.59681441799654},
21530 which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
21531
21532 @item coeffclamp
21533 This option is deprecated and ignored.
21534
21535 @item tlength
21536 Specify the transform length in time domain. Use this option to control accuracy
21537 trade-off between time domain and frequency domain at every frequency sample.
21538 It can contain variables:
21539 @table @option
21540 @item frequency, freq, f
21541 the frequency where it is evaluated
21542 @item timeclamp, tc
21543 the value of @var{timeclamp} option.
21544 @end table
21545 Default value is @code{384*tc/(384+tc*f)}.
21546
21547 @item count
21548 Specify the transform count for every video frame. Default value is @code{6}.
21549 Acceptable range is @code{[1, 30]}.
21550
21551 @item fcount
21552 Specify the transform count for every single pixel. Default value is @code{0},
21553 which makes it computed automatically. Acceptable range is @code{[0, 10]}.
21554
21555 @item fontfile
21556 Specify font file for use with freetype to draw the axis. If not specified,
21557 use embedded font. Note that drawing with font file or embedded font is not
21558 implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
21559 option instead.
21560
21561 @item font
21562 Specify fontconfig pattern. This has lower priority than @var{fontfile}.
21563 The : in the pattern may be replaced by | to avoid unnecessary escaping.
21564
21565 @item fontcolor
21566 Specify font color expression. This is arithmetic expression that should return
21567 integer value 0xRRGGBB. It can contain variables:
21568 @table @option
21569 @item frequency, freq, f
21570 the frequency where it is evaluated
21571 @item timeclamp, tc
21572 the value of @var{timeclamp} option
21573 @end table
21574 and functions:
21575 @table @option
21576 @item midi(f)
21577 midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
21578 @item r(x), g(x), b(x)
21579 red, green, and blue value of intensity x.
21580 @end table
21581 Default value is @code{st(0, (midi(f)-59.5)/12);
21582 st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
21583 r(1-ld(1)) + b(ld(1))}.
21584
21585 @item axisfile
21586 Specify image file to draw the axis. This option override @var{fontfile} and
21587 @var{fontcolor} option.
21588
21589 @item axis, text
21590 Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
21591 the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
21592 Default value is @code{1}.
21593
21594 @item csp
21595 Set colorspace. The accepted values are:
21596 @table @samp
21597 @item unspecified
21598 Unspecified (default)
21599
21600 @item bt709
21601 BT.709
21602
21603 @item fcc
21604 FCC
21605
21606 @item bt470bg
21607 BT.470BG or BT.601-6 625
21608
21609 @item smpte170m
21610 SMPTE-170M or BT.601-6 525
21611
21612 @item smpte240m
21613 SMPTE-240M
21614
21615 @item bt2020ncl
21616 BT.2020 with non-constant luminance
21617
21618 @end table
21619
21620 @item cscheme
21621 Set spectrogram color scheme. This is list of floating point values with format
21622 @code{left_r|left_g|left_b|right_r|right_g|right_b}.
21623 The default is @code{1|0.5|0|0|0.5|1}.
21624
21625 @end table
21626
21627 @subsection Examples
21628
21629 @itemize
21630 @item
21631 Playing audio while showing the spectrum:
21632 @example
21633 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
21634 @end example
21635
21636 @item
21637 Same as above, but with frame rate 30 fps:
21638 @example
21639 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
21640 @end example
21641
21642 @item
21643 Playing at 1280x720:
21644 @example
21645 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
21646 @end example
21647
21648 @item
21649 Disable sonogram display:
21650 @example
21651 sono_h=0
21652 @end example
21653
21654 @item
21655 A1 and its harmonics: A1, A2, (near)E3, A3:
21656 @example
21657 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),
21658                  asplit[a][out1]; [a] showcqt [out0]'
21659 @end example
21660
21661 @item
21662 Same as above, but with more accuracy in frequency domain:
21663 @example
21664 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),
21665                  asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
21666 @end example
21667
21668 @item
21669 Custom volume:
21670 @example
21671 bar_v=10:sono_v=bar_v*a_weighting(f)
21672 @end example
21673
21674 @item
21675 Custom gamma, now spectrum is linear to the amplitude.
21676 @example
21677 bar_g=2:sono_g=2
21678 @end example
21679
21680 @item
21681 Custom tlength equation:
21682 @example
21683 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)))'
21684 @end example
21685
21686 @item
21687 Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
21688 @example
21689 fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
21690 @end example
21691
21692 @item
21693 Custom font using fontconfig:
21694 @example
21695 font='Courier New,Monospace,mono|bold'
21696 @end example
21697
21698 @item
21699 Custom frequency range with custom axis using image file:
21700 @example
21701 axisfile=myaxis.png:basefreq=40:endfreq=10000
21702 @end example
21703 @end itemize
21704
21705 @section showfreqs
21706
21707 Convert input audio to video output representing the audio power spectrum.
21708 Audio amplitude is on Y-axis while frequency is on X-axis.
21709
21710 The filter accepts the following options:
21711
21712 @table @option
21713 @item size, s
21714 Specify size of video. For the syntax of this option, check the
21715 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
21716 Default is @code{1024x512}.
21717
21718 @item mode
21719 Set display mode.
21720 This set how each frequency bin will be represented.
21721
21722 It accepts the following values:
21723 @table @samp
21724 @item line
21725 @item bar
21726 @item dot
21727 @end table
21728 Default is @code{bar}.
21729
21730 @item ascale
21731 Set amplitude scale.
21732
21733 It accepts the following values:
21734 @table @samp
21735 @item lin
21736 Linear scale.
21737
21738 @item sqrt
21739 Square root scale.
21740
21741 @item cbrt
21742 Cubic root scale.
21743
21744 @item log
21745 Logarithmic scale.
21746 @end table
21747 Default is @code{log}.
21748
21749 @item fscale
21750 Set frequency scale.
21751
21752 It accepts the following values:
21753 @table @samp
21754 @item lin
21755 Linear scale.
21756
21757 @item log
21758 Logarithmic scale.
21759
21760 @item rlog
21761 Reverse logarithmic scale.
21762 @end table
21763 Default is @code{lin}.
21764
21765 @item win_size
21766 Set window size.
21767
21768 It accepts the following values:
21769 @table @samp
21770 @item w16
21771 @item w32
21772 @item w64
21773 @item w128
21774 @item w256
21775 @item w512
21776 @item w1024
21777 @item w2048
21778 @item w4096
21779 @item w8192
21780 @item w16384
21781 @item w32768
21782 @item w65536
21783 @end table
21784 Default is @code{w2048}
21785
21786 @item win_func
21787 Set windowing function.
21788
21789 It accepts the following values:
21790 @table @samp
21791 @item rect
21792 @item bartlett
21793 @item hanning
21794 @item hamming
21795 @item blackman
21796 @item welch
21797 @item flattop
21798 @item bharris
21799 @item bnuttall
21800 @item bhann
21801 @item sine
21802 @item nuttall
21803 @item lanczos
21804 @item gauss
21805 @item tukey
21806 @item dolph
21807 @item cauchy
21808 @item parzen
21809 @item poisson
21810 @item bohman
21811 @end table
21812 Default is @code{hanning}.
21813
21814 @item overlap
21815 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
21816 which means optimal overlap for selected window function will be picked.
21817
21818 @item averaging
21819 Set time averaging. Setting this to 0 will display current maximal peaks.
21820 Default is @code{1}, which means time averaging is disabled.
21821
21822 @item colors
21823 Specify list of colors separated by space or by '|' which will be used to
21824 draw channel frequencies. Unrecognized or missing colors will be replaced
21825 by white color.
21826
21827 @item cmode
21828 Set channel display mode.
21829
21830 It accepts the following values:
21831 @table @samp
21832 @item combined
21833 @item separate
21834 @end table
21835 Default is @code{combined}.
21836
21837 @item minamp
21838 Set minimum amplitude used in @code{log} amplitude scaler.
21839
21840 @end table
21841
21842 @anchor{showspectrum}
21843 @section showspectrum
21844
21845 Convert input audio to a video output, representing the audio frequency
21846 spectrum.
21847
21848 The filter accepts the following options:
21849
21850 @table @option
21851 @item size, s
21852 Specify the video size for the output. For the syntax of this option, check the
21853 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
21854 Default value is @code{640x512}.
21855
21856 @item slide
21857 Specify how the spectrum should slide along the window.
21858
21859 It accepts the following values:
21860 @table @samp
21861 @item replace
21862 the samples start again on the left when they reach the right
21863 @item scroll
21864 the samples scroll from right to left
21865 @item fullframe
21866 frames are only produced when the samples reach the right
21867 @item rscroll
21868 the samples scroll from left to right
21869 @end table
21870
21871 Default value is @code{replace}.
21872
21873 @item mode
21874 Specify display mode.
21875
21876 It accepts the following values:
21877 @table @samp
21878 @item combined
21879 all channels are displayed in the same row
21880 @item separate
21881 all channels are displayed in separate rows
21882 @end table
21883
21884 Default value is @samp{combined}.
21885
21886 @item color
21887 Specify display color mode.
21888
21889 It accepts the following values:
21890 @table @samp
21891 @item channel
21892 each channel is displayed in a separate color
21893 @item intensity
21894 each channel is displayed using the same color scheme
21895 @item rainbow
21896 each channel is displayed using the rainbow color scheme
21897 @item moreland
21898 each channel is displayed using the moreland color scheme
21899 @item nebulae
21900 each channel is displayed using the nebulae color scheme
21901 @item fire
21902 each channel is displayed using the fire color scheme
21903 @item fiery
21904 each channel is displayed using the fiery color scheme
21905 @item fruit
21906 each channel is displayed using the fruit color scheme
21907 @item cool
21908 each channel is displayed using the cool color scheme
21909 @item magma
21910 each channel is displayed using the magma color scheme
21911 @item green
21912 each channel is displayed using the green color scheme
21913 @item viridis
21914 each channel is displayed using the viridis color scheme
21915 @item plasma
21916 each channel is displayed using the plasma color scheme
21917 @item cividis
21918 each channel is displayed using the cividis color scheme
21919 @item terrain
21920 each channel is displayed using the terrain color scheme
21921 @end table
21922
21923 Default value is @samp{channel}.
21924
21925 @item scale
21926 Specify scale used for calculating intensity color values.
21927
21928 It accepts the following values:
21929 @table @samp
21930 @item lin
21931 linear
21932 @item sqrt
21933 square root, default
21934 @item cbrt
21935 cubic root
21936 @item log
21937 logarithmic
21938 @item 4thrt
21939 4th root
21940 @item 5thrt
21941 5th root
21942 @end table
21943
21944 Default value is @samp{sqrt}.
21945
21946 @item saturation
21947 Set saturation modifier for displayed colors. Negative values provide
21948 alternative color scheme. @code{0} is no saturation at all.
21949 Saturation must be in [-10.0, 10.0] range.
21950 Default value is @code{1}.
21951
21952 @item win_func
21953 Set window function.
21954
21955 It accepts the following values:
21956 @table @samp
21957 @item rect
21958 @item bartlett
21959 @item hann
21960 @item hanning
21961 @item hamming
21962 @item blackman
21963 @item welch
21964 @item flattop
21965 @item bharris
21966 @item bnuttall
21967 @item bhann
21968 @item sine
21969 @item nuttall
21970 @item lanczos
21971 @item gauss
21972 @item tukey
21973 @item dolph
21974 @item cauchy
21975 @item parzen
21976 @item poisson
21977 @item bohman
21978 @end table
21979
21980 Default value is @code{hann}.
21981
21982 @item orientation
21983 Set orientation of time vs frequency axis. Can be @code{vertical} or
21984 @code{horizontal}. Default is @code{vertical}.
21985
21986 @item overlap
21987 Set ratio of overlap window. Default value is @code{0}.
21988 When value is @code{1} overlap is set to recommended size for specific
21989 window function currently used.
21990
21991 @item gain
21992 Set scale gain for calculating intensity color values.
21993 Default value is @code{1}.
21994
21995 @item data
21996 Set which data to display. Can be @code{magnitude}, default or @code{phase}.
21997
21998 @item rotation
21999 Set color rotation, must be in [-1.0, 1.0] range.
22000 Default value is @code{0}.
22001
22002 @item start
22003 Set start frequency from which to display spectrogram. Default is @code{0}.
22004
22005 @item stop
22006 Set stop frequency to which to display spectrogram. Default is @code{0}.
22007
22008 @item fps
22009 Set upper frame rate limit. Default is @code{auto}, unlimited.
22010
22011 @item legend
22012 Draw time and frequency axes and legends. Default is disabled.
22013 @end table
22014
22015 The usage is very similar to the showwaves filter; see the examples in that
22016 section.
22017
22018 @subsection Examples
22019
22020 @itemize
22021 @item
22022 Large window with logarithmic color scaling:
22023 @example
22024 showspectrum=s=1280x480:scale=log
22025 @end example
22026
22027 @item
22028 Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
22029 @example
22030 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
22031              [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
22032 @end example
22033 @end itemize
22034
22035 @section showspectrumpic
22036
22037 Convert input audio to a single video frame, representing the audio frequency
22038 spectrum.
22039
22040 The filter accepts the following options:
22041
22042 @table @option
22043 @item size, s
22044 Specify the video size for the output. For the syntax of this option, check the
22045 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
22046 Default value is @code{4096x2048}.
22047
22048 @item mode
22049 Specify display mode.
22050
22051 It accepts the following values:
22052 @table @samp
22053 @item combined
22054 all channels are displayed in the same row
22055 @item separate
22056 all channels are displayed in separate rows
22057 @end table
22058 Default value is @samp{combined}.
22059
22060 @item color
22061 Specify display color mode.
22062
22063 It accepts the following values:
22064 @table @samp
22065 @item channel
22066 each channel is displayed in a separate color
22067 @item intensity
22068 each channel is displayed using the same color scheme
22069 @item rainbow
22070 each channel is displayed using the rainbow color scheme
22071 @item moreland
22072 each channel is displayed using the moreland color scheme
22073 @item nebulae
22074 each channel is displayed using the nebulae color scheme
22075 @item fire
22076 each channel is displayed using the fire color scheme
22077 @item fiery
22078 each channel is displayed using the fiery color scheme
22079 @item fruit
22080 each channel is displayed using the fruit color scheme
22081 @item cool
22082 each channel is displayed using the cool color scheme
22083 @item magma
22084 each channel is displayed using the magma color scheme
22085 @item green
22086 each channel is displayed using the green color scheme
22087 @item viridis
22088 each channel is displayed using the viridis color scheme
22089 @item plasma
22090 each channel is displayed using the plasma color scheme
22091 @item cividis
22092 each channel is displayed using the cividis color scheme
22093 @item terrain
22094 each channel is displayed using the terrain color scheme
22095 @end table
22096 Default value is @samp{intensity}.
22097
22098 @item scale
22099 Specify scale used for calculating intensity color values.
22100
22101 It accepts the following values:
22102 @table @samp
22103 @item lin
22104 linear
22105 @item sqrt
22106 square root, default
22107 @item cbrt
22108 cubic root
22109 @item log
22110 logarithmic
22111 @item 4thrt
22112 4th root
22113 @item 5thrt
22114 5th root
22115 @end table
22116 Default value is @samp{log}.
22117
22118 @item saturation
22119 Set saturation modifier for displayed colors. Negative values provide
22120 alternative color scheme. @code{0} is no saturation at all.
22121 Saturation must be in [-10.0, 10.0] range.
22122 Default value is @code{1}.
22123
22124 @item win_func
22125 Set window function.
22126
22127 It accepts the following values:
22128 @table @samp
22129 @item rect
22130 @item bartlett
22131 @item hann
22132 @item hanning
22133 @item hamming
22134 @item blackman
22135 @item welch
22136 @item flattop
22137 @item bharris
22138 @item bnuttall
22139 @item bhann
22140 @item sine
22141 @item nuttall
22142 @item lanczos
22143 @item gauss
22144 @item tukey
22145 @item dolph
22146 @item cauchy
22147 @item parzen
22148 @item poisson
22149 @item bohman
22150 @end table
22151 Default value is @code{hann}.
22152
22153 @item orientation
22154 Set orientation of time vs frequency axis. Can be @code{vertical} or
22155 @code{horizontal}. Default is @code{vertical}.
22156
22157 @item gain
22158 Set scale gain for calculating intensity color values.
22159 Default value is @code{1}.
22160
22161 @item legend
22162 Draw time and frequency axes and legends. Default is enabled.
22163
22164 @item rotation
22165 Set color rotation, must be in [-1.0, 1.0] range.
22166 Default value is @code{0}.
22167
22168 @item start
22169 Set start frequency from which to display spectrogram. Default is @code{0}.
22170
22171 @item stop
22172 Set stop frequency to which to display spectrogram. Default is @code{0}.
22173 @end table
22174
22175 @subsection Examples
22176
22177 @itemize
22178 @item
22179 Extract an audio spectrogram of a whole audio track
22180 in a 1024x1024 picture using @command{ffmpeg}:
22181 @example
22182 ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
22183 @end example
22184 @end itemize
22185
22186 @section showvolume
22187
22188 Convert input audio volume to a video output.
22189
22190 The filter accepts the following options:
22191
22192 @table @option
22193 @item rate, r
22194 Set video rate.
22195
22196 @item b
22197 Set border width, allowed range is [0, 5]. Default is 1.
22198
22199 @item w
22200 Set channel width, allowed range is [80, 8192]. Default is 400.
22201
22202 @item h
22203 Set channel height, allowed range is [1, 900]. Default is 20.
22204
22205 @item f
22206 Set fade, allowed range is [0, 1]. Default is 0.95.
22207
22208 @item c
22209 Set volume color expression.
22210
22211 The expression can use the following variables:
22212
22213 @table @option
22214 @item VOLUME
22215 Current max volume of channel in dB.
22216
22217 @item PEAK
22218 Current peak.
22219
22220 @item CHANNEL
22221 Current channel number, starting from 0.
22222 @end table
22223
22224 @item t
22225 If set, displays channel names. Default is enabled.
22226
22227 @item v
22228 If set, displays volume values. Default is enabled.
22229
22230 @item o
22231 Set orientation, can be horizontal: @code{h} or vertical: @code{v},
22232 default is @code{h}.
22233
22234 @item s
22235 Set step size, allowed range is [0, 5]. Default is 0, which means
22236 step is disabled.
22237
22238 @item p
22239 Set background opacity, allowed range is [0, 1]. Default is 0.
22240
22241 @item m
22242 Set metering mode, can be peak: @code{p} or rms: @code{r},
22243 default is @code{p}.
22244
22245 @item ds
22246 Set display scale, can be linear: @code{lin} or log: @code{log},
22247 default is @code{lin}.
22248
22249 @item dm
22250 In second.
22251 If set to > 0., display a line for the max level
22252 in the previous seconds.
22253 default is disabled: @code{0.}
22254
22255 @item dmc
22256 The color of the max line. Use when @code{dm} option is set to > 0.
22257 default is: @code{orange}
22258 @end table
22259
22260 @section showwaves
22261
22262 Convert input audio to a video output, representing the samples waves.
22263
22264 The filter accepts the following options:
22265
22266 @table @option
22267 @item size, s
22268 Specify the video size for the output. For the syntax of this option, check the
22269 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
22270 Default value is @code{600x240}.
22271
22272 @item mode
22273 Set display mode.
22274
22275 Available values are:
22276 @table @samp
22277 @item point
22278 Draw a point for each sample.
22279
22280 @item line
22281 Draw a vertical line for each sample.
22282
22283 @item p2p
22284 Draw a point for each sample and a line between them.
22285
22286 @item cline
22287 Draw a centered vertical line for each sample.
22288 @end table
22289
22290 Default value is @code{point}.
22291
22292 @item n
22293 Set the number of samples which are printed on the same column. A
22294 larger value will decrease the frame rate. Must be a positive
22295 integer. This option can be set only if the value for @var{rate}
22296 is not explicitly specified.
22297
22298 @item rate, r
22299 Set the (approximate) output frame rate. This is done by setting the
22300 option @var{n}. Default value is "25".
22301
22302 @item split_channels
22303 Set if channels should be drawn separately or overlap. Default value is 0.
22304
22305 @item colors
22306 Set colors separated by '|' which are going to be used for drawing of each channel.
22307
22308 @item scale
22309 Set amplitude scale.
22310
22311 Available values are:
22312 @table @samp
22313 @item lin
22314 Linear.
22315
22316 @item log
22317 Logarithmic.
22318
22319 @item sqrt
22320 Square root.
22321
22322 @item cbrt
22323 Cubic root.
22324 @end table
22325
22326 Default is linear.
22327
22328 @item draw
22329 Set the draw mode. This is mostly useful to set for high @var{n}.
22330
22331 Available values are:
22332 @table @samp
22333 @item scale
22334 Scale pixel values for each drawn sample.
22335
22336 @item full
22337 Draw every sample directly.
22338 @end table
22339
22340 Default value is @code{scale}.
22341 @end table
22342
22343 @subsection Examples
22344
22345 @itemize
22346 @item
22347 Output the input file audio and the corresponding video representation
22348 at the same time:
22349 @example
22350 amovie=a.mp3,asplit[out0],showwaves[out1]
22351 @end example
22352
22353 @item
22354 Create a synthetic signal and show it with showwaves, forcing a
22355 frame rate of 30 frames per second:
22356 @example
22357 aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
22358 @end example
22359 @end itemize
22360
22361 @section showwavespic
22362
22363 Convert input audio to a single video frame, representing the samples waves.
22364
22365 The filter accepts the following options:
22366
22367 @table @option
22368 @item size, s
22369 Specify the video size for the output. For the syntax of this option, check the
22370 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
22371 Default value is @code{600x240}.
22372
22373 @item split_channels
22374 Set if channels should be drawn separately or overlap. Default value is 0.
22375
22376 @item colors
22377 Set colors separated by '|' which are going to be used for drawing of each channel.
22378
22379 @item scale
22380 Set amplitude scale.
22381
22382 Available values are:
22383 @table @samp
22384 @item lin
22385 Linear.
22386
22387 @item log
22388 Logarithmic.
22389
22390 @item sqrt
22391 Square root.
22392
22393 @item cbrt
22394 Cubic root.
22395 @end table
22396
22397 Default is linear.
22398 @end table
22399
22400 @subsection Examples
22401
22402 @itemize
22403 @item
22404 Extract a channel split representation of the wave form of a whole audio track
22405 in a 1024x800 picture using @command{ffmpeg}:
22406 @example
22407 ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
22408 @end example
22409 @end itemize
22410
22411 @section sidedata, asidedata
22412
22413 Delete frame side data, or select frames based on it.
22414
22415 This filter accepts the following options:
22416
22417 @table @option
22418 @item mode
22419 Set mode of operation of the filter.
22420
22421 Can be one of the following:
22422
22423 @table @samp
22424 @item select
22425 Select every frame with side data of @code{type}.
22426
22427 @item delete
22428 Delete side data of @code{type}. If @code{type} is not set, delete all side
22429 data in the frame.
22430
22431 @end table
22432
22433 @item type
22434 Set side data type used with all modes. Must be set for @code{select} mode. For
22435 the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
22436 in @file{libavutil/frame.h}. For example, to choose
22437 @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
22438
22439 @end table
22440
22441 @section spectrumsynth
22442
22443 Sythesize audio from 2 input video spectrums, first input stream represents
22444 magnitude across time and second represents phase across time.
22445 The filter will transform from frequency domain as displayed in videos back
22446 to time domain as presented in audio output.
22447
22448 This filter is primarily created for reversing processed @ref{showspectrum}
22449 filter outputs, but can synthesize sound from other spectrograms too.
22450 But in such case results are going to be poor if the phase data is not
22451 available, because in such cases phase data need to be recreated, usually
22452 its just recreated from random noise.
22453 For best results use gray only output (@code{channel} color mode in
22454 @ref{showspectrum} filter) and @code{log} scale for magnitude video and
22455 @code{lin} scale for phase video. To produce phase, for 2nd video, use
22456 @code{data} option. Inputs videos should generally use @code{fullframe}
22457 slide mode as that saves resources needed for decoding video.
22458
22459 The filter accepts the following options:
22460
22461 @table @option
22462 @item sample_rate
22463 Specify sample rate of output audio, the sample rate of audio from which
22464 spectrum was generated may differ.
22465
22466 @item channels
22467 Set number of channels represented in input video spectrums.
22468
22469 @item scale
22470 Set scale which was used when generating magnitude input spectrum.
22471 Can be @code{lin} or @code{log}. Default is @code{log}.
22472
22473 @item slide
22474 Set slide which was used when generating inputs spectrums.
22475 Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
22476 Default is @code{fullframe}.
22477
22478 @item win_func
22479 Set window function used for resynthesis.
22480
22481 @item overlap
22482 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
22483 which means optimal overlap for selected window function will be picked.
22484
22485 @item orientation
22486 Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
22487 Default is @code{vertical}.
22488 @end table
22489
22490 @subsection Examples
22491
22492 @itemize
22493 @item
22494 First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
22495 then resynthesize videos back to audio with spectrumsynth:
22496 @example
22497 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
22498 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
22499 ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
22500 @end example
22501 @end itemize
22502
22503 @section split, asplit
22504
22505 Split input into several identical outputs.
22506
22507 @code{asplit} works with audio input, @code{split} with video.
22508
22509 The filter accepts a single parameter which specifies the number of outputs. If
22510 unspecified, it defaults to 2.
22511
22512 @subsection Examples
22513
22514 @itemize
22515 @item
22516 Create two separate outputs from the same input:
22517 @example
22518 [in] split [out0][out1]
22519 @end example
22520
22521 @item
22522 To create 3 or more outputs, you need to specify the number of
22523 outputs, like in:
22524 @example
22525 [in] asplit=3 [out0][out1][out2]
22526 @end example
22527
22528 @item
22529 Create two separate outputs from the same input, one cropped and
22530 one padded:
22531 @example
22532 [in] split [splitout1][splitout2];
22533 [splitout1] crop=100:100:0:0    [cropout];
22534 [splitout2] pad=200:200:100:100 [padout];
22535 @end example
22536
22537 @item
22538 Create 5 copies of the input audio with @command{ffmpeg}:
22539 @example
22540 ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
22541 @end example
22542 @end itemize
22543
22544 @section zmq, azmq
22545
22546 Receive commands sent through a libzmq client, and forward them to
22547 filters in the filtergraph.
22548
22549 @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
22550 must be inserted between two video filters, @code{azmq} between two
22551 audio filters. Both are capable to send messages to any filter type.
22552
22553 To enable these filters you need to install the libzmq library and
22554 headers and configure FFmpeg with @code{--enable-libzmq}.
22555
22556 For more information about libzmq see:
22557 @url{http://www.zeromq.org/}
22558
22559 The @code{zmq} and @code{azmq} filters work as a libzmq server, which
22560 receives messages sent through a network interface defined by the
22561 @option{bind_address} (or the abbreviation "@option{b}") option.
22562 Default value of this option is @file{tcp://localhost:5555}. You may
22563 want to alter this value to your needs, but do not forget to escape any
22564 ':' signs (see @ref{filtergraph escaping}).
22565
22566 The received message must be in the form:
22567 @example
22568 @var{TARGET} @var{COMMAND} [@var{ARG}]
22569 @end example
22570
22571 @var{TARGET} specifies the target of the command, usually the name of
22572 the filter class or a specific filter instance name. The default
22573 filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
22574 but you can override this by using the @samp{filter_name@@id} syntax
22575 (see @ref{Filtergraph syntax}).
22576
22577 @var{COMMAND} specifies the name of the command for the target filter.
22578
22579 @var{ARG} is optional and specifies the optional argument list for the
22580 given @var{COMMAND}.
22581
22582 Upon reception, the message is processed and the corresponding command
22583 is injected into the filtergraph. Depending on the result, the filter
22584 will send a reply to the client, adopting the format:
22585 @example
22586 @var{ERROR_CODE} @var{ERROR_REASON}
22587 @var{MESSAGE}
22588 @end example
22589
22590 @var{MESSAGE} is optional.
22591
22592 @subsection Examples
22593
22594 Look at @file{tools/zmqsend} for an example of a zmq client which can
22595 be used to send commands processed by these filters.
22596
22597 Consider the following filtergraph generated by @command{ffplay}.
22598 In this example the last overlay filter has an instance name. All other
22599 filters will have default instance names.
22600
22601 @example
22602 ffplay -dumpgraph 1 -f lavfi "
22603 color=s=100x100:c=red  [l];
22604 color=s=100x100:c=blue [r];
22605 nullsrc=s=200x100, zmq [bg];
22606 [bg][l]   overlay     [bg+l];
22607 [bg+l][r] overlay@@my=x=100 "
22608 @end example
22609
22610 To change the color of the left side of the video, the following
22611 command can be used:
22612 @example
22613 echo Parsed_color_0 c yellow | tools/zmqsend
22614 @end example
22615
22616 To change the right side:
22617 @example
22618 echo Parsed_color_1 c pink | tools/zmqsend
22619 @end example
22620
22621 To change the position of the right side:
22622 @example
22623 echo overlay@@my x 150 | tools/zmqsend
22624 @end example
22625
22626
22627 @c man end MULTIMEDIA FILTERS
22628
22629 @chapter Multimedia Sources
22630 @c man begin MULTIMEDIA SOURCES
22631
22632 Below is a description of the currently available multimedia sources.
22633
22634 @section amovie
22635
22636 This is the same as @ref{movie} source, except it selects an audio
22637 stream by default.
22638
22639 @anchor{movie}
22640 @section movie
22641
22642 Read audio and/or video stream(s) from a movie container.
22643
22644 It accepts the following parameters:
22645
22646 @table @option
22647 @item filename
22648 The name of the resource to read (not necessarily a file; it can also be a
22649 device or a stream accessed through some protocol).
22650
22651 @item format_name, f
22652 Specifies the format assumed for the movie to read, and can be either
22653 the name of a container or an input device. If not specified, the
22654 format is guessed from @var{movie_name} or by probing.
22655
22656 @item seek_point, sp
22657 Specifies the seek point in seconds. The frames will be output
22658 starting from this seek point. The parameter is evaluated with
22659 @code{av_strtod}, so the numerical value may be suffixed by an IS
22660 postfix. The default value is "0".
22661
22662 @item streams, s
22663 Specifies the streams to read. Several streams can be specified,
22664 separated by "+". The source will then have as many outputs, in the
22665 same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
22666 section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
22667 respectively the default (best suited) video and audio stream. Default
22668 is "dv", or "da" if the filter is called as "amovie".
22669
22670 @item stream_index, si
22671 Specifies the index of the video stream to read. If the value is -1,
22672 the most suitable video stream will be automatically selected. The default
22673 value is "-1". Deprecated. If the filter is called "amovie", it will select
22674 audio instead of video.
22675
22676 @item loop
22677 Specifies how many times to read the stream in sequence.
22678 If the value is 0, the stream will be looped infinitely.
22679 Default value is "1".
22680
22681 Note that when the movie is looped the source timestamps are not
22682 changed, so it will generate non monotonically increasing timestamps.
22683
22684 @item discontinuity
22685 Specifies the time difference between frames above which the point is
22686 considered a timestamp discontinuity which is removed by adjusting the later
22687 timestamps.
22688 @end table
22689
22690 It allows overlaying a second video on top of the main input of
22691 a filtergraph, as shown in this graph:
22692 @example
22693 input -----------> deltapts0 --> overlay --> output
22694                                     ^
22695                                     |
22696 movie --> scale--> deltapts1 -------+
22697 @end example
22698 @subsection Examples
22699
22700 @itemize
22701 @item
22702 Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
22703 on top of the input labelled "in":
22704 @example
22705 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
22706 [in] setpts=PTS-STARTPTS [main];
22707 [main][over] overlay=16:16 [out]
22708 @end example
22709
22710 @item
22711 Read from a video4linux2 device, and overlay it on top of the input
22712 labelled "in":
22713 @example
22714 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
22715 [in] setpts=PTS-STARTPTS [main];
22716 [main][over] overlay=16:16 [out]
22717 @end example
22718
22719 @item
22720 Read the first video stream and the audio stream with id 0x81 from
22721 dvd.vob; the video is connected to the pad named "video" and the audio is
22722 connected to the pad named "audio":
22723 @example
22724 movie=dvd.vob:s=v:0+#0x81 [video] [audio]
22725 @end example
22726 @end itemize
22727
22728 @subsection Commands
22729
22730 Both movie and amovie support the following commands:
22731 @table @option
22732 @item seek
22733 Perform seek using "av_seek_frame".
22734 The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
22735 @itemize
22736 @item
22737 @var{stream_index}: If stream_index is -1, a default
22738 stream is selected, and @var{timestamp} is automatically converted
22739 from AV_TIME_BASE units to the stream specific time_base.
22740 @item
22741 @var{timestamp}: Timestamp in AVStream.time_base units
22742 or, if no stream is specified, in AV_TIME_BASE units.
22743 @item
22744 @var{flags}: Flags which select direction and seeking mode.
22745 @end itemize
22746
22747 @item get_duration
22748 Get movie duration in AV_TIME_BASE units.
22749
22750 @end table
22751
22752 @c man end MULTIMEDIA SOURCES