]> git.sesse.net Git - ffmpeg/blob - doc/filters.texi
Merge commit '01d6f84f49a55fd591aa120960fce2b9dba92d0d'
[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{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.
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{LINKLABEL}        ::= "[" @var{NAME} "]"
216 @var{LINKLABELS}       ::= @var{LINKLABEL} [@var{LINKLABELS}]
217 @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
218 @var{FILTER}           ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
219 @var{FILTERCHAIN}      ::= @var{FILTER} [,@var{FILTERCHAIN}]
220 @var{FILTERGRAPH}      ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
221 @end example
222
223 @section Notes on filtergraph escaping
224
225 Filtergraph description composition entails several levels of
226 escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
227 section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
228 information about the employed escaping procedure.
229
230 A first level escaping affects the content of each filter option
231 value, which may contain the special character @code{:} used to
232 separate values, or one of the escaping characters @code{\'}.
233
234 A second level escaping affects the whole filter description, which
235 may contain the escaping characters @code{\'} or the special
236 characters @code{[],;} used by the filtergraph description.
237
238 Finally, when you specify a filtergraph on a shell commandline, you
239 need to perform a third level escaping for the shell special
240 characters contained within it.
241
242 For example, consider the following string to be embedded in
243 the @ref{drawtext} filter description @option{text} value:
244 @example
245 this is a 'string': may contain one, or more, special characters
246 @end example
247
248 This string contains the @code{'} special escaping character, and the
249 @code{:} special character, so it needs to be escaped in this way:
250 @example
251 text=this is a \'string\'\: may contain one, or more, special characters
252 @end example
253
254 A second level of escaping is required when embedding the filter
255 description in a filtergraph description, in order to escape all the
256 filtergraph special characters. Thus the example above becomes:
257 @example
258 drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
259 @end example
260 (note that in addition to the @code{\'} escaping special characters,
261 also @code{,} needs to be escaped).
262
263 Finally an additional level of escaping is needed when writing the
264 filtergraph description in a shell command, which depends on the
265 escaping rules of the adopted shell. For example, assuming that
266 @code{\} is special and needs to be escaped with another @code{\}, the
267 previous string will finally result in:
268 @example
269 -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
270 @end example
271
272 @chapter Timeline editing
273
274 Some filters support a generic @option{enable} option. For the filters
275 supporting timeline editing, this option can be set to an expression which is
276 evaluated before sending a frame to the filter. If the evaluation is non-zero,
277 the filter will be enabled, otherwise the frame will be sent unchanged to the
278 next filter in the filtergraph.
279
280 The expression accepts the following values:
281 @table @samp
282 @item t
283 timestamp expressed in seconds, NAN if the input timestamp is unknown
284
285 @item n
286 sequential number of the input frame, starting from 0
287
288 @item pos
289 the position in the file of the input frame, NAN if unknown
290
291 @item w
292 @item h
293 width and height of the input frame if video
294 @end table
295
296 Additionally, these filters support an @option{enable} command that can be used
297 to re-define the expression.
298
299 Like any other filtering option, the @option{enable} option follows the same
300 rules.
301
302 For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
303 minutes, and a @ref{curves} filter starting at 3 seconds:
304 @example
305 smartblur = enable='between(t,10,3*60)',
306 curves    = enable='gte(t,3)' : preset=cross_process
307 @end example
308
309 See @code{ffmpeg -filters} to view which filters have timeline support.
310
311 @c man end FILTERGRAPH DESCRIPTION
312
313 @chapter Audio Filters
314 @c man begin AUDIO FILTERS
315
316 When you configure your FFmpeg build, you can disable any of the
317 existing filters using @code{--disable-filters}.
318 The configure output will show the audio filters included in your
319 build.
320
321 Below is a description of the currently available audio filters.
322
323 @section acompressor
324
325 A compressor is mainly used to reduce the dynamic range of a signal.
326 Especially modern music is mostly compressed at a high ratio to
327 improve the overall loudness. It's done to get the highest attention
328 of a listener, "fatten" the sound and bring more "power" to the track.
329 If a signal is compressed too much it may sound dull or "dead"
330 afterwards or it may start to "pump" (which could be a powerful effect
331 but can also destroy a track completely).
332 The right compression is the key to reach a professional sound and is
333 the high art of mixing and mastering. Because of its complex settings
334 it may take a long time to get the right feeling for this kind of effect.
335
336 Compression is done by detecting the volume above a chosen level
337 @code{threshold} and dividing it by the factor set with @code{ratio}.
338 So if you set the threshold to -12dB and your signal reaches -6dB a ratio
339 of 2:1 will result in a signal at -9dB. Because an exact manipulation of
340 the signal would cause distortion of the waveform the reduction can be
341 levelled over the time. This is done by setting "Attack" and "Release".
342 @code{attack} determines how long the signal has to rise above the threshold
343 before any reduction will occur and @code{release} sets the time the signal
344 has to fall below the threshold to reduce the reduction again. Shorter signals
345 than the chosen attack time will be left untouched.
346 The overall reduction of the signal can be made up afterwards with the
347 @code{makeup} setting. So compressing the peaks of a signal about 6dB and
348 raising the makeup to this level results in a signal twice as loud than the
349 source. To gain a softer entry in the compression the @code{knee} flattens the
350 hard edge at the threshold in the range of the chosen decibels.
351
352 The filter accepts the following options:
353
354 @table @option
355 @item level_in
356 Set input gain. Default is 1. Range is between 0.015625 and 64.
357
358 @item threshold
359 If a signal of second stream rises above this level it will affect the gain
360 reduction of the first stream.
361 By default it is 0.125. Range is between 0.00097563 and 1.
362
363 @item ratio
364 Set a ratio by which the signal is reduced. 1:2 means that if the level
365 rose 4dB above the threshold, it will be only 2dB above after the reduction.
366 Default is 2. Range is between 1 and 20.
367
368 @item attack
369 Amount of milliseconds the signal has to rise above the threshold before gain
370 reduction starts. Default is 20. Range is between 0.01 and 2000.
371
372 @item release
373 Amount of milliseconds the signal has to fall below the threshold before
374 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
375
376 @item makeup
377 Set the amount by how much signal will be amplified after processing.
378 Default is 2. Range is from 1 and 64.
379
380 @item knee
381 Curve the sharp knee around the threshold to enter gain reduction more softly.
382 Default is 2.82843. Range is between 1 and 8.
383
384 @item link
385 Choose if the @code{average} level between all channels of input stream
386 or the louder(@code{maximum}) channel of input stream affects the
387 reduction. Default is @code{average}.
388
389 @item detection
390 Should the exact signal be taken in case of @code{peak} or an RMS one in case
391 of @code{rms}. Default is @code{rms} which is mostly smoother.
392
393 @item mix
394 How much to use compressed signal in output. Default is 1.
395 Range is between 0 and 1.
396 @end table
397
398 @section acrossfade
399
400 Apply cross fade from one input audio stream to another input audio stream.
401 The cross fade is applied for specified duration near the end of first stream.
402
403 The filter accepts the following options:
404
405 @table @option
406 @item nb_samples, ns
407 Specify the number of samples for which the cross fade effect has to last.
408 At the end of the cross fade effect the first input audio will be completely
409 silent. Default is 44100.
410
411 @item duration, d
412 Specify the duration of the cross fade effect. See
413 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
414 for the accepted syntax.
415 By default the duration is determined by @var{nb_samples}.
416 If set this option is used instead of @var{nb_samples}.
417
418 @item overlap, o
419 Should first stream end overlap with second stream start. Default is enabled.
420
421 @item curve1
422 Set curve for cross fade transition for first stream.
423
424 @item curve2
425 Set curve for cross fade transition for second stream.
426
427 For description of available curve types see @ref{afade} filter description.
428 @end table
429
430 @subsection Examples
431
432 @itemize
433 @item
434 Cross fade from one input to another:
435 @example
436 ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
437 @end example
438
439 @item
440 Cross fade from one input to another but without overlapping:
441 @example
442 ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
443 @end example
444 @end itemize
445
446 @section acrusher
447
448 Reduce audio bit resolution.
449
450 This filter is bit crusher with enhanced functionality. A bit crusher
451 is used to audibly reduce number of bits an audio signal is sampled
452 with. This doesn't change the bit depth at all, it just produces the
453 effect. Material reduced in bit depth sounds more harsh and "digital".
454 This filter is able to even round to continuous values instead of discrete
455 bit depths.
456 Additionally it has a D/C offset which results in different crushing of
457 the lower and the upper half of the signal.
458 An Anti-Aliasing setting is able to produce "softer" crushing sounds.
459
460 Another feature of this filter is the logarithmic mode.
461 This setting switches from linear distances between bits to logarithmic ones.
462 The result is a much more "natural" sounding crusher which doesn't gate low
463 signals for example. The human ear has a logarithmic perception, too
464 so this kind of crushing is much more pleasant.
465 Logarithmic crushing is also able to get anti-aliased.
466
467 The filter accepts the following options:
468
469 @table @option
470 @item level_in
471 Set level in.
472
473 @item level_out
474 Set level out.
475
476 @item bits
477 Set bit reduction.
478
479 @item mix
480 Set mixing amount.
481
482 @item mode
483 Can be linear: @code{lin} or logarithmic: @code{log}.
484
485 @item dc
486 Set DC.
487
488 @item aa
489 Set anti-aliasing.
490
491 @item samples
492 Set sample reduction.
493
494 @item lfo
495 Enable LFO. By default disabled.
496
497 @item lforange
498 Set LFO range.
499
500 @item lforate
501 Set LFO rate.
502 @end table
503
504 @section adelay
505
506 Delay one or more audio channels.
507
508 Samples in delayed channel are filled with silence.
509
510 The filter accepts the following option:
511
512 @table @option
513 @item delays
514 Set list of delays in milliseconds for each channel separated by '|'.
515 At least one delay greater than 0 should be provided.
516 Unused delays will be silently ignored. If number of given delays is
517 smaller than number of channels all remaining channels will not be delayed.
518 If you want to delay exact number of samples, append 'S' to number.
519 @end table
520
521 @subsection Examples
522
523 @itemize
524 @item
525 Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
526 the second channel (and any other channels that may be present) unchanged.
527 @example
528 adelay=1500|0|500
529 @end example
530
531 @item
532 Delay second channel by 500 samples, the third channel by 700 samples and leave
533 the first channel (and any other channels that may be present) unchanged.
534 @example
535 adelay=0|500S|700S
536 @end example
537 @end itemize
538
539 @section aecho
540
541 Apply echoing to the input audio.
542
543 Echoes are reflected sound and can occur naturally amongst mountains
544 (and sometimes large buildings) when talking or shouting; digital echo
545 effects emulate this behaviour and are often used to help fill out the
546 sound of a single instrument or vocal. The time difference between the
547 original signal and the reflection is the @code{delay}, and the
548 loudness of the reflected signal is the @code{decay}.
549 Multiple echoes can have different delays and decays.
550
551 A description of the accepted parameters follows.
552
553 @table @option
554 @item in_gain
555 Set input gain of reflected signal. Default is @code{0.6}.
556
557 @item out_gain
558 Set output gain of reflected signal. Default is @code{0.3}.
559
560 @item delays
561 Set list of time intervals in milliseconds between original signal and reflections
562 separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
563 Default is @code{1000}.
564
565 @item decays
566 Set list of loudnesses of reflected signals separated by '|'.
567 Allowed range for each @code{decay} is @code{(0 - 1.0]}.
568 Default is @code{0.5}.
569 @end table
570
571 @subsection Examples
572
573 @itemize
574 @item
575 Make it sound as if there are twice as many instruments as are actually playing:
576 @example
577 aecho=0.8:0.88:60:0.4
578 @end example
579
580 @item
581 If delay is very short, then it sound like a (metallic) robot playing music:
582 @example
583 aecho=0.8:0.88:6:0.4
584 @end example
585
586 @item
587 A longer delay will sound like an open air concert in the mountains:
588 @example
589 aecho=0.8:0.9:1000:0.3
590 @end example
591
592 @item
593 Same as above but with one more mountain:
594 @example
595 aecho=0.8:0.9:1000|1800:0.3|0.25
596 @end example
597 @end itemize
598
599 @section aemphasis
600 Audio emphasis filter creates or restores material directly taken from LPs or
601 emphased CDs with different filter curves. E.g. to store music on vinyl the
602 signal has to be altered by a filter first to even out the disadvantages of
603 this recording medium.
604 Once the material is played back the inverse filter has to be applied to
605 restore the distortion of the frequency response.
606
607 The filter accepts the following options:
608
609 @table @option
610 @item level_in
611 Set input gain.
612
613 @item level_out
614 Set output gain.
615
616 @item mode
617 Set filter mode. For restoring material use @code{reproduction} mode, otherwise
618 use @code{production} mode. Default is @code{reproduction} mode.
619
620 @item type
621 Set filter type. Selects medium. Can be one of the following:
622
623 @table @option
624 @item col
625 select Columbia.
626 @item emi
627 select EMI.
628 @item bsi
629 select BSI (78RPM).
630 @item riaa
631 select RIAA.
632 @item cd
633 select Compact Disc (CD).
634 @item 50fm
635 select 50µs (FM).
636 @item 75fm
637 select 75µs (FM).
638 @item 50kf
639 select 50µs (FM-KF).
640 @item 75kf
641 select 75µs (FM-KF).
642 @end table
643 @end table
644
645 @section aeval
646
647 Modify an audio signal according to the specified expressions.
648
649 This filter accepts one or more expressions (one for each channel),
650 which are evaluated and used to modify a corresponding audio signal.
651
652 It accepts the following parameters:
653
654 @table @option
655 @item exprs
656 Set the '|'-separated expressions list for each separate channel. If
657 the number of input channels is greater than the number of
658 expressions, the last specified expression is used for the remaining
659 output channels.
660
661 @item channel_layout, c
662 Set output channel layout. If not specified, the channel layout is
663 specified by the number of expressions. If set to @samp{same}, it will
664 use by default the same input channel layout.
665 @end table
666
667 Each expression in @var{exprs} can contain the following constants and functions:
668
669 @table @option
670 @item ch
671 channel number of the current expression
672
673 @item n
674 number of the evaluated sample, starting from 0
675
676 @item s
677 sample rate
678
679 @item t
680 time of the evaluated sample expressed in seconds
681
682 @item nb_in_channels
683 @item nb_out_channels
684 input and output number of channels
685
686 @item val(CH)
687 the value of input channel with number @var{CH}
688 @end table
689
690 Note: this filter is slow. For faster processing you should use a
691 dedicated filter.
692
693 @subsection Examples
694
695 @itemize
696 @item
697 Half volume:
698 @example
699 aeval=val(ch)/2:c=same
700 @end example
701
702 @item
703 Invert phase of the second channel:
704 @example
705 aeval=val(0)|-val(1)
706 @end example
707 @end itemize
708
709 @anchor{afade}
710 @section afade
711
712 Apply fade-in/out effect to input audio.
713
714 A description of the accepted parameters follows.
715
716 @table @option
717 @item type, t
718 Specify the effect type, can be either @code{in} for fade-in, or
719 @code{out} for a fade-out effect. Default is @code{in}.
720
721 @item start_sample, ss
722 Specify the number of the start sample for starting to apply the fade
723 effect. Default is 0.
724
725 @item nb_samples, ns
726 Specify the number of samples for which the fade effect has to last. At
727 the end of the fade-in effect the output audio will have the same
728 volume as the input audio, at the end of the fade-out transition
729 the output audio will be silence. Default is 44100.
730
731 @item start_time, st
732 Specify the start time of the fade effect. Default is 0.
733 The value must be specified as a time duration; see
734 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
735 for the accepted syntax.
736 If set this option is used instead of @var{start_sample}.
737
738 @item duration, d
739 Specify the duration of the fade effect. See
740 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
741 for the accepted syntax.
742 At the end of the fade-in effect the output audio will have the same
743 volume as the input audio, at the end of the fade-out transition
744 the output audio will be silence.
745 By default the duration is determined by @var{nb_samples}.
746 If set this option is used instead of @var{nb_samples}.
747
748 @item curve
749 Set curve for fade transition.
750
751 It accepts the following values:
752 @table @option
753 @item tri
754 select triangular, linear slope (default)
755 @item qsin
756 select quarter of sine wave
757 @item hsin
758 select half of sine wave
759 @item esin
760 select exponential sine wave
761 @item log
762 select logarithmic
763 @item ipar
764 select inverted parabola
765 @item qua
766 select quadratic
767 @item cub
768 select cubic
769 @item squ
770 select square root
771 @item cbr
772 select cubic root
773 @item par
774 select parabola
775 @item exp
776 select exponential
777 @item iqsin
778 select inverted quarter of sine wave
779 @item ihsin
780 select inverted half of sine wave
781 @item dese
782 select double-exponential seat
783 @item desi
784 select double-exponential sigmoid
785 @end table
786 @end table
787
788 @subsection Examples
789
790 @itemize
791 @item
792 Fade in first 15 seconds of audio:
793 @example
794 afade=t=in:ss=0:d=15
795 @end example
796
797 @item
798 Fade out last 25 seconds of a 900 seconds audio:
799 @example
800 afade=t=out:st=875:d=25
801 @end example
802 @end itemize
803
804 @section afftfilt
805 Apply arbitrary expressions to samples in frequency domain.
806
807 @table @option
808 @item real
809 Set frequency domain real expression for each separate channel separated
810 by '|'. Default is "1".
811 If the number of input channels is greater than the number of
812 expressions, the last specified expression is used for the remaining
813 output channels.
814
815 @item imag
816 Set frequency domain imaginary expression for each separate channel
817 separated by '|'. If not set, @var{real} option is used.
818
819 Each expression in @var{real} and @var{imag} can contain the following
820 constants:
821
822 @table @option
823 @item sr
824 sample rate
825
826 @item b
827 current frequency bin number
828
829 @item nb
830 number of available bins
831
832 @item ch
833 channel number of the current expression
834
835 @item chs
836 number of channels
837
838 @item pts
839 current frame pts
840 @end table
841
842 @item win_size
843 Set window size.
844
845 It accepts the following values:
846 @table @samp
847 @item w16
848 @item w32
849 @item w64
850 @item w128
851 @item w256
852 @item w512
853 @item w1024
854 @item w2048
855 @item w4096
856 @item w8192
857 @item w16384
858 @item w32768
859 @item w65536
860 @end table
861 Default is @code{w4096}
862
863 @item win_func
864 Set window function. Default is @code{hann}.
865
866 @item overlap
867 Set window overlap. If set to 1, the recommended overlap for selected
868 window function will be picked. Default is @code{0.75}.
869 @end table
870
871 @subsection Examples
872
873 @itemize
874 @item
875 Leave almost only low frequencies in audio:
876 @example
877 afftfilt="1-clip((b/nb)*b,0,1)"
878 @end example
879 @end itemize
880
881 @anchor{aformat}
882 @section aformat
883
884 Set output format constraints for the input audio. The framework will
885 negotiate the most appropriate format to minimize conversions.
886
887 It accepts the following parameters:
888 @table @option
889
890 @item sample_fmts
891 A '|'-separated list of requested sample formats.
892
893 @item sample_rates
894 A '|'-separated list of requested sample rates.
895
896 @item channel_layouts
897 A '|'-separated list of requested channel layouts.
898
899 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
900 for the required syntax.
901 @end table
902
903 If a parameter is omitted, all values are allowed.
904
905 Force the output to either unsigned 8-bit or signed 16-bit stereo
906 @example
907 aformat=sample_fmts=u8|s16:channel_layouts=stereo
908 @end example
909
910 @section agate
911
912 A gate is mainly used to reduce lower parts of a signal. This kind of signal
913 processing reduces disturbing noise between useful signals.
914
915 Gating is done by detecting the volume below a chosen level @var{threshold}
916 and dividing it by the factor set with @var{ratio}. The bottom of the noise
917 floor is set via @var{range}. Because an exact manipulation of the signal
918 would cause distortion of the waveform the reduction can be levelled over
919 time. This is done by setting @var{attack} and @var{release}.
920
921 @var{attack} determines how long the signal has to fall below the threshold
922 before any reduction will occur and @var{release} sets the time the signal
923 has to rise above the threshold to reduce the reduction again.
924 Shorter signals than the chosen attack time will be left untouched.
925
926 @table @option
927 @item level_in
928 Set input level before filtering.
929 Default is 1. Allowed range is from 0.015625 to 64.
930
931 @item range
932 Set the level of gain reduction when the signal is below the threshold.
933 Default is 0.06125. Allowed range is from 0 to 1.
934
935 @item threshold
936 If a signal rises above this level the gain reduction is released.
937 Default is 0.125. Allowed range is from 0 to 1.
938
939 @item ratio
940 Set a ratio by which the signal is reduced.
941 Default is 2. Allowed range is from 1 to 9000.
942
943 @item attack
944 Amount of milliseconds the signal has to rise above the threshold before gain
945 reduction stops.
946 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
947
948 @item release
949 Amount of milliseconds the signal has to fall below the threshold before the
950 reduction is increased again. Default is 250 milliseconds.
951 Allowed range is from 0.01 to 9000.
952
953 @item makeup
954 Set amount of amplification of signal after processing.
955 Default is 1. Allowed range is from 1 to 64.
956
957 @item knee
958 Curve the sharp knee around the threshold to enter gain reduction more softly.
959 Default is 2.828427125. Allowed range is from 1 to 8.
960
961 @item detection
962 Choose if exact signal should be taken for detection or an RMS like one.
963 Default is @code{rms}. Can be @code{peak} or @code{rms}.
964
965 @item link
966 Choose if the average level between all channels or the louder channel affects
967 the reduction.
968 Default is @code{average}. Can be @code{average} or @code{maximum}.
969 @end table
970
971 @section alimiter
972
973 The limiter prevents an input signal from rising over a desired threshold.
974 This limiter uses lookahead technology to prevent your signal from distorting.
975 It means that there is a small delay after the signal is processed. Keep in mind
976 that the delay it produces is the attack time you set.
977
978 The filter accepts the following options:
979
980 @table @option
981 @item level_in
982 Set input gain. Default is 1.
983
984 @item level_out
985 Set output gain. Default is 1.
986
987 @item limit
988 Don't let signals above this level pass the limiter. Default is 1.
989
990 @item attack
991 The limiter will reach its attenuation level in this amount of time in
992 milliseconds. Default is 5 milliseconds.
993
994 @item release
995 Come back from limiting to attenuation 1.0 in this amount of milliseconds.
996 Default is 50 milliseconds.
997
998 @item asc
999 When gain reduction is always needed ASC takes care of releasing to an
1000 average reduction level rather than reaching a reduction of 0 in the release
1001 time.
1002
1003 @item asc_level
1004 Select how much the release time is affected by ASC, 0 means nearly no changes
1005 in release time while 1 produces higher release times.
1006
1007 @item level
1008 Auto level output signal. Default is enabled.
1009 This normalizes audio back to 0dB if enabled.
1010 @end table
1011
1012 Depending on picked setting it is recommended to upsample input 2x or 4x times
1013 with @ref{aresample} before applying this filter.
1014
1015 @section allpass
1016
1017 Apply a two-pole all-pass filter with central frequency (in Hz)
1018 @var{frequency}, and filter-width @var{width}.
1019 An all-pass filter changes the audio's frequency to phase relationship
1020 without changing its frequency to amplitude relationship.
1021
1022 The filter accepts the following options:
1023
1024 @table @option
1025 @item frequency, f
1026 Set frequency in Hz.
1027
1028 @item width_type
1029 Set method to specify band-width of filter.
1030 @table @option
1031 @item h
1032 Hz
1033 @item q
1034 Q-Factor
1035 @item o
1036 octave
1037 @item s
1038 slope
1039 @end table
1040
1041 @item width, w
1042 Specify the band-width of a filter in width_type units.
1043 @end table
1044
1045 @section aloop
1046
1047 Loop audio samples.
1048
1049 The filter accepts the following options:
1050
1051 @table @option
1052 @item loop
1053 Set the number of loops.
1054
1055 @item size
1056 Set maximal number of samples.
1057
1058 @item start
1059 Set first sample of loop.
1060 @end table
1061
1062 @anchor{amerge}
1063 @section amerge
1064
1065 Merge two or more audio streams into a single multi-channel stream.
1066
1067 The filter accepts the following options:
1068
1069 @table @option
1070
1071 @item inputs
1072 Set the number of inputs. Default is 2.
1073
1074 @end table
1075
1076 If the channel layouts of the inputs are disjoint, and therefore compatible,
1077 the channel layout of the output will be set accordingly and the channels
1078 will be reordered as necessary. If the channel layouts of the inputs are not
1079 disjoint, the output will have all the channels of the first input then all
1080 the channels of the second input, in that order, and the channel layout of
1081 the output will be the default value corresponding to the total number of
1082 channels.
1083
1084 For example, if the first input is in 2.1 (FL+FR+LF) and the second input
1085 is FC+BL+BR, then the output will be in 5.1, with the channels in the
1086 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
1087 first input, b1 is the first channel of the second input).
1088
1089 On the other hand, if both input are in stereo, the output channels will be
1090 in the default order: a1, a2, b1, b2, and the channel layout will be
1091 arbitrarily set to 4.0, which may or may not be the expected value.
1092
1093 All inputs must have the same sample rate, and format.
1094
1095 If inputs do not have the same duration, the output will stop with the
1096 shortest.
1097
1098 @subsection Examples
1099
1100 @itemize
1101 @item
1102 Merge two mono files into a stereo stream:
1103 @example
1104 amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
1105 @end example
1106
1107 @item
1108 Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
1109 @example
1110 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
1111 @end example
1112 @end itemize
1113
1114 @section amix
1115
1116 Mixes multiple audio inputs into a single output.
1117
1118 Note that this filter only supports float samples (the @var{amerge}
1119 and @var{pan} audio filters support many formats). If the @var{amix}
1120 input has integer samples then @ref{aresample} will be automatically
1121 inserted to perform the conversion to float samples.
1122
1123 For example
1124 @example
1125 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
1126 @end example
1127 will mix 3 input audio streams to a single output with the same duration as the
1128 first input and a dropout transition time of 3 seconds.
1129
1130 It accepts the following parameters:
1131 @table @option
1132
1133 @item inputs
1134 The number of inputs. If unspecified, it defaults to 2.
1135
1136 @item duration
1137 How to determine the end-of-stream.
1138 @table @option
1139
1140 @item longest
1141 The duration of the longest input. (default)
1142
1143 @item shortest
1144 The duration of the shortest input.
1145
1146 @item first
1147 The duration of the first input.
1148
1149 @end table
1150
1151 @item dropout_transition
1152 The transition time, in seconds, for volume renormalization when an input
1153 stream ends. The default value is 2 seconds.
1154
1155 @end table
1156
1157 @section anequalizer
1158
1159 High-order parametric multiband equalizer for each channel.
1160
1161 It accepts the following parameters:
1162 @table @option
1163 @item params
1164
1165 This option string is in format:
1166 "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
1167 Each equalizer band is separated by '|'.
1168
1169 @table @option
1170 @item chn
1171 Set channel number to which equalization will be applied.
1172 If input doesn't have that channel the entry is ignored.
1173
1174 @item f
1175 Set central frequency for band.
1176 If input doesn't have that frequency the entry is ignored.
1177
1178 @item w
1179 Set band width in hertz.
1180
1181 @item g
1182 Set band gain in dB.
1183
1184 @item t
1185 Set filter type for band, optional, can be:
1186
1187 @table @samp
1188 @item 0
1189 Butterworth, this is default.
1190
1191 @item 1
1192 Chebyshev type 1.
1193
1194 @item 2
1195 Chebyshev type 2.
1196 @end table
1197 @end table
1198
1199 @item curves
1200 With this option activated frequency response of anequalizer is displayed
1201 in video stream.
1202
1203 @item size
1204 Set video stream size. Only useful if curves option is activated.
1205
1206 @item mgain
1207 Set max gain that will be displayed. Only useful if curves option is activated.
1208 Setting this to a reasonable value makes it possible to display gain which is derived from
1209 neighbour bands which are too close to each other and thus produce higher gain
1210 when both are activated.
1211
1212 @item fscale
1213 Set frequency scale used to draw frequency response in video output.
1214 Can be linear or logarithmic. Default is logarithmic.
1215
1216 @item colors
1217 Set color for each channel curve which is going to be displayed in video stream.
1218 This is list of color names separated by space or by '|'.
1219 Unrecognised or missing colors will be replaced by white color.
1220 @end table
1221
1222 @subsection Examples
1223
1224 @itemize
1225 @item
1226 Lower gain by 10 of central frequency 200Hz and width 100 Hz
1227 for first 2 channels using Chebyshev type 1 filter:
1228 @example
1229 anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
1230 @end example
1231 @end itemize
1232
1233 @subsection Commands
1234
1235 This filter supports the following commands:
1236 @table @option
1237 @item change
1238 Alter existing filter parameters.
1239 Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
1240
1241 @var{fN} is existing filter number, starting from 0, if no such filter is available
1242 error is returned.
1243 @var{freq} set new frequency parameter.
1244 @var{width} set new width parameter in herz.
1245 @var{gain} set new gain parameter in dB.
1246
1247 Full filter invocation with asendcmd may look like this:
1248 asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
1249 @end table
1250
1251 @section anull
1252
1253 Pass the audio source unchanged to the output.
1254
1255 @section apad
1256
1257 Pad the end of an audio stream with silence.
1258
1259 This can be used together with @command{ffmpeg} @option{-shortest} to
1260 extend audio streams to the same length as the video stream.
1261
1262 A description of the accepted options follows.
1263
1264 @table @option
1265 @item packet_size
1266 Set silence packet size. Default value is 4096.
1267
1268 @item pad_len
1269 Set the number of samples of silence to add to the end. After the
1270 value is reached, the stream is terminated. This option is mutually
1271 exclusive with @option{whole_len}.
1272
1273 @item whole_len
1274 Set the minimum total number of samples in the output audio stream. If
1275 the value is longer than the input audio length, silence is added to
1276 the end, until the value is reached. This option is mutually exclusive
1277 with @option{pad_len}.
1278 @end table
1279
1280 If neither the @option{pad_len} nor the @option{whole_len} option is
1281 set, the filter will add silence to the end of the input stream
1282 indefinitely.
1283
1284 @subsection Examples
1285
1286 @itemize
1287 @item
1288 Add 1024 samples of silence to the end of the input:
1289 @example
1290 apad=pad_len=1024
1291 @end example
1292
1293 @item
1294 Make sure the audio output will contain at least 10000 samples, pad
1295 the input with silence if required:
1296 @example
1297 apad=whole_len=10000
1298 @end example
1299
1300 @item
1301 Use @command{ffmpeg} to pad the audio input with silence, so that the
1302 video stream will always result the shortest and will be converted
1303 until the end in the output file when using the @option{shortest}
1304 option:
1305 @example
1306 ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
1307 @end example
1308 @end itemize
1309
1310 @section aphaser
1311 Add a phasing effect to the input audio.
1312
1313 A phaser filter creates series of peaks and troughs in the frequency spectrum.
1314 The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
1315
1316 A description of the accepted parameters follows.
1317
1318 @table @option
1319 @item in_gain
1320 Set input gain. Default is 0.4.
1321
1322 @item out_gain
1323 Set output gain. Default is 0.74
1324
1325 @item delay
1326 Set delay in milliseconds. Default is 3.0.
1327
1328 @item decay
1329 Set decay. Default is 0.4.
1330
1331 @item speed
1332 Set modulation speed in Hz. Default is 0.5.
1333
1334 @item type
1335 Set modulation type. Default is triangular.
1336
1337 It accepts the following values:
1338 @table @samp
1339 @item triangular, t
1340 @item sinusoidal, s
1341 @end table
1342 @end table
1343
1344 @section apulsator
1345
1346 Audio pulsator is something between an autopanner and a tremolo.
1347 But it can produce funny stereo effects as well. Pulsator changes the volume
1348 of the left and right channel based on a LFO (low frequency oscillator) with
1349 different waveforms and shifted phases.
1350 This filter have the ability to define an offset between left and right
1351 channel. An offset of 0 means that both LFO shapes match each other.
1352 The left and right channel are altered equally - a conventional tremolo.
1353 An offset of 50% means that the shape of the right channel is exactly shifted
1354 in phase (or moved backwards about half of the frequency) - pulsator acts as
1355 an autopanner. At 1 both curves match again. Every setting in between moves the
1356 phase shift gapless between all stages and produces some "bypassing" sounds with
1357 sine and triangle waveforms. The more you set the offset near 1 (starting from
1358 the 0.5) the faster the signal passes from the left to the right speaker.
1359
1360 The filter accepts the following options:
1361
1362 @table @option
1363 @item level_in
1364 Set input gain. By default it is 1. Range is [0.015625 - 64].
1365
1366 @item level_out
1367 Set output gain. By default it is 1. Range is [0.015625 - 64].
1368
1369 @item mode
1370 Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
1371 sawup or sawdown. Default is sine.
1372
1373 @item amount
1374 Set modulation. Define how much of original signal is affected by the LFO.
1375
1376 @item offset_l
1377 Set left channel offset. Default is 0. Allowed range is [0 - 1].
1378
1379 @item offset_r
1380 Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
1381
1382 @item width
1383 Set pulse width. Default is 1. Allowed range is [0 - 2].
1384
1385 @item timing
1386 Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
1387
1388 @item bpm
1389 Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
1390 is set to bpm.
1391
1392 @item ms
1393 Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
1394 is set to ms.
1395
1396 @item hz
1397 Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
1398 if timing is set to hz.
1399 @end table
1400
1401 @anchor{aresample}
1402 @section aresample
1403
1404 Resample the input audio to the specified parameters, using the
1405 libswresample library. If none are specified then the filter will
1406 automatically convert between its input and output.
1407
1408 This filter is also able to stretch/squeeze the audio data to make it match
1409 the timestamps or to inject silence / cut out audio to make it match the
1410 timestamps, do a combination of both or do neither.
1411
1412 The filter accepts the syntax
1413 [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
1414 expresses a sample rate and @var{resampler_options} is a list of
1415 @var{key}=@var{value} pairs, separated by ":". See the
1416 @ref{Resampler Options,,the "Resampler Options" section in the
1417 ffmpeg-resampler(1) manual,ffmpeg-resampler}
1418 for the complete list of supported options.
1419
1420 @subsection Examples
1421
1422 @itemize
1423 @item
1424 Resample the input audio to 44100Hz:
1425 @example
1426 aresample=44100
1427 @end example
1428
1429 @item
1430 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
1431 samples per second compensation:
1432 @example
1433 aresample=async=1000
1434 @end example
1435 @end itemize
1436
1437 @section areverse
1438
1439 Reverse an audio clip.
1440
1441 Warning: This filter requires memory to buffer the entire clip, so trimming
1442 is suggested.
1443
1444 @subsection Examples
1445
1446 @itemize
1447 @item
1448 Take the first 5 seconds of a clip, and reverse it.
1449 @example
1450 atrim=end=5,areverse
1451 @end example
1452 @end itemize
1453
1454 @section asetnsamples
1455
1456 Set the number of samples per each output audio frame.
1457
1458 The last output packet may contain a different number of samples, as
1459 the filter will flush all the remaining samples when the input audio
1460 signals its end.
1461
1462 The filter accepts the following options:
1463
1464 @table @option
1465
1466 @item nb_out_samples, n
1467 Set the number of frames per each output audio frame. The number is
1468 intended as the number of samples @emph{per each channel}.
1469 Default value is 1024.
1470
1471 @item pad, p
1472 If set to 1, the filter will pad the last audio frame with zeroes, so
1473 that the last frame will contain the same number of samples as the
1474 previous ones. Default value is 1.
1475 @end table
1476
1477 For example, to set the number of per-frame samples to 1234 and
1478 disable padding for the last frame, use:
1479 @example
1480 asetnsamples=n=1234:p=0
1481 @end example
1482
1483 @section asetrate
1484
1485 Set the sample rate without altering the PCM data.
1486 This will result in a change of speed and pitch.
1487
1488 The filter accepts the following options:
1489
1490 @table @option
1491 @item sample_rate, r
1492 Set the output sample rate. Default is 44100 Hz.
1493 @end table
1494
1495 @section ashowinfo
1496
1497 Show a line containing various information for each input audio frame.
1498 The input audio is not modified.
1499
1500 The shown line contains a sequence of key/value pairs of the form
1501 @var{key}:@var{value}.
1502
1503 The following values are shown in the output:
1504
1505 @table @option
1506 @item n
1507 The (sequential) number of the input frame, starting from 0.
1508
1509 @item pts
1510 The presentation timestamp of the input frame, in time base units; the time base
1511 depends on the filter input pad, and is usually 1/@var{sample_rate}.
1512
1513 @item pts_time
1514 The presentation timestamp of the input frame in seconds.
1515
1516 @item pos
1517 position of the frame in the input stream, -1 if this information in
1518 unavailable and/or meaningless (for example in case of synthetic audio)
1519
1520 @item fmt
1521 The sample format.
1522
1523 @item chlayout
1524 The channel layout.
1525
1526 @item rate
1527 The sample rate for the audio frame.
1528
1529 @item nb_samples
1530 The number of samples (per channel) in the frame.
1531
1532 @item checksum
1533 The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
1534 audio, the data is treated as if all the planes were concatenated.
1535
1536 @item plane_checksums
1537 A list of Adler-32 checksums for each data plane.
1538 @end table
1539
1540 @anchor{astats}
1541 @section astats
1542
1543 Display time domain statistical information about the audio channels.
1544 Statistics are calculated and displayed for each audio channel and,
1545 where applicable, an overall figure is also given.
1546
1547 It accepts the following option:
1548 @table @option
1549 @item length
1550 Short window length in seconds, used for peak and trough RMS measurement.
1551 Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
1552
1553 @item metadata
1554
1555 Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
1556 where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
1557 disabled.
1558
1559 Available keys for each channel are:
1560 DC_offset
1561 Min_level
1562 Max_level
1563 Min_difference
1564 Max_difference
1565 Mean_difference
1566 Peak_level
1567 RMS_peak
1568 RMS_trough
1569 Crest_factor
1570 Flat_factor
1571 Peak_count
1572 Bit_depth
1573
1574 and for Overall:
1575 DC_offset
1576 Min_level
1577 Max_level
1578 Min_difference
1579 Max_difference
1580 Mean_difference
1581 Peak_level
1582 RMS_level
1583 RMS_peak
1584 RMS_trough
1585 Flat_factor
1586 Peak_count
1587 Bit_depth
1588 Number_of_samples
1589
1590 For example full key look like this @code{lavfi.astats.1.DC_offset} or
1591 this @code{lavfi.astats.Overall.Peak_count}.
1592
1593 For description what each key means read below.
1594
1595 @item reset
1596 Set number of frame after which stats are going to be recalculated.
1597 Default is disabled.
1598 @end table
1599
1600 A description of each shown parameter follows:
1601
1602 @table @option
1603 @item DC offset
1604 Mean amplitude displacement from zero.
1605
1606 @item Min level
1607 Minimal sample level.
1608
1609 @item Max level
1610 Maximal sample level.
1611
1612 @item Min difference
1613 Minimal difference between two consecutive samples.
1614
1615 @item Max difference
1616 Maximal difference between two consecutive samples.
1617
1618 @item Mean difference
1619 Mean difference between two consecutive samples.
1620 The average of each difference between two consecutive samples.
1621
1622 @item Peak level dB
1623 @item RMS level dB
1624 Standard peak and RMS level measured in dBFS.
1625
1626 @item RMS peak dB
1627 @item RMS trough dB
1628 Peak and trough values for RMS level measured over a short window.
1629
1630 @item Crest factor
1631 Standard ratio of peak to RMS level (note: not in dB).
1632
1633 @item Flat factor
1634 Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
1635 (i.e. either @var{Min level} or @var{Max level}).
1636
1637 @item Peak count
1638 Number of occasions (not the number of samples) that the signal attained either
1639 @var{Min level} or @var{Max level}.
1640
1641 @item Bit depth
1642 Overall bit depth of audio. Number of bits used for each sample.
1643 @end table
1644
1645 @section asyncts
1646
1647 Synchronize audio data with timestamps by squeezing/stretching it and/or
1648 dropping samples/adding silence when needed.
1649
1650 This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
1651
1652 It accepts the following parameters:
1653 @table @option
1654
1655 @item compensate
1656 Enable stretching/squeezing the data to make it match the timestamps. Disabled
1657 by default. When disabled, time gaps are covered with silence.
1658
1659 @item min_delta
1660 The minimum difference between timestamps and audio data (in seconds) to trigger
1661 adding/dropping samples. The default value is 0.1. If you get an imperfect
1662 sync with this filter, try setting this parameter to 0.
1663
1664 @item max_comp
1665 The maximum compensation in samples per second. Only relevant with compensate=1.
1666 The default value is 500.
1667
1668 @item first_pts
1669 Assume that the first PTS should be this value. The time base is 1 / sample
1670 rate. This allows for padding/trimming at the start of the stream. By default,
1671 no assumption is made about the first frame's expected PTS, so no padding or
1672 trimming is done. For example, this could be set to 0 to pad the beginning with
1673 silence if an audio stream starts after the video stream or to trim any samples
1674 with a negative PTS due to encoder delay.
1675
1676 @end table
1677
1678 @section atempo
1679
1680 Adjust audio tempo.
1681
1682 The filter accepts exactly one parameter, the audio tempo. If not
1683 specified then the filter will assume nominal 1.0 tempo. Tempo must
1684 be in the [0.5, 2.0] range.
1685
1686 @subsection Examples
1687
1688 @itemize
1689 @item
1690 Slow down audio to 80% tempo:
1691 @example
1692 atempo=0.8
1693 @end example
1694
1695 @item
1696 To speed up audio to 125% tempo:
1697 @example
1698 atempo=1.25
1699 @end example
1700 @end itemize
1701
1702 @section atrim
1703
1704 Trim the input so that the output contains one continuous subpart of the input.
1705
1706 It accepts the following parameters:
1707 @table @option
1708 @item start
1709 Timestamp (in seconds) of the start of the section to keep. I.e. the audio
1710 sample with the timestamp @var{start} will be the first sample in the output.
1711
1712 @item end
1713 Specify time of the first audio sample that will be dropped, i.e. the
1714 audio sample immediately preceding the one with the timestamp @var{end} will be
1715 the last sample in the output.
1716
1717 @item start_pts
1718 Same as @var{start}, except this option sets the start timestamp in samples
1719 instead of seconds.
1720
1721 @item end_pts
1722 Same as @var{end}, except this option sets the end timestamp in samples instead
1723 of seconds.
1724
1725 @item duration
1726 The maximum duration of the output in seconds.
1727
1728 @item start_sample
1729 The number of the first sample that should be output.
1730
1731 @item end_sample
1732 The number of the first sample that should be dropped.
1733 @end table
1734
1735 @option{start}, @option{end}, and @option{duration} are expressed as time
1736 duration specifications; see
1737 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
1738
1739 Note that the first two sets of the start/end options and the @option{duration}
1740 option look at the frame timestamp, while the _sample options simply count the
1741 samples that pass through the filter. So start/end_pts and start/end_sample will
1742 give different results when the timestamps are wrong, inexact or do not start at
1743 zero. Also note that this filter does not modify the timestamps. If you wish
1744 to have the output timestamps start at zero, insert the asetpts filter after the
1745 atrim filter.
1746
1747 If multiple start or end options are set, this filter tries to be greedy and
1748 keep all samples that match at least one of the specified constraints. To keep
1749 only the part that matches all the constraints at once, chain multiple atrim
1750 filters.
1751
1752 The defaults are such that all the input is kept. So it is possible to set e.g.
1753 just the end values to keep everything before the specified time.
1754
1755 Examples:
1756 @itemize
1757 @item
1758 Drop everything except the second minute of input:
1759 @example
1760 ffmpeg -i INPUT -af atrim=60:120
1761 @end example
1762
1763 @item
1764 Keep only the first 1000 samples:
1765 @example
1766 ffmpeg -i INPUT -af atrim=end_sample=1000
1767 @end example
1768
1769 @end itemize
1770
1771 @section bandpass
1772
1773 Apply a two-pole Butterworth band-pass filter with central
1774 frequency @var{frequency}, and (3dB-point) band-width width.
1775 The @var{csg} option selects a constant skirt gain (peak gain = Q)
1776 instead of the default: constant 0dB peak gain.
1777 The filter roll off at 6dB per octave (20dB per decade).
1778
1779 The filter accepts the following options:
1780
1781 @table @option
1782 @item frequency, f
1783 Set the filter's central frequency. Default is @code{3000}.
1784
1785 @item csg
1786 Constant skirt gain if set to 1. Defaults to 0.
1787
1788 @item width_type
1789 Set method to specify band-width of filter.
1790 @table @option
1791 @item h
1792 Hz
1793 @item q
1794 Q-Factor
1795 @item o
1796 octave
1797 @item s
1798 slope
1799 @end table
1800
1801 @item width, w
1802 Specify the band-width of a filter in width_type units.
1803 @end table
1804
1805 @section bandreject
1806
1807 Apply a two-pole Butterworth band-reject filter with central
1808 frequency @var{frequency}, and (3dB-point) band-width @var{width}.
1809 The filter roll off at 6dB per octave (20dB per decade).
1810
1811 The filter accepts the following options:
1812
1813 @table @option
1814 @item frequency, f
1815 Set the filter's central frequency. Default is @code{3000}.
1816
1817 @item width_type
1818 Set method to specify band-width of filter.
1819 @table @option
1820 @item h
1821 Hz
1822 @item q
1823 Q-Factor
1824 @item o
1825 octave
1826 @item s
1827 slope
1828 @end table
1829
1830 @item width, w
1831 Specify the band-width of a filter in width_type units.
1832 @end table
1833
1834 @section bass
1835
1836 Boost or cut the bass (lower) frequencies of the audio using a two-pole
1837 shelving filter with a response similar to that of a standard
1838 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
1839
1840 The filter accepts the following options:
1841
1842 @table @option
1843 @item gain, g
1844 Give the gain at 0 Hz. Its useful range is about -20
1845 (for a large cut) to +20 (for a large boost).
1846 Beware of clipping when using a positive gain.
1847
1848 @item frequency, f
1849 Set the filter's central frequency and so can be used
1850 to extend or reduce the frequency range to be boosted or cut.
1851 The default value is @code{100} Hz.
1852
1853 @item width_type
1854 Set method to specify band-width of filter.
1855 @table @option
1856 @item h
1857 Hz
1858 @item q
1859 Q-Factor
1860 @item o
1861 octave
1862 @item s
1863 slope
1864 @end table
1865
1866 @item width, w
1867 Determine how steep is the filter's shelf transition.
1868 @end table
1869
1870 @section biquad
1871
1872 Apply a biquad IIR filter with the given coefficients.
1873 Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
1874 are the numerator and denominator coefficients respectively.
1875
1876 @section bs2b
1877 Bauer stereo to binaural transformation, which improves headphone listening of
1878 stereo audio records.
1879
1880 It accepts the following parameters:
1881 @table @option
1882
1883 @item profile
1884 Pre-defined crossfeed level.
1885 @table @option
1886
1887 @item default
1888 Default level (fcut=700, feed=50).
1889
1890 @item cmoy
1891 Chu Moy circuit (fcut=700, feed=60).
1892
1893 @item jmeier
1894 Jan Meier circuit (fcut=650, feed=95).
1895
1896 @end table
1897
1898 @item fcut
1899 Cut frequency (in Hz).
1900
1901 @item feed
1902 Feed level (in Hz).
1903
1904 @end table
1905
1906 @section channelmap
1907
1908 Remap input channels to new locations.
1909
1910 It accepts the following parameters:
1911 @table @option
1912 @item map
1913 Map channels from input to output. The argument is a '|'-separated list of
1914 mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
1915 @var{in_channel} form. @var{in_channel} can be either the name of the input
1916 channel (e.g. FL for front left) or its index in the input channel layout.
1917 @var{out_channel} is the name of the output channel or its index in the output
1918 channel layout. If @var{out_channel} is not given then it is implicitly an
1919 index, starting with zero and increasing by one for each mapping.
1920
1921 @item channel_layout
1922 The channel layout of the output stream.
1923 @end table
1924
1925 If no mapping is present, the filter will implicitly map input channels to
1926 output channels, preserving indices.
1927
1928 For example, assuming a 5.1+downmix input MOV file,
1929 @example
1930 ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
1931 @end example
1932 will create an output WAV file tagged as stereo from the downmix channels of
1933 the input.
1934
1935 To fix a 5.1 WAV improperly encoded in AAC's native channel order
1936 @example
1937 ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
1938 @end example
1939
1940 @section channelsplit
1941
1942 Split each channel from an input audio stream into a separate output stream.
1943
1944 It accepts the following parameters:
1945 @table @option
1946 @item channel_layout
1947 The channel layout of the input stream. The default is "stereo".
1948 @end table
1949
1950 For example, assuming a stereo input MP3 file,
1951 @example
1952 ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
1953 @end example
1954 will create an output Matroska file with two audio streams, one containing only
1955 the left channel and the other the right channel.
1956
1957 Split a 5.1 WAV file into per-channel files:
1958 @example
1959 ffmpeg -i in.wav -filter_complex
1960 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
1961 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
1962 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
1963 side_right.wav
1964 @end example
1965
1966 @section chorus
1967 Add a chorus effect to the audio.
1968
1969 Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
1970
1971 Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
1972 constant, with chorus, it is varied using using sinusoidal or triangular modulation.
1973 The modulation depth defines the range the modulated delay is played before or after
1974 the delay. Hence the delayed sound will sound slower or faster, that is the delayed
1975 sound tuned around the original one, like in a chorus where some vocals are slightly
1976 off key.
1977
1978 It accepts the following parameters:
1979 @table @option
1980 @item in_gain
1981 Set input gain. Default is 0.4.
1982
1983 @item out_gain
1984 Set output gain. Default is 0.4.
1985
1986 @item delays
1987 Set delays. A typical delay is around 40ms to 60ms.
1988
1989 @item decays
1990 Set decays.
1991
1992 @item speeds
1993 Set speeds.
1994
1995 @item depths
1996 Set depths.
1997 @end table
1998
1999 @subsection Examples
2000
2001 @itemize
2002 @item
2003 A single delay:
2004 @example
2005 chorus=0.7:0.9:55:0.4:0.25:2
2006 @end example
2007
2008 @item
2009 Two delays:
2010 @example
2011 chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
2012 @end example
2013
2014 @item
2015 Fuller sounding chorus with three delays:
2016 @example
2017 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
2018 @end example
2019 @end itemize
2020
2021 @section compand
2022 Compress or expand the audio's dynamic range.
2023
2024 It accepts the following parameters:
2025
2026 @table @option
2027
2028 @item attacks
2029 @item decays
2030 A list of times in seconds for each channel over which the instantaneous level
2031 of the input signal is averaged to determine its volume. @var{attacks} refers to
2032 increase of volume and @var{decays} refers to decrease of volume. For most
2033 situations, the attack time (response to the audio getting louder) should be
2034 shorter than the decay time, because the human ear is more sensitive to sudden
2035 loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
2036 a typical value for decay is 0.8 seconds.
2037 If specified number of attacks & decays is lower than number of channels, the last
2038 set attack/decay will be used for all remaining channels.
2039
2040 @item points
2041 A list of points for the transfer function, specified in dB relative to the
2042 maximum possible signal amplitude. Each key points list must be defined using
2043 the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
2044 @code{x0/y0 x1/y1 x2/y2 ....}
2045
2046 The input values must be in strictly increasing order but the transfer function
2047 does not have to be monotonically rising. The point @code{0/0} is assumed but
2048 may be overridden (by @code{0/out-dBn}). Typical values for the transfer
2049 function are @code{-70/-70|-60/-20}.
2050
2051 @item soft-knee
2052 Set the curve radius in dB for all joints. It defaults to 0.01.
2053
2054 @item gain
2055 Set the additional gain in dB to be applied at all points on the transfer
2056 function. This allows for easy adjustment of the overall gain.
2057 It defaults to 0.
2058
2059 @item volume
2060 Set an initial volume, in dB, to be assumed for each channel when filtering
2061 starts. This permits the user to supply a nominal level initially, so that, for
2062 example, a very large gain is not applied to initial signal levels before the
2063 companding has begun to operate. A typical value for audio which is initially
2064 quiet is -90 dB. It defaults to 0.
2065
2066 @item delay
2067 Set a delay, in seconds. The input audio is analyzed immediately, but audio is
2068 delayed before being fed to the volume adjuster. Specifying a delay
2069 approximately equal to the attack/decay times allows the filter to effectively
2070 operate in predictive rather than reactive mode. It defaults to 0.
2071
2072 @end table
2073
2074 @subsection Examples
2075
2076 @itemize
2077 @item
2078 Make music with both quiet and loud passages suitable for listening to in a
2079 noisy environment:
2080 @example
2081 compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
2082 @end example
2083
2084 Another example for audio with whisper and explosion parts:
2085 @example
2086 compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
2087 @end example
2088
2089 @item
2090 A noise gate for when the noise is at a lower level than the signal:
2091 @example
2092 compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
2093 @end example
2094
2095 @item
2096 Here is another noise gate, this time for when the noise is at a higher level
2097 than the signal (making it, in some ways, similar to squelch):
2098 @example
2099 compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
2100 @end example
2101
2102 @item
2103 2:1 compression starting at -6dB:
2104 @example
2105 compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
2106 @end example
2107
2108 @item
2109 2:1 compression starting at -9dB:
2110 @example
2111 compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
2112 @end example
2113
2114 @item
2115 2:1 compression starting at -12dB:
2116 @example
2117 compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
2118 @end example
2119
2120 @item
2121 2:1 compression starting at -18dB:
2122 @example
2123 compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
2124 @end example
2125
2126 @item
2127 3:1 compression starting at -15dB:
2128 @example
2129 compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
2130 @end example
2131
2132 @item
2133 Compressor/Gate:
2134 @example
2135 compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
2136 @end example
2137
2138 @item
2139 Expander:
2140 @example
2141 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
2142 @end example
2143
2144 @item
2145 Hard limiter at -6dB:
2146 @example
2147 compand=attacks=0:points=-80/-80|-6/-6|20/-6
2148 @end example
2149
2150 @item
2151 Hard limiter at -12dB:
2152 @example
2153 compand=attacks=0:points=-80/-80|-12/-12|20/-12
2154 @end example
2155
2156 @item
2157 Hard noise gate at -35 dB:
2158 @example
2159 compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
2160 @end example
2161
2162 @item
2163 Soft limiter:
2164 @example
2165 compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
2166 @end example
2167 @end itemize
2168
2169 @section compensationdelay
2170
2171 Compensation Delay Line is a metric based delay to compensate differing
2172 positions of microphones or speakers.
2173
2174 For example, you have recorded guitar with two microphones placed in
2175 different location. Because the front of sound wave has fixed speed in
2176 normal conditions, the phasing of microphones can vary and depends on
2177 their location and interposition. The best sound mix can be achieved when
2178 these microphones are in phase (synchronized). Note that distance of
2179 ~30 cm between microphones makes one microphone to capture signal in
2180 antiphase to another microphone. That makes the final mix sounding moody.
2181 This filter helps to solve phasing problems by adding different delays
2182 to each microphone track and make them synchronized.
2183
2184 The best result can be reached when you take one track as base and
2185 synchronize other tracks one by one with it.
2186 Remember that synchronization/delay tolerance depends on sample rate, too.
2187 Higher sample rates will give more tolerance.
2188
2189 It accepts the following parameters:
2190
2191 @table @option
2192 @item mm
2193 Set millimeters distance. This is compensation distance for fine tuning.
2194 Default is 0.
2195
2196 @item cm
2197 Set cm distance. This is compensation distance for tightening distance setup.
2198 Default is 0.
2199
2200 @item m
2201 Set meters distance. This is compensation distance for hard distance setup.
2202 Default is 0.
2203
2204 @item dry
2205 Set dry amount. Amount of unprocessed (dry) signal.
2206 Default is 0.
2207
2208 @item wet
2209 Set wet amount. Amount of processed (wet) signal.
2210 Default is 1.
2211
2212 @item temp
2213 Set temperature degree in Celsius. This is the temperature of the environment.
2214 Default is 20.
2215 @end table
2216
2217 @section crystalizer
2218 Simple algorithm to expand audio dynamic range.
2219
2220 The filter accepts the following options:
2221
2222 @table @option
2223 @item i
2224 Sets the intensity of effect (default: 2.0). Must be in range between 0.0
2225 (unchanged sound) to 10.0 (maximum effect).
2226
2227 @item c
2228 Enable clipping. By default is enabled.
2229 @end table
2230
2231 @section dcshift
2232 Apply a DC shift to the audio.
2233
2234 This can be useful to remove a DC offset (caused perhaps by a hardware problem
2235 in the recording chain) from the audio. The effect of a DC offset is reduced
2236 headroom and hence volume. The @ref{astats} filter can be used to determine if
2237 a signal has a DC offset.
2238
2239 @table @option
2240 @item shift
2241 Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
2242 the audio.
2243
2244 @item limitergain
2245 Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
2246 used to prevent clipping.
2247 @end table
2248
2249 @section dynaudnorm
2250 Dynamic Audio Normalizer.
2251
2252 This filter applies a certain amount of gain to the input audio in order
2253 to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
2254 contrast to more "simple" normalization algorithms, the Dynamic Audio
2255 Normalizer *dynamically* re-adjusts the gain factor to the input audio.
2256 This allows for applying extra gain to the "quiet" sections of the audio
2257 while avoiding distortions or clipping the "loud" sections. In other words:
2258 The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
2259 sections, in the sense that the volume of each section is brought to the
2260 same target level. Note, however, that the Dynamic Audio Normalizer achieves
2261 this goal *without* applying "dynamic range compressing". It will retain 100%
2262 of the dynamic range *within* each section of the audio file.
2263
2264 @table @option
2265 @item f
2266 Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
2267 Default is 500 milliseconds.
2268 The Dynamic Audio Normalizer processes the input audio in small chunks,
2269 referred to as frames. This is required, because a peak magnitude has no
2270 meaning for just a single sample value. Instead, we need to determine the
2271 peak magnitude for a contiguous sequence of sample values. While a "standard"
2272 normalizer would simply use the peak magnitude of the complete file, the
2273 Dynamic Audio Normalizer determines the peak magnitude individually for each
2274 frame. The length of a frame is specified in milliseconds. By default, the
2275 Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
2276 been found to give good results with most files.
2277 Note that the exact frame length, in number of samples, will be determined
2278 automatically, based on the sampling rate of the individual input audio file.
2279
2280 @item g
2281 Set the Gaussian filter window size. In range from 3 to 301, must be odd
2282 number. Default is 31.
2283 Probably the most important parameter of the Dynamic Audio Normalizer is the
2284 @code{window size} of the Gaussian smoothing filter. The filter's window size
2285 is specified in frames, centered around the current frame. For the sake of
2286 simplicity, this must be an odd number. Consequently, the default value of 31
2287 takes into account the current frame, as well as the 15 preceding frames and
2288 the 15 subsequent frames. Using a larger window results in a stronger
2289 smoothing effect and thus in less gain variation, i.e. slower gain
2290 adaptation. Conversely, using a smaller window results in a weaker smoothing
2291 effect and thus in more gain variation, i.e. faster gain adaptation.
2292 In other words, the more you increase this value, the more the Dynamic Audio
2293 Normalizer will behave like a "traditional" normalization filter. On the
2294 contrary, the more you decrease this value, the more the Dynamic Audio
2295 Normalizer will behave like a dynamic range compressor.
2296
2297 @item p
2298 Set the target peak value. This specifies the highest permissible magnitude
2299 level for the normalized audio input. This filter will try to approach the
2300 target peak magnitude as closely as possible, but at the same time it also
2301 makes sure that the normalized signal will never exceed the peak magnitude.
2302 A frame's maximum local gain factor is imposed directly by the target peak
2303 magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
2304 It is not recommended to go above this value.
2305
2306 @item m
2307 Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
2308 The Dynamic Audio Normalizer determines the maximum possible (local) gain
2309 factor for each input frame, i.e. the maximum gain factor that does not
2310 result in clipping or distortion. The maximum gain factor is determined by
2311 the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
2312 additionally bounds the frame's maximum gain factor by a predetermined
2313 (global) maximum gain factor. This is done in order to avoid excessive gain
2314 factors in "silent" or almost silent frames. By default, the maximum gain
2315 factor is 10.0, For most inputs the default value should be sufficient and
2316 it usually is not recommended to increase this value. Though, for input
2317 with an extremely low overall volume level, it may be necessary to allow even
2318 higher gain factors. Note, however, that the Dynamic Audio Normalizer does
2319 not simply apply a "hard" threshold (i.e. cut off values above the threshold).
2320 Instead, a "sigmoid" threshold function will be applied. This way, the
2321 gain factors will smoothly approach the threshold value, but never exceed that
2322 value.
2323
2324 @item r
2325 Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
2326 By default, the Dynamic Audio Normalizer performs "peak" normalization.
2327 This means that the maximum local gain factor for each frame is defined
2328 (only) by the frame's highest magnitude sample. This way, the samples can
2329 be amplified as much as possible without exceeding the maximum signal
2330 level, i.e. without clipping. Optionally, however, the Dynamic Audio
2331 Normalizer can also take into account the frame's root mean square,
2332 abbreviated RMS. In electrical engineering, the RMS is commonly used to
2333 determine the power of a time-varying signal. It is therefore considered
2334 that the RMS is a better approximation of the "perceived loudness" than
2335 just looking at the signal's peak magnitude. Consequently, by adjusting all
2336 frames to a constant RMS value, a uniform "perceived loudness" can be
2337 established. If a target RMS value has been specified, a frame's local gain
2338 factor is defined as the factor that would result in exactly that RMS value.
2339 Note, however, that the maximum local gain factor is still restricted by the
2340 frame's highest magnitude sample, in order to prevent clipping.
2341
2342 @item n
2343 Enable channels coupling. By default is enabled.
2344 By default, the Dynamic Audio Normalizer will amplify all channels by the same
2345 amount. This means the same gain factor will be applied to all channels, i.e.
2346 the maximum possible gain factor is determined by the "loudest" channel.
2347 However, in some recordings, it may happen that the volume of the different
2348 channels is uneven, e.g. one channel may be "quieter" than the other one(s).
2349 In this case, this option can be used to disable the channel coupling. This way,
2350 the gain factor will be determined independently for each channel, depending
2351 only on the individual channel's highest magnitude sample. This allows for
2352 harmonizing the volume of the different channels.
2353
2354 @item c
2355 Enable DC bias correction. By default is disabled.
2356 An audio signal (in the time domain) is a sequence of sample values.
2357 In the Dynamic Audio Normalizer these sample values are represented in the
2358 -1.0 to 1.0 range, regardless of the original input format. Normally, the
2359 audio signal, or "waveform", should be centered around the zero point.
2360 That means if we calculate the mean value of all samples in a file, or in a
2361 single frame, then the result should be 0.0 or at least very close to that
2362 value. If, however, there is a significant deviation of the mean value from
2363 0.0, in either positive or negative direction, this is referred to as a
2364 DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
2365 Audio Normalizer provides optional DC bias correction.
2366 With DC bias correction enabled, the Dynamic Audio Normalizer will determine
2367 the mean value, or "DC correction" offset, of each input frame and subtract
2368 that value from all of the frame's sample values which ensures those samples
2369 are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
2370 boundaries, the DC correction offset values will be interpolated smoothly
2371 between neighbouring frames.
2372
2373 @item b
2374 Enable alternative boundary mode. By default is disabled.
2375 The Dynamic Audio Normalizer takes into account a certain neighbourhood
2376 around each frame. This includes the preceding frames as well as the
2377 subsequent frames. However, for the "boundary" frames, located at the very
2378 beginning and at the very end of the audio file, not all neighbouring
2379 frames are available. In particular, for the first few frames in the audio
2380 file, the preceding frames are not known. And, similarly, for the last few
2381 frames in the audio file, the subsequent frames are not known. Thus, the
2382 question arises which gain factors should be assumed for the missing frames
2383 in the "boundary" region. The Dynamic Audio Normalizer implements two modes
2384 to deal with this situation. The default boundary mode assumes a gain factor
2385 of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
2386 "fade out" at the beginning and at the end of the input, respectively.
2387
2388 @item s
2389 Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
2390 By default, the Dynamic Audio Normalizer does not apply "traditional"
2391 compression. This means that signal peaks will not be pruned and thus the
2392 full dynamic range will be retained within each local neighbourhood. However,
2393 in some cases it may be desirable to combine the Dynamic Audio Normalizer's
2394 normalization algorithm with a more "traditional" compression.
2395 For this purpose, the Dynamic Audio Normalizer provides an optional compression
2396 (thresholding) function. If (and only if) the compression feature is enabled,
2397 all input frames will be processed by a soft knee thresholding function prior
2398 to the actual normalization process. Put simply, the thresholding function is
2399 going to prune all samples whose magnitude exceeds a certain threshold value.
2400 However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
2401 value. Instead, the threshold value will be adjusted for each individual
2402 frame.
2403 In general, smaller parameters result in stronger compression, and vice versa.
2404 Values below 3.0 are not recommended, because audible distortion may appear.
2405 @end table
2406
2407 @section earwax
2408
2409 Make audio easier to listen to on headphones.
2410
2411 This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
2412 so that when listened to on headphones the stereo image is moved from
2413 inside your head (standard for headphones) to outside and in front of
2414 the listener (standard for speakers).
2415
2416 Ported from SoX.
2417
2418 @section equalizer
2419
2420 Apply a two-pole peaking equalisation (EQ) filter. With this
2421 filter, the signal-level at and around a selected frequency can
2422 be increased or decreased, whilst (unlike bandpass and bandreject
2423 filters) that at all other frequencies is unchanged.
2424
2425 In order to produce complex equalisation curves, this filter can
2426 be given several times, each with a different central frequency.
2427
2428 The filter accepts the following options:
2429
2430 @table @option
2431 @item frequency, f
2432 Set the filter's central frequency in Hz.
2433
2434 @item width_type
2435 Set method to specify band-width of filter.
2436 @table @option
2437 @item h
2438 Hz
2439 @item q
2440 Q-Factor
2441 @item o
2442 octave
2443 @item s
2444 slope
2445 @end table
2446
2447 @item width, w
2448 Specify the band-width of a filter in width_type units.
2449
2450 @item gain, g
2451 Set the required gain or attenuation in dB.
2452 Beware of clipping when using a positive gain.
2453 @end table
2454
2455 @subsection Examples
2456 @itemize
2457 @item
2458 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
2459 @example
2460 equalizer=f=1000:width_type=h:width=200:g=-10
2461 @end example
2462
2463 @item
2464 Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
2465 @example
2466 equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
2467 @end example
2468 @end itemize
2469
2470 @section extrastereo
2471
2472 Linearly increases the difference between left and right channels which
2473 adds some sort of "live" effect to playback.
2474
2475 The filter accepts the following options:
2476
2477 @table @option
2478 @item m
2479 Sets the difference coefficient (default: 2.5). 0.0 means mono sound
2480 (average of both channels), with 1.0 sound will be unchanged, with
2481 -1.0 left and right channels will be swapped.
2482
2483 @item c
2484 Enable clipping. By default is enabled.
2485 @end table
2486
2487 @section firequalizer
2488 Apply FIR Equalization using arbitrary frequency response.
2489
2490 The filter accepts the following option:
2491
2492 @table @option
2493 @item gain
2494 Set gain curve equation (in dB). The expression can contain variables:
2495 @table @option
2496 @item f
2497 the evaluated frequency
2498 @item sr
2499 sample rate
2500 @item ch
2501 channel number, set to 0 when multichannels evaluation is disabled
2502 @item chid
2503 channel id, see libavutil/channel_layout.h, set to the first channel id when
2504 multichannels evaluation is disabled
2505 @item chs
2506 number of channels
2507 @item chlayout
2508 channel_layout, see libavutil/channel_layout.h
2509
2510 @end table
2511 and functions:
2512 @table @option
2513 @item gain_interpolate(f)
2514 interpolate gain on frequency f based on gain_entry
2515 @item cubic_interpolate(f)
2516 same as gain_interpolate, but smoother
2517 @end table
2518 This option is also available as command. Default is @code{gain_interpolate(f)}.
2519
2520 @item gain_entry
2521 Set gain entry for gain_interpolate function. The expression can
2522 contain functions:
2523 @table @option
2524 @item entry(f, g)
2525 store gain entry at frequency f with value g
2526 @end table
2527 This option is also available as command.
2528
2529 @item delay
2530 Set filter delay in seconds. Higher value means more accurate.
2531 Default is @code{0.01}.
2532
2533 @item accuracy
2534 Set filter accuracy in Hz. Lower value means more accurate.
2535 Default is @code{5}.
2536
2537 @item wfunc
2538 Set window function. Acceptable values are:
2539 @table @option
2540 @item rectangular
2541 rectangular window, useful when gain curve is already smooth
2542 @item hann
2543 hann window (default)
2544 @item hamming
2545 hamming window
2546 @item blackman
2547 blackman window
2548 @item nuttall3
2549 3-terms continuous 1st derivative nuttall window
2550 @item mnuttall3
2551 minimum 3-terms discontinuous nuttall window
2552 @item nuttall
2553 4-terms continuous 1st derivative nuttall window
2554 @item bnuttall
2555 minimum 4-terms discontinuous nuttall (blackman-nuttall) window
2556 @item bharris
2557 blackman-harris window
2558 @item tukey
2559 tukey window
2560 @end table
2561
2562 @item fixed
2563 If enabled, use fixed number of audio samples. This improves speed when
2564 filtering with large delay. Default is disabled.
2565
2566 @item multi
2567 Enable multichannels evaluation on gain. Default is disabled.
2568
2569 @item zero_phase
2570 Enable zero phase mode by subtracting timestamp to compensate delay.
2571 Default is disabled.
2572
2573 @item scale
2574 Set scale used by gain. Acceptable values are:
2575 @table @option
2576 @item linlin
2577 linear frequency, linear gain
2578 @item linlog
2579 linear frequency, logarithmic (in dB) gain (default)
2580 @item loglin
2581 logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
2582 @item loglog
2583 logarithmic frequency, logarithmic gain
2584 @end table
2585
2586 @item dumpfile
2587 Set file for dumping, suitable for gnuplot.
2588
2589 @item dumpscale
2590 Set scale for dumpfile. Acceptable values are same with scale option.
2591 Default is linlog.
2592
2593 @item fft2
2594 Enable 2-channel convolution using complex FFT. This improves speed significantly.
2595 Default is disabled.
2596 @end table
2597
2598 @subsection Examples
2599 @itemize
2600 @item
2601 lowpass at 1000 Hz:
2602 @example
2603 firequalizer=gain='if(lt(f,1000), 0, -INF)'
2604 @end example
2605 @item
2606 lowpass at 1000 Hz with gain_entry:
2607 @example
2608 firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
2609 @end example
2610 @item
2611 custom equalization:
2612 @example
2613 firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
2614 @end example
2615 @item
2616 higher delay with zero phase to compensate delay:
2617 @example
2618 firequalizer=delay=0.1:fixed=on:zero_phase=on
2619 @end example
2620 @item
2621 lowpass on left channel, highpass on right channel:
2622 @example
2623 firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
2624 :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
2625 @end example
2626 @end itemize
2627
2628 @section flanger
2629 Apply a flanging effect to the audio.
2630
2631 The filter accepts the following options:
2632
2633 @table @option
2634 @item delay
2635 Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
2636
2637 @item depth
2638 Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
2639
2640 @item regen
2641 Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
2642 Default value is 0.
2643
2644 @item width
2645 Set percentage of delayed signal mixed with original. Range from 0 to 100.
2646 Default value is 71.
2647
2648 @item speed
2649 Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
2650
2651 @item shape
2652 Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
2653 Default value is @var{sinusoidal}.
2654
2655 @item phase
2656 Set swept wave percentage-shift for multi channel. Range from 0 to 100.
2657 Default value is 25.
2658
2659 @item interp
2660 Set delay-line interpolation, @var{linear} or @var{quadratic}.
2661 Default is @var{linear}.
2662 @end table
2663
2664 @section hdcd
2665
2666 Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
2667 embedded HDCD codes is expanded into a 20-bit PCM stream.
2668
2669 The filter supports the Peak Extend and Low-level Gain Adjustment features
2670 of HDCD, and detects the Transient Filter flag.
2671
2672 @example
2673 ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
2674 @end example
2675
2676 When using the filter with wav, note the default encoding for wav is 16-bit,
2677 so the resulting 20-bit stream will be truncated back to 16-bit. Use something
2678 like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
2679 @example
2680 ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
2681 ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
2682 @end example
2683
2684 The filter accepts the following options:
2685
2686 @table @option
2687 @item disable_autoconvert
2688 Disable any automatic format conversion or resampling in the filter graph.
2689
2690 @item process_stereo
2691 Process the stereo channels together. If target_gain does not match between
2692 channels, consider it invalid and use the last valid target_gain.
2693
2694 @item cdt_ms
2695 Set the code detect timer period in ms.
2696
2697 @item force_pe
2698 Always extend peaks above -3dBFS even if PE isn't signaled.
2699
2700 @item analyze_mode
2701 Replace audio with a solid tone and adjust the amplitude to signal some
2702 specific aspect of the decoding process. The output file can be loaded in
2703 an audio editor alongside the original to aid analysis.
2704
2705 @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
2706
2707 Modes are:
2708 @table @samp
2709 @item 0, off
2710 Disabled
2711 @item 1, lle
2712 Gain adjustment level at each sample
2713 @item 2, pe
2714 Samples where peak extend occurs
2715 @item 3, cdt
2716 Samples where the code detect timer is active
2717 @item 4, tgm
2718 Samples where the target gain does not match between channels
2719 @end table
2720 @end table
2721
2722 @section highpass
2723
2724 Apply a high-pass filter with 3dB point frequency.
2725 The filter can be either single-pole, or double-pole (the default).
2726 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
2727
2728 The filter accepts the following options:
2729
2730 @table @option
2731 @item frequency, f
2732 Set frequency in Hz. Default is 3000.
2733
2734 @item poles, p
2735 Set number of poles. Default is 2.
2736
2737 @item width_type
2738 Set method to specify band-width of filter.
2739 @table @option
2740 @item h
2741 Hz
2742 @item q
2743 Q-Factor
2744 @item o
2745 octave
2746 @item s
2747 slope
2748 @end table
2749
2750 @item width, w
2751 Specify the band-width of a filter in width_type units.
2752 Applies only to double-pole filter.
2753 The default is 0.707q and gives a Butterworth response.
2754 @end table
2755
2756 @section join
2757
2758 Join multiple input streams into one multi-channel stream.
2759
2760 It accepts the following parameters:
2761 @table @option
2762
2763 @item inputs
2764 The number of input streams. It defaults to 2.
2765
2766 @item channel_layout
2767 The desired output channel layout. It defaults to stereo.
2768
2769 @item map
2770 Map channels from inputs to output. The argument is a '|'-separated list of
2771 mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
2772 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
2773 can be either the name of the input channel (e.g. FL for front left) or its
2774 index in the specified input stream. @var{out_channel} is the name of the output
2775 channel.
2776 @end table
2777
2778 The filter will attempt to guess the mappings when they are not specified
2779 explicitly. It does so by first trying to find an unused matching input channel
2780 and if that fails it picks the first unused input channel.
2781
2782 Join 3 inputs (with properly set channel layouts):
2783 @example
2784 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
2785 @end example
2786
2787 Build a 5.1 output from 6 single-channel streams:
2788 @example
2789 ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
2790 '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'
2791 out
2792 @end example
2793
2794 @section ladspa
2795
2796 Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
2797
2798 To enable compilation of this filter you need to configure FFmpeg with
2799 @code{--enable-ladspa}.
2800
2801 @table @option
2802 @item file, f
2803 Specifies the name of LADSPA plugin library to load. If the environment
2804 variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
2805 each one of the directories specified by the colon separated list in
2806 @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
2807 this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
2808 @file{/usr/lib/ladspa/}.
2809
2810 @item plugin, p
2811 Specifies the plugin within the library. Some libraries contain only
2812 one plugin, but others contain many of them. If this is not set filter
2813 will list all available plugins within the specified library.
2814
2815 @item controls, c
2816 Set the '|' separated list of controls which are zero or more floating point
2817 values that determine the behavior of the loaded plugin (for example delay,
2818 threshold or gain).
2819 Controls need to be defined using the following syntax:
2820 c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
2821 @var{valuei} is the value set on the @var{i}-th control.
2822 Alternatively they can be also defined using the following syntax:
2823 @var{value0}|@var{value1}|@var{value2}|..., where
2824 @var{valuei} is the value set on the @var{i}-th control.
2825 If @option{controls} is set to @code{help}, all available controls and
2826 their valid ranges are printed.
2827
2828 @item sample_rate, s
2829 Specify the sample rate, default to 44100. Only used if plugin have
2830 zero inputs.
2831
2832 @item nb_samples, n
2833 Set the number of samples per channel per each output frame, default
2834 is 1024. Only used if plugin have zero inputs.
2835
2836 @item duration, d
2837 Set the minimum duration of the sourced audio. See
2838 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
2839 for the accepted syntax.
2840 Note that the resulting duration may be greater than the specified duration,
2841 as the generated audio is always cut at the end of a complete frame.
2842 If not specified, or the expressed duration is negative, the audio is
2843 supposed to be generated forever.
2844 Only used if plugin have zero inputs.
2845
2846 @end table
2847
2848 @subsection Examples
2849
2850 @itemize
2851 @item
2852 List all available plugins within amp (LADSPA example plugin) library:
2853 @example
2854 ladspa=file=amp
2855 @end example
2856
2857 @item
2858 List all available controls and their valid ranges for @code{vcf_notch}
2859 plugin from @code{VCF} library:
2860 @example
2861 ladspa=f=vcf:p=vcf_notch:c=help
2862 @end example
2863
2864 @item
2865 Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
2866 plugin library:
2867 @example
2868 ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
2869 @end example
2870
2871 @item
2872 Add reverberation to the audio using TAP-plugins
2873 (Tom's Audio Processing plugins):
2874 @example
2875 ladspa=file=tap_reverb:tap_reverb
2876 @end example
2877
2878 @item
2879 Generate white noise, with 0.2 amplitude:
2880 @example
2881 ladspa=file=cmt:noise_source_white:c=c0=.2
2882 @end example
2883
2884 @item
2885 Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
2886 @code{C* Audio Plugin Suite} (CAPS) library:
2887 @example
2888 ladspa=file=caps:Click:c=c1=20'
2889 @end example
2890
2891 @item
2892 Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
2893 @example
2894 ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
2895 @end example
2896
2897 @item
2898 Increase volume by 20dB using fast lookahead limiter from Steve Harris
2899 @code{SWH Plugins} collection:
2900 @example
2901 ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
2902 @end example
2903
2904 @item
2905 Attenuate low frequencies using Multiband EQ from Steve Harris
2906 @code{SWH Plugins} collection:
2907 @example
2908 ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
2909 @end example
2910 @end itemize
2911
2912 @subsection Commands
2913
2914 This filter supports the following commands:
2915 @table @option
2916 @item cN
2917 Modify the @var{N}-th control value.
2918
2919 If the specified value is not valid, it is ignored and prior one is kept.
2920 @end table
2921
2922 @section loudnorm
2923
2924 EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
2925 Support for both single pass (livestreams, files) and double pass (files) modes.
2926 This algorithm can target IL, LRA, and maximum true peak.
2927
2928 The filter accepts the following options:
2929
2930 @table @option
2931 @item I, i
2932 Set integrated loudness target.
2933 Range is -70.0 - -5.0. Default value is -24.0.
2934
2935 @item LRA, lra
2936 Set loudness range target.
2937 Range is 1.0 - 20.0. Default value is 7.0.
2938
2939 @item TP, tp
2940 Set maximum true peak.
2941 Range is -9.0 - +0.0. Default value is -2.0.
2942
2943 @item measured_I, measured_i
2944 Measured IL of input file.
2945 Range is -99.0 - +0.0.
2946
2947 @item measured_LRA, measured_lra
2948 Measured LRA of input file.
2949 Range is  0.0 - 99.0.
2950
2951 @item measured_TP, measured_tp
2952 Measured true peak of input file.
2953 Range is  -99.0 - +99.0.
2954
2955 @item measured_thresh
2956 Measured threshold of input file.
2957 Range is -99.0 - +0.0.
2958
2959 @item offset
2960 Set offset gain. Gain is applied before the true-peak limiter.
2961 Range is  -99.0 - +99.0. Default is +0.0.
2962
2963 @item linear
2964 Normalize linearly if possible.
2965 measured_I, measured_LRA, measured_TP, and measured_thresh must also
2966 to be specified in order to use this mode.
2967 Options are true or false. Default is true.
2968
2969 @item dual_mono
2970 Treat mono input files as "dual-mono". If a mono file is intended for playback
2971 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
2972 If set to @code{true}, this option will compensate for this effect.
2973 Multi-channel input files are not affected by this option.
2974 Options are true or false. Default is false.
2975
2976 @item print_format
2977 Set print format for stats. Options are summary, json, or none.
2978 Default value is none.
2979 @end table
2980
2981 @section lowpass
2982
2983 Apply a low-pass filter with 3dB point frequency.
2984 The filter can be either single-pole or double-pole (the default).
2985 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
2986
2987 The filter accepts the following options:
2988
2989 @table @option
2990 @item frequency, f
2991 Set frequency in Hz. Default is 500.
2992
2993 @item poles, p
2994 Set number of poles. Default is 2.
2995
2996 @item width_type
2997 Set method to specify band-width of filter.
2998 @table @option
2999 @item h
3000 Hz
3001 @item q
3002 Q-Factor
3003 @item o
3004 octave
3005 @item s
3006 slope
3007 @end table
3008
3009 @item width, w
3010 Specify the band-width of a filter in width_type units.
3011 Applies only to double-pole filter.
3012 The default is 0.707q and gives a Butterworth response.
3013 @end table
3014
3015 @anchor{pan}
3016 @section pan
3017
3018 Mix channels with specific gain levels. The filter accepts the output
3019 channel layout followed by a set of channels definitions.
3020
3021 This filter is also designed to efficiently remap the channels of an audio
3022 stream.
3023
3024 The filter accepts parameters of the form:
3025 "@var{l}|@var{outdef}|@var{outdef}|..."
3026
3027 @table @option
3028 @item l
3029 output channel layout or number of channels
3030
3031 @item outdef
3032 output channel specification, of the form:
3033 "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
3034
3035 @item out_name
3036 output channel to define, either a channel name (FL, FR, etc.) or a channel
3037 number (c0, c1, etc.)
3038
3039 @item gain
3040 multiplicative coefficient for the channel, 1 leaving the volume unchanged
3041
3042 @item in_name
3043 input channel to use, see out_name for details; it is not possible to mix
3044 named and numbered input channels
3045 @end table
3046
3047 If the `=' in a channel specification is replaced by `<', then the gains for
3048 that specification will be renormalized so that the total is 1, thus
3049 avoiding clipping noise.
3050
3051 @subsection Mixing examples
3052
3053 For example, if you want to down-mix from stereo to mono, but with a bigger
3054 factor for the left channel:
3055 @example
3056 pan=1c|c0=0.9*c0+0.1*c1
3057 @end example
3058
3059 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
3060 7-channels surround:
3061 @example
3062 pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
3063 @end example
3064
3065 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
3066 that should be preferred (see "-ac" option) unless you have very specific
3067 needs.
3068
3069 @subsection Remapping examples
3070
3071 The channel remapping will be effective if, and only if:
3072
3073 @itemize
3074 @item gain coefficients are zeroes or ones,
3075 @item only one input per channel output,
3076 @end itemize
3077
3078 If all these conditions are satisfied, the filter will notify the user ("Pure
3079 channel mapping detected"), and use an optimized and lossless method to do the
3080 remapping.
3081
3082 For example, if you have a 5.1 source and want a stereo audio stream by
3083 dropping the extra channels:
3084 @example
3085 pan="stereo| c0=FL | c1=FR"
3086 @end example
3087
3088 Given the same source, you can also switch front left and front right channels
3089 and keep the input channel layout:
3090 @example
3091 pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
3092 @end example
3093
3094 If the input is a stereo audio stream, you can mute the front left channel (and
3095 still keep the stereo channel layout) with:
3096 @example
3097 pan="stereo|c1=c1"
3098 @end example
3099
3100 Still with a stereo audio stream input, you can copy the right channel in both
3101 front left and right:
3102 @example
3103 pan="stereo| c0=FR | c1=FR"
3104 @end example
3105
3106 @section replaygain
3107
3108 ReplayGain scanner filter. This filter takes an audio stream as an input and
3109 outputs it unchanged.
3110 At end of filtering it displays @code{track_gain} and @code{track_peak}.
3111
3112 @section resample
3113
3114 Convert the audio sample format, sample rate and channel layout. It is
3115 not meant to be used directly.
3116
3117 @section rubberband
3118 Apply time-stretching and pitch-shifting with librubberband.
3119
3120 The filter accepts the following options:
3121
3122 @table @option
3123 @item tempo
3124 Set tempo scale factor.
3125
3126 @item pitch
3127 Set pitch scale factor.
3128
3129 @item transients
3130 Set transients detector.
3131 Possible values are:
3132 @table @var
3133 @item crisp
3134 @item mixed
3135 @item smooth
3136 @end table
3137
3138 @item detector
3139 Set detector.
3140 Possible values are:
3141 @table @var
3142 @item compound
3143 @item percussive
3144 @item soft
3145 @end table
3146
3147 @item phase
3148 Set phase.
3149 Possible values are:
3150 @table @var
3151 @item laminar
3152 @item independent
3153 @end table
3154
3155 @item window
3156 Set processing window size.
3157 Possible values are:
3158 @table @var
3159 @item standard
3160 @item short
3161 @item long
3162 @end table
3163
3164 @item smoothing
3165 Set smoothing.
3166 Possible values are:
3167 @table @var
3168 @item off
3169 @item on
3170 @end table
3171
3172 @item formant
3173 Enable formant preservation when shift pitching.
3174 Possible values are:
3175 @table @var
3176 @item shifted
3177 @item preserved
3178 @end table
3179
3180 @item pitchq
3181 Set pitch quality.
3182 Possible values are:
3183 @table @var
3184 @item quality
3185 @item speed
3186 @item consistency
3187 @end table
3188
3189 @item channels
3190 Set channels.
3191 Possible values are:
3192 @table @var
3193 @item apart
3194 @item together
3195 @end table
3196 @end table
3197
3198 @section sidechaincompress
3199
3200 This filter acts like normal compressor but has the ability to compress
3201 detected signal using second input signal.
3202 It needs two input streams and returns one output stream.
3203 First input stream will be processed depending on second stream signal.
3204 The filtered signal then can be filtered with other filters in later stages of
3205 processing. See @ref{pan} and @ref{amerge} filter.
3206
3207 The filter accepts the following options:
3208
3209 @table @option
3210 @item level_in
3211 Set input gain. Default is 1. Range is between 0.015625 and 64.
3212
3213 @item threshold
3214 If a signal of second stream raises above this level it will affect the gain
3215 reduction of first stream.
3216 By default is 0.125. Range is between 0.00097563 and 1.
3217
3218 @item ratio
3219 Set a ratio about which the signal is reduced. 1:2 means that if the level
3220 raised 4dB above the threshold, it will be only 2dB above after the reduction.
3221 Default is 2. Range is between 1 and 20.
3222
3223 @item attack
3224 Amount of milliseconds the signal has to rise above the threshold before gain
3225 reduction starts. Default is 20. Range is between 0.01 and 2000.
3226
3227 @item release
3228 Amount of milliseconds the signal has to fall below the threshold before
3229 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
3230
3231 @item makeup
3232 Set the amount by how much signal will be amplified after processing.
3233 Default is 2. Range is from 1 and 64.
3234
3235 @item knee
3236 Curve the sharp knee around the threshold to enter gain reduction more softly.
3237 Default is 2.82843. Range is between 1 and 8.
3238
3239 @item link
3240 Choose if the @code{average} level between all channels of side-chain stream
3241 or the louder(@code{maximum}) channel of side-chain stream affects the
3242 reduction. Default is @code{average}.
3243
3244 @item detection
3245 Should the exact signal be taken in case of @code{peak} or an RMS one in case
3246 of @code{rms}. Default is @code{rms} which is mainly smoother.
3247
3248 @item level_sc
3249 Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
3250
3251 @item mix
3252 How much to use compressed signal in output. Default is 1.
3253 Range is between 0 and 1.
3254 @end table
3255
3256 @subsection Examples
3257
3258 @itemize
3259 @item
3260 Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
3261 depending on the signal of 2nd input and later compressed signal to be
3262 merged with 2nd input:
3263 @example
3264 ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
3265 @end example
3266 @end itemize
3267
3268 @section sidechaingate
3269
3270 A sidechain gate acts like a normal (wideband) gate but has the ability to
3271 filter the detected signal before sending it to the gain reduction stage.
3272 Normally a gate uses the full range signal to detect a level above the
3273 threshold.
3274 For example: If you cut all lower frequencies from your sidechain signal
3275 the gate will decrease the volume of your track only if not enough highs
3276 appear. With this technique you are able to reduce the resonation of a
3277 natural drum or remove "rumbling" of muted strokes from a heavily distorted
3278 guitar.
3279 It needs two input streams and returns one output stream.
3280 First input stream will be processed depending on second stream signal.
3281
3282 The filter accepts the following options:
3283
3284 @table @option
3285 @item level_in
3286 Set input level before filtering.
3287 Default is 1. Allowed range is from 0.015625 to 64.
3288
3289 @item range
3290 Set the level of gain reduction when the signal is below the threshold.
3291 Default is 0.06125. Allowed range is from 0 to 1.
3292
3293 @item threshold
3294 If a signal rises above this level the gain reduction is released.
3295 Default is 0.125. Allowed range is from 0 to 1.
3296
3297 @item ratio
3298 Set a ratio about which the signal is reduced.
3299 Default is 2. Allowed range is from 1 to 9000.
3300
3301 @item attack
3302 Amount of milliseconds the signal has to rise above the threshold before gain
3303 reduction stops.
3304 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
3305
3306 @item release
3307 Amount of milliseconds the signal has to fall below the threshold before the
3308 reduction is increased again. Default is 250 milliseconds.
3309 Allowed range is from 0.01 to 9000.
3310
3311 @item makeup
3312 Set amount of amplification of signal after processing.
3313 Default is 1. Allowed range is from 1 to 64.
3314
3315 @item knee
3316 Curve the sharp knee around the threshold to enter gain reduction more softly.
3317 Default is 2.828427125. Allowed range is from 1 to 8.
3318
3319 @item detection
3320 Choose if exact signal should be taken for detection or an RMS like one.
3321 Default is rms. Can be peak or rms.
3322
3323 @item link
3324 Choose if the average level between all channels or the louder channel affects
3325 the reduction.
3326 Default is average. Can be average or maximum.
3327
3328 @item level_sc
3329 Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
3330 @end table
3331
3332 @section silencedetect
3333
3334 Detect silence in an audio stream.
3335
3336 This filter logs a message when it detects that the input audio volume is less
3337 or equal to a noise tolerance value for a duration greater or equal to the
3338 minimum detected noise duration.
3339
3340 The printed times and duration are expressed in seconds.
3341
3342 The filter accepts the following options:
3343
3344 @table @option
3345 @item duration, d
3346 Set silence duration until notification (default is 2 seconds).
3347
3348 @item noise, n
3349 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
3350 specified value) or amplitude ratio. Default is -60dB, or 0.001.
3351 @end table
3352
3353 @subsection Examples
3354
3355 @itemize
3356 @item
3357 Detect 5 seconds of silence with -50dB noise tolerance:
3358 @example
3359 silencedetect=n=-50dB:d=5
3360 @end example
3361
3362 @item
3363 Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
3364 tolerance in @file{silence.mp3}:
3365 @example
3366 ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
3367 @end example
3368 @end itemize
3369
3370 @section silenceremove
3371
3372 Remove silence from the beginning, middle or end of the audio.
3373
3374 The filter accepts the following options:
3375
3376 @table @option
3377 @item start_periods
3378 This value is used to indicate if audio should be trimmed at beginning of
3379 the audio. A value of zero indicates no silence should be trimmed from the
3380 beginning. When specifying a non-zero value, it trims audio up until it
3381 finds non-silence. Normally, when trimming silence from beginning of audio
3382 the @var{start_periods} will be @code{1} but it can be increased to higher
3383 values to trim all audio up to specific count of non-silence periods.
3384 Default value is @code{0}.
3385
3386 @item start_duration
3387 Specify the amount of time that non-silence must be detected before it stops
3388 trimming audio. By increasing the duration, bursts of noises can be treated
3389 as silence and trimmed off. Default value is @code{0}.
3390
3391 @item start_threshold
3392 This indicates what sample value should be treated as silence. For digital
3393 audio, a value of @code{0} may be fine but for audio recorded from analog,
3394 you may wish to increase the value to account for background noise.
3395 Can be specified in dB (in case "dB" is appended to the specified value)
3396 or amplitude ratio. Default value is @code{0}.
3397
3398 @item stop_periods
3399 Set the count for trimming silence from the end of audio.
3400 To remove silence from the middle of a file, specify a @var{stop_periods}
3401 that is negative. This value is then treated as a positive value and is
3402 used to indicate the effect should restart processing as specified by
3403 @var{start_periods}, making it suitable for removing periods of silence
3404 in the middle of the audio.
3405 Default value is @code{0}.
3406
3407 @item stop_duration
3408 Specify a duration of silence that must exist before audio is not copied any
3409 more. By specifying a higher duration, silence that is wanted can be left in
3410 the audio.
3411 Default value is @code{0}.
3412
3413 @item stop_threshold
3414 This is the same as @option{start_threshold} but for trimming silence from
3415 the end of audio.
3416 Can be specified in dB (in case "dB" is appended to the specified value)
3417 or amplitude ratio. Default value is @code{0}.
3418
3419 @item leave_silence
3420 This indicates that @var{stop_duration} length of audio should be left intact
3421 at the beginning of each period of silence.
3422 For example, if you want to remove long pauses between words but do not want
3423 to remove the pauses completely. Default value is @code{0}.
3424
3425 @item detection
3426 Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
3427 and works better with digital silence which is exactly 0.
3428 Default value is @code{rms}.
3429
3430 @item window
3431 Set ratio used to calculate size of window for detecting silence.
3432 Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
3433 @end table
3434
3435 @subsection Examples
3436
3437 @itemize
3438 @item
3439 The following example shows how this filter can be used to start a recording
3440 that does not contain the delay at the start which usually occurs between
3441 pressing the record button and the start of the performance:
3442 @example
3443 silenceremove=1:5:0.02
3444 @end example
3445
3446 @item
3447 Trim all silence encountered from beginning to end where there is more than 1
3448 second of silence in audio:
3449 @example
3450 silenceremove=0:0:0:-1:1:-90dB
3451 @end example
3452 @end itemize
3453
3454 @section sofalizer
3455
3456 SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
3457 loudspeakers around the user for binaural listening via headphones (audio
3458 formats up to 9 channels supported).
3459 The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
3460 SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
3461 Austrian Academy of Sciences.
3462
3463 To enable compilation of this filter you need to configure FFmpeg with
3464 @code{--enable-netcdf}.
3465
3466 The filter accepts the following options:
3467
3468 @table @option
3469 @item sofa
3470 Set the SOFA file used for rendering.
3471
3472 @item gain
3473 Set gain applied to audio. Value is in dB. Default is 0.
3474
3475 @item rotation
3476 Set rotation of virtual loudspeakers in deg. Default is 0.
3477
3478 @item elevation
3479 Set elevation of virtual speakers in deg. Default is 0.
3480
3481 @item radius
3482 Set distance in meters between loudspeakers and the listener with near-field
3483 HRTFs. Default is 1.
3484
3485 @item type
3486 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
3487 processing audio in time domain which is slow.
3488 @var{freq} is processing audio in frequency domain which is fast.
3489 Default is @var{freq}.
3490
3491 @item speakers
3492 Set custom positions of virtual loudspeakers. Syntax for this option is:
3493 <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
3494 Each virtual loudspeaker is described with short channel name following with
3495 azimuth and elevation in degreees.
3496 Each virtual loudspeaker description is separated by '|'.
3497 For example to override front left and front right channel positions use:
3498 'speakers=FL 45 15|FR 345 15'.
3499 Descriptions with unrecognised channel names are ignored.
3500 @end table
3501
3502 @subsection Examples
3503
3504 @itemize
3505 @item
3506 Using ClubFritz6 sofa file:
3507 @example
3508 sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
3509 @end example
3510
3511 @item
3512 Using ClubFritz12 sofa file and bigger radius with small rotation:
3513 @example
3514 sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
3515 @end example
3516
3517 @item
3518 Similar as above but with custom speaker positions for front left, front right, back left and back right
3519 and also with custom gain:
3520 @example
3521 "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
3522 @end example
3523 @end itemize
3524
3525 @section stereotools
3526
3527 This filter has some handy utilities to manage stereo signals, for converting
3528 M/S stereo recordings to L/R signal while having control over the parameters
3529 or spreading the stereo image of master track.
3530
3531 The filter accepts the following options:
3532
3533 @table @option
3534 @item level_in
3535 Set input level before filtering for both channels. Defaults is 1.
3536 Allowed range is from 0.015625 to 64.
3537
3538 @item level_out
3539 Set output level after filtering for both channels. Defaults is 1.
3540 Allowed range is from 0.015625 to 64.
3541
3542 @item balance_in
3543 Set input balance between both channels. Default is 0.
3544 Allowed range is from -1 to 1.
3545
3546 @item balance_out
3547 Set output balance between both channels. Default is 0.
3548 Allowed range is from -1 to 1.
3549
3550 @item softclip
3551 Enable softclipping. Results in analog distortion instead of harsh digital 0dB
3552 clipping. Disabled by default.
3553
3554 @item mutel
3555 Mute the left channel. Disabled by default.
3556
3557 @item muter
3558 Mute the right channel. Disabled by default.
3559
3560 @item phasel
3561 Change the phase of the left channel. Disabled by default.
3562
3563 @item phaser
3564 Change the phase of the right channel. Disabled by default.
3565
3566 @item mode
3567 Set stereo mode. Available values are:
3568
3569 @table @samp
3570 @item lr>lr
3571 Left/Right to Left/Right, this is default.
3572
3573 @item lr>ms
3574 Left/Right to Mid/Side.
3575
3576 @item ms>lr
3577 Mid/Side to Left/Right.
3578
3579 @item lr>ll
3580 Left/Right to Left/Left.
3581
3582 @item lr>rr
3583 Left/Right to Right/Right.
3584
3585 @item lr>l+r
3586 Left/Right to Left + Right.
3587
3588 @item lr>rl
3589 Left/Right to Right/Left.
3590 @end table
3591
3592 @item slev
3593 Set level of side signal. Default is 1.
3594 Allowed range is from 0.015625 to 64.
3595
3596 @item sbal
3597 Set balance of side signal. Default is 0.
3598 Allowed range is from -1 to 1.
3599
3600 @item mlev
3601 Set level of the middle signal. Default is 1.
3602 Allowed range is from 0.015625 to 64.
3603
3604 @item mpan
3605 Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
3606
3607 @item base
3608 Set stereo base between mono and inversed channels. Default is 0.
3609 Allowed range is from -1 to 1.
3610
3611 @item delay
3612 Set delay in milliseconds how much to delay left from right channel and
3613 vice versa. Default is 0. Allowed range is from -20 to 20.
3614
3615 @item sclevel
3616 Set S/C level. Default is 1. Allowed range is from 1 to 100.
3617
3618 @item phase
3619 Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
3620 @end table
3621
3622 @subsection Examples
3623
3624 @itemize
3625 @item
3626 Apply karaoke like effect:
3627 @example
3628 stereotools=mlev=0.015625
3629 @end example
3630
3631 @item
3632 Convert M/S signal to L/R:
3633 @example
3634 "stereotools=mode=ms>lr"
3635 @end example
3636 @end itemize
3637
3638 @section stereowiden
3639
3640 This filter enhance the stereo effect by suppressing signal common to both
3641 channels and by delaying the signal of left into right and vice versa,
3642 thereby widening the stereo effect.
3643
3644 The filter accepts the following options:
3645
3646 @table @option
3647 @item delay
3648 Time in milliseconds of the delay of left signal into right and vice versa.
3649 Default is 20 milliseconds.
3650
3651 @item feedback
3652 Amount of gain in delayed signal into right and vice versa. Gives a delay
3653 effect of left signal in right output and vice versa which gives widening
3654 effect. Default is 0.3.
3655
3656 @item crossfeed
3657 Cross feed of left into right with inverted phase. This helps in suppressing
3658 the mono. If the value is 1 it will cancel all the signal common to both
3659 channels. Default is 0.3.
3660
3661 @item drymix
3662 Set level of input signal of original channel. Default is 0.8.
3663 @end table
3664
3665 @section treble
3666
3667 Boost or cut treble (upper) frequencies of the audio using a two-pole
3668 shelving filter with a response similar to that of a standard
3669 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
3670
3671 The filter accepts the following options:
3672
3673 @table @option
3674 @item gain, g
3675 Give the gain at whichever is the lower of ~22 kHz and the
3676 Nyquist frequency. Its useful range is about -20 (for a large cut)
3677 to +20 (for a large boost). Beware of clipping when using a positive gain.
3678
3679 @item frequency, f
3680 Set the filter's central frequency and so can be used
3681 to extend or reduce the frequency range to be boosted or cut.
3682 The default value is @code{3000} Hz.
3683
3684 @item width_type
3685 Set method to specify band-width of filter.
3686 @table @option
3687 @item h
3688 Hz
3689 @item q
3690 Q-Factor
3691 @item o
3692 octave
3693 @item s
3694 slope
3695 @end table
3696
3697 @item width, w
3698 Determine how steep is the filter's shelf transition.
3699 @end table
3700
3701 @section tremolo
3702
3703 Sinusoidal amplitude modulation.
3704
3705 The filter accepts the following options:
3706
3707 @table @option
3708 @item f
3709 Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
3710 (20 Hz or lower) will result in a tremolo effect.
3711 This filter may also be used as a ring modulator by specifying
3712 a modulation frequency higher than 20 Hz.
3713 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
3714
3715 @item d
3716 Depth of modulation as a percentage. Range is 0.0 - 1.0.
3717 Default value is 0.5.
3718 @end table
3719
3720 @section vibrato
3721
3722 Sinusoidal phase modulation.
3723
3724 The filter accepts the following options:
3725
3726 @table @option
3727 @item f
3728 Modulation frequency in Hertz.
3729 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
3730
3731 @item d
3732 Depth of modulation as a percentage. Range is 0.0 - 1.0.
3733 Default value is 0.5.
3734 @end table
3735
3736 @section volume
3737
3738 Adjust the input audio volume.
3739
3740 It accepts the following parameters:
3741 @table @option
3742
3743 @item volume
3744 Set audio volume expression.
3745
3746 Output values are clipped to the maximum value.
3747
3748 The output audio volume is given by the relation:
3749 @example
3750 @var{output_volume} = @var{volume} * @var{input_volume}
3751 @end example
3752
3753 The default value for @var{volume} is "1.0".
3754
3755 @item precision
3756 This parameter represents the mathematical precision.
3757
3758 It determines which input sample formats will be allowed, which affects the
3759 precision of the volume scaling.
3760
3761 @table @option
3762 @item fixed
3763 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
3764 @item float
3765 32-bit floating-point; this limits input sample format to FLT. (default)
3766 @item double
3767 64-bit floating-point; this limits input sample format to DBL.
3768 @end table
3769
3770 @item replaygain
3771 Choose the behaviour on encountering ReplayGain side data in input frames.
3772
3773 @table @option
3774 @item drop
3775 Remove ReplayGain side data, ignoring its contents (the default).
3776
3777 @item ignore
3778 Ignore ReplayGain side data, but leave it in the frame.
3779
3780 @item track
3781 Prefer the track gain, if present.
3782
3783 @item album
3784 Prefer the album gain, if present.
3785 @end table
3786
3787 @item replaygain_preamp
3788 Pre-amplification gain in dB to apply to the selected replaygain gain.
3789
3790 Default value for @var{replaygain_preamp} is 0.0.
3791
3792 @item eval
3793 Set when the volume expression is evaluated.
3794
3795 It accepts the following values:
3796 @table @samp
3797 @item once
3798 only evaluate expression once during the filter initialization, or
3799 when the @samp{volume} command is sent
3800
3801 @item frame
3802 evaluate expression for each incoming frame
3803 @end table
3804
3805 Default value is @samp{once}.
3806 @end table
3807
3808 The volume expression can contain the following parameters.
3809
3810 @table @option
3811 @item n
3812 frame number (starting at zero)
3813 @item nb_channels
3814 number of channels
3815 @item nb_consumed_samples
3816 number of samples consumed by the filter
3817 @item nb_samples
3818 number of samples in the current frame
3819 @item pos
3820 original frame position in the file
3821 @item pts
3822 frame PTS
3823 @item sample_rate
3824 sample rate
3825 @item startpts
3826 PTS at start of stream
3827 @item startt
3828 time at start of stream
3829 @item t
3830 frame time
3831 @item tb
3832 timestamp timebase
3833 @item volume
3834 last set volume value
3835 @end table
3836
3837 Note that when @option{eval} is set to @samp{once} only the
3838 @var{sample_rate} and @var{tb} variables are available, all other
3839 variables will evaluate to NAN.
3840
3841 @subsection Commands
3842
3843 This filter supports the following commands:
3844 @table @option
3845 @item volume
3846 Modify the volume expression.
3847 The command accepts the same syntax of the corresponding option.
3848
3849 If the specified expression is not valid, it is kept at its current
3850 value.
3851 @item replaygain_noclip
3852 Prevent clipping by limiting the gain applied.
3853
3854 Default value for @var{replaygain_noclip} is 1.
3855
3856 @end table
3857
3858 @subsection Examples
3859
3860 @itemize
3861 @item
3862 Halve the input audio volume:
3863 @example
3864 volume=volume=0.5
3865 volume=volume=1/2
3866 volume=volume=-6.0206dB
3867 @end example
3868
3869 In all the above example the named key for @option{volume} can be
3870 omitted, for example like in:
3871 @example
3872 volume=0.5
3873 @end example
3874
3875 @item
3876 Increase input audio power by 6 decibels using fixed-point precision:
3877 @example
3878 volume=volume=6dB:precision=fixed
3879 @end example
3880
3881 @item
3882 Fade volume after time 10 with an annihilation period of 5 seconds:
3883 @example
3884 volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
3885 @end example
3886 @end itemize
3887
3888 @section volumedetect
3889
3890 Detect the volume of the input video.
3891
3892 The filter has no parameters. The input is not modified. Statistics about
3893 the volume will be printed in the log when the input stream end is reached.
3894
3895 In particular it will show the mean volume (root mean square), maximum
3896 volume (on a per-sample basis), and the beginning of a histogram of the
3897 registered volume values (from the maximum value to a cumulated 1/1000 of
3898 the samples).
3899
3900 All volumes are in decibels relative to the maximum PCM value.
3901
3902 @subsection Examples
3903
3904 Here is an excerpt of the output:
3905 @example
3906 [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
3907 [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
3908 [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
3909 [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
3910 [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
3911 [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
3912 [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
3913 [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
3914 [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
3915 @end example
3916
3917 It means that:
3918 @itemize
3919 @item
3920 The mean square energy is approximately -27 dB, or 10^-2.7.
3921 @item
3922 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
3923 @item
3924 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
3925 @end itemize
3926
3927 In other words, raising the volume by +4 dB does not cause any clipping,
3928 raising it by +5 dB causes clipping for 6 samples, etc.
3929
3930 @c man end AUDIO FILTERS
3931
3932 @chapter Audio Sources
3933 @c man begin AUDIO SOURCES
3934
3935 Below is a description of the currently available audio sources.
3936
3937 @section abuffer
3938
3939 Buffer audio frames, and make them available to the filter chain.
3940
3941 This source is mainly intended for a programmatic use, in particular
3942 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
3943
3944 It accepts the following parameters:
3945 @table @option
3946
3947 @item time_base
3948 The timebase which will be used for timestamps of submitted frames. It must be
3949 either a floating-point number or in @var{numerator}/@var{denominator} form.
3950
3951 @item sample_rate
3952 The sample rate of the incoming audio buffers.
3953
3954 @item sample_fmt
3955 The sample format of the incoming audio buffers.
3956 Either a sample format name or its corresponding integer representation from
3957 the enum AVSampleFormat in @file{libavutil/samplefmt.h}
3958
3959 @item channel_layout
3960 The channel layout of the incoming audio buffers.
3961 Either a channel layout name from channel_layout_map in
3962 @file{libavutil/channel_layout.c} or its corresponding integer representation
3963 from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
3964
3965 @item channels
3966 The number of channels of the incoming audio buffers.
3967 If both @var{channels} and @var{channel_layout} are specified, then they
3968 must be consistent.
3969
3970 @end table
3971
3972 @subsection Examples
3973
3974 @example
3975 abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
3976 @end example
3977
3978 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
3979 Since the sample format with name "s16p" corresponds to the number
3980 6 and the "stereo" channel layout corresponds to the value 0x3, this is
3981 equivalent to:
3982 @example
3983 abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
3984 @end example
3985
3986 @section aevalsrc
3987
3988 Generate an audio signal specified by an expression.
3989
3990 This source accepts in input one or more expressions (one for each
3991 channel), which are evaluated and used to generate a corresponding
3992 audio signal.
3993
3994 This source accepts the following options:
3995
3996 @table @option
3997 @item exprs
3998 Set the '|'-separated expressions list for each separate channel. In case the
3999 @option{channel_layout} option is not specified, the selected channel layout
4000 depends on the number of provided expressions. Otherwise the last
4001 specified expression is applied to the remaining output channels.
4002
4003 @item channel_layout, c
4004 Set the channel layout. The number of channels in the specified layout
4005 must be equal to the number of specified expressions.
4006
4007 @item duration, d
4008 Set the minimum duration of the sourced audio. See
4009 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4010 for the accepted syntax.
4011 Note that the resulting duration may be greater than the specified
4012 duration, as the generated audio is always cut at the end of a
4013 complete frame.
4014
4015 If not specified, or the expressed duration is negative, the audio is
4016 supposed to be generated forever.
4017
4018 @item nb_samples, n
4019 Set the number of samples per channel per each output frame,
4020 default to 1024.
4021
4022 @item sample_rate, s
4023 Specify the sample rate, default to 44100.
4024 @end table
4025
4026 Each expression in @var{exprs} can contain the following constants:
4027
4028 @table @option
4029 @item n
4030 number of the evaluated sample, starting from 0
4031
4032 @item t
4033 time of the evaluated sample expressed in seconds, starting from 0
4034
4035 @item s
4036 sample rate
4037
4038 @end table
4039
4040 @subsection Examples
4041
4042 @itemize
4043 @item
4044 Generate silence:
4045 @example
4046 aevalsrc=0
4047 @end example
4048
4049 @item
4050 Generate a sin signal with frequency of 440 Hz, set sample rate to
4051 8000 Hz:
4052 @example
4053 aevalsrc="sin(440*2*PI*t):s=8000"
4054 @end example
4055
4056 @item
4057 Generate a two channels signal, specify the channel layout (Front
4058 Center + Back Center) explicitly:
4059 @example
4060 aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
4061 @end example
4062
4063 @item
4064 Generate white noise:
4065 @example
4066 aevalsrc="-2+random(0)"
4067 @end example
4068
4069 @item
4070 Generate an amplitude modulated signal:
4071 @example
4072 aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
4073 @end example
4074
4075 @item
4076 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
4077 @example
4078 aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
4079 @end example
4080
4081 @end itemize
4082
4083 @section anullsrc
4084
4085 The null audio source, return unprocessed audio frames. It is mainly useful
4086 as a template and to be employed in analysis / debugging tools, or as
4087 the source for filters which ignore the input data (for example the sox
4088 synth filter).
4089
4090 This source accepts the following options:
4091
4092 @table @option
4093
4094 @item channel_layout, cl
4095
4096 Specifies the channel layout, and can be either an integer or a string
4097 representing a channel layout. The default value of @var{channel_layout}
4098 is "stereo".
4099
4100 Check the channel_layout_map definition in
4101 @file{libavutil/channel_layout.c} for the mapping between strings and
4102 channel layout values.
4103
4104 @item sample_rate, r
4105 Specifies the sample rate, and defaults to 44100.
4106
4107 @item nb_samples, n
4108 Set the number of samples per requested frames.
4109
4110 @end table
4111
4112 @subsection Examples
4113
4114 @itemize
4115 @item
4116 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
4117 @example
4118 anullsrc=r=48000:cl=4
4119 @end example
4120
4121 @item
4122 Do the same operation with a more obvious syntax:
4123 @example
4124 anullsrc=r=48000:cl=mono
4125 @end example
4126 @end itemize
4127
4128 All the parameters need to be explicitly defined.
4129
4130 @section flite
4131
4132 Synthesize a voice utterance using the libflite library.
4133
4134 To enable compilation of this filter you need to configure FFmpeg with
4135 @code{--enable-libflite}.
4136
4137 Note that the flite library is not thread-safe.
4138
4139 The filter accepts the following options:
4140
4141 @table @option
4142
4143 @item list_voices
4144 If set to 1, list the names of the available voices and exit
4145 immediately. Default value is 0.
4146
4147 @item nb_samples, n
4148 Set the maximum number of samples per frame. Default value is 512.
4149
4150 @item textfile
4151 Set the filename containing the text to speak.
4152
4153 @item text
4154 Set the text to speak.
4155
4156 @item voice, v
4157 Set the voice to use for the speech synthesis. Default value is
4158 @code{kal}. See also the @var{list_voices} option.
4159 @end table
4160
4161 @subsection Examples
4162
4163 @itemize
4164 @item
4165 Read from file @file{speech.txt}, and synthesize the text using the
4166 standard flite voice:
4167 @example
4168 flite=textfile=speech.txt
4169 @end example
4170
4171 @item
4172 Read the specified text selecting the @code{slt} voice:
4173 @example
4174 flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
4175 @end example
4176
4177 @item
4178 Input text to ffmpeg:
4179 @example
4180 ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
4181 @end example
4182
4183 @item
4184 Make @file{ffplay} speak the specified text, using @code{flite} and
4185 the @code{lavfi} device:
4186 @example
4187 ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
4188 @end example
4189 @end itemize
4190
4191 For more information about libflite, check:
4192 @url{http://www.speech.cs.cmu.edu/flite/}
4193
4194 @section anoisesrc
4195
4196 Generate a noise audio signal.
4197
4198 The filter accepts the following options:
4199
4200 @table @option
4201 @item sample_rate, r
4202 Specify the sample rate. Default value is 48000 Hz.
4203
4204 @item amplitude, a
4205 Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
4206 is 1.0.
4207
4208 @item duration, d
4209 Specify the duration of the generated audio stream. Not specifying this option
4210 results in noise with an infinite length.
4211
4212 @item color, colour, c
4213 Specify the color of noise. Available noise colors are white, pink, and brown.
4214 Default color is white.
4215
4216 @item seed, s
4217 Specify a value used to seed the PRNG.
4218
4219 @item nb_samples, n
4220 Set the number of samples per each output frame, default is 1024.
4221 @end table
4222
4223 @subsection Examples
4224
4225 @itemize
4226
4227 @item
4228 Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
4229 @example
4230 anoisesrc=d=60:c=pink:r=44100:a=0.5
4231 @end example
4232 @end itemize
4233
4234 @section sine
4235
4236 Generate an audio signal made of a sine wave with amplitude 1/8.
4237
4238 The audio signal is bit-exact.
4239
4240 The filter accepts the following options:
4241
4242 @table @option
4243
4244 @item frequency, f
4245 Set the carrier frequency. Default is 440 Hz.
4246
4247 @item beep_factor, b
4248 Enable a periodic beep every second with frequency @var{beep_factor} times
4249 the carrier frequency. Default is 0, meaning the beep is disabled.
4250
4251 @item sample_rate, r
4252 Specify the sample rate, default is 44100.
4253
4254 @item duration, d
4255 Specify the duration of the generated audio stream.
4256
4257 @item samples_per_frame
4258 Set the number of samples per output frame.
4259
4260 The expression can contain the following constants:
4261
4262 @table @option
4263 @item n
4264 The (sequential) number of the output audio frame, starting from 0.
4265
4266 @item pts
4267 The PTS (Presentation TimeStamp) of the output audio frame,
4268 expressed in @var{TB} units.
4269
4270 @item t
4271 The PTS of the output audio frame, expressed in seconds.
4272
4273 @item TB
4274 The timebase of the output audio frames.
4275 @end table
4276
4277 Default is @code{1024}.
4278 @end table
4279
4280 @subsection Examples
4281
4282 @itemize
4283
4284 @item
4285 Generate a simple 440 Hz sine wave:
4286 @example
4287 sine
4288 @end example
4289
4290 @item
4291 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
4292 @example
4293 sine=220:4:d=5
4294 sine=f=220:b=4:d=5
4295 sine=frequency=220:beep_factor=4:duration=5
4296 @end example
4297
4298 @item
4299 Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
4300 pattern:
4301 @example
4302 sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
4303 @end example
4304 @end itemize
4305
4306 @c man end AUDIO SOURCES
4307
4308 @chapter Audio Sinks
4309 @c man begin AUDIO SINKS
4310
4311 Below is a description of the currently available audio sinks.
4312
4313 @section abuffersink
4314
4315 Buffer audio frames, and make them available to the end of filter chain.
4316
4317 This sink is mainly intended for programmatic use, in particular
4318 through the interface defined in @file{libavfilter/buffersink.h}
4319 or the options system.
4320
4321 It accepts a pointer to an AVABufferSinkContext structure, which
4322 defines the incoming buffers' formats, to be passed as the opaque
4323 parameter to @code{avfilter_init_filter} for initialization.
4324 @section anullsink
4325
4326 Null audio sink; do absolutely nothing with the input audio. It is
4327 mainly useful as a template and for use in analysis / debugging
4328 tools.
4329
4330 @c man end AUDIO SINKS
4331
4332 @chapter Video Filters
4333 @c man begin VIDEO FILTERS
4334
4335 When you configure your FFmpeg build, you can disable any of the
4336 existing filters using @code{--disable-filters}.
4337 The configure output will show the video filters included in your
4338 build.
4339
4340 Below is a description of the currently available video filters.
4341
4342 @section alphaextract
4343
4344 Extract the alpha component from the input as a grayscale video. This
4345 is especially useful with the @var{alphamerge} filter.
4346
4347 @section alphamerge
4348
4349 Add or replace the alpha component of the primary input with the
4350 grayscale value of a second input. This is intended for use with
4351 @var{alphaextract} to allow the transmission or storage of frame
4352 sequences that have alpha in a format that doesn't support an alpha
4353 channel.
4354
4355 For example, to reconstruct full frames from a normal YUV-encoded video
4356 and a separate video created with @var{alphaextract}, you might use:
4357 @example
4358 movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
4359 @end example
4360
4361 Since this filter is designed for reconstruction, it operates on frame
4362 sequences without considering timestamps, and terminates when either
4363 input reaches end of stream. This will cause problems if your encoding
4364 pipeline drops frames. If you're trying to apply an image as an
4365 overlay to a video stream, consider the @var{overlay} filter instead.
4366
4367 @section ass
4368
4369 Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
4370 and libavformat to work. On the other hand, it is limited to ASS (Advanced
4371 Substation Alpha) subtitles files.
4372
4373 This filter accepts the following option in addition to the common options from
4374 the @ref{subtitles} filter:
4375
4376 @table @option
4377 @item shaping
4378 Set the shaping engine
4379
4380 Available values are:
4381 @table @samp
4382 @item auto
4383 The default libass shaping engine, which is the best available.
4384 @item simple
4385 Fast, font-agnostic shaper that can do only substitutions
4386 @item complex
4387 Slower shaper using OpenType for substitutions and positioning
4388 @end table
4389
4390 The default is @code{auto}.
4391 @end table
4392
4393 @section atadenoise
4394 Apply an Adaptive Temporal Averaging Denoiser to the video input.
4395
4396 The filter accepts the following options:
4397
4398 @table @option
4399 @item 0a
4400 Set threshold A for 1st plane. Default is 0.02.
4401 Valid range is 0 to 0.3.
4402
4403 @item 0b
4404 Set threshold B for 1st plane. Default is 0.04.
4405 Valid range is 0 to 5.
4406
4407 @item 1a
4408 Set threshold A for 2nd plane. Default is 0.02.
4409 Valid range is 0 to 0.3.
4410
4411 @item 1b
4412 Set threshold B for 2nd plane. Default is 0.04.
4413 Valid range is 0 to 5.
4414
4415 @item 2a
4416 Set threshold A for 3rd plane. Default is 0.02.
4417 Valid range is 0 to 0.3.
4418
4419 @item 2b
4420 Set threshold B for 3rd plane. Default is 0.04.
4421 Valid range is 0 to 5.
4422
4423 Threshold A is designed to react on abrupt changes in the input signal and
4424 threshold B is designed to react on continuous changes in the input signal.
4425
4426 @item s
4427 Set number of frames filter will use for averaging. Default is 33. Must be odd
4428 number in range [5, 129].
4429
4430 @item p
4431 Set what planes of frame filter will use for averaging. Default is all.
4432 @end table
4433
4434 @section avgblur
4435
4436 Apply average blur filter.
4437
4438 The filter accepts the following options:
4439
4440 @table @option
4441 @item sizeX
4442 Set horizontal kernel size.
4443
4444 @item planes
4445 Set which planes to filter. By default all planes are filtered.
4446
4447 @item sizeY
4448 Set vertical kernel size, if zero it will be same as @code{sizeX}.
4449 Default is @code{0}.
4450 @end table
4451
4452 @section bbox
4453
4454 Compute the bounding box for the non-black pixels in the input frame
4455 luminance plane.
4456
4457 This filter computes the bounding box containing all the pixels with a
4458 luminance value greater than the minimum allowed value.
4459 The parameters describing the bounding box are printed on the filter
4460 log.
4461
4462 The filter accepts the following option:
4463
4464 @table @option
4465 @item min_val
4466 Set the minimal luminance value. Default is @code{16}.
4467 @end table
4468
4469 @section bitplanenoise
4470
4471 Show and measure bit plane noise.
4472
4473 The filter accepts the following options:
4474
4475 @table @option
4476 @item bitplane
4477 Set which plane to analyze. Default is @code{1}.
4478
4479 @item filter
4480 Filter out noisy pixels from @code{bitplane} set above.
4481 Default is disabled.
4482 @end table
4483
4484 @section blackdetect
4485
4486 Detect video intervals that are (almost) completely black. Can be
4487 useful to detect chapter transitions, commercials, or invalid
4488 recordings. Output lines contains the time for the start, end and
4489 duration of the detected black interval expressed in seconds.
4490
4491 In order to display the output lines, you need to set the loglevel at
4492 least to the AV_LOG_INFO value.
4493
4494 The filter accepts the following options:
4495
4496 @table @option
4497 @item black_min_duration, d
4498 Set the minimum detected black duration expressed in seconds. It must
4499 be a non-negative floating point number.
4500
4501 Default value is 2.0.
4502
4503 @item picture_black_ratio_th, pic_th
4504 Set the threshold for considering a picture "black".
4505 Express the minimum value for the ratio:
4506 @example
4507 @var{nb_black_pixels} / @var{nb_pixels}
4508 @end example
4509
4510 for which a picture is considered black.
4511 Default value is 0.98.
4512
4513 @item pixel_black_th, pix_th
4514 Set the threshold for considering a pixel "black".
4515
4516 The threshold expresses the maximum pixel luminance value for which a
4517 pixel is considered "black". The provided value is scaled according to
4518 the following equation:
4519 @example
4520 @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
4521 @end example
4522
4523 @var{luminance_range_size} and @var{luminance_minimum_value} depend on
4524 the input video format, the range is [0-255] for YUV full-range
4525 formats and [16-235] for YUV non full-range formats.
4526
4527 Default value is 0.10.
4528 @end table
4529
4530 The following example sets the maximum pixel threshold to the minimum
4531 value, and detects only black intervals of 2 or more seconds:
4532 @example
4533 blackdetect=d=2:pix_th=0.00
4534 @end example
4535
4536 @section blackframe
4537
4538 Detect frames that are (almost) completely black. Can be useful to
4539 detect chapter transitions or commercials. Output lines consist of
4540 the frame number of the detected frame, the percentage of blackness,
4541 the position in the file if known or -1 and the timestamp in seconds.
4542
4543 In order to display the output lines, you need to set the loglevel at
4544 least to the AV_LOG_INFO value.
4545
4546 This filter exports frame metadata @code{lavfi.blackframe.pblack}.
4547 The value represents the percentage of pixels in the picture that
4548 are below the threshold value.
4549
4550 It accepts the following parameters:
4551
4552 @table @option
4553
4554 @item amount
4555 The percentage of the pixels that have to be below the threshold; it defaults to
4556 @code{98}.
4557
4558 @item threshold, thresh
4559 The threshold below which a pixel value is considered black; it defaults to
4560 @code{32}.
4561
4562 @end table
4563
4564 @section blend, tblend
4565
4566 Blend two video frames into each other.
4567
4568 The @code{blend} filter takes two input streams and outputs one
4569 stream, the first input is the "top" layer and second input is
4570 "bottom" layer.  By default, the output terminates when the longest input terminates.
4571
4572 The @code{tblend} (time blend) filter takes two consecutive frames
4573 from one single stream, and outputs the result obtained by blending
4574 the new frame on top of the old frame.
4575
4576 A description of the accepted options follows.
4577
4578 @table @option
4579 @item c0_mode
4580 @item c1_mode
4581 @item c2_mode
4582 @item c3_mode
4583 @item all_mode
4584 Set blend mode for specific pixel component or all pixel components in case
4585 of @var{all_mode}. Default value is @code{normal}.
4586
4587 Available values for component modes are:
4588 @table @samp
4589 @item addition
4590 @item addition128
4591 @item and
4592 @item average
4593 @item burn
4594 @item darken
4595 @item difference
4596 @item difference128
4597 @item divide
4598 @item dodge
4599 @item freeze
4600 @item exclusion
4601 @item glow
4602 @item hardlight
4603 @item hardmix
4604 @item heat
4605 @item lighten
4606 @item linearlight
4607 @item multiply
4608 @item multiply128
4609 @item negation
4610 @item normal
4611 @item or
4612 @item overlay
4613 @item phoenix
4614 @item pinlight
4615 @item reflect
4616 @item screen
4617 @item softlight
4618 @item subtract
4619 @item vividlight
4620 @item xor
4621 @end table
4622
4623 @item c0_opacity
4624 @item c1_opacity
4625 @item c2_opacity
4626 @item c3_opacity
4627 @item all_opacity
4628 Set blend opacity for specific pixel component or all pixel components in case
4629 of @var{all_opacity}. Only used in combination with pixel component blend modes.
4630
4631 @item c0_expr
4632 @item c1_expr
4633 @item c2_expr
4634 @item c3_expr
4635 @item all_expr
4636 Set blend expression for specific pixel component or all pixel components in case
4637 of @var{all_expr}. Note that related mode options will be ignored if those are set.
4638
4639 The expressions can use the following variables:
4640
4641 @table @option
4642 @item N
4643 The sequential number of the filtered frame, starting from @code{0}.
4644
4645 @item X
4646 @item Y
4647 the coordinates of the current sample
4648
4649 @item W
4650 @item H
4651 the width and height of currently filtered plane
4652
4653 @item SW
4654 @item SH
4655 Width and height scale depending on the currently filtered plane. It is the
4656 ratio between the corresponding luma plane number of pixels and the current
4657 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
4658 @code{0.5,0.5} for chroma planes.
4659
4660 @item T
4661 Time of the current frame, expressed in seconds.
4662
4663 @item TOP, A
4664 Value of pixel component at current location for first video frame (top layer).
4665
4666 @item BOTTOM, B
4667 Value of pixel component at current location for second video frame (bottom layer).
4668 @end table
4669
4670 @item shortest
4671 Force termination when the shortest input terminates. Default is
4672 @code{0}. This option is only defined for the @code{blend} filter.
4673
4674 @item repeatlast
4675 Continue applying the last bottom frame after the end of the stream. A value of
4676 @code{0} disable the filter after the last frame of the bottom layer is reached.
4677 Default is @code{1}. This option is only defined for the @code{blend} filter.
4678 @end table
4679
4680 @subsection Examples
4681
4682 @itemize
4683 @item
4684 Apply transition from bottom layer to top layer in first 10 seconds:
4685 @example
4686 blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
4687 @end example
4688
4689 @item
4690 Apply 1x1 checkerboard effect:
4691 @example
4692 blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
4693 @end example
4694
4695 @item
4696 Apply uncover left effect:
4697 @example
4698 blend=all_expr='if(gte(N*SW+X,W),A,B)'
4699 @end example
4700
4701 @item
4702 Apply uncover down effect:
4703 @example
4704 blend=all_expr='if(gte(Y-N*SH,0),A,B)'
4705 @end example
4706
4707 @item
4708 Apply uncover up-left effect:
4709 @example
4710 blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
4711 @end example
4712
4713 @item
4714 Split diagonally video and shows top and bottom layer on each side:
4715 @example
4716 blend=all_expr=if(gt(X,Y*(W/H)),A,B)
4717 @end example
4718
4719 @item
4720 Display differences between the current and the previous frame:
4721 @example
4722 tblend=all_mode=difference128
4723 @end example
4724 @end itemize
4725
4726 @section boxblur
4727
4728 Apply a boxblur algorithm to the input video.
4729
4730 It accepts the following parameters:
4731
4732 @table @option
4733
4734 @item luma_radius, lr
4735 @item luma_power, lp
4736 @item chroma_radius, cr
4737 @item chroma_power, cp
4738 @item alpha_radius, ar
4739 @item alpha_power, ap
4740
4741 @end table
4742
4743 A description of the accepted options follows.
4744
4745 @table @option
4746 @item luma_radius, lr
4747 @item chroma_radius, cr
4748 @item alpha_radius, ar
4749 Set an expression for the box radius in pixels used for blurring the
4750 corresponding input plane.
4751
4752 The radius value must be a non-negative number, and must not be
4753 greater than the value of the expression @code{min(w,h)/2} for the
4754 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
4755 planes.
4756
4757 Default value for @option{luma_radius} is "2". If not specified,
4758 @option{chroma_radius} and @option{alpha_radius} default to the
4759 corresponding value set for @option{luma_radius}.
4760
4761 The expressions can contain the following constants:
4762 @table @option
4763 @item w
4764 @item h
4765 The input width and height in pixels.
4766
4767 @item cw
4768 @item ch
4769 The input chroma image width and height in pixels.
4770
4771 @item hsub
4772 @item vsub
4773 The horizontal and vertical chroma subsample values. For example, for the
4774 pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
4775 @end table
4776
4777 @item luma_power, lp
4778 @item chroma_power, cp
4779 @item alpha_power, ap
4780 Specify how many times the boxblur filter is applied to the
4781 corresponding plane.
4782
4783 Default value for @option{luma_power} is 2. If not specified,
4784 @option{chroma_power} and @option{alpha_power} default to the
4785 corresponding value set for @option{luma_power}.
4786
4787 A value of 0 will disable the effect.
4788 @end table
4789
4790 @subsection Examples
4791
4792 @itemize
4793 @item
4794 Apply a boxblur filter with the luma, chroma, and alpha radii
4795 set to 2:
4796 @example
4797 boxblur=luma_radius=2:luma_power=1
4798 boxblur=2:1
4799 @end example
4800
4801 @item
4802 Set the luma radius to 2, and alpha and chroma radius to 0:
4803 @example
4804 boxblur=2:1:cr=0:ar=0
4805 @end example
4806
4807 @item
4808 Set the luma and chroma radii to a fraction of the video dimension:
4809 @example
4810 boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
4811 @end example
4812 @end itemize
4813
4814 @section bwdif
4815
4816 Deinterlace the input video ("bwdif" stands for "Bob Weaver
4817 Deinterlacing Filter").
4818
4819 Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
4820 interpolation algorithms.
4821 It accepts the following parameters:
4822
4823 @table @option
4824 @item mode
4825 The interlacing mode to adopt. It accepts one of the following values:
4826
4827 @table @option
4828 @item 0, send_frame
4829 Output one frame for each frame.
4830 @item 1, send_field
4831 Output one frame for each field.
4832 @end table
4833
4834 The default value is @code{send_field}.
4835
4836 @item parity
4837 The picture field parity assumed for the input interlaced video. It accepts one
4838 of the following values:
4839
4840 @table @option
4841 @item 0, tff
4842 Assume the top field is first.
4843 @item 1, bff
4844 Assume the bottom field is first.
4845 @item -1, auto
4846 Enable automatic detection of field parity.
4847 @end table
4848
4849 The default value is @code{auto}.
4850 If the interlacing is unknown or the decoder does not export this information,
4851 top field first will be assumed.
4852
4853 @item deint
4854 Specify which frames to deinterlace. Accept one of the following
4855 values:
4856
4857 @table @option
4858 @item 0, all
4859 Deinterlace all frames.
4860 @item 1, interlaced
4861 Only deinterlace frames marked as interlaced.
4862 @end table
4863
4864 The default value is @code{all}.
4865 @end table
4866
4867 @section chromakey
4868 YUV colorspace color/chroma keying.
4869
4870 The filter accepts the following options:
4871
4872 @table @option
4873 @item color
4874 The color which will be replaced with transparency.
4875
4876 @item similarity
4877 Similarity percentage with the key color.
4878
4879 0.01 matches only the exact key color, while 1.0 matches everything.
4880
4881 @item blend
4882 Blend percentage.
4883
4884 0.0 makes pixels either fully transparent, or not transparent at all.
4885
4886 Higher values result in semi-transparent pixels, with a higher transparency
4887 the more similar the pixels color is to the key color.
4888
4889 @item yuv
4890 Signals that the color passed is already in YUV instead of RGB.
4891
4892 Litteral colors like "green" or "red" don't make sense with this enabled anymore.
4893 This can be used to pass exact YUV values as hexadecimal numbers.
4894 @end table
4895
4896 @subsection Examples
4897
4898 @itemize
4899 @item
4900 Make every green pixel in the input image transparent:
4901 @example
4902 ffmpeg -i input.png -vf chromakey=green out.png
4903 @end example
4904
4905 @item
4906 Overlay a greenscreen-video on top of a static black background.
4907 @example
4908 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
4909 @end example
4910 @end itemize
4911
4912 @section ciescope
4913
4914 Display CIE color diagram with pixels overlaid onto it.
4915
4916 The filter accepts the following options:
4917
4918 @table @option
4919 @item system
4920 Set color system.
4921
4922 @table @samp
4923 @item ntsc, 470m
4924 @item ebu, 470bg
4925 @item smpte
4926 @item 240m
4927 @item apple
4928 @item widergb
4929 @item cie1931
4930 @item rec709, hdtv
4931 @item uhdtv, rec2020
4932 @end table
4933
4934 @item cie
4935 Set CIE system.
4936
4937 @table @samp
4938 @item xyy
4939 @item ucs
4940 @item luv
4941 @end table
4942
4943 @item gamuts
4944 Set what gamuts to draw.
4945
4946 See @code{system} option for available values.
4947
4948 @item size, s
4949 Set ciescope size, by default set to 512.
4950
4951 @item intensity, i
4952 Set intensity used to map input pixel values to CIE diagram.
4953
4954 @item contrast
4955 Set contrast used to draw tongue colors that are out of active color system gamut.
4956
4957 @item corrgamma
4958 Correct gamma displayed on scope, by default enabled.
4959
4960 @item showwhite
4961 Show white point on CIE diagram, by default disabled.
4962
4963 @item gamma
4964 Set input gamma. Used only with XYZ input color space.
4965 @end table
4966
4967 @section codecview
4968
4969 Visualize information exported by some codecs.
4970
4971 Some codecs can export information through frames using side-data or other
4972 means. For example, some MPEG based codecs export motion vectors through the
4973 @var{export_mvs} flag in the codec @option{flags2} option.
4974
4975 The filter accepts the following option:
4976
4977 @table @option
4978 @item mv
4979 Set motion vectors to visualize.
4980
4981 Available flags for @var{mv} are:
4982
4983 @table @samp
4984 @item pf
4985 forward predicted MVs of P-frames
4986 @item bf
4987 forward predicted MVs of B-frames
4988 @item bb
4989 backward predicted MVs of B-frames
4990 @end table
4991
4992 @item qp
4993 Display quantization parameters using the chroma planes.
4994
4995 @item mv_type, mvt
4996 Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
4997
4998 Available flags for @var{mv_type} are:
4999
5000 @table @samp
5001 @item fp
5002 forward predicted MVs
5003 @item bp
5004 backward predicted MVs
5005 @end table
5006
5007 @item frame_type, ft
5008 Set frame type to visualize motion vectors of.
5009
5010 Available flags for @var{frame_type} are:
5011
5012 @table @samp
5013 @item if
5014 intra-coded frames (I-frames)
5015 @item pf
5016 predicted frames (P-frames)
5017 @item bf
5018 bi-directionally predicted frames (B-frames)
5019 @end table
5020 @end table
5021
5022 @subsection Examples
5023
5024 @itemize
5025 @item
5026 Visualize forward predicted MVs of all frames using @command{ffplay}:
5027 @example
5028 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
5029 @end example
5030
5031 @item
5032 Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
5033 @example
5034 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
5035 @end example
5036 @end itemize
5037
5038 @section colorbalance
5039 Modify intensity of primary colors (red, green and blue) of input frames.
5040
5041 The filter allows an input frame to be adjusted in the shadows, midtones or highlights
5042 regions for the red-cyan, green-magenta or blue-yellow balance.
5043
5044 A positive adjustment value shifts the balance towards the primary color, a negative
5045 value towards the complementary color.
5046
5047 The filter accepts the following options:
5048
5049 @table @option
5050 @item rs
5051 @item gs
5052 @item bs
5053 Adjust red, green and blue shadows (darkest pixels).
5054
5055 @item rm
5056 @item gm
5057 @item bm
5058 Adjust red, green and blue midtones (medium pixels).
5059
5060 @item rh
5061 @item gh
5062 @item bh
5063 Adjust red, green and blue highlights (brightest pixels).
5064
5065 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
5066 @end table
5067
5068 @subsection Examples
5069
5070 @itemize
5071 @item
5072 Add red color cast to shadows:
5073 @example
5074 colorbalance=rs=.3
5075 @end example
5076 @end itemize
5077
5078 @section colorkey
5079 RGB colorspace color keying.
5080
5081 The filter accepts the following options:
5082
5083 @table @option
5084 @item color
5085 The color which will be replaced with transparency.
5086
5087 @item similarity
5088 Similarity percentage with the key color.
5089
5090 0.01 matches only the exact key color, while 1.0 matches everything.
5091
5092 @item blend
5093 Blend percentage.
5094
5095 0.0 makes pixels either fully transparent, or not transparent at all.
5096
5097 Higher values result in semi-transparent pixels, with a higher transparency
5098 the more similar the pixels color is to the key color.
5099 @end table
5100
5101 @subsection Examples
5102
5103 @itemize
5104 @item
5105 Make every green pixel in the input image transparent:
5106 @example
5107 ffmpeg -i input.png -vf colorkey=green out.png
5108 @end example
5109
5110 @item
5111 Overlay a greenscreen-video on top of a static background image.
5112 @example
5113 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
5114 @end example
5115 @end itemize
5116
5117 @section colorlevels
5118
5119 Adjust video input frames using levels.
5120
5121 The filter accepts the following options:
5122
5123 @table @option
5124 @item rimin
5125 @item gimin
5126 @item bimin
5127 @item aimin
5128 Adjust red, green, blue and alpha input black point.
5129 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
5130
5131 @item rimax
5132 @item gimax
5133 @item bimax
5134 @item aimax
5135 Adjust red, green, blue and alpha input white point.
5136 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
5137
5138 Input levels are used to lighten highlights (bright tones), darken shadows
5139 (dark tones), change the balance of bright and dark tones.
5140
5141 @item romin
5142 @item gomin
5143 @item bomin
5144 @item aomin
5145 Adjust red, green, blue and alpha output black point.
5146 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
5147
5148 @item romax
5149 @item gomax
5150 @item bomax
5151 @item aomax
5152 Adjust red, green, blue and alpha output white point.
5153 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
5154
5155 Output levels allows manual selection of a constrained output level range.
5156 @end table
5157
5158 @subsection Examples
5159
5160 @itemize
5161 @item
5162 Make video output darker:
5163 @example
5164 colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
5165 @end example
5166
5167 @item
5168 Increase contrast:
5169 @example
5170 colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
5171 @end example
5172
5173 @item
5174 Make video output lighter:
5175 @example
5176 colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
5177 @end example
5178
5179 @item
5180 Increase brightness:
5181 @example
5182 colorlevels=romin=0.5:gomin=0.5:bomin=0.5
5183 @end example
5184 @end itemize
5185
5186 @section colorchannelmixer
5187
5188 Adjust video input frames by re-mixing color channels.
5189
5190 This filter modifies a color channel by adding the values associated to
5191 the other channels of the same pixels. For example if the value to
5192 modify is red, the output value will be:
5193 @example
5194 @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
5195 @end example
5196
5197 The filter accepts the following options:
5198
5199 @table @option
5200 @item rr
5201 @item rg
5202 @item rb
5203 @item ra
5204 Adjust contribution of input red, green, blue and alpha channels for output red channel.
5205 Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
5206
5207 @item gr
5208 @item gg
5209 @item gb
5210 @item ga
5211 Adjust contribution of input red, green, blue and alpha channels for output green channel.
5212 Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
5213
5214 @item br
5215 @item bg
5216 @item bb
5217 @item ba
5218 Adjust contribution of input red, green, blue and alpha channels for output blue channel.
5219 Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
5220
5221 @item ar
5222 @item ag
5223 @item ab
5224 @item aa
5225 Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
5226 Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
5227
5228 Allowed ranges for options are @code{[-2.0, 2.0]}.
5229 @end table
5230
5231 @subsection Examples
5232
5233 @itemize
5234 @item
5235 Convert source to grayscale:
5236 @example
5237 colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
5238 @end example
5239 @item
5240 Simulate sepia tones:
5241 @example
5242 colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
5243 @end example
5244 @end itemize
5245
5246 @section colormatrix
5247
5248 Convert color matrix.
5249
5250 The filter accepts the following options:
5251
5252 @table @option
5253 @item src
5254 @item dst
5255 Specify the source and destination color matrix. Both values must be
5256 specified.
5257
5258 The accepted values are:
5259 @table @samp
5260 @item bt709
5261 BT.709
5262
5263 @item fcc
5264 FCC
5265
5266 @item bt601
5267 BT.601
5268
5269 @item bt470
5270 BT.470
5271
5272 @item bt470bg
5273 BT.470BG
5274
5275 @item smpte170m
5276 SMPTE-170M
5277
5278 @item smpte240m
5279 SMPTE-240M
5280
5281 @item bt2020
5282 BT.2020
5283 @end table
5284 @end table
5285
5286 For example to convert from BT.601 to SMPTE-240M, use the command:
5287 @example
5288 colormatrix=bt601:smpte240m
5289 @end example
5290
5291 @section colorspace
5292
5293 Convert colorspace, transfer characteristics or color primaries.
5294 Input video needs to have an even size.
5295
5296 The filter accepts the following options:
5297
5298 @table @option
5299 @anchor{all}
5300 @item all
5301 Specify all color properties at once.
5302
5303 The accepted values are:
5304 @table @samp
5305 @item bt470m
5306 BT.470M
5307
5308 @item bt470bg
5309 BT.470BG
5310
5311 @item bt601-6-525
5312 BT.601-6 525
5313
5314 @item bt601-6-625
5315 BT.601-6 625
5316
5317 @item bt709
5318 BT.709
5319
5320 @item smpte170m
5321 SMPTE-170M
5322
5323 @item smpte240m
5324 SMPTE-240M
5325
5326 @item bt2020
5327 BT.2020
5328
5329 @end table
5330
5331 @anchor{space}
5332 @item space
5333 Specify output colorspace.
5334
5335 The accepted values are:
5336 @table @samp
5337 @item bt709
5338 BT.709
5339
5340 @item fcc
5341 FCC
5342
5343 @item bt470bg
5344 BT.470BG or BT.601-6 625
5345
5346 @item smpte170m
5347 SMPTE-170M or BT.601-6 525
5348
5349 @item smpte240m
5350 SMPTE-240M
5351
5352 @item ycgco
5353 YCgCo
5354
5355 @item bt2020ncl
5356 BT.2020 with non-constant luminance
5357
5358 @end table
5359
5360 @anchor{trc}
5361 @item trc
5362 Specify output transfer characteristics.
5363
5364 The accepted values are:
5365 @table @samp
5366 @item bt709
5367 BT.709
5368
5369 @item bt470m
5370 BT.470M
5371
5372 @item bt470bg
5373 BT.470BG
5374
5375 @item gamma22
5376 Constant gamma of 2.2
5377
5378 @item gamma28
5379 Constant gamma of 2.8
5380
5381 @item smpte170m
5382 SMPTE-170M, BT.601-6 625 or BT.601-6 525
5383
5384 @item smpte240m
5385 SMPTE-240M
5386
5387 @item srgb
5388 SRGB
5389
5390 @item iec61966-2-1
5391 iec61966-2-1
5392
5393 @item iec61966-2-4
5394 iec61966-2-4
5395
5396 @item xvycc
5397 xvycc
5398
5399 @item bt2020-10
5400 BT.2020 for 10-bits content
5401
5402 @item bt2020-12
5403 BT.2020 for 12-bits content
5404
5405 @end table
5406
5407 @anchor{primaries}
5408 @item primaries
5409 Specify output color primaries.
5410
5411 The accepted values are:
5412 @table @samp
5413 @item bt709
5414 BT.709
5415
5416 @item bt470m
5417 BT.470M
5418
5419 @item bt470bg
5420 BT.470BG or BT.601-6 625
5421
5422 @item smpte170m
5423 SMPTE-170M or BT.601-6 525
5424
5425 @item smpte240m
5426 SMPTE-240M
5427
5428 @item film
5429 film
5430
5431 @item smpte431
5432 SMPTE-431
5433
5434 @item smpte432
5435 SMPTE-432
5436
5437 @item bt2020
5438 BT.2020
5439
5440 @end table
5441
5442 @anchor{range}
5443 @item range
5444 Specify output color range.
5445
5446 The accepted values are:
5447 @table @samp
5448 @item tv
5449 TV (restricted) range
5450
5451 @item mpeg
5452 MPEG (restricted) range
5453
5454 @item pc
5455 PC (full) range
5456
5457 @item jpeg
5458 JPEG (full) range
5459
5460 @end table
5461
5462 @item format
5463 Specify output color format.
5464
5465 The accepted values are:
5466 @table @samp
5467 @item yuv420p
5468 YUV 4:2:0 planar 8-bits
5469
5470 @item yuv420p10
5471 YUV 4:2:0 planar 10-bits
5472
5473 @item yuv420p12
5474 YUV 4:2:0 planar 12-bits
5475
5476 @item yuv422p
5477 YUV 4:2:2 planar 8-bits
5478
5479 @item yuv422p10
5480 YUV 4:2:2 planar 10-bits
5481
5482 @item yuv422p12
5483 YUV 4:2:2 planar 12-bits
5484
5485 @item yuv444p
5486 YUV 4:4:4 planar 8-bits
5487
5488 @item yuv444p10
5489 YUV 4:4:4 planar 10-bits
5490
5491 @item yuv444p12
5492 YUV 4:4:4 planar 12-bits
5493
5494 @end table
5495
5496 @item fast
5497 Do a fast conversion, which skips gamma/primary correction. This will take
5498 significantly less CPU, but will be mathematically incorrect. To get output
5499 compatible with that produced by the colormatrix filter, use fast=1.
5500
5501 @item dither
5502 Specify dithering mode.
5503
5504 The accepted values are:
5505 @table @samp
5506 @item none
5507 No dithering
5508
5509 @item fsb
5510 Floyd-Steinberg dithering
5511 @end table
5512
5513 @item wpadapt
5514 Whitepoint adaptation mode.
5515
5516 The accepted values are:
5517 @table @samp
5518 @item bradford
5519 Bradford whitepoint adaptation
5520
5521 @item vonkries
5522 von Kries whitepoint adaptation
5523
5524 @item identity
5525 identity whitepoint adaptation (i.e. no whitepoint adaptation)
5526 @end table
5527
5528 @item iall
5529 Override all input properties at once. Same accepted values as @ref{all}.
5530
5531 @item ispace
5532 Override input colorspace. Same accepted values as @ref{space}.
5533
5534 @item iprimaries
5535 Override input color primaries. Same accepted values as @ref{primaries}.
5536
5537 @item itrc
5538 Override input transfer characteristics. Same accepted values as @ref{trc}.
5539
5540 @item irange
5541 Override input color range. Same accepted values as @ref{range}.
5542
5543 @end table
5544
5545 The filter converts the transfer characteristics, color space and color
5546 primaries to the specified user values. The output value, if not specified,
5547 is set to a default value based on the "all" property. If that property is
5548 also not specified, the filter will log an error. The output color range and
5549 format default to the same value as the input color range and format. The
5550 input transfer characteristics, color space, color primaries and color range
5551 should be set on the input data. If any of these are missing, the filter will
5552 log an error and no conversion will take place.
5553
5554 For example to convert the input to SMPTE-240M, use the command:
5555 @example
5556 colorspace=smpte240m
5557 @end example
5558
5559 @section convolution
5560
5561 Apply convolution 3x3 or 5x5 filter.
5562
5563 The filter accepts the following options:
5564
5565 @table @option
5566 @item 0m
5567 @item 1m
5568 @item 2m
5569 @item 3m
5570 Set matrix for each plane.
5571 Matrix is sequence of 9 or 25 signed integers.
5572
5573 @item 0rdiv
5574 @item 1rdiv
5575 @item 2rdiv
5576 @item 3rdiv
5577 Set multiplier for calculated value for each plane.
5578
5579 @item 0bias
5580 @item 1bias
5581 @item 2bias
5582 @item 3bias
5583 Set bias for each plane. This value is added to the result of the multiplication.
5584 Useful for making the overall image brighter or darker. Default is 0.0.
5585 @end table
5586
5587 @subsection Examples
5588
5589 @itemize
5590 @item
5591 Apply sharpen:
5592 @example
5593 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"
5594 @end example
5595
5596 @item
5597 Apply blur:
5598 @example
5599 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"
5600 @end example
5601
5602 @item
5603 Apply edge enhance:
5604 @example
5605 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"
5606 @end example
5607
5608 @item
5609 Apply edge detect:
5610 @example
5611 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"
5612 @end example
5613
5614 @item
5615 Apply emboss:
5616 @example
5617 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"
5618 @end example
5619 @end itemize
5620
5621 @section copy
5622
5623 Copy the input source unchanged to the output. This is mainly useful for
5624 testing purposes.
5625
5626 @anchor{coreimage}
5627 @section coreimage
5628 Video filtering on GPU using Apple's CoreImage API on OSX.
5629
5630 Hardware acceleration is based on an OpenGL context. Usually, this means it is
5631 processed by video hardware. However, software-based OpenGL implementations
5632 exist which means there is no guarantee for hardware processing. It depends on
5633 the respective OSX.
5634
5635 There are many filters and image generators provided by Apple that come with a
5636 large variety of options. The filter has to be referenced by its name along
5637 with its options.
5638
5639 The coreimage filter accepts the following options:
5640 @table @option
5641 @item list_filters
5642 List all available filters and generators along with all their respective
5643 options as well as possible minimum and maximum values along with the default
5644 values.
5645 @example
5646 list_filters=true
5647 @end example
5648
5649 @item filter
5650 Specify all filters by their respective name and options.
5651 Use @var{list_filters} to determine all valid filter names and options.
5652 Numerical options are specified by a float value and are automatically clamped
5653 to their respective value range.  Vector and color options have to be specified
5654 by a list of space separated float values. Character escaping has to be done.
5655 A special option name @code{default} is available to use default options for a
5656 filter.
5657
5658 It is required to specify either @code{default} or at least one of the filter options.
5659 All omitted options are used with their default values.
5660 The syntax of the filter string is as follows:
5661 @example
5662 filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
5663 @end example
5664
5665 @item output_rect
5666 Specify a rectangle where the output of the filter chain is copied into the
5667 input image. It is given by a list of space separated float values:
5668 @example
5669 output_rect=x\ y\ width\ height
5670 @end example
5671 If not given, the output rectangle equals the dimensions of the input image.
5672 The output rectangle is automatically cropped at the borders of the input
5673 image. Negative values are valid for each component.
5674 @example
5675 output_rect=25\ 25\ 100\ 100
5676 @end example
5677 @end table
5678
5679 Several filters can be chained for successive processing without GPU-HOST
5680 transfers allowing for fast processing of complex filter chains.
5681 Currently, only filters with zero (generators) or exactly one (filters) input
5682 image and one output image are supported. Also, transition filters are not yet
5683 usable as intended.
5684
5685 Some filters generate output images with additional padding depending on the
5686 respective filter kernel. The padding is automatically removed to ensure the
5687 filter output has the same size as the input image.
5688
5689 For image generators, the size of the output image is determined by the
5690 previous output image of the filter chain or the input image of the whole
5691 filterchain, respectively. The generators do not use the pixel information of
5692 this image to generate their output. However, the generated output is
5693 blended onto this image, resulting in partial or complete coverage of the
5694 output image.
5695
5696 The @ref{coreimagesrc} video source can be used for generating input images
5697 which are directly fed into the filter chain. By using it, providing input
5698 images by another video source or an input video is not required.
5699
5700 @subsection Examples
5701
5702 @itemize
5703
5704 @item
5705 List all filters available:
5706 @example
5707 coreimage=list_filters=true
5708 @end example
5709
5710 @item
5711 Use the CIBoxBlur filter with default options to blur an image:
5712 @example
5713 coreimage=filter=CIBoxBlur@@default
5714 @end example
5715
5716 @item
5717 Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
5718 its center at 100x100 and a radius of 50 pixels:
5719 @example
5720 coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
5721 @end example
5722
5723 @item
5724 Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
5725 given as complete and escaped command-line for Apple's standard bash shell:
5726 @example
5727 ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
5728 @end example
5729 @end itemize
5730
5731 @section crop
5732
5733 Crop the input video to given dimensions.
5734
5735 It accepts the following parameters:
5736
5737 @table @option
5738 @item w, out_w
5739 The width of the output video. It defaults to @code{iw}.
5740 This expression is evaluated only once during the filter
5741 configuration, or when the @samp{w} or @samp{out_w} command is sent.
5742
5743 @item h, out_h
5744 The height of the output video. It defaults to @code{ih}.
5745 This expression is evaluated only once during the filter
5746 configuration, or when the @samp{h} or @samp{out_h} command is sent.
5747
5748 @item x
5749 The horizontal position, in the input video, of the left edge of the output
5750 video. It defaults to @code{(in_w-out_w)/2}.
5751 This expression is evaluated per-frame.
5752
5753 @item y
5754 The vertical position, in the input video, of the top edge of the output video.
5755 It defaults to @code{(in_h-out_h)/2}.
5756 This expression is evaluated per-frame.
5757
5758 @item keep_aspect
5759 If set to 1 will force the output display aspect ratio
5760 to be the same of the input, by changing the output sample aspect
5761 ratio. It defaults to 0.
5762
5763 @item exact
5764 Enable exact cropping. If enabled, subsampled videos will be cropped at exact
5765 width/height/x/y as specified and will not be rounded to nearest smaller value.
5766 It defaults to 0.
5767 @end table
5768
5769 The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
5770 expressions containing the following constants:
5771
5772 @table @option
5773 @item x
5774 @item y
5775 The computed values for @var{x} and @var{y}. They are evaluated for
5776 each new frame.
5777
5778 @item in_w
5779 @item in_h
5780 The input width and height.
5781
5782 @item iw
5783 @item ih
5784 These are the same as @var{in_w} and @var{in_h}.
5785
5786 @item out_w
5787 @item out_h
5788 The output (cropped) width and height.
5789
5790 @item ow
5791 @item oh
5792 These are the same as @var{out_w} and @var{out_h}.
5793
5794 @item a
5795 same as @var{iw} / @var{ih}
5796
5797 @item sar
5798 input sample aspect ratio
5799
5800 @item dar
5801 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
5802
5803 @item hsub
5804 @item vsub
5805 horizontal and vertical chroma subsample values. For example for the
5806 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
5807
5808 @item n
5809 The number of the input frame, starting from 0.
5810
5811 @item pos
5812 the position in the file of the input frame, NAN if unknown
5813
5814 @item t
5815 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
5816
5817 @end table
5818
5819 The expression for @var{out_w} may depend on the value of @var{out_h},
5820 and the expression for @var{out_h} may depend on @var{out_w}, but they
5821 cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
5822 evaluated after @var{out_w} and @var{out_h}.
5823
5824 The @var{x} and @var{y} parameters specify the expressions for the
5825 position of the top-left corner of the output (non-cropped) area. They
5826 are evaluated for each frame. If the evaluated value is not valid, it
5827 is approximated to the nearest valid value.
5828
5829 The expression for @var{x} may depend on @var{y}, and the expression
5830 for @var{y} may depend on @var{x}.
5831
5832 @subsection Examples
5833
5834 @itemize
5835 @item
5836 Crop area with size 100x100 at position (12,34).
5837 @example
5838 crop=100:100:12:34
5839 @end example
5840
5841 Using named options, the example above becomes:
5842 @example
5843 crop=w=100:h=100:x=12:y=34
5844 @end example
5845
5846 @item
5847 Crop the central input area with size 100x100:
5848 @example
5849 crop=100:100
5850 @end example
5851
5852 @item
5853 Crop the central input area with size 2/3 of the input video:
5854 @example
5855 crop=2/3*in_w:2/3*in_h
5856 @end example
5857
5858 @item
5859 Crop the input video central square:
5860 @example
5861 crop=out_w=in_h
5862 crop=in_h
5863 @end example
5864
5865 @item
5866 Delimit the rectangle with the top-left corner placed at position
5867 100:100 and the right-bottom corner corresponding to the right-bottom
5868 corner of the input image.
5869 @example
5870 crop=in_w-100:in_h-100:100:100
5871 @end example
5872
5873 @item
5874 Crop 10 pixels from the left and right borders, and 20 pixels from
5875 the top and bottom borders
5876 @example
5877 crop=in_w-2*10:in_h-2*20
5878 @end example
5879
5880 @item
5881 Keep only the bottom right quarter of the input image:
5882 @example
5883 crop=in_w/2:in_h/2:in_w/2:in_h/2
5884 @end example
5885
5886 @item
5887 Crop height for getting Greek harmony:
5888 @example
5889 crop=in_w:1/PHI*in_w
5890 @end example
5891
5892 @item
5893 Apply trembling effect:
5894 @example
5895 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)
5896 @end example
5897
5898 @item
5899 Apply erratic camera effect depending on timestamp:
5900 @example
5901 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)"
5902 @end example
5903
5904 @item
5905 Set x depending on the value of y:
5906 @example
5907 crop=in_w/2:in_h/2:y:10+10*sin(n/10)
5908 @end example
5909 @end itemize
5910
5911 @subsection Commands
5912
5913 This filter supports the following commands:
5914 @table @option
5915 @item w, out_w
5916 @item h, out_h
5917 @item x
5918 @item y
5919 Set width/height of the output video and the horizontal/vertical position
5920 in the input video.
5921 The command accepts the same syntax of the corresponding option.
5922
5923 If the specified expression is not valid, it is kept at its current
5924 value.
5925 @end table
5926
5927 @section cropdetect
5928
5929 Auto-detect the crop size.
5930
5931 It calculates the necessary cropping parameters and prints the
5932 recommended parameters via the logging system. The detected dimensions
5933 correspond to the non-black area of the input video.
5934
5935 It accepts the following parameters:
5936
5937 @table @option
5938
5939 @item limit
5940 Set higher black value threshold, which can be optionally specified
5941 from nothing (0) to everything (255 for 8-bit based formats). An intensity
5942 value greater to the set value is considered non-black. It defaults to 24.
5943 You can also specify a value between 0.0 and 1.0 which will be scaled depending
5944 on the bitdepth of the pixel format.
5945
5946 @item round
5947 The value which the width/height should be divisible by. It defaults to
5948 16. The offset is automatically adjusted to center the video. Use 2 to
5949 get only even dimensions (needed for 4:2:2 video). 16 is best when
5950 encoding to most video codecs.
5951
5952 @item reset_count, reset
5953 Set the counter that determines after how many frames cropdetect will
5954 reset the previously detected largest video area and start over to
5955 detect the current optimal crop area. Default value is 0.
5956
5957 This can be useful when channel logos distort the video area. 0
5958 indicates 'never reset', and returns the largest area encountered during
5959 playback.
5960 @end table
5961
5962 @anchor{curves}
5963 @section curves
5964
5965 Apply color adjustments using curves.
5966
5967 This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
5968 component (red, green and blue) has its values defined by @var{N} key points
5969 tied from each other using a smooth curve. The x-axis represents the pixel
5970 values from the input frame, and the y-axis the new pixel values to be set for
5971 the output frame.
5972
5973 By default, a component curve is defined by the two points @var{(0;0)} and
5974 @var{(1;1)}. This creates a straight line where each original pixel value is
5975 "adjusted" to its own value, which means no change to the image.
5976
5977 The filter allows you to redefine these two points and add some more. A new
5978 curve (using a natural cubic spline interpolation) will be define to pass
5979 smoothly through all these new coordinates. The new defined points needs to be
5980 strictly increasing over the x-axis, and their @var{x} and @var{y} values must
5981 be in the @var{[0;1]} interval.  If the computed curves happened to go outside
5982 the vector spaces, the values will be clipped accordingly.
5983
5984 The filter accepts the following options:
5985
5986 @table @option
5987 @item preset
5988 Select one of the available color presets. This option can be used in addition
5989 to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
5990 options takes priority on the preset values.
5991 Available presets are:
5992 @table @samp
5993 @item none
5994 @item color_negative
5995 @item cross_process
5996 @item darker
5997 @item increase_contrast
5998 @item lighter
5999 @item linear_contrast
6000 @item medium_contrast
6001 @item negative
6002 @item strong_contrast
6003 @item vintage
6004 @end table
6005 Default is @code{none}.
6006 @item master, m
6007 Set the master key points. These points will define a second pass mapping. It
6008 is sometimes called a "luminance" or "value" mapping. It can be used with
6009 @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
6010 post-processing LUT.
6011 @item red, r
6012 Set the key points for the red component.
6013 @item green, g
6014 Set the key points for the green component.
6015 @item blue, b
6016 Set the key points for the blue component.
6017 @item all
6018 Set the key points for all components (not including master).
6019 Can be used in addition to the other key points component
6020 options. In this case, the unset component(s) will fallback on this
6021 @option{all} setting.
6022 @item psfile
6023 Specify a Photoshop curves file (@code{.acv}) to import the settings from.
6024 @item plot
6025 Save Gnuplot script of the curves in specified file.
6026 @end table
6027
6028 To avoid some filtergraph syntax conflicts, each key points list need to be
6029 defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
6030
6031 @subsection Examples
6032
6033 @itemize
6034 @item
6035 Increase slightly the middle level of blue:
6036 @example
6037 curves=blue='0/0 0.5/0.58 1/1'
6038 @end example
6039
6040 @item
6041 Vintage effect:
6042 @example
6043 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'
6044 @end example
6045 Here we obtain the following coordinates for each components:
6046 @table @var
6047 @item red
6048 @code{(0;0.11) (0.42;0.51) (1;0.95)}
6049 @item green
6050 @code{(0;0) (0.50;0.48) (1;1)}
6051 @item blue
6052 @code{(0;0.22) (0.49;0.44) (1;0.80)}
6053 @end table
6054
6055 @item
6056 The previous example can also be achieved with the associated built-in preset:
6057 @example
6058 curves=preset=vintage
6059 @end example
6060
6061 @item
6062 Or simply:
6063 @example
6064 curves=vintage
6065 @end example
6066
6067 @item
6068 Use a Photoshop preset and redefine the points of the green component:
6069 @example
6070 curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
6071 @end example
6072
6073 @item
6074 Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
6075 and @command{gnuplot}:
6076 @example
6077 ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
6078 gnuplot -p /tmp/curves.plt
6079 @end example
6080 @end itemize
6081
6082 @section datascope
6083
6084 Video data analysis filter.
6085
6086 This filter shows hexadecimal pixel values of part of video.
6087
6088 The filter accepts the following options:
6089
6090 @table @option
6091 @item size, s
6092 Set output video size.
6093
6094 @item x
6095 Set x offset from where to pick pixels.
6096
6097 @item y
6098 Set y offset from where to pick pixels.
6099
6100 @item mode
6101 Set scope mode, can be one of the following:
6102 @table @samp
6103 @item mono
6104 Draw hexadecimal pixel values with white color on black background.
6105
6106 @item color
6107 Draw hexadecimal pixel values with input video pixel color on black
6108 background.
6109
6110 @item color2
6111 Draw hexadecimal pixel values on color background picked from input video,
6112 the text color is picked in such way so its always visible.
6113 @end table
6114
6115 @item axis
6116 Draw rows and columns numbers on left and top of video.
6117
6118 @item opacity
6119 Set background opacity.
6120 @end table
6121
6122 @section dctdnoiz
6123
6124 Denoise frames using 2D DCT (frequency domain filtering).
6125
6126 This filter is not designed for real time.
6127
6128 The filter accepts the following options:
6129
6130 @table @option
6131 @item sigma, s
6132 Set the noise sigma constant.
6133
6134 This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
6135 coefficient (absolute value) below this threshold with be dropped.
6136
6137 If you need a more advanced filtering, see @option{expr}.
6138
6139 Default is @code{0}.
6140
6141 @item overlap
6142 Set number overlapping pixels for each block. Since the filter can be slow, you
6143 may want to reduce this value, at the cost of a less effective filter and the
6144 risk of various artefacts.
6145
6146 If the overlapping value doesn't permit processing the whole input width or
6147 height, a warning will be displayed and according borders won't be denoised.
6148
6149 Default value is @var{blocksize}-1, which is the best possible setting.
6150
6151 @item expr, e
6152 Set the coefficient factor expression.
6153
6154 For each coefficient of a DCT block, this expression will be evaluated as a
6155 multiplier value for the coefficient.
6156
6157 If this is option is set, the @option{sigma} option will be ignored.
6158
6159 The absolute value of the coefficient can be accessed through the @var{c}
6160 variable.
6161
6162 @item n
6163 Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
6164 @var{blocksize}, which is the width and height of the processed blocks.
6165
6166 The default value is @var{3} (8x8) and can be raised to @var{4} for a
6167 @var{blocksize} of 16x16. Note that changing this setting has huge consequences
6168 on the speed processing. Also, a larger block size does not necessarily means a
6169 better de-noising.
6170 @end table
6171
6172 @subsection Examples
6173
6174 Apply a denoise with a @option{sigma} of @code{4.5}:
6175 @example
6176 dctdnoiz=4.5
6177 @end example
6178
6179 The same operation can be achieved using the expression system:
6180 @example
6181 dctdnoiz=e='gte(c, 4.5*3)'
6182 @end example
6183
6184 Violent denoise using a block size of @code{16x16}:
6185 @example
6186 dctdnoiz=15:n=4
6187 @end example
6188
6189 @section deband
6190
6191 Remove banding artifacts from input video.
6192 It works by replacing banded pixels with average value of referenced pixels.
6193
6194 The filter accepts the following options:
6195
6196 @table @option
6197 @item 1thr
6198 @item 2thr
6199 @item 3thr
6200 @item 4thr
6201 Set banding detection threshold for each plane. Default is 0.02.
6202 Valid range is 0.00003 to 0.5.
6203 If difference between current pixel and reference pixel is less than threshold,
6204 it will be considered as banded.
6205
6206 @item range, r
6207 Banding detection range in pixels. Default is 16. If positive, random number
6208 in range 0 to set value will be used. If negative, exact absolute value
6209 will be used.
6210 The range defines square of four pixels around current pixel.
6211
6212 @item direction, d
6213 Set direction in radians from which four pixel will be compared. If positive,
6214 random direction from 0 to set direction will be picked. If negative, exact of
6215 absolute value will be picked. For example direction 0, -PI or -2*PI radians
6216 will pick only pixels on same row and -PI/2 will pick only pixels on same
6217 column.
6218
6219 @item blur, b
6220 If enabled, current pixel is compared with average value of all four
6221 surrounding pixels. The default is enabled. If disabled current pixel is
6222 compared with all four surrounding pixels. The pixel is considered banded
6223 if only all four differences with surrounding pixels are less than threshold.
6224
6225 @item coupling, c
6226 If enabled, current pixel is changed if and only if all pixel components are banded,
6227 e.g. banding detection threshold is triggered for all color components.
6228 The default is disabled.
6229 @end table
6230
6231 @anchor{decimate}
6232 @section decimate
6233
6234 Drop duplicated frames at regular intervals.
6235
6236 The filter accepts the following options:
6237
6238 @table @option
6239 @item cycle
6240 Set the number of frames from which one will be dropped. Setting this to
6241 @var{N} means one frame in every batch of @var{N} frames will be dropped.
6242 Default is @code{5}.
6243
6244 @item dupthresh
6245 Set the threshold for duplicate detection. If the difference metric for a frame
6246 is less than or equal to this value, then it is declared as duplicate. Default
6247 is @code{1.1}
6248
6249 @item scthresh
6250 Set scene change threshold. Default is @code{15}.
6251
6252 @item blockx
6253 @item blocky
6254 Set the size of the x and y-axis blocks used during metric calculations.
6255 Larger blocks give better noise suppression, but also give worse detection of
6256 small movements. Must be a power of two. Default is @code{32}.
6257
6258 @item ppsrc
6259 Mark main input as a pre-processed input and activate clean source input
6260 stream. This allows the input to be pre-processed with various filters to help
6261 the metrics calculation while keeping the frame selection lossless. When set to
6262 @code{1}, the first stream is for the pre-processed input, and the second
6263 stream is the clean source from where the kept frames are chosen. Default is
6264 @code{0}.
6265
6266 @item chroma
6267 Set whether or not chroma is considered in the metric calculations. Default is
6268 @code{1}.
6269 @end table
6270
6271 @section deflate
6272
6273 Apply deflate effect to the video.
6274
6275 This filter replaces the pixel by the local(3x3) average by taking into account
6276 only values lower than the pixel.
6277
6278 It accepts the following options:
6279
6280 @table @option
6281 @item threshold0
6282 @item threshold1
6283 @item threshold2
6284 @item threshold3
6285 Limit the maximum change for each plane, default is 65535.
6286 If 0, plane will remain unchanged.
6287 @end table
6288
6289 @section dejudder
6290
6291 Remove judder produced by partially interlaced telecined content.
6292
6293 Judder can be introduced, for instance, by @ref{pullup} filter. If the original
6294 source was partially telecined content then the output of @code{pullup,dejudder}
6295 will have a variable frame rate. May change the recorded frame rate of the
6296 container. Aside from that change, this filter will not affect constant frame
6297 rate video.
6298
6299 The option available in this filter is:
6300 @table @option
6301
6302 @item cycle
6303 Specify the length of the window over which the judder repeats.
6304
6305 Accepts any integer greater than 1. Useful values are:
6306 @table @samp
6307
6308 @item 4
6309 If the original was telecined from 24 to 30 fps (Film to NTSC).
6310
6311 @item 5
6312 If the original was telecined from 25 to 30 fps (PAL to NTSC).
6313
6314 @item 20
6315 If a mixture of the two.
6316 @end table
6317
6318 The default is @samp{4}.
6319 @end table
6320
6321 @section delogo
6322
6323 Suppress a TV station logo by a simple interpolation of the surrounding
6324 pixels. Just set a rectangle covering the logo and watch it disappear
6325 (and sometimes something even uglier appear - your mileage may vary).
6326
6327 It accepts the following parameters:
6328 @table @option
6329
6330 @item x
6331 @item y
6332 Specify the top left corner coordinates of the logo. They must be
6333 specified.
6334
6335 @item w
6336 @item h
6337 Specify the width and height of the logo to clear. They must be
6338 specified.
6339
6340 @item band, t
6341 Specify the thickness of the fuzzy edge of the rectangle (added to
6342 @var{w} and @var{h}). The default value is 1. This option is
6343 deprecated, setting higher values should no longer be necessary and
6344 is not recommended.
6345
6346 @item show
6347 When set to 1, a green rectangle is drawn on the screen to simplify
6348 finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
6349 The default value is 0.
6350
6351 The rectangle is drawn on the outermost pixels which will be (partly)
6352 replaced with interpolated values. The values of the next pixels
6353 immediately outside this rectangle in each direction will be used to
6354 compute the interpolated pixel values inside the rectangle.
6355
6356 @end table
6357
6358 @subsection Examples
6359
6360 @itemize
6361 @item
6362 Set a rectangle covering the area with top left corner coordinates 0,0
6363 and size 100x77, and a band of size 10:
6364 @example
6365 delogo=x=0:y=0:w=100:h=77:band=10
6366 @end example
6367
6368 @end itemize
6369
6370 @section deshake
6371
6372 Attempt to fix small changes in horizontal and/or vertical shift. This
6373 filter helps remove camera shake from hand-holding a camera, bumping a
6374 tripod, moving on a vehicle, etc.
6375
6376 The filter accepts the following options:
6377
6378 @table @option
6379
6380 @item x
6381 @item y
6382 @item w
6383 @item h
6384 Specify a rectangular area where to limit the search for motion
6385 vectors.
6386 If desired the search for motion vectors can be limited to a
6387 rectangular area of the frame defined by its top left corner, width
6388 and height. These parameters have the same meaning as the drawbox
6389 filter which can be used to visualise the position of the bounding
6390 box.
6391
6392 This is useful when simultaneous movement of subjects within the frame
6393 might be confused for camera motion by the motion vector search.
6394
6395 If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
6396 then the full frame is used. This allows later options to be set
6397 without specifying the bounding box for the motion vector search.
6398
6399 Default - search the whole frame.
6400
6401 @item rx
6402 @item ry
6403 Specify the maximum extent of movement in x and y directions in the
6404 range 0-64 pixels. Default 16.
6405
6406 @item edge
6407 Specify how to generate pixels to fill blanks at the edge of the
6408 frame. Available values are:
6409 @table @samp
6410 @item blank, 0
6411 Fill zeroes at blank locations
6412 @item original, 1
6413 Original image at blank locations
6414 @item clamp, 2
6415 Extruded edge value at blank locations
6416 @item mirror, 3
6417 Mirrored edge at blank locations
6418 @end table
6419 Default value is @samp{mirror}.
6420
6421 @item blocksize
6422 Specify the blocksize to use for motion search. Range 4-128 pixels,
6423 default 8.
6424
6425 @item contrast
6426 Specify the contrast threshold for blocks. Only blocks with more than
6427 the specified contrast (difference between darkest and lightest
6428 pixels) will be considered. Range 1-255, default 125.
6429
6430 @item search
6431 Specify the search strategy. Available values are:
6432 @table @samp
6433 @item exhaustive, 0
6434 Set exhaustive search
6435 @item less, 1
6436 Set less exhaustive search.
6437 @end table
6438 Default value is @samp{exhaustive}.
6439
6440 @item filename
6441 If set then a detailed log of the motion search is written to the
6442 specified file.
6443
6444 @item opencl
6445 If set to 1, specify using OpenCL capabilities, only available if
6446 FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
6447
6448 @end table
6449
6450 @section detelecine
6451
6452 Apply an exact inverse of the telecine operation. It requires a predefined
6453 pattern specified using the pattern option which must be the same as that passed
6454 to the telecine filter.
6455
6456 This filter accepts the following options:
6457
6458 @table @option
6459 @item first_field
6460 @table @samp
6461 @item top, t
6462 top field first
6463 @item bottom, b
6464 bottom field first
6465 The default value is @code{top}.
6466 @end table
6467
6468 @item pattern
6469 A string of numbers representing the pulldown pattern you wish to apply.
6470 The default value is @code{23}.
6471
6472 @item start_frame
6473 A number representing position of the first frame with respect to the telecine
6474 pattern. This is to be used if the stream is cut. The default value is @code{0}.
6475 @end table
6476
6477 @section dilation
6478
6479 Apply dilation effect to the video.
6480
6481 This filter replaces the pixel by the local(3x3) maximum.
6482
6483 It accepts the following options:
6484
6485 @table @option
6486 @item threshold0
6487 @item threshold1
6488 @item threshold2
6489 @item threshold3
6490 Limit the maximum change for each plane, default is 65535.
6491 If 0, plane will remain unchanged.
6492
6493 @item coordinates
6494 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
6495 pixels are used.
6496
6497 Flags to local 3x3 coordinates maps like this:
6498
6499     1 2 3
6500     4   5
6501     6 7 8
6502 @end table
6503
6504 @section displace
6505
6506 Displace pixels as indicated by second and third input stream.
6507
6508 It takes three input streams and outputs one stream, the first input is the
6509 source, and second and third input are displacement maps.
6510
6511 The second input specifies how much to displace pixels along the
6512 x-axis, while the third input specifies how much to displace pixels
6513 along the y-axis.
6514 If one of displacement map streams terminates, last frame from that
6515 displacement map will be used.
6516
6517 Note that once generated, displacements maps can be reused over and over again.
6518
6519 A description of the accepted options follows.
6520
6521 @table @option
6522 @item edge
6523 Set displace behavior for pixels that are out of range.
6524
6525 Available values are:
6526 @table @samp
6527 @item blank
6528 Missing pixels are replaced by black pixels.
6529
6530 @item smear
6531 Adjacent pixels will spread out to replace missing pixels.
6532
6533 @item wrap
6534 Out of range pixels are wrapped so they point to pixels of other side.
6535 @end table
6536 Default is @samp{smear}.
6537
6538 @end table
6539
6540 @subsection Examples
6541
6542 @itemize
6543 @item
6544 Add ripple effect to rgb input of video size hd720:
6545 @example
6546 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
6547 @end example
6548
6549 @item
6550 Add wave effect to rgb input of video size hd720:
6551 @example
6552 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
6553 @end example
6554 @end itemize
6555
6556 @section drawbox
6557
6558 Draw a colored box on the input image.
6559
6560 It accepts the following parameters:
6561
6562 @table @option
6563 @item x
6564 @item y
6565 The expressions which specify the top left corner coordinates of the box. It defaults to 0.
6566
6567 @item width, w
6568 @item height, h
6569 The expressions which specify the width and height of the box; if 0 they are interpreted as
6570 the input width and height. It defaults to 0.
6571
6572 @item color, c
6573 Specify the color of the box to write. For the general syntax of this option,
6574 check the "Color" section in the ffmpeg-utils manual. If the special
6575 value @code{invert} is used, the box edge color is the same as the
6576 video with inverted luma.
6577
6578 @item thickness, t
6579 The expression which sets the thickness of the box edge. Default value is @code{3}.
6580
6581 See below for the list of accepted constants.
6582 @end table
6583
6584 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
6585 following constants:
6586
6587 @table @option
6588 @item dar
6589 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
6590
6591 @item hsub
6592 @item vsub
6593 horizontal and vertical chroma subsample values. For example for the
6594 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
6595
6596 @item in_h, ih
6597 @item in_w, iw
6598 The input width and height.
6599
6600 @item sar
6601 The input sample aspect ratio.
6602
6603 @item x
6604 @item y
6605 The x and y offset coordinates where the box is drawn.
6606
6607 @item w
6608 @item h
6609 The width and height of the drawn box.
6610
6611 @item t
6612 The thickness of the drawn box.
6613
6614 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
6615 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
6616
6617 @end table
6618
6619 @subsection Examples
6620
6621 @itemize
6622 @item
6623 Draw a black box around the edge of the input image:
6624 @example
6625 drawbox
6626 @end example
6627
6628 @item
6629 Draw a box with color red and an opacity of 50%:
6630 @example
6631 drawbox=10:20:200:60:red@@0.5
6632 @end example
6633
6634 The previous example can be specified as:
6635 @example
6636 drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
6637 @end example
6638
6639 @item
6640 Fill the box with pink color:
6641 @example
6642 drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
6643 @end example
6644
6645 @item
6646 Draw a 2-pixel red 2.40:1 mask:
6647 @example
6648 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
6649 @end example
6650 @end itemize
6651
6652 @section drawgrid
6653
6654 Draw a grid on the input image.
6655
6656 It accepts the following parameters:
6657
6658 @table @option
6659 @item x
6660 @item y
6661 The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
6662
6663 @item width, w
6664 @item height, h
6665 The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
6666 input width and height, respectively, minus @code{thickness}, so image gets
6667 framed. Default to 0.
6668
6669 @item color, c
6670 Specify the color of the grid. For the general syntax of this option,
6671 check the "Color" section in the ffmpeg-utils manual. If the special
6672 value @code{invert} is used, the grid color is the same as the
6673 video with inverted luma.
6674
6675 @item thickness, t
6676 The expression which sets the thickness of the grid line. Default value is @code{1}.
6677
6678 See below for the list of accepted constants.
6679 @end table
6680
6681 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
6682 following constants:
6683
6684 @table @option
6685 @item dar
6686 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
6687
6688 @item hsub
6689 @item vsub
6690 horizontal and vertical chroma subsample values. For example for the
6691 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
6692
6693 @item in_h, ih
6694 @item in_w, iw
6695 The input grid cell width and height.
6696
6697 @item sar
6698 The input sample aspect ratio.
6699
6700 @item x
6701 @item y
6702 The x and y coordinates of some point of grid intersection (meant to configure offset).
6703
6704 @item w
6705 @item h
6706 The width and height of the drawn cell.
6707
6708 @item t
6709 The thickness of the drawn cell.
6710
6711 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
6712 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
6713
6714 @end table
6715
6716 @subsection Examples
6717
6718 @itemize
6719 @item
6720 Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
6721 @example
6722 drawgrid=width=100:height=100:thickness=2:color=red@@0.5
6723 @end example
6724
6725 @item
6726 Draw a white 3x3 grid with an opacity of 50%:
6727 @example
6728 drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
6729 @end example
6730 @end itemize
6731
6732 @anchor{drawtext}
6733 @section drawtext
6734
6735 Draw a text string or text from a specified file on top of a video, using the
6736 libfreetype library.
6737
6738 To enable compilation of this filter, you need to configure FFmpeg with
6739 @code{--enable-libfreetype}.
6740 To enable default font fallback and the @var{font} option you need to
6741 configure FFmpeg with @code{--enable-libfontconfig}.
6742 To enable the @var{text_shaping} option, you need to configure FFmpeg with
6743 @code{--enable-libfribidi}.
6744
6745 @subsection Syntax
6746
6747 It accepts the following parameters:
6748
6749 @table @option
6750
6751 @item box
6752 Used to draw a box around text using the background color.
6753 The value must be either 1 (enable) or 0 (disable).
6754 The default value of @var{box} is 0.
6755
6756 @item boxborderw
6757 Set the width of the border to be drawn around the box using @var{boxcolor}.
6758 The default value of @var{boxborderw} is 0.
6759
6760 @item boxcolor
6761 The color to be used for drawing box around text. For the syntax of this
6762 option, check the "Color" section in the ffmpeg-utils manual.
6763
6764 The default value of @var{boxcolor} is "white".
6765
6766 @item line_spacing
6767 Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
6768 The default value of @var{line_spacing} is 0.
6769
6770 @item borderw
6771 Set the width of the border to be drawn around the text using @var{bordercolor}.
6772 The default value of @var{borderw} is 0.
6773
6774 @item bordercolor
6775 Set the color to be used for drawing border around text. For the syntax of this
6776 option, check the "Color" section in the ffmpeg-utils manual.
6777
6778 The default value of @var{bordercolor} is "black".
6779
6780 @item expansion
6781 Select how the @var{text} is expanded. Can be either @code{none},
6782 @code{strftime} (deprecated) or
6783 @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
6784 below for details.
6785
6786 @item basetime
6787 Set a start time for the count. Value is in microseconds. Only applied
6788 in the deprecated strftime expansion mode. To emulate in normal expansion
6789 mode use the @code{pts} function, supplying the start time (in seconds)
6790 as the second argument.
6791
6792 @item fix_bounds
6793 If true, check and fix text coords to avoid clipping.
6794
6795 @item fontcolor
6796 The color to be used for drawing fonts. For the syntax of this option, check
6797 the "Color" section in the ffmpeg-utils manual.
6798
6799 The default value of @var{fontcolor} is "black".
6800
6801 @item fontcolor_expr
6802 String which is expanded the same way as @var{text} to obtain dynamic
6803 @var{fontcolor} value. By default this option has empty value and is not
6804 processed. When this option is set, it overrides @var{fontcolor} option.
6805
6806 @item font
6807 The font family to be used for drawing text. By default Sans.
6808
6809 @item fontfile
6810 The font file to be used for drawing text. The path must be included.
6811 This parameter is mandatory if the fontconfig support is disabled.
6812
6813 @item alpha
6814 Draw the text applying alpha blending. The value can
6815 be a number between 0.0 and 1.0.
6816 The expression accepts the same variables @var{x, y} as well.
6817 The default value is 1.
6818 Please see @var{fontcolor_expr}.
6819
6820 @item fontsize
6821 The font size to be used for drawing text.
6822 The default value of @var{fontsize} is 16.
6823
6824 @item text_shaping
6825 If set to 1, attempt to shape the text (for example, reverse the order of
6826 right-to-left text and join Arabic characters) before drawing it.
6827 Otherwise, just draw the text exactly as given.
6828 By default 1 (if supported).
6829
6830 @item ft_load_flags
6831 The flags to be used for loading the fonts.
6832
6833 The flags map the corresponding flags supported by libfreetype, and are
6834 a combination of the following values:
6835 @table @var
6836 @item default
6837 @item no_scale
6838 @item no_hinting
6839 @item render
6840 @item no_bitmap
6841 @item vertical_layout
6842 @item force_autohint
6843 @item crop_bitmap
6844 @item pedantic
6845 @item ignore_global_advance_width
6846 @item no_recurse
6847 @item ignore_transform
6848 @item monochrome
6849 @item linear_design
6850 @item no_autohint
6851 @end table
6852
6853 Default value is "default".
6854
6855 For more information consult the documentation for the FT_LOAD_*
6856 libfreetype flags.
6857
6858 @item shadowcolor
6859 The color to be used for drawing a shadow behind the drawn text. For the
6860 syntax of this option, check the "Color" section in the ffmpeg-utils manual.
6861
6862 The default value of @var{shadowcolor} is "black".
6863
6864 @item shadowx
6865 @item shadowy
6866 The x and y offsets for the text shadow position with respect to the
6867 position of the text. They can be either positive or negative
6868 values. The default value for both is "0".
6869
6870 @item start_number
6871 The starting frame number for the n/frame_num variable. The default value
6872 is "0".
6873
6874 @item tabsize
6875 The size in number of spaces to use for rendering the tab.
6876 Default value is 4.
6877
6878 @item timecode
6879 Set the initial timecode representation in "hh:mm:ss[:;.]ff"
6880 format. It can be used with or without text parameter. @var{timecode_rate}
6881 option must be specified.
6882
6883 @item timecode_rate, rate, r
6884 Set the timecode frame rate (timecode only).
6885
6886 @item tc24hmax
6887 If set to 1, the output of the timecode option will wrap around at 24 hours.
6888 Default is 0 (disabled).
6889
6890 @item text
6891 The text string to be drawn. The text must be a sequence of UTF-8
6892 encoded characters.
6893 This parameter is mandatory if no file is specified with the parameter
6894 @var{textfile}.
6895
6896 @item textfile
6897 A text file containing text to be drawn. The text must be a sequence
6898 of UTF-8 encoded characters.
6899
6900 This parameter is mandatory if no text string is specified with the
6901 parameter @var{text}.
6902
6903 If both @var{text} and @var{textfile} are specified, an error is thrown.
6904
6905 @item reload
6906 If set to 1, the @var{textfile} will be reloaded before each frame.
6907 Be sure to update it atomically, or it may be read partially, or even fail.
6908
6909 @item x
6910 @item y
6911 The expressions which specify the offsets where text will be drawn
6912 within the video frame. They are relative to the top/left border of the
6913 output image.
6914
6915 The default value of @var{x} and @var{y} is "0".
6916
6917 See below for the list of accepted constants and functions.
6918 @end table
6919
6920 The parameters for @var{x} and @var{y} are expressions containing the
6921 following constants and functions:
6922
6923 @table @option
6924 @item dar
6925 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
6926
6927 @item hsub
6928 @item vsub
6929 horizontal and vertical chroma subsample values. For example for the
6930 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
6931
6932 @item line_h, lh
6933 the height of each text line
6934
6935 @item main_h, h, H
6936 the input height
6937
6938 @item main_w, w, W
6939 the input width
6940
6941 @item max_glyph_a, ascent
6942 the maximum distance from the baseline to the highest/upper grid
6943 coordinate used to place a glyph outline point, for all the rendered
6944 glyphs.
6945 It is a positive value, due to the grid's orientation with the Y axis
6946 upwards.
6947
6948 @item max_glyph_d, descent
6949 the maximum distance from the baseline to the lowest grid coordinate
6950 used to place a glyph outline point, for all the rendered glyphs.
6951 This is a negative value, due to the grid's orientation, with the Y axis
6952 upwards.
6953
6954 @item max_glyph_h
6955 maximum glyph height, that is the maximum height for all the glyphs
6956 contained in the rendered text, it is equivalent to @var{ascent} -
6957 @var{descent}.
6958
6959 @item max_glyph_w
6960 maximum glyph width, that is the maximum width for all the glyphs
6961 contained in the rendered text
6962
6963 @item n
6964 the number of input frame, starting from 0
6965
6966 @item rand(min, max)
6967 return a random number included between @var{min} and @var{max}
6968
6969 @item sar
6970 The input sample aspect ratio.
6971
6972 @item t
6973 timestamp expressed in seconds, NAN if the input timestamp is unknown
6974
6975 @item text_h, th
6976 the height of the rendered text
6977
6978 @item text_w, tw
6979 the width of the rendered text
6980
6981 @item x
6982 @item y
6983 the x and y offset coordinates where the text is drawn.
6984
6985 These parameters allow the @var{x} and @var{y} expressions to refer
6986 each other, so you can for example specify @code{y=x/dar}.
6987 @end table
6988
6989 @anchor{drawtext_expansion}
6990 @subsection Text expansion
6991
6992 If @option{expansion} is set to @code{strftime},
6993 the filter recognizes strftime() sequences in the provided text and
6994 expands them accordingly. Check the documentation of strftime(). This
6995 feature is deprecated.
6996
6997 If @option{expansion} is set to @code{none}, the text is printed verbatim.
6998
6999 If @option{expansion} is set to @code{normal} (which is the default),
7000 the following expansion mechanism is used.
7001
7002 The backslash character @samp{\}, followed by any character, always expands to
7003 the second character.
7004
7005 Sequences of the form @code{%@{...@}} are expanded. The text between the
7006 braces is a function name, possibly followed by arguments separated by ':'.
7007 If the arguments contain special characters or delimiters (':' or '@}'),
7008 they should be escaped.
7009
7010 Note that they probably must also be escaped as the value for the
7011 @option{text} option in the filter argument string and as the filter
7012 argument in the filtergraph description, and possibly also for the shell,
7013 that makes up to four levels of escaping; using a text file avoids these
7014 problems.
7015
7016 The following functions are available:
7017
7018 @table @command
7019
7020 @item expr, e
7021 The expression evaluation result.
7022
7023 It must take one argument specifying the expression to be evaluated,
7024 which accepts the same constants and functions as the @var{x} and
7025 @var{y} values. Note that not all constants should be used, for
7026 example the text size is not known when evaluating the expression, so
7027 the constants @var{text_w} and @var{text_h} will have an undefined
7028 value.
7029
7030 @item expr_int_format, eif
7031 Evaluate the expression's value and output as formatted integer.
7032
7033 The first argument is the expression to be evaluated, just as for the @var{expr} function.
7034 The second argument specifies the output format. Allowed values are @samp{x},
7035 @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
7036 @code{printf} function.
7037 The third parameter is optional and sets the number of positions taken by the output.
7038 It can be used to add padding with zeros from the left.
7039
7040 @item gmtime
7041 The time at which the filter is running, expressed in UTC.
7042 It can accept an argument: a strftime() format string.
7043
7044 @item localtime
7045 The time at which the filter is running, expressed in the local time zone.
7046 It can accept an argument: a strftime() format string.
7047
7048 @item metadata
7049 Frame metadata. Takes one or two arguments.
7050
7051 The first argument is mandatory and specifies the metadata key.
7052
7053 The second argument is optional and specifies a default value, used when the
7054 metadata key is not found or empty.
7055
7056 @item n, frame_num
7057 The frame number, starting from 0.
7058
7059 @item pict_type
7060 A 1 character description of the current picture type.
7061
7062 @item pts
7063 The timestamp of the current frame.
7064 It can take up to three arguments.
7065
7066 The first argument is the format of the timestamp; it defaults to @code{flt}
7067 for seconds as a decimal number with microsecond accuracy; @code{hms} stands
7068 for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
7069 @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
7070 @code{localtime} stands for the timestamp of the frame formatted as
7071 local time zone time.
7072
7073 The second argument is an offset added to the timestamp.
7074
7075 If the format is set to @code{localtime} or @code{gmtime},
7076 a third argument may be supplied: a strftime() format string.
7077 By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
7078 @end table
7079
7080 @subsection Examples
7081
7082 @itemize
7083 @item
7084 Draw "Test Text" with font FreeSerif, using the default values for the
7085 optional parameters.
7086
7087 @example
7088 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
7089 @end example
7090
7091 @item
7092 Draw 'Test Text' with font FreeSerif of size 24 at position x=100
7093 and y=50 (counting from the top-left corner of the screen), text is
7094 yellow with a red box around it. Both the text and the box have an
7095 opacity of 20%.
7096
7097 @example
7098 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
7099           x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
7100 @end example
7101
7102 Note that the double quotes are not necessary if spaces are not used
7103 within the parameter list.
7104
7105 @item
7106 Show the text at the center of the video frame:
7107 @example
7108 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
7109 @end example
7110
7111 @item
7112 Show the text at a random position, switching to a new position every 30 seconds:
7113 @example
7114 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)"
7115 @end example
7116
7117 @item
7118 Show a text line sliding from right to left in the last row of the video
7119 frame. The file @file{LONG_LINE} is assumed to contain a single line
7120 with no newlines.
7121 @example
7122 drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
7123 @end example
7124
7125 @item
7126 Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
7127 @example
7128 drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
7129 @end example
7130
7131 @item
7132 Draw a single green letter "g", at the center of the input video.
7133 The glyph baseline is placed at half screen height.
7134 @example
7135 drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
7136 @end example
7137
7138 @item
7139 Show text for 1 second every 3 seconds:
7140 @example
7141 drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
7142 @end example
7143
7144 @item
7145 Use fontconfig to set the font. Note that the colons need to be escaped.
7146 @example
7147 drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
7148 @end example
7149
7150 @item
7151 Print the date of a real-time encoding (see strftime(3)):
7152 @example
7153 drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
7154 @end example
7155
7156 @item
7157 Show text fading in and out (appearing/disappearing):
7158 @example
7159 #!/bin/sh
7160 DS=1.0 # display start
7161 DE=10.0 # display end
7162 FID=1.5 # fade in duration
7163 FOD=5 # fade out duration
7164 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 @}"
7165 @end example
7166
7167 @item
7168 Horizontally align multiple separate texts. Note that @option{max_glyph_a}
7169 and the @option{fontsize} value are included in the @option{y} offset.
7170 @example
7171 drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
7172 drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
7173 @end example
7174
7175 @end itemize
7176
7177 For more information about libfreetype, check:
7178 @url{http://www.freetype.org/}.
7179
7180 For more information about fontconfig, check:
7181 @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
7182
7183 For more information about libfribidi, check:
7184 @url{http://fribidi.org/}.
7185
7186 @section edgedetect
7187
7188 Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
7189
7190 The filter accepts the following options:
7191
7192 @table @option
7193 @item low
7194 @item high
7195 Set low and high threshold values used by the Canny thresholding
7196 algorithm.
7197
7198 The high threshold selects the "strong" edge pixels, which are then
7199 connected through 8-connectivity with the "weak" edge pixels selected
7200 by the low threshold.
7201
7202 @var{low} and @var{high} threshold values must be chosen in the range
7203 [0,1], and @var{low} should be lesser or equal to @var{high}.
7204
7205 Default value for @var{low} is @code{20/255}, and default value for @var{high}
7206 is @code{50/255}.
7207
7208 @item mode
7209 Define the drawing mode.
7210
7211 @table @samp
7212 @item wires
7213 Draw white/gray wires on black background.
7214
7215 @item colormix
7216 Mix the colors to create a paint/cartoon effect.
7217 @end table
7218
7219 Default value is @var{wires}.
7220 @end table
7221
7222 @subsection Examples
7223
7224 @itemize
7225 @item
7226 Standard edge detection with custom values for the hysteresis thresholding:
7227 @example
7228 edgedetect=low=0.1:high=0.4
7229 @end example
7230
7231 @item
7232 Painting effect without thresholding:
7233 @example
7234 edgedetect=mode=colormix:high=0
7235 @end example
7236 @end itemize
7237
7238 @section eq
7239 Set brightness, contrast, saturation and approximate gamma adjustment.
7240
7241 The filter accepts the following options:
7242
7243 @table @option
7244 @item contrast
7245 Set the contrast expression. The value must be a float value in range
7246 @code{-2.0} to @code{2.0}. The default value is "1".
7247
7248 @item brightness
7249 Set the brightness expression. The value must be a float value in
7250 range @code{-1.0} to @code{1.0}. The default value is "0".
7251
7252 @item saturation
7253 Set the saturation expression. The value must be a float in
7254 range @code{0.0} to @code{3.0}. The default value is "1".
7255
7256 @item gamma
7257 Set the gamma expression. The value must be a float in range
7258 @code{0.1} to @code{10.0}.  The default value is "1".
7259
7260 @item gamma_r
7261 Set the gamma expression for red. The value must be a float in
7262 range @code{0.1} to @code{10.0}. The default value is "1".
7263
7264 @item gamma_g
7265 Set the gamma expression for green. The value must be a float in range
7266 @code{0.1} to @code{10.0}. The default value is "1".
7267
7268 @item gamma_b
7269 Set the gamma expression for blue. The value must be a float in range
7270 @code{0.1} to @code{10.0}. The default value is "1".
7271
7272 @item gamma_weight
7273 Set the gamma weight expression. It can be used to reduce the effect
7274 of a high gamma value on bright image areas, e.g. keep them from
7275 getting overamplified and just plain white. The value must be a float
7276 in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
7277 gamma correction all the way down while @code{1.0} leaves it at its
7278 full strength. Default is "1".
7279
7280 @item eval
7281 Set when the expressions for brightness, contrast, saturation and
7282 gamma expressions are evaluated.
7283
7284 It accepts the following values:
7285 @table @samp
7286 @item init
7287 only evaluate expressions once during the filter initialization or
7288 when a command is processed
7289
7290 @item frame
7291 evaluate expressions for each incoming frame
7292 @end table
7293
7294 Default value is @samp{init}.
7295 @end table
7296
7297 The expressions accept the following parameters:
7298 @table @option
7299 @item n
7300 frame count of the input frame starting from 0
7301
7302 @item pos
7303 byte position of the corresponding packet in the input file, NAN if
7304 unspecified
7305
7306 @item r
7307 frame rate of the input video, NAN if the input frame rate is unknown
7308
7309 @item t
7310 timestamp expressed in seconds, NAN if the input timestamp is unknown
7311 @end table
7312
7313 @subsection Commands
7314 The filter supports the following commands:
7315
7316 @table @option
7317 @item contrast
7318 Set the contrast expression.
7319
7320 @item brightness
7321 Set the brightness expression.
7322
7323 @item saturation
7324 Set the saturation expression.
7325
7326 @item gamma
7327 Set the gamma expression.
7328
7329 @item gamma_r
7330 Set the gamma_r expression.
7331
7332 @item gamma_g
7333 Set gamma_g expression.
7334
7335 @item gamma_b
7336 Set gamma_b expression.
7337
7338 @item gamma_weight
7339 Set gamma_weight expression.
7340
7341 The command accepts the same syntax of the corresponding option.
7342
7343 If the specified expression is not valid, it is kept at its current
7344 value.
7345
7346 @end table
7347
7348 @section erosion
7349
7350 Apply erosion effect to the video.
7351
7352 This filter replaces the pixel by the local(3x3) minimum.
7353
7354 It accepts the following options:
7355
7356 @table @option
7357 @item threshold0
7358 @item threshold1
7359 @item threshold2
7360 @item threshold3
7361 Limit the maximum change for each plane, default is 65535.
7362 If 0, plane will remain unchanged.
7363
7364 @item coordinates
7365 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
7366 pixels are used.
7367
7368 Flags to local 3x3 coordinates maps like this:
7369
7370     1 2 3
7371     4   5
7372     6 7 8
7373 @end table
7374
7375 @section extractplanes
7376
7377 Extract color channel components from input video stream into
7378 separate grayscale video streams.
7379
7380 The filter accepts the following option:
7381
7382 @table @option
7383 @item planes
7384 Set plane(s) to extract.
7385
7386 Available values for planes are:
7387 @table @samp
7388 @item y
7389 @item u
7390 @item v
7391 @item a
7392 @item r
7393 @item g
7394 @item b
7395 @end table
7396
7397 Choosing planes not available in the input will result in an error.
7398 That means you cannot select @code{r}, @code{g}, @code{b} planes
7399 with @code{y}, @code{u}, @code{v} planes at same time.
7400 @end table
7401
7402 @subsection Examples
7403
7404 @itemize
7405 @item
7406 Extract luma, u and v color channel component from input video frame
7407 into 3 grayscale outputs:
7408 @example
7409 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
7410 @end example
7411 @end itemize
7412
7413 @section elbg
7414
7415 Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
7416
7417 For each input image, the filter will compute the optimal mapping from
7418 the input to the output given the codebook length, that is the number
7419 of distinct output colors.
7420
7421 This filter accepts the following options.
7422
7423 @table @option
7424 @item codebook_length, l
7425 Set codebook length. The value must be a positive integer, and
7426 represents the number of distinct output colors. Default value is 256.
7427
7428 @item nb_steps, n
7429 Set the maximum number of iterations to apply for computing the optimal
7430 mapping. The higher the value the better the result and the higher the
7431 computation time. Default value is 1.
7432
7433 @item seed, s
7434 Set a random seed, must be an integer included between 0 and
7435 UINT32_MAX. If not specified, or if explicitly set to -1, the filter
7436 will try to use a good random seed on a best effort basis.
7437
7438 @item pal8
7439 Set pal8 output pixel format. This option does not work with codebook
7440 length greater than 256.
7441 @end table
7442
7443 @section fade
7444
7445 Apply a fade-in/out effect to the input video.
7446
7447 It accepts the following parameters:
7448
7449 @table @option
7450 @item type, t
7451 The effect type can be either "in" for a fade-in, or "out" for a fade-out
7452 effect.
7453 Default is @code{in}.
7454
7455 @item start_frame, s
7456 Specify the number of the frame to start applying the fade
7457 effect at. Default is 0.
7458
7459 @item nb_frames, n
7460 The number of frames that the fade effect lasts. At the end of the
7461 fade-in effect, the output video will have the same intensity as the input video.
7462 At the end of the fade-out transition, the output video will be filled with the
7463 selected @option{color}.
7464 Default is 25.
7465
7466 @item alpha
7467 If set to 1, fade only alpha channel, if one exists on the input.
7468 Default value is 0.
7469
7470 @item start_time, st
7471 Specify the timestamp (in seconds) of the frame to start to apply the fade
7472 effect. If both start_frame and start_time are specified, the fade will start at
7473 whichever comes last.  Default is 0.
7474
7475 @item duration, d
7476 The number of seconds for which the fade effect has to last. At the end of the
7477 fade-in effect the output video will have the same intensity as the input video,
7478 at the end of the fade-out transition the output video will be filled with the
7479 selected @option{color}.
7480 If both duration and nb_frames are specified, duration is used. Default is 0
7481 (nb_frames is used by default).
7482
7483 @item color, c
7484 Specify the color of the fade. Default is "black".
7485 @end table
7486
7487 @subsection Examples
7488
7489 @itemize
7490 @item
7491 Fade in the first 30 frames of video:
7492 @example
7493 fade=in:0:30
7494 @end example
7495
7496 The command above is equivalent to:
7497 @example
7498 fade=t=in:s=0:n=30
7499 @end example
7500
7501 @item
7502 Fade out the last 45 frames of a 200-frame video:
7503 @example
7504 fade=out:155:45
7505 fade=type=out:start_frame=155:nb_frames=45
7506 @end example
7507
7508 @item
7509 Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
7510 @example
7511 fade=in:0:25, fade=out:975:25
7512 @end example
7513
7514 @item
7515 Make the first 5 frames yellow, then fade in from frame 5-24:
7516 @example
7517 fade=in:5:20:color=yellow
7518 @end example
7519
7520 @item
7521 Fade in alpha over first 25 frames of video:
7522 @example
7523 fade=in:0:25:alpha=1
7524 @end example
7525
7526 @item
7527 Make the first 5.5 seconds black, then fade in for 0.5 seconds:
7528 @example
7529 fade=t=in:st=5.5:d=0.5
7530 @end example
7531
7532 @end itemize
7533
7534 @section fftfilt
7535 Apply arbitrary expressions to samples in frequency domain
7536
7537 @table @option
7538 @item dc_Y
7539 Adjust the dc value (gain) of the luma plane of the image. The filter
7540 accepts an integer value in range @code{0} to @code{1000}. The default
7541 value is set to @code{0}.
7542
7543 @item dc_U
7544 Adjust the dc value (gain) of the 1st chroma plane of the image. The
7545 filter accepts an integer value in range @code{0} to @code{1000}. The
7546 default value is set to @code{0}.
7547
7548 @item dc_V
7549 Adjust the dc value (gain) of the 2nd chroma plane of the image. The
7550 filter accepts an integer value in range @code{0} to @code{1000}. The
7551 default value is set to @code{0}.
7552
7553 @item weight_Y
7554 Set the frequency domain weight expression for the luma plane.
7555
7556 @item weight_U
7557 Set the frequency domain weight expression for the 1st chroma plane.
7558
7559 @item weight_V
7560 Set the frequency domain weight expression for the 2nd chroma plane.
7561
7562 The filter accepts the following variables:
7563 @item X
7564 @item Y
7565 The coordinates of the current sample.
7566
7567 @item W
7568 @item H
7569 The width and height of the image.
7570 @end table
7571
7572 @subsection Examples
7573
7574 @itemize
7575 @item
7576 High-pass:
7577 @example
7578 fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
7579 @end example
7580
7581 @item
7582 Low-pass:
7583 @example
7584 fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
7585 @end example
7586
7587 @item
7588 Sharpen:
7589 @example
7590 fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
7591 @end example
7592
7593 @item
7594 Blur:
7595 @example
7596 fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
7597 @end example
7598
7599 @end itemize
7600
7601 @section field
7602
7603 Extract a single field from an interlaced image using stride
7604 arithmetic to avoid wasting CPU time. The output frames are marked as
7605 non-interlaced.
7606
7607 The filter accepts the following options:
7608
7609 @table @option
7610 @item type
7611 Specify whether to extract the top (if the value is @code{0} or
7612 @code{top}) or the bottom field (if the value is @code{1} or
7613 @code{bottom}).
7614 @end table
7615
7616 @section fieldhint
7617
7618 Create new frames by copying the top and bottom fields from surrounding frames
7619 supplied as numbers by the hint file.
7620
7621 @table @option
7622 @item hint
7623 Set file containing hints: absolute/relative frame numbers.
7624
7625 There must be one line for each frame in a clip. Each line must contain two
7626 numbers separated by the comma, optionally followed by @code{-} or @code{+}.
7627 Numbers supplied on each line of file can not be out of [N-1,N+1] where N
7628 is current frame number for @code{absolute} mode or out of [-1, 1] range
7629 for @code{relative} mode. First number tells from which frame to pick up top
7630 field and second number tells from which frame to pick up bottom field.
7631
7632 If optionally followed by @code{+} output frame will be marked as interlaced,
7633 else if followed by @code{-} output frame will be marked as progressive, else
7634 it will be marked same as input frame.
7635 If line starts with @code{#} or @code{;} that line is skipped.
7636
7637 @item mode
7638 Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
7639 @end table
7640
7641 Example of first several lines of @code{hint} file for @code{relative} mode:
7642 @example
7643 0,0 - # first frame
7644 1,0 - # second frame, use third's frame top field and second's frame bottom field
7645 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
7646 1,0 -
7647 0,0 -
7648 0,0 -
7649 1,0 -
7650 1,0 -
7651 1,0 -
7652 0,0 -
7653 0,0 -
7654 1,0 -
7655 1,0 -
7656 1,0 -
7657 0,0 -
7658 @end example
7659
7660 @section fieldmatch
7661
7662 Field matching filter for inverse telecine. It is meant to reconstruct the
7663 progressive frames from a telecined stream. The filter does not drop duplicated
7664 frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
7665 followed by a decimation filter such as @ref{decimate} in the filtergraph.
7666
7667 The separation of the field matching and the decimation is notably motivated by
7668 the possibility of inserting a de-interlacing filter fallback between the two.
7669 If the source has mixed telecined and real interlaced content,
7670 @code{fieldmatch} will not be able to match fields for the interlaced parts.
7671 But these remaining combed frames will be marked as interlaced, and thus can be
7672 de-interlaced by a later filter such as @ref{yadif} before decimation.
7673
7674 In addition to the various configuration options, @code{fieldmatch} can take an
7675 optional second stream, activated through the @option{ppsrc} option. If
7676 enabled, the frames reconstruction will be based on the fields and frames from
7677 this second stream. This allows the first input to be pre-processed in order to
7678 help the various algorithms of the filter, while keeping the output lossless
7679 (assuming the fields are matched properly). Typically, a field-aware denoiser,
7680 or brightness/contrast adjustments can help.
7681
7682 Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
7683 and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
7684 which @code{fieldmatch} is based on. While the semantic and usage are very
7685 close, some behaviour and options names can differ.
7686
7687 The @ref{decimate} filter currently only works for constant frame rate input.
7688 If your input has mixed telecined (30fps) and progressive content with a lower
7689 framerate like 24fps use the following filterchain to produce the necessary cfr
7690 stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
7691
7692 The filter accepts the following options:
7693
7694 @table @option
7695 @item order
7696 Specify the assumed field order of the input stream. Available values are:
7697
7698 @table @samp
7699 @item auto
7700 Auto detect parity (use FFmpeg's internal parity value).
7701 @item bff
7702 Assume bottom field first.
7703 @item tff
7704 Assume top field first.
7705 @end table
7706
7707 Note that it is sometimes recommended not to trust the parity announced by the
7708 stream.
7709
7710 Default value is @var{auto}.
7711
7712 @item mode
7713 Set the matching mode or strategy to use. @option{pc} mode is the safest in the
7714 sense that it won't risk creating jerkiness due to duplicate frames when
7715 possible, but if there are bad edits or blended fields it will end up
7716 outputting combed frames when a good match might actually exist. On the other
7717 hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
7718 but will almost always find a good frame if there is one. The other values are
7719 all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
7720 jerkiness and creating duplicate frames versus finding good matches in sections
7721 with bad edits, orphaned fields, blended fields, etc.
7722
7723 More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
7724
7725 Available values are:
7726
7727 @table @samp
7728 @item pc
7729 2-way matching (p/c)
7730 @item pc_n
7731 2-way matching, and trying 3rd match if still combed (p/c + n)
7732 @item pc_u
7733 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
7734 @item pc_n_ub
7735 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
7736 still combed (p/c + n + u/b)
7737 @item pcn
7738 3-way matching (p/c/n)
7739 @item pcn_ub
7740 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
7741 detected as combed (p/c/n + u/b)
7742 @end table
7743
7744 The parenthesis at the end indicate the matches that would be used for that
7745 mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
7746 @var{top}).
7747
7748 In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
7749 the slowest.
7750
7751 Default value is @var{pc_n}.
7752
7753 @item ppsrc
7754 Mark the main input stream as a pre-processed input, and enable the secondary
7755 input stream as the clean source to pick the fields from. See the filter
7756 introduction for more details. It is similar to the @option{clip2} feature from
7757 VFM/TFM.
7758
7759 Default value is @code{0} (disabled).
7760
7761 @item field
7762 Set the field to match from. It is recommended to set this to the same value as
7763 @option{order} unless you experience matching failures with that setting. In
7764 certain circumstances changing the field that is used to match from can have a
7765 large impact on matching performance. Available values are:
7766
7767 @table @samp
7768 @item auto
7769 Automatic (same value as @option{order}).
7770 @item bottom
7771 Match from the bottom field.
7772 @item top
7773 Match from the top field.
7774 @end table
7775
7776 Default value is @var{auto}.
7777
7778 @item mchroma
7779 Set whether or not chroma is included during the match comparisons. In most
7780 cases it is recommended to leave this enabled. You should set this to @code{0}
7781 only if your clip has bad chroma problems such as heavy rainbowing or other
7782 artifacts. Setting this to @code{0} could also be used to speed things up at
7783 the cost of some accuracy.
7784
7785 Default value is @code{1}.
7786
7787 @item y0
7788 @item y1
7789 These define an exclusion band which excludes the lines between @option{y0} and
7790 @option{y1} from being included in the field matching decision. An exclusion
7791 band can be used to ignore subtitles, a logo, or other things that may
7792 interfere with the matching. @option{y0} sets the starting scan line and
7793 @option{y1} sets the ending line; all lines in between @option{y0} and
7794 @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
7795 @option{y0} and @option{y1} to the same value will disable the feature.
7796 @option{y0} and @option{y1} defaults to @code{0}.
7797
7798 @item scthresh
7799 Set the scene change detection threshold as a percentage of maximum change on
7800 the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
7801 detection is only relevant in case @option{combmatch}=@var{sc}.  The range for
7802 @option{scthresh} is @code{[0.0, 100.0]}.
7803
7804 Default value is @code{12.0}.
7805
7806 @item combmatch
7807 When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
7808 account the combed scores of matches when deciding what match to use as the
7809 final match. Available values are:
7810
7811 @table @samp
7812 @item none
7813 No final matching based on combed scores.
7814 @item sc
7815 Combed scores are only used when a scene change is detected.
7816 @item full
7817 Use combed scores all the time.
7818 @end table
7819
7820 Default is @var{sc}.
7821
7822 @item combdbg
7823 Force @code{fieldmatch} to calculate the combed metrics for certain matches and
7824 print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
7825 Available values are:
7826
7827 @table @samp
7828 @item none
7829 No forced calculation.
7830 @item pcn
7831 Force p/c/n calculations.
7832 @item pcnub
7833 Force p/c/n/u/b calculations.
7834 @end table
7835
7836 Default value is @var{none}.
7837
7838 @item cthresh
7839 This is the area combing threshold used for combed frame detection. This
7840 essentially controls how "strong" or "visible" combing must be to be detected.
7841 Larger values mean combing must be more visible and smaller values mean combing
7842 can be less visible or strong and still be detected. Valid settings are from
7843 @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
7844 be detected as combed). This is basically a pixel difference value. A good
7845 range is @code{[8, 12]}.
7846
7847 Default value is @code{9}.
7848
7849 @item chroma
7850 Sets whether or not chroma is considered in the combed frame decision.  Only
7851 disable this if your source has chroma problems (rainbowing, etc.) that are
7852 causing problems for the combed frame detection with chroma enabled. Actually,
7853 using @option{chroma}=@var{0} is usually more reliable, except for the case
7854 where there is chroma only combing in the source.
7855
7856 Default value is @code{0}.
7857
7858 @item blockx
7859 @item blocky
7860 Respectively set the x-axis and y-axis size of the window used during combed
7861 frame detection. This has to do with the size of the area in which
7862 @option{combpel} pixels are required to be detected as combed for a frame to be
7863 declared combed. See the @option{combpel} parameter description for more info.
7864 Possible values are any number that is a power of 2 starting at 4 and going up
7865 to 512.
7866
7867 Default value is @code{16}.
7868
7869 @item combpel
7870 The number of combed pixels inside any of the @option{blocky} by
7871 @option{blockx} size blocks on the frame for the frame to be detected as
7872 combed. While @option{cthresh} controls how "visible" the combing must be, this
7873 setting controls "how much" combing there must be in any localized area (a
7874 window defined by the @option{blockx} and @option{blocky} settings) on the
7875 frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
7876 which point no frames will ever be detected as combed). This setting is known
7877 as @option{MI} in TFM/VFM vocabulary.
7878
7879 Default value is @code{80}.
7880 @end table
7881
7882 @anchor{p/c/n/u/b meaning}
7883 @subsection p/c/n/u/b meaning
7884
7885 @subsubsection p/c/n
7886
7887 We assume the following telecined stream:
7888
7889 @example
7890 Top fields:     1 2 2 3 4
7891 Bottom fields:  1 2 3 4 4
7892 @end example
7893
7894 The numbers correspond to the progressive frame the fields relate to. Here, the
7895 first two frames are progressive, the 3rd and 4th are combed, and so on.
7896
7897 When @code{fieldmatch} is configured to run a matching from bottom
7898 (@option{field}=@var{bottom}) this is how this input stream get transformed:
7899
7900 @example
7901 Input stream:
7902                 T     1 2 2 3 4
7903                 B     1 2 3 4 4   <-- matching reference
7904
7905 Matches:              c c n n c
7906
7907 Output stream:
7908                 T     1 2 3 4 4
7909                 B     1 2 3 4 4
7910 @end example
7911
7912 As a result of the field matching, we can see that some frames get duplicated.
7913 To perform a complete inverse telecine, you need to rely on a decimation filter
7914 after this operation. See for instance the @ref{decimate} filter.
7915
7916 The same operation now matching from top fields (@option{field}=@var{top})
7917 looks like this:
7918
7919 @example
7920 Input stream:
7921                 T     1 2 2 3 4   <-- matching reference
7922                 B     1 2 3 4 4
7923
7924 Matches:              c c p p c
7925
7926 Output stream:
7927                 T     1 2 2 3 4
7928                 B     1 2 2 3 4
7929 @end example
7930
7931 In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
7932 basically, they refer to the frame and field of the opposite parity:
7933
7934 @itemize
7935 @item @var{p} matches the field of the opposite parity in the previous frame
7936 @item @var{c} matches the field of the opposite parity in the current frame
7937 @item @var{n} matches the field of the opposite parity in the next frame
7938 @end itemize
7939
7940 @subsubsection u/b
7941
7942 The @var{u} and @var{b} matching are a bit special in the sense that they match
7943 from the opposite parity flag. In the following examples, we assume that we are
7944 currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
7945 'x' is placed above and below each matched fields.
7946
7947 With bottom matching (@option{field}=@var{bottom}):
7948 @example
7949 Match:           c         p           n          b          u
7950
7951                  x       x               x        x          x
7952   Top          1 2 2     1 2 2       1 2 2      1 2 2      1 2 2
7953   Bottom       1 2 3     1 2 3       1 2 3      1 2 3      1 2 3
7954                  x         x           x        x              x
7955
7956 Output frames:
7957                  2          1          2          2          2
7958                  2          2          2          1          3
7959 @end example
7960
7961 With top matching (@option{field}=@var{top}):
7962 @example
7963 Match:           c         p           n          b          u
7964
7965                  x         x           x        x              x
7966   Top          1 2 2     1 2 2       1 2 2      1 2 2      1 2 2
7967   Bottom       1 2 3     1 2 3       1 2 3      1 2 3      1 2 3
7968                  x       x               x        x          x
7969
7970 Output frames:
7971                  2          2          2          1          2
7972                  2          1          3          2          2
7973 @end example
7974
7975 @subsection Examples
7976
7977 Simple IVTC of a top field first telecined stream:
7978 @example
7979 fieldmatch=order=tff:combmatch=none, decimate
7980 @end example
7981
7982 Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
7983 @example
7984 fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
7985 @end example
7986
7987 @section fieldorder
7988
7989 Transform the field order of the input video.
7990
7991 It accepts the following parameters:
7992
7993 @table @option
7994
7995 @item order
7996 The output field order. Valid values are @var{tff} for top field first or @var{bff}
7997 for bottom field first.
7998 @end table
7999
8000 The default value is @samp{tff}.
8001
8002 The transformation is done by shifting the picture content up or down
8003 by one line, and filling the remaining line with appropriate picture content.
8004 This method is consistent with most broadcast field order converters.
8005
8006 If the input video is not flagged as being interlaced, or it is already
8007 flagged as being of the required output field order, then this filter does
8008 not alter the incoming video.
8009
8010 It is very useful when converting to or from PAL DV material,
8011 which is bottom field first.
8012
8013 For example:
8014 @example
8015 ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
8016 @end example
8017
8018 @section fifo, afifo
8019
8020 Buffer input images and send them when they are requested.
8021
8022 It is mainly useful when auto-inserted by the libavfilter
8023 framework.
8024
8025 It does not take parameters.
8026
8027 @section find_rect
8028
8029 Find a rectangular object
8030
8031 It accepts the following options:
8032
8033 @table @option
8034 @item object
8035 Filepath of the object image, needs to be in gray8.
8036
8037 @item threshold
8038 Detection threshold, default is 0.5.
8039
8040 @item mipmaps
8041 Number of mipmaps, default is 3.
8042
8043 @item xmin, ymin, xmax, ymax
8044 Specifies the rectangle in which to search.
8045 @end table
8046
8047 @subsection Examples
8048
8049 @itemize
8050 @item
8051 Generate a representative palette of a given video using @command{ffmpeg}:
8052 @example
8053 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
8054 @end example
8055 @end itemize
8056
8057 @section cover_rect
8058
8059 Cover a rectangular object
8060
8061 It accepts the following options:
8062
8063 @table @option
8064 @item cover
8065 Filepath of the optional cover image, needs to be in yuv420.
8066
8067 @item mode
8068 Set covering mode.
8069
8070 It accepts the following values:
8071 @table @samp
8072 @item cover
8073 cover it by the supplied image
8074 @item blur
8075 cover it by interpolating the surrounding pixels
8076 @end table
8077
8078 Default value is @var{blur}.
8079 @end table
8080
8081 @subsection Examples
8082
8083 @itemize
8084 @item
8085 Generate a representative palette of a given video using @command{ffmpeg}:
8086 @example
8087 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
8088 @end example
8089 @end itemize
8090
8091 @anchor{format}
8092 @section format
8093
8094 Convert the input video to one of the specified pixel formats.
8095 Libavfilter will try to pick one that is suitable as input to
8096 the next filter.
8097
8098 It accepts the following parameters:
8099 @table @option
8100
8101 @item pix_fmts
8102 A '|'-separated list of pixel format names, such as
8103 "pix_fmts=yuv420p|monow|rgb24".
8104
8105 @end table
8106
8107 @subsection Examples
8108
8109 @itemize
8110 @item
8111 Convert the input video to the @var{yuv420p} format
8112 @example
8113 format=pix_fmts=yuv420p
8114 @end example
8115
8116 Convert the input video to any of the formats in the list
8117 @example
8118 format=pix_fmts=yuv420p|yuv444p|yuv410p
8119 @end example
8120 @end itemize
8121
8122 @anchor{fps}
8123 @section fps
8124
8125 Convert the video to specified constant frame rate by duplicating or dropping
8126 frames as necessary.
8127
8128 It accepts the following parameters:
8129 @table @option
8130
8131 @item fps
8132 The desired output frame rate. The default is @code{25}.
8133
8134 @item round
8135 Rounding method.
8136
8137 Possible values are:
8138 @table @option
8139 @item zero
8140 zero round towards 0
8141 @item inf
8142 round away from 0
8143 @item down
8144 round towards -infinity
8145 @item up
8146 round towards +infinity
8147 @item near
8148 round to nearest
8149 @end table
8150 The default is @code{near}.
8151
8152 @item start_time
8153 Assume the first PTS should be the given value, in seconds. This allows for
8154 padding/trimming at the start of stream. By default, no assumption is made
8155 about the first frame's expected PTS, so no padding or trimming is done.
8156 For example, this could be set to 0 to pad the beginning with duplicates of
8157 the first frame if a video stream starts after the audio stream or to trim any
8158 frames with a negative PTS.
8159
8160 @end table
8161
8162 Alternatively, the options can be specified as a flat string:
8163 @var{fps}[:@var{round}].
8164
8165 See also the @ref{setpts} filter.
8166
8167 @subsection Examples
8168
8169 @itemize
8170 @item
8171 A typical usage in order to set the fps to 25:
8172 @example
8173 fps=fps=25
8174 @end example
8175
8176 @item
8177 Sets the fps to 24, using abbreviation and rounding method to round to nearest:
8178 @example
8179 fps=fps=film:round=near
8180 @end example
8181 @end itemize
8182
8183 @section framepack
8184
8185 Pack two different video streams into a stereoscopic video, setting proper
8186 metadata on supported codecs. The two views should have the same size and
8187 framerate and processing will stop when the shorter video ends. Please note
8188 that you may conveniently adjust view properties with the @ref{scale} and
8189 @ref{fps} filters.
8190
8191 It accepts the following parameters:
8192 @table @option
8193
8194 @item format
8195 The desired packing format. Supported values are:
8196
8197 @table @option
8198
8199 @item sbs
8200 The views are next to each other (default).
8201
8202 @item tab
8203 The views are on top of each other.
8204
8205 @item lines
8206 The views are packed by line.
8207
8208 @item columns
8209 The views are packed by column.
8210
8211 @item frameseq
8212 The views are temporally interleaved.
8213
8214 @end table
8215
8216 @end table
8217
8218 Some examples:
8219
8220 @example
8221 # Convert left and right views into a frame-sequential video
8222 ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
8223
8224 # Convert views into a side-by-side video with the same output resolution as the input
8225 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
8226 @end example
8227
8228 @section framerate
8229
8230 Change the frame rate by interpolating new video output frames from the source
8231 frames.
8232
8233 This filter is not designed to function correctly with interlaced media. If
8234 you wish to change the frame rate of interlaced media then you are required
8235 to deinterlace before this filter and re-interlace after this filter.
8236
8237 A description of the accepted options follows.
8238
8239 @table @option
8240 @item fps
8241 Specify the output frames per second. This option can also be specified
8242 as a value alone. The default is @code{50}.
8243
8244 @item interp_start
8245 Specify the start of a range where the output frame will be created as a
8246 linear interpolation of two frames. The range is [@code{0}-@code{255}],
8247 the default is @code{15}.
8248
8249 @item interp_end
8250 Specify the end of a range where the output frame will be created as a
8251 linear interpolation of two frames. The range is [@code{0}-@code{255}],
8252 the default is @code{240}.
8253
8254 @item scene
8255 Specify the level at which a scene change is detected as a value between
8256 0 and 100 to indicate a new scene; a low value reflects a low
8257 probability for the current frame to introduce a new scene, while a higher
8258 value means the current frame is more likely to be one.
8259 The default is @code{7}.
8260
8261 @item flags
8262 Specify flags influencing the filter process.
8263
8264 Available value for @var{flags} is:
8265
8266 @table @option
8267 @item scene_change_detect, scd
8268 Enable scene change detection using the value of the option @var{scene}.
8269 This flag is enabled by default.
8270 @end table
8271 @end table
8272
8273 @section framestep
8274
8275 Select one frame every N-th frame.
8276
8277 This filter accepts the following option:
8278 @table @option
8279 @item step
8280 Select frame after every @code{step} frames.
8281 Allowed values are positive integers higher than 0. Default value is @code{1}.
8282 @end table
8283
8284 @anchor{frei0r}
8285 @section frei0r
8286
8287 Apply a frei0r effect to the input video.
8288
8289 To enable the compilation of this filter, you need to install the frei0r
8290 header and configure FFmpeg with @code{--enable-frei0r}.
8291
8292 It accepts the following parameters:
8293
8294 @table @option
8295
8296 @item filter_name
8297 The name of the frei0r effect to load. If the environment variable
8298 @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
8299 directories specified by the colon-separated list in @env{FREIOR_PATH}.
8300 Otherwise, the standard frei0r paths are searched, in this order:
8301 @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
8302 @file{/usr/lib/frei0r-1/}.
8303
8304 @item filter_params
8305 A '|'-separated list of parameters to pass to the frei0r effect.
8306
8307 @end table
8308
8309 A frei0r effect parameter can be a boolean (its value is either
8310 "y" or "n"), a double, a color (specified as
8311 @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
8312 numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
8313 section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
8314 @var{X} and @var{Y} are floating point numbers) and/or a string.
8315
8316 The number and types of parameters depend on the loaded effect. If an
8317 effect parameter is not specified, the default value is set.
8318
8319 @subsection Examples
8320
8321 @itemize
8322 @item
8323 Apply the distort0r effect, setting the first two double parameters:
8324 @example
8325 frei0r=filter_name=distort0r:filter_params=0.5|0.01
8326 @end example
8327
8328 @item
8329 Apply the colordistance effect, taking a color as the first parameter:
8330 @example
8331 frei0r=colordistance:0.2/0.3/0.4
8332 frei0r=colordistance:violet
8333 frei0r=colordistance:0x112233
8334 @end example
8335
8336 @item
8337 Apply the perspective effect, specifying the top left and top right image
8338 positions:
8339 @example
8340 frei0r=perspective:0.2/0.2|0.8/0.2
8341 @end example
8342 @end itemize
8343
8344 For more information, see
8345 @url{http://frei0r.dyne.org}
8346
8347 @section fspp
8348
8349 Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
8350
8351 It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
8352 processing filter, one of them is performed once per block, not per pixel.
8353 This allows for much higher speed.
8354
8355 The filter accepts the following options:
8356
8357 @table @option
8358 @item quality
8359 Set quality. This option defines the number of levels for averaging. It accepts
8360 an integer in the range 4-5. Default value is @code{4}.
8361
8362 @item qp
8363 Force a constant quantization parameter. It accepts an integer in range 0-63.
8364 If not set, the filter will use the QP from the video stream (if available).
8365
8366 @item strength
8367 Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
8368 more details but also more artifacts, while higher values make the image smoother
8369 but also blurrier. Default value is @code{0} âˆ’ PSNR optimal.
8370
8371 @item use_bframe_qp
8372 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
8373 option may cause flicker since the B-Frames have often larger QP. Default is
8374 @code{0} (not enabled).
8375
8376 @end table
8377
8378 @section gblur
8379
8380 Apply Gaussian blur filter.
8381
8382 The filter accepts the following options:
8383
8384 @table @option
8385 @item sigma
8386 Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
8387
8388 @item steps
8389 Set number of steps for Gaussian approximation. Defauls is @code{1}.
8390
8391 @item planes
8392 Set which planes to filter. By default all planes are filtered.
8393
8394 @item sigmaV
8395 Set vertical sigma, if negative it will be same as @code{sigma}.
8396 Default is @code{-1}.
8397 @end table
8398
8399 @section geq
8400
8401 The filter accepts the following options:
8402
8403 @table @option
8404 @item lum_expr, lum
8405 Set the luminance expression.
8406 @item cb_expr, cb
8407 Set the chrominance blue expression.
8408 @item cr_expr, cr
8409 Set the chrominance red expression.
8410 @item alpha_expr, a
8411 Set the alpha expression.
8412 @item red_expr, r
8413 Set the red expression.
8414 @item green_expr, g
8415 Set the green expression.
8416 @item blue_expr, b
8417 Set the blue expression.
8418 @end table
8419
8420 The colorspace is selected according to the specified options. If one
8421 of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
8422 options is specified, the filter will automatically select a YCbCr
8423 colorspace. If one of the @option{red_expr}, @option{green_expr}, or
8424 @option{blue_expr} options is specified, it will select an RGB
8425 colorspace.
8426
8427 If one of the chrominance expression is not defined, it falls back on the other
8428 one. If no alpha expression is specified it will evaluate to opaque value.
8429 If none of chrominance expressions are specified, they will evaluate
8430 to the luminance expression.
8431
8432 The expressions can use the following variables and functions:
8433
8434 @table @option
8435 @item N
8436 The sequential number of the filtered frame, starting from @code{0}.
8437
8438 @item X
8439 @item Y
8440 The coordinates of the current sample.
8441
8442 @item W
8443 @item H
8444 The width and height of the image.
8445
8446 @item SW
8447 @item SH
8448 Width and height scale depending on the currently filtered plane. It is the
8449 ratio between the corresponding luma plane number of pixels and the current
8450 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
8451 @code{0.5,0.5} for chroma planes.
8452
8453 @item T
8454 Time of the current frame, expressed in seconds.
8455
8456 @item p(x, y)
8457 Return the value of the pixel at location (@var{x},@var{y}) of the current
8458 plane.
8459
8460 @item lum(x, y)
8461 Return the value of the pixel at location (@var{x},@var{y}) of the luminance
8462 plane.
8463
8464 @item cb(x, y)
8465 Return the value of the pixel at location (@var{x},@var{y}) of the
8466 blue-difference chroma plane. Return 0 if there is no such plane.
8467
8468 @item cr(x, y)
8469 Return the value of the pixel at location (@var{x},@var{y}) of the
8470 red-difference chroma plane. Return 0 if there is no such plane.
8471
8472 @item r(x, y)
8473 @item g(x, y)
8474 @item b(x, y)
8475 Return the value of the pixel at location (@var{x},@var{y}) of the
8476 red/green/blue component. Return 0 if there is no such component.
8477
8478 @item alpha(x, y)
8479 Return the value of the pixel at location (@var{x},@var{y}) of the alpha
8480 plane. Return 0 if there is no such plane.
8481 @end table
8482
8483 For functions, if @var{x} and @var{y} are outside the area, the value will be
8484 automatically clipped to the closer edge.
8485
8486 @subsection Examples
8487
8488 @itemize
8489 @item
8490 Flip the image horizontally:
8491 @example
8492 geq=p(W-X\,Y)
8493 @end example
8494
8495 @item
8496 Generate a bidimensional sine wave, with angle @code{PI/3} and a
8497 wavelength of 100 pixels:
8498 @example
8499 geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
8500 @end example
8501
8502 @item
8503 Generate a fancy enigmatic moving light:
8504 @example
8505 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
8506 @end example
8507
8508 @item
8509 Generate a quick emboss effect:
8510 @example
8511 format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
8512 @end example
8513
8514 @item
8515 Modify RGB components depending on pixel position:
8516 @example
8517 geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
8518 @end example
8519
8520 @item
8521 Create a radial gradient that is the same size as the input (also see
8522 the @ref{vignette} filter):
8523 @example
8524 geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
8525 @end example
8526 @end itemize
8527
8528 @section gradfun
8529
8530 Fix the banding artifacts that are sometimes introduced into nearly flat
8531 regions by truncation to 8-bit color depth.
8532 Interpolate the gradients that should go where the bands are, and
8533 dither them.
8534
8535 It is designed for playback only.  Do not use it prior to
8536 lossy compression, because compression tends to lose the dither and
8537 bring back the bands.
8538
8539 It accepts the following parameters:
8540
8541 @table @option
8542
8543 @item strength
8544 The maximum amount by which the filter will change any one pixel. This is also
8545 the threshold for detecting nearly flat regions. Acceptable values range from
8546 .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
8547 valid range.
8548
8549 @item radius
8550 The neighborhood to fit the gradient to. A larger radius makes for smoother
8551 gradients, but also prevents the filter from modifying the pixels near detailed
8552 regions. Acceptable values are 8-32; the default value is 16. Out-of-range
8553 values will be clipped to the valid range.
8554
8555 @end table
8556
8557 Alternatively, the options can be specified as a flat string:
8558 @var{strength}[:@var{radius}]
8559
8560 @subsection Examples
8561
8562 @itemize
8563 @item
8564 Apply the filter with a @code{3.5} strength and radius of @code{8}:
8565 @example
8566 gradfun=3.5:8
8567 @end example
8568
8569 @item
8570 Specify radius, omitting the strength (which will fall-back to the default
8571 value):
8572 @example
8573 gradfun=radius=8
8574 @end example
8575
8576 @end itemize
8577
8578 @anchor{haldclut}
8579 @section haldclut
8580
8581 Apply a Hald CLUT to a video stream.
8582
8583 First input is the video stream to process, and second one is the Hald CLUT.
8584 The Hald CLUT input can be a simple picture or a complete video stream.
8585
8586 The filter accepts the following options:
8587
8588 @table @option
8589 @item shortest
8590 Force termination when the shortest input terminates. Default is @code{0}.
8591 @item repeatlast
8592 Continue applying the last CLUT after the end of the stream. A value of
8593 @code{0} disable the filter after the last frame of the CLUT is reached.
8594 Default is @code{1}.
8595 @end table
8596
8597 @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
8598 filters share the same internals).
8599
8600 More information about the Hald CLUT can be found on Eskil Steenberg's website
8601 (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
8602
8603 @subsection Workflow examples
8604
8605 @subsubsection Hald CLUT video stream
8606
8607 Generate an identity Hald CLUT stream altered with various effects:
8608 @example
8609 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
8610 @end example
8611
8612 Note: make sure you use a lossless codec.
8613
8614 Then use it with @code{haldclut} to apply it on some random stream:
8615 @example
8616 ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
8617 @end example
8618
8619 The Hald CLUT will be applied to the 10 first seconds (duration of
8620 @file{clut.nut}), then the latest picture of that CLUT stream will be applied
8621 to the remaining frames of the @code{mandelbrot} stream.
8622
8623 @subsubsection Hald CLUT with preview
8624
8625 A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
8626 @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
8627 biggest possible square starting at the top left of the picture. The remaining
8628 padding pixels (bottom or right) will be ignored. This area can be used to add
8629 a preview of the Hald CLUT.
8630
8631 Typically, the following generated Hald CLUT will be supported by the
8632 @code{haldclut} filter:
8633
8634 @example
8635 ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
8636    pad=iw+320 [padded_clut];
8637    smptebars=s=320x256, split [a][b];
8638    [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
8639    [main][b] overlay=W-320" -frames:v 1 clut.png
8640 @end example
8641
8642 It contains the original and a preview of the effect of the CLUT: SMPTE color
8643 bars are displayed on the right-top, and below the same color bars processed by
8644 the color changes.
8645
8646 Then, the effect of this Hald CLUT can be visualized with:
8647 @example
8648 ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
8649 @end example
8650
8651 @section hflip
8652
8653 Flip the input video horizontally.
8654
8655 For example, to horizontally flip the input video with @command{ffmpeg}:
8656 @example
8657 ffmpeg -i in.avi -vf "hflip" out.avi
8658 @end example
8659
8660 @section histeq
8661 This filter applies a global color histogram equalization on a
8662 per-frame basis.
8663
8664 It can be used to correct video that has a compressed range of pixel
8665 intensities.  The filter redistributes the pixel intensities to
8666 equalize their distribution across the intensity range. It may be
8667 viewed as an "automatically adjusting contrast filter". This filter is
8668 useful only for correcting degraded or poorly captured source
8669 video.
8670
8671 The filter accepts the following options:
8672
8673 @table @option
8674 @item strength
8675 Determine the amount of equalization to be applied.  As the strength
8676 is reduced, the distribution of pixel intensities more-and-more
8677 approaches that of the input frame. The value must be a float number
8678 in the range [0,1] and defaults to 0.200.
8679
8680 @item intensity
8681 Set the maximum intensity that can generated and scale the output
8682 values appropriately.  The strength should be set as desired and then
8683 the intensity can be limited if needed to avoid washing-out. The value
8684 must be a float number in the range [0,1] and defaults to 0.210.
8685
8686 @item antibanding
8687 Set the antibanding level. If enabled the filter will randomly vary
8688 the luminance of output pixels by a small amount to avoid banding of
8689 the histogram. Possible values are @code{none}, @code{weak} or
8690 @code{strong}. It defaults to @code{none}.
8691 @end table
8692
8693 @section histogram
8694
8695 Compute and draw a color distribution histogram for the input video.
8696
8697 The computed histogram is a representation of the color component
8698 distribution in an image.
8699
8700 Standard histogram displays the color components distribution in an image.
8701 Displays color graph for each color component. Shows distribution of
8702 the Y, U, V, A or R, G, B components, depending on input format, in the
8703 current frame. Below each graph a color component scale meter is shown.
8704
8705 The filter accepts the following options:
8706
8707 @table @option
8708 @item level_height
8709 Set height of level. Default value is @code{200}.
8710 Allowed range is [50, 2048].
8711
8712 @item scale_height
8713 Set height of color scale. Default value is @code{12}.
8714 Allowed range is [0, 40].
8715
8716 @item display_mode
8717 Set display mode.
8718 It accepts the following values:
8719 @table @samp
8720 @item parade
8721 Per color component graphs are placed below each other.
8722
8723 @item overlay
8724 Presents information identical to that in the @code{parade}, except
8725 that the graphs representing color components are superimposed directly
8726 over one another.
8727 @end table
8728 Default is @code{parade}.
8729
8730 @item levels_mode
8731 Set mode. Can be either @code{linear}, or @code{logarithmic}.
8732 Default is @code{linear}.
8733
8734 @item components
8735 Set what color components to display.
8736 Default is @code{7}.
8737
8738 @item fgopacity
8739 Set foreground opacity. Default is @code{0.7}.
8740
8741 @item bgopacity
8742 Set background opacity. Default is @code{0.5}.
8743 @end table
8744
8745 @subsection Examples
8746
8747 @itemize
8748
8749 @item
8750 Calculate and draw histogram:
8751 @example
8752 ffplay -i input -vf histogram
8753 @end example
8754
8755 @end itemize
8756
8757 @anchor{hqdn3d}
8758 @section hqdn3d
8759
8760 This is a high precision/quality 3d denoise filter. It aims to reduce
8761 image noise, producing smooth images and making still images really
8762 still. It should enhance compressibility.
8763
8764 It accepts the following optional parameters:
8765
8766 @table @option
8767 @item luma_spatial
8768 A non-negative floating point number which specifies spatial luma strength.
8769 It defaults to 4.0.
8770
8771 @item chroma_spatial
8772 A non-negative floating point number which specifies spatial chroma strength.
8773 It defaults to 3.0*@var{luma_spatial}/4.0.
8774
8775 @item luma_tmp
8776 A floating point number which specifies luma temporal strength. It defaults to
8777 6.0*@var{luma_spatial}/4.0.
8778
8779 @item chroma_tmp
8780 A floating point number which specifies chroma temporal strength. It defaults to
8781 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
8782 @end table
8783
8784 @anchor{hwupload_cuda}
8785 @section hwupload_cuda
8786
8787 Upload system memory frames to a CUDA device.
8788
8789 It accepts the following optional parameters:
8790
8791 @table @option
8792 @item device
8793 The number of the CUDA device to use
8794 @end table
8795
8796 @section hqx
8797
8798 Apply a high-quality magnification filter designed for pixel art. This filter
8799 was originally created by Maxim Stepin.
8800
8801 It accepts the following option:
8802
8803 @table @option
8804 @item n
8805 Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
8806 @code{hq3x} and @code{4} for @code{hq4x}.
8807 Default is @code{3}.
8808 @end table
8809
8810 @section hstack
8811 Stack input videos horizontally.
8812
8813 All streams must be of same pixel format and of same height.
8814
8815 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
8816 to create same output.
8817
8818 The filter accept the following option:
8819
8820 @table @option
8821 @item inputs
8822 Set number of input streams. Default is 2.
8823
8824 @item shortest
8825 If set to 1, force the output to terminate when the shortest input
8826 terminates. Default value is 0.
8827 @end table
8828
8829 @section hue
8830
8831 Modify the hue and/or the saturation of the input.
8832
8833 It accepts the following parameters:
8834
8835 @table @option
8836 @item h
8837 Specify the hue angle as a number of degrees. It accepts an expression,
8838 and defaults to "0".
8839
8840 @item s
8841 Specify the saturation in the [-10,10] range. It accepts an expression and
8842 defaults to "1".
8843
8844 @item H
8845 Specify the hue angle as a number of radians. It accepts an
8846 expression, and defaults to "0".
8847
8848 @item b
8849 Specify the brightness in the [-10,10] range. It accepts an expression and
8850 defaults to "0".
8851 @end table
8852
8853 @option{h} and @option{H} are mutually exclusive, and can't be
8854 specified at the same time.
8855
8856 The @option{b}, @option{h}, @option{H} and @option{s} option values are
8857 expressions containing the following constants:
8858
8859 @table @option
8860 @item n
8861 frame count of the input frame starting from 0
8862
8863 @item pts
8864 presentation timestamp of the input frame expressed in time base units
8865
8866 @item r
8867 frame rate of the input video, NAN if the input frame rate is unknown
8868
8869 @item t
8870 timestamp expressed in seconds, NAN if the input timestamp is unknown
8871
8872 @item tb
8873 time base of the input video
8874 @end table
8875
8876 @subsection Examples
8877
8878 @itemize
8879 @item
8880 Set the hue to 90 degrees and the saturation to 1.0:
8881 @example
8882 hue=h=90:s=1
8883 @end example
8884
8885 @item
8886 Same command but expressing the hue in radians:
8887 @example
8888 hue=H=PI/2:s=1
8889 @end example
8890
8891 @item
8892 Rotate hue and make the saturation swing between 0
8893 and 2 over a period of 1 second:
8894 @example
8895 hue="H=2*PI*t: s=sin(2*PI*t)+1"
8896 @end example
8897
8898 @item
8899 Apply a 3 seconds saturation fade-in effect starting at 0:
8900 @example
8901 hue="s=min(t/3\,1)"
8902 @end example
8903
8904 The general fade-in expression can be written as:
8905 @example
8906 hue="s=min(0\, max((t-START)/DURATION\, 1))"
8907 @end example
8908
8909 @item
8910 Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
8911 @example
8912 hue="s=max(0\, min(1\, (8-t)/3))"
8913 @end example
8914
8915 The general fade-out expression can be written as:
8916 @example
8917 hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
8918 @end example
8919
8920 @end itemize
8921
8922 @subsection Commands
8923
8924 This filter supports the following commands:
8925 @table @option
8926 @item b
8927 @item s
8928 @item h
8929 @item H
8930 Modify the hue and/or the saturation and/or brightness of the input video.
8931 The command accepts the same syntax of the corresponding option.
8932
8933 If the specified expression is not valid, it is kept at its current
8934 value.
8935 @end table
8936
8937 @section hysteresis
8938
8939 Grow first stream into second stream by connecting components.
8940 This makes it possible to build more robust edge masks.
8941
8942 This filter accepts the following options:
8943
8944 @table @option
8945 @item planes
8946 Set which planes will be processed as bitmap, unprocessed planes will be
8947 copied from first stream.
8948 By default value 0xf, all planes will be processed.
8949
8950 @item threshold
8951 Set threshold which is used in filtering. If pixel component value is higher than
8952 this value filter algorithm for connecting components is activated.
8953 By default value is 0.
8954 @end table
8955
8956 @section idet
8957
8958 Detect video interlacing type.
8959
8960 This filter tries to detect if the input frames are interlaced, progressive,
8961 top or bottom field first. It will also try to detect fields that are
8962 repeated between adjacent frames (a sign of telecine).
8963
8964 Single frame detection considers only immediately adjacent frames when classifying each frame.
8965 Multiple frame detection incorporates the classification history of previous frames.
8966
8967 The filter will log these metadata values:
8968
8969 @table @option
8970 @item single.current_frame
8971 Detected type of current frame using single-frame detection. One of:
8972 ``tff'' (top field first), ``bff'' (bottom field first),
8973 ``progressive'', or ``undetermined''
8974
8975 @item single.tff
8976 Cumulative number of frames detected as top field first using single-frame detection.
8977
8978 @item multiple.tff
8979 Cumulative number of frames detected as top field first using multiple-frame detection.
8980
8981 @item single.bff
8982 Cumulative number of frames detected as bottom field first using single-frame detection.
8983
8984 @item multiple.current_frame
8985 Detected type of current frame using multiple-frame detection. One of:
8986 ``tff'' (top field first), ``bff'' (bottom field first),
8987 ``progressive'', or ``undetermined''
8988
8989 @item multiple.bff
8990 Cumulative number of frames detected as bottom field first using multiple-frame detection.
8991
8992 @item single.progressive
8993 Cumulative number of frames detected as progressive using single-frame detection.
8994
8995 @item multiple.progressive
8996 Cumulative number of frames detected as progressive using multiple-frame detection.
8997
8998 @item single.undetermined
8999 Cumulative number of frames that could not be classified using single-frame detection.
9000
9001 @item multiple.undetermined
9002 Cumulative number of frames that could not be classified using multiple-frame detection.
9003
9004 @item repeated.current_frame
9005 Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
9006
9007 @item repeated.neither
9008 Cumulative number of frames with no repeated field.
9009
9010 @item repeated.top
9011 Cumulative number of frames with the top field repeated from the previous frame's top field.
9012
9013 @item repeated.bottom
9014 Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
9015 @end table
9016
9017 The filter accepts the following options:
9018
9019 @table @option
9020 @item intl_thres
9021 Set interlacing threshold.
9022 @item prog_thres
9023 Set progressive threshold.
9024 @item rep_thres
9025 Threshold for repeated field detection.
9026 @item half_life
9027 Number of frames after which a given frame's contribution to the
9028 statistics is halved (i.e., it contributes only 0.5 to its
9029 classification). The default of 0 means that all frames seen are given
9030 full weight of 1.0 forever.
9031 @item analyze_interlaced_flag
9032 When this is not 0 then idet will use the specified number of frames to determine
9033 if the interlaced flag is accurate, it will not count undetermined frames.
9034 If the flag is found to be accurate it will be used without any further
9035 computations, if it is found to be inaccurate it will be cleared without any
9036 further computations. This allows inserting the idet filter as a low computational
9037 method to clean up the interlaced flag
9038 @end table
9039
9040 @section il
9041
9042 Deinterleave or interleave fields.
9043
9044 This filter allows one to process interlaced images fields without
9045 deinterlacing them. Deinterleaving splits the input frame into 2
9046 fields (so called half pictures). Odd lines are moved to the top
9047 half of the output image, even lines to the bottom half.
9048 You can process (filter) them independently and then re-interleave them.
9049
9050 The filter accepts the following options:
9051
9052 @table @option
9053 @item luma_mode, l
9054 @item chroma_mode, c
9055 @item alpha_mode, a
9056 Available values for @var{luma_mode}, @var{chroma_mode} and
9057 @var{alpha_mode} are:
9058
9059 @table @samp
9060 @item none
9061 Do nothing.
9062
9063 @item deinterleave, d
9064 Deinterleave fields, placing one above the other.
9065
9066 @item interleave, i
9067 Interleave fields. Reverse the effect of deinterleaving.
9068 @end table
9069 Default value is @code{none}.
9070
9071 @item luma_swap, ls
9072 @item chroma_swap, cs
9073 @item alpha_swap, as
9074 Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
9075 @end table
9076
9077 @section inflate
9078
9079 Apply inflate effect to the video.
9080
9081 This filter replaces the pixel by the local(3x3) average by taking into account
9082 only values higher than the pixel.
9083
9084 It accepts the following options:
9085
9086 @table @option
9087 @item threshold0
9088 @item threshold1
9089 @item threshold2
9090 @item threshold3
9091 Limit the maximum change for each plane, default is 65535.
9092 If 0, plane will remain unchanged.
9093 @end table
9094
9095 @section interlace
9096
9097 Simple interlacing filter from progressive contents. This interleaves upper (or
9098 lower) lines from odd frames with lower (or upper) lines from even frames,
9099 halving the frame rate and preserving image height.
9100
9101 @example
9102    Original        Original             New Frame
9103    Frame 'j'      Frame 'j+1'             (tff)
9104   ==========      ===========       ==================
9105     Line 0  -------------------->    Frame 'j' Line 0
9106     Line 1          Line 1  ---->   Frame 'j+1' Line 1
9107     Line 2 --------------------->    Frame 'j' Line 2
9108     Line 3          Line 3  ---->   Frame 'j+1' Line 3
9109      ...             ...                   ...
9110 New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
9111 @end example
9112
9113 It accepts the following optional parameters:
9114
9115 @table @option
9116 @item scan
9117 This determines whether the interlaced frame is taken from the even
9118 (tff - default) or odd (bff) lines of the progressive frame.
9119
9120 @item lowpass
9121 Enable (default) or disable the vertical lowpass filter to avoid twitter
9122 interlacing and reduce moire patterns.
9123 @end table
9124
9125 @section kerndeint
9126
9127 Deinterlace input video by applying Donald Graft's adaptive kernel
9128 deinterling. Work on interlaced parts of a video to produce
9129 progressive frames.
9130
9131 The description of the accepted parameters follows.
9132
9133 @table @option
9134 @item thresh
9135 Set the threshold which affects the filter's tolerance when
9136 determining if a pixel line must be processed. It must be an integer
9137 in the range [0,255] and defaults to 10. A value of 0 will result in
9138 applying the process on every pixels.
9139
9140 @item map
9141 Paint pixels exceeding the threshold value to white if set to 1.
9142 Default is 0.
9143
9144 @item order
9145 Set the fields order. Swap fields if set to 1, leave fields alone if
9146 0. Default is 0.
9147
9148 @item sharp
9149 Enable additional sharpening if set to 1. Default is 0.
9150
9151 @item twoway
9152 Enable twoway sharpening if set to 1. Default is 0.
9153 @end table
9154
9155 @subsection Examples
9156
9157 @itemize
9158 @item
9159 Apply default values:
9160 @example
9161 kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
9162 @end example
9163
9164 @item
9165 Enable additional sharpening:
9166 @example
9167 kerndeint=sharp=1
9168 @end example
9169
9170 @item
9171 Paint processed pixels in white:
9172 @example
9173 kerndeint=map=1
9174 @end example
9175 @end itemize
9176
9177 @section lenscorrection
9178
9179 Correct radial lens distortion
9180
9181 This filter can be used to correct for radial distortion as can result from the use
9182 of wide angle lenses, and thereby re-rectify the image. To find the right parameters
9183 one can use tools available for example as part of opencv or simply trial-and-error.
9184 To use opencv use the calibration sample (under samples/cpp) from the opencv sources
9185 and extract the k1 and k2 coefficients from the resulting matrix.
9186
9187 Note that effectively the same filter is available in the open-source tools Krita and
9188 Digikam from the KDE project.
9189
9190 In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
9191 this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
9192 brightness distribution, so you may want to use both filters together in certain
9193 cases, though you will have to take care of ordering, i.e. whether vignetting should
9194 be applied before or after lens correction.
9195
9196 @subsection Options
9197
9198 The filter accepts the following options:
9199
9200 @table @option
9201 @item cx
9202 Relative x-coordinate of the focal point of the image, and thereby the center of the
9203 distortion. This value has a range [0,1] and is expressed as fractions of the image
9204 width.
9205 @item cy
9206 Relative y-coordinate of the focal point of the image, and thereby the center of the
9207 distortion. This value has a range [0,1] and is expressed as fractions of the image
9208 height.
9209 @item k1
9210 Coefficient of the quadratic correction term. 0.5 means no correction.
9211 @item k2
9212 Coefficient of the double quadratic correction term. 0.5 means no correction.
9213 @end table
9214
9215 The formula that generates the correction is:
9216
9217 @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)
9218
9219 where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
9220 distances from the focal point in the source and target images, respectively.
9221
9222 @section loop
9223
9224 Loop video frames.
9225
9226 The filter accepts the following options:
9227
9228 @table @option
9229 @item loop
9230 Set the number of loops.
9231
9232 @item size
9233 Set maximal size in number of frames.
9234
9235 @item start
9236 Set first frame of loop.
9237 @end table
9238
9239 @anchor{lut3d}
9240 @section lut3d
9241
9242 Apply a 3D LUT to an input video.
9243
9244 The filter accepts the following options:
9245
9246 @table @option
9247 @item file
9248 Set the 3D LUT file name.
9249
9250 Currently supported formats:
9251 @table @samp
9252 @item 3dl
9253 AfterEffects
9254 @item cube
9255 Iridas
9256 @item dat
9257 DaVinci
9258 @item m3d
9259 Pandora
9260 @end table
9261 @item interp
9262 Select interpolation mode.
9263
9264 Available values are:
9265
9266 @table @samp
9267 @item nearest
9268 Use values from the nearest defined point.
9269 @item trilinear
9270 Interpolate values using the 8 points defining a cube.
9271 @item tetrahedral
9272 Interpolate values using a tetrahedron.
9273 @end table
9274 @end table
9275
9276 @section lut, lutrgb, lutyuv
9277
9278 Compute a look-up table for binding each pixel component input value
9279 to an output value, and apply it to the input video.
9280
9281 @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
9282 to an RGB input video.
9283
9284 These filters accept the following parameters:
9285 @table @option
9286 @item c0
9287 set first pixel component expression
9288 @item c1
9289 set second pixel component expression
9290 @item c2
9291 set third pixel component expression
9292 @item c3
9293 set fourth pixel component expression, corresponds to the alpha component
9294
9295 @item r
9296 set red component expression
9297 @item g
9298 set green component expression
9299 @item b
9300 set blue component expression
9301 @item a
9302 alpha component expression
9303
9304 @item y
9305 set Y/luminance component expression
9306 @item u
9307 set U/Cb component expression
9308 @item v
9309 set V/Cr component expression
9310 @end table
9311
9312 Each of them specifies the expression to use for computing the lookup table for
9313 the corresponding pixel component values.
9314
9315 The exact component associated to each of the @var{c*} options depends on the
9316 format in input.
9317
9318 The @var{lut} filter requires either YUV or RGB pixel formats in input,
9319 @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
9320
9321 The expressions can contain the following constants and functions:
9322
9323 @table @option
9324 @item w
9325 @item h
9326 The input width and height.
9327
9328 @item val
9329 The input value for the pixel component.
9330
9331 @item clipval
9332 The input value, clipped to the @var{minval}-@var{maxval} range.
9333
9334 @item maxval
9335 The maximum value for the pixel component.
9336
9337 @item minval
9338 The minimum value for the pixel component.
9339
9340 @item negval
9341 The negated value for the pixel component value, clipped to the
9342 @var{minval}-@var{maxval} range; it corresponds to the expression
9343 "maxval-clipval+minval".
9344
9345 @item clip(val)
9346 The computed value in @var{val}, clipped to the
9347 @var{minval}-@var{maxval} range.
9348
9349 @item gammaval(gamma)
9350 The computed gamma correction value of the pixel component value,
9351 clipped to the @var{minval}-@var{maxval} range. It corresponds to the
9352 expression
9353 "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
9354
9355 @end table
9356
9357 All expressions default to "val".
9358
9359 @subsection Examples
9360
9361 @itemize
9362 @item
9363 Negate input video:
9364 @example
9365 lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
9366 lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
9367 @end example
9368
9369 The above is the same as:
9370 @example
9371 lutrgb="r=negval:g=negval:b=negval"
9372 lutyuv="y=negval:u=negval:v=negval"
9373 @end example
9374
9375 @item
9376 Negate luminance:
9377 @example
9378 lutyuv=y=negval
9379 @end example
9380
9381 @item
9382 Remove chroma components, turning the video into a graytone image:
9383 @example
9384 lutyuv="u=128:v=128"
9385 @end example
9386
9387 @item
9388 Apply a luma burning effect:
9389 @example
9390 lutyuv="y=2*val"
9391 @end example
9392
9393 @item
9394 Remove green and blue components:
9395 @example
9396 lutrgb="g=0:b=0"
9397 @end example
9398
9399 @item
9400 Set a constant alpha channel value on input:
9401 @example
9402 format=rgba,lutrgb=a="maxval-minval/2"
9403 @end example
9404
9405 @item
9406 Correct luminance gamma by a factor of 0.5:
9407 @example
9408 lutyuv=y=gammaval(0.5)
9409 @end example
9410
9411 @item
9412 Discard least significant bits of luma:
9413 @example
9414 lutyuv=y='bitand(val, 128+64+32)'
9415 @end example
9416
9417 @item
9418 Technicolor like effect:
9419 @example
9420 lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
9421 @end example
9422 @end itemize
9423
9424 @section lut2
9425
9426 Compute and apply a lookup table from two video inputs.
9427
9428 This filter accepts the following parameters:
9429 @table @option
9430 @item c0
9431 set first pixel component expression
9432 @item c1
9433 set second pixel component expression
9434 @item c2
9435 set third pixel component expression
9436 @item c3
9437 set fourth pixel component expression, corresponds to the alpha component
9438 @end table
9439
9440 Each of them specifies the expression to use for computing the lookup table for
9441 the corresponding pixel component values.
9442
9443 The exact component associated to each of the @var{c*} options depends on the
9444 format in inputs.
9445
9446 The expressions can contain the following constants:
9447
9448 @table @option
9449 @item w
9450 @item h
9451 The input width and height.
9452
9453 @item x
9454 The first input value for the pixel component.
9455
9456 @item y
9457 The second input value for the pixel component.
9458
9459 @item bdx
9460 The first input video bit depth.
9461
9462 @item bdy
9463 The second input video bit depth.
9464 @end table
9465
9466 All expressions default to "x".
9467
9468 @subsection Examples
9469
9470 @itemize
9471 @item
9472 Highlight differences between two RGB video streams:
9473 @example
9474 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)'
9475 @end example
9476
9477 @item
9478 Highlight differences between two YUV video streams:
9479 @example
9480 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)'
9481 @end example
9482 @end itemize
9483
9484 @section maskedclamp
9485
9486 Clamp the first input stream with the second input and third input stream.
9487
9488 Returns the value of first stream to be between second input
9489 stream - @code{undershoot} and third input stream + @code{overshoot}.
9490
9491 This filter accepts the following options:
9492 @table @option
9493 @item undershoot
9494 Default value is @code{0}.
9495
9496 @item overshoot
9497 Default value is @code{0}.
9498
9499 @item planes
9500 Set which planes will be processed as bitmap, unprocessed planes will be
9501 copied from first stream.
9502 By default value 0xf, all planes will be processed.
9503 @end table
9504
9505 @section maskedmerge
9506
9507 Merge the first input stream with the second input stream using per pixel
9508 weights in the third input stream.
9509
9510 A value of 0 in the third stream pixel component means that pixel component
9511 from first stream is returned unchanged, while maximum value (eg. 255 for
9512 8-bit videos) means that pixel component from second stream is returned
9513 unchanged. Intermediate values define the amount of merging between both
9514 input stream's pixel components.
9515
9516 This filter accepts the following options:
9517 @table @option
9518 @item planes
9519 Set which planes will be processed as bitmap, unprocessed planes will be
9520 copied from first stream.
9521 By default value 0xf, all planes will be processed.
9522 @end table
9523
9524 @section mcdeint
9525
9526 Apply motion-compensation deinterlacing.
9527
9528 It needs one field per frame as input and must thus be used together
9529 with yadif=1/3 or equivalent.
9530
9531 This filter accepts the following options:
9532 @table @option
9533 @item mode
9534 Set the deinterlacing mode.
9535
9536 It accepts one of the following values:
9537 @table @samp
9538 @item fast
9539 @item medium
9540 @item slow
9541 use iterative motion estimation
9542 @item extra_slow
9543 like @samp{slow}, but use multiple reference frames.
9544 @end table
9545 Default value is @samp{fast}.
9546
9547 @item parity
9548 Set the picture field parity assumed for the input video. It must be
9549 one of the following values:
9550
9551 @table @samp
9552 @item 0, tff
9553 assume top field first
9554 @item 1, bff
9555 assume bottom field first
9556 @end table
9557
9558 Default value is @samp{bff}.
9559
9560 @item qp
9561 Set per-block quantization parameter (QP) used by the internal
9562 encoder.
9563
9564 Higher values should result in a smoother motion vector field but less
9565 optimal individual vectors. Default value is 1.
9566 @end table
9567
9568 @section mergeplanes
9569
9570 Merge color channel components from several video streams.
9571
9572 The filter accepts up to 4 input streams, and merge selected input
9573 planes to the output video.
9574
9575 This filter accepts the following options:
9576 @table @option
9577 @item mapping
9578 Set input to output plane mapping. Default is @code{0}.
9579
9580 The mappings is specified as a bitmap. It should be specified as a
9581 hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
9582 mapping for the first plane of the output stream. 'A' sets the number of
9583 the input stream to use (from 0 to 3), and 'a' the plane number of the
9584 corresponding input to use (from 0 to 3). The rest of the mappings is
9585 similar, 'Bb' describes the mapping for the output stream second
9586 plane, 'Cc' describes the mapping for the output stream third plane and
9587 'Dd' describes the mapping for the output stream fourth plane.
9588
9589 @item format
9590 Set output pixel format. Default is @code{yuva444p}.
9591 @end table
9592
9593 @subsection Examples
9594
9595 @itemize
9596 @item
9597 Merge three gray video streams of same width and height into single video stream:
9598 @example
9599 [a0][a1][a2]mergeplanes=0x001020:yuv444p
9600 @end example
9601
9602 @item
9603 Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
9604 @example
9605 [a0][a1]mergeplanes=0x00010210:yuva444p
9606 @end example
9607
9608 @item
9609 Swap Y and A plane in yuva444p stream:
9610 @example
9611 format=yuva444p,mergeplanes=0x03010200:yuva444p
9612 @end example
9613
9614 @item
9615 Swap U and V plane in yuv420p stream:
9616 @example
9617 format=yuv420p,mergeplanes=0x000201:yuv420p
9618 @end example
9619
9620 @item
9621 Cast a rgb24 clip to yuv444p:
9622 @example
9623 format=rgb24,mergeplanes=0x000102:yuv444p
9624 @end example
9625 @end itemize
9626
9627 @section mestimate
9628
9629 Estimate and export motion vectors using block matching algorithms.
9630 Motion vectors are stored in frame side data to be used by other filters.
9631
9632 This filter accepts the following options:
9633 @table @option
9634 @item method
9635 Specify the motion estimation method. Accepts one of the following values:
9636
9637 @table @samp
9638 @item esa
9639 Exhaustive search algorithm.
9640 @item tss
9641 Three step search algorithm.
9642 @item tdls
9643 Two dimensional logarithmic search algorithm.
9644 @item ntss
9645 New three step search algorithm.
9646 @item fss
9647 Four step search algorithm.
9648 @item ds
9649 Diamond search algorithm.
9650 @item hexbs
9651 Hexagon-based search algorithm.
9652 @item epzs
9653 Enhanced predictive zonal search algorithm.
9654 @item umh
9655 Uneven multi-hexagon search algorithm.
9656 @end table
9657 Default value is @samp{esa}.
9658
9659 @item mb_size
9660 Macroblock size. Default @code{16}.
9661
9662 @item search_param
9663 Search parameter. Default @code{7}.
9664 @end table
9665
9666 @section midequalizer
9667
9668 Apply Midway Image Equalization effect using two video streams.
9669
9670 Midway Image Equalization adjusts a pair of images to have the same
9671 histogram, while maintaining their dynamics as much as possible. It's
9672 useful for e.g. matching exposures from a pair of stereo cameras.
9673
9674 This filter has two inputs and one output, which must be of same pixel format, but
9675 may be of different sizes. The output of filter is first input adjusted with
9676 midway histogram of both inputs.
9677
9678 This filter accepts the following option:
9679
9680 @table @option
9681 @item planes
9682 Set which planes to process. Default is @code{15}, which is all available planes.
9683 @end table
9684
9685 @section minterpolate
9686
9687 Convert the video to specified frame rate using motion interpolation.
9688
9689 This filter accepts the following options:
9690 @table @option
9691 @item fps
9692 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}.
9693
9694 @item mi_mode
9695 Motion interpolation mode. Following values are accepted:
9696 @table @samp
9697 @item dup
9698 Duplicate previous or next frame for interpolating new ones.
9699 @item blend
9700 Blend source frames. Interpolated frame is mean of previous and next frames.
9701 @item mci
9702 Motion compensated interpolation. Following options are effective when this mode is selected:
9703
9704 @table @samp
9705 @item mc_mode
9706 Motion compensation mode. Following values are accepted:
9707 @table @samp
9708 @item obmc
9709 Overlapped block motion compensation.
9710 @item aobmc
9711 Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
9712 @end table
9713 Default mode is @samp{obmc}.
9714
9715 @item me_mode
9716 Motion estimation mode. Following values are accepted:
9717 @table @samp
9718 @item bidir
9719 Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
9720 @item bilat
9721 Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
9722 @end table
9723 Default mode is @samp{bilat}.
9724
9725 @item me
9726 The algorithm to be used for motion estimation. Following values are accepted:
9727 @table @samp
9728 @item esa
9729 Exhaustive search algorithm.
9730 @item tss
9731 Three step search algorithm.
9732 @item tdls
9733 Two dimensional logarithmic search algorithm.
9734 @item ntss
9735 New three step search algorithm.
9736 @item fss
9737 Four step search algorithm.
9738 @item ds
9739 Diamond search algorithm.
9740 @item hexbs
9741 Hexagon-based search algorithm.
9742 @item epzs
9743 Enhanced predictive zonal search algorithm.
9744 @item umh
9745 Uneven multi-hexagon search algorithm.
9746 @end table
9747 Default algorithm is @samp{epzs}.
9748
9749 @item mb_size
9750 Macroblock size. Default @code{16}.
9751
9752 @item search_param
9753 Motion estimation search parameter. Default @code{32}.
9754
9755 @item vsbmc
9756 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).
9757 @end table
9758 @end table
9759
9760 @item scd
9761 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:
9762 @table @samp
9763 @item none
9764 Disable scene change detection.
9765 @item fdiff
9766 Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
9767 @end table
9768 Default method is @samp{fdiff}.
9769
9770 @item scd_threshold
9771 Scene change detection threshold. Default is @code{5.0}.
9772 @end table
9773
9774 @section mpdecimate
9775
9776 Drop frames that do not differ greatly from the previous frame in
9777 order to reduce frame rate.
9778
9779 The main use of this filter is for very-low-bitrate encoding
9780 (e.g. streaming over dialup modem), but it could in theory be used for
9781 fixing movies that were inverse-telecined incorrectly.
9782
9783 A description of the accepted options follows.
9784
9785 @table @option
9786 @item max
9787 Set the maximum number of consecutive frames which can be dropped (if
9788 positive), or the minimum interval between dropped frames (if
9789 negative). If the value is 0, the frame is dropped unregarding the
9790 number of previous sequentially dropped frames.
9791
9792 Default value is 0.
9793
9794 @item hi
9795 @item lo
9796 @item frac
9797 Set the dropping threshold values.
9798
9799 Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
9800 represent actual pixel value differences, so a threshold of 64
9801 corresponds to 1 unit of difference for each pixel, or the same spread
9802 out differently over the block.
9803
9804 A frame is a candidate for dropping if no 8x8 blocks differ by more
9805 than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
9806 meaning the whole image) differ by more than a threshold of @option{lo}.
9807
9808 Default value for @option{hi} is 64*12, default value for @option{lo} is
9809 64*5, and default value for @option{frac} is 0.33.
9810 @end table
9811
9812
9813 @section negate
9814
9815 Negate input video.
9816
9817 It accepts an integer in input; if non-zero it negates the
9818 alpha component (if available). The default value in input is 0.
9819
9820 @section nlmeans
9821
9822 Denoise frames using Non-Local Means algorithm.
9823
9824 Each pixel is adjusted by looking for other pixels with similar contexts. This
9825 context similarity is defined by comparing their surrounding patches of size
9826 @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
9827 around the pixel.
9828
9829 Note that the research area defines centers for patches, which means some
9830 patches will be made of pixels outside that research area.
9831
9832 The filter accepts the following options.
9833
9834 @table @option
9835 @item s
9836 Set denoising strength.
9837
9838 @item p
9839 Set patch size.
9840
9841 @item pc
9842 Same as @option{p} but for chroma planes.
9843
9844 The default value is @var{0} and means automatic.
9845
9846 @item r
9847 Set research size.
9848
9849 @item rc
9850 Same as @option{r} but for chroma planes.
9851
9852 The default value is @var{0} and means automatic.
9853 @end table
9854
9855 @section nnedi
9856
9857 Deinterlace video using neural network edge directed interpolation.
9858
9859 This filter accepts the following options:
9860
9861 @table @option
9862 @item weights
9863 Mandatory option, without binary file filter can not work.
9864 Currently file can be found here:
9865 https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
9866
9867 @item deint
9868 Set which frames to deinterlace, by default it is @code{all}.
9869 Can be @code{all} or @code{interlaced}.
9870
9871 @item field
9872 Set mode of operation.
9873
9874 Can be one of the following:
9875
9876 @table @samp
9877 @item af
9878 Use frame flags, both fields.
9879 @item a
9880 Use frame flags, single field.
9881 @item t
9882 Use top field only.
9883 @item b
9884 Use bottom field only.
9885 @item tf
9886 Use both fields, top first.
9887 @item bf
9888 Use both fields, bottom first.
9889 @end table
9890
9891 @item planes
9892 Set which planes to process, by default filter process all frames.
9893
9894 @item nsize
9895 Set size of local neighborhood around each pixel, used by the predictor neural
9896 network.
9897
9898 Can be one of the following:
9899
9900 @table @samp
9901 @item s8x6
9902 @item s16x6
9903 @item s32x6
9904 @item s48x6
9905 @item s8x4
9906 @item s16x4
9907 @item s32x4
9908 @end table
9909
9910 @item nns
9911 Set the number of neurons in predicctor neural network.
9912 Can be one of the following:
9913
9914 @table @samp
9915 @item n16
9916 @item n32
9917 @item n64
9918 @item n128
9919 @item n256
9920 @end table
9921
9922 @item qual
9923 Controls the number of different neural network predictions that are blended
9924 together to compute the final output value. Can be @code{fast}, default or
9925 @code{slow}.
9926
9927 @item etype
9928 Set which set of weights to use in the predictor.
9929 Can be one of the following:
9930
9931 @table @samp
9932 @item a
9933 weights trained to minimize absolute error
9934 @item s
9935 weights trained to minimize squared error
9936 @end table
9937
9938 @item pscrn
9939 Controls whether or not the prescreener neural network is used to decide
9940 which pixels should be processed by the predictor neural network and which
9941 can be handled by simple cubic interpolation.
9942 The prescreener is trained to know whether cubic interpolation will be
9943 sufficient for a pixel or whether it should be predicted by the predictor nn.
9944 The computational complexity of the prescreener nn is much less than that of
9945 the predictor nn. Since most pixels can be handled by cubic interpolation,
9946 using the prescreener generally results in much faster processing.
9947 The prescreener is pretty accurate, so the difference between using it and not
9948 using it is almost always unnoticeable.
9949
9950 Can be one of the following:
9951
9952 @table @samp
9953 @item none
9954 @item original
9955 @item new
9956 @end table
9957
9958 Default is @code{new}.
9959
9960 @item fapprox
9961 Set various debugging flags.
9962 @end table
9963
9964 @section noformat
9965
9966 Force libavfilter not to use any of the specified pixel formats for the
9967 input to the next filter.
9968
9969 It accepts the following parameters:
9970 @table @option
9971
9972 @item pix_fmts
9973 A '|'-separated list of pixel format names, such as
9974 apix_fmts=yuv420p|monow|rgb24".
9975
9976 @end table
9977
9978 @subsection Examples
9979
9980 @itemize
9981 @item
9982 Force libavfilter to use a format different from @var{yuv420p} for the
9983 input to the vflip filter:
9984 @example
9985 noformat=pix_fmts=yuv420p,vflip
9986 @end example
9987
9988 @item
9989 Convert the input video to any of the formats not contained in the list:
9990 @example
9991 noformat=yuv420p|yuv444p|yuv410p
9992 @end example
9993 @end itemize
9994
9995 @section noise
9996
9997 Add noise on video input frame.
9998
9999 The filter accepts the following options:
10000
10001 @table @option
10002 @item all_seed
10003 @item c0_seed
10004 @item c1_seed
10005 @item c2_seed
10006 @item c3_seed
10007 Set noise seed for specific pixel component or all pixel components in case
10008 of @var{all_seed}. Default value is @code{123457}.
10009
10010 @item all_strength, alls
10011 @item c0_strength, c0s
10012 @item c1_strength, c1s
10013 @item c2_strength, c2s
10014 @item c3_strength, c3s
10015 Set noise strength for specific pixel component or all pixel components in case
10016 @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
10017
10018 @item all_flags, allf
10019 @item c0_flags, c0f
10020 @item c1_flags, c1f
10021 @item c2_flags, c2f
10022 @item c3_flags, c3f
10023 Set pixel component flags or set flags for all components if @var{all_flags}.
10024 Available values for component flags are:
10025 @table @samp
10026 @item a
10027 averaged temporal noise (smoother)
10028 @item p
10029 mix random noise with a (semi)regular pattern
10030 @item t
10031 temporal noise (noise pattern changes between frames)
10032 @item u
10033 uniform noise (gaussian otherwise)
10034 @end table
10035 @end table
10036
10037 @subsection Examples
10038
10039 Add temporal and uniform noise to input video:
10040 @example
10041 noise=alls=20:allf=t+u
10042 @end example
10043
10044 @section null
10045
10046 Pass the video source unchanged to the output.
10047
10048 @section ocr
10049 Optical Character Recognition
10050
10051 This filter uses Tesseract for optical character recognition.
10052
10053 It accepts the following options:
10054
10055 @table @option
10056 @item datapath
10057 Set datapath to tesseract data. Default is to use whatever was
10058 set at installation.
10059
10060 @item language
10061 Set language, default is "eng".
10062
10063 @item whitelist
10064 Set character whitelist.
10065
10066 @item blacklist
10067 Set character blacklist.
10068 @end table
10069
10070 The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
10071
10072 @section ocv
10073
10074 Apply a video transform using libopencv.
10075
10076 To enable this filter, install the libopencv library and headers and
10077 configure FFmpeg with @code{--enable-libopencv}.
10078
10079 It accepts the following parameters:
10080
10081 @table @option
10082
10083 @item filter_name
10084 The name of the libopencv filter to apply.
10085
10086 @item filter_params
10087 The parameters to pass to the libopencv filter. If not specified, the default
10088 values are assumed.
10089
10090 @end table
10091
10092 Refer to the official libopencv documentation for more precise
10093 information:
10094 @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
10095
10096 Several libopencv filters are supported; see the following subsections.
10097
10098 @anchor{dilate}
10099 @subsection dilate
10100
10101 Dilate an image by using a specific structuring element.
10102 It corresponds to the libopencv function @code{cvDilate}.
10103
10104 It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
10105
10106 @var{struct_el} represents a structuring element, and has the syntax:
10107 @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
10108
10109 @var{cols} and @var{rows} represent the number of columns and rows of
10110 the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
10111 point, and @var{shape} the shape for the structuring element. @var{shape}
10112 must be "rect", "cross", "ellipse", or "custom".
10113
10114 If the value for @var{shape} is "custom", it must be followed by a
10115 string of the form "=@var{filename}". The file with name
10116 @var{filename} is assumed to represent a binary image, with each
10117 printable character corresponding to a bright pixel. When a custom
10118 @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
10119 or columns and rows of the read file are assumed instead.
10120
10121 The default value for @var{struct_el} is "3x3+0x0/rect".
10122
10123 @var{nb_iterations} specifies the number of times the transform is
10124 applied to the image, and defaults to 1.
10125
10126 Some examples:
10127 @example
10128 # Use the default values
10129 ocv=dilate
10130
10131 # Dilate using a structuring element with a 5x5 cross, iterating two times
10132 ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
10133
10134 # Read the shape from the file diamond.shape, iterating two times.
10135 # The file diamond.shape may contain a pattern of characters like this
10136 #   *
10137 #  ***
10138 # *****
10139 #  ***
10140 #   *
10141 # The specified columns and rows are ignored
10142 # but the anchor point coordinates are not
10143 ocv=dilate:0x0+2x2/custom=diamond.shape|2
10144 @end example
10145
10146 @subsection erode
10147
10148 Erode an image by using a specific structuring element.
10149 It corresponds to the libopencv function @code{cvErode}.
10150
10151 It accepts the parameters: @var{struct_el}:@var{nb_iterations},
10152 with the same syntax and semantics as the @ref{dilate} filter.
10153
10154 @subsection smooth
10155
10156 Smooth the input video.
10157
10158 The filter takes the following parameters:
10159 @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
10160
10161 @var{type} is the type of smooth filter to apply, and must be one of
10162 the following values: "blur", "blur_no_scale", "median", "gaussian",
10163 or "bilateral". The default value is "gaussian".
10164
10165 The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
10166 depend on the smooth type. @var{param1} and
10167 @var{param2} accept integer positive values or 0. @var{param3} and
10168 @var{param4} accept floating point values.
10169
10170 The default value for @var{param1} is 3. The default value for the
10171 other parameters is 0.
10172
10173 These parameters correspond to the parameters assigned to the
10174 libopencv function @code{cvSmooth}.
10175
10176 @anchor{overlay}
10177 @section overlay
10178
10179 Overlay one video on top of another.
10180
10181 It takes two inputs and has one output. The first input is the "main"
10182 video on which the second input is overlaid.
10183
10184 It accepts the following parameters:
10185
10186 A description of the accepted options follows.
10187
10188 @table @option
10189 @item x
10190 @item y
10191 Set the expression for the x and y coordinates of the overlaid video
10192 on the main video. Default value is "0" for both expressions. In case
10193 the expression is invalid, it is set to a huge value (meaning that the
10194 overlay will not be displayed within the output visible area).
10195
10196 @item eof_action
10197 The action to take when EOF is encountered on the secondary input; it accepts
10198 one of the following values:
10199
10200 @table @option
10201 @item repeat
10202 Repeat the last frame (the default).
10203 @item endall
10204 End both streams.
10205 @item pass
10206 Pass the main input through.
10207 @end table
10208
10209 @item eval
10210 Set when the expressions for @option{x}, and @option{y} are evaluated.
10211
10212 It accepts the following values:
10213 @table @samp
10214 @item init
10215 only evaluate expressions once during the filter initialization or
10216 when a command is processed
10217
10218 @item frame
10219 evaluate expressions for each incoming frame
10220 @end table
10221
10222 Default value is @samp{frame}.
10223
10224 @item shortest
10225 If set to 1, force the output to terminate when the shortest input
10226 terminates. Default value is 0.
10227
10228 @item format
10229 Set the format for the output video.
10230
10231 It accepts the following values:
10232 @table @samp
10233 @item yuv420
10234 force YUV420 output
10235
10236 @item yuv422
10237 force YUV422 output
10238
10239 @item yuv444
10240 force YUV444 output
10241
10242 @item rgb
10243 force packed RGB output
10244
10245 @item gbrp
10246 force planar RGB output
10247 @end table
10248
10249 Default value is @samp{yuv420}.
10250
10251 @item rgb @emph{(deprecated)}
10252 If set to 1, force the filter to accept inputs in the RGB
10253 color space. Default value is 0. This option is deprecated, use
10254 @option{format} instead.
10255
10256 @item repeatlast
10257 If set to 1, force the filter to draw the last overlay frame over the
10258 main input until the end of the stream. A value of 0 disables this
10259 behavior. Default value is 1.
10260 @end table
10261
10262 The @option{x}, and @option{y} expressions can contain the following
10263 parameters.
10264
10265 @table @option
10266 @item main_w, W
10267 @item main_h, H
10268 The main input width and height.
10269
10270 @item overlay_w, w
10271 @item overlay_h, h
10272 The overlay input width and height.
10273
10274 @item x
10275 @item y
10276 The computed values for @var{x} and @var{y}. They are evaluated for
10277 each new frame.
10278
10279 @item hsub
10280 @item vsub
10281 horizontal and vertical chroma subsample values of the output
10282 format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
10283 @var{vsub} is 1.
10284
10285 @item n
10286 the number of input frame, starting from 0
10287
10288 @item pos
10289 the position in the file of the input frame, NAN if unknown
10290
10291 @item t
10292 The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
10293
10294 @end table
10295
10296 Note that the @var{n}, @var{pos}, @var{t} variables are available only
10297 when evaluation is done @emph{per frame}, and will evaluate to NAN
10298 when @option{eval} is set to @samp{init}.
10299
10300 Be aware that frames are taken from each input video in timestamp
10301 order, hence, if their initial timestamps differ, it is a good idea
10302 to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
10303 have them begin in the same zero timestamp, as the example for
10304 the @var{movie} filter does.
10305
10306 You can chain together more overlays but you should test the
10307 efficiency of such approach.
10308
10309 @subsection Commands
10310
10311 This filter supports the following commands:
10312 @table @option
10313 @item x
10314 @item y
10315 Modify the x and y of the overlay input.
10316 The command accepts the same syntax of the corresponding option.
10317
10318 If the specified expression is not valid, it is kept at its current
10319 value.
10320 @end table
10321
10322 @subsection Examples
10323
10324 @itemize
10325 @item
10326 Draw the overlay at 10 pixels from the bottom right corner of the main
10327 video:
10328 @example
10329 overlay=main_w-overlay_w-10:main_h-overlay_h-10
10330 @end example
10331
10332 Using named options the example above becomes:
10333 @example
10334 overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
10335 @end example
10336
10337 @item
10338 Insert a transparent PNG logo in the bottom left corner of the input,
10339 using the @command{ffmpeg} tool with the @code{-filter_complex} option:
10340 @example
10341 ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
10342 @end example
10343
10344 @item
10345 Insert 2 different transparent PNG logos (second logo on bottom
10346 right corner) using the @command{ffmpeg} tool:
10347 @example
10348 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
10349 @end example
10350
10351 @item
10352 Add a transparent color layer on top of the main video; @code{WxH}
10353 must specify the size of the main input to the overlay filter:
10354 @example
10355 color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
10356 @end example
10357
10358 @item
10359 Play an original video and a filtered version (here with the deshake
10360 filter) side by side using the @command{ffplay} tool:
10361 @example
10362 ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
10363 @end example
10364
10365 The above command is the same as:
10366 @example
10367 ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
10368 @end example
10369
10370 @item
10371 Make a sliding overlay appearing from the left to the right top part of the
10372 screen starting since time 2:
10373 @example
10374 overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
10375 @end example
10376
10377 @item
10378 Compose output by putting two input videos side to side:
10379 @example
10380 ffmpeg -i left.avi -i right.avi -filter_complex "
10381 nullsrc=size=200x100 [background];
10382 [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
10383 [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
10384 [background][left]       overlay=shortest=1       [background+left];
10385 [background+left][right] overlay=shortest=1:x=100 [left+right]
10386 "
10387 @end example
10388
10389 @item
10390 Mask 10-20 seconds of a video by applying the delogo filter to a section
10391 @example
10392 ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
10393 -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]'
10394 masked.avi
10395 @end example
10396
10397 @item
10398 Chain several overlays in cascade:
10399 @example
10400 nullsrc=s=200x200 [bg];
10401 testsrc=s=100x100, split=4 [in0][in1][in2][in3];
10402 [in0] lutrgb=r=0, [bg]   overlay=0:0     [mid0];
10403 [in1] lutrgb=g=0, [mid0] overlay=100:0   [mid1];
10404 [in2] lutrgb=b=0, [mid1] overlay=0:100   [mid2];
10405 [in3] null,       [mid2] overlay=100:100 [out0]
10406 @end example
10407
10408 @end itemize
10409
10410 @section owdenoise
10411
10412 Apply Overcomplete Wavelet denoiser.
10413
10414 The filter accepts the following options:
10415
10416 @table @option
10417 @item depth
10418 Set depth.
10419
10420 Larger depth values will denoise lower frequency components more, but
10421 slow down filtering.
10422
10423 Must be an int in the range 8-16, default is @code{8}.
10424
10425 @item luma_strength, ls
10426 Set luma strength.
10427
10428 Must be a double value in the range 0-1000, default is @code{1.0}.
10429
10430 @item chroma_strength, cs
10431 Set chroma strength.
10432
10433 Must be a double value in the range 0-1000, default is @code{1.0}.
10434 @end table
10435
10436 @anchor{pad}
10437 @section pad
10438
10439 Add paddings to the input image, and place the original input at the
10440 provided @var{x}, @var{y} coordinates.
10441
10442 It accepts the following parameters:
10443
10444 @table @option
10445 @item width, w
10446 @item height, h
10447 Specify an expression for the size of the output image with the
10448 paddings added. If the value for @var{width} or @var{height} is 0, the
10449 corresponding input size is used for the output.
10450
10451 The @var{width} expression can reference the value set by the
10452 @var{height} expression, and vice versa.
10453
10454 The default value of @var{width} and @var{height} is 0.
10455
10456 @item x
10457 @item y
10458 Specify the offsets to place the input image at within the padded area,
10459 with respect to the top/left border of the output image.
10460
10461 The @var{x} expression can reference the value set by the @var{y}
10462 expression, and vice versa.
10463
10464 The default value of @var{x} and @var{y} is 0.
10465
10466 @item color
10467 Specify the color of the padded area. For the syntax of this option,
10468 check the "Color" section in the ffmpeg-utils manual.
10469
10470 The default value of @var{color} is "black".
10471
10472 @item eval
10473 Specify when to evaluate  @var{width}, @var{height}, @var{x} and @var{y} expression.
10474
10475 It accepts the following values:
10476
10477 @table @samp
10478 @item init
10479 Only evaluate expressions once during the filter initialization or when
10480 a command is processed.
10481
10482 @item frame
10483 Evaluate expressions for each incoming frame.
10484
10485 @end table
10486
10487 Default value is @samp{init}.
10488
10489 @end table
10490
10491 The value for the @var{width}, @var{height}, @var{x}, and @var{y}
10492 options are expressions containing the following constants:
10493
10494 @table @option
10495 @item in_w
10496 @item in_h
10497 The input video width and height.
10498
10499 @item iw
10500 @item ih
10501 These are the same as @var{in_w} and @var{in_h}.
10502
10503 @item out_w
10504 @item out_h
10505 The output width and height (the size of the padded area), as
10506 specified by the @var{width} and @var{height} expressions.
10507
10508 @item ow
10509 @item oh
10510 These are the same as @var{out_w} and @var{out_h}.
10511
10512 @item x
10513 @item y
10514 The x and y offsets as specified by the @var{x} and @var{y}
10515 expressions, or NAN if not yet specified.
10516
10517 @item a
10518 same as @var{iw} / @var{ih}
10519
10520 @item sar
10521 input sample aspect ratio
10522
10523 @item dar
10524 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
10525
10526 @item hsub
10527 @item vsub
10528 The horizontal and vertical chroma subsample values. For example for the
10529 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
10530 @end table
10531
10532 @subsection Examples
10533
10534 @itemize
10535 @item
10536 Add paddings with the color "violet" to the input video. The output video
10537 size is 640x480, and the top-left corner of the input video is placed at
10538 column 0, row 40
10539 @example
10540 pad=640:480:0:40:violet
10541 @end example
10542
10543 The example above is equivalent to the following command:
10544 @example
10545 pad=width=640:height=480:x=0:y=40:color=violet
10546 @end example
10547
10548 @item
10549 Pad the input to get an output with dimensions increased by 3/2,
10550 and put the input video at the center of the padded area:
10551 @example
10552 pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
10553 @end example
10554
10555 @item
10556 Pad the input to get a squared output with size equal to the maximum
10557 value between the input width and height, and put the input video at
10558 the center of the padded area:
10559 @example
10560 pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
10561 @end example
10562
10563 @item
10564 Pad the input to get a final w/h ratio of 16:9:
10565 @example
10566 pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
10567 @end example
10568
10569 @item
10570 In case of anamorphic video, in order to set the output display aspect
10571 correctly, it is necessary to use @var{sar} in the expression,
10572 according to the relation:
10573 @example
10574 (ih * X / ih) * sar = output_dar
10575 X = output_dar / sar
10576 @end example
10577
10578 Thus the previous example needs to be modified to:
10579 @example
10580 pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
10581 @end example
10582
10583 @item
10584 Double the output size and put the input video in the bottom-right
10585 corner of the output padded area:
10586 @example
10587 pad="2*iw:2*ih:ow-iw:oh-ih"
10588 @end example
10589 @end itemize
10590
10591 @anchor{palettegen}
10592 @section palettegen
10593
10594 Generate one palette for a whole video stream.
10595
10596 It accepts the following options:
10597
10598 @table @option
10599 @item max_colors
10600 Set the maximum number of colors to quantize in the palette.
10601 Note: the palette will still contain 256 colors; the unused palette entries
10602 will be black.
10603
10604 @item reserve_transparent
10605 Create a palette of 255 colors maximum and reserve the last one for
10606 transparency. Reserving the transparency color is useful for GIF optimization.
10607 If not set, the maximum of colors in the palette will be 256. You probably want
10608 to disable this option for a standalone image.
10609 Set by default.
10610
10611 @item stats_mode
10612 Set statistics mode.
10613
10614 It accepts the following values:
10615 @table @samp
10616 @item full
10617 Compute full frame histograms.
10618 @item diff
10619 Compute histograms only for the part that differs from previous frame. This
10620 might be relevant to give more importance to the moving part of your input if
10621 the background is static.
10622 @item single
10623 Compute new histogram for each frame.
10624 @end table
10625
10626 Default value is @var{full}.
10627 @end table
10628
10629 The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
10630 (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
10631 color quantization of the palette. This information is also visible at
10632 @var{info} logging level.
10633
10634 @subsection Examples
10635
10636 @itemize
10637 @item
10638 Generate a representative palette of a given video using @command{ffmpeg}:
10639 @example
10640 ffmpeg -i input.mkv -vf palettegen palette.png
10641 @end example
10642 @end itemize
10643
10644 @section paletteuse
10645
10646 Use a palette to downsample an input video stream.
10647
10648 The filter takes two inputs: one video stream and a palette. The palette must
10649 be a 256 pixels image.
10650
10651 It accepts the following options:
10652
10653 @table @option
10654 @item dither
10655 Select dithering mode. Available algorithms are:
10656 @table @samp
10657 @item bayer
10658 Ordered 8x8 bayer dithering (deterministic)
10659 @item heckbert
10660 Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
10661 Note: this dithering is sometimes considered "wrong" and is included as a
10662 reference.
10663 @item floyd_steinberg
10664 Floyd and Steingberg dithering (error diffusion)
10665 @item sierra2
10666 Frankie Sierra dithering v2 (error diffusion)
10667 @item sierra2_4a
10668 Frankie Sierra dithering v2 "Lite" (error diffusion)
10669 @end table
10670
10671 Default is @var{sierra2_4a}.
10672
10673 @item bayer_scale
10674 When @var{bayer} dithering is selected, this option defines the scale of the
10675 pattern (how much the crosshatch pattern is visible). A low value means more
10676 visible pattern for less banding, and higher value means less visible pattern
10677 at the cost of more banding.
10678
10679 The option must be an integer value in the range [0,5]. Default is @var{2}.
10680
10681 @item diff_mode
10682 If set, define the zone to process
10683
10684 @table @samp
10685 @item rectangle
10686 Only the changing rectangle will be reprocessed. This is similar to GIF
10687 cropping/offsetting compression mechanism. This option can be useful for speed
10688 if only a part of the image is changing, and has use cases such as limiting the
10689 scope of the error diffusal @option{dither} to the rectangle that bounds the
10690 moving scene (it leads to more deterministic output if the scene doesn't change
10691 much, and as a result less moving noise and better GIF compression).
10692 @end table
10693
10694 Default is @var{none}.
10695
10696 @item new
10697 Take new palette for each output frame.
10698 @end table
10699
10700 @subsection Examples
10701
10702 @itemize
10703 @item
10704 Use a palette (generated for example with @ref{palettegen}) to encode a GIF
10705 using @command{ffmpeg}:
10706 @example
10707 ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
10708 @end example
10709 @end itemize
10710
10711 @section perspective
10712
10713 Correct perspective of video not recorded perpendicular to the screen.
10714
10715 A description of the accepted parameters follows.
10716
10717 @table @option
10718 @item x0
10719 @item y0
10720 @item x1
10721 @item y1
10722 @item x2
10723 @item y2
10724 @item x3
10725 @item y3
10726 Set coordinates expression for top left, top right, bottom left and bottom right corners.
10727 Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
10728 If the @code{sense} option is set to @code{source}, then the specified points will be sent
10729 to the corners of the destination. If the @code{sense} option is set to @code{destination},
10730 then the corners of the source will be sent to the specified coordinates.
10731
10732 The expressions can use the following variables:
10733
10734 @table @option
10735 @item W
10736 @item H
10737 the width and height of video frame.
10738 @item in
10739 Input frame count.
10740 @item on
10741 Output frame count.
10742 @end table
10743
10744 @item interpolation
10745 Set interpolation for perspective correction.
10746
10747 It accepts the following values:
10748 @table @samp
10749 @item linear
10750 @item cubic
10751 @end table
10752
10753 Default value is @samp{linear}.
10754
10755 @item sense
10756 Set interpretation of coordinate options.
10757
10758 It accepts the following values:
10759 @table @samp
10760 @item 0, source
10761
10762 Send point in the source specified by the given coordinates to
10763 the corners of the destination.
10764
10765 @item 1, destination
10766
10767 Send the corners of the source to the point in the destination specified
10768 by the given coordinates.
10769
10770 Default value is @samp{source}.
10771 @end table
10772
10773 @item eval
10774 Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
10775
10776 It accepts the following values:
10777 @table @samp
10778 @item init
10779 only evaluate expressions once during the filter initialization or
10780 when a command is processed
10781
10782 @item frame
10783 evaluate expressions for each incoming frame
10784 @end table
10785
10786 Default value is @samp{init}.
10787 @end table
10788
10789 @section phase
10790
10791 Delay interlaced video by one field time so that the field order changes.
10792
10793 The intended use is to fix PAL movies that have been captured with the
10794 opposite field order to the film-to-video transfer.
10795
10796 A description of the accepted parameters follows.
10797
10798 @table @option
10799 @item mode
10800 Set phase mode.
10801
10802 It accepts the following values:
10803 @table @samp
10804 @item t
10805 Capture field order top-first, transfer bottom-first.
10806 Filter will delay the bottom field.
10807
10808 @item b
10809 Capture field order bottom-first, transfer top-first.
10810 Filter will delay the top field.
10811
10812 @item p
10813 Capture and transfer with the same field order. This mode only exists
10814 for the documentation of the other options to refer to, but if you
10815 actually select it, the filter will faithfully do nothing.
10816
10817 @item a
10818 Capture field order determined automatically by field flags, transfer
10819 opposite.
10820 Filter selects among @samp{t} and @samp{b} modes on a frame by frame
10821 basis using field flags. If no field information is available,
10822 then this works just like @samp{u}.
10823
10824 @item u
10825 Capture unknown or varying, transfer opposite.
10826 Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
10827 analyzing the images and selecting the alternative that produces best
10828 match between the fields.
10829
10830 @item T
10831 Capture top-first, transfer unknown or varying.
10832 Filter selects among @samp{t} and @samp{p} using image analysis.
10833
10834 @item B
10835 Capture bottom-first, transfer unknown or varying.
10836 Filter selects among @samp{b} and @samp{p} using image analysis.
10837
10838 @item A
10839 Capture determined by field flags, transfer unknown or varying.
10840 Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
10841 image analysis. If no field information is available, then this works just
10842 like @samp{U}. This is the default mode.
10843
10844 @item U
10845 Both capture and transfer unknown or varying.
10846 Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
10847 @end table
10848 @end table
10849
10850 @section pixdesctest
10851
10852 Pixel format descriptor test filter, mainly useful for internal
10853 testing. The output video should be equal to the input video.
10854
10855 For example:
10856 @example
10857 format=monow, pixdesctest
10858 @end example
10859
10860 can be used to test the monowhite pixel format descriptor definition.
10861
10862 @section pp
10863
10864 Enable the specified chain of postprocessing subfilters using libpostproc. This
10865 library should be automatically selected with a GPL build (@code{--enable-gpl}).
10866 Subfilters must be separated by '/' and can be disabled by prepending a '-'.
10867 Each subfilter and some options have a short and a long name that can be used
10868 interchangeably, i.e. dr/dering are the same.
10869
10870 The filters accept the following options:
10871
10872 @table @option
10873 @item subfilters
10874 Set postprocessing subfilters string.
10875 @end table
10876
10877 All subfilters share common options to determine their scope:
10878
10879 @table @option
10880 @item a/autoq
10881 Honor the quality commands for this subfilter.
10882
10883 @item c/chrom
10884 Do chrominance filtering, too (default).
10885
10886 @item y/nochrom
10887 Do luminance filtering only (no chrominance).
10888
10889 @item n/noluma
10890 Do chrominance filtering only (no luminance).
10891 @end table
10892
10893 These options can be appended after the subfilter name, separated by a '|'.
10894
10895 Available subfilters are:
10896
10897 @table @option
10898 @item hb/hdeblock[|difference[|flatness]]
10899 Horizontal deblocking filter
10900 @table @option
10901 @item difference
10902 Difference factor where higher values mean more deblocking (default: @code{32}).
10903 @item flatness
10904 Flatness threshold where lower values mean more deblocking (default: @code{39}).
10905 @end table
10906
10907 @item vb/vdeblock[|difference[|flatness]]
10908 Vertical deblocking filter
10909 @table @option
10910 @item difference
10911 Difference factor where higher values mean more deblocking (default: @code{32}).
10912 @item flatness
10913 Flatness threshold where lower values mean more deblocking (default: @code{39}).
10914 @end table
10915
10916 @item ha/hadeblock[|difference[|flatness]]
10917 Accurate horizontal deblocking filter
10918 @table @option
10919 @item difference
10920 Difference factor where higher values mean more deblocking (default: @code{32}).
10921 @item flatness
10922 Flatness threshold where lower values mean more deblocking (default: @code{39}).
10923 @end table
10924
10925 @item va/vadeblock[|difference[|flatness]]
10926 Accurate vertical deblocking filter
10927 @table @option
10928 @item difference
10929 Difference factor where higher values mean more deblocking (default: @code{32}).
10930 @item flatness
10931 Flatness threshold where lower values mean more deblocking (default: @code{39}).
10932 @end table
10933 @end table
10934
10935 The horizontal and vertical deblocking filters share the difference and
10936 flatness values so you cannot set different horizontal and vertical
10937 thresholds.
10938
10939 @table @option
10940 @item h1/x1hdeblock
10941 Experimental horizontal deblocking filter
10942
10943 @item v1/x1vdeblock
10944 Experimental vertical deblocking filter
10945
10946 @item dr/dering
10947 Deringing filter
10948
10949 @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
10950 @table @option
10951 @item threshold1
10952 larger -> stronger filtering
10953 @item threshold2
10954 larger -> stronger filtering
10955 @item threshold3
10956 larger -> stronger filtering
10957 @end table
10958
10959 @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
10960 @table @option
10961 @item f/fullyrange
10962 Stretch luminance to @code{0-255}.
10963 @end table
10964
10965 @item lb/linblenddeint
10966 Linear blend deinterlacing filter that deinterlaces the given block by
10967 filtering all lines with a @code{(1 2 1)} filter.
10968
10969 @item li/linipoldeint
10970 Linear interpolating deinterlacing filter that deinterlaces the given block by
10971 linearly interpolating every second line.
10972
10973 @item ci/cubicipoldeint
10974 Cubic interpolating deinterlacing filter deinterlaces the given block by
10975 cubically interpolating every second line.
10976
10977 @item md/mediandeint
10978 Median deinterlacing filter that deinterlaces the given block by applying a
10979 median filter to every second line.
10980
10981 @item fd/ffmpegdeint
10982 FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
10983 second line with a @code{(-1 4 2 4 -1)} filter.
10984
10985 @item l5/lowpass5
10986 Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
10987 block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
10988
10989 @item fq/forceQuant[|quantizer]
10990 Overrides the quantizer table from the input with the constant quantizer you
10991 specify.
10992 @table @option
10993 @item quantizer
10994 Quantizer to use
10995 @end table
10996
10997 @item de/default
10998 Default pp filter combination (@code{hb|a,vb|a,dr|a})
10999
11000 @item fa/fast
11001 Fast pp filter combination (@code{h1|a,v1|a,dr|a})
11002
11003 @item ac
11004 High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
11005 @end table
11006
11007 @subsection Examples
11008
11009 @itemize
11010 @item
11011 Apply horizontal and vertical deblocking, deringing and automatic
11012 brightness/contrast:
11013 @example
11014 pp=hb/vb/dr/al
11015 @end example
11016
11017 @item
11018 Apply default filters without brightness/contrast correction:
11019 @example
11020 pp=de/-al
11021 @end example
11022
11023 @item
11024 Apply default filters and temporal denoiser:
11025 @example
11026 pp=default/tmpnoise|1|2|3
11027 @end example
11028
11029 @item
11030 Apply deblocking on luminance only, and switch vertical deblocking on or off
11031 automatically depending on available CPU time:
11032 @example
11033 pp=hb|y/vb|a
11034 @end example
11035 @end itemize
11036
11037 @section pp7
11038 Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
11039 similar to spp = 6 with 7 point DCT, where only the center sample is
11040 used after IDCT.
11041
11042 The filter accepts the following options:
11043
11044 @table @option
11045 @item qp
11046 Force a constant quantization parameter. It accepts an integer in range
11047 0 to 63. If not set, the filter will use the QP from the video stream
11048 (if available).
11049
11050 @item mode
11051 Set thresholding mode. Available modes are:
11052
11053 @table @samp
11054 @item hard
11055 Set hard thresholding.
11056 @item soft
11057 Set soft thresholding (better de-ringing effect, but likely blurrier).
11058 @item medium
11059 Set medium thresholding (good results, default).
11060 @end table
11061 @end table
11062
11063 @section premultiply
11064 Apply alpha premultiply effect to input video stream using first plane
11065 of second stream as alpha.
11066
11067 Both streams must have same dimensions and same pixel format.
11068
11069 @section prewitt
11070 Apply prewitt operator to input video stream.
11071
11072 The filter accepts the following option:
11073
11074 @table @option
11075 @item planes
11076 Set which planes will be processed, unprocessed planes will be copied.
11077 By default value 0xf, all planes will be processed.
11078
11079 @item scale
11080 Set value which will be multiplied with filtered result.
11081
11082 @item delta
11083 Set value which will be added to filtered result.
11084 @end table
11085
11086 @section psnr
11087
11088 Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
11089 Ratio) between two input videos.
11090
11091 This filter takes in input two input videos, the first input is
11092 considered the "main" source and is passed unchanged to the
11093 output. The second input is used as a "reference" video for computing
11094 the PSNR.
11095
11096 Both video inputs must have the same resolution and pixel format for
11097 this filter to work correctly. Also it assumes that both inputs
11098 have the same number of frames, which are compared one by one.
11099
11100 The obtained average PSNR is printed through the logging system.
11101
11102 The filter stores the accumulated MSE (mean squared error) of each
11103 frame, and at the end of the processing it is averaged across all frames
11104 equally, and the following formula is applied to obtain the PSNR:
11105
11106 @example
11107 PSNR = 10*log10(MAX^2/MSE)
11108 @end example
11109
11110 Where MAX is the average of the maximum values of each component of the
11111 image.
11112
11113 The description of the accepted parameters follows.
11114
11115 @table @option
11116 @item stats_file, f
11117 If specified the filter will use the named file to save the PSNR of
11118 each individual frame. When filename equals "-" the data is sent to
11119 standard output.
11120
11121 @item stats_version
11122 Specifies which version of the stats file format to use. Details of
11123 each format are written below.
11124 Default value is 1.
11125
11126 @item stats_add_max
11127 Determines whether the max value is output to the stats log.
11128 Default value is 0.
11129 Requires stats_version >= 2. If this is set and stats_version < 2,
11130 the filter will return an error.
11131 @end table
11132
11133 The file printed if @var{stats_file} is selected, contains a sequence of
11134 key/value pairs of the form @var{key}:@var{value} for each compared
11135 couple of frames.
11136
11137 If a @var{stats_version} greater than 1 is specified, a header line precedes
11138 the list of per-frame-pair stats, with key value pairs following the frame
11139 format with the following parameters:
11140
11141 @table @option
11142 @item psnr_log_version
11143 The version of the log file format. Will match @var{stats_version}.
11144
11145 @item fields
11146 A comma separated list of the per-frame-pair parameters included in
11147 the log.
11148 @end table
11149
11150 A description of each shown per-frame-pair parameter follows:
11151
11152 @table @option
11153 @item n
11154 sequential number of the input frame, starting from 1
11155
11156 @item mse_avg
11157 Mean Square Error pixel-by-pixel average difference of the compared
11158 frames, averaged over all the image components.
11159
11160 @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
11161 Mean Square Error pixel-by-pixel average difference of the compared
11162 frames for the component specified by the suffix.
11163
11164 @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
11165 Peak Signal to Noise ratio of the compared frames for the component
11166 specified by the suffix.
11167
11168 @item max_avg, max_y, max_u, max_v
11169 Maximum allowed value for each channel, and average over all
11170 channels.
11171 @end table
11172
11173 For example:
11174 @example
11175 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
11176 [main][ref] psnr="stats_file=stats.log" [out]
11177 @end example
11178
11179 On this example the input file being processed is compared with the
11180 reference file @file{ref_movie.mpg}. The PSNR of each individual frame
11181 is stored in @file{stats.log}.
11182
11183 @anchor{pullup}
11184 @section pullup
11185
11186 Pulldown reversal (inverse telecine) filter, capable of handling mixed
11187 hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
11188 content.
11189
11190 The pullup filter is designed to take advantage of future context in making
11191 its decisions. This filter is stateless in the sense that it does not lock
11192 onto a pattern to follow, but it instead looks forward to the following
11193 fields in order to identify matches and rebuild progressive frames.
11194
11195 To produce content with an even framerate, insert the fps filter after
11196 pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
11197 @code{fps=24} for 30fps and the (rare) telecined 25fps input.
11198
11199 The filter accepts the following options:
11200
11201 @table @option
11202 @item jl
11203 @item jr
11204 @item jt
11205 @item jb
11206 These options set the amount of "junk" to ignore at the left, right, top, and
11207 bottom of the image, respectively. Left and right are in units of 8 pixels,
11208 while top and bottom are in units of 2 lines.
11209 The default is 8 pixels on each side.
11210
11211 @item sb
11212 Set the strict breaks. Setting this option to 1 will reduce the chances of
11213 filter generating an occasional mismatched frame, but it may also cause an
11214 excessive number of frames to be dropped during high motion sequences.
11215 Conversely, setting it to -1 will make filter match fields more easily.
11216 This may help processing of video where there is slight blurring between
11217 the fields, but may also cause there to be interlaced frames in the output.
11218 Default value is @code{0}.
11219
11220 @item mp
11221 Set the metric plane to use. It accepts the following values:
11222 @table @samp
11223 @item l
11224 Use luma plane.
11225
11226 @item u
11227 Use chroma blue plane.
11228
11229 @item v
11230 Use chroma red plane.
11231 @end table
11232
11233 This option may be set to use chroma plane instead of the default luma plane
11234 for doing filter's computations. This may improve accuracy on very clean
11235 source material, but more likely will decrease accuracy, especially if there
11236 is chroma noise (rainbow effect) or any grayscale video.
11237 The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
11238 load and make pullup usable in realtime on slow machines.
11239 @end table
11240
11241 For best results (without duplicated frames in the output file) it is
11242 necessary to change the output frame rate. For example, to inverse
11243 telecine NTSC input:
11244 @example
11245 ffmpeg -i input -vf pullup -r 24000/1001 ...
11246 @end example
11247
11248 @section qp
11249
11250 Change video quantization parameters (QP).
11251
11252 The filter accepts the following option:
11253
11254 @table @option
11255 @item qp
11256 Set expression for quantization parameter.
11257 @end table
11258
11259 The expression is evaluated through the eval API and can contain, among others,
11260 the following constants:
11261
11262 @table @var
11263 @item known
11264 1 if index is not 129, 0 otherwise.
11265
11266 @item qp
11267 Sequentional index starting from -129 to 128.
11268 @end table
11269
11270 @subsection Examples
11271
11272 @itemize
11273 @item
11274 Some equation like:
11275 @example
11276 qp=2+2*sin(PI*qp)
11277 @end example
11278 @end itemize
11279
11280 @section random
11281
11282 Flush video frames from internal cache of frames into a random order.
11283 No frame is discarded.
11284 Inspired by @ref{frei0r} nervous filter.
11285
11286 @table @option
11287 @item frames
11288 Set size in number of frames of internal cache, in range from @code{2} to
11289 @code{512}. Default is @code{30}.
11290
11291 @item seed
11292 Set seed for random number generator, must be an integer included between
11293 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
11294 less than @code{0}, the filter will try to use a good random seed on a
11295 best effort basis.
11296 @end table
11297
11298 @section readeia608
11299
11300 Read closed captioning (EIA-608) information from the top lines of a video frame.
11301
11302 This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
11303 @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
11304 with EIA-608 data (starting from 0). A description of each metadata value follows:
11305
11306 @table @option
11307 @item lavfi.readeia608.X.cc
11308 The two bytes stored as EIA-608 data (printed in hexadecimal).
11309
11310 @item lavfi.readeia608.X.line
11311 The number of the line on which the EIA-608 data was identified and read.
11312 @end table
11313
11314 This filter accepts the following options:
11315
11316 @table @option
11317 @item scan_min
11318 Set the line to start scanning for EIA-608 data. Default is @code{0}.
11319
11320 @item scan_max
11321 Set the line to end scanning for EIA-608 data. Default is @code{29}.
11322
11323 @item mac
11324 Set minimal acceptable amplitude change for sync codes detection.
11325 Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
11326
11327 @item spw
11328 Set the ratio of width reserved for sync code detection.
11329 Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
11330
11331 @item mhd
11332 Set the max peaks height difference for sync code detection.
11333 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
11334
11335 @item mpd
11336 Set max peaks period difference for sync code detection.
11337 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
11338
11339 @item msd
11340 Set the first two max start code bits differences.
11341 Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
11342
11343 @item bhd
11344 Set the minimum ratio of bits height compared to 3rd start code bit.
11345 Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
11346
11347 @item th_w
11348 Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
11349
11350 @item th_b
11351 Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
11352
11353 @item chp
11354 Enable checking the parity bit. In the event of a parity error, the filter will output
11355 @code{0x00} for that character. Default is false.
11356 @end table
11357
11358 @subsection Examples
11359
11360 @itemize
11361 @item
11362 Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
11363 @example
11364 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
11365 @end example
11366 @end itemize
11367
11368 @section readvitc
11369
11370 Read vertical interval timecode (VITC) information from the top lines of a
11371 video frame.
11372
11373 The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
11374 timecode value, if a valid timecode has been detected. Further metadata key
11375 @code{lavfi.readvitc.found} is set to 0/1 depending on whether
11376 timecode data has been found or not.
11377
11378 This filter accepts the following options:
11379
11380 @table @option
11381 @item scan_max
11382 Set the maximum number of lines to scan for VITC data. If the value is set to
11383 @code{-1} the full video frame is scanned. Default is @code{45}.
11384
11385 @item thr_b
11386 Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
11387 default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
11388
11389 @item thr_w
11390 Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
11391 default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
11392 @end table
11393
11394 @subsection Examples
11395
11396 @itemize
11397 @item
11398 Detect and draw VITC data onto the video frame; if no valid VITC is detected,
11399 draw @code{--:--:--:--} as a placeholder:
11400 @example
11401 ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
11402 @end example
11403 @end itemize
11404
11405 @section remap
11406
11407 Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
11408
11409 Destination pixel at position (X, Y) will be picked from source (x, y) position
11410 where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
11411 value for pixel will be used for destination pixel.
11412
11413 Xmap and Ymap input video streams must be of same dimensions. Output video stream
11414 will have Xmap/Ymap video stream dimensions.
11415 Xmap and Ymap input video streams are 16bit depth, single channel.
11416
11417 @section removegrain
11418
11419 The removegrain filter is a spatial denoiser for progressive video.
11420
11421 @table @option
11422 @item m0
11423 Set mode for the first plane.
11424
11425 @item m1
11426 Set mode for the second plane.
11427
11428 @item m2
11429 Set mode for the third plane.
11430
11431 @item m3
11432 Set mode for the fourth plane.
11433 @end table
11434
11435 Range of mode is from 0 to 24. Description of each mode follows:
11436
11437 @table @var
11438 @item 0
11439 Leave input plane unchanged. Default.
11440
11441 @item 1
11442 Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
11443
11444 @item 2
11445 Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
11446
11447 @item 3
11448 Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
11449
11450 @item 4
11451 Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
11452 This is equivalent to a median filter.
11453
11454 @item 5
11455 Line-sensitive clipping giving the minimal change.
11456
11457 @item 6
11458 Line-sensitive clipping, intermediate.
11459
11460 @item 7
11461 Line-sensitive clipping, intermediate.
11462
11463 @item 8
11464 Line-sensitive clipping, intermediate.
11465
11466 @item 9
11467 Line-sensitive clipping on a line where the neighbours pixels are the closest.
11468
11469 @item 10
11470 Replaces the target pixel with the closest neighbour.
11471
11472 @item 11
11473 [1 2 1] horizontal and vertical kernel blur.
11474
11475 @item 12
11476 Same as mode 11.
11477
11478 @item 13
11479 Bob mode, interpolates top field from the line where the neighbours
11480 pixels are the closest.
11481
11482 @item 14
11483 Bob mode, interpolates bottom field from the line where the neighbours
11484 pixels are the closest.
11485
11486 @item 15
11487 Bob mode, interpolates top field. Same as 13 but with a more complicated
11488 interpolation formula.
11489
11490 @item 16
11491 Bob mode, interpolates bottom field. Same as 14 but with a more complicated
11492 interpolation formula.
11493
11494 @item 17
11495 Clips the pixel with the minimum and maximum of respectively the maximum and
11496 minimum of each pair of opposite neighbour pixels.
11497
11498 @item 18
11499 Line-sensitive clipping using opposite neighbours whose greatest distance from
11500 the current pixel is minimal.
11501
11502 @item 19
11503 Replaces the pixel with the average of its 8 neighbours.
11504
11505 @item 20
11506 Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
11507
11508 @item 21
11509 Clips pixels using the averages of opposite neighbour.
11510
11511 @item 22
11512 Same as mode 21 but simpler and faster.
11513
11514 @item 23
11515 Small edge and halo removal, but reputed useless.
11516
11517 @item 24
11518 Similar as 23.
11519 @end table
11520
11521 @section removelogo
11522
11523 Suppress a TV station logo, using an image file to determine which
11524 pixels comprise the logo. It works by filling in the pixels that
11525 comprise the logo with neighboring pixels.
11526
11527 The filter accepts the following options:
11528
11529 @table @option
11530 @item filename, f
11531 Set the filter bitmap file, which can be any image format supported by
11532 libavformat. The width and height of the image file must match those of the
11533 video stream being processed.
11534 @end table
11535
11536 Pixels in the provided bitmap image with a value of zero are not
11537 considered part of the logo, non-zero pixels are considered part of
11538 the logo. If you use white (255) for the logo and black (0) for the
11539 rest, you will be safe. For making the filter bitmap, it is
11540 recommended to take a screen capture of a black frame with the logo
11541 visible, and then using a threshold filter followed by the erode
11542 filter once or twice.
11543
11544 If needed, little splotches can be fixed manually. Remember that if
11545 logo pixels are not covered, the filter quality will be much
11546 reduced. Marking too many pixels as part of the logo does not hurt as
11547 much, but it will increase the amount of blurring needed to cover over
11548 the image and will destroy more information than necessary, and extra
11549 pixels will slow things down on a large logo.
11550
11551 @section repeatfields
11552
11553 This filter uses the repeat_field flag from the Video ES headers and hard repeats
11554 fields based on its value.
11555
11556 @section reverse
11557
11558 Reverse a video clip.
11559
11560 Warning: This filter requires memory to buffer the entire clip, so trimming
11561 is suggested.
11562
11563 @subsection Examples
11564
11565 @itemize
11566 @item
11567 Take the first 5 seconds of a clip, and reverse it.
11568 @example
11569 trim=end=5,reverse
11570 @end example
11571 @end itemize
11572
11573 @section rotate
11574
11575 Rotate video by an arbitrary angle expressed in radians.
11576
11577 The filter accepts the following options:
11578
11579 A description of the optional parameters follows.
11580 @table @option
11581 @item angle, a
11582 Set an expression for the angle by which to rotate the input video
11583 clockwise, expressed as a number of radians. A negative value will
11584 result in a counter-clockwise rotation. By default it is set to "0".
11585
11586 This expression is evaluated for each frame.
11587
11588 @item out_w, ow
11589 Set the output width expression, default value is "iw".
11590 This expression is evaluated just once during configuration.
11591
11592 @item out_h, oh
11593 Set the output height expression, default value is "ih".
11594 This expression is evaluated just once during configuration.
11595
11596 @item bilinear
11597 Enable bilinear interpolation if set to 1, a value of 0 disables
11598 it. Default value is 1.
11599
11600 @item fillcolor, c
11601 Set the color used to fill the output area not covered by the rotated
11602 image. For the general syntax of this option, check the "Color" section in the
11603 ffmpeg-utils manual. If the special value "none" is selected then no
11604 background is printed (useful for example if the background is never shown).
11605
11606 Default value is "black".
11607 @end table
11608
11609 The expressions for the angle and the output size can contain the
11610 following constants and functions:
11611
11612 @table @option
11613 @item n
11614 sequential number of the input frame, starting from 0. It is always NAN
11615 before the first frame is filtered.
11616
11617 @item t
11618 time in seconds of the input frame, it is set to 0 when the filter is
11619 configured. It is always NAN before the first frame is filtered.
11620
11621 @item hsub
11622 @item vsub
11623 horizontal and vertical chroma subsample values. For example for the
11624 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
11625
11626 @item in_w, iw
11627 @item in_h, ih
11628 the input video width and height
11629
11630 @item out_w, ow
11631 @item out_h, oh
11632 the output width and height, that is the size of the padded area as
11633 specified by the @var{width} and @var{height} expressions
11634
11635 @item rotw(a)
11636 @item roth(a)
11637 the minimal width/height required for completely containing the input
11638 video rotated by @var{a} radians.
11639
11640 These are only available when computing the @option{out_w} and
11641 @option{out_h} expressions.
11642 @end table
11643
11644 @subsection Examples
11645
11646 @itemize
11647 @item
11648 Rotate the input by PI/6 radians clockwise:
11649 @example
11650 rotate=PI/6
11651 @end example
11652
11653 @item
11654 Rotate the input by PI/6 radians counter-clockwise:
11655 @example
11656 rotate=-PI/6
11657 @end example
11658
11659 @item
11660 Rotate the input by 45 degrees clockwise:
11661 @example
11662 rotate=45*PI/180
11663 @end example
11664
11665 @item
11666 Apply a constant rotation with period T, starting from an angle of PI/3:
11667 @example
11668 rotate=PI/3+2*PI*t/T
11669 @end example
11670
11671 @item
11672 Make the input video rotation oscillating with a period of T
11673 seconds and an amplitude of A radians:
11674 @example
11675 rotate=A*sin(2*PI/T*t)
11676 @end example
11677
11678 @item
11679 Rotate the video, output size is chosen so that the whole rotating
11680 input video is always completely contained in the output:
11681 @example
11682 rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
11683 @end example
11684
11685 @item
11686 Rotate the video, reduce the output size so that no background is ever
11687 shown:
11688 @example
11689 rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
11690 @end example
11691 @end itemize
11692
11693 @subsection Commands
11694
11695 The filter supports the following commands:
11696
11697 @table @option
11698 @item a, angle
11699 Set the angle expression.
11700 The command accepts the same syntax of the corresponding option.
11701
11702 If the specified expression is not valid, it is kept at its current
11703 value.
11704 @end table
11705
11706 @section sab
11707
11708 Apply Shape Adaptive Blur.
11709
11710 The filter accepts the following options:
11711
11712 @table @option
11713 @item luma_radius, lr
11714 Set luma blur filter strength, must be a value in range 0.1-4.0, default
11715 value is 1.0. A greater value will result in a more blurred image, and
11716 in slower processing.
11717
11718 @item luma_pre_filter_radius, lpfr
11719 Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
11720 value is 1.0.
11721
11722 @item luma_strength, ls
11723 Set luma maximum difference between pixels to still be considered, must
11724 be a value in the 0.1-100.0 range, default value is 1.0.
11725
11726 @item chroma_radius, cr
11727 Set chroma blur filter strength, must be a value in range -0.9-4.0. A
11728 greater value will result in a more blurred image, and in slower
11729 processing.
11730
11731 @item chroma_pre_filter_radius, cpfr
11732 Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
11733
11734 @item chroma_strength, cs
11735 Set chroma maximum difference between pixels to still be considered,
11736 must be a value in the -0.9-100.0 range.
11737 @end table
11738
11739 Each chroma option value, if not explicitly specified, is set to the
11740 corresponding luma option value.
11741
11742 @anchor{scale}
11743 @section scale
11744
11745 Scale (resize) the input video, using the libswscale library.
11746
11747 The scale filter forces the output display aspect ratio to be the same
11748 of the input, by changing the output sample aspect ratio.
11749
11750 If the input image format is different from the format requested by
11751 the next filter, the scale filter will convert the input to the
11752 requested format.
11753
11754 @subsection Options
11755 The filter accepts the following options, or any of the options
11756 supported by the libswscale scaler.
11757
11758 See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
11759 the complete list of scaler options.
11760
11761 @table @option
11762 @item width, w
11763 @item height, h
11764 Set the output video dimension expression. Default value is the input
11765 dimension.
11766
11767 If the value is 0, the input width is used for the output.
11768
11769 If one of the values is -1, the scale filter will use a value that
11770 maintains the aspect ratio of the input image, calculated from the
11771 other specified dimension. If both of them are -1, the input size is
11772 used
11773
11774 If one of the values is -n with n > 1, the scale filter will also use a value
11775 that maintains the aspect ratio of the input image, calculated from the other
11776 specified dimension. After that it will, however, make sure that the calculated
11777 dimension is divisible by n and adjust the value if necessary.
11778
11779 See below for the list of accepted constants for use in the dimension
11780 expression.
11781
11782 @item eval
11783 Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
11784
11785 @table @samp
11786 @item init
11787 Only evaluate expressions once during the filter initialization or when a command is processed.
11788
11789 @item frame
11790 Evaluate expressions for each incoming frame.
11791
11792 @end table
11793
11794 Default value is @samp{init}.
11795
11796
11797 @item interl
11798 Set the interlacing mode. It accepts the following values:
11799
11800 @table @samp
11801 @item 1
11802 Force interlaced aware scaling.
11803
11804 @item 0
11805 Do not apply interlaced scaling.
11806
11807 @item -1
11808 Select interlaced aware scaling depending on whether the source frames
11809 are flagged as interlaced or not.
11810 @end table
11811
11812 Default value is @samp{0}.
11813
11814 @item flags
11815 Set libswscale scaling flags. See
11816 @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
11817 complete list of values. If not explicitly specified the filter applies
11818 the default flags.
11819
11820
11821 @item param0, param1
11822 Set libswscale input parameters for scaling algorithms that need them. See
11823 @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
11824 complete documentation. If not explicitly specified the filter applies
11825 empty parameters.
11826
11827
11828
11829 @item size, s
11830 Set the video size. For the syntax of this option, check the
11831 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
11832
11833 @item in_color_matrix
11834 @item out_color_matrix
11835 Set in/output YCbCr color space type.
11836
11837 This allows the autodetected value to be overridden as well as allows forcing
11838 a specific value used for the output and encoder.
11839
11840 If not specified, the color space type depends on the pixel format.
11841
11842 Possible values:
11843
11844 @table @samp
11845 @item auto
11846 Choose automatically.
11847
11848 @item bt709
11849 Format conforming to International Telecommunication Union (ITU)
11850 Recommendation BT.709.
11851
11852 @item fcc
11853 Set color space conforming to the United States Federal Communications
11854 Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
11855
11856 @item bt601
11857 Set color space conforming to:
11858
11859 @itemize
11860 @item
11861 ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
11862
11863 @item
11864 ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
11865
11866 @item
11867 Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
11868
11869 @end itemize
11870
11871 @item smpte240m
11872 Set color space conforming to SMPTE ST 240:1999.
11873 @end table
11874
11875 @item in_range
11876 @item out_range
11877 Set in/output YCbCr sample range.
11878
11879 This allows the autodetected value to be overridden as well as allows forcing
11880 a specific value used for the output and encoder. If not specified, the
11881 range depends on the pixel format. Possible values:
11882
11883 @table @samp
11884 @item auto
11885 Choose automatically.
11886
11887 @item jpeg/full/pc
11888 Set full range (0-255 in case of 8-bit luma).
11889
11890 @item mpeg/tv
11891 Set "MPEG" range (16-235 in case of 8-bit luma).
11892 @end table
11893
11894 @item force_original_aspect_ratio
11895 Enable decreasing or increasing output video width or height if necessary to
11896 keep the original aspect ratio. Possible values:
11897
11898 @table @samp
11899 @item disable
11900 Scale the video as specified and disable this feature.
11901
11902 @item decrease
11903 The output video dimensions will automatically be decreased if needed.
11904
11905 @item increase
11906 The output video dimensions will automatically be increased if needed.
11907
11908 @end table
11909
11910 One useful instance of this option is that when you know a specific device's
11911 maximum allowed resolution, you can use this to limit the output video to
11912 that, while retaining the aspect ratio. For example, device A allows
11913 1280x720 playback, and your video is 1920x800. Using this option (set it to
11914 decrease) and specifying 1280x720 to the command line makes the output
11915 1280x533.
11916
11917 Please note that this is a different thing than specifying -1 for @option{w}
11918 or @option{h}, you still need to specify the output resolution for this option
11919 to work.
11920
11921 @end table
11922
11923 The values of the @option{w} and @option{h} options are expressions
11924 containing the following constants:
11925
11926 @table @var
11927 @item in_w
11928 @item in_h
11929 The input width and height
11930
11931 @item iw
11932 @item ih
11933 These are the same as @var{in_w} and @var{in_h}.
11934
11935 @item out_w
11936 @item out_h
11937 The output (scaled) width and height
11938
11939 @item ow
11940 @item oh
11941 These are the same as @var{out_w} and @var{out_h}
11942
11943 @item a
11944 The same as @var{iw} / @var{ih}
11945
11946 @item sar
11947 input sample aspect ratio
11948
11949 @item dar
11950 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
11951
11952 @item hsub
11953 @item vsub
11954 horizontal and vertical input chroma subsample values. For example for the
11955 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
11956
11957 @item ohsub
11958 @item ovsub
11959 horizontal and vertical output chroma subsample values. For example for the
11960 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
11961 @end table
11962
11963 @subsection Examples
11964
11965 @itemize
11966 @item
11967 Scale the input video to a size of 200x100
11968 @example
11969 scale=w=200:h=100
11970 @end example
11971
11972 This is equivalent to:
11973 @example
11974 scale=200:100
11975 @end example
11976
11977 or:
11978 @example
11979 scale=200x100
11980 @end example
11981
11982 @item
11983 Specify a size abbreviation for the output size:
11984 @example
11985 scale=qcif
11986 @end example
11987
11988 which can also be written as:
11989 @example
11990 scale=size=qcif
11991 @end example
11992
11993 @item
11994 Scale the input to 2x:
11995 @example
11996 scale=w=2*iw:h=2*ih
11997 @end example
11998
11999 @item
12000 The above is the same as:
12001 @example
12002 scale=2*in_w:2*in_h
12003 @end example
12004
12005 @item
12006 Scale the input to 2x with forced interlaced scaling:
12007 @example
12008 scale=2*iw:2*ih:interl=1
12009 @end example
12010
12011 @item
12012 Scale the input to half size:
12013 @example
12014 scale=w=iw/2:h=ih/2
12015 @end example
12016
12017 @item
12018 Increase the width, and set the height to the same size:
12019 @example
12020 scale=3/2*iw:ow
12021 @end example
12022
12023 @item
12024 Seek Greek harmony:
12025 @example
12026 scale=iw:1/PHI*iw
12027 scale=ih*PHI:ih
12028 @end example
12029
12030 @item
12031 Increase the height, and set the width to 3/2 of the height:
12032 @example
12033 scale=w=3/2*oh:h=3/5*ih
12034 @end example
12035
12036 @item
12037 Increase the size, making the size a multiple of the chroma
12038 subsample values:
12039 @example
12040 scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
12041 @end example
12042
12043 @item
12044 Increase the width to a maximum of 500 pixels,
12045 keeping the same aspect ratio as the input:
12046 @example
12047 scale=w='min(500\, iw*3/2):h=-1'
12048 @end example
12049 @end itemize
12050
12051 @subsection Commands
12052
12053 This filter supports the following commands:
12054 @table @option
12055 @item width, w
12056 @item height, h
12057 Set the output video dimension expression.
12058 The command accepts the same syntax of the corresponding option.
12059
12060 If the specified expression is not valid, it is kept at its current
12061 value.
12062 @end table
12063
12064 @section scale_npp
12065
12066 Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
12067 format conversion on CUDA video frames. Setting the output width and height
12068 works in the same way as for the @var{scale} filter.
12069
12070 The following additional options are accepted:
12071 @table @option
12072 @item format
12073 The pixel format of the output CUDA frames. If set to the string "same" (the
12074 default), the input format will be kept. Note that automatic format negotiation
12075 and conversion is not yet supported for hardware frames
12076
12077 @item interp_algo
12078 The interpolation algorithm used for resizing. One of the following:
12079 @table @option
12080 @item nn
12081 Nearest neighbour.
12082
12083 @item linear
12084 @item cubic
12085 @item cubic2p_bspline
12086 2-parameter cubic (B=1, C=0)
12087
12088 @item cubic2p_catmullrom
12089 2-parameter cubic (B=0, C=1/2)
12090
12091 @item cubic2p_b05c03
12092 2-parameter cubic (B=1/2, C=3/10)
12093
12094 @item super
12095 Supersampling
12096
12097 @item lanczos
12098 @end table
12099
12100 @end table
12101
12102 @section scale2ref
12103
12104 Scale (resize) the input video, based on a reference video.
12105
12106 See the scale filter for available options, scale2ref supports the same but
12107 uses the reference video instead of the main input as basis.
12108
12109 @subsection Examples
12110
12111 @itemize
12112 @item
12113 Scale a subtitle stream to match the main video in size before overlaying
12114 @example
12115 'scale2ref[b][a];[a][b]overlay'
12116 @end example
12117 @end itemize
12118
12119 @anchor{selectivecolor}
12120 @section selectivecolor
12121
12122 Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
12123 as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
12124 by the "purity" of the color (that is, how saturated it already is).
12125
12126 This filter is similar to the Adobe Photoshop Selective Color tool.
12127
12128 The filter accepts the following options:
12129
12130 @table @option
12131 @item correction_method
12132 Select color correction method.
12133
12134 Available values are:
12135 @table @samp
12136 @item absolute
12137 Specified adjustments are applied "as-is" (added/subtracted to original pixel
12138 component value).
12139 @item relative
12140 Specified adjustments are relative to the original component value.
12141 @end table
12142 Default is @code{absolute}.
12143 @item reds
12144 Adjustments for red pixels (pixels where the red component is the maximum)
12145 @item yellows
12146 Adjustments for yellow pixels (pixels where the blue component is the minimum)
12147 @item greens
12148 Adjustments for green pixels (pixels where the green component is the maximum)
12149 @item cyans
12150 Adjustments for cyan pixels (pixels where the red component is the minimum)
12151 @item blues
12152 Adjustments for blue pixels (pixels where the blue component is the maximum)
12153 @item magentas
12154 Adjustments for magenta pixels (pixels where the green component is the minimum)
12155 @item whites
12156 Adjustments for white pixels (pixels where all components are greater than 128)
12157 @item neutrals
12158 Adjustments for all pixels except pure black and pure white
12159 @item blacks
12160 Adjustments for black pixels (pixels where all components are lesser than 128)
12161 @item psfile
12162 Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
12163 @end table
12164
12165 All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
12166 4 space separated floating point adjustment values in the [-1,1] range,
12167 respectively to adjust the amount of cyan, magenta, yellow and black for the
12168 pixels of its range.
12169
12170 @subsection Examples
12171
12172 @itemize
12173 @item
12174 Increase cyan by 50% and reduce yellow by 33% in every green areas, and
12175 increase magenta by 27% in blue areas:
12176 @example
12177 selectivecolor=greens=.5 0 -.33 0:blues=0 .27
12178 @end example
12179
12180 @item
12181 Use a Photoshop selective color preset:
12182 @example
12183 selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
12184 @end example
12185 @end itemize
12186
12187 @anchor{separatefields}
12188 @section separatefields
12189
12190 The @code{separatefields} takes a frame-based video input and splits
12191 each frame into its components fields, producing a new half height clip
12192 with twice the frame rate and twice the frame count.
12193
12194 This filter use field-dominance information in frame to decide which
12195 of each pair of fields to place first in the output.
12196 If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
12197
12198 @section setdar, setsar
12199
12200 The @code{setdar} filter sets the Display Aspect Ratio for the filter
12201 output video.
12202
12203 This is done by changing the specified Sample (aka Pixel) Aspect
12204 Ratio, according to the following equation:
12205 @example
12206 @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
12207 @end example
12208
12209 Keep in mind that the @code{setdar} filter does not modify the pixel
12210 dimensions of the video frame. Also, the display aspect ratio set by
12211 this filter may be changed by later filters in the filterchain,
12212 e.g. in case of scaling or if another "setdar" or a "setsar" filter is
12213 applied.
12214
12215 The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
12216 the filter output video.
12217
12218 Note that as a consequence of the application of this filter, the
12219 output display aspect ratio will change according to the equation
12220 above.
12221
12222 Keep in mind that the sample aspect ratio set by the @code{setsar}
12223 filter may be changed by later filters in the filterchain, e.g. if
12224 another "setsar" or a "setdar" filter is applied.
12225
12226 It accepts the following parameters:
12227
12228 @table @option
12229 @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
12230 Set the aspect ratio used by the filter.
12231
12232 The parameter can be a floating point number string, an expression, or
12233 a string of the form @var{num}:@var{den}, where @var{num} and
12234 @var{den} are the numerator and denominator of the aspect ratio. If
12235 the parameter is not specified, it is assumed the value "0".
12236 In case the form "@var{num}:@var{den}" is used, the @code{:} character
12237 should be escaped.
12238
12239 @item max
12240 Set the maximum integer value to use for expressing numerator and
12241 denominator when reducing the expressed aspect ratio to a rational.
12242 Default value is @code{100}.
12243
12244 @end table
12245
12246 The parameter @var{sar} is an expression containing
12247 the following constants:
12248
12249 @table @option
12250 @item E, PI, PHI
12251 These are approximated values for the mathematical constants e
12252 (Euler's number), pi (Greek pi), and phi (the golden ratio).
12253
12254 @item w, h
12255 The input width and height.
12256
12257 @item a
12258 These are the same as @var{w} / @var{h}.
12259
12260 @item sar
12261 The input sample aspect ratio.
12262
12263 @item dar
12264 The input display aspect ratio. It is the same as
12265 (@var{w} / @var{h}) * @var{sar}.
12266
12267 @item hsub, vsub
12268 Horizontal and vertical chroma subsample values. For example, for the
12269 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
12270 @end table
12271
12272 @subsection Examples
12273
12274 @itemize
12275
12276 @item
12277 To change the display aspect ratio to 16:9, specify one of the following:
12278 @example
12279 setdar=dar=1.77777
12280 setdar=dar=16/9
12281 @end example
12282
12283 @item
12284 To change the sample aspect ratio to 10:11, specify:
12285 @example
12286 setsar=sar=10/11
12287 @end example
12288
12289 @item
12290 To set a display aspect ratio of 16:9, and specify a maximum integer value of
12291 1000 in the aspect ratio reduction, use the command:
12292 @example
12293 setdar=ratio=16/9:max=1000
12294 @end example
12295
12296 @end itemize
12297
12298 @anchor{setfield}
12299 @section setfield
12300
12301 Force field for the output video frame.
12302
12303 The @code{setfield} filter marks the interlace type field for the
12304 output frames. It does not change the input frame, but only sets the
12305 corresponding property, which affects how the frame is treated by
12306 following filters (e.g. @code{fieldorder} or @code{yadif}).
12307
12308 The filter accepts the following options:
12309
12310 @table @option
12311
12312 @item mode
12313 Available values are:
12314
12315 @table @samp
12316 @item auto
12317 Keep the same field property.
12318
12319 @item bff
12320 Mark the frame as bottom-field-first.
12321
12322 @item tff
12323 Mark the frame as top-field-first.
12324
12325 @item prog
12326 Mark the frame as progressive.
12327 @end table
12328 @end table
12329
12330 @section showinfo
12331
12332 Show a line containing various information for each input video frame.
12333 The input video is not modified.
12334
12335 The shown line contains a sequence of key/value pairs of the form
12336 @var{key}:@var{value}.
12337
12338 The following values are shown in the output:
12339
12340 @table @option
12341 @item n
12342 The (sequential) number of the input frame, starting from 0.
12343
12344 @item pts
12345 The Presentation TimeStamp of the input frame, expressed as a number of
12346 time base units. The time base unit depends on the filter input pad.
12347
12348 @item pts_time
12349 The Presentation TimeStamp of the input frame, expressed as a number of
12350 seconds.
12351
12352 @item pos
12353 The position of the frame in the input stream, or -1 if this information is
12354 unavailable and/or meaningless (for example in case of synthetic video).
12355
12356 @item fmt
12357 The pixel format name.
12358
12359 @item sar
12360 The sample aspect ratio of the input frame, expressed in the form
12361 @var{num}/@var{den}.
12362
12363 @item s
12364 The size of the input frame. For the syntax of this option, check the
12365 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
12366
12367 @item i
12368 The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
12369 for bottom field first).
12370
12371 @item iskey
12372 This is 1 if the frame is a key frame, 0 otherwise.
12373
12374 @item type
12375 The picture type of the input frame ("I" for an I-frame, "P" for a
12376 P-frame, "B" for a B-frame, or "?" for an unknown type).
12377 Also refer to the documentation of the @code{AVPictureType} enum and of
12378 the @code{av_get_picture_type_char} function defined in
12379 @file{libavutil/avutil.h}.
12380
12381 @item checksum
12382 The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
12383
12384 @item plane_checksum
12385 The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
12386 expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
12387 @end table
12388
12389 @section showpalette
12390
12391 Displays the 256 colors palette of each frame. This filter is only relevant for
12392 @var{pal8} pixel format frames.
12393
12394 It accepts the following option:
12395
12396 @table @option
12397 @item s
12398 Set the size of the box used to represent one palette color entry. Default is
12399 @code{30} (for a @code{30x30} pixel box).
12400 @end table
12401
12402 @section shuffleframes
12403
12404 Reorder and/or duplicate and/or drop video frames.
12405
12406 It accepts the following parameters:
12407
12408 @table @option
12409 @item mapping
12410 Set the destination indexes of input frames.
12411 This is space or '|' separated list of indexes that maps input frames to output
12412 frames. Number of indexes also sets maximal value that each index may have.
12413 '-1' index have special meaning and that is to drop frame.
12414 @end table
12415
12416 The first frame has the index 0. The default is to keep the input unchanged.
12417
12418 @subsection Examples
12419
12420 @itemize
12421 @item
12422 Swap second and third frame of every three frames of the input:
12423 @example
12424 ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
12425 @end example
12426
12427 @item
12428 Swap 10th and 1st frame of every ten frames of the input:
12429 @example
12430 ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
12431 @end example
12432 @end itemize
12433
12434 @section shuffleplanes
12435
12436 Reorder and/or duplicate video planes.
12437
12438 It accepts the following parameters:
12439
12440 @table @option
12441
12442 @item map0
12443 The index of the input plane to be used as the first output plane.
12444
12445 @item map1
12446 The index of the input plane to be used as the second output plane.
12447
12448 @item map2
12449 The index of the input plane to be used as the third output plane.
12450
12451 @item map3
12452 The index of the input plane to be used as the fourth output plane.
12453
12454 @end table
12455
12456 The first plane has the index 0. The default is to keep the input unchanged.
12457
12458 @subsection Examples
12459
12460 @itemize
12461 @item
12462 Swap the second and third planes of the input:
12463 @example
12464 ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
12465 @end example
12466 @end itemize
12467
12468 @anchor{signalstats}
12469 @section signalstats
12470 Evaluate various visual metrics that assist in determining issues associated
12471 with the digitization of analog video media.
12472
12473 By default the filter will log these metadata values:
12474
12475 @table @option
12476 @item YMIN
12477 Display the minimal Y value contained within the input frame. Expressed in
12478 range of [0-255].
12479
12480 @item YLOW
12481 Display the Y value at the 10% percentile within the input frame. Expressed in
12482 range of [0-255].
12483
12484 @item YAVG
12485 Display the average Y value within the input frame. Expressed in range of
12486 [0-255].
12487
12488 @item YHIGH
12489 Display the Y value at the 90% percentile within the input frame. Expressed in
12490 range of [0-255].
12491
12492 @item YMAX
12493 Display the maximum Y value contained within the input frame. Expressed in
12494 range of [0-255].
12495
12496 @item UMIN
12497 Display the minimal U value contained within the input frame. Expressed in
12498 range of [0-255].
12499
12500 @item ULOW
12501 Display the U value at the 10% percentile within the input frame. Expressed in
12502 range of [0-255].
12503
12504 @item UAVG
12505 Display the average U value within the input frame. Expressed in range of
12506 [0-255].
12507
12508 @item UHIGH
12509 Display the U value at the 90% percentile within the input frame. Expressed in
12510 range of [0-255].
12511
12512 @item UMAX
12513 Display the maximum U value contained within the input frame. Expressed in
12514 range of [0-255].
12515
12516 @item VMIN
12517 Display the minimal V value contained within the input frame. Expressed in
12518 range of [0-255].
12519
12520 @item VLOW
12521 Display the V value at the 10% percentile within the input frame. Expressed in
12522 range of [0-255].
12523
12524 @item VAVG
12525 Display the average V value within the input frame. Expressed in range of
12526 [0-255].
12527
12528 @item VHIGH
12529 Display the V value at the 90% percentile within the input frame. Expressed in
12530 range of [0-255].
12531
12532 @item VMAX
12533 Display the maximum V value contained within the input frame. Expressed in
12534 range of [0-255].
12535
12536 @item SATMIN
12537 Display the minimal saturation value contained within the input frame.
12538 Expressed in range of [0-~181.02].
12539
12540 @item SATLOW
12541 Display the saturation value at the 10% percentile within the input frame.
12542 Expressed in range of [0-~181.02].
12543
12544 @item SATAVG
12545 Display the average saturation value within the input frame. Expressed in range
12546 of [0-~181.02].
12547
12548 @item SATHIGH
12549 Display the saturation value at the 90% percentile within the input frame.
12550 Expressed in range of [0-~181.02].
12551
12552 @item SATMAX
12553 Display the maximum saturation value contained within the input frame.
12554 Expressed in range of [0-~181.02].
12555
12556 @item HUEMED
12557 Display the median value for hue within the input frame. Expressed in range of
12558 [0-360].
12559
12560 @item HUEAVG
12561 Display the average value for hue within the input frame. Expressed in range of
12562 [0-360].
12563
12564 @item YDIF
12565 Display the average of sample value difference between all values of the Y
12566 plane in the current frame and corresponding values of the previous input frame.
12567 Expressed in range of [0-255].
12568
12569 @item UDIF
12570 Display the average of sample value difference between all values of the U
12571 plane in the current frame and corresponding values of the previous input frame.
12572 Expressed in range of [0-255].
12573
12574 @item VDIF
12575 Display the average of sample value difference between all values of the V
12576 plane in the current frame and corresponding values of the previous input frame.
12577 Expressed in range of [0-255].
12578
12579 @item YBITDEPTH
12580 Display bit depth of Y plane in current frame.
12581 Expressed in range of [0-16].
12582
12583 @item UBITDEPTH
12584 Display bit depth of U plane in current frame.
12585 Expressed in range of [0-16].
12586
12587 @item VBITDEPTH
12588 Display bit depth of V plane in current frame.
12589 Expressed in range of [0-16].
12590 @end table
12591
12592 The filter accepts the following options:
12593
12594 @table @option
12595 @item stat
12596 @item out
12597
12598 @option{stat} specify an additional form of image analysis.
12599 @option{out} output video with the specified type of pixel highlighted.
12600
12601 Both options accept the following values:
12602
12603 @table @samp
12604 @item tout
12605 Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
12606 unlike the neighboring pixels of the same field. Examples of temporal outliers
12607 include the results of video dropouts, head clogs, or tape tracking issues.
12608
12609 @item vrep
12610 Identify @var{vertical line repetition}. Vertical line repetition includes
12611 similar rows of pixels within a frame. In born-digital video vertical line
12612 repetition is common, but this pattern is uncommon in video digitized from an
12613 analog source. When it occurs in video that results from the digitization of an
12614 analog source it can indicate concealment from a dropout compensator.
12615
12616 @item brng
12617 Identify pixels that fall outside of legal broadcast range.
12618 @end table
12619
12620 @item color, c
12621 Set the highlight color for the @option{out} option. The default color is
12622 yellow.
12623 @end table
12624
12625 @subsection Examples
12626
12627 @itemize
12628 @item
12629 Output data of various video metrics:
12630 @example
12631 ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
12632 @end example
12633
12634 @item
12635 Output specific data about the minimum and maximum values of the Y plane per frame:
12636 @example
12637 ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
12638 @end example
12639
12640 @item
12641 Playback video while highlighting pixels that are outside of broadcast range in red.
12642 @example
12643 ffplay example.mov -vf signalstats="out=brng:color=red"
12644 @end example
12645
12646 @item
12647 Playback video with signalstats metadata drawn over the frame.
12648 @example
12649 ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
12650 @end example
12651
12652 The contents of signalstat_drawtext.txt used in the command are:
12653 @example
12654 time %@{pts:hms@}
12655 Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
12656 U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
12657 V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
12658 saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
12659
12660 @end example
12661 @end itemize
12662
12663 @anchor{smartblur}
12664 @section smartblur
12665
12666 Blur the input video without impacting the outlines.
12667
12668 It accepts the following options:
12669
12670 @table @option
12671 @item luma_radius, lr
12672 Set the luma radius. The option value must be a float number in
12673 the range [0.1,5.0] that specifies the variance of the gaussian filter
12674 used to blur the image (slower if larger). Default value is 1.0.
12675
12676 @item luma_strength, ls
12677 Set the luma strength. The option value must be a float number
12678 in the range [-1.0,1.0] that configures the blurring. A value included
12679 in [0.0,1.0] will blur the image whereas a value included in
12680 [-1.0,0.0] will sharpen the image. Default value is 1.0.
12681
12682 @item luma_threshold, lt
12683 Set the luma threshold used as a coefficient to determine
12684 whether a pixel should be blurred or not. The option value must be an
12685 integer in the range [-30,30]. A value of 0 will filter all the image,
12686 a value included in [0,30] will filter flat areas and a value included
12687 in [-30,0] will filter edges. Default value is 0.
12688
12689 @item chroma_radius, cr
12690 Set the chroma radius. The option value must be a float number in
12691 the range [0.1,5.0] that specifies the variance of the gaussian filter
12692 used to blur the image (slower if larger). Default value is @option{luma_radius}.
12693
12694 @item chroma_strength, cs
12695 Set the chroma strength. The option value must be a float number
12696 in the range [-1.0,1.0] that configures the blurring. A value included
12697 in [0.0,1.0] will blur the image whereas a value included in
12698 [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
12699
12700 @item chroma_threshold, ct
12701 Set the chroma threshold used as a coefficient to determine
12702 whether a pixel should be blurred or not. The option value must be an
12703 integer in the range [-30,30]. A value of 0 will filter all the image,
12704 a value included in [0,30] will filter flat areas and a value included
12705 in [-30,0] will filter edges. Default value is @option{luma_threshold}.
12706 @end table
12707
12708 If a chroma option is not explicitly set, the corresponding luma value
12709 is set.
12710
12711 @section ssim
12712
12713 Obtain the SSIM (Structural SImilarity Metric) between two input videos.
12714
12715 This filter takes in input two input videos, the first input is
12716 considered the "main" source and is passed unchanged to the
12717 output. The second input is used as a "reference" video for computing
12718 the SSIM.
12719
12720 Both video inputs must have the same resolution and pixel format for
12721 this filter to work correctly. Also it assumes that both inputs
12722 have the same number of frames, which are compared one by one.
12723
12724 The filter stores the calculated SSIM of each frame.
12725
12726 The description of the accepted parameters follows.
12727
12728 @table @option
12729 @item stats_file, f
12730 If specified the filter will use the named file to save the SSIM of
12731 each individual frame. When filename equals "-" the data is sent to
12732 standard output.
12733 @end table
12734
12735 The file printed if @var{stats_file} is selected, contains a sequence of
12736 key/value pairs of the form @var{key}:@var{value} for each compared
12737 couple of frames.
12738
12739 A description of each shown parameter follows:
12740
12741 @table @option
12742 @item n
12743 sequential number of the input frame, starting from 1
12744
12745 @item Y, U, V, R, G, B
12746 SSIM of the compared frames for the component specified by the suffix.
12747
12748 @item All
12749 SSIM of the compared frames for the whole frame.
12750
12751 @item dB
12752 Same as above but in dB representation.
12753 @end table
12754
12755 For example:
12756 @example
12757 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
12758 [main][ref] ssim="stats_file=stats.log" [out]
12759 @end example
12760
12761 On this example the input file being processed is compared with the
12762 reference file @file{ref_movie.mpg}. The SSIM of each individual frame
12763 is stored in @file{stats.log}.
12764
12765 Another example with both psnr and ssim at same time:
12766 @example
12767 ffmpeg -i main.mpg -i ref.mpg -lavfi  "ssim;[0:v][1:v]psnr" -f null -
12768 @end example
12769
12770 @section stereo3d
12771
12772 Convert between different stereoscopic image formats.
12773
12774 The filters accept the following options:
12775
12776 @table @option
12777 @item in
12778 Set stereoscopic image format of input.
12779
12780 Available values for input image formats are:
12781 @table @samp
12782 @item sbsl
12783 side by side parallel (left eye left, right eye right)
12784
12785 @item sbsr
12786 side by side crosseye (right eye left, left eye right)
12787
12788 @item sbs2l
12789 side by side parallel with half width resolution
12790 (left eye left, right eye right)
12791
12792 @item sbs2r
12793 side by side crosseye with half width resolution
12794 (right eye left, left eye right)
12795
12796 @item abl
12797 above-below (left eye above, right eye below)
12798
12799 @item abr
12800 above-below (right eye above, left eye below)
12801
12802 @item ab2l
12803 above-below with half height resolution
12804 (left eye above, right eye below)
12805
12806 @item ab2r
12807 above-below with half height resolution
12808 (right eye above, left eye below)
12809
12810 @item al
12811 alternating frames (left eye first, right eye second)
12812
12813 @item ar
12814 alternating frames (right eye first, left eye second)
12815
12816 @item irl
12817 interleaved rows (left eye has top row, right eye starts on next row)
12818
12819 @item irr
12820 interleaved rows (right eye has top row, left eye starts on next row)
12821
12822 @item icl
12823 interleaved columns, left eye first
12824
12825 @item icr
12826 interleaved columns, right eye first
12827
12828 Default value is @samp{sbsl}.
12829 @end table
12830
12831 @item out
12832 Set stereoscopic image format of output.
12833
12834 @table @samp
12835 @item sbsl
12836 side by side parallel (left eye left, right eye right)
12837
12838 @item sbsr
12839 side by side crosseye (right eye left, left eye right)
12840
12841 @item sbs2l
12842 side by side parallel with half width resolution
12843 (left eye left, right eye right)
12844
12845 @item sbs2r
12846 side by side crosseye with half width resolution
12847 (right eye left, left eye right)
12848
12849 @item abl
12850 above-below (left eye above, right eye below)
12851
12852 @item abr
12853 above-below (right eye above, left eye below)
12854
12855 @item ab2l
12856 above-below with half height resolution
12857 (left eye above, right eye below)
12858
12859 @item ab2r
12860 above-below with half height resolution
12861 (right eye above, left eye below)
12862
12863 @item al
12864 alternating frames (left eye first, right eye second)
12865
12866 @item ar
12867 alternating frames (right eye first, left eye second)
12868
12869 @item irl
12870 interleaved rows (left eye has top row, right eye starts on next row)
12871
12872 @item irr
12873 interleaved rows (right eye has top row, left eye starts on next row)
12874
12875 @item arbg
12876 anaglyph red/blue gray
12877 (red filter on left eye, blue filter on right eye)
12878
12879 @item argg
12880 anaglyph red/green gray
12881 (red filter on left eye, green filter on right eye)
12882
12883 @item arcg
12884 anaglyph red/cyan gray
12885 (red filter on left eye, cyan filter on right eye)
12886
12887 @item arch
12888 anaglyph red/cyan half colored
12889 (red filter on left eye, cyan filter on right eye)
12890
12891 @item arcc
12892 anaglyph red/cyan color
12893 (red filter on left eye, cyan filter on right eye)
12894
12895 @item arcd
12896 anaglyph red/cyan color optimized with the least squares projection of dubois
12897 (red filter on left eye, cyan filter on right eye)
12898
12899 @item agmg
12900 anaglyph green/magenta gray
12901 (green filter on left eye, magenta filter on right eye)
12902
12903 @item agmh
12904 anaglyph green/magenta half colored
12905 (green filter on left eye, magenta filter on right eye)
12906
12907 @item agmc
12908 anaglyph green/magenta colored
12909 (green filter on left eye, magenta filter on right eye)
12910
12911 @item agmd
12912 anaglyph green/magenta color optimized with the least squares projection of dubois
12913 (green filter on left eye, magenta filter on right eye)
12914
12915 @item aybg
12916 anaglyph yellow/blue gray
12917 (yellow filter on left eye, blue filter on right eye)
12918
12919 @item aybh
12920 anaglyph yellow/blue half colored
12921 (yellow filter on left eye, blue filter on right eye)
12922
12923 @item aybc
12924 anaglyph yellow/blue colored
12925 (yellow filter on left eye, blue filter on right eye)
12926
12927 @item aybd
12928 anaglyph yellow/blue color optimized with the least squares projection of dubois
12929 (yellow filter on left eye, blue filter on right eye)
12930
12931 @item ml
12932 mono output (left eye only)
12933
12934 @item mr
12935 mono output (right eye only)
12936
12937 @item chl
12938 checkerboard, left eye first
12939
12940 @item chr
12941 checkerboard, right eye first
12942
12943 @item icl
12944 interleaved columns, left eye first
12945
12946 @item icr
12947 interleaved columns, right eye first
12948
12949 @item hdmi
12950 HDMI frame pack
12951 @end table
12952
12953 Default value is @samp{arcd}.
12954 @end table
12955
12956 @subsection Examples
12957
12958 @itemize
12959 @item
12960 Convert input video from side by side parallel to anaglyph yellow/blue dubois:
12961 @example
12962 stereo3d=sbsl:aybd
12963 @end example
12964
12965 @item
12966 Convert input video from above below (left eye above, right eye below) to side by side crosseye.
12967 @example
12968 stereo3d=abl:sbsr
12969 @end example
12970 @end itemize
12971
12972 @section streamselect, astreamselect
12973 Select video or audio streams.
12974
12975 The filter accepts the following options:
12976
12977 @table @option
12978 @item inputs
12979 Set number of inputs. Default is 2.
12980
12981 @item map
12982 Set input indexes to remap to outputs.
12983 @end table
12984
12985 @subsection Commands
12986
12987 The @code{streamselect} and @code{astreamselect} filter supports the following
12988 commands:
12989
12990 @table @option
12991 @item map
12992 Set input indexes to remap to outputs.
12993 @end table
12994
12995 @subsection Examples
12996
12997 @itemize
12998 @item
12999 Select first 5 seconds 1st stream and rest of time 2nd stream:
13000 @example
13001 sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
13002 @end example
13003
13004 @item
13005 Same as above, but for audio:
13006 @example
13007 asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
13008 @end example
13009 @end itemize
13010
13011 @section sobel
13012 Apply sobel operator to input video stream.
13013
13014 The filter accepts the following option:
13015
13016 @table @option
13017 @item planes
13018 Set which planes will be processed, unprocessed planes will be copied.
13019 By default value 0xf, all planes will be processed.
13020
13021 @item scale
13022 Set value which will be multiplied with filtered result.
13023
13024 @item delta
13025 Set value which will be added to filtered result.
13026 @end table
13027
13028 @anchor{spp}
13029 @section spp
13030
13031 Apply a simple postprocessing filter that compresses and decompresses the image
13032 at several (or - in the case of @option{quality} level @code{6} - all) shifts
13033 and average the results.
13034
13035 The filter accepts the following options:
13036
13037 @table @option
13038 @item quality
13039 Set quality. This option defines the number of levels for averaging. It accepts
13040 an integer in the range 0-6. If set to @code{0}, the filter will have no
13041 effect. A value of @code{6} means the higher quality. For each increment of
13042 that value the speed drops by a factor of approximately 2.  Default value is
13043 @code{3}.
13044
13045 @item qp
13046 Force a constant quantization parameter. If not set, the filter will use the QP
13047 from the video stream (if available).
13048
13049 @item mode
13050 Set thresholding mode. Available modes are:
13051
13052 @table @samp
13053 @item hard
13054 Set hard thresholding (default).
13055 @item soft
13056 Set soft thresholding (better de-ringing effect, but likely blurrier).
13057 @end table
13058
13059 @item use_bframe_qp
13060 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
13061 option may cause flicker since the B-Frames have often larger QP. Default is
13062 @code{0} (not enabled).
13063 @end table
13064
13065 @anchor{subtitles}
13066 @section subtitles
13067
13068 Draw subtitles on top of input video using the libass library.
13069
13070 To enable compilation of this filter you need to configure FFmpeg with
13071 @code{--enable-libass}. This filter also requires a build with libavcodec and
13072 libavformat to convert the passed subtitles file to ASS (Advanced Substation
13073 Alpha) subtitles format.
13074
13075 The filter accepts the following options:
13076
13077 @table @option
13078 @item filename, f
13079 Set the filename of the subtitle file to read. It must be specified.
13080
13081 @item original_size
13082 Specify the size of the original video, the video for which the ASS file
13083 was composed. For the syntax of this option, check the
13084 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
13085 Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
13086 correctly scale the fonts if the aspect ratio has been changed.
13087
13088 @item fontsdir
13089 Set a directory path containing fonts that can be used by the filter.
13090 These fonts will be used in addition to whatever the font provider uses.
13091
13092 @item charenc
13093 Set subtitles input character encoding. @code{subtitles} filter only. Only
13094 useful if not UTF-8.
13095
13096 @item stream_index, si
13097 Set subtitles stream index. @code{subtitles} filter only.
13098
13099 @item force_style
13100 Override default style or script info parameters of the subtitles. It accepts a
13101 string containing ASS style format @code{KEY=VALUE} couples separated by ",".
13102 @end table
13103
13104 If the first key is not specified, it is assumed that the first value
13105 specifies the @option{filename}.
13106
13107 For example, to render the file @file{sub.srt} on top of the input
13108 video, use the command:
13109 @example
13110 subtitles=sub.srt
13111 @end example
13112
13113 which is equivalent to:
13114 @example
13115 subtitles=filename=sub.srt
13116 @end example
13117
13118 To render the default subtitles stream from file @file{video.mkv}, use:
13119 @example
13120 subtitles=video.mkv
13121 @end example
13122
13123 To render the second subtitles stream from that file, use:
13124 @example
13125 subtitles=video.mkv:si=1
13126 @end example
13127
13128 To make the subtitles stream from @file{sub.srt} appear in transparent green
13129 @code{DejaVu Serif}, use:
13130 @example
13131 subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
13132 @end example
13133
13134 @section super2xsai
13135
13136 Scale the input by 2x and smooth using the Super2xSaI (Scale and
13137 Interpolate) pixel art scaling algorithm.
13138
13139 Useful for enlarging pixel art images without reducing sharpness.
13140
13141 @section swaprect
13142
13143 Swap two rectangular objects in video.
13144
13145 This filter accepts the following options:
13146
13147 @table @option
13148 @item w
13149 Set object width.
13150
13151 @item h
13152 Set object height.
13153
13154 @item x1
13155 Set 1st rect x coordinate.
13156
13157 @item y1
13158 Set 1st rect y coordinate.
13159
13160 @item x2
13161 Set 2nd rect x coordinate.
13162
13163 @item y2
13164 Set 2nd rect y coordinate.
13165
13166 All expressions are evaluated once for each frame.
13167 @end table
13168
13169 The all options are expressions containing the following constants:
13170
13171 @table @option
13172 @item w
13173 @item h
13174 The input width and height.
13175
13176 @item a
13177 same as @var{w} / @var{h}
13178
13179 @item sar
13180 input sample aspect ratio
13181
13182 @item dar
13183 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
13184
13185 @item n
13186 The number of the input frame, starting from 0.
13187
13188 @item t
13189 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
13190
13191 @item pos
13192 the position in the file of the input frame, NAN if unknown
13193 @end table
13194
13195 @section swapuv
13196 Swap U & V plane.
13197
13198 @section telecine
13199
13200 Apply telecine process to the video.
13201
13202 This filter accepts the following options:
13203
13204 @table @option
13205 @item first_field
13206 @table @samp
13207 @item top, t
13208 top field first
13209 @item bottom, b
13210 bottom field first
13211 The default value is @code{top}.
13212 @end table
13213
13214 @item pattern
13215 A string of numbers representing the pulldown pattern you wish to apply.
13216 The default value is @code{23}.
13217 @end table
13218
13219 @example
13220 Some typical patterns:
13221
13222 NTSC output (30i):
13223 27.5p: 32222
13224 24p: 23 (classic)
13225 24p: 2332 (preferred)
13226 20p: 33
13227 18p: 334
13228 16p: 3444
13229
13230 PAL output (25i):
13231 27.5p: 12222
13232 24p: 222222222223 ("Euro pulldown")
13233 16.67p: 33
13234 16p: 33333334
13235 @end example
13236
13237 @section threshold
13238
13239 Apply threshold effect to video stream.
13240
13241 This filter needs four video streams to perform thresholding.
13242 First stream is stream we are filtering.
13243 Second stream is holding threshold values, third stream is holding min values,
13244 and last, fourth stream is holding max values.
13245
13246 The filter accepts the following option:
13247
13248 @table @option
13249 @item planes
13250 Set which planes will be processed, unprocessed planes will be copied.
13251 By default value 0xf, all planes will be processed.
13252 @end table
13253
13254 For example if first stream pixel's component value is less then threshold value
13255 of pixel component from 2nd threshold stream, third stream value will picked,
13256 otherwise fourth stream pixel component value will be picked.
13257
13258 Using color source filter one can perform various types of thresholding:
13259
13260 @subsection Examples
13261
13262 @itemize
13263 @item
13264 Binary threshold, using gray color as threshold:
13265 @example
13266 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
13267 @end example
13268
13269 @item
13270 Inverted binary threshold, using gray color as threshold:
13271 @example
13272 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
13273 @end example
13274
13275 @item
13276 Truncate binary threshold, using gray color as threshold:
13277 @example
13278 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
13279 @end example
13280
13281 @item
13282 Threshold to zero, using gray color as threshold:
13283 @example
13284 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
13285 @end example
13286
13287 @item
13288 Inverted threshold to zero, using gray color as threshold:
13289 @example
13290 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
13291 @end example
13292 @end itemize
13293
13294 @section thumbnail
13295 Select the most representative frame in a given sequence of consecutive frames.
13296
13297 The filter accepts the following options:
13298
13299 @table @option
13300 @item n
13301 Set the frames batch size to analyze; in a set of @var{n} frames, the filter
13302 will pick one of them, and then handle the next batch of @var{n} frames until
13303 the end. Default is @code{100}.
13304 @end table
13305
13306 Since the filter keeps track of the whole frames sequence, a bigger @var{n}
13307 value will result in a higher memory usage, so a high value is not recommended.
13308
13309 @subsection Examples
13310
13311 @itemize
13312 @item
13313 Extract one picture each 50 frames:
13314 @example
13315 thumbnail=50
13316 @end example
13317
13318 @item
13319 Complete example of a thumbnail creation with @command{ffmpeg}:
13320 @example
13321 ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
13322 @end example
13323 @end itemize
13324
13325 @section tile
13326
13327 Tile several successive frames together.
13328
13329 The filter accepts the following options:
13330
13331 @table @option
13332
13333 @item layout
13334 Set the grid size (i.e. the number of lines and columns). For the syntax of
13335 this option, check the
13336 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
13337
13338 @item nb_frames
13339 Set the maximum number of frames to render in the given area. It must be less
13340 than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
13341 the area will be used.
13342
13343 @item margin
13344 Set the outer border margin in pixels.
13345
13346 @item padding
13347 Set the inner border thickness (i.e. the number of pixels between frames). For
13348 more advanced padding options (such as having different values for the edges),
13349 refer to the pad video filter.
13350
13351 @item color
13352 Specify the color of the unused area. For the syntax of this option, check the
13353 "Color" section in the ffmpeg-utils manual. The default value of @var{color}
13354 is "black".
13355 @end table
13356
13357 @subsection Examples
13358
13359 @itemize
13360 @item
13361 Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
13362 @example
13363 ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
13364 @end example
13365 The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
13366 duplicating each output frame to accommodate the originally detected frame
13367 rate.
13368
13369 @item
13370 Display @code{5} pictures in an area of @code{3x2} frames,
13371 with @code{7} pixels between them, and @code{2} pixels of initial margin, using
13372 mixed flat and named options:
13373 @example
13374 tile=3x2:nb_frames=5:padding=7:margin=2
13375 @end example
13376 @end itemize
13377
13378 @section tinterlace
13379
13380 Perform various types of temporal field interlacing.
13381
13382 Frames are counted starting from 1, so the first input frame is
13383 considered odd.
13384
13385 The filter accepts the following options:
13386
13387 @table @option
13388
13389 @item mode
13390 Specify the mode of the interlacing. This option can also be specified
13391 as a value alone. See below for a list of values for this option.
13392
13393 Available values are:
13394
13395 @table @samp
13396 @item merge, 0
13397 Move odd frames into the upper field, even into the lower field,
13398 generating a double height frame at half frame rate.
13399 @example
13400  ------> time
13401 Input:
13402 Frame 1         Frame 2         Frame 3         Frame 4
13403
13404 11111           22222           33333           44444
13405 11111           22222           33333           44444
13406 11111           22222           33333           44444
13407 11111           22222           33333           44444
13408
13409 Output:
13410 11111                           33333
13411 22222                           44444
13412 11111                           33333
13413 22222                           44444
13414 11111                           33333
13415 22222                           44444
13416 11111                           33333
13417 22222                           44444
13418 @end example
13419
13420 @item drop_even, 1
13421 Only output odd frames, even frames are dropped, generating a frame with
13422 unchanged height at half frame rate.
13423
13424 @example
13425  ------> time
13426 Input:
13427 Frame 1         Frame 2         Frame 3         Frame 4
13428
13429 11111           22222           33333           44444
13430 11111           22222           33333           44444
13431 11111           22222           33333           44444
13432 11111           22222           33333           44444
13433
13434 Output:
13435 11111                           33333
13436 11111                           33333
13437 11111                           33333
13438 11111                           33333
13439 @end example
13440
13441 @item drop_odd, 2
13442 Only output even frames, odd frames are dropped, generating a frame with
13443 unchanged height at half frame rate.
13444
13445 @example
13446  ------> time
13447 Input:
13448 Frame 1         Frame 2         Frame 3         Frame 4
13449
13450 11111           22222           33333           44444
13451 11111           22222           33333           44444
13452 11111           22222           33333           44444
13453 11111           22222           33333           44444
13454
13455 Output:
13456                 22222                           44444
13457                 22222                           44444
13458                 22222                           44444
13459                 22222                           44444
13460 @end example
13461
13462 @item pad, 3
13463 Expand each frame to full height, but pad alternate lines with black,
13464 generating a frame with double height at the same input frame rate.
13465
13466 @example
13467  ------> time
13468 Input:
13469 Frame 1         Frame 2         Frame 3         Frame 4
13470
13471 11111           22222           33333           44444
13472 11111           22222           33333           44444
13473 11111           22222           33333           44444
13474 11111           22222           33333           44444
13475
13476 Output:
13477 11111           .....           33333           .....
13478 .....           22222           .....           44444
13479 11111           .....           33333           .....
13480 .....           22222           .....           44444
13481 11111           .....           33333           .....
13482 .....           22222           .....           44444
13483 11111           .....           33333           .....
13484 .....           22222           .....           44444
13485 @end example
13486
13487
13488 @item interleave_top, 4
13489 Interleave the upper field from odd frames with the lower field from
13490 even frames, generating a frame with unchanged height at half frame rate.
13491
13492 @example
13493  ------> time
13494 Input:
13495 Frame 1         Frame 2         Frame 3         Frame 4
13496
13497 11111<-         22222           33333<-         44444
13498 11111           22222<-         33333           44444<-
13499 11111<-         22222           33333<-         44444
13500 11111           22222<-         33333           44444<-
13501
13502 Output:
13503 11111                           33333
13504 22222                           44444
13505 11111                           33333
13506 22222                           44444
13507 @end example
13508
13509
13510 @item interleave_bottom, 5
13511 Interleave the lower field from odd frames with the upper field from
13512 even frames, generating a frame with unchanged height at half frame rate.
13513
13514 @example
13515  ------> time
13516 Input:
13517 Frame 1         Frame 2         Frame 3         Frame 4
13518
13519 11111           22222<-         33333           44444<-
13520 11111<-         22222           33333<-         44444
13521 11111           22222<-         33333           44444<-
13522 11111<-         22222           33333<-         44444
13523
13524 Output:
13525 22222                           44444
13526 11111                           33333
13527 22222                           44444
13528 11111                           33333
13529 @end example
13530
13531
13532 @item interlacex2, 6
13533 Double frame rate with unchanged height. Frames are inserted each
13534 containing the second temporal field from the previous input frame and
13535 the first temporal field from the next input frame. This mode relies on
13536 the top_field_first flag. Useful for interlaced video displays with no
13537 field synchronisation.
13538
13539 @example
13540  ------> time
13541 Input:
13542 Frame 1         Frame 2         Frame 3         Frame 4
13543
13544 11111           22222           33333           44444
13545  11111           22222           33333           44444
13546 11111           22222           33333           44444
13547  11111           22222           33333           44444
13548
13549 Output:
13550 11111   22222   22222   33333   33333   44444   44444
13551  11111   11111   22222   22222   33333   33333   44444
13552 11111   22222   22222   33333   33333   44444   44444
13553  11111   11111   22222   22222   33333   33333   44444
13554 @end example
13555
13556
13557 @item mergex2, 7
13558 Move odd frames into the upper field, even into the lower field,
13559 generating a double height frame at same frame rate.
13560
13561 @example
13562  ------> time
13563 Input:
13564 Frame 1         Frame 2         Frame 3         Frame 4
13565
13566 11111           22222           33333           44444
13567 11111           22222           33333           44444
13568 11111           22222           33333           44444
13569 11111           22222           33333           44444
13570
13571 Output:
13572 11111           33333           33333           55555
13573 22222           22222           44444           44444
13574 11111           33333           33333           55555
13575 22222           22222           44444           44444
13576 11111           33333           33333           55555
13577 22222           22222           44444           44444
13578 11111           33333           33333           55555
13579 22222           22222           44444           44444
13580 @end example
13581
13582 @end table
13583
13584 Numeric values are deprecated but are accepted for backward
13585 compatibility reasons.
13586
13587 Default mode is @code{merge}.
13588
13589 @item flags
13590 Specify flags influencing the filter process.
13591
13592 Available value for @var{flags} is:
13593
13594 @table @option
13595 @item low_pass_filter, vlfp
13596 Enable vertical low-pass filtering in the filter.
13597 Vertical low-pass filtering is required when creating an interlaced
13598 destination from a progressive source which contains high-frequency
13599 vertical detail. Filtering will reduce interlace 'twitter' and Moire
13600 patterning.
13601
13602 Vertical low-pass filtering can only be enabled for @option{mode}
13603 @var{interleave_top} and @var{interleave_bottom}.
13604
13605 @end table
13606 @end table
13607
13608 @section transpose
13609
13610 Transpose rows with columns in the input video and optionally flip it.
13611
13612 It accepts the following parameters:
13613
13614 @table @option
13615
13616 @item dir
13617 Specify the transposition direction.
13618
13619 Can assume the following values:
13620 @table @samp
13621 @item 0, 4, cclock_flip
13622 Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
13623 @example
13624 L.R     L.l
13625 . . ->  . .
13626 l.r     R.r
13627 @end example
13628
13629 @item 1, 5, clock
13630 Rotate by 90 degrees clockwise, that is:
13631 @example
13632 L.R     l.L
13633 . . ->  . .
13634 l.r     r.R
13635 @end example
13636
13637 @item 2, 6, cclock
13638 Rotate by 90 degrees counterclockwise, that is:
13639 @example
13640 L.R     R.r
13641 . . ->  . .
13642 l.r     L.l
13643 @end example
13644
13645 @item 3, 7, clock_flip
13646 Rotate by 90 degrees clockwise and vertically flip, that is:
13647 @example
13648 L.R     r.R
13649 . . ->  . .
13650 l.r     l.L
13651 @end example
13652 @end table
13653
13654 For values between 4-7, the transposition is only done if the input
13655 video geometry is portrait and not landscape. These values are
13656 deprecated, the @code{passthrough} option should be used instead.
13657
13658 Numerical values are deprecated, and should be dropped in favor of
13659 symbolic constants.
13660
13661 @item passthrough
13662 Do not apply the transposition if the input geometry matches the one
13663 specified by the specified value. It accepts the following values:
13664 @table @samp
13665 @item none
13666 Always apply transposition.
13667 @item portrait
13668 Preserve portrait geometry (when @var{height} >= @var{width}).
13669 @item landscape
13670 Preserve landscape geometry (when @var{width} >= @var{height}).
13671 @end table
13672
13673 Default value is @code{none}.
13674 @end table
13675
13676 For example to rotate by 90 degrees clockwise and preserve portrait
13677 layout:
13678 @example
13679 transpose=dir=1:passthrough=portrait
13680 @end example
13681
13682 The command above can also be specified as:
13683 @example
13684 transpose=1:portrait
13685 @end example
13686
13687 @section trim
13688 Trim the input so that the output contains one continuous subpart of the input.
13689
13690 It accepts the following parameters:
13691 @table @option
13692 @item start
13693 Specify the time of the start of the kept section, i.e. the frame with the
13694 timestamp @var{start} will be the first frame in the output.
13695
13696 @item end
13697 Specify the time of the first frame that will be dropped, i.e. the frame
13698 immediately preceding the one with the timestamp @var{end} will be the last
13699 frame in the output.
13700
13701 @item start_pts
13702 This is the same as @var{start}, except this option sets the start timestamp
13703 in timebase units instead of seconds.
13704
13705 @item end_pts
13706 This is the same as @var{end}, except this option sets the end timestamp
13707 in timebase units instead of seconds.
13708
13709 @item duration
13710 The maximum duration of the output in seconds.
13711
13712 @item start_frame
13713 The number of the first frame that should be passed to the output.
13714
13715 @item end_frame
13716 The number of the first frame that should be dropped.
13717 @end table
13718
13719 @option{start}, @option{end}, and @option{duration} are expressed as time
13720 duration specifications; see
13721 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
13722 for the accepted syntax.
13723
13724 Note that the first two sets of the start/end options and the @option{duration}
13725 option look at the frame timestamp, while the _frame variants simply count the
13726 frames that pass through the filter. Also note that this filter does not modify
13727 the timestamps. If you wish for the output timestamps to start at zero, insert a
13728 setpts filter after the trim filter.
13729
13730 If multiple start or end options are set, this filter tries to be greedy and
13731 keep all the frames that match at least one of the specified constraints. To keep
13732 only the part that matches all the constraints at once, chain multiple trim
13733 filters.
13734
13735 The defaults are such that all the input is kept. So it is possible to set e.g.
13736 just the end values to keep everything before the specified time.
13737
13738 Examples:
13739 @itemize
13740 @item
13741 Drop everything except the second minute of input:
13742 @example
13743 ffmpeg -i INPUT -vf trim=60:120
13744 @end example
13745
13746 @item
13747 Keep only the first second:
13748 @example
13749 ffmpeg -i INPUT -vf trim=duration=1
13750 @end example
13751
13752 @end itemize
13753
13754
13755 @anchor{unsharp}
13756 @section unsharp
13757
13758 Sharpen or blur the input video.
13759
13760 It accepts the following parameters:
13761
13762 @table @option
13763 @item luma_msize_x, lx
13764 Set the luma matrix horizontal size. It must be an odd integer between
13765 3 and 23. The default value is 5.
13766
13767 @item luma_msize_y, ly
13768 Set the luma matrix vertical size. It must be an odd integer between 3
13769 and 23. The default value is 5.
13770
13771 @item luma_amount, la
13772 Set the luma effect strength. It must be a floating point number, reasonable
13773 values lay between -1.5 and 1.5.
13774
13775 Negative values will blur the input video, while positive values will
13776 sharpen it, a value of zero will disable the effect.
13777
13778 Default value is 1.0.
13779
13780 @item chroma_msize_x, cx
13781 Set the chroma matrix horizontal size. It must be an odd integer
13782 between 3 and 23. The default value is 5.
13783
13784 @item chroma_msize_y, cy
13785 Set the chroma matrix vertical size. It must be an odd integer
13786 between 3 and 23. The default value is 5.
13787
13788 @item chroma_amount, ca
13789 Set the chroma effect strength. It must be a floating point number, reasonable
13790 values lay between -1.5 and 1.5.
13791
13792 Negative values will blur the input video, while positive values will
13793 sharpen it, a value of zero will disable the effect.
13794
13795 Default value is 0.0.
13796
13797 @item opencl
13798 If set to 1, specify using OpenCL capabilities, only available if
13799 FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
13800
13801 @end table
13802
13803 All parameters are optional and default to the equivalent of the
13804 string '5:5:1.0:5:5:0.0'.
13805
13806 @subsection Examples
13807
13808 @itemize
13809 @item
13810 Apply strong luma sharpen effect:
13811 @example
13812 unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
13813 @end example
13814
13815 @item
13816 Apply a strong blur of both luma and chroma parameters:
13817 @example
13818 unsharp=7:7:-2:7:7:-2
13819 @end example
13820 @end itemize
13821
13822 @section uspp
13823
13824 Apply ultra slow/simple postprocessing filter that compresses and decompresses
13825 the image at several (or - in the case of @option{quality} level @code{8} - all)
13826 shifts and average the results.
13827
13828 The way this differs from the behavior of spp is that uspp actually encodes &
13829 decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
13830 DCT similar to MJPEG.
13831
13832 The filter accepts the following options:
13833
13834 @table @option
13835 @item quality
13836 Set quality. This option defines the number of levels for averaging. It accepts
13837 an integer in the range 0-8. If set to @code{0}, the filter will have no
13838 effect. A value of @code{8} means the higher quality. For each increment of
13839 that value the speed drops by a factor of approximately 2.  Default value is
13840 @code{3}.
13841
13842 @item qp
13843 Force a constant quantization parameter. If not set, the filter will use the QP
13844 from the video stream (if available).
13845 @end table
13846
13847 @section vaguedenoiser
13848
13849 Apply a wavelet based denoiser.
13850
13851 It transforms each frame from the video input into the wavelet domain,
13852 using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
13853 the obtained coefficients. It does an inverse wavelet transform after.
13854 Due to wavelet properties, it should give a nice smoothed result, and
13855 reduced noise, without blurring picture features.
13856
13857 This filter accepts the following options:
13858
13859 @table @option
13860 @item threshold
13861 The filtering strength. The higher, the more filtered the video will be.
13862 Hard thresholding can use a higher threshold than soft thresholding
13863 before the video looks overfiltered.
13864
13865 @item method
13866 The filtering method the filter will use.
13867
13868 It accepts the following values:
13869 @table @samp
13870 @item hard
13871 All values under the threshold will be zeroed.
13872
13873 @item soft
13874 All values under the threshold will be zeroed. All values above will be
13875 reduced by the threshold.
13876
13877 @item garrote
13878 Scales or nullifies coefficients - intermediary between (more) soft and
13879 (less) hard thresholding.
13880 @end table
13881
13882 @item nsteps
13883 Number of times, the wavelet will decompose the picture. Picture can't
13884 be decomposed beyond a particular point (typically, 8 for a 640x480
13885 frame - as 2^9 = 512 > 480)
13886
13887 @item percent
13888 Partial of full denoising (limited coefficients shrinking), from 0 to 100.
13889
13890 @item planes
13891 A list of the planes to process. By default all planes are processed.
13892 @end table
13893
13894 @section vectorscope
13895
13896 Display 2 color component values in the two dimensional graph (which is called
13897 a vectorscope).
13898
13899 This filter accepts the following options:
13900
13901 @table @option
13902 @item mode, m
13903 Set vectorscope mode.
13904
13905 It accepts the following values:
13906 @table @samp
13907 @item gray
13908 Gray values are displayed on graph, higher brightness means more pixels have
13909 same component color value on location in graph. This is the default mode.
13910
13911 @item color
13912 Gray values are displayed on graph. Surrounding pixels values which are not
13913 present in video frame are drawn in gradient of 2 color components which are
13914 set by option @code{x} and @code{y}. The 3rd color component is static.
13915
13916 @item color2
13917 Actual color components values present in video frame are displayed on graph.
13918
13919 @item color3
13920 Similar as color2 but higher frequency of same values @code{x} and @code{y}
13921 on graph increases value of another color component, which is luminance by
13922 default values of @code{x} and @code{y}.
13923
13924 @item color4
13925 Actual colors present in video frame are displayed on graph. If two different
13926 colors map to same position on graph then color with higher value of component
13927 not present in graph is picked.
13928
13929 @item color5
13930 Gray values are displayed on graph. Similar to @code{color} but with 3rd color
13931 component picked from radial gradient.
13932 @end table
13933
13934 @item x
13935 Set which color component will be represented on X-axis. Default is @code{1}.
13936
13937 @item y
13938 Set which color component will be represented on Y-axis. Default is @code{2}.
13939
13940 @item intensity, i
13941 Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
13942 of color component which represents frequency of (X, Y) location in graph.
13943
13944 @item envelope, e
13945 @table @samp
13946 @item none
13947 No envelope, this is default.
13948
13949 @item instant
13950 Instant envelope, even darkest single pixel will be clearly highlighted.
13951
13952 @item peak
13953 Hold maximum and minimum values presented in graph over time. This way you
13954 can still spot out of range values without constantly looking at vectorscope.
13955
13956 @item peak+instant
13957 Peak and instant envelope combined together.
13958 @end table
13959
13960 @item graticule, g
13961 Set what kind of graticule to draw.
13962 @table @samp
13963 @item none
13964 @item green
13965 @item color
13966 @end table
13967
13968 @item opacity, o
13969 Set graticule opacity.
13970
13971 @item flags, f
13972 Set graticule flags.
13973
13974 @table @samp
13975 @item white
13976 Draw graticule for white point.
13977
13978 @item black
13979 Draw graticule for black point.
13980
13981 @item name
13982 Draw color points short names.
13983 @end table
13984
13985 @item bgopacity, b
13986 Set background opacity.
13987
13988 @item lthreshold, l
13989 Set low threshold for color component not represented on X or Y axis.
13990 Values lower than this value will be ignored. Default is 0.
13991 Note this value is multiplied with actual max possible value one pixel component
13992 can have. So for 8-bit input and low threshold value of 0.1 actual threshold
13993 is 0.1 * 255 = 25.
13994
13995 @item hthreshold, h
13996 Set high threshold for color component not represented on X or Y axis.
13997 Values higher than this value will be ignored. Default is 1.
13998 Note this value is multiplied with actual max possible value one pixel component
13999 can have. So for 8-bit input and high threshold value of 0.9 actual threshold
14000 is 0.9 * 255 = 230.
14001
14002 @item colorspace, c
14003 Set what kind of colorspace to use when drawing graticule.
14004 @table @samp
14005 @item auto
14006 @item 601
14007 @item 709
14008 @end table
14009 Default is auto.
14010 @end table
14011
14012 @anchor{vidstabdetect}
14013 @section vidstabdetect
14014
14015 Analyze video stabilization/deshaking. Perform pass 1 of 2, see
14016 @ref{vidstabtransform} for pass 2.
14017
14018 This filter generates a file with relative translation and rotation
14019 transform information about subsequent frames, which is then used by
14020 the @ref{vidstabtransform} filter.
14021
14022 To enable compilation of this filter you need to configure FFmpeg with
14023 @code{--enable-libvidstab}.
14024
14025 This filter accepts the following options:
14026
14027 @table @option
14028 @item result
14029 Set the path to the file used to write the transforms information.
14030 Default value is @file{transforms.trf}.
14031
14032 @item shakiness
14033 Set how shaky the video is and how quick the camera is. It accepts an
14034 integer in the range 1-10, a value of 1 means little shakiness, a
14035 value of 10 means strong shakiness. Default value is 5.
14036
14037 @item accuracy
14038 Set the accuracy of the detection process. It must be a value in the
14039 range 1-15. A value of 1 means low accuracy, a value of 15 means high
14040 accuracy. Default value is 15.
14041
14042 @item stepsize
14043 Set stepsize of the search process. The region around minimum is
14044 scanned with 1 pixel resolution. Default value is 6.
14045
14046 @item mincontrast
14047 Set minimum contrast. Below this value a local measurement field is
14048 discarded. Must be a floating point value in the range 0-1. Default
14049 value is 0.3.
14050
14051 @item tripod
14052 Set reference frame number for tripod mode.
14053
14054 If enabled, the motion of the frames is compared to a reference frame
14055 in the filtered stream, identified by the specified number. The idea
14056 is to compensate all movements in a more-or-less static scene and keep
14057 the camera view absolutely still.
14058
14059 If set to 0, it is disabled. The frames are counted starting from 1.
14060
14061 @item show
14062 Show fields and transforms in the resulting frames. It accepts an
14063 integer in the range 0-2. Default value is 0, which disables any
14064 visualization.
14065 @end table
14066
14067 @subsection Examples
14068
14069 @itemize
14070 @item
14071 Use default values:
14072 @example
14073 vidstabdetect
14074 @end example
14075
14076 @item
14077 Analyze strongly shaky movie and put the results in file
14078 @file{mytransforms.trf}:
14079 @example
14080 vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
14081 @end example
14082
14083 @item
14084 Visualize the result of internal transformations in the resulting
14085 video:
14086 @example
14087 vidstabdetect=show=1
14088 @end example
14089
14090 @item
14091 Analyze a video with medium shakiness using @command{ffmpeg}:
14092 @example
14093 ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
14094 @end example
14095 @end itemize
14096
14097 @anchor{vidstabtransform}
14098 @section vidstabtransform
14099
14100 Video stabilization/deshaking: pass 2 of 2,
14101 see @ref{vidstabdetect} for pass 1.
14102
14103 Read a file with transform information for each frame and
14104 apply/compensate them. Together with the @ref{vidstabdetect}
14105 filter this can be used to deshake videos. See also
14106 @url{http://public.hronopik.de/vid.stab}. It is important to also use
14107 the @ref{unsharp} filter, see below.
14108
14109 To enable compilation of this filter you need to configure FFmpeg with
14110 @code{--enable-libvidstab}.
14111
14112 @subsection Options
14113
14114 @table @option
14115 @item input
14116 Set path to the file used to read the transforms. Default value is
14117 @file{transforms.trf}.
14118
14119 @item smoothing
14120 Set the number of frames (value*2 + 1) used for lowpass filtering the
14121 camera movements. Default value is 10.
14122
14123 For example a number of 10 means that 21 frames are used (10 in the
14124 past and 10 in the future) to smoothen the motion in the video. A
14125 larger value leads to a smoother video, but limits the acceleration of
14126 the camera (pan/tilt movements). 0 is a special case where a static
14127 camera is simulated.
14128
14129 @item optalgo
14130 Set the camera path optimization algorithm.
14131
14132 Accepted values are:
14133 @table @samp
14134 @item gauss
14135 gaussian kernel low-pass filter on camera motion (default)
14136 @item avg
14137 averaging on transformations
14138 @end table
14139
14140 @item maxshift
14141 Set maximal number of pixels to translate frames. Default value is -1,
14142 meaning no limit.
14143
14144 @item maxangle
14145 Set maximal angle in radians (degree*PI/180) to rotate frames. Default
14146 value is -1, meaning no limit.
14147
14148 @item crop
14149 Specify how to deal with borders that may be visible due to movement
14150 compensation.
14151
14152 Available values are:
14153 @table @samp
14154 @item keep
14155 keep image information from previous frame (default)
14156 @item black
14157 fill the border black
14158 @end table
14159
14160 @item invert
14161 Invert transforms if set to 1. Default value is 0.
14162
14163 @item relative
14164 Consider transforms as relative to previous frame if set to 1,
14165 absolute if set to 0. Default value is 0.
14166
14167 @item zoom
14168 Set percentage to zoom. A positive value will result in a zoom-in
14169 effect, a negative value in a zoom-out effect. Default value is 0 (no
14170 zoom).
14171
14172 @item optzoom
14173 Set optimal zooming to avoid borders.
14174
14175 Accepted values are:
14176 @table @samp
14177 @item 0
14178 disabled
14179 @item 1
14180 optimal static zoom value is determined (only very strong movements
14181 will lead to visible borders) (default)
14182 @item 2
14183 optimal adaptive zoom value is determined (no borders will be
14184 visible), see @option{zoomspeed}
14185 @end table
14186
14187 Note that the value given at zoom is added to the one calculated here.
14188
14189 @item zoomspeed
14190 Set percent to zoom maximally each frame (enabled when
14191 @option{optzoom} is set to 2). Range is from 0 to 5, default value is
14192 0.25.
14193
14194 @item interpol
14195 Specify type of interpolation.
14196
14197 Available values are:
14198 @table @samp
14199 @item no
14200 no interpolation
14201 @item linear
14202 linear only horizontal
14203 @item bilinear
14204 linear in both directions (default)
14205 @item bicubic
14206 cubic in both directions (slow)
14207 @end table
14208
14209 @item tripod
14210 Enable virtual tripod mode if set to 1, which is equivalent to
14211 @code{relative=0:smoothing=0}. Default value is 0.
14212
14213 Use also @code{tripod} option of @ref{vidstabdetect}.
14214
14215 @item debug
14216 Increase log verbosity if set to 1. Also the detected global motions
14217 are written to the temporary file @file{global_motions.trf}. Default
14218 value is 0.
14219 @end table
14220
14221 @subsection Examples
14222
14223 @itemize
14224 @item
14225 Use @command{ffmpeg} for a typical stabilization with default values:
14226 @example
14227 ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
14228 @end example
14229
14230 Note the use of the @ref{unsharp} filter which is always recommended.
14231
14232 @item
14233 Zoom in a bit more and load transform data from a given file:
14234 @example
14235 vidstabtransform=zoom=5:input="mytransforms.trf"
14236 @end example
14237
14238 @item
14239 Smoothen the video even more:
14240 @example
14241 vidstabtransform=smoothing=30
14242 @end example
14243 @end itemize
14244
14245 @section vflip
14246
14247 Flip the input video vertically.
14248
14249 For example, to vertically flip a video with @command{ffmpeg}:
14250 @example
14251 ffmpeg -i in.avi -vf "vflip" out.avi
14252 @end example
14253
14254 @anchor{vignette}
14255 @section vignette
14256
14257 Make or reverse a natural vignetting effect.
14258
14259 The filter accepts the following options:
14260
14261 @table @option
14262 @item angle, a
14263 Set lens angle expression as a number of radians.
14264
14265 The value is clipped in the @code{[0,PI/2]} range.
14266
14267 Default value: @code{"PI/5"}
14268
14269 @item x0
14270 @item y0
14271 Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
14272 by default.
14273
14274 @item mode
14275 Set forward/backward mode.
14276
14277 Available modes are:
14278 @table @samp
14279 @item forward
14280 The larger the distance from the central point, the darker the image becomes.
14281
14282 @item backward
14283 The larger the distance from the central point, the brighter the image becomes.
14284 This can be used to reverse a vignette effect, though there is no automatic
14285 detection to extract the lens @option{angle} and other settings (yet). It can
14286 also be used to create a burning effect.
14287 @end table
14288
14289 Default value is @samp{forward}.
14290
14291 @item eval
14292 Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
14293
14294 It accepts the following values:
14295 @table @samp
14296 @item init
14297 Evaluate expressions only once during the filter initialization.
14298
14299 @item frame
14300 Evaluate expressions for each incoming frame. This is way slower than the
14301 @samp{init} mode since it requires all the scalers to be re-computed, but it
14302 allows advanced dynamic expressions.
14303 @end table
14304
14305 Default value is @samp{init}.
14306
14307 @item dither
14308 Set dithering to reduce the circular banding effects. Default is @code{1}
14309 (enabled).
14310
14311 @item aspect
14312 Set vignette aspect. This setting allows one to adjust the shape of the vignette.
14313 Setting this value to the SAR of the input will make a rectangular vignetting
14314 following the dimensions of the video.
14315
14316 Default is @code{1/1}.
14317 @end table
14318
14319 @subsection Expressions
14320
14321 The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
14322 following parameters.
14323
14324 @table @option
14325 @item w
14326 @item h
14327 input width and height
14328
14329 @item n
14330 the number of input frame, starting from 0
14331
14332 @item pts
14333 the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
14334 @var{TB} units, NAN if undefined
14335
14336 @item r
14337 frame rate of the input video, NAN if the input frame rate is unknown
14338
14339 @item t
14340 the PTS (Presentation TimeStamp) of the filtered video frame,
14341 expressed in seconds, NAN if undefined
14342
14343 @item tb
14344 time base of the input video
14345 @end table
14346
14347
14348 @subsection Examples
14349
14350 @itemize
14351 @item
14352 Apply simple strong vignetting effect:
14353 @example
14354 vignette=PI/4
14355 @end example
14356
14357 @item
14358 Make a flickering vignetting:
14359 @example
14360 vignette='PI/4+random(1)*PI/50':eval=frame
14361 @end example
14362
14363 @end itemize
14364
14365 @section vstack
14366 Stack input videos vertically.
14367
14368 All streams must be of same pixel format and of same width.
14369
14370 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
14371 to create same output.
14372
14373 The filter accept the following option:
14374
14375 @table @option
14376 @item inputs
14377 Set number of input streams. Default is 2.
14378
14379 @item shortest
14380 If set to 1, force the output to terminate when the shortest input
14381 terminates. Default value is 0.
14382 @end table
14383
14384 @section w3fdif
14385
14386 Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
14387 Deinterlacing Filter").
14388
14389 Based on the process described by Martin Weston for BBC R&D, and
14390 implemented based on the de-interlace algorithm written by Jim
14391 Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
14392 uses filter coefficients calculated by BBC R&D.
14393
14394 There are two sets of filter coefficients, so called "simple":
14395 and "complex". Which set of filter coefficients is used can
14396 be set by passing an optional parameter:
14397
14398 @table @option
14399 @item filter
14400 Set the interlacing filter coefficients. Accepts one of the following values:
14401
14402 @table @samp
14403 @item simple
14404 Simple filter coefficient set.
14405 @item complex
14406 More-complex filter coefficient set.
14407 @end table
14408 Default value is @samp{complex}.
14409
14410 @item deint
14411 Specify which frames to deinterlace. Accept one of the following values:
14412
14413 @table @samp
14414 @item all
14415 Deinterlace all frames,
14416 @item interlaced
14417 Only deinterlace frames marked as interlaced.
14418 @end table
14419
14420 Default value is @samp{all}.
14421 @end table
14422
14423 @section waveform
14424 Video waveform monitor.
14425
14426 The waveform monitor plots color component intensity. By default luminance
14427 only. Each column of the waveform corresponds to a column of pixels in the
14428 source video.
14429
14430 It accepts the following options:
14431
14432 @table @option
14433 @item mode, m
14434 Can be either @code{row}, or @code{column}. Default is @code{column}.
14435 In row mode, the graph on the left side represents color component value 0 and
14436 the right side represents value = 255. In column mode, the top side represents
14437 color component value = 0 and bottom side represents value = 255.
14438
14439 @item intensity, i
14440 Set intensity. Smaller values are useful to find out how many values of the same
14441 luminance are distributed across input rows/columns.
14442 Default value is @code{0.04}. Allowed range is [0, 1].
14443
14444 @item mirror, r
14445 Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
14446 In mirrored mode, higher values will be represented on the left
14447 side for @code{row} mode and at the top for @code{column} mode. Default is
14448 @code{1} (mirrored).
14449
14450 @item display, d
14451 Set display mode.
14452 It accepts the following values:
14453 @table @samp
14454 @item overlay
14455 Presents information identical to that in the @code{parade}, except
14456 that the graphs representing color components are superimposed directly
14457 over one another.
14458
14459 This display mode makes it easier to spot relative differences or similarities
14460 in overlapping areas of the color components that are supposed to be identical,
14461 such as neutral whites, grays, or blacks.
14462
14463 @item stack
14464 Display separate graph for the color components side by side in
14465 @code{row} mode or one below the other in @code{column} mode.
14466
14467 @item parade
14468 Display separate graph for the color components side by side in
14469 @code{column} mode or one below the other in @code{row} mode.
14470
14471 Using this display mode makes it easy to spot color casts in the highlights
14472 and shadows of an image, by comparing the contours of the top and the bottom
14473 graphs of each waveform. Since whites, grays, and blacks are characterized
14474 by exactly equal amounts of red, green, and blue, neutral areas of the picture
14475 should display three waveforms of roughly equal width/height. If not, the
14476 correction is easy to perform by making level adjustments the three waveforms.
14477 @end table
14478 Default is @code{stack}.
14479
14480 @item components, c
14481 Set which color components to display. Default is 1, which means only luminance
14482 or red color component if input is in RGB colorspace. If is set for example to
14483 7 it will display all 3 (if) available color components.
14484
14485 @item envelope, e
14486 @table @samp
14487 @item none
14488 No envelope, this is default.
14489
14490 @item instant
14491 Instant envelope, minimum and maximum values presented in graph will be easily
14492 visible even with small @code{step} value.
14493
14494 @item peak
14495 Hold minimum and maximum values presented in graph across time. This way you
14496 can still spot out of range values without constantly looking at waveforms.
14497
14498 @item peak+instant
14499 Peak and instant envelope combined together.
14500 @end table
14501
14502 @item filter, f
14503 @table @samp
14504 @item lowpass
14505 No filtering, this is default.
14506
14507 @item flat
14508 Luma and chroma combined together.
14509
14510 @item aflat
14511 Similar as above, but shows difference between blue and red chroma.
14512
14513 @item chroma
14514 Displays only chroma.
14515
14516 @item color
14517 Displays actual color value on waveform.
14518
14519 @item acolor
14520 Similar as above, but with luma showing frequency of chroma values.
14521 @end table
14522
14523 @item graticule, g
14524 Set which graticule to display.
14525
14526 @table @samp
14527 @item none
14528 Do not display graticule.
14529
14530 @item green
14531 Display green graticule showing legal broadcast ranges.
14532 @end table
14533
14534 @item opacity, o
14535 Set graticule opacity.
14536
14537 @item flags, fl
14538 Set graticule flags.
14539
14540 @table @samp
14541 @item numbers
14542 Draw numbers above lines. By default enabled.
14543
14544 @item dots
14545 Draw dots instead of lines.
14546 @end table
14547
14548 @item scale, s
14549 Set scale used for displaying graticule.
14550
14551 @table @samp
14552 @item digital
14553 @item millivolts
14554 @item ire
14555 @end table
14556 Default is digital.
14557
14558 @item bgopacity, b
14559 Set background opacity.
14560 @end table
14561
14562 @section weave
14563
14564 The @code{weave} takes a field-based video input and join
14565 each two sequential fields into single frame, producing a new double
14566 height clip with half the frame rate and half the frame count.
14567
14568 It accepts the following option:
14569
14570 @table @option
14571 @item first_field
14572 Set first field. Available values are:
14573
14574 @table @samp
14575 @item top, t
14576 Set the frame as top-field-first.
14577
14578 @item bottom, b
14579 Set the frame as bottom-field-first.
14580 @end table
14581 @end table
14582
14583 @subsection Examples
14584
14585 @itemize
14586 @item
14587 Interlace video using @ref{select} and @ref{separatefields} filter:
14588 @example
14589 separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
14590 @end example
14591 @end itemize
14592
14593 @section xbr
14594 Apply the xBR high-quality magnification filter which is designed for pixel
14595 art. It follows a set of edge-detection rules, see
14596 @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
14597
14598 It accepts the following option:
14599
14600 @table @option
14601 @item n
14602 Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
14603 @code{3xBR} and @code{4} for @code{4xBR}.
14604 Default is @code{3}.
14605 @end table
14606
14607 @anchor{yadif}
14608 @section yadif
14609
14610 Deinterlace the input video ("yadif" means "yet another deinterlacing
14611 filter").
14612
14613 It accepts the following parameters:
14614
14615
14616 @table @option
14617
14618 @item mode
14619 The interlacing mode to adopt. It accepts one of the following values:
14620
14621 @table @option
14622 @item 0, send_frame
14623 Output one frame for each frame.
14624 @item 1, send_field
14625 Output one frame for each field.
14626 @item 2, send_frame_nospatial
14627 Like @code{send_frame}, but it skips the spatial interlacing check.
14628 @item 3, send_field_nospatial
14629 Like @code{send_field}, but it skips the spatial interlacing check.
14630 @end table
14631
14632 The default value is @code{send_frame}.
14633
14634 @item parity
14635 The picture field parity assumed for the input interlaced video. It accepts one
14636 of the following values:
14637
14638 @table @option
14639 @item 0, tff
14640 Assume the top field is first.
14641 @item 1, bff
14642 Assume the bottom field is first.
14643 @item -1, auto
14644 Enable automatic detection of field parity.
14645 @end table
14646
14647 The default value is @code{auto}.
14648 If the interlacing is unknown or the decoder does not export this information,
14649 top field first will be assumed.
14650
14651 @item deint
14652 Specify which frames to deinterlace. Accept one of the following
14653 values:
14654
14655 @table @option
14656 @item 0, all
14657 Deinterlace all frames.
14658 @item 1, interlaced
14659 Only deinterlace frames marked as interlaced.
14660 @end table
14661
14662 The default value is @code{all}.
14663 @end table
14664
14665 @section zoompan
14666
14667 Apply Zoom & Pan effect.
14668
14669 This filter accepts the following options:
14670
14671 @table @option
14672 @item zoom, z
14673 Set the zoom expression. Default is 1.
14674
14675 @item x
14676 @item y
14677 Set the x and y expression. Default is 0.
14678
14679 @item d
14680 Set the duration expression in number of frames.
14681 This sets for how many number of frames effect will last for
14682 single input image.
14683
14684 @item s
14685 Set the output image size, default is 'hd720'.
14686
14687 @item fps
14688 Set the output frame rate, default is '25'.
14689 @end table
14690
14691 Each expression can contain the following constants:
14692
14693 @table @option
14694 @item in_w, iw
14695 Input width.
14696
14697 @item in_h, ih
14698 Input height.
14699
14700 @item out_w, ow
14701 Output width.
14702
14703 @item out_h, oh
14704 Output height.
14705
14706 @item in
14707 Input frame count.
14708
14709 @item on
14710 Output frame count.
14711
14712 @item x
14713 @item y
14714 Last calculated 'x' and 'y' position from 'x' and 'y' expression
14715 for current input frame.
14716
14717 @item px
14718 @item py
14719 'x' and 'y' of last output frame of previous input frame or 0 when there was
14720 not yet such frame (first input frame).
14721
14722 @item zoom
14723 Last calculated zoom from 'z' expression for current input frame.
14724
14725 @item pzoom
14726 Last calculated zoom of last output frame of previous input frame.
14727
14728 @item duration
14729 Number of output frames for current input frame. Calculated from 'd' expression
14730 for each input frame.
14731
14732 @item pduration
14733 number of output frames created for previous input frame
14734
14735 @item a
14736 Rational number: input width / input height
14737
14738 @item sar
14739 sample aspect ratio
14740
14741 @item dar
14742 display aspect ratio
14743
14744 @end table
14745
14746 @subsection Examples
14747
14748 @itemize
14749 @item
14750 Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
14751 @example
14752 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
14753 @end example
14754
14755 @item
14756 Zoom-in up to 1.5 and pan always at center of picture:
14757 @example
14758 zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
14759 @end example
14760
14761 @item
14762 Same as above but without pausing:
14763 @example
14764 zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
14765 @end example
14766 @end itemize
14767
14768 @section zscale
14769 Scale (resize) the input video, using the z.lib library:
14770 https://github.com/sekrit-twc/zimg.
14771
14772 The zscale filter forces the output display aspect ratio to be the same
14773 as the input, by changing the output sample aspect ratio.
14774
14775 If the input image format is different from the format requested by
14776 the next filter, the zscale filter will convert the input to the
14777 requested format.
14778
14779 @subsection Options
14780 The filter accepts the following options.
14781
14782 @table @option
14783 @item width, w
14784 @item height, h
14785 Set the output video dimension expression. Default value is the input
14786 dimension.
14787
14788 If the @var{width} or @var{w} is 0, the input width is used for the output.
14789 If the @var{height} or @var{h} is 0, the input height is used for the output.
14790
14791 If one of the values is -1, the zscale filter will use a value that
14792 maintains the aspect ratio of the input image, calculated from the
14793 other specified dimension. If both of them are -1, the input size is
14794 used
14795
14796 If one of the values is -n with n > 1, the zscale filter will also use a value
14797 that maintains the aspect ratio of the input image, calculated from the other
14798 specified dimension. After that it will, however, make sure that the calculated
14799 dimension is divisible by n and adjust the value if necessary.
14800
14801 See below for the list of accepted constants for use in the dimension
14802 expression.
14803
14804 @item size, s
14805 Set the video size. For the syntax of this option, check the
14806 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
14807
14808 @item dither, d
14809 Set the dither type.
14810
14811 Possible values are:
14812 @table @var
14813 @item none
14814 @item ordered
14815 @item random
14816 @item error_diffusion
14817 @end table
14818
14819 Default is none.
14820
14821 @item filter, f
14822 Set the resize filter type.
14823
14824 Possible values are:
14825 @table @var
14826 @item point
14827 @item bilinear
14828 @item bicubic
14829 @item spline16
14830 @item spline36
14831 @item lanczos
14832 @end table
14833
14834 Default is bilinear.
14835
14836 @item range, r
14837 Set the color range.
14838
14839 Possible values are:
14840 @table @var
14841 @item input
14842 @item limited
14843 @item full
14844 @end table
14845
14846 Default is same as input.
14847
14848 @item primaries, p
14849 Set the color primaries.
14850
14851 Possible values are:
14852 @table @var
14853 @item input
14854 @item 709
14855 @item unspecified
14856 @item 170m
14857 @item 240m
14858 @item 2020
14859 @end table
14860
14861 Default is same as input.
14862
14863 @item transfer, t
14864 Set the transfer characteristics.
14865
14866 Possible values are:
14867 @table @var
14868 @item input
14869 @item 709
14870 @item unspecified
14871 @item 601
14872 @item linear
14873 @item 2020_10
14874 @item 2020_12
14875 @item smpte2084
14876 @item iec61966-2-1
14877 @item arib-std-b67
14878 @end table
14879
14880 Default is same as input.
14881
14882 @item matrix, m
14883 Set the colorspace matrix.
14884
14885 Possible value are:
14886 @table @var
14887 @item input
14888 @item 709
14889 @item unspecified
14890 @item 470bg
14891 @item 170m
14892 @item 2020_ncl
14893 @item 2020_cl
14894 @end table
14895
14896 Default is same as input.
14897
14898 @item rangein, rin
14899 Set the input color range.
14900
14901 Possible values are:
14902 @table @var
14903 @item input
14904 @item limited
14905 @item full
14906 @end table
14907
14908 Default is same as input.
14909
14910 @item primariesin, pin
14911 Set the input color primaries.
14912
14913 Possible values are:
14914 @table @var
14915 @item input
14916 @item 709
14917 @item unspecified
14918 @item 170m
14919 @item 240m
14920 @item 2020
14921 @end table
14922
14923 Default is same as input.
14924
14925 @item transferin, tin
14926 Set the input transfer characteristics.
14927
14928 Possible values are:
14929 @table @var
14930 @item input
14931 @item 709
14932 @item unspecified
14933 @item 601
14934 @item linear
14935 @item 2020_10
14936 @item 2020_12
14937 @end table
14938
14939 Default is same as input.
14940
14941 @item matrixin, min
14942 Set the input colorspace matrix.
14943
14944 Possible value are:
14945 @table @var
14946 @item input
14947 @item 709
14948 @item unspecified
14949 @item 470bg
14950 @item 170m
14951 @item 2020_ncl
14952 @item 2020_cl
14953 @end table
14954
14955 @item chromal, c
14956 Set the output chroma location.
14957
14958 Possible values are:
14959 @table @var
14960 @item input
14961 @item left
14962 @item center
14963 @item topleft
14964 @item top
14965 @item bottomleft
14966 @item bottom
14967 @end table
14968
14969 @item chromalin, cin
14970 Set the input chroma location.
14971
14972 Possible values are:
14973 @table @var
14974 @item input
14975 @item left
14976 @item center
14977 @item topleft
14978 @item top
14979 @item bottomleft
14980 @item bottom
14981 @end table
14982
14983 @item npl
14984 Set the nominal peak luminance.
14985 @end table
14986
14987 The values of the @option{w} and @option{h} options are expressions
14988 containing the following constants:
14989
14990 @table @var
14991 @item in_w
14992 @item in_h
14993 The input width and height
14994
14995 @item iw
14996 @item ih
14997 These are the same as @var{in_w} and @var{in_h}.
14998
14999 @item out_w
15000 @item out_h
15001 The output (scaled) width and height
15002
15003 @item ow
15004 @item oh
15005 These are the same as @var{out_w} and @var{out_h}
15006
15007 @item a
15008 The same as @var{iw} / @var{ih}
15009
15010 @item sar
15011 input sample aspect ratio
15012
15013 @item dar
15014 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
15015
15016 @item hsub
15017 @item vsub
15018 horizontal and vertical input chroma subsample values. For example for the
15019 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
15020
15021 @item ohsub
15022 @item ovsub
15023 horizontal and vertical output chroma subsample values. For example for the
15024 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
15025 @end table
15026
15027 @table @option
15028 @end table
15029
15030 @c man end VIDEO FILTERS
15031
15032 @chapter Video Sources
15033 @c man begin VIDEO SOURCES
15034
15035 Below is a description of the currently available video sources.
15036
15037 @section buffer
15038
15039 Buffer video frames, and make them available to the filter chain.
15040
15041 This source is mainly intended for a programmatic use, in particular
15042 through the interface defined in @file{libavfilter/vsrc_buffer.h}.
15043
15044 It accepts the following parameters:
15045
15046 @table @option
15047
15048 @item video_size
15049 Specify the size (width and height) of the buffered video frames. For the
15050 syntax of this option, check the
15051 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15052
15053 @item width
15054 The input video width.
15055
15056 @item height
15057 The input video height.
15058
15059 @item pix_fmt
15060 A string representing the pixel format of the buffered video frames.
15061 It may be a number corresponding to a pixel format, or a pixel format
15062 name.
15063
15064 @item time_base
15065 Specify the timebase assumed by the timestamps of the buffered frames.
15066
15067 @item frame_rate
15068 Specify the frame rate expected for the video stream.
15069
15070 @item pixel_aspect, sar
15071 The sample (pixel) aspect ratio of the input video.
15072
15073 @item sws_param
15074 Specify the optional parameters to be used for the scale filter which
15075 is automatically inserted when an input change is detected in the
15076 input size or format.
15077
15078 @item hw_frames_ctx
15079 When using a hardware pixel format, this should be a reference to an
15080 AVHWFramesContext describing input frames.
15081 @end table
15082
15083 For example:
15084 @example
15085 buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
15086 @end example
15087
15088 will instruct the source to accept video frames with size 320x240 and
15089 with format "yuv410p", assuming 1/24 as the timestamps timebase and
15090 square pixels (1:1 sample aspect ratio).
15091 Since the pixel format with name "yuv410p" corresponds to the number 6
15092 (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
15093 this example corresponds to:
15094 @example
15095 buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
15096 @end example
15097
15098 Alternatively, the options can be specified as a flat string, but this
15099 syntax is deprecated:
15100
15101 @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}]
15102
15103 @section cellauto
15104
15105 Create a pattern generated by an elementary cellular automaton.
15106
15107 The initial state of the cellular automaton can be defined through the
15108 @option{filename} and @option{pattern} options. If such options are
15109 not specified an initial state is created randomly.
15110
15111 At each new frame a new row in the video is filled with the result of
15112 the cellular automaton next generation. The behavior when the whole
15113 frame is filled is defined by the @option{scroll} option.
15114
15115 This source accepts the following options:
15116
15117 @table @option
15118 @item filename, f
15119 Read the initial cellular automaton state, i.e. the starting row, from
15120 the specified file.
15121 In the file, each non-whitespace character is considered an alive
15122 cell, a newline will terminate the row, and further characters in the
15123 file will be ignored.
15124
15125 @item pattern, p
15126 Read the initial cellular automaton state, i.e. the starting row, from
15127 the specified string.
15128
15129 Each non-whitespace character in the string is considered an alive
15130 cell, a newline will terminate the row, and further characters in the
15131 string will be ignored.
15132
15133 @item rate, r
15134 Set the video rate, that is the number of frames generated per second.
15135 Default is 25.
15136
15137 @item random_fill_ratio, ratio
15138 Set the random fill ratio for the initial cellular automaton row. It
15139 is a floating point number value ranging from 0 to 1, defaults to
15140 1/PHI.
15141
15142 This option is ignored when a file or a pattern is specified.
15143
15144 @item random_seed, seed
15145 Set the seed for filling randomly the initial row, must be an integer
15146 included between 0 and UINT32_MAX. If not specified, or if explicitly
15147 set to -1, the filter will try to use a good random seed on a best
15148 effort basis.
15149
15150 @item rule
15151 Set the cellular automaton rule, it is a number ranging from 0 to 255.
15152 Default value is 110.
15153
15154 @item size, s
15155 Set the size of the output video. For the syntax of this option, check the
15156 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15157
15158 If @option{filename} or @option{pattern} is specified, the size is set
15159 by default to the width of the specified initial state row, and the
15160 height is set to @var{width} * PHI.
15161
15162 If @option{size} is set, it must contain the width of the specified
15163 pattern string, and the specified pattern will be centered in the
15164 larger row.
15165
15166 If a filename or a pattern string is not specified, the size value
15167 defaults to "320x518" (used for a randomly generated initial state).
15168
15169 @item scroll
15170 If set to 1, scroll the output upward when all the rows in the output
15171 have been already filled. If set to 0, the new generated row will be
15172 written over the top row just after the bottom row is filled.
15173 Defaults to 1.
15174
15175 @item start_full, full
15176 If set to 1, completely fill the output with generated rows before
15177 outputting the first frame.
15178 This is the default behavior, for disabling set the value to 0.
15179
15180 @item stitch
15181 If set to 1, stitch the left and right row edges together.
15182 This is the default behavior, for disabling set the value to 0.
15183 @end table
15184
15185 @subsection Examples
15186
15187 @itemize
15188 @item
15189 Read the initial state from @file{pattern}, and specify an output of
15190 size 200x400.
15191 @example
15192 cellauto=f=pattern:s=200x400
15193 @end example
15194
15195 @item
15196 Generate a random initial row with a width of 200 cells, with a fill
15197 ratio of 2/3:
15198 @example
15199 cellauto=ratio=2/3:s=200x200
15200 @end example
15201
15202 @item
15203 Create a pattern generated by rule 18 starting by a single alive cell
15204 centered on an initial row with width 100:
15205 @example
15206 cellauto=p=@@:s=100x400:full=0:rule=18
15207 @end example
15208
15209 @item
15210 Specify a more elaborated initial pattern:
15211 @example
15212 cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
15213 @end example
15214
15215 @end itemize
15216
15217 @anchor{coreimagesrc}
15218 @section coreimagesrc
15219 Video source generated on GPU using Apple's CoreImage API on OSX.
15220
15221 This video source is a specialized version of the @ref{coreimage} video filter.
15222 Use a core image generator at the beginning of the applied filterchain to
15223 generate the content.
15224
15225 The coreimagesrc video source accepts the following options:
15226 @table @option
15227 @item list_generators
15228 List all available generators along with all their respective options as well as
15229 possible minimum and maximum values along with the default values.
15230 @example
15231 list_generators=true
15232 @end example
15233
15234 @item size, s
15235 Specify the size of the sourced video. For the syntax of this option, check the
15236 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15237 The default value is @code{320x240}.
15238
15239 @item rate, r
15240 Specify the frame rate of the sourced video, as the number of frames
15241 generated per second. It has to be a string in the format
15242 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
15243 number or a valid video frame rate abbreviation. The default value is
15244 "25".
15245
15246 @item sar
15247 Set the sample aspect ratio of the sourced video.
15248
15249 @item duration, d
15250 Set the duration of the sourced video. See
15251 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
15252 for the accepted syntax.
15253
15254 If not specified, or the expressed duration is negative, the video is
15255 supposed to be generated forever.
15256 @end table
15257
15258 Additionally, all options of the @ref{coreimage} video filter are accepted.
15259 A complete filterchain can be used for further processing of the
15260 generated input without CPU-HOST transfer. See @ref{coreimage} documentation
15261 and examples for details.
15262
15263 @subsection Examples
15264
15265 @itemize
15266
15267 @item
15268 Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
15269 given as complete and escaped command-line for Apple's standard bash shell:
15270 @example
15271 ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
15272 @end example
15273 This example is equivalent to the QRCode example of @ref{coreimage} without the
15274 need for a nullsrc video source.
15275 @end itemize
15276
15277
15278 @section mandelbrot
15279
15280 Generate a Mandelbrot set fractal, and progressively zoom towards the
15281 point specified with @var{start_x} and @var{start_y}.
15282
15283 This source accepts the following options:
15284
15285 @table @option
15286
15287 @item end_pts
15288 Set the terminal pts value. Default value is 400.
15289
15290 @item end_scale
15291 Set the terminal scale value.
15292 Must be a floating point value. Default value is 0.3.
15293
15294 @item inner
15295 Set the inner coloring mode, that is the algorithm used to draw the
15296 Mandelbrot fractal internal region.
15297
15298 It shall assume one of the following values:
15299 @table @option
15300 @item black
15301 Set black mode.
15302 @item convergence
15303 Show time until convergence.
15304 @item mincol
15305 Set color based on point closest to the origin of the iterations.
15306 @item period
15307 Set period mode.
15308 @end table
15309
15310 Default value is @var{mincol}.
15311
15312 @item bailout
15313 Set the bailout value. Default value is 10.0.
15314
15315 @item maxiter
15316 Set the maximum of iterations performed by the rendering
15317 algorithm. Default value is 7189.
15318
15319 @item outer
15320 Set outer coloring mode.
15321 It shall assume one of following values:
15322 @table @option
15323 @item iteration_count
15324 Set iteration cound mode.
15325 @item normalized_iteration_count
15326 set normalized iteration count mode.
15327 @end table
15328 Default value is @var{normalized_iteration_count}.
15329
15330 @item rate, r
15331 Set frame rate, expressed as number of frames per second. Default
15332 value is "25".
15333
15334 @item size, s
15335 Set frame size. For the syntax of this option, check the "Video
15336 size" section in the ffmpeg-utils manual. Default value is "640x480".
15337
15338 @item start_scale
15339 Set the initial scale value. Default value is 3.0.
15340
15341 @item start_x
15342 Set the initial x position. Must be a floating point value between
15343 -100 and 100. Default value is -0.743643887037158704752191506114774.
15344
15345 @item start_y
15346 Set the initial y position. Must be a floating point value between
15347 -100 and 100. Default value is -0.131825904205311970493132056385139.
15348 @end table
15349
15350 @section mptestsrc
15351
15352 Generate various test patterns, as generated by the MPlayer test filter.
15353
15354 The size of the generated video is fixed, and is 256x256.
15355 This source is useful in particular for testing encoding features.
15356
15357 This source accepts the following options:
15358
15359 @table @option
15360
15361 @item rate, r
15362 Specify the frame rate of the sourced video, as the number of frames
15363 generated per second. It has to be a string in the format
15364 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
15365 number or a valid video frame rate abbreviation. The default value is
15366 "25".
15367
15368 @item duration, d
15369 Set the duration of the sourced video. See
15370 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
15371 for the accepted syntax.
15372
15373 If not specified, or the expressed duration is negative, the video is
15374 supposed to be generated forever.
15375
15376 @item test, t
15377
15378 Set the number or the name of the test to perform. Supported tests are:
15379 @table @option
15380 @item dc_luma
15381 @item dc_chroma
15382 @item freq_luma
15383 @item freq_chroma
15384 @item amp_luma
15385 @item amp_chroma
15386 @item cbp
15387 @item mv
15388 @item ring1
15389 @item ring2
15390 @item all
15391
15392 @end table
15393
15394 Default value is "all", which will cycle through the list of all tests.
15395 @end table
15396
15397 Some examples:
15398 @example
15399 mptestsrc=t=dc_luma
15400 @end example
15401
15402 will generate a "dc_luma" test pattern.
15403
15404 @section frei0r_src
15405
15406 Provide a frei0r source.
15407
15408 To enable compilation of this filter you need to install the frei0r
15409 header and configure FFmpeg with @code{--enable-frei0r}.
15410
15411 This source accepts the following parameters:
15412
15413 @table @option
15414
15415 @item size
15416 The size of the video to generate. For the syntax of this option, check the
15417 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15418
15419 @item framerate
15420 The framerate of the generated video. It may be a string of the form
15421 @var{num}/@var{den} or a frame rate abbreviation.
15422
15423 @item filter_name
15424 The name to the frei0r source to load. For more information regarding frei0r and
15425 how to set the parameters, read the @ref{frei0r} section in the video filters
15426 documentation.
15427
15428 @item filter_params
15429 A '|'-separated list of parameters to pass to the frei0r source.
15430
15431 @end table
15432
15433 For example, to generate a frei0r partik0l source with size 200x200
15434 and frame rate 10 which is overlaid on the overlay filter main input:
15435 @example
15436 frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
15437 @end example
15438
15439 @section life
15440
15441 Generate a life pattern.
15442
15443 This source is based on a generalization of John Conway's life game.
15444
15445 The sourced input represents a life grid, each pixel represents a cell
15446 which can be in one of two possible states, alive or dead. Every cell
15447 interacts with its eight neighbours, which are the cells that are
15448 horizontally, vertically, or diagonally adjacent.
15449
15450 At each interaction the grid evolves according to the adopted rule,
15451 which specifies the number of neighbor alive cells which will make a
15452 cell stay alive or born. The @option{rule} option allows one to specify
15453 the rule to adopt.
15454
15455 This source accepts the following options:
15456
15457 @table @option
15458 @item filename, f
15459 Set the file from which to read the initial grid state. In the file,
15460 each non-whitespace character is considered an alive cell, and newline
15461 is used to delimit the end of each row.
15462
15463 If this option is not specified, the initial grid is generated
15464 randomly.
15465
15466 @item rate, r
15467 Set the video rate, that is the number of frames generated per second.
15468 Default is 25.
15469
15470 @item random_fill_ratio, ratio
15471 Set the random fill ratio for the initial random grid. It is a
15472 floating point number value ranging from 0 to 1, defaults to 1/PHI.
15473 It is ignored when a file is specified.
15474
15475 @item random_seed, seed
15476 Set the seed for filling the initial random grid, must be an integer
15477 included between 0 and UINT32_MAX. If not specified, or if explicitly
15478 set to -1, the filter will try to use a good random seed on a best
15479 effort basis.
15480
15481 @item rule
15482 Set the life rule.
15483
15484 A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
15485 where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
15486 @var{NS} specifies the number of alive neighbor cells which make a
15487 live cell stay alive, and @var{NB} the number of alive neighbor cells
15488 which make a dead cell to become alive (i.e. to "born").
15489 "s" and "b" can be used in place of "S" and "B", respectively.
15490
15491 Alternatively a rule can be specified by an 18-bits integer. The 9
15492 high order bits are used to encode the next cell state if it is alive
15493 for each number of neighbor alive cells, the low order bits specify
15494 the rule for "borning" new cells. Higher order bits encode for an
15495 higher number of neighbor cells.
15496 For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
15497 rule of 12 and a born rule of 9, which corresponds to "S23/B03".
15498
15499 Default value is "S23/B3", which is the original Conway's game of life
15500 rule, and will keep a cell alive if it has 2 or 3 neighbor alive
15501 cells, and will born a new cell if there are three alive cells around
15502 a dead cell.
15503
15504 @item size, s
15505 Set the size of the output video. For the syntax of this option, check the
15506 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15507
15508 If @option{filename} is specified, the size is set by default to the
15509 same size of the input file. If @option{size} is set, it must contain
15510 the size specified in the input file, and the initial grid defined in
15511 that file is centered in the larger resulting area.
15512
15513 If a filename is not specified, the size value defaults to "320x240"
15514 (used for a randomly generated initial grid).
15515
15516 @item stitch
15517 If set to 1, stitch the left and right grid edges together, and the
15518 top and bottom edges also. Defaults to 1.
15519
15520 @item mold
15521 Set cell mold speed. If set, a dead cell will go from @option{death_color} to
15522 @option{mold_color} with a step of @option{mold}. @option{mold} can have a
15523 value from 0 to 255.
15524
15525 @item life_color
15526 Set the color of living (or new born) cells.
15527
15528 @item death_color
15529 Set the color of dead cells. If @option{mold} is set, this is the first color
15530 used to represent a dead cell.
15531
15532 @item mold_color
15533 Set mold color, for definitely dead and moldy cells.
15534
15535 For the syntax of these 3 color options, check the "Color" section in the
15536 ffmpeg-utils manual.
15537 @end table
15538
15539 @subsection Examples
15540
15541 @itemize
15542 @item
15543 Read a grid from @file{pattern}, and center it on a grid of size
15544 300x300 pixels:
15545 @example
15546 life=f=pattern:s=300x300
15547 @end example
15548
15549 @item
15550 Generate a random grid of size 200x200, with a fill ratio of 2/3:
15551 @example
15552 life=ratio=2/3:s=200x200
15553 @end example
15554
15555 @item
15556 Specify a custom rule for evolving a randomly generated grid:
15557 @example
15558 life=rule=S14/B34
15559 @end example
15560
15561 @item
15562 Full example with slow death effect (mold) using @command{ffplay}:
15563 @example
15564 ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
15565 @end example
15566 @end itemize
15567
15568 @anchor{allrgb}
15569 @anchor{allyuv}
15570 @anchor{color}
15571 @anchor{haldclutsrc}
15572 @anchor{nullsrc}
15573 @anchor{rgbtestsrc}
15574 @anchor{smptebars}
15575 @anchor{smptehdbars}
15576 @anchor{testsrc}
15577 @anchor{testsrc2}
15578 @anchor{yuvtestsrc}
15579 @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
15580
15581 The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
15582
15583 The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
15584
15585 The @code{color} source provides an uniformly colored input.
15586
15587 The @code{haldclutsrc} source provides an identity Hald CLUT. See also
15588 @ref{haldclut} filter.
15589
15590 The @code{nullsrc} source returns unprocessed video frames. It is
15591 mainly useful to be employed in analysis / debugging tools, or as the
15592 source for filters which ignore the input data.
15593
15594 The @code{rgbtestsrc} source generates an RGB test pattern useful for
15595 detecting RGB vs BGR issues. You should see a red, green and blue
15596 stripe from top to bottom.
15597
15598 The @code{smptebars} source generates a color bars pattern, based on
15599 the SMPTE Engineering Guideline EG 1-1990.
15600
15601 The @code{smptehdbars} source generates a color bars pattern, based on
15602 the SMPTE RP 219-2002.
15603
15604 The @code{testsrc} source generates a test video pattern, showing a
15605 color pattern, a scrolling gradient and a timestamp. This is mainly
15606 intended for testing purposes.
15607
15608 The @code{testsrc2} source is similar to testsrc, but supports more
15609 pixel formats instead of just @code{rgb24}. This allows using it as an
15610 input for other tests without requiring a format conversion.
15611
15612 The @code{yuvtestsrc} source generates an YUV test pattern. You should
15613 see a y, cb and cr stripe from top to bottom.
15614
15615 The sources accept the following parameters:
15616
15617 @table @option
15618
15619 @item color, c
15620 Specify the color of the source, only available in the @code{color}
15621 source. For the syntax of this option, check the "Color" section in the
15622 ffmpeg-utils manual.
15623
15624 @item level
15625 Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
15626 source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
15627 pixels to be used as identity matrix for 3D lookup tables. Each component is
15628 coded on a @code{1/(N*N)} scale.
15629
15630 @item size, s
15631 Specify the size of the sourced video. For the syntax of this option, check the
15632 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15633 The default value is @code{320x240}.
15634
15635 This option is not available with the @code{haldclutsrc} filter.
15636
15637 @item rate, r
15638 Specify the frame rate of the sourced video, as the number of frames
15639 generated per second. It has to be a string in the format
15640 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
15641 number or a valid video frame rate abbreviation. The default value is
15642 "25".
15643
15644 @item sar
15645 Set the sample aspect ratio of the sourced video.
15646
15647 @item duration, d
15648 Set the duration of the sourced video. See
15649 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
15650 for the accepted syntax.
15651
15652 If not specified, or the expressed duration is negative, the video is
15653 supposed to be generated forever.
15654
15655 @item decimals, n
15656 Set the number of decimals to show in the timestamp, only available in the
15657 @code{testsrc} source.
15658
15659 The displayed timestamp value will correspond to the original
15660 timestamp value multiplied by the power of 10 of the specified
15661 value. Default value is 0.
15662 @end table
15663
15664 For example the following:
15665 @example
15666 testsrc=duration=5.3:size=qcif:rate=10
15667 @end example
15668
15669 will generate a video with a duration of 5.3 seconds, with size
15670 176x144 and a frame rate of 10 frames per second.
15671
15672 The following graph description will generate a red source
15673 with an opacity of 0.2, with size "qcif" and a frame rate of 10
15674 frames per second.
15675 @example
15676 color=c=red@@0.2:s=qcif:r=10
15677 @end example
15678
15679 If the input content is to be ignored, @code{nullsrc} can be used. The
15680 following command generates noise in the luminance plane by employing
15681 the @code{geq} filter:
15682 @example
15683 nullsrc=s=256x256, geq=random(1)*255:128:128
15684 @end example
15685
15686 @subsection Commands
15687
15688 The @code{color} source supports the following commands:
15689
15690 @table @option
15691 @item c, color
15692 Set the color of the created image. Accepts the same syntax of the
15693 corresponding @option{color} option.
15694 @end table
15695
15696 @c man end VIDEO SOURCES
15697
15698 @chapter Video Sinks
15699 @c man begin VIDEO SINKS
15700
15701 Below is a description of the currently available video sinks.
15702
15703 @section buffersink
15704
15705 Buffer video frames, and make them available to the end of the filter
15706 graph.
15707
15708 This sink is mainly intended for programmatic use, in particular
15709 through the interface defined in @file{libavfilter/buffersink.h}
15710 or the options system.
15711
15712 It accepts a pointer to an AVBufferSinkContext structure, which
15713 defines the incoming buffers' formats, to be passed as the opaque
15714 parameter to @code{avfilter_init_filter} for initialization.
15715
15716 @section nullsink
15717
15718 Null video sink: do absolutely nothing with the input video. It is
15719 mainly useful as a template and for use in analysis / debugging
15720 tools.
15721
15722 @c man end VIDEO SINKS
15723
15724 @chapter Multimedia Filters
15725 @c man begin MULTIMEDIA FILTERS
15726
15727 Below is a description of the currently available multimedia filters.
15728
15729 @section abitscope
15730
15731 Convert input audio to a video output, displaying the audio bit scope.
15732
15733 The filter accepts the following options:
15734
15735 @table @option
15736 @item rate, r
15737 Set frame rate, expressed as number of frames per second. Default
15738 value is "25".
15739
15740 @item size, s
15741 Specify the video size for the output. For the syntax of this option, check the
15742 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15743 Default value is @code{1024x256}.
15744
15745 @item colors
15746 Specify list of colors separated by space or by '|' which will be used to
15747 draw channels. Unrecognized or missing colors will be replaced
15748 by white color.
15749 @end table
15750
15751 @section ahistogram
15752
15753 Convert input audio to a video output, displaying the volume histogram.
15754
15755 The filter accepts the following options:
15756
15757 @table @option
15758 @item dmode
15759 Specify how histogram is calculated.
15760
15761 It accepts the following values:
15762 @table @samp
15763 @item single
15764 Use single histogram for all channels.
15765 @item separate
15766 Use separate histogram for each channel.
15767 @end table
15768 Default is @code{single}.
15769
15770 @item rate, r
15771 Set frame rate, expressed as number of frames per second. Default
15772 value is "25".
15773
15774 @item size, s
15775 Specify the video size for the output. For the syntax of this option, check the
15776 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15777 Default value is @code{hd720}.
15778
15779 @item scale
15780 Set display scale.
15781
15782 It accepts the following values:
15783 @table @samp
15784 @item log
15785 logarithmic
15786 @item sqrt
15787 square root
15788 @item cbrt
15789 cubic root
15790 @item lin
15791 linear
15792 @item rlog
15793 reverse logarithmic
15794 @end table
15795 Default is @code{log}.
15796
15797 @item ascale
15798 Set amplitude scale.
15799
15800 It accepts the following values:
15801 @table @samp
15802 @item log
15803 logarithmic
15804 @item lin
15805 linear
15806 @end table
15807 Default is @code{log}.
15808
15809 @item acount
15810 Set how much frames to accumulate in histogram.
15811 Defauls is 1. Setting this to -1 accumulates all frames.
15812
15813 @item rheight
15814 Set histogram ratio of window height.
15815
15816 @item slide
15817 Set sonogram sliding.
15818
15819 It accepts the following values:
15820 @table @samp
15821 @item replace
15822 replace old rows with new ones.
15823 @item scroll
15824 scroll from top to bottom.
15825 @end table
15826 Default is @code{replace}.
15827 @end table
15828
15829 @section aphasemeter
15830
15831 Convert input audio to a video output, displaying the audio phase.
15832
15833 The filter accepts the following options:
15834
15835 @table @option
15836 @item rate, r
15837 Set the output frame rate. Default value is @code{25}.
15838
15839 @item size, s
15840 Set the video size for the output. For the syntax of this option, check the
15841 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15842 Default value is @code{800x400}.
15843
15844 @item rc
15845 @item gc
15846 @item bc
15847 Specify the red, green, blue contrast. Default values are @code{2},
15848 @code{7} and @code{1}.
15849 Allowed range is @code{[0, 255]}.
15850
15851 @item mpc
15852 Set color which will be used for drawing median phase. If color is
15853 @code{none} which is default, no median phase value will be drawn.
15854
15855 @item video
15856 Enable video output. Default is enabled.
15857 @end table
15858
15859 The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
15860 represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
15861 The @code{-1} means left and right channels are completely out of phase and
15862 @code{1} means channels are in phase.
15863
15864 @section avectorscope
15865
15866 Convert input audio to a video output, representing the audio vector
15867 scope.
15868
15869 The filter is used to measure the difference between channels of stereo
15870 audio stream. A monoaural signal, consisting of identical left and right
15871 signal, results in straight vertical line. Any stereo separation is visible
15872 as a deviation from this line, creating a Lissajous figure.
15873 If the straight (or deviation from it) but horizontal line appears this
15874 indicates that the left and right channels are out of phase.
15875
15876 The filter accepts the following options:
15877
15878 @table @option
15879 @item mode, m
15880 Set the vectorscope mode.
15881
15882 Available values are:
15883 @table @samp
15884 @item lissajous
15885 Lissajous rotated by 45 degrees.
15886
15887 @item lissajous_xy
15888 Same as above but not rotated.
15889
15890 @item polar
15891 Shape resembling half of circle.
15892 @end table
15893
15894 Default value is @samp{lissajous}.
15895
15896 @item size, s
15897 Set the video size for the output. For the syntax of this option, check the
15898 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15899 Default value is @code{400x400}.
15900
15901 @item rate, r
15902 Set the output frame rate. Default value is @code{25}.
15903
15904 @item rc
15905 @item gc
15906 @item bc
15907 @item ac
15908 Specify the red, green, blue and alpha contrast. Default values are @code{40},
15909 @code{160}, @code{80} and @code{255}.
15910 Allowed range is @code{[0, 255]}.
15911
15912 @item rf
15913 @item gf
15914 @item bf
15915 @item af
15916 Specify the red, green, blue and alpha fade. Default values are @code{15},
15917 @code{10}, @code{5} and @code{5}.
15918 Allowed range is @code{[0, 255]}.
15919
15920 @item zoom
15921 Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
15922
15923 @item draw
15924 Set the vectorscope drawing mode.
15925
15926 Available values are:
15927 @table @samp
15928 @item dot
15929 Draw dot for each sample.
15930
15931 @item line
15932 Draw line between previous and current sample.
15933 @end table
15934
15935 Default value is @samp{dot}.
15936
15937 @item scale
15938 Specify amplitude scale of audio samples.
15939
15940 Available values are:
15941 @table @samp
15942 @item lin
15943 Linear.
15944
15945 @item sqrt
15946 Square root.
15947
15948 @item cbrt
15949 Cubic root.
15950
15951 @item log
15952 Logarithmic.
15953 @end table
15954
15955 @end table
15956
15957 @subsection Examples
15958
15959 @itemize
15960 @item
15961 Complete example using @command{ffplay}:
15962 @example
15963 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
15964              [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
15965 @end example
15966 @end itemize
15967
15968 @section bench, abench
15969
15970 Benchmark part of a filtergraph.
15971
15972 The filter accepts the following options:
15973
15974 @table @option
15975 @item action
15976 Start or stop a timer.
15977
15978 Available values are:
15979 @table @samp
15980 @item start
15981 Get the current time, set it as frame metadata (using the key
15982 @code{lavfi.bench.start_time}), and forward the frame to the next filter.
15983
15984 @item stop
15985 Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
15986 the input frame metadata to get the time difference. Time difference, average,
15987 maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
15988 @code{min}) are then printed. The timestamps are expressed in seconds.
15989 @end table
15990 @end table
15991
15992 @subsection Examples
15993
15994 @itemize
15995 @item
15996 Benchmark @ref{selectivecolor} filter:
15997 @example
15998 bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
15999 @end example
16000 @end itemize
16001
16002 @section concat
16003
16004 Concatenate audio and video streams, joining them together one after the
16005 other.
16006
16007 The filter works on segments of synchronized video and audio streams. All
16008 segments must have the same number of streams of each type, and that will
16009 also be the number of streams at output.
16010
16011 The filter accepts the following options:
16012
16013 @table @option
16014
16015 @item n
16016 Set the number of segments. Default is 2.
16017
16018 @item v
16019 Set the number of output video streams, that is also the number of video
16020 streams in each segment. Default is 1.
16021
16022 @item a
16023 Set the number of output audio streams, that is also the number of audio
16024 streams in each segment. Default is 0.
16025
16026 @item unsafe
16027 Activate unsafe mode: do not fail if segments have a different format.
16028
16029 @end table
16030
16031 The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
16032 @var{a} audio outputs.
16033
16034 There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
16035 segment, in the same order as the outputs, then the inputs for the second
16036 segment, etc.
16037
16038 Related streams do not always have exactly the same duration, for various
16039 reasons including codec frame size or sloppy authoring. For that reason,
16040 related synchronized streams (e.g. a video and its audio track) should be
16041 concatenated at once. The concat filter will use the duration of the longest
16042 stream in each segment (except the last one), and if necessary pad shorter
16043 audio streams with silence.
16044
16045 For this filter to work correctly, all segments must start at timestamp 0.
16046
16047 All corresponding streams must have the same parameters in all segments; the
16048 filtering system will automatically select a common pixel format for video
16049 streams, and a common sample format, sample rate and channel layout for
16050 audio streams, but other settings, such as resolution, must be converted
16051 explicitly by the user.
16052
16053 Different frame rates are acceptable but will result in variable frame rate
16054 at output; be sure to configure the output file to handle it.
16055
16056 @subsection Examples
16057
16058 @itemize
16059 @item
16060 Concatenate an opening, an episode and an ending, all in bilingual version
16061 (video in stream 0, audio in streams 1 and 2):
16062 @example
16063 ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
16064   '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
16065    concat=n=3:v=1:a=2 [v] [a1] [a2]' \
16066   -map '[v]' -map '[a1]' -map '[a2]' output.mkv
16067 @end example
16068
16069 @item
16070 Concatenate two parts, handling audio and video separately, using the
16071 (a)movie sources, and adjusting the resolution:
16072 @example
16073 movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
16074 movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
16075 [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
16076 @end example
16077 Note that a desync will happen at the stitch if the audio and video streams
16078 do not have exactly the same duration in the first file.
16079
16080 @end itemize
16081
16082 @section drawgraph, adrawgraph
16083
16084 Draw a graph using input video or audio metadata.
16085
16086 It accepts the following parameters:
16087
16088 @table @option
16089 @item m1
16090 Set 1st frame metadata key from which metadata values will be used to draw a graph.
16091
16092 @item fg1
16093 Set 1st foreground color expression.
16094
16095 @item m2
16096 Set 2nd frame metadata key from which metadata values will be used to draw a graph.
16097
16098 @item fg2
16099 Set 2nd foreground color expression.
16100
16101 @item m3
16102 Set 3rd frame metadata key from which metadata values will be used to draw a graph.
16103
16104 @item fg3
16105 Set 3rd foreground color expression.
16106
16107 @item m4
16108 Set 4th frame metadata key from which metadata values will be used to draw a graph.
16109
16110 @item fg4
16111 Set 4th foreground color expression.
16112
16113 @item min
16114 Set minimal value of metadata value.
16115
16116 @item max
16117 Set maximal value of metadata value.
16118
16119 @item bg
16120 Set graph background color. Default is white.
16121
16122 @item mode
16123 Set graph mode.
16124
16125 Available values for mode is:
16126 @table @samp
16127 @item bar
16128 @item dot
16129 @item line
16130 @end table
16131
16132 Default is @code{line}.
16133
16134 @item slide
16135 Set slide mode.
16136
16137 Available values for slide is:
16138 @table @samp
16139 @item frame
16140 Draw new frame when right border is reached.
16141
16142 @item replace
16143 Replace old columns with new ones.
16144
16145 @item scroll
16146 Scroll from right to left.
16147
16148 @item rscroll
16149 Scroll from left to right.
16150
16151 @item picture
16152 Draw single picture.
16153 @end table
16154
16155 Default is @code{frame}.
16156
16157 @item size
16158 Set size of graph video. For the syntax of this option, check the
16159 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16160 The default value is @code{900x256}.
16161
16162 The foreground color expressions can use the following variables:
16163 @table @option
16164 @item MIN
16165 Minimal value of metadata value.
16166
16167 @item MAX
16168 Maximal value of metadata value.
16169
16170 @item VAL
16171 Current metadata key value.
16172 @end table
16173
16174 The color is defined as 0xAABBGGRR.
16175 @end table
16176
16177 Example using metadata from @ref{signalstats} filter:
16178 @example
16179 signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
16180 @end example
16181
16182 Example using metadata from @ref{ebur128} filter:
16183 @example
16184 ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
16185 @end example
16186
16187 @anchor{ebur128}
16188 @section ebur128
16189
16190 EBU R128 scanner filter. This filter takes an audio stream as input and outputs
16191 it unchanged. By default, it logs a message at a frequency of 10Hz with the
16192 Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
16193 Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
16194
16195 The filter also has a video output (see the @var{video} option) with a real
16196 time graph to observe the loudness evolution. The graphic contains the logged
16197 message mentioned above, so it is not printed anymore when this option is set,
16198 unless the verbose logging is set. The main graphing area contains the
16199 short-term loudness (3 seconds of analysis), and the gauge on the right is for
16200 the momentary loudness (400 milliseconds).
16201
16202 More information about the Loudness Recommendation EBU R128 on
16203 @url{http://tech.ebu.ch/loudness}.
16204
16205 The filter accepts the following options:
16206
16207 @table @option
16208
16209 @item video
16210 Activate the video output. The audio stream is passed unchanged whether this
16211 option is set or no. The video stream will be the first output stream if
16212 activated. Default is @code{0}.
16213
16214 @item size
16215 Set the video size. This option is for video only. For the syntax of this
16216 option, check the
16217 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16218 Default and minimum resolution is @code{640x480}.
16219
16220 @item meter
16221 Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
16222 @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
16223 other integer value between this range is allowed.
16224
16225 @item metadata
16226 Set metadata injection. If set to @code{1}, the audio input will be segmented
16227 into 100ms output frames, each of them containing various loudness information
16228 in metadata.  All the metadata keys are prefixed with @code{lavfi.r128.}.
16229
16230 Default is @code{0}.
16231
16232 @item framelog
16233 Force the frame logging level.
16234
16235 Available values are:
16236 @table @samp
16237 @item info
16238 information logging level
16239 @item verbose
16240 verbose logging level
16241 @end table
16242
16243 By default, the logging level is set to @var{info}. If the @option{video} or
16244 the @option{metadata} options are set, it switches to @var{verbose}.
16245
16246 @item peak
16247 Set peak mode(s).
16248
16249 Available modes can be cumulated (the option is a @code{flag} type). Possible
16250 values are:
16251 @table @samp
16252 @item none
16253 Disable any peak mode (default).
16254 @item sample
16255 Enable sample-peak mode.
16256
16257 Simple peak mode looking for the higher sample value. It logs a message
16258 for sample-peak (identified by @code{SPK}).
16259 @item true
16260 Enable true-peak mode.
16261
16262 If enabled, the peak lookup is done on an over-sampled version of the input
16263 stream for better peak accuracy. It logs a message for true-peak.
16264 (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
16265 This mode requires a build with @code{libswresample}.
16266 @end table
16267
16268 @item dualmono
16269 Treat mono input files as "dual mono". If a mono file is intended for playback
16270 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
16271 If set to @code{true}, this option will compensate for this effect.
16272 Multi-channel input files are not affected by this option.
16273
16274 @item panlaw
16275 Set a specific pan law to be used for the measurement of dual mono files.
16276 This parameter is optional, and has a default value of -3.01dB.
16277 @end table
16278
16279 @subsection Examples
16280
16281 @itemize
16282 @item
16283 Real-time graph using @command{ffplay}, with a EBU scale meter +18:
16284 @example
16285 ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
16286 @end example
16287
16288 @item
16289 Run an analysis with @command{ffmpeg}:
16290 @example
16291 ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
16292 @end example
16293 @end itemize
16294
16295 @section interleave, ainterleave
16296
16297 Temporally interleave frames from several inputs.
16298
16299 @code{interleave} works with video inputs, @code{ainterleave} with audio.
16300
16301 These filters read frames from several inputs and send the oldest
16302 queued frame to the output.
16303
16304 Input streams must have well defined, monotonically increasing frame
16305 timestamp values.
16306
16307 In order to submit one frame to output, these filters need to enqueue
16308 at least one frame for each input, so they cannot work in case one
16309 input is not yet terminated and will not receive incoming frames.
16310
16311 For example consider the case when one input is a @code{select} filter
16312 which always drops input frames. The @code{interleave} filter will keep
16313 reading from that input, but it will never be able to send new frames
16314 to output until the input sends an end-of-stream signal.
16315
16316 Also, depending on inputs synchronization, the filters will drop
16317 frames in case one input receives more frames than the other ones, and
16318 the queue is already filled.
16319
16320 These filters accept the following options:
16321
16322 @table @option
16323 @item nb_inputs, n
16324 Set the number of different inputs, it is 2 by default.
16325 @end table
16326
16327 @subsection Examples
16328
16329 @itemize
16330 @item
16331 Interleave frames belonging to different streams using @command{ffmpeg}:
16332 @example
16333 ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
16334 @end example
16335
16336 @item
16337 Add flickering blur effect:
16338 @example
16339 select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
16340 @end example
16341 @end itemize
16342
16343 @section metadata, ametadata
16344
16345 Manipulate frame metadata.
16346
16347 This filter accepts the following options:
16348
16349 @table @option
16350 @item mode
16351 Set mode of operation of the filter.
16352
16353 Can be one of the following:
16354
16355 @table @samp
16356 @item select
16357 If both @code{value} and @code{key} is set, select frames
16358 which have such metadata. If only @code{key} is set, select
16359 every frame that has such key in metadata.
16360
16361 @item add
16362 Add new metadata @code{key} and @code{value}. If key is already available
16363 do nothing.
16364
16365 @item modify
16366 Modify value of already present key.
16367
16368 @item delete
16369 If @code{value} is set, delete only keys that have such value.
16370 Otherwise, delete key. If @code{key} is not set, delete all metadata values in
16371 the frame.
16372
16373 @item print
16374 Print key and its value if metadata was found. If @code{key} is not set print all
16375 metadata values available in frame.
16376 @end table
16377
16378 @item key
16379 Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
16380
16381 @item value
16382 Set metadata value which will be used. This option is mandatory for
16383 @code{modify} and @code{add} mode.
16384
16385 @item function
16386 Which function to use when comparing metadata value and @code{value}.
16387
16388 Can be one of following:
16389
16390 @table @samp
16391 @item same_str
16392 Values are interpreted as strings, returns true if metadata value is same as @code{value}.
16393
16394 @item starts_with
16395 Values are interpreted as strings, returns true if metadata value starts with
16396 the @code{value} option string.
16397
16398 @item less
16399 Values are interpreted as floats, returns true if metadata value is less than @code{value}.
16400
16401 @item equal
16402 Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
16403
16404 @item greater
16405 Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
16406
16407 @item expr
16408 Values are interpreted as floats, returns true if expression from option @code{expr}
16409 evaluates to true.
16410 @end table
16411
16412 @item expr
16413 Set expression which is used when @code{function} is set to @code{expr}.
16414 The expression is evaluated through the eval API and can contain the following
16415 constants:
16416
16417 @table @option
16418 @item VALUE1
16419 Float representation of @code{value} from metadata key.
16420
16421 @item VALUE2
16422 Float representation of @code{value} as supplied by user in @code{value} option.
16423 @end table
16424
16425 @item file
16426 If specified in @code{print} mode, output is written to the named file. Instead of
16427 plain filename any writable url can be specified. Filename ``-'' is a shorthand
16428 for standard output. If @code{file} option is not set, output is written to the log
16429 with AV_LOG_INFO loglevel.
16430
16431 @end table
16432
16433 @subsection Examples
16434
16435 @itemize
16436 @item
16437 Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
16438 between 0 and 1.
16439 @example
16440 signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
16441 @end example
16442 @item
16443 Print silencedetect output to file @file{metadata.txt}.
16444 @example
16445 silencedetect,ametadata=mode=print:file=metadata.txt
16446 @end example
16447 @item
16448 Direct all metadata to a pipe with file descriptor 4.
16449 @example
16450 metadata=mode=print:file='pipe\:4'
16451 @end example
16452 @end itemize
16453
16454 @section perms, aperms
16455
16456 Set read/write permissions for the output frames.
16457
16458 These filters are mainly aimed at developers to test direct path in the
16459 following filter in the filtergraph.
16460
16461 The filters accept the following options:
16462
16463 @table @option
16464 @item mode
16465 Select the permissions mode.
16466
16467 It accepts the following values:
16468 @table @samp
16469 @item none
16470 Do nothing. This is the default.
16471 @item ro
16472 Set all the output frames read-only.
16473 @item rw
16474 Set all the output frames directly writable.
16475 @item toggle
16476 Make the frame read-only if writable, and writable if read-only.
16477 @item random
16478 Set each output frame read-only or writable randomly.
16479 @end table
16480
16481 @item seed
16482 Set the seed for the @var{random} mode, must be an integer included between
16483 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
16484 @code{-1}, the filter will try to use a good random seed on a best effort
16485 basis.
16486 @end table
16487
16488 Note: in case of auto-inserted filter between the permission filter and the
16489 following one, the permission might not be received as expected in that
16490 following filter. Inserting a @ref{format} or @ref{aformat} filter before the
16491 perms/aperms filter can avoid this problem.
16492
16493 @section realtime, arealtime
16494
16495 Slow down filtering to match real time approximatively.
16496
16497 These filters will pause the filtering for a variable amount of time to
16498 match the output rate with the input timestamps.
16499 They are similar to the @option{re} option to @code{ffmpeg}.
16500
16501 They accept the following options:
16502
16503 @table @option
16504 @item limit
16505 Time limit for the pauses. Any pause longer than that will be considered
16506 a timestamp discontinuity and reset the timer. Default is 2 seconds.
16507 @end table
16508
16509 @anchor{select}
16510 @section select, aselect
16511
16512 Select frames to pass in output.
16513
16514 This filter accepts the following options:
16515
16516 @table @option
16517
16518 @item expr, e
16519 Set expression, which is evaluated for each input frame.
16520
16521 If the expression is evaluated to zero, the frame is discarded.
16522
16523 If the evaluation result is negative or NaN, the frame is sent to the
16524 first output; otherwise it is sent to the output with index
16525 @code{ceil(val)-1}, assuming that the input index starts from 0.
16526
16527 For example a value of @code{1.2} corresponds to the output with index
16528 @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
16529
16530 @item outputs, n
16531 Set the number of outputs. The output to which to send the selected
16532 frame is based on the result of the evaluation. Default value is 1.
16533 @end table
16534
16535 The expression can contain the following constants:
16536
16537 @table @option
16538 @item n
16539 The (sequential) number of the filtered frame, starting from 0.
16540
16541 @item selected_n
16542 The (sequential) number of the selected frame, starting from 0.
16543
16544 @item prev_selected_n
16545 The sequential number of the last selected frame. It's NAN if undefined.
16546
16547 @item TB
16548 The timebase of the input timestamps.
16549
16550 @item pts
16551 The PTS (Presentation TimeStamp) of the filtered video frame,
16552 expressed in @var{TB} units. It's NAN if undefined.
16553
16554 @item t
16555 The PTS of the filtered video frame,
16556 expressed in seconds. It's NAN if undefined.
16557
16558 @item prev_pts
16559 The PTS of the previously filtered video frame. It's NAN if undefined.
16560
16561 @item prev_selected_pts
16562 The PTS of the last previously filtered video frame. It's NAN if undefined.
16563
16564 @item prev_selected_t
16565 The PTS of the last previously selected video frame. It's NAN if undefined.
16566
16567 @item start_pts
16568 The PTS of the first video frame in the video. It's NAN if undefined.
16569
16570 @item start_t
16571 The time of the first video frame in the video. It's NAN if undefined.
16572
16573 @item pict_type @emph{(video only)}
16574 The type of the filtered frame. It can assume one of the following
16575 values:
16576 @table @option
16577 @item I
16578 @item P
16579 @item B
16580 @item S
16581 @item SI
16582 @item SP
16583 @item BI
16584 @end table
16585
16586 @item interlace_type @emph{(video only)}
16587 The frame interlace type. It can assume one of the following values:
16588 @table @option
16589 @item PROGRESSIVE
16590 The frame is progressive (not interlaced).
16591 @item TOPFIRST
16592 The frame is top-field-first.
16593 @item BOTTOMFIRST
16594 The frame is bottom-field-first.
16595 @end table
16596
16597 @item consumed_sample_n @emph{(audio only)}
16598 the number of selected samples before the current frame
16599
16600 @item samples_n @emph{(audio only)}
16601 the number of samples in the current frame
16602
16603 @item sample_rate @emph{(audio only)}
16604 the input sample rate
16605
16606 @item key
16607 This is 1 if the filtered frame is a key-frame, 0 otherwise.
16608
16609 @item pos
16610 the position in the file of the filtered frame, -1 if the information
16611 is not available (e.g. for synthetic video)
16612
16613 @item scene @emph{(video only)}
16614 value between 0 and 1 to indicate a new scene; a low value reflects a low
16615 probability for the current frame to introduce a new scene, while a higher
16616 value means the current frame is more likely to be one (see the example below)
16617
16618 @item concatdec_select
16619 The concat demuxer can select only part of a concat input file by setting an
16620 inpoint and an outpoint, but the output packets may not be entirely contained
16621 in the selected interval. By using this variable, it is possible to skip frames
16622 generated by the concat demuxer which are not exactly contained in the selected
16623 interval.
16624
16625 This works by comparing the frame pts against the @var{lavf.concat.start_time}
16626 and the @var{lavf.concat.duration} packet metadata values which are also
16627 present in the decoded frames.
16628
16629 The @var{concatdec_select} variable is -1 if the frame pts is at least
16630 start_time and either the duration metadata is missing or the frame pts is less
16631 than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
16632 missing.
16633
16634 That basically means that an input frame is selected if its pts is within the
16635 interval set by the concat demuxer.
16636
16637 @end table
16638
16639 The default value of the select expression is "1".
16640
16641 @subsection Examples
16642
16643 @itemize
16644 @item
16645 Select all frames in input:
16646 @example
16647 select
16648 @end example
16649
16650 The example above is the same as:
16651 @example
16652 select=1
16653 @end example
16654
16655 @item
16656 Skip all frames:
16657 @example
16658 select=0
16659 @end example
16660
16661 @item
16662 Select only I-frames:
16663 @example
16664 select='eq(pict_type\,I)'
16665 @end example
16666
16667 @item
16668 Select one frame every 100:
16669 @example
16670 select='not(mod(n\,100))'
16671 @end example
16672
16673 @item
16674 Select only frames contained in the 10-20 time interval:
16675 @example
16676 select=between(t\,10\,20)
16677 @end example
16678
16679 @item
16680 Select only I-frames contained in the 10-20 time interval:
16681 @example
16682 select=between(t\,10\,20)*eq(pict_type\,I)
16683 @end example
16684
16685 @item
16686 Select frames with a minimum distance of 10 seconds:
16687 @example
16688 select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
16689 @end example
16690
16691 @item
16692 Use aselect to select only audio frames with samples number > 100:
16693 @example
16694 aselect='gt(samples_n\,100)'
16695 @end example
16696
16697 @item
16698 Create a mosaic of the first scenes:
16699 @example
16700 ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
16701 @end example
16702
16703 Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
16704 choice.
16705
16706 @item
16707 Send even and odd frames to separate outputs, and compose them:
16708 @example
16709 select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
16710 @end example
16711
16712 @item
16713 Select useful frames from an ffconcat file which is using inpoints and
16714 outpoints but where the source files are not intra frame only.
16715 @example
16716 ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
16717 @end example
16718 @end itemize
16719
16720 @section sendcmd, asendcmd
16721
16722 Send commands to filters in the filtergraph.
16723
16724 These filters read commands to be sent to other filters in the
16725 filtergraph.
16726
16727 @code{sendcmd} must be inserted between two video filters,
16728 @code{asendcmd} must be inserted between two audio filters, but apart
16729 from that they act the same way.
16730
16731 The specification of commands can be provided in the filter arguments
16732 with the @var{commands} option, or in a file specified by the
16733 @var{filename} option.
16734
16735 These filters accept the following options:
16736 @table @option
16737 @item commands, c
16738 Set the commands to be read and sent to the other filters.
16739 @item filename, f
16740 Set the filename of the commands to be read and sent to the other
16741 filters.
16742 @end table
16743
16744 @subsection Commands syntax
16745
16746 A commands description consists of a sequence of interval
16747 specifications, comprising a list of commands to be executed when a
16748 particular event related to that interval occurs. The occurring event
16749 is typically the current frame time entering or leaving a given time
16750 interval.
16751
16752 An interval is specified by the following syntax:
16753 @example
16754 @var{START}[-@var{END}] @var{COMMANDS};
16755 @end example
16756
16757 The time interval is specified by the @var{START} and @var{END} times.
16758 @var{END} is optional and defaults to the maximum time.
16759
16760 The current frame time is considered within the specified interval if
16761 it is included in the interval [@var{START}, @var{END}), that is when
16762 the time is greater or equal to @var{START} and is lesser than
16763 @var{END}.
16764
16765 @var{COMMANDS} consists of a sequence of one or more command
16766 specifications, separated by ",", relating to that interval.  The
16767 syntax of a command specification is given by:
16768 @example
16769 [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
16770 @end example
16771
16772 @var{FLAGS} is optional and specifies the type of events relating to
16773 the time interval which enable sending the specified command, and must
16774 be a non-null sequence of identifier flags separated by "+" or "|" and
16775 enclosed between "[" and "]".
16776
16777 The following flags are recognized:
16778 @table @option
16779 @item enter
16780 The command is sent when the current frame timestamp enters the
16781 specified interval. In other words, the command is sent when the
16782 previous frame timestamp was not in the given interval, and the
16783 current is.
16784
16785 @item leave
16786 The command is sent when the current frame timestamp leaves the
16787 specified interval. In other words, the command is sent when the
16788 previous frame timestamp was in the given interval, and the
16789 current is not.
16790 @end table
16791
16792 If @var{FLAGS} is not specified, a default value of @code{[enter]} is
16793 assumed.
16794
16795 @var{TARGET} specifies the target of the command, usually the name of
16796 the filter class or a specific filter instance name.
16797
16798 @var{COMMAND} specifies the name of the command for the target filter.
16799
16800 @var{ARG} is optional and specifies the optional list of argument for
16801 the given @var{COMMAND}.
16802
16803 Between one interval specification and another, whitespaces, or
16804 sequences of characters starting with @code{#} until the end of line,
16805 are ignored and can be used to annotate comments.
16806
16807 A simplified BNF description of the commands specification syntax
16808 follows:
16809 @example
16810 @var{COMMAND_FLAG}  ::= "enter" | "leave"
16811 @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
16812 @var{COMMAND}       ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
16813 @var{COMMANDS}      ::= @var{COMMAND} [,@var{COMMANDS}]
16814 @var{INTERVAL}      ::= @var{START}[-@var{END}] @var{COMMANDS}
16815 @var{INTERVALS}     ::= @var{INTERVAL}[;@var{INTERVALS}]
16816 @end example
16817
16818 @subsection Examples
16819
16820 @itemize
16821 @item
16822 Specify audio tempo change at second 4:
16823 @example
16824 asendcmd=c='4.0 atempo tempo 1.5',atempo
16825 @end example
16826
16827 @item
16828 Specify a list of drawtext and hue commands in a file.
16829 @example
16830 # show text in the interval 5-10
16831 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
16832          [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
16833
16834 # desaturate the image in the interval 15-20
16835 15.0-20.0 [enter] hue s 0,
16836           [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
16837           [leave] hue s 1,
16838           [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
16839
16840 # apply an exponential saturation fade-out effect, starting from time 25
16841 25 [enter] hue s exp(25-t)
16842 @end example
16843
16844 A filtergraph allowing to read and process the above command list
16845 stored in a file @file{test.cmd}, can be specified with:
16846 @example
16847 sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
16848 @end example
16849 @end itemize
16850
16851 @anchor{setpts}
16852 @section setpts, asetpts
16853
16854 Change the PTS (presentation timestamp) of the input frames.
16855
16856 @code{setpts} works on video frames, @code{asetpts} on audio frames.
16857
16858 This filter accepts the following options:
16859
16860 @table @option
16861
16862 @item expr
16863 The expression which is evaluated for each frame to construct its timestamp.
16864
16865 @end table
16866
16867 The expression is evaluated through the eval API and can contain the following
16868 constants:
16869
16870 @table @option
16871 @item FRAME_RATE
16872 frame rate, only defined for constant frame-rate video
16873
16874 @item PTS
16875 The presentation timestamp in input
16876
16877 @item N
16878 The count of the input frame for video or the number of consumed samples,
16879 not including the current frame for audio, starting from 0.
16880
16881 @item NB_CONSUMED_SAMPLES
16882 The number of consumed samples, not including the current frame (only
16883 audio)
16884
16885 @item NB_SAMPLES, S
16886 The number of samples in the current frame (only audio)
16887
16888 @item SAMPLE_RATE, SR
16889 The audio sample rate.
16890
16891 @item STARTPTS
16892 The PTS of the first frame.
16893
16894 @item STARTT
16895 the time in seconds of the first frame
16896
16897 @item INTERLACED
16898 State whether the current frame is interlaced.
16899
16900 @item T
16901 the time in seconds of the current frame
16902
16903 @item POS
16904 original position in the file of the frame, or undefined if undefined
16905 for the current frame
16906
16907 @item PREV_INPTS
16908 The previous input PTS.
16909
16910 @item PREV_INT
16911 previous input time in seconds
16912
16913 @item PREV_OUTPTS
16914 The previous output PTS.
16915
16916 @item PREV_OUTT
16917 previous output time in seconds
16918
16919 @item RTCTIME
16920 The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
16921 instead.
16922
16923 @item RTCSTART
16924 The wallclock (RTC) time at the start of the movie in microseconds.
16925
16926 @item TB
16927 The timebase of the input timestamps.
16928
16929 @end table
16930
16931 @subsection Examples
16932
16933 @itemize
16934 @item
16935 Start counting PTS from zero
16936 @example
16937 setpts=PTS-STARTPTS
16938 @end example
16939
16940 @item
16941 Apply fast motion effect:
16942 @example
16943 setpts=0.5*PTS
16944 @end example
16945
16946 @item
16947 Apply slow motion effect:
16948 @example
16949 setpts=2.0*PTS
16950 @end example
16951
16952 @item
16953 Set fixed rate of 25 frames per second:
16954 @example
16955 setpts=N/(25*TB)
16956 @end example
16957
16958 @item
16959 Set fixed rate 25 fps with some jitter:
16960 @example
16961 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
16962 @end example
16963
16964 @item
16965 Apply an offset of 10 seconds to the input PTS:
16966 @example
16967 setpts=PTS+10/TB
16968 @end example
16969
16970 @item
16971 Generate timestamps from a "live source" and rebase onto the current timebase:
16972 @example
16973 setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
16974 @end example
16975
16976 @item
16977 Generate timestamps by counting samples:
16978 @example
16979 asetpts=N/SR/TB
16980 @end example
16981
16982 @end itemize
16983
16984 @section settb, asettb
16985
16986 Set the timebase to use for the output frames timestamps.
16987 It is mainly useful for testing timebase configuration.
16988
16989 It accepts the following parameters:
16990
16991 @table @option
16992
16993 @item expr, tb
16994 The expression which is evaluated into the output timebase.
16995
16996 @end table
16997
16998 The value for @option{tb} is an arithmetic expression representing a
16999 rational. The expression can contain the constants "AVTB" (the default
17000 timebase), "intb" (the input timebase) and "sr" (the sample rate,
17001 audio only). Default value is "intb".
17002
17003 @subsection Examples
17004
17005 @itemize
17006 @item
17007 Set the timebase to 1/25:
17008 @example
17009 settb=expr=1/25
17010 @end example
17011
17012 @item
17013 Set the timebase to 1/10:
17014 @example
17015 settb=expr=0.1
17016 @end example
17017
17018 @item
17019 Set the timebase to 1001/1000:
17020 @example
17021 settb=1+0.001
17022 @end example
17023
17024 @item
17025 Set the timebase to 2*intb:
17026 @example
17027 settb=2*intb
17028 @end example
17029
17030 @item
17031 Set the default timebase value:
17032 @example
17033 settb=AVTB
17034 @end example
17035 @end itemize
17036
17037 @section showcqt
17038 Convert input audio to a video output representing frequency spectrum
17039 logarithmically using Brown-Puckette constant Q transform algorithm with
17040 direct frequency domain coefficient calculation (but the transform itself
17041 is not really constant Q, instead the Q factor is actually variable/clamped),
17042 with musical tone scale, from E0 to D#10.
17043
17044 The filter accepts the following options:
17045
17046 @table @option
17047 @item size, s
17048 Specify the video size for the output. It must be even. For the syntax of this option,
17049 check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17050 Default value is @code{1920x1080}.
17051
17052 @item fps, rate, r
17053 Set the output frame rate. Default value is @code{25}.
17054
17055 @item bar_h
17056 Set the bargraph height. It must be even. Default value is @code{-1} which
17057 computes the bargraph height automatically.
17058
17059 @item axis_h
17060 Set the axis height. It must be even. Default value is @code{-1} which computes
17061 the axis height automatically.
17062
17063 @item sono_h
17064 Set the sonogram height. It must be even. Default value is @code{-1} which
17065 computes the sonogram height automatically.
17066
17067 @item fullhd
17068 Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
17069 instead. Default value is @code{1}.
17070
17071 @item sono_v, volume
17072 Specify the sonogram volume expression. It can contain variables:
17073 @table @option
17074 @item bar_v
17075 the @var{bar_v} evaluated expression
17076 @item frequency, freq, f
17077 the frequency where it is evaluated
17078 @item timeclamp, tc
17079 the value of @var{timeclamp} option
17080 @end table
17081 and functions:
17082 @table @option
17083 @item a_weighting(f)
17084 A-weighting of equal loudness
17085 @item b_weighting(f)
17086 B-weighting of equal loudness
17087 @item c_weighting(f)
17088 C-weighting of equal loudness.
17089 @end table
17090 Default value is @code{16}.
17091
17092 @item bar_v, volume2
17093 Specify the bargraph volume expression. It can contain variables:
17094 @table @option
17095 @item sono_v
17096 the @var{sono_v} evaluated expression
17097 @item frequency, freq, f
17098 the frequency where it is evaluated
17099 @item timeclamp, tc
17100 the value of @var{timeclamp} option
17101 @end table
17102 and functions:
17103 @table @option
17104 @item a_weighting(f)
17105 A-weighting of equal loudness
17106 @item b_weighting(f)
17107 B-weighting of equal loudness
17108 @item c_weighting(f)
17109 C-weighting of equal loudness.
17110 @end table
17111 Default value is @code{sono_v}.
17112
17113 @item sono_g, gamma
17114 Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
17115 higher gamma makes the spectrum having more range. Default value is @code{3}.
17116 Acceptable range is @code{[1, 7]}.
17117
17118 @item bar_g, gamma2
17119 Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
17120 @code{[1, 7]}.
17121
17122 @item bar_t
17123 Specify the bargraph transparency level. Lower value makes the bargraph sharper.
17124 Default value is @code{1}. Acceptable range is @code{[0, 1]}.
17125
17126 @item timeclamp, tc
17127 Specify the transform timeclamp. At low frequency, there is trade-off between
17128 accuracy in time domain and frequency domain. If timeclamp is lower,
17129 event in time domain is represented more accurately (such as fast bass drum),
17130 otherwise event in frequency domain is represented more accurately
17131 (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
17132
17133 @item basefreq
17134 Specify the transform base frequency. Default value is @code{20.01523126408007475},
17135 which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
17136
17137 @item endfreq
17138 Specify the transform end frequency. Default value is @code{20495.59681441799654},
17139 which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
17140
17141 @item coeffclamp
17142 This option is deprecated and ignored.
17143
17144 @item tlength
17145 Specify the transform length in time domain. Use this option to control accuracy
17146 trade-off between time domain and frequency domain at every frequency sample.
17147 It can contain variables:
17148 @table @option
17149 @item frequency, freq, f
17150 the frequency where it is evaluated
17151 @item timeclamp, tc
17152 the value of @var{timeclamp} option.
17153 @end table
17154 Default value is @code{384*tc/(384+tc*f)}.
17155
17156 @item count
17157 Specify the transform count for every video frame. Default value is @code{6}.
17158 Acceptable range is @code{[1, 30]}.
17159
17160 @item fcount
17161 Specify the transform count for every single pixel. Default value is @code{0},
17162 which makes it computed automatically. Acceptable range is @code{[0, 10]}.
17163
17164 @item fontfile
17165 Specify font file for use with freetype to draw the axis. If not specified,
17166 use embedded font. Note that drawing with font file or embedded font is not
17167 implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
17168 option instead.
17169
17170 @item font
17171 Specify fontconfig pattern. This has lower priority than @var{fontfile}.
17172 The : in the pattern may be replaced by | to avoid unnecessary escaping.
17173
17174 @item fontcolor
17175 Specify font color expression. This is arithmetic expression that should return
17176 integer value 0xRRGGBB. It can contain variables:
17177 @table @option
17178 @item frequency, freq, f
17179 the frequency where it is evaluated
17180 @item timeclamp, tc
17181 the value of @var{timeclamp} option
17182 @end table
17183 and functions:
17184 @table @option
17185 @item midi(f)
17186 midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
17187 @item r(x), g(x), b(x)
17188 red, green, and blue value of intensity x.
17189 @end table
17190 Default value is @code{st(0, (midi(f)-59.5)/12);
17191 st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
17192 r(1-ld(1)) + b(ld(1))}.
17193
17194 @item axisfile
17195 Specify image file to draw the axis. This option override @var{fontfile} and
17196 @var{fontcolor} option.
17197
17198 @item axis, text
17199 Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
17200 the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
17201 Default value is @code{1}.
17202
17203 @item csp
17204 Set colorspace. The accepted values are:
17205 @table @samp
17206 @item unspecified
17207 Unspecified (default)
17208
17209 @item bt709
17210 BT.709
17211
17212 @item fcc
17213 FCC
17214
17215 @item bt470bg
17216 BT.470BG or BT.601-6 625
17217
17218 @item smpte170m
17219 SMPTE-170M or BT.601-6 525
17220
17221 @item smpte240m
17222 SMPTE-240M
17223
17224 @item bt2020ncl
17225 BT.2020 with non-constant luminance
17226
17227 @end table
17228
17229 @item cscheme
17230 Set spectrogram color scheme. This is list of floating point values with format
17231 @code{left_r|left_g|left_b|right_r|right_g|right_b}.
17232 The default is @code{1|0.5|0|0|0.5|1}.
17233
17234 @end table
17235
17236 @subsection Examples
17237
17238 @itemize
17239 @item
17240 Playing audio while showing the spectrum:
17241 @example
17242 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
17243 @end example
17244
17245 @item
17246 Same as above, but with frame rate 30 fps:
17247 @example
17248 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
17249 @end example
17250
17251 @item
17252 Playing at 1280x720:
17253 @example
17254 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
17255 @end example
17256
17257 @item
17258 Disable sonogram display:
17259 @example
17260 sono_h=0
17261 @end example
17262
17263 @item
17264 A1 and its harmonics: A1, A2, (near)E3, A3:
17265 @example
17266 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),
17267                  asplit[a][out1]; [a] showcqt [out0]'
17268 @end example
17269
17270 @item
17271 Same as above, but with more accuracy in frequency domain:
17272 @example
17273 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),
17274                  asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
17275 @end example
17276
17277 @item
17278 Custom volume:
17279 @example
17280 bar_v=10:sono_v=bar_v*a_weighting(f)
17281 @end example
17282
17283 @item
17284 Custom gamma, now spectrum is linear to the amplitude.
17285 @example
17286 bar_g=2:sono_g=2
17287 @end example
17288
17289 @item
17290 Custom tlength equation:
17291 @example
17292 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)))'
17293 @end example
17294
17295 @item
17296 Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
17297 @example
17298 fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
17299 @end example
17300
17301 @item
17302 Custom font using fontconfig:
17303 @example
17304 font='Courier New,Monospace,mono|bold'
17305 @end example
17306
17307 @item
17308 Custom frequency range with custom axis using image file:
17309 @example
17310 axisfile=myaxis.png:basefreq=40:endfreq=10000
17311 @end example
17312 @end itemize
17313
17314 @section showfreqs
17315
17316 Convert input audio to video output representing the audio power spectrum.
17317 Audio amplitude is on Y-axis while frequency is on X-axis.
17318
17319 The filter accepts the following options:
17320
17321 @table @option
17322 @item size, s
17323 Specify size of video. For the syntax of this option, check the
17324 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17325 Default is @code{1024x512}.
17326
17327 @item mode
17328 Set display mode.
17329 This set how each frequency bin will be represented.
17330
17331 It accepts the following values:
17332 @table @samp
17333 @item line
17334 @item bar
17335 @item dot
17336 @end table
17337 Default is @code{bar}.
17338
17339 @item ascale
17340 Set amplitude scale.
17341
17342 It accepts the following values:
17343 @table @samp
17344 @item lin
17345 Linear scale.
17346
17347 @item sqrt
17348 Square root scale.
17349
17350 @item cbrt
17351 Cubic root scale.
17352
17353 @item log
17354 Logarithmic scale.
17355 @end table
17356 Default is @code{log}.
17357
17358 @item fscale
17359 Set frequency scale.
17360
17361 It accepts the following values:
17362 @table @samp
17363 @item lin
17364 Linear scale.
17365
17366 @item log
17367 Logarithmic scale.
17368
17369 @item rlog
17370 Reverse logarithmic scale.
17371 @end table
17372 Default is @code{lin}.
17373
17374 @item win_size
17375 Set window size.
17376
17377 It accepts the following values:
17378 @table @samp
17379 @item w16
17380 @item w32
17381 @item w64
17382 @item w128
17383 @item w256
17384 @item w512
17385 @item w1024
17386 @item w2048
17387 @item w4096
17388 @item w8192
17389 @item w16384
17390 @item w32768
17391 @item w65536
17392 @end table
17393 Default is @code{w2048}
17394
17395 @item win_func
17396 Set windowing function.
17397
17398 It accepts the following values:
17399 @table @samp
17400 @item rect
17401 @item bartlett
17402 @item hanning
17403 @item hamming
17404 @item blackman
17405 @item welch
17406 @item flattop
17407 @item bharris
17408 @item bnuttall
17409 @item bhann
17410 @item sine
17411 @item nuttall
17412 @item lanczos
17413 @item gauss
17414 @item tukey
17415 @item dolph
17416 @item cauchy
17417 @item parzen
17418 @item poisson
17419 @end table
17420 Default is @code{hanning}.
17421
17422 @item overlap
17423 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
17424 which means optimal overlap for selected window function will be picked.
17425
17426 @item averaging
17427 Set time averaging. Setting this to 0 will display current maximal peaks.
17428 Default is @code{1}, which means time averaging is disabled.
17429
17430 @item colors
17431 Specify list of colors separated by space or by '|' which will be used to
17432 draw channel frequencies. Unrecognized or missing colors will be replaced
17433 by white color.
17434
17435 @item cmode
17436 Set channel display mode.
17437
17438 It accepts the following values:
17439 @table @samp
17440 @item combined
17441 @item separate
17442 @end table
17443 Default is @code{combined}.
17444
17445 @item minamp
17446 Set minimum amplitude used in @code{log} amplitude scaler.
17447
17448 @end table
17449
17450 @anchor{showspectrum}
17451 @section showspectrum
17452
17453 Convert input audio to a video output, representing the audio frequency
17454 spectrum.
17455
17456 The filter accepts the following options:
17457
17458 @table @option
17459 @item size, s
17460 Specify the video size for the output. For the syntax of this option, check the
17461 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17462 Default value is @code{640x512}.
17463
17464 @item slide
17465 Specify how the spectrum should slide along the window.
17466
17467 It accepts the following values:
17468 @table @samp
17469 @item replace
17470 the samples start again on the left when they reach the right
17471 @item scroll
17472 the samples scroll from right to left
17473 @item fullframe
17474 frames are only produced when the samples reach the right
17475 @item rscroll
17476 the samples scroll from left to right
17477 @end table
17478
17479 Default value is @code{replace}.
17480
17481 @item mode
17482 Specify display mode.
17483
17484 It accepts the following values:
17485 @table @samp
17486 @item combined
17487 all channels are displayed in the same row
17488 @item separate
17489 all channels are displayed in separate rows
17490 @end table
17491
17492 Default value is @samp{combined}.
17493
17494 @item color
17495 Specify display color mode.
17496
17497 It accepts the following values:
17498 @table @samp
17499 @item channel
17500 each channel is displayed in a separate color
17501 @item intensity
17502 each channel is displayed using the same color scheme
17503 @item rainbow
17504 each channel is displayed using the rainbow color scheme
17505 @item moreland
17506 each channel is displayed using the moreland color scheme
17507 @item nebulae
17508 each channel is displayed using the nebulae color scheme
17509 @item fire
17510 each channel is displayed using the fire color scheme
17511 @item fiery
17512 each channel is displayed using the fiery color scheme
17513 @item fruit
17514 each channel is displayed using the fruit color scheme
17515 @item cool
17516 each channel is displayed using the cool color scheme
17517 @end table
17518
17519 Default value is @samp{channel}.
17520
17521 @item scale
17522 Specify scale used for calculating intensity color values.
17523
17524 It accepts the following values:
17525 @table @samp
17526 @item lin
17527 linear
17528 @item sqrt
17529 square root, default
17530 @item cbrt
17531 cubic root
17532 @item log
17533 logarithmic
17534 @item 4thrt
17535 4th root
17536 @item 5thrt
17537 5th root
17538 @end table
17539
17540 Default value is @samp{sqrt}.
17541
17542 @item saturation
17543 Set saturation modifier for displayed colors. Negative values provide
17544 alternative color scheme. @code{0} is no saturation at all.
17545 Saturation must be in [-10.0, 10.0] range.
17546 Default value is @code{1}.
17547
17548 @item win_func
17549 Set window function.
17550
17551 It accepts the following values:
17552 @table @samp
17553 @item rect
17554 @item bartlett
17555 @item hann
17556 @item hanning
17557 @item hamming
17558 @item blackman
17559 @item welch
17560 @item flattop
17561 @item bharris
17562 @item bnuttall
17563 @item bhann
17564 @item sine
17565 @item nuttall
17566 @item lanczos
17567 @item gauss
17568 @item tukey
17569 @item dolph
17570 @item cauchy
17571 @item parzen
17572 @item poisson
17573 @end table
17574
17575 Default value is @code{hann}.
17576
17577 @item orientation
17578 Set orientation of time vs frequency axis. Can be @code{vertical} or
17579 @code{horizontal}. Default is @code{vertical}.
17580
17581 @item overlap
17582 Set ratio of overlap window. Default value is @code{0}.
17583 When value is @code{1} overlap is set to recommended size for specific
17584 window function currently used.
17585
17586 @item gain
17587 Set scale gain for calculating intensity color values.
17588 Default value is @code{1}.
17589
17590 @item data
17591 Set which data to display. Can be @code{magnitude}, default or @code{phase}.
17592
17593 @item rotation
17594 Set color rotation, must be in [-1.0, 1.0] range.
17595 Default value is @code{0}.
17596 @end table
17597
17598 The usage is very similar to the showwaves filter; see the examples in that
17599 section.
17600
17601 @subsection Examples
17602
17603 @itemize
17604 @item
17605 Large window with logarithmic color scaling:
17606 @example
17607 showspectrum=s=1280x480:scale=log
17608 @end example
17609
17610 @item
17611 Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
17612 @example
17613 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
17614              [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
17615 @end example
17616 @end itemize
17617
17618 @section showspectrumpic
17619
17620 Convert input audio to a single video frame, representing the audio frequency
17621 spectrum.
17622
17623 The filter accepts the following options:
17624
17625 @table @option
17626 @item size, s
17627 Specify the video size for the output. For the syntax of this option, check the
17628 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17629 Default value is @code{4096x2048}.
17630
17631 @item mode
17632 Specify display mode.
17633
17634 It accepts the following values:
17635 @table @samp
17636 @item combined
17637 all channels are displayed in the same row
17638 @item separate
17639 all channels are displayed in separate rows
17640 @end table
17641 Default value is @samp{combined}.
17642
17643 @item color
17644 Specify display color mode.
17645
17646 It accepts the following values:
17647 @table @samp
17648 @item channel
17649 each channel is displayed in a separate color
17650 @item intensity
17651 each channel is displayed using the same color scheme
17652 @item rainbow
17653 each channel is displayed using the rainbow color scheme
17654 @item moreland
17655 each channel is displayed using the moreland color scheme
17656 @item nebulae
17657 each channel is displayed using the nebulae color scheme
17658 @item fire
17659 each channel is displayed using the fire color scheme
17660 @item fiery
17661 each channel is displayed using the fiery color scheme
17662 @item fruit
17663 each channel is displayed using the fruit color scheme
17664 @item cool
17665 each channel is displayed using the cool color scheme
17666 @end table
17667 Default value is @samp{intensity}.
17668
17669 @item scale
17670 Specify scale used for calculating intensity color values.
17671
17672 It accepts the following values:
17673 @table @samp
17674 @item lin
17675 linear
17676 @item sqrt
17677 square root, default
17678 @item cbrt
17679 cubic root
17680 @item log
17681 logarithmic
17682 @item 4thrt
17683 4th root
17684 @item 5thrt
17685 5th root
17686 @end table
17687 Default value is @samp{log}.
17688
17689 @item saturation
17690 Set saturation modifier for displayed colors. Negative values provide
17691 alternative color scheme. @code{0} is no saturation at all.
17692 Saturation must be in [-10.0, 10.0] range.
17693 Default value is @code{1}.
17694
17695 @item win_func
17696 Set window function.
17697
17698 It accepts the following values:
17699 @table @samp
17700 @item rect
17701 @item bartlett
17702 @item hann
17703 @item hanning
17704 @item hamming
17705 @item blackman
17706 @item welch
17707 @item flattop
17708 @item bharris
17709 @item bnuttall
17710 @item bhann
17711 @item sine
17712 @item nuttall
17713 @item lanczos
17714 @item gauss
17715 @item tukey
17716 @item dolph
17717 @item cauchy
17718 @item parzen
17719 @item poisson
17720 @end table
17721 Default value is @code{hann}.
17722
17723 @item orientation
17724 Set orientation of time vs frequency axis. Can be @code{vertical} or
17725 @code{horizontal}. Default is @code{vertical}.
17726
17727 @item gain
17728 Set scale gain for calculating intensity color values.
17729 Default value is @code{1}.
17730
17731 @item legend
17732 Draw time and frequency axes and legends. Default is enabled.
17733
17734 @item rotation
17735 Set color rotation, must be in [-1.0, 1.0] range.
17736 Default value is @code{0}.
17737 @end table
17738
17739 @subsection Examples
17740
17741 @itemize
17742 @item
17743 Extract an audio spectrogram of a whole audio track
17744 in a 1024x1024 picture using @command{ffmpeg}:
17745 @example
17746 ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
17747 @end example
17748 @end itemize
17749
17750 @section showvolume
17751
17752 Convert input audio volume to a video output.
17753
17754 The filter accepts the following options:
17755
17756 @table @option
17757 @item rate, r
17758 Set video rate.
17759
17760 @item b
17761 Set border width, allowed range is [0, 5]. Default is 1.
17762
17763 @item w
17764 Set channel width, allowed range is [80, 8192]. Default is 400.
17765
17766 @item h
17767 Set channel height, allowed range is [1, 900]. Default is 20.
17768
17769 @item f
17770 Set fade, allowed range is [0.001, 1]. Default is 0.95.
17771
17772 @item c
17773 Set volume color expression.
17774
17775 The expression can use the following variables:
17776
17777 @table @option
17778 @item VOLUME
17779 Current max volume of channel in dB.
17780
17781 @item PEAK
17782 Current peak.
17783
17784 @item CHANNEL
17785 Current channel number, starting from 0.
17786 @end table
17787
17788 @item t
17789 If set, displays channel names. Default is enabled.
17790
17791 @item v
17792 If set, displays volume values. Default is enabled.
17793
17794 @item o
17795 Set orientation, can be @code{horizontal} or @code{vertical},
17796 default is @code{horizontal}.
17797
17798 @item s
17799 Set step size, allowed range s [0, 5]. Default is 0, which means
17800 step is disabled.
17801 @end table
17802
17803 @section showwaves
17804
17805 Convert input audio to a video output, representing the samples waves.
17806
17807 The filter accepts the following options:
17808
17809 @table @option
17810 @item size, s
17811 Specify the video size for the output. For the syntax of this option, check the
17812 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17813 Default value is @code{600x240}.
17814
17815 @item mode
17816 Set display mode.
17817
17818 Available values are:
17819 @table @samp
17820 @item point
17821 Draw a point for each sample.
17822
17823 @item line
17824 Draw a vertical line for each sample.
17825
17826 @item p2p
17827 Draw a point for each sample and a line between them.
17828
17829 @item cline
17830 Draw a centered vertical line for each sample.
17831 @end table
17832
17833 Default value is @code{point}.
17834
17835 @item n
17836 Set the number of samples which are printed on the same column. A
17837 larger value will decrease the frame rate. Must be a positive
17838 integer. This option can be set only if the value for @var{rate}
17839 is not explicitly specified.
17840
17841 @item rate, r
17842 Set the (approximate) output frame rate. This is done by setting the
17843 option @var{n}. Default value is "25".
17844
17845 @item split_channels
17846 Set if channels should be drawn separately or overlap. Default value is 0.
17847
17848 @item colors
17849 Set colors separated by '|' which are going to be used for drawing of each channel.
17850
17851 @item scale
17852 Set amplitude scale.
17853
17854 Available values are:
17855 @table @samp
17856 @item lin
17857 Linear.
17858
17859 @item log
17860 Logarithmic.
17861
17862 @item sqrt
17863 Square root.
17864
17865 @item cbrt
17866 Cubic root.
17867 @end table
17868
17869 Default is linear.
17870 @end table
17871
17872 @subsection Examples
17873
17874 @itemize
17875 @item
17876 Output the input file audio and the corresponding video representation
17877 at the same time:
17878 @example
17879 amovie=a.mp3,asplit[out0],showwaves[out1]
17880 @end example
17881
17882 @item
17883 Create a synthetic signal and show it with showwaves, forcing a
17884 frame rate of 30 frames per second:
17885 @example
17886 aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
17887 @end example
17888 @end itemize
17889
17890 @section showwavespic
17891
17892 Convert input audio to a single video frame, representing the samples waves.
17893
17894 The filter accepts the following options:
17895
17896 @table @option
17897 @item size, s
17898 Specify the video size for the output. For the syntax of this option, check the
17899 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17900 Default value is @code{600x240}.
17901
17902 @item split_channels
17903 Set if channels should be drawn separately or overlap. Default value is 0.
17904
17905 @item colors
17906 Set colors separated by '|' which are going to be used for drawing of each channel.
17907
17908 @item scale
17909 Set amplitude scale.
17910
17911 Available values are:
17912 @table @samp
17913 @item lin
17914 Linear.
17915
17916 @item log
17917 Logarithmic.
17918
17919 @item sqrt
17920 Square root.
17921
17922 @item cbrt
17923 Cubic root.
17924 @end table
17925
17926 Default is linear.
17927 @end table
17928
17929 @subsection Examples
17930
17931 @itemize
17932 @item
17933 Extract a channel split representation of the wave form of a whole audio track
17934 in a 1024x800 picture using @command{ffmpeg}:
17935 @example
17936 ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
17937 @end example
17938 @end itemize
17939
17940 @section sidedata, asidedata
17941
17942 Delete frame side data, or select frames based on it.
17943
17944 This filter accepts the following options:
17945
17946 @table @option
17947 @item mode
17948 Set mode of operation of the filter.
17949
17950 Can be one of the following:
17951
17952 @table @samp
17953 @item select
17954 Select every frame with side data of @code{type}.
17955
17956 @item delete
17957 Delete side data of @code{type}. If @code{type} is not set, delete all side
17958 data in the frame.
17959
17960 @end table
17961
17962 @item type
17963 Set side data type used with all modes. Must be set for @code{select} mode. For
17964 the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
17965 in @file{libavutil/frame.h}. For example, to choose
17966 @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
17967
17968 @end table
17969
17970 @section spectrumsynth
17971
17972 Sythesize audio from 2 input video spectrums, first input stream represents
17973 magnitude across time and second represents phase across time.
17974 The filter will transform from frequency domain as displayed in videos back
17975 to time domain as presented in audio output.
17976
17977 This filter is primarily created for reversing processed @ref{showspectrum}
17978 filter outputs, but can synthesize sound from other spectrograms too.
17979 But in such case results are going to be poor if the phase data is not
17980 available, because in such cases phase data need to be recreated, usually
17981 its just recreated from random noise.
17982 For best results use gray only output (@code{channel} color mode in
17983 @ref{showspectrum} filter) and @code{log} scale for magnitude video and
17984 @code{lin} scale for phase video. To produce phase, for 2nd video, use
17985 @code{data} option. Inputs videos should generally use @code{fullframe}
17986 slide mode as that saves resources needed for decoding video.
17987
17988 The filter accepts the following options:
17989
17990 @table @option
17991 @item sample_rate
17992 Specify sample rate of output audio, the sample rate of audio from which
17993 spectrum was generated may differ.
17994
17995 @item channels
17996 Set number of channels represented in input video spectrums.
17997
17998 @item scale
17999 Set scale which was used when generating magnitude input spectrum.
18000 Can be @code{lin} or @code{log}. Default is @code{log}.
18001
18002 @item slide
18003 Set slide which was used when generating inputs spectrums.
18004 Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
18005 Default is @code{fullframe}.
18006
18007 @item win_func
18008 Set window function used for resynthesis.
18009
18010 @item overlap
18011 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
18012 which means optimal overlap for selected window function will be picked.
18013
18014 @item orientation
18015 Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
18016 Default is @code{vertical}.
18017 @end table
18018
18019 @subsection Examples
18020
18021 @itemize
18022 @item
18023 First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
18024 then resynthesize videos back to audio with spectrumsynth:
18025 @example
18026 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
18027 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
18028 ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
18029 @end example
18030 @end itemize
18031
18032 @section split, asplit
18033
18034 Split input into several identical outputs.
18035
18036 @code{asplit} works with audio input, @code{split} with video.
18037
18038 The filter accepts a single parameter which specifies the number of outputs. If
18039 unspecified, it defaults to 2.
18040
18041 @subsection Examples
18042
18043 @itemize
18044 @item
18045 Create two separate outputs from the same input:
18046 @example
18047 [in] split [out0][out1]
18048 @end example
18049
18050 @item
18051 To create 3 or more outputs, you need to specify the number of
18052 outputs, like in:
18053 @example
18054 [in] asplit=3 [out0][out1][out2]
18055 @end example
18056
18057 @item
18058 Create two separate outputs from the same input, one cropped and
18059 one padded:
18060 @example
18061 [in] split [splitout1][splitout2];
18062 [splitout1] crop=100:100:0:0    [cropout];
18063 [splitout2] pad=200:200:100:100 [padout];
18064 @end example
18065
18066 @item
18067 Create 5 copies of the input audio with @command{ffmpeg}:
18068 @example
18069 ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
18070 @end example
18071 @end itemize
18072
18073 @section zmq, azmq
18074
18075 Receive commands sent through a libzmq client, and forward them to
18076 filters in the filtergraph.
18077
18078 @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
18079 must be inserted between two video filters, @code{azmq} between two
18080 audio filters.
18081
18082 To enable these filters you need to install the libzmq library and
18083 headers and configure FFmpeg with @code{--enable-libzmq}.
18084
18085 For more information about libzmq see:
18086 @url{http://www.zeromq.org/}
18087
18088 The @code{zmq} and @code{azmq} filters work as a libzmq server, which
18089 receives messages sent through a network interface defined by the
18090 @option{bind_address} option.
18091
18092 The received message must be in the form:
18093 @example
18094 @var{TARGET} @var{COMMAND} [@var{ARG}]
18095 @end example
18096
18097 @var{TARGET} specifies the target of the command, usually the name of
18098 the filter class or a specific filter instance name.
18099
18100 @var{COMMAND} specifies the name of the command for the target filter.
18101
18102 @var{ARG} is optional and specifies the optional argument list for the
18103 given @var{COMMAND}.
18104
18105 Upon reception, the message is processed and the corresponding command
18106 is injected into the filtergraph. Depending on the result, the filter
18107 will send a reply to the client, adopting the format:
18108 @example
18109 @var{ERROR_CODE} @var{ERROR_REASON}
18110 @var{MESSAGE}
18111 @end example
18112
18113 @var{MESSAGE} is optional.
18114
18115 @subsection Examples
18116
18117 Look at @file{tools/zmqsend} for an example of a zmq client which can
18118 be used to send commands processed by these filters.
18119
18120 Consider the following filtergraph generated by @command{ffplay}
18121 @example
18122 ffplay -dumpgraph 1 -f lavfi "
18123 color=s=100x100:c=red  [l];
18124 color=s=100x100:c=blue [r];
18125 nullsrc=s=200x100, zmq [bg];
18126 [bg][l]   overlay      [bg+l];
18127 [bg+l][r] overlay=x=100 "
18128 @end example
18129
18130 To change the color of the left side of the video, the following
18131 command can be used:
18132 @example
18133 echo Parsed_color_0 c yellow | tools/zmqsend
18134 @end example
18135
18136 To change the right side:
18137 @example
18138 echo Parsed_color_1 c pink | tools/zmqsend
18139 @end example
18140
18141 @c man end MULTIMEDIA FILTERS
18142
18143 @chapter Multimedia Sources
18144 @c man begin MULTIMEDIA SOURCES
18145
18146 Below is a description of the currently available multimedia sources.
18147
18148 @section amovie
18149
18150 This is the same as @ref{movie} source, except it selects an audio
18151 stream by default.
18152
18153 @anchor{movie}
18154 @section movie
18155
18156 Read audio and/or video stream(s) from a movie container.
18157
18158 It accepts the following parameters:
18159
18160 @table @option
18161 @item filename
18162 The name of the resource to read (not necessarily a file; it can also be a
18163 device or a stream accessed through some protocol).
18164
18165 @item format_name, f
18166 Specifies the format assumed for the movie to read, and can be either
18167 the name of a container or an input device. If not specified, the
18168 format is guessed from @var{movie_name} or by probing.
18169
18170 @item seek_point, sp
18171 Specifies the seek point in seconds. The frames will be output
18172 starting from this seek point. The parameter is evaluated with
18173 @code{av_strtod}, so the numerical value may be suffixed by an IS
18174 postfix. The default value is "0".
18175
18176 @item streams, s
18177 Specifies the streams to read. Several streams can be specified,
18178 separated by "+". The source will then have as many outputs, in the
18179 same order. The syntax is explained in the ``Stream specifiers''
18180 section in the ffmpeg manual. Two special names, "dv" and "da" specify
18181 respectively the default (best suited) video and audio stream. Default
18182 is "dv", or "da" if the filter is called as "amovie".
18183
18184 @item stream_index, si
18185 Specifies the index of the video stream to read. If the value is -1,
18186 the most suitable video stream will be automatically selected. The default
18187 value is "-1". Deprecated. If the filter is called "amovie", it will select
18188 audio instead of video.
18189
18190 @item loop
18191 Specifies how many times to read the stream in sequence.
18192 If the value is 0, the stream will be looped infinitely.
18193 Default value is "1".
18194
18195 Note that when the movie is looped the source timestamps are not
18196 changed, so it will generate non monotonically increasing timestamps.
18197
18198 @item discontinuity
18199 Specifies the time difference between frames above which the point is
18200 considered a timestamp discontinuity which is removed by adjusting the later
18201 timestamps.
18202 @end table
18203
18204 It allows overlaying a second video on top of the main input of
18205 a filtergraph, as shown in this graph:
18206 @example
18207 input -----------> deltapts0 --> overlay --> output
18208                                     ^
18209                                     |
18210 movie --> scale--> deltapts1 -------+
18211 @end example
18212 @subsection Examples
18213
18214 @itemize
18215 @item
18216 Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
18217 on top of the input labelled "in":
18218 @example
18219 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
18220 [in] setpts=PTS-STARTPTS [main];
18221 [main][over] overlay=16:16 [out]
18222 @end example
18223
18224 @item
18225 Read from a video4linux2 device, and overlay it on top of the input
18226 labelled "in":
18227 @example
18228 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
18229 [in] setpts=PTS-STARTPTS [main];
18230 [main][over] overlay=16:16 [out]
18231 @end example
18232
18233 @item
18234 Read the first video stream and the audio stream with id 0x81 from
18235 dvd.vob; the video is connected to the pad named "video" and the audio is
18236 connected to the pad named "audio":
18237 @example
18238 movie=dvd.vob:s=v:0+#0x81 [video] [audio]
18239 @end example
18240 @end itemize
18241
18242 @subsection Commands
18243
18244 Both movie and amovie support the following commands:
18245 @table @option
18246 @item seek
18247 Perform seek using "av_seek_frame".
18248 The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
18249 @itemize
18250 @item
18251 @var{stream_index}: If stream_index is -1, a default
18252 stream is selected, and @var{timestamp} is automatically converted
18253 from AV_TIME_BASE units to the stream specific time_base.
18254 @item
18255 @var{timestamp}: Timestamp in AVStream.time_base units
18256 or, if no stream is specified, in AV_TIME_BASE units.
18257 @item
18258 @var{flags}: Flags which select direction and seeking mode.
18259 @end itemize
18260
18261 @item get_duration
18262 Get movie duration in AV_TIME_BASE units.
18263
18264 @end table
18265
18266 @c man end MULTIMEDIA SOURCES