1 @chapter Filtering Introduction
2 @c man begin FILTERING INTRODUCTION
4 Filtering in FFmpeg is enabled through the libavfilter library.
6 In libavfilter, a filter can have multiple inputs and multiple
8 To illustrate the sorts of things that are possible, we consider the
13 input --> split ---------------------> overlay --> output
16 +-----> crop --> vflip -------+
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:
25 ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
28 The result will be that the top half of the video is mirrored
29 onto the bottom half of the output video.
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]}.
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.
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
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
54 @c man end FILTERING INTRODUCTION
57 @c man begin GRAPH2DOT
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.
68 to see how to use @file{graph2dot}.
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
74 For example the sequence of commands:
76 echo @var{GRAPH_DESCRIPTION} | \
77 tools/graph2dot -o graph.tmp && \
78 dot -Tpng graph.tmp -o graph.png && \
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:
87 ffmpeg -i infile -vf scale=640:360 outfile
89 your @var{GRAPH_DESCRIPTION} string will need to be of the form:
91 nullsrc,scale=640:360,nullsink
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.
98 @chapter Filtergraph description
99 @c man begin FILTERGRAPH DESCRIPTION
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.
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.
111 A filter with no input pads is called a "source", and a filter with no
112 output pads is called a "sink".
114 @anchor{Filtergraph syntax}
115 @section Filtergraph syntax
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}.
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.
128 A filtergraph consists of a sequence of filterchains. A sequence of
129 filterchains is represented by a list of ";"-separated filterchain
132 A filter is represented by a string of the form:
133 [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
135 @var{filter_name} is the name of the filter class of which the
136 described filter is an instance of, and has to be the name of one of
137 the filter classes registered in the program optionally followed by "@@@var{id}".
138 The name of the filter class is optionally followed by a string
141 @var{arguments} is a string which contains the parameters used to
142 initialize the filter instance. It may have one of two forms:
146 A ':'-separated list of @var{key=value} pairs.
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}.
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.
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
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.
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.
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
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
190 nullsrc, split[L1], [L2]overlay, nullsink
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.
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.
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.
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.
212 Here is a BNF description of the filtergraph syntax:
214 @var{NAME} ::= sequence of alphanumeric characters and '_'
215 @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
216 @var{LINKLABEL} ::= "[" @var{NAME} "]"
217 @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
218 @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
219 @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
220 @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
221 @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
224 @anchor{filtergraph escaping}
225 @section Notes on filtergraph escaping
227 Filtergraph description composition entails several levels of
228 escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
229 section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
230 information about the employed escaping procedure.
232 A first level escaping affects the content of each filter option
233 value, which may contain the special character @code{:} used to
234 separate values, or one of the escaping characters @code{\'}.
236 A second level escaping affects the whole filter description, which
237 may contain the escaping characters @code{\'} or the special
238 characters @code{[],;} used by the filtergraph description.
240 Finally, when you specify a filtergraph on a shell commandline, you
241 need to perform a third level escaping for the shell special
242 characters contained within it.
244 For example, consider the following string to be embedded in
245 the @ref{drawtext} filter description @option{text} value:
247 this is a 'string': may contain one, or more, special characters
250 This string contains the @code{'} special escaping character, and the
251 @code{:} special character, so it needs to be escaped in this way:
253 text=this is a \'string\'\: may contain one, or more, special characters
256 A second level of escaping is required when embedding the filter
257 description in a filtergraph description, in order to escape all the
258 filtergraph special characters. Thus the example above becomes:
260 drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
262 (note that in addition to the @code{\'} escaping special characters,
263 also @code{,} needs to be escaped).
265 Finally an additional level of escaping is needed when writing the
266 filtergraph description in a shell command, which depends on the
267 escaping rules of the adopted shell. For example, assuming that
268 @code{\} is special and needs to be escaped with another @code{\}, the
269 previous string will finally result in:
271 -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
274 @chapter Timeline editing
276 Some filters support a generic @option{enable} option. For the filters
277 supporting timeline editing, this option can be set to an expression which is
278 evaluated before sending a frame to the filter. If the evaluation is non-zero,
279 the filter will be enabled, otherwise the frame will be sent unchanged to the
280 next filter in the filtergraph.
282 The expression accepts the following values:
285 timestamp expressed in seconds, NAN if the input timestamp is unknown
288 sequential number of the input frame, starting from 0
291 the position in the file of the input frame, NAN if unknown
295 width and height of the input frame if video
298 Additionally, these filters support an @option{enable} command that can be used
299 to re-define the expression.
301 Like any other filtering option, the @option{enable} option follows the same
304 For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
305 minutes, and a @ref{curves} filter starting at 3 seconds:
307 smartblur = enable='between(t,10,3*60)',
308 curves = enable='gte(t,3)' : preset=cross_process
311 See @code{ffmpeg -filters} to view which filters have timeline support.
313 @c man end FILTERGRAPH DESCRIPTION
316 @chapter Options for filters with several inputs (framesync)
317 @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
319 Some filters with several inputs support a common set of options.
320 These options can only be set by name, not with the short notation.
324 The action to take when EOF is encountered on the secondary input; it accepts
325 one of the following values:
329 Repeat the last frame (the default).
333 Pass the main input through.
337 If set to 1, force the output to terminate when the shortest input
338 terminates. Default value is 0.
341 If set to 1, force the filter to extend the last frame of secondary streams
342 until the end of the primary stream. A value of 0 disables this behavior.
346 @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
348 @chapter Audio Filters
349 @c man begin AUDIO FILTERS
351 When you configure your FFmpeg build, you can disable any of the
352 existing filters using @code{--disable-filters}.
353 The configure output will show the audio filters included in your
356 Below is a description of the currently available audio filters.
360 A compressor is mainly used to reduce the dynamic range of a signal.
361 Especially modern music is mostly compressed at a high ratio to
362 improve the overall loudness. It's done to get the highest attention
363 of a listener, "fatten" the sound and bring more "power" to the track.
364 If a signal is compressed too much it may sound dull or "dead"
365 afterwards or it may start to "pump" (which could be a powerful effect
366 but can also destroy a track completely).
367 The right compression is the key to reach a professional sound and is
368 the high art of mixing and mastering. Because of its complex settings
369 it may take a long time to get the right feeling for this kind of effect.
371 Compression is done by detecting the volume above a chosen level
372 @code{threshold} and dividing it by the factor set with @code{ratio}.
373 So if you set the threshold to -12dB and your signal reaches -6dB a ratio
374 of 2:1 will result in a signal at -9dB. Because an exact manipulation of
375 the signal would cause distortion of the waveform the reduction can be
376 levelled over the time. This is done by setting "Attack" and "Release".
377 @code{attack} determines how long the signal has to rise above the threshold
378 before any reduction will occur and @code{release} sets the time the signal
379 has to fall below the threshold to reduce the reduction again. Shorter signals
380 than the chosen attack time will be left untouched.
381 The overall reduction of the signal can be made up afterwards with the
382 @code{makeup} setting. So compressing the peaks of a signal about 6dB and
383 raising the makeup to this level results in a signal twice as loud than the
384 source. To gain a softer entry in the compression the @code{knee} flattens the
385 hard edge at the threshold in the range of the chosen decibels.
387 The filter accepts the following options:
391 Set input gain. Default is 1. Range is between 0.015625 and 64.
394 If a signal of stream rises above this level it will affect the gain
396 By default it is 0.125. Range is between 0.00097563 and 1.
399 Set a ratio by which the signal is reduced. 1:2 means that if the level
400 rose 4dB above the threshold, it will be only 2dB above after the reduction.
401 Default is 2. Range is between 1 and 20.
404 Amount of milliseconds the signal has to rise above the threshold before gain
405 reduction starts. Default is 20. Range is between 0.01 and 2000.
408 Amount of milliseconds the signal has to fall below the threshold before
409 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
412 Set the amount by how much signal will be amplified after processing.
413 Default is 1. Range is from 1 to 64.
416 Curve the sharp knee around the threshold to enter gain reduction more softly.
417 Default is 2.82843. Range is between 1 and 8.
420 Choose if the @code{average} level between all channels of input stream
421 or the louder(@code{maximum}) channel of input stream affects the
422 reduction. Default is @code{average}.
425 Should the exact signal be taken in case of @code{peak} or an RMS one in case
426 of @code{rms}. Default is @code{rms} which is mostly smoother.
429 How much to use compressed signal in output. Default is 1.
430 Range is between 0 and 1.
434 Simple audio dynamic range commpression/expansion filter.
436 The filter accepts the following options:
440 Set contrast. Default is 33. Allowed range is between 0 and 100.
445 Copy the input audio source unchanged to the output. This is mainly useful for
450 Apply cross fade from one input audio stream to another input audio stream.
451 The cross fade is applied for specified duration near the end of first stream.
453 The filter accepts the following options:
457 Specify the number of samples for which the cross fade effect has to last.
458 At the end of the cross fade effect the first input audio will be completely
459 silent. Default is 44100.
462 Specify the duration of the cross fade effect. See
463 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
464 for the accepted syntax.
465 By default the duration is determined by @var{nb_samples}.
466 If set this option is used instead of @var{nb_samples}.
469 Should first stream end overlap with second stream start. Default is enabled.
472 Set curve for cross fade transition for first stream.
475 Set curve for cross fade transition for second stream.
477 For description of available curve types see @ref{afade} filter description.
484 Cross fade from one input to another:
486 ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
490 Cross fade from one input to another but without overlapping:
492 ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
497 Split audio stream into several bands.
499 This filter splits audio stream into two or more frequency ranges.
500 Summing all streams back will give flat output.
502 The filter accepts the following options:
506 Set split frequencies. Those must be positive and increasing.
509 Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
510 Default is @var{4th}.
515 Reduce audio bit resolution.
517 This filter is bit crusher with enhanced functionality. A bit crusher
518 is used to audibly reduce number of bits an audio signal is sampled
519 with. This doesn't change the bit depth at all, it just produces the
520 effect. Material reduced in bit depth sounds more harsh and "digital".
521 This filter is able to even round to continuous values instead of discrete
523 Additionally it has a D/C offset which results in different crushing of
524 the lower and the upper half of the signal.
525 An Anti-Aliasing setting is able to produce "softer" crushing sounds.
527 Another feature of this filter is the logarithmic mode.
528 This setting switches from linear distances between bits to logarithmic ones.
529 The result is a much more "natural" sounding crusher which doesn't gate low
530 signals for example. The human ear has a logarithmic perception,
531 so this kind of crushing is much more pleasant.
532 Logarithmic crushing is also able to get anti-aliased.
534 The filter accepts the following options:
550 Can be linear: @code{lin} or logarithmic: @code{log}.
559 Set sample reduction.
562 Enable LFO. By default disabled.
573 Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
577 Remove impulsive noise from input audio.
579 Samples detected as impulsive noise are replaced by interpolated samples using
580 autoregressive modelling.
584 Set window size, in milliseconds. Allowed range is from @code{10} to
585 @code{100}. Default value is @code{55} milliseconds.
586 This sets size of window which will be processed at once.
589 Set window overlap, in percentage of window size. Allowed range is from
590 @code{50} to @code{95}. Default value is @code{75} percent.
591 Setting this to a very high value increases impulsive noise removal but makes
592 whole process much slower.
595 Set autoregression order, in percentage of window size. Allowed range is from
596 @code{0} to @code{25}. Default value is @code{2} percent. This option also
597 controls quality of interpolated samples using neighbour good samples.
600 Set threshold value. Allowed range is from @code{1} to @code{100}.
601 Default value is @code{2}.
602 This controls the strength of impulsive noise which is going to be removed.
603 The lower value, the more samples will be detected as impulsive noise.
606 Set burst fusion, in percentage of window size. Allowed range is @code{0} to
607 @code{10}. Default value is @code{2}.
608 If any two samples deteced as noise are spaced less than this value then any
609 sample inbetween those two samples will be also detected as noise.
614 It accepts the following values:
617 Select overlap-add method. Even not interpolated samples are slightly
618 changed with this method.
621 Select overlap-save method. Not interpolated samples remain unchanged.
624 Default value is @code{a}.
628 Remove clipped samples from input audio.
630 Samples detected as clipped are replaced by interpolated samples using
631 autoregressive modelling.
635 Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
636 Default value is @code{55} milliseconds.
637 This sets size of window which will be processed at once.
640 Set window overlap, in percentage of window size. Allowed range is from @code{50}
641 to @code{95}. Default value is @code{75} percent.
644 Set autoregression order, in percentage of window size. Allowed range is from
645 @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
646 quality of interpolated samples using neighbour good samples.
649 Set threshold value. Allowed range is from @code{1} to @code{100}.
650 Default value is @code{10}. Higher values make clip detection less aggressive.
653 Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
654 Default value is @code{1000}. Higher values make clip detection less aggressive.
659 It accepts the following values:
662 Select overlap-add method. Even not interpolated samples are slightly changed
666 Select overlap-save method. Not interpolated samples remain unchanged.
669 Default value is @code{a}.
674 Delay one or more audio channels.
676 Samples in delayed channel are filled with silence.
678 The filter accepts the following option:
682 Set list of delays in milliseconds for each channel separated by '|'.
683 Unused delays will be silently ignored. If number of given delays is
684 smaller than number of channels all remaining channels will not be delayed.
685 If you want to delay exact number of samples, append 'S' to number.
692 Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
693 the second channel (and any other channels that may be present) unchanged.
699 Delay second channel by 500 samples, the third channel by 700 samples and leave
700 the first channel (and any other channels that may be present) unchanged.
706 @section aderivative, aintegral
708 Compute derivative/integral of audio stream.
710 Applying both filters one after another produces original audio.
714 Apply echoing to the input audio.
716 Echoes are reflected sound and can occur naturally amongst mountains
717 (and sometimes large buildings) when talking or shouting; digital echo
718 effects emulate this behaviour and are often used to help fill out the
719 sound of a single instrument or vocal. The time difference between the
720 original signal and the reflection is the @code{delay}, and the
721 loudness of the reflected signal is the @code{decay}.
722 Multiple echoes can have different delays and decays.
724 A description of the accepted parameters follows.
728 Set input gain of reflected signal. Default is @code{0.6}.
731 Set output gain of reflected signal. Default is @code{0.3}.
734 Set list of time intervals in milliseconds between original signal and reflections
735 separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
736 Default is @code{1000}.
739 Set list of loudness of reflected signals separated by '|'.
740 Allowed range for each @code{decay} is @code{(0 - 1.0]}.
741 Default is @code{0.5}.
748 Make it sound as if there are twice as many instruments as are actually playing:
750 aecho=0.8:0.88:60:0.4
754 If delay is very short, then it sound like a (metallic) robot playing music:
760 A longer delay will sound like an open air concert in the mountains:
762 aecho=0.8:0.9:1000:0.3
766 Same as above but with one more mountain:
768 aecho=0.8:0.9:1000|1800:0.3|0.25
773 Audio emphasis filter creates or restores material directly taken from LPs or
774 emphased CDs with different filter curves. E.g. to store music on vinyl the
775 signal has to be altered by a filter first to even out the disadvantages of
776 this recording medium.
777 Once the material is played back the inverse filter has to be applied to
778 restore the distortion of the frequency response.
780 The filter accepts the following options:
790 Set filter mode. For restoring material use @code{reproduction} mode, otherwise
791 use @code{production} mode. Default is @code{reproduction} mode.
794 Set filter type. Selects medium. Can be one of the following:
806 select Compact Disc (CD).
812 select 50µs (FM-KF).
814 select 75µs (FM-KF).
820 Modify an audio signal according to the specified expressions.
822 This filter accepts one or more expressions (one for each channel),
823 which are evaluated and used to modify a corresponding audio signal.
825 It accepts the following parameters:
829 Set the '|'-separated expressions list for each separate channel. If
830 the number of input channels is greater than the number of
831 expressions, the last specified expression is used for the remaining
834 @item channel_layout, c
835 Set output channel layout. If not specified, the channel layout is
836 specified by the number of expressions. If set to @samp{same}, it will
837 use by default the same input channel layout.
840 Each expression in @var{exprs} can contain the following constants and functions:
844 channel number of the current expression
847 number of the evaluated sample, starting from 0
853 time of the evaluated sample expressed in seconds
856 @item nb_out_channels
857 input and output number of channels
860 the value of input channel with number @var{CH}
863 Note: this filter is slow. For faster processing you should use a
872 aeval=val(ch)/2:c=same
876 Invert phase of the second channel:
885 Apply fade-in/out effect to input audio.
887 A description of the accepted parameters follows.
891 Specify the effect type, can be either @code{in} for fade-in, or
892 @code{out} for a fade-out effect. Default is @code{in}.
894 @item start_sample, ss
895 Specify the number of the start sample for starting to apply the fade
896 effect. Default is 0.
899 Specify the number of samples for which the fade effect has to last. At
900 the end of the fade-in effect the output audio will have the same
901 volume as the input audio, at the end of the fade-out transition
902 the output audio will be silence. Default is 44100.
905 Specify the start time of the fade effect. Default is 0.
906 The value must be specified as a time duration; see
907 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
908 for the accepted syntax.
909 If set this option is used instead of @var{start_sample}.
912 Specify the duration of the fade effect. See
913 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
914 for the accepted syntax.
915 At the end of the fade-in effect the output audio will have the same
916 volume as the input audio, at the end of the fade-out transition
917 the output audio will be silence.
918 By default the duration is determined by @var{nb_samples}.
919 If set this option is used instead of @var{nb_samples}.
922 Set curve for fade transition.
924 It accepts the following values:
927 select triangular, linear slope (default)
929 select quarter of sine wave
931 select half of sine wave
933 select exponential sine wave
937 select inverted parabola
951 select inverted quarter of sine wave
953 select inverted half of sine wave
955 select double-exponential seat
957 select double-exponential sigmoid
965 Fade in first 15 seconds of audio:
971 Fade out last 25 seconds of a 900 seconds audio:
973 afade=t=out:st=875:d=25
978 Denoise audio samples with FFT.
980 A description of the accepted parameters follows.
984 Set the noise reduction in dB, allowed range is 0.01 to 97.
985 Default value is 12 dB.
988 Set the noise floor in dB, allowed range is -80 to -20.
989 Default value is -50 dB.
994 It accepts the following values:
1003 Select shellac noise.
1006 Select custom noise, defined in @code{bn} option.
1008 Default value is white noise.
1012 Set custom band noise for every one of 15 bands.
1013 Bands are separated by ' ' or '|'.
1016 Set the residual floor in dB, allowed range is -80 to -20.
1017 Default value is -38 dB.
1020 Enable noise tracking. By default is disabled.
1021 With this enabled, noise floor is automatically adjusted.
1024 Enable residual tracking. By default is disabled.
1027 Set the output mode.
1029 It accepts the following values:
1032 Pass input unchanged.
1035 Pass noise filtered out.
1040 Default value is @var{o}.
1044 @subsection Commands
1046 This filter supports the following commands:
1048 @item sample_noise, sn
1049 Start or stop measuring noise profile.
1050 Syntax for the command is : "start" or "stop" string.
1051 After measuring noise profile is stopped it will be
1052 automatically applied in filtering.
1054 @item noise_reduction, nr
1055 Change noise reduction. Argument is single float number.
1056 Syntax for the command is : "@var{noise_reduction}"
1058 @item noise_floor, nf
1059 Change noise floor. Argument is single float number.
1060 Syntax for the command is : "@var{noise_floor}"
1062 @item output_mode, om
1063 Change output mode operation.
1064 Syntax for the command is : "i", "o" or "n" string.
1068 Apply arbitrary expressions to samples in frequency domain.
1072 Set frequency domain real expression for each separate channel separated
1073 by '|'. Default is "1".
1074 If the number of input channels is greater than the number of
1075 expressions, the last specified expression is used for the remaining
1079 Set frequency domain imaginary expression for each separate channel
1080 separated by '|'. If not set, @var{real} option is used.
1082 Each expression in @var{real} and @var{imag} can contain the following
1090 current frequency bin number
1093 number of available bins
1096 channel number of the current expression
1108 It accepts the following values:
1124 Default is @code{w4096}
1127 Set window function. Default is @code{hann}.
1130 Set window overlap. If set to 1, the recommended overlap for selected
1131 window function will be picked. Default is @code{0.75}.
1134 @subsection Examples
1138 Leave almost only low frequencies in audio:
1140 afftfilt="1-clip((b/nb)*b,0,1)"
1147 Apply an arbitrary Frequency Impulse Response filter.
1149 This filter is designed for applying long FIR filters,
1150 up to 60 seconds long.
1152 It can be used as component for digital crossover filters,
1153 room equalization, cross talk cancellation, wavefield synthesis,
1154 auralization, ambiophonics and ambisonics.
1156 This filter uses second stream as FIR coefficients.
1157 If second stream holds single channel, it will be used
1158 for all input channels in first stream, otherwise
1159 number of channels in second stream must be same as
1160 number of channels in first stream.
1162 It accepts the following parameters:
1166 Set dry gain. This sets input gain.
1169 Set wet gain. This sets final output gain.
1172 Set Impulse Response filter length. Default is 1, which means whole IR is processed.
1175 Enable applying gain measured from power of IR. For approach to use for measuring power
1176 of IR see next option.
1179 Set which approach to use for auto gain measurement.
1183 select peak gain, very conservative approach. This is default value.
1186 select DC gain, limited application.
1189 select gain to noise approach, this is most popular one.
1193 Set gain to be applied to IR coefficients before filtering.
1194 Allowed range is 0 to 1. This can be set even with @var{again} used.
1197 Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
1198 Allowed range is 0.1 to 60 seconds.
1201 Show IR frequency reponse, magnitude and phase in additional video stream.
1202 By default it is disabled.
1205 Set for which IR channel to display frequency response. By default is first channel
1206 displayed. This option is used only when @var{response} is enabled.
1209 Set video stream size. This option is used only when @var{response} is enabled.
1212 @subsection Examples
1216 Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
1218 ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
1225 Set output format constraints for the input audio. The framework will
1226 negotiate the most appropriate format to minimize conversions.
1228 It accepts the following parameters:
1232 A '|'-separated list of requested sample formats.
1235 A '|'-separated list of requested sample rates.
1237 @item channel_layouts
1238 A '|'-separated list of requested channel layouts.
1240 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
1241 for the required syntax.
1244 If a parameter is omitted, all values are allowed.
1246 Force the output to either unsigned 8-bit or signed 16-bit stereo
1248 aformat=sample_fmts=u8|s16:channel_layouts=stereo
1253 A gate is mainly used to reduce lower parts of a signal. This kind of signal
1254 processing reduces disturbing noise between useful signals.
1256 Gating is done by detecting the volume below a chosen level @var{threshold}
1257 and dividing it by the factor set with @var{ratio}. The bottom of the noise
1258 floor is set via @var{range}. Because an exact manipulation of the signal
1259 would cause distortion of the waveform the reduction can be levelled over
1260 time. This is done by setting @var{attack} and @var{release}.
1262 @var{attack} determines how long the signal has to fall below the threshold
1263 before any reduction will occur and @var{release} sets the time the signal
1264 has to rise above the threshold to reduce the reduction again.
1265 Shorter signals than the chosen attack time will be left untouched.
1269 Set input level before filtering.
1270 Default is 1. Allowed range is from 0.015625 to 64.
1273 Set the level of gain reduction when the signal is below the threshold.
1274 Default is 0.06125. Allowed range is from 0 to 1.
1277 If a signal rises above this level the gain reduction is released.
1278 Default is 0.125. Allowed range is from 0 to 1.
1281 Set a ratio by which the signal is reduced.
1282 Default is 2. Allowed range is from 1 to 9000.
1285 Amount of milliseconds the signal has to rise above the threshold before gain
1287 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
1290 Amount of milliseconds the signal has to fall below the threshold before the
1291 reduction is increased again. Default is 250 milliseconds.
1292 Allowed range is from 0.01 to 9000.
1295 Set amount of amplification of signal after processing.
1296 Default is 1. Allowed range is from 1 to 64.
1299 Curve the sharp knee around the threshold to enter gain reduction more softly.
1300 Default is 2.828427125. Allowed range is from 1 to 8.
1303 Choose if exact signal should be taken for detection or an RMS like one.
1304 Default is @code{rms}. Can be @code{peak} or @code{rms}.
1307 Choose if the average level between all channels or the louder channel affects
1309 Default is @code{average}. Can be @code{average} or @code{maximum}.
1314 Apply an arbitrary Infinite Impulse Response filter.
1316 It accepts the following parameters:
1320 Set numerator/zeros coefficients.
1323 Set denominator/poles coefficients.
1335 Set coefficients format.
1341 Z-plane zeros/poles, cartesian (default)
1343 Z-plane zeros/poles, polar radians
1345 Z-plane zeros/poles, polar degrees
1349 Set kind of processing.
1350 Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
1353 Set filtering precision.
1357 double-precision floating-point (default)
1359 single-precision floating-point
1367 Show IR frequency reponse, magnitude and phase in additional video stream.
1368 By default it is disabled.
1371 Set for which IR channel to display frequency response. By default is first channel
1372 displayed. This option is used only when @var{response} is enabled.
1375 Set video stream size. This option is used only when @var{response} is enabled.
1378 Coefficients in @code{tf} format are separated by spaces and are in ascending
1381 Coefficients in @code{zp} format are separated by spaces and order of coefficients
1382 doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
1385 Different coefficients and gains can be provided for every channel, in such case
1386 use '|' to separate coefficients or gains. Last provided coefficients will be
1387 used for all remaining channels.
1389 @subsection Examples
1393 Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
1395 aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
1399 Same as above but in @code{zp} format:
1401 aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
1407 The limiter prevents an input signal from rising over a desired threshold.
1408 This limiter uses lookahead technology to prevent your signal from distorting.
1409 It means that there is a small delay after the signal is processed. Keep in mind
1410 that the delay it produces is the attack time you set.
1412 The filter accepts the following options:
1416 Set input gain. Default is 1.
1419 Set output gain. Default is 1.
1422 Don't let signals above this level pass the limiter. Default is 1.
1425 The limiter will reach its attenuation level in this amount of time in
1426 milliseconds. Default is 5 milliseconds.
1429 Come back from limiting to attenuation 1.0 in this amount of milliseconds.
1430 Default is 50 milliseconds.
1433 When gain reduction is always needed ASC takes care of releasing to an
1434 average reduction level rather than reaching a reduction of 0 in the release
1438 Select how much the release time is affected by ASC, 0 means nearly no changes
1439 in release time while 1 produces higher release times.
1442 Auto level output signal. Default is enabled.
1443 This normalizes audio back to 0dB if enabled.
1446 Depending on picked setting it is recommended to upsample input 2x or 4x times
1447 with @ref{aresample} before applying this filter.
1451 Apply a two-pole all-pass filter with central frequency (in Hz)
1452 @var{frequency}, and filter-width @var{width}.
1453 An all-pass filter changes the audio's frequency to phase relationship
1454 without changing its frequency to amplitude relationship.
1456 The filter accepts the following options:
1460 Set frequency in Hz.
1463 Set method to specify band-width of filter.
1478 Specify the band-width of a filter in width_type units.
1481 Specify which channels to filter, by default all available are filtered.
1484 @subsection Commands
1486 This filter supports the following commands:
1489 Change allpass frequency.
1490 Syntax for the command is : "@var{frequency}"
1493 Change allpass width_type.
1494 Syntax for the command is : "@var{width_type}"
1497 Change allpass width.
1498 Syntax for the command is : "@var{width}"
1505 The filter accepts the following options:
1509 Set the number of loops. Setting this value to -1 will result in infinite loops.
1513 Set maximal number of samples. Default is 0.
1516 Set first sample of loop. Default is 0.
1522 Merge two or more audio streams into a single multi-channel stream.
1524 The filter accepts the following options:
1529 Set the number of inputs. Default is 2.
1533 If the channel layouts of the inputs are disjoint, and therefore compatible,
1534 the channel layout of the output will be set accordingly and the channels
1535 will be reordered as necessary. If the channel layouts of the inputs are not
1536 disjoint, the output will have all the channels of the first input then all
1537 the channels of the second input, in that order, and the channel layout of
1538 the output will be the default value corresponding to the total number of
1541 For example, if the first input is in 2.1 (FL+FR+LF) and the second input
1542 is FC+BL+BR, then the output will be in 5.1, with the channels in the
1543 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
1544 first input, b1 is the first channel of the second input).
1546 On the other hand, if both input are in stereo, the output channels will be
1547 in the default order: a1, a2, b1, b2, and the channel layout will be
1548 arbitrarily set to 4.0, which may or may not be the expected value.
1550 All inputs must have the same sample rate, and format.
1552 If inputs do not have the same duration, the output will stop with the
1555 @subsection Examples
1559 Merge two mono files into a stereo stream:
1561 amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
1565 Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
1567 ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
1573 Mixes multiple audio inputs into a single output.
1575 Note that this filter only supports float samples (the @var{amerge}
1576 and @var{pan} audio filters support many formats). If the @var{amix}
1577 input has integer samples then @ref{aresample} will be automatically
1578 inserted to perform the conversion to float samples.
1582 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
1584 will mix 3 input audio streams to a single output with the same duration as the
1585 first input and a dropout transition time of 3 seconds.
1587 It accepts the following parameters:
1591 The number of inputs. If unspecified, it defaults to 2.
1594 How to determine the end-of-stream.
1598 The duration of the longest input. (default)
1601 The duration of the shortest input.
1604 The duration of the first input.
1608 @item dropout_transition
1609 The transition time, in seconds, for volume renormalization when an input
1610 stream ends. The default value is 2 seconds.
1613 Specify weight of each input audio stream as sequence.
1614 Each weight is separated by space. By default all inputs have same weight.
1619 Multiply first audio stream with second audio stream and store result
1620 in output audio stream. Multiplication is done by multiplying each
1621 sample from first stream with sample at same position from second stream.
1623 With this element-wise multiplication one can create amplitude fades and
1624 amplitude modulations.
1626 @section anequalizer
1628 High-order parametric multiband equalizer for each channel.
1630 It accepts the following parameters:
1634 This option string is in format:
1635 "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
1636 Each equalizer band is separated by '|'.
1640 Set channel number to which equalization will be applied.
1641 If input doesn't have that channel the entry is ignored.
1644 Set central frequency for band.
1645 If input doesn't have that frequency the entry is ignored.
1648 Set band width in hertz.
1651 Set band gain in dB.
1654 Set filter type for band, optional, can be:
1658 Butterworth, this is default.
1669 With this option activated frequency response of anequalizer is displayed
1673 Set video stream size. Only useful if curves option is activated.
1676 Set max gain that will be displayed. Only useful if curves option is activated.
1677 Setting this to a reasonable value makes it possible to display gain which is derived from
1678 neighbour bands which are too close to each other and thus produce higher gain
1679 when both are activated.
1682 Set frequency scale used to draw frequency response in video output.
1683 Can be linear or logarithmic. Default is logarithmic.
1686 Set color for each channel curve which is going to be displayed in video stream.
1687 This is list of color names separated by space or by '|'.
1688 Unrecognised or missing colors will be replaced by white color.
1691 @subsection Examples
1695 Lower gain by 10 of central frequency 200Hz and width 100 Hz
1696 for first 2 channels using Chebyshev type 1 filter:
1698 anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
1702 @subsection Commands
1704 This filter supports the following commands:
1707 Alter existing filter parameters.
1708 Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
1710 @var{fN} is existing filter number, starting from 0, if no such filter is available
1712 @var{freq} set new frequency parameter.
1713 @var{width} set new width parameter in herz.
1714 @var{gain} set new gain parameter in dB.
1716 Full filter invocation with asendcmd may look like this:
1717 asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
1722 Pass the audio source unchanged to the output.
1726 Pad the end of an audio stream with silence.
1728 This can be used together with @command{ffmpeg} @option{-shortest} to
1729 extend audio streams to the same length as the video stream.
1731 A description of the accepted options follows.
1735 Set silence packet size. Default value is 4096.
1738 Set the number of samples of silence to add to the end. After the
1739 value is reached, the stream is terminated. This option is mutually
1740 exclusive with @option{whole_len}.
1743 Set the minimum total number of samples in the output audio stream. If
1744 the value is longer than the input audio length, silence is added to
1745 the end, until the value is reached. This option is mutually exclusive
1746 with @option{pad_len}.
1749 If neither the @option{pad_len} nor the @option{whole_len} option is
1750 set, the filter will add silence to the end of the input stream
1753 @subsection Examples
1757 Add 1024 samples of silence to the end of the input:
1763 Make sure the audio output will contain at least 10000 samples, pad
1764 the input with silence if required:
1766 apad=whole_len=10000
1770 Use @command{ffmpeg} to pad the audio input with silence, so that the
1771 video stream will always result the shortest and will be converted
1772 until the end in the output file when using the @option{shortest}
1775 ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
1780 Add a phasing effect to the input audio.
1782 A phaser filter creates series of peaks and troughs in the frequency spectrum.
1783 The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
1785 A description of the accepted parameters follows.
1789 Set input gain. Default is 0.4.
1792 Set output gain. Default is 0.74
1795 Set delay in milliseconds. Default is 3.0.
1798 Set decay. Default is 0.4.
1801 Set modulation speed in Hz. Default is 0.5.
1804 Set modulation type. Default is triangular.
1806 It accepts the following values:
1815 Audio pulsator is something between an autopanner and a tremolo.
1816 But it can produce funny stereo effects as well. Pulsator changes the volume
1817 of the left and right channel based on a LFO (low frequency oscillator) with
1818 different waveforms and shifted phases.
1819 This filter have the ability to define an offset between left and right
1820 channel. An offset of 0 means that both LFO shapes match each other.
1821 The left and right channel are altered equally - a conventional tremolo.
1822 An offset of 50% means that the shape of the right channel is exactly shifted
1823 in phase (or moved backwards about half of the frequency) - pulsator acts as
1824 an autopanner. At 1 both curves match again. Every setting in between moves the
1825 phase shift gapless between all stages and produces some "bypassing" sounds with
1826 sine and triangle waveforms. The more you set the offset near 1 (starting from
1827 the 0.5) the faster the signal passes from the left to the right speaker.
1829 The filter accepts the following options:
1833 Set input gain. By default it is 1. Range is [0.015625 - 64].
1836 Set output gain. By default it is 1. Range is [0.015625 - 64].
1839 Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
1840 sawup or sawdown. Default is sine.
1843 Set modulation. Define how much of original signal is affected by the LFO.
1846 Set left channel offset. Default is 0. Allowed range is [0 - 1].
1849 Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
1852 Set pulse width. Default is 1. Allowed range is [0 - 2].
1855 Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
1858 Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
1862 Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
1866 Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
1867 if timing is set to hz.
1873 Resample the input audio to the specified parameters, using the
1874 libswresample library. If none are specified then the filter will
1875 automatically convert between its input and output.
1877 This filter is also able to stretch/squeeze the audio data to make it match
1878 the timestamps or to inject silence / cut out audio to make it match the
1879 timestamps, do a combination of both or do neither.
1881 The filter accepts the syntax
1882 [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
1883 expresses a sample rate and @var{resampler_options} is a list of
1884 @var{key}=@var{value} pairs, separated by ":". See the
1885 @ref{Resampler Options,,"Resampler Options" section in the
1886 ffmpeg-resampler(1) manual,ffmpeg-resampler}
1887 for the complete list of supported options.
1889 @subsection Examples
1893 Resample the input audio to 44100Hz:
1899 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
1900 samples per second compensation:
1902 aresample=async=1000
1908 Reverse an audio clip.
1910 Warning: This filter requires memory to buffer the entire clip, so trimming
1913 @subsection Examples
1917 Take the first 5 seconds of a clip, and reverse it.
1919 atrim=end=5,areverse
1923 @section asetnsamples
1925 Set the number of samples per each output audio frame.
1927 The last output packet may contain a different number of samples, as
1928 the filter will flush all the remaining samples when the input audio
1931 The filter accepts the following options:
1935 @item nb_out_samples, n
1936 Set the number of frames per each output audio frame. The number is
1937 intended as the number of samples @emph{per each channel}.
1938 Default value is 1024.
1941 If set to 1, the filter will pad the last audio frame with zeroes, so
1942 that the last frame will contain the same number of samples as the
1943 previous ones. Default value is 1.
1946 For example, to set the number of per-frame samples to 1234 and
1947 disable padding for the last frame, use:
1949 asetnsamples=n=1234:p=0
1954 Set the sample rate without altering the PCM data.
1955 This will result in a change of speed and pitch.
1957 The filter accepts the following options:
1960 @item sample_rate, r
1961 Set the output sample rate. Default is 44100 Hz.
1966 Show a line containing various information for each input audio frame.
1967 The input audio is not modified.
1969 The shown line contains a sequence of key/value pairs of the form
1970 @var{key}:@var{value}.
1972 The following values are shown in the output:
1976 The (sequential) number of the input frame, starting from 0.
1979 The presentation timestamp of the input frame, in time base units; the time base
1980 depends on the filter input pad, and is usually 1/@var{sample_rate}.
1983 The presentation timestamp of the input frame in seconds.
1986 position of the frame in the input stream, -1 if this information in
1987 unavailable and/or meaningless (for example in case of synthetic audio)
1996 The sample rate for the audio frame.
1999 The number of samples (per channel) in the frame.
2002 The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
2003 audio, the data is treated as if all the planes were concatenated.
2005 @item plane_checksums
2006 A list of Adler-32 checksums for each data plane.
2012 Display time domain statistical information about the audio channels.
2013 Statistics are calculated and displayed for each audio channel and,
2014 where applicable, an overall figure is also given.
2016 It accepts the following option:
2019 Short window length in seconds, used for peak and trough RMS measurement.
2020 Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
2024 Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
2025 where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
2028 Available keys for each channel are:
2064 For example full key look like this @code{lavfi.astats.1.DC_offset} or
2065 this @code{lavfi.astats.Overall.Peak_count}.
2067 For description what each key means read below.
2070 Set number of frame after which stats are going to be recalculated.
2071 Default is disabled.
2074 A description of each shown parameter follows:
2078 Mean amplitude displacement from zero.
2081 Minimal sample level.
2084 Maximal sample level.
2086 @item Min difference
2087 Minimal difference between two consecutive samples.
2089 @item Max difference
2090 Maximal difference between two consecutive samples.
2092 @item Mean difference
2093 Mean difference between two consecutive samples.
2094 The average of each difference between two consecutive samples.
2096 @item RMS difference
2097 Root Mean Square difference between two consecutive samples.
2101 Standard peak and RMS level measured in dBFS.
2105 Peak and trough values for RMS level measured over a short window.
2108 Standard ratio of peak to RMS level (note: not in dB).
2111 Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
2112 (i.e. either @var{Min level} or @var{Max level}).
2115 Number of occasions (not the number of samples) that the signal attained either
2116 @var{Min level} or @var{Max level}.
2119 Overall bit depth of audio. Number of bits used for each sample.
2122 Measured dynamic range of audio in dB.
2124 @item Zero crossings
2125 Number of points where the waveform crosses the zero level axis.
2127 @item Zero crossings rate
2128 Rate of Zero crossings and number of audio samples.
2135 The filter accepts exactly one parameter, the audio tempo. If not
2136 specified then the filter will assume nominal 1.0 tempo. Tempo must
2137 be in the [0.5, 100.0] range.
2139 Note that tempo greater than 2 will skip some samples rather than
2140 blend them in. If for any reason this is a concern it is always
2141 possible to daisy-chain several instances of atempo to achieve the
2142 desired product tempo.
2144 @subsection Examples
2148 Slow down audio to 80% tempo:
2154 To speed up audio to 300% tempo:
2160 To speed up audio to 300% tempo by daisy-chaining two atempo instances:
2162 atempo=sqrt(3),atempo=sqrt(3)
2168 Trim the input so that the output contains one continuous subpart of the input.
2170 It accepts the following parameters:
2173 Timestamp (in seconds) of the start of the section to keep. I.e. the audio
2174 sample with the timestamp @var{start} will be the first sample in the output.
2177 Specify time of the first audio sample that will be dropped, i.e. the
2178 audio sample immediately preceding the one with the timestamp @var{end} will be
2179 the last sample in the output.
2182 Same as @var{start}, except this option sets the start timestamp in samples
2186 Same as @var{end}, except this option sets the end timestamp in samples instead
2190 The maximum duration of the output in seconds.
2193 The number of the first sample that should be output.
2196 The number of the first sample that should be dropped.
2199 @option{start}, @option{end}, and @option{duration} are expressed as time
2200 duration specifications; see
2201 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
2203 Note that the first two sets of the start/end options and the @option{duration}
2204 option look at the frame timestamp, while the _sample options simply count the
2205 samples that pass through the filter. So start/end_pts and start/end_sample will
2206 give different results when the timestamps are wrong, inexact or do not start at
2207 zero. Also note that this filter does not modify the timestamps. If you wish
2208 to have the output timestamps start at zero, insert the asetpts filter after the
2211 If multiple start or end options are set, this filter tries to be greedy and
2212 keep all samples that match at least one of the specified constraints. To keep
2213 only the part that matches all the constraints at once, chain multiple atrim
2216 The defaults are such that all the input is kept. So it is possible to set e.g.
2217 just the end values to keep everything before the specified time.
2222 Drop everything except the second minute of input:
2224 ffmpeg -i INPUT -af atrim=60:120
2228 Keep only the first 1000 samples:
2230 ffmpeg -i INPUT -af atrim=end_sample=1000
2237 Apply a two-pole Butterworth band-pass filter with central
2238 frequency @var{frequency}, and (3dB-point) band-width width.
2239 The @var{csg} option selects a constant skirt gain (peak gain = Q)
2240 instead of the default: constant 0dB peak gain.
2241 The filter roll off at 6dB per octave (20dB per decade).
2243 The filter accepts the following options:
2247 Set the filter's central frequency. Default is @code{3000}.
2250 Constant skirt gain if set to 1. Defaults to 0.
2253 Set method to specify band-width of filter.
2268 Specify the band-width of a filter in width_type units.
2271 Specify which channels to filter, by default all available are filtered.
2274 @subsection Commands
2276 This filter supports the following commands:
2279 Change bandpass frequency.
2280 Syntax for the command is : "@var{frequency}"
2283 Change bandpass width_type.
2284 Syntax for the command is : "@var{width_type}"
2287 Change bandpass width.
2288 Syntax for the command is : "@var{width}"
2293 Apply a two-pole Butterworth band-reject filter with central
2294 frequency @var{frequency}, and (3dB-point) band-width @var{width}.
2295 The filter roll off at 6dB per octave (20dB per decade).
2297 The filter accepts the following options:
2301 Set the filter's central frequency. Default is @code{3000}.
2304 Set method to specify band-width of filter.
2319 Specify the band-width of a filter in width_type units.
2322 Specify which channels to filter, by default all available are filtered.
2325 @subsection Commands
2327 This filter supports the following commands:
2330 Change bandreject frequency.
2331 Syntax for the command is : "@var{frequency}"
2334 Change bandreject width_type.
2335 Syntax for the command is : "@var{width_type}"
2338 Change bandreject width.
2339 Syntax for the command is : "@var{width}"
2342 @section bass, lowshelf
2344 Boost or cut the bass (lower) frequencies of the audio using a two-pole
2345 shelving filter with a response similar to that of a standard
2346 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
2348 The filter accepts the following options:
2352 Give the gain at 0 Hz. Its useful range is about -20
2353 (for a large cut) to +20 (for a large boost).
2354 Beware of clipping when using a positive gain.
2357 Set the filter's central frequency and so can be used
2358 to extend or reduce the frequency range to be boosted or cut.
2359 The default value is @code{100} Hz.
2362 Set method to specify band-width of filter.
2377 Determine how steep is the filter's shelf transition.
2380 Specify which channels to filter, by default all available are filtered.
2383 @subsection Commands
2385 This filter supports the following commands:
2388 Change bass frequency.
2389 Syntax for the command is : "@var{frequency}"
2392 Change bass width_type.
2393 Syntax for the command is : "@var{width_type}"
2397 Syntax for the command is : "@var{width}"
2401 Syntax for the command is : "@var{gain}"
2406 Apply a biquad IIR filter with the given coefficients.
2407 Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
2408 are the numerator and denominator coefficients respectively.
2409 and @var{channels}, @var{c} specify which channels to filter, by default all
2410 available are filtered.
2412 @subsection Commands
2414 This filter supports the following commands:
2422 Change biquad parameter.
2423 Syntax for the command is : "@var{value}"
2427 Bauer stereo to binaural transformation, which improves headphone listening of
2428 stereo audio records.
2430 To enable compilation of this filter you need to configure FFmpeg with
2431 @code{--enable-libbs2b}.
2433 It accepts the following parameters:
2437 Pre-defined crossfeed level.
2441 Default level (fcut=700, feed=50).
2444 Chu Moy circuit (fcut=700, feed=60).
2447 Jan Meier circuit (fcut=650, feed=95).
2452 Cut frequency (in Hz).
2461 Remap input channels to new locations.
2463 It accepts the following parameters:
2466 Map channels from input to output. The argument is a '|'-separated list of
2467 mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
2468 @var{in_channel} form. @var{in_channel} can be either the name of the input
2469 channel (e.g. FL for front left) or its index in the input channel layout.
2470 @var{out_channel} is the name of the output channel or its index in the output
2471 channel layout. If @var{out_channel} is not given then it is implicitly an
2472 index, starting with zero and increasing by one for each mapping.
2474 @item channel_layout
2475 The channel layout of the output stream.
2478 If no mapping is present, the filter will implicitly map input channels to
2479 output channels, preserving indices.
2481 @subsection Examples
2485 For example, assuming a 5.1+downmix input MOV file,
2487 ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
2489 will create an output WAV file tagged as stereo from the downmix channels of
2493 To fix a 5.1 WAV improperly encoded in AAC's native channel order
2495 ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
2499 @section channelsplit
2501 Split each channel from an input audio stream into a separate output stream.
2503 It accepts the following parameters:
2505 @item channel_layout
2506 The channel layout of the input stream. The default is "stereo".
2508 A channel layout describing the channels to be extracted as separate output streams
2509 or "all" to extract each input channel as a separate stream. The default is "all".
2511 Choosing channels not present in channel layout in the input will result in an error.
2514 @subsection Examples
2518 For example, assuming a stereo input MP3 file,
2520 ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
2522 will create an output Matroska file with two audio streams, one containing only
2523 the left channel and the other the right channel.
2526 Split a 5.1 WAV file into per-channel files:
2528 ffmpeg -i in.wav -filter_complex
2529 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
2530 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
2531 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
2536 Extract only LFE from a 5.1 WAV file:
2538 ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
2539 -map '[LFE]' lfe.wav
2544 Add a chorus effect to the audio.
2546 Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
2548 Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
2549 constant, with chorus, it is varied using using sinusoidal or triangular modulation.
2550 The modulation depth defines the range the modulated delay is played before or after
2551 the delay. Hence the delayed sound will sound slower or faster, that is the delayed
2552 sound tuned around the original one, like in a chorus where some vocals are slightly
2555 It accepts the following parameters:
2558 Set input gain. Default is 0.4.
2561 Set output gain. Default is 0.4.
2564 Set delays. A typical delay is around 40ms to 60ms.
2576 @subsection Examples
2582 chorus=0.7:0.9:55:0.4:0.25:2
2588 chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
2592 Fuller sounding chorus with three delays:
2594 chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
2599 Compress or expand the audio's dynamic range.
2601 It accepts the following parameters:
2607 A list of times in seconds for each channel over which the instantaneous level
2608 of the input signal is averaged to determine its volume. @var{attacks} refers to
2609 increase of volume and @var{decays} refers to decrease of volume. For most
2610 situations, the attack time (response to the audio getting louder) should be
2611 shorter than the decay time, because the human ear is more sensitive to sudden
2612 loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
2613 a typical value for decay is 0.8 seconds.
2614 If specified number of attacks & decays is lower than number of channels, the last
2615 set attack/decay will be used for all remaining channels.
2618 A list of points for the transfer function, specified in dB relative to the
2619 maximum possible signal amplitude. Each key points list must be defined using
2620 the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
2621 @code{x0/y0 x1/y1 x2/y2 ....}
2623 The input values must be in strictly increasing order but the transfer function
2624 does not have to be monotonically rising. The point @code{0/0} is assumed but
2625 may be overridden (by @code{0/out-dBn}). Typical values for the transfer
2626 function are @code{-70/-70|-60/-20|1/0}.
2629 Set the curve radius in dB for all joints. It defaults to 0.01.
2632 Set the additional gain in dB to be applied at all points on the transfer
2633 function. This allows for easy adjustment of the overall gain.
2637 Set an initial volume, in dB, to be assumed for each channel when filtering
2638 starts. This permits the user to supply a nominal level initially, so that, for
2639 example, a very large gain is not applied to initial signal levels before the
2640 companding has begun to operate. A typical value for audio which is initially
2641 quiet is -90 dB. It defaults to 0.
2644 Set a delay, in seconds. The input audio is analyzed immediately, but audio is
2645 delayed before being fed to the volume adjuster. Specifying a delay
2646 approximately equal to the attack/decay times allows the filter to effectively
2647 operate in predictive rather than reactive mode. It defaults to 0.
2651 @subsection Examples
2655 Make music with both quiet and loud passages suitable for listening to in a
2658 compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
2661 Another example for audio with whisper and explosion parts:
2663 compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
2667 A noise gate for when the noise is at a lower level than the signal:
2669 compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
2673 Here is another noise gate, this time for when the noise is at a higher level
2674 than the signal (making it, in some ways, similar to squelch):
2676 compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
2680 2:1 compression starting at -6dB:
2682 compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
2686 2:1 compression starting at -9dB:
2688 compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
2692 2:1 compression starting at -12dB:
2694 compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
2698 2:1 compression starting at -18dB:
2700 compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
2704 3:1 compression starting at -15dB:
2706 compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
2712 compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
2718 compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
2722 Hard limiter at -6dB:
2724 compand=attacks=0:points=-80/-80|-6/-6|20/-6
2728 Hard limiter at -12dB:
2730 compand=attacks=0:points=-80/-80|-12/-12|20/-12
2734 Hard noise gate at -35 dB:
2736 compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
2742 compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
2746 @section compensationdelay
2748 Compensation Delay Line is a metric based delay to compensate differing
2749 positions of microphones or speakers.
2751 For example, you have recorded guitar with two microphones placed in
2752 different location. Because the front of sound wave has fixed speed in
2753 normal conditions, the phasing of microphones can vary and depends on
2754 their location and interposition. The best sound mix can be achieved when
2755 these microphones are in phase (synchronized). Note that distance of
2756 ~30 cm between microphones makes one microphone to capture signal in
2757 antiphase to another microphone. That makes the final mix sounding moody.
2758 This filter helps to solve phasing problems by adding different delays
2759 to each microphone track and make them synchronized.
2761 The best result can be reached when you take one track as base and
2762 synchronize other tracks one by one with it.
2763 Remember that synchronization/delay tolerance depends on sample rate, too.
2764 Higher sample rates will give more tolerance.
2766 It accepts the following parameters:
2770 Set millimeters distance. This is compensation distance for fine tuning.
2774 Set cm distance. This is compensation distance for tightening distance setup.
2778 Set meters distance. This is compensation distance for hard distance setup.
2782 Set dry amount. Amount of unprocessed (dry) signal.
2786 Set wet amount. Amount of processed (wet) signal.
2790 Set temperature degree in Celsius. This is the temperature of the environment.
2795 Apply headphone crossfeed filter.
2797 Crossfeed is the process of blending the left and right channels of stereo
2799 It is mainly used to reduce extreme stereo separation of low frequencies.
2801 The intent is to produce more speaker like sound to the listener.
2803 The filter accepts the following options:
2807 Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
2808 This sets gain of low shelf filter for side part of stereo image.
2809 Default is -6dB. Max allowed is -30db when strength is set to 1.
2812 Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
2813 This sets cut off frequency of low shelf filter. Default is cut off near
2814 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
2817 Set input gain. Default is 0.9.
2820 Set output gain. Default is 1.
2823 @section crystalizer
2824 Simple algorithm to expand audio dynamic range.
2826 The filter accepts the following options:
2830 Sets the intensity of effect (default: 2.0). Must be in range between 0.0
2831 (unchanged sound) to 10.0 (maximum effect).
2834 Enable clipping. By default is enabled.
2838 Apply a DC shift to the audio.
2840 This can be useful to remove a DC offset (caused perhaps by a hardware problem
2841 in the recording chain) from the audio. The effect of a DC offset is reduced
2842 headroom and hence volume. The @ref{astats} filter can be used to determine if
2843 a signal has a DC offset.
2847 Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
2851 Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
2852 used to prevent clipping.
2856 Measure audio dynamic range.
2858 DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
2859 is found in transition material. And anything less that 8 have very poor dynamics
2860 and is very compressed.
2862 The filter accepts the following options:
2866 Set window length in seconds used to split audio into segments of equal length.
2867 Default is 3 seconds.
2871 Dynamic Audio Normalizer.
2873 This filter applies a certain amount of gain to the input audio in order
2874 to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
2875 contrast to more "simple" normalization algorithms, the Dynamic Audio
2876 Normalizer *dynamically* re-adjusts the gain factor to the input audio.
2877 This allows for applying extra gain to the "quiet" sections of the audio
2878 while avoiding distortions or clipping the "loud" sections. In other words:
2879 The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
2880 sections, in the sense that the volume of each section is brought to the
2881 same target level. Note, however, that the Dynamic Audio Normalizer achieves
2882 this goal *without* applying "dynamic range compressing". It will retain 100%
2883 of the dynamic range *within* each section of the audio file.
2887 Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
2888 Default is 500 milliseconds.
2889 The Dynamic Audio Normalizer processes the input audio in small chunks,
2890 referred to as frames. This is required, because a peak magnitude has no
2891 meaning for just a single sample value. Instead, we need to determine the
2892 peak magnitude for a contiguous sequence of sample values. While a "standard"
2893 normalizer would simply use the peak magnitude of the complete file, the
2894 Dynamic Audio Normalizer determines the peak magnitude individually for each
2895 frame. The length of a frame is specified in milliseconds. By default, the
2896 Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
2897 been found to give good results with most files.
2898 Note that the exact frame length, in number of samples, will be determined
2899 automatically, based on the sampling rate of the individual input audio file.
2902 Set the Gaussian filter window size. In range from 3 to 301, must be odd
2903 number. Default is 31.
2904 Probably the most important parameter of the Dynamic Audio Normalizer is the
2905 @code{window size} of the Gaussian smoothing filter. The filter's window size
2906 is specified in frames, centered around the current frame. For the sake of
2907 simplicity, this must be an odd number. Consequently, the default value of 31
2908 takes into account the current frame, as well as the 15 preceding frames and
2909 the 15 subsequent frames. Using a larger window results in a stronger
2910 smoothing effect and thus in less gain variation, i.e. slower gain
2911 adaptation. Conversely, using a smaller window results in a weaker smoothing
2912 effect and thus in more gain variation, i.e. faster gain adaptation.
2913 In other words, the more you increase this value, the more the Dynamic Audio
2914 Normalizer will behave like a "traditional" normalization filter. On the
2915 contrary, the more you decrease this value, the more the Dynamic Audio
2916 Normalizer will behave like a dynamic range compressor.
2919 Set the target peak value. This specifies the highest permissible magnitude
2920 level for the normalized audio input. This filter will try to approach the
2921 target peak magnitude as closely as possible, but at the same time it also
2922 makes sure that the normalized signal will never exceed the peak magnitude.
2923 A frame's maximum local gain factor is imposed directly by the target peak
2924 magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
2925 It is not recommended to go above this value.
2928 Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
2929 The Dynamic Audio Normalizer determines the maximum possible (local) gain
2930 factor for each input frame, i.e. the maximum gain factor that does not
2931 result in clipping or distortion. The maximum gain factor is determined by
2932 the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
2933 additionally bounds the frame's maximum gain factor by a predetermined
2934 (global) maximum gain factor. This is done in order to avoid excessive gain
2935 factors in "silent" or almost silent frames. By default, the maximum gain
2936 factor is 10.0, For most inputs the default value should be sufficient and
2937 it usually is not recommended to increase this value. Though, for input
2938 with an extremely low overall volume level, it may be necessary to allow even
2939 higher gain factors. Note, however, that the Dynamic Audio Normalizer does
2940 not simply apply a "hard" threshold (i.e. cut off values above the threshold).
2941 Instead, a "sigmoid" threshold function will be applied. This way, the
2942 gain factors will smoothly approach the threshold value, but never exceed that
2946 Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
2947 By default, the Dynamic Audio Normalizer performs "peak" normalization.
2948 This means that the maximum local gain factor for each frame is defined
2949 (only) by the frame's highest magnitude sample. This way, the samples can
2950 be amplified as much as possible without exceeding the maximum signal
2951 level, i.e. without clipping. Optionally, however, the Dynamic Audio
2952 Normalizer can also take into account the frame's root mean square,
2953 abbreviated RMS. In electrical engineering, the RMS is commonly used to
2954 determine the power of a time-varying signal. It is therefore considered
2955 that the RMS is a better approximation of the "perceived loudness" than
2956 just looking at the signal's peak magnitude. Consequently, by adjusting all
2957 frames to a constant RMS value, a uniform "perceived loudness" can be
2958 established. If a target RMS value has been specified, a frame's local gain
2959 factor is defined as the factor that would result in exactly that RMS value.
2960 Note, however, that the maximum local gain factor is still restricted by the
2961 frame's highest magnitude sample, in order to prevent clipping.
2964 Enable channels coupling. By default is enabled.
2965 By default, the Dynamic Audio Normalizer will amplify all channels by the same
2966 amount. This means the same gain factor will be applied to all channels, i.e.
2967 the maximum possible gain factor is determined by the "loudest" channel.
2968 However, in some recordings, it may happen that the volume of the different
2969 channels is uneven, e.g. one channel may be "quieter" than the other one(s).
2970 In this case, this option can be used to disable the channel coupling. This way,
2971 the gain factor will be determined independently for each channel, depending
2972 only on the individual channel's highest magnitude sample. This allows for
2973 harmonizing the volume of the different channels.
2976 Enable DC bias correction. By default is disabled.
2977 An audio signal (in the time domain) is a sequence of sample values.
2978 In the Dynamic Audio Normalizer these sample values are represented in the
2979 -1.0 to 1.0 range, regardless of the original input format. Normally, the
2980 audio signal, or "waveform", should be centered around the zero point.
2981 That means if we calculate the mean value of all samples in a file, or in a
2982 single frame, then the result should be 0.0 or at least very close to that
2983 value. If, however, there is a significant deviation of the mean value from
2984 0.0, in either positive or negative direction, this is referred to as a
2985 DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
2986 Audio Normalizer provides optional DC bias correction.
2987 With DC bias correction enabled, the Dynamic Audio Normalizer will determine
2988 the mean value, or "DC correction" offset, of each input frame and subtract
2989 that value from all of the frame's sample values which ensures those samples
2990 are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
2991 boundaries, the DC correction offset values will be interpolated smoothly
2992 between neighbouring frames.
2995 Enable alternative boundary mode. By default is disabled.
2996 The Dynamic Audio Normalizer takes into account a certain neighbourhood
2997 around each frame. This includes the preceding frames as well as the
2998 subsequent frames. However, for the "boundary" frames, located at the very
2999 beginning and at the very end of the audio file, not all neighbouring
3000 frames are available. In particular, for the first few frames in the audio
3001 file, the preceding frames are not known. And, similarly, for the last few
3002 frames in the audio file, the subsequent frames are not known. Thus, the
3003 question arises which gain factors should be assumed for the missing frames
3004 in the "boundary" region. The Dynamic Audio Normalizer implements two modes
3005 to deal with this situation. The default boundary mode assumes a gain factor
3006 of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
3007 "fade out" at the beginning and at the end of the input, respectively.
3010 Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
3011 By default, the Dynamic Audio Normalizer does not apply "traditional"
3012 compression. This means that signal peaks will not be pruned and thus the
3013 full dynamic range will be retained within each local neighbourhood. However,
3014 in some cases it may be desirable to combine the Dynamic Audio Normalizer's
3015 normalization algorithm with a more "traditional" compression.
3016 For this purpose, the Dynamic Audio Normalizer provides an optional compression
3017 (thresholding) function. If (and only if) the compression feature is enabled,
3018 all input frames will be processed by a soft knee thresholding function prior
3019 to the actual normalization process. Put simply, the thresholding function is
3020 going to prune all samples whose magnitude exceeds a certain threshold value.
3021 However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
3022 value. Instead, the threshold value will be adjusted for each individual
3024 In general, smaller parameters result in stronger compression, and vice versa.
3025 Values below 3.0 are not recommended, because audible distortion may appear.
3030 Make audio easier to listen to on headphones.
3032 This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
3033 so that when listened to on headphones the stereo image is moved from
3034 inside your head (standard for headphones) to outside and in front of
3035 the listener (standard for speakers).
3041 Apply a two-pole peaking equalisation (EQ) filter. With this
3042 filter, the signal-level at and around a selected frequency can
3043 be increased or decreased, whilst (unlike bandpass and bandreject
3044 filters) that at all other frequencies is unchanged.
3046 In order to produce complex equalisation curves, this filter can
3047 be given several times, each with a different central frequency.
3049 The filter accepts the following options:
3053 Set the filter's central frequency in Hz.
3056 Set method to specify band-width of filter.
3071 Specify the band-width of a filter in width_type units.
3074 Set the required gain or attenuation in dB.
3075 Beware of clipping when using a positive gain.
3078 Specify which channels to filter, by default all available are filtered.
3081 @subsection Examples
3084 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
3086 equalizer=f=1000:t=h:width=200:g=-10
3090 Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
3092 equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
3096 @subsection Commands
3098 This filter supports the following commands:
3101 Change equalizer frequency.
3102 Syntax for the command is : "@var{frequency}"
3105 Change equalizer width_type.
3106 Syntax for the command is : "@var{width_type}"
3109 Change equalizer width.
3110 Syntax for the command is : "@var{width}"
3113 Change equalizer gain.
3114 Syntax for the command is : "@var{gain}"
3117 @section extrastereo
3119 Linearly increases the difference between left and right channels which
3120 adds some sort of "live" effect to playback.
3122 The filter accepts the following options:
3126 Sets the difference coefficient (default: 2.5). 0.0 means mono sound
3127 (average of both channels), with 1.0 sound will be unchanged, with
3128 -1.0 left and right channels will be swapped.
3131 Enable clipping. By default is enabled.
3134 @section firequalizer
3135 Apply FIR Equalization using arbitrary frequency response.
3137 The filter accepts the following option:
3141 Set gain curve equation (in dB). The expression can contain variables:
3144 the evaluated frequency
3148 channel number, set to 0 when multichannels evaluation is disabled
3150 channel id, see libavutil/channel_layout.h, set to the first channel id when
3151 multichannels evaluation is disabled
3155 channel_layout, see libavutil/channel_layout.h
3160 @item gain_interpolate(f)
3161 interpolate gain on frequency f based on gain_entry
3162 @item cubic_interpolate(f)
3163 same as gain_interpolate, but smoother
3165 This option is also available as command. Default is @code{gain_interpolate(f)}.
3168 Set gain entry for gain_interpolate function. The expression can
3172 store gain entry at frequency f with value g
3174 This option is also available as command.
3177 Set filter delay in seconds. Higher value means more accurate.
3178 Default is @code{0.01}.
3181 Set filter accuracy in Hz. Lower value means more accurate.
3182 Default is @code{5}.
3185 Set window function. Acceptable values are:
3188 rectangular window, useful when gain curve is already smooth
3190 hann window (default)
3196 3-terms continuous 1st derivative nuttall window
3198 minimum 3-terms discontinuous nuttall window
3200 4-terms continuous 1st derivative nuttall window
3202 minimum 4-terms discontinuous nuttall (blackman-nuttall) window
3204 blackman-harris window
3210 If enabled, use fixed number of audio samples. This improves speed when
3211 filtering with large delay. Default is disabled.
3214 Enable multichannels evaluation on gain. Default is disabled.
3217 Enable zero phase mode by subtracting timestamp to compensate delay.
3218 Default is disabled.
3221 Set scale used by gain. Acceptable values are:
3224 linear frequency, linear gain
3226 linear frequency, logarithmic (in dB) gain (default)
3228 logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
3230 logarithmic frequency, logarithmic gain
3234 Set file for dumping, suitable for gnuplot.
3237 Set scale for dumpfile. Acceptable values are same with scale option.
3241 Enable 2-channel convolution using complex FFT. This improves speed significantly.
3242 Default is disabled.
3245 Enable minimum phase impulse response. Default is disabled.
3248 @subsection Examples
3253 firequalizer=gain='if(lt(f,1000), 0, -INF)'
3256 lowpass at 1000 Hz with gain_entry:
3258 firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
3261 custom equalization:
3263 firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
3266 higher delay with zero phase to compensate delay:
3268 firequalizer=delay=0.1:fixed=on:zero_phase=on
3271 lowpass on left channel, highpass on right channel:
3273 firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
3274 :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
3279 Apply a flanging effect to the audio.
3281 The filter accepts the following options:
3285 Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
3288 Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
3291 Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
3295 Set percentage of delayed signal mixed with original. Range from 0 to 100.
3296 Default value is 71.
3299 Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
3302 Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
3303 Default value is @var{sinusoidal}.
3306 Set swept wave percentage-shift for multi channel. Range from 0 to 100.
3307 Default value is 25.
3310 Set delay-line interpolation, @var{linear} or @var{quadratic}.
3311 Default is @var{linear}.
3315 Apply Haas effect to audio.
3317 Note that this makes most sense to apply on mono signals.
3318 With this filter applied to mono signals it give some directionality and
3319 stretches its stereo image.
3321 The filter accepts the following options:
3325 Set input level. By default is @var{1}, or 0dB
3328 Set output level. By default is @var{1}, or 0dB.
3331 Set gain applied to side part of signal. By default is @var{1}.
3334 Set kind of middle source. Can be one of the following:
3344 Pick middle part signal of stereo image.
3347 Pick side part signal of stereo image.
3351 Change middle phase. By default is disabled.
3354 Set left channel delay. By default is @var{2.05} milliseconds.
3357 Set left channel balance. By default is @var{-1}.
3360 Set left channel gain. By default is @var{1}.
3363 Change left phase. By default is disabled.
3366 Set right channel delay. By defaults is @var{2.12} milliseconds.
3369 Set right channel balance. By default is @var{1}.
3372 Set right channel gain. By default is @var{1}.
3375 Change right phase. By default is enabled.
3380 Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
3381 embedded HDCD codes is expanded into a 20-bit PCM stream.
3383 The filter supports the Peak Extend and Low-level Gain Adjustment features
3384 of HDCD, and detects the Transient Filter flag.
3387 ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
3390 When using the filter with wav, note the default encoding for wav is 16-bit,
3391 so the resulting 20-bit stream will be truncated back to 16-bit. Use something
3392 like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
3394 ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
3395 ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
3398 The filter accepts the following options:
3401 @item disable_autoconvert
3402 Disable any automatic format conversion or resampling in the filter graph.
3404 @item process_stereo
3405 Process the stereo channels together. If target_gain does not match between
3406 channels, consider it invalid and use the last valid target_gain.
3409 Set the code detect timer period in ms.
3412 Always extend peaks above -3dBFS even if PE isn't signaled.
3415 Replace audio with a solid tone and adjust the amplitude to signal some
3416 specific aspect of the decoding process. The output file can be loaded in
3417 an audio editor alongside the original to aid analysis.
3419 @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
3426 Gain adjustment level at each sample
3428 Samples where peak extend occurs
3430 Samples where the code detect timer is active
3432 Samples where the target gain does not match between channels
3438 Apply head-related transfer functions (HRTFs) to create virtual
3439 loudspeakers around the user for binaural listening via headphones.
3440 The HRIRs are provided via additional streams, for each channel
3441 one stereo input stream is needed.
3443 The filter accepts the following options:
3447 Set mapping of input streams for convolution.
3448 The argument is a '|'-separated list of channel names in order as they
3449 are given as additional stream inputs for filter.
3450 This also specify number of input streams. Number of input streams
3451 must be not less than number of channels in first stream plus one.
3454 Set gain applied to audio. Value is in dB. Default is 0.
3457 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
3458 processing audio in time domain which is slow.
3459 @var{freq} is processing audio in frequency domain which is fast.
3460 Default is @var{freq}.
3463 Set custom gain for LFE channels. Value is in dB. Default is 0.
3466 Set size of frame in number of samples which will be processed at once.
3467 Default value is @var{1024}. Allowed range is from 1024 to 96000.
3470 Set format of hrir stream.
3471 Default value is @var{stereo}. Alternative value is @var{multich}.
3472 If value is set to @var{stereo}, number of additional streams should
3473 be greater or equal to number of input channels in first input stream.
3474 Also each additional stream should have stereo number of channels.
3475 If value is set to @var{multich}, number of additional streams should
3476 be exactly one. Also number of input channels of additional stream
3477 should be equal or greater than twice number of channels of first input
3481 @subsection Examples
3485 Full example using wav files as coefficients with amovie filters for 7.1 downmix,
3486 each amovie filter use stereo file with IR coefficients as input.
3487 The files give coefficients for each position of virtual loudspeaker:
3489 ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
3494 Full example using wav files as coefficients with amovie filters for 7.1 downmix,
3495 but now in @var{multich} @var{hrir} format.
3497 ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
3504 Apply a high-pass filter with 3dB point frequency.
3505 The filter can be either single-pole, or double-pole (the default).
3506 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
3508 The filter accepts the following options:
3512 Set frequency in Hz. Default is 3000.
3515 Set number of poles. Default is 2.
3518 Set method to specify band-width of filter.
3533 Specify the band-width of a filter in width_type units.
3534 Applies only to double-pole filter.
3535 The default is 0.707q and gives a Butterworth response.
3538 Specify which channels to filter, by default all available are filtered.
3541 @subsection Commands
3543 This filter supports the following commands:
3546 Change highpass frequency.
3547 Syntax for the command is : "@var{frequency}"
3550 Change highpass width_type.
3551 Syntax for the command is : "@var{width_type}"
3554 Change highpass width.
3555 Syntax for the command is : "@var{width}"
3560 Join multiple input streams into one multi-channel stream.
3562 It accepts the following parameters:
3566 The number of input streams. It defaults to 2.
3568 @item channel_layout
3569 The desired output channel layout. It defaults to stereo.
3572 Map channels from inputs to output. The argument is a '|'-separated list of
3573 mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
3574 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
3575 can be either the name of the input channel (e.g. FL for front left) or its
3576 index in the specified input stream. @var{out_channel} is the name of the output
3580 The filter will attempt to guess the mappings when they are not specified
3581 explicitly. It does so by first trying to find an unused matching input channel
3582 and if that fails it picks the first unused input channel.
3584 Join 3 inputs (with properly set channel layouts):
3586 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
3589 Build a 5.1 output from 6 single-channel streams:
3591 ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
3592 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
3598 Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
3600 To enable compilation of this filter you need to configure FFmpeg with
3601 @code{--enable-ladspa}.
3605 Specifies the name of LADSPA plugin library to load. If the environment
3606 variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
3607 each one of the directories specified by the colon separated list in
3608 @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
3609 this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
3610 @file{/usr/lib/ladspa/}.
3613 Specifies the plugin within the library. Some libraries contain only
3614 one plugin, but others contain many of them. If this is not set filter
3615 will list all available plugins within the specified library.
3618 Set the '|' separated list of controls which are zero or more floating point
3619 values that determine the behavior of the loaded plugin (for example delay,
3621 Controls need to be defined using the following syntax:
3622 c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
3623 @var{valuei} is the value set on the @var{i}-th control.
3624 Alternatively they can be also defined using the following syntax:
3625 @var{value0}|@var{value1}|@var{value2}|..., where
3626 @var{valuei} is the value set on the @var{i}-th control.
3627 If @option{controls} is set to @code{help}, all available controls and
3628 their valid ranges are printed.
3630 @item sample_rate, s
3631 Specify the sample rate, default to 44100. Only used if plugin have
3635 Set the number of samples per channel per each output frame, default
3636 is 1024. Only used if plugin have zero inputs.
3639 Set the minimum duration of the sourced audio. See
3640 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3641 for the accepted syntax.
3642 Note that the resulting duration may be greater than the specified duration,
3643 as the generated audio is always cut at the end of a complete frame.
3644 If not specified, or the expressed duration is negative, the audio is
3645 supposed to be generated forever.
3646 Only used if plugin have zero inputs.
3650 @subsection Examples
3654 List all available plugins within amp (LADSPA example plugin) library:
3660 List all available controls and their valid ranges for @code{vcf_notch}
3661 plugin from @code{VCF} library:
3663 ladspa=f=vcf:p=vcf_notch:c=help
3667 Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
3670 ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
3674 Add reverberation to the audio using TAP-plugins
3675 (Tom's Audio Processing plugins):
3677 ladspa=file=tap_reverb:tap_reverb
3681 Generate white noise, with 0.2 amplitude:
3683 ladspa=file=cmt:noise_source_white:c=c0=.2
3687 Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
3688 @code{C* Audio Plugin Suite} (CAPS) library:
3690 ladspa=file=caps:Click:c=c1=20'
3694 Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
3696 ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
3700 Increase volume by 20dB using fast lookahead limiter from Steve Harris
3701 @code{SWH Plugins} collection:
3703 ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
3707 Attenuate low frequencies using Multiband EQ from Steve Harris
3708 @code{SWH Plugins} collection:
3710 ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
3714 Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
3717 ladspa=caps:Narrower
3721 Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
3723 ladspa=caps:White:.2
3727 Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
3729 ladspa=caps:Fractal:c=c1=1
3733 Dynamic volume normalization using @code{VLevel} plugin:
3735 ladspa=vlevel-ladspa:vlevel_mono
3739 @subsection Commands
3741 This filter supports the following commands:
3744 Modify the @var{N}-th control value.
3746 If the specified value is not valid, it is ignored and prior one is kept.
3751 EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
3752 Support for both single pass (livestreams, files) and double pass (files) modes.
3753 This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
3754 the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
3755 Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
3757 The filter accepts the following options:
3761 Set integrated loudness target.
3762 Range is -70.0 - -5.0. Default value is -24.0.
3765 Set loudness range target.
3766 Range is 1.0 - 20.0. Default value is 7.0.
3769 Set maximum true peak.
3770 Range is -9.0 - +0.0. Default value is -2.0.
3772 @item measured_I, measured_i
3773 Measured IL of input file.
3774 Range is -99.0 - +0.0.
3776 @item measured_LRA, measured_lra
3777 Measured LRA of input file.
3778 Range is 0.0 - 99.0.
3780 @item measured_TP, measured_tp
3781 Measured true peak of input file.
3782 Range is -99.0 - +99.0.
3784 @item measured_thresh
3785 Measured threshold of input file.
3786 Range is -99.0 - +0.0.
3789 Set offset gain. Gain is applied before the true-peak limiter.
3790 Range is -99.0 - +99.0. Default is +0.0.
3793 Normalize linearly if possible.
3794 measured_I, measured_LRA, measured_TP, and measured_thresh must also
3795 to be specified in order to use this mode.
3796 Options are true or false. Default is true.
3799 Treat mono input files as "dual-mono". If a mono file is intended for playback
3800 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
3801 If set to @code{true}, this option will compensate for this effect.
3802 Multi-channel input files are not affected by this option.
3803 Options are true or false. Default is false.
3806 Set print format for stats. Options are summary, json, or none.
3807 Default value is none.
3812 Apply a low-pass filter with 3dB point frequency.
3813 The filter can be either single-pole or double-pole (the default).
3814 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
3816 The filter accepts the following options:
3820 Set frequency in Hz. Default is 500.
3823 Set number of poles. Default is 2.
3826 Set method to specify band-width of filter.
3841 Specify the band-width of a filter in width_type units.
3842 Applies only to double-pole filter.
3843 The default is 0.707q and gives a Butterworth response.
3846 Specify which channels to filter, by default all available are filtered.
3849 @subsection Examples
3852 Lowpass only LFE channel, it LFE is not present it does nothing:
3858 @subsection Commands
3860 This filter supports the following commands:
3863 Change lowpass frequency.
3864 Syntax for the command is : "@var{frequency}"
3867 Change lowpass width_type.
3868 Syntax for the command is : "@var{width_type}"
3871 Change lowpass width.
3872 Syntax for the command is : "@var{width}"
3877 Load a LV2 (LADSPA Version 2) plugin.
3879 To enable compilation of this filter you need to configure FFmpeg with
3880 @code{--enable-lv2}.
3884 Specifies the plugin URI. You may need to escape ':'.
3887 Set the '|' separated list of controls which are zero or more floating point
3888 values that determine the behavior of the loaded plugin (for example delay,
3890 If @option{controls} is set to @code{help}, all available controls and
3891 their valid ranges are printed.
3893 @item sample_rate, s
3894 Specify the sample rate, default to 44100. Only used if plugin have
3898 Set the number of samples per channel per each output frame, default
3899 is 1024. Only used if plugin have zero inputs.
3902 Set the minimum duration of the sourced audio. See
3903 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3904 for the accepted syntax.
3905 Note that the resulting duration may be greater than the specified duration,
3906 as the generated audio is always cut at the end of a complete frame.
3907 If not specified, or the expressed duration is negative, the audio is
3908 supposed to be generated forever.
3909 Only used if plugin have zero inputs.
3912 @subsection Examples
3916 Apply bass enhancer plugin from Calf:
3918 lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
3922 Apply vinyl plugin from Calf:
3924 lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
3928 Apply bit crusher plugin from ArtyFX:
3930 lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
3935 Multiband Compress or expand the audio's dynamic range.
3937 The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
3938 This is akin to the crossover of a loudspeaker, and results in flat frequency
3939 response when absent compander action.
3941 It accepts the following parameters:
3945 This option syntax is:
3946 attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
3947 For explanation of each item refer to compand filter documentation.
3953 Mix channels with specific gain levels. The filter accepts the output
3954 channel layout followed by a set of channels definitions.
3956 This filter is also designed to efficiently remap the channels of an audio
3959 The filter accepts parameters of the form:
3960 "@var{l}|@var{outdef}|@var{outdef}|..."
3964 output channel layout or number of channels
3967 output channel specification, of the form:
3968 "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
3971 output channel to define, either a channel name (FL, FR, etc.) or a channel
3972 number (c0, c1, etc.)
3975 multiplicative coefficient for the channel, 1 leaving the volume unchanged
3978 input channel to use, see out_name for details; it is not possible to mix
3979 named and numbered input channels
3982 If the `=' in a channel specification is replaced by `<', then the gains for
3983 that specification will be renormalized so that the total is 1, thus
3984 avoiding clipping noise.
3986 @subsection Mixing examples
3988 For example, if you want to down-mix from stereo to mono, but with a bigger
3989 factor for the left channel:
3991 pan=1c|c0=0.9*c0+0.1*c1
3994 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
3995 7-channels surround:
3997 pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
4000 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
4001 that should be preferred (see "-ac" option) unless you have very specific
4004 @subsection Remapping examples
4006 The channel remapping will be effective if, and only if:
4009 @item gain coefficients are zeroes or ones,
4010 @item only one input per channel output,
4013 If all these conditions are satisfied, the filter will notify the user ("Pure
4014 channel mapping detected"), and use an optimized and lossless method to do the
4017 For example, if you have a 5.1 source and want a stereo audio stream by
4018 dropping the extra channels:
4020 pan="stereo| c0=FL | c1=FR"
4023 Given the same source, you can also switch front left and front right channels
4024 and keep the input channel layout:
4026 pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
4029 If the input is a stereo audio stream, you can mute the front left channel (and
4030 still keep the stereo channel layout) with:
4035 Still with a stereo audio stream input, you can copy the right channel in both
4036 front left and right:
4038 pan="stereo| c0=FR | c1=FR"
4043 ReplayGain scanner filter. This filter takes an audio stream as an input and
4044 outputs it unchanged.
4045 At end of filtering it displays @code{track_gain} and @code{track_peak}.
4049 Convert the audio sample format, sample rate and channel layout. It is
4050 not meant to be used directly.
4053 Apply time-stretching and pitch-shifting with librubberband.
4055 To enable compilation of this filter, you need to configure FFmpeg with
4056 @code{--enable-librubberband}.
4058 The filter accepts the following options:
4062 Set tempo scale factor.
4065 Set pitch scale factor.
4068 Set transients detector.
4069 Possible values are:
4078 Possible values are:
4087 Possible values are:
4094 Set processing window size.
4095 Possible values are:
4104 Possible values are:
4111 Enable formant preservation when shift pitching.
4112 Possible values are:
4120 Possible values are:
4129 Possible values are:
4136 @section sidechaincompress
4138 This filter acts like normal compressor but has the ability to compress
4139 detected signal using second input signal.
4140 It needs two input streams and returns one output stream.
4141 First input stream will be processed depending on second stream signal.
4142 The filtered signal then can be filtered with other filters in later stages of
4143 processing. See @ref{pan} and @ref{amerge} filter.
4145 The filter accepts the following options:
4149 Set input gain. Default is 1. Range is between 0.015625 and 64.
4152 If a signal of second stream raises above this level it will affect the gain
4153 reduction of first stream.
4154 By default is 0.125. Range is between 0.00097563 and 1.
4157 Set a ratio about which the signal is reduced. 1:2 means that if the level
4158 raised 4dB above the threshold, it will be only 2dB above after the reduction.
4159 Default is 2. Range is between 1 and 20.
4162 Amount of milliseconds the signal has to rise above the threshold before gain
4163 reduction starts. Default is 20. Range is between 0.01 and 2000.
4166 Amount of milliseconds the signal has to fall below the threshold before
4167 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
4170 Set the amount by how much signal will be amplified after processing.
4171 Default is 1. Range is from 1 to 64.
4174 Curve the sharp knee around the threshold to enter gain reduction more softly.
4175 Default is 2.82843. Range is between 1 and 8.
4178 Choose if the @code{average} level between all channels of side-chain stream
4179 or the louder(@code{maximum}) channel of side-chain stream affects the
4180 reduction. Default is @code{average}.
4183 Should the exact signal be taken in case of @code{peak} or an RMS one in case
4184 of @code{rms}. Default is @code{rms} which is mainly smoother.
4187 Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
4190 How much to use compressed signal in output. Default is 1.
4191 Range is between 0 and 1.
4194 @subsection Examples
4198 Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
4199 depending on the signal of 2nd input and later compressed signal to be
4200 merged with 2nd input:
4202 ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
4206 @section sidechaingate
4208 A sidechain gate acts like a normal (wideband) gate but has the ability to
4209 filter the detected signal before sending it to the gain reduction stage.
4210 Normally a gate uses the full range signal to detect a level above the
4212 For example: If you cut all lower frequencies from your sidechain signal
4213 the gate will decrease the volume of your track only if not enough highs
4214 appear. With this technique you are able to reduce the resonation of a
4215 natural drum or remove "rumbling" of muted strokes from a heavily distorted
4217 It needs two input streams and returns one output stream.
4218 First input stream will be processed depending on second stream signal.
4220 The filter accepts the following options:
4224 Set input level before filtering.
4225 Default is 1. Allowed range is from 0.015625 to 64.
4228 Set the level of gain reduction when the signal is below the threshold.
4229 Default is 0.06125. Allowed range is from 0 to 1.
4232 If a signal rises above this level the gain reduction is released.
4233 Default is 0.125. Allowed range is from 0 to 1.
4236 Set a ratio about which the signal is reduced.
4237 Default is 2. Allowed range is from 1 to 9000.
4240 Amount of milliseconds the signal has to rise above the threshold before gain
4242 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
4245 Amount of milliseconds the signal has to fall below the threshold before the
4246 reduction is increased again. Default is 250 milliseconds.
4247 Allowed range is from 0.01 to 9000.
4250 Set amount of amplification of signal after processing.
4251 Default is 1. Allowed range is from 1 to 64.
4254 Curve the sharp knee around the threshold to enter gain reduction more softly.
4255 Default is 2.828427125. Allowed range is from 1 to 8.
4258 Choose if exact signal should be taken for detection or an RMS like one.
4259 Default is rms. Can be peak or rms.
4262 Choose if the average level between all channels or the louder channel affects
4264 Default is average. Can be average or maximum.
4267 Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
4270 @section silencedetect
4272 Detect silence in an audio stream.
4274 This filter logs a message when it detects that the input audio volume is less
4275 or equal to a noise tolerance value for a duration greater or equal to the
4276 minimum detected noise duration.
4278 The printed times and duration are expressed in seconds.
4280 The filter accepts the following options:
4284 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
4285 specified value) or amplitude ratio. Default is -60dB, or 0.001.
4288 Set silence duration until notification (default is 2 seconds).
4291 Process each channel separately, instead of combined. By default is disabled.
4294 @subsection Examples
4298 Detect 5 seconds of silence with -50dB noise tolerance:
4300 silencedetect=n=-50dB:d=5
4304 Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
4305 tolerance in @file{silence.mp3}:
4307 ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
4311 @section silenceremove
4313 Remove silence from the beginning, middle or end of the audio.
4315 The filter accepts the following options:
4319 This value is used to indicate if audio should be trimmed at beginning of
4320 the audio. A value of zero indicates no silence should be trimmed from the
4321 beginning. When specifying a non-zero value, it trims audio up until it
4322 finds non-silence. Normally, when trimming silence from beginning of audio
4323 the @var{start_periods} will be @code{1} but it can be increased to higher
4324 values to trim all audio up to specific count of non-silence periods.
4325 Default value is @code{0}.
4327 @item start_duration
4328 Specify the amount of time that non-silence must be detected before it stops
4329 trimming audio. By increasing the duration, bursts of noises can be treated
4330 as silence and trimmed off. Default value is @code{0}.
4332 @item start_threshold
4333 This indicates what sample value should be treated as silence. For digital
4334 audio, a value of @code{0} may be fine but for audio recorded from analog,
4335 you may wish to increase the value to account for background noise.
4336 Can be specified in dB (in case "dB" is appended to the specified value)
4337 or amplitude ratio. Default value is @code{0}.
4340 Set the count for trimming silence from the end of audio.
4341 To remove silence from the middle of a file, specify a @var{stop_periods}
4342 that is negative. This value is then treated as a positive value and is
4343 used to indicate the effect should restart processing as specified by
4344 @var{start_periods}, making it suitable for removing periods of silence
4345 in the middle of the audio.
4346 Default value is @code{0}.
4349 Specify a duration of silence that must exist before audio is not copied any
4350 more. By specifying a higher duration, silence that is wanted can be left in
4352 Default value is @code{0}.
4354 @item stop_threshold
4355 This is the same as @option{start_threshold} but for trimming silence from
4357 Can be specified in dB (in case "dB" is appended to the specified value)
4358 or amplitude ratio. Default value is @code{0}.
4361 This indicates that @var{stop_duration} length of audio should be left intact
4362 at the beginning of each period of silence.
4363 For example, if you want to remove long pauses between words but do not want
4364 to remove the pauses completely. Default value is @code{0}.
4367 Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
4368 and works better with digital silence which is exactly 0.
4369 Default value is @code{rms}.
4372 Set ratio used to calculate size of window for detecting silence.
4373 Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
4376 @subsection Examples
4380 The following example shows how this filter can be used to start a recording
4381 that does not contain the delay at the start which usually occurs between
4382 pressing the record button and the start of the performance:
4384 silenceremove=1:5:0.02
4388 Trim all silence encountered from beginning to end where there is more than 1
4389 second of silence in audio:
4391 silenceremove=0:0:0:-1:1:-90dB
4397 SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
4398 loudspeakers around the user for binaural listening via headphones (audio
4399 formats up to 9 channels supported).
4400 The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
4401 SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
4402 Austrian Academy of Sciences.
4404 To enable compilation of this filter you need to configure FFmpeg with
4405 @code{--enable-libmysofa}.
4407 The filter accepts the following options:
4411 Set the SOFA file used for rendering.
4414 Set gain applied to audio. Value is in dB. Default is 0.
4417 Set rotation of virtual loudspeakers in deg. Default is 0.
4420 Set elevation of virtual speakers in deg. Default is 0.
4423 Set distance in meters between loudspeakers and the listener with near-field
4424 HRTFs. Default is 1.
4427 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
4428 processing audio in time domain which is slow.
4429 @var{freq} is processing audio in frequency domain which is fast.
4430 Default is @var{freq}.
4433 Set custom positions of virtual loudspeakers. Syntax for this option is:
4434 <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
4435 Each virtual loudspeaker is described with short channel name following with
4436 azimuth and elevation in degrees.
4437 Each virtual loudspeaker description is separated by '|'.
4438 For example to override front left and front right channel positions use:
4439 'speakers=FL 45 15|FR 345 15'.
4440 Descriptions with unrecognised channel names are ignored.
4443 Set custom gain for LFE channels. Value is in dB. Default is 0.
4446 @subsection Examples
4450 Using ClubFritz6 sofa file:
4452 sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
4456 Using ClubFritz12 sofa file and bigger radius with small rotation:
4458 sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
4462 Similar as above but with custom speaker positions for front left, front right, back left and back right
4463 and also with custom gain:
4465 "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
4469 @section stereotools
4471 This filter has some handy utilities to manage stereo signals, for converting
4472 M/S stereo recordings to L/R signal while having control over the parameters
4473 or spreading the stereo image of master track.
4475 The filter accepts the following options:
4479 Set input level before filtering for both channels. Defaults is 1.
4480 Allowed range is from 0.015625 to 64.
4483 Set output level after filtering for both channels. Defaults is 1.
4484 Allowed range is from 0.015625 to 64.
4487 Set input balance between both channels. Default is 0.
4488 Allowed range is from -1 to 1.
4491 Set output balance between both channels. Default is 0.
4492 Allowed range is from -1 to 1.
4495 Enable softclipping. Results in analog distortion instead of harsh digital 0dB
4496 clipping. Disabled by default.
4499 Mute the left channel. Disabled by default.
4502 Mute the right channel. Disabled by default.
4505 Change the phase of the left channel. Disabled by default.
4508 Change the phase of the right channel. Disabled by default.
4511 Set stereo mode. Available values are:
4515 Left/Right to Left/Right, this is default.
4518 Left/Right to Mid/Side.
4521 Mid/Side to Left/Right.
4524 Left/Right to Left/Left.
4527 Left/Right to Right/Right.
4530 Left/Right to Left + Right.
4533 Left/Right to Right/Left.
4536 Mid/Side to Left/Left.
4539 Mid/Side to Right/Right.
4543 Set level of side signal. Default is 1.
4544 Allowed range is from 0.015625 to 64.
4547 Set balance of side signal. Default is 0.
4548 Allowed range is from -1 to 1.
4551 Set level of the middle signal. Default is 1.
4552 Allowed range is from 0.015625 to 64.
4555 Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
4558 Set stereo base between mono and inversed channels. Default is 0.
4559 Allowed range is from -1 to 1.
4562 Set delay in milliseconds how much to delay left from right channel and
4563 vice versa. Default is 0. Allowed range is from -20 to 20.
4566 Set S/C level. Default is 1. Allowed range is from 1 to 100.
4569 Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
4571 @item bmode_in, bmode_out
4572 Set balance mode for balance_in/balance_out option.
4574 Can be one of the following:
4578 Classic balance mode. Attenuate one channel at time.
4579 Gain is raised up to 1.
4582 Similar as classic mode above but gain is raised up to 2.
4585 Equal power distribution, from -6dB to +6dB range.
4589 @subsection Examples
4593 Apply karaoke like effect:
4595 stereotools=mlev=0.015625
4599 Convert M/S signal to L/R:
4601 "stereotools=mode=ms>lr"
4605 @section stereowiden
4607 This filter enhance the stereo effect by suppressing signal common to both
4608 channels and by delaying the signal of left into right and vice versa,
4609 thereby widening the stereo effect.
4611 The filter accepts the following options:
4615 Time in milliseconds of the delay of left signal into right and vice versa.
4616 Default is 20 milliseconds.
4619 Amount of gain in delayed signal into right and vice versa. Gives a delay
4620 effect of left signal in right output and vice versa which gives widening
4621 effect. Default is 0.3.
4624 Cross feed of left into right with inverted phase. This helps in suppressing
4625 the mono. If the value is 1 it will cancel all the signal common to both
4626 channels. Default is 0.3.
4629 Set level of input signal of original channel. Default is 0.8.
4632 @section superequalizer
4633 Apply 18 band equalizer.
4635 The filter accepts the following options:
4642 Set 131Hz band gain.
4644 Set 185Hz band gain.
4646 Set 262Hz band gain.
4648 Set 370Hz band gain.
4650 Set 523Hz band gain.
4652 Set 740Hz band gain.
4654 Set 1047Hz band gain.
4656 Set 1480Hz band gain.
4658 Set 2093Hz band gain.
4660 Set 2960Hz band gain.
4662 Set 4186Hz band gain.
4664 Set 5920Hz band gain.
4666 Set 8372Hz band gain.
4668 Set 11840Hz band gain.
4670 Set 16744Hz band gain.
4672 Set 20000Hz band gain.
4676 Apply audio surround upmix filter.
4678 This filter allows to produce multichannel output from audio stream.
4680 The filter accepts the following options:
4684 Set output channel layout. By default, this is @var{5.1}.
4686 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4687 for the required syntax.
4690 Set input channel layout. By default, this is @var{stereo}.
4692 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4693 for the required syntax.
4696 Set input volume level. By default, this is @var{1}.
4699 Set output volume level. By default, this is @var{1}.
4702 Enable LFE channel output if output channel layout has it. By default, this is enabled.
4705 Set LFE low cut off frequency. By default, this is @var{128} Hz.
4708 Set LFE high cut off frequency. By default, this is @var{256} Hz.
4711 Set front center input volume. By default, this is @var{1}.
4714 Set front center output volume. By default, this is @var{1}.
4717 Set LFE input volume. By default, this is @var{1}.
4720 Set LFE output volume. By default, this is @var{1}.
4723 @section treble, highshelf
4725 Boost or cut treble (upper) frequencies of the audio using a two-pole
4726 shelving filter with a response similar to that of a standard
4727 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
4729 The filter accepts the following options:
4733 Give the gain at whichever is the lower of ~22 kHz and the
4734 Nyquist frequency. Its useful range is about -20 (for a large cut)
4735 to +20 (for a large boost). Beware of clipping when using a positive gain.
4738 Set the filter's central frequency and so can be used
4739 to extend or reduce the frequency range to be boosted or cut.
4740 The default value is @code{3000} Hz.
4743 Set method to specify band-width of filter.
4758 Determine how steep is the filter's shelf transition.
4761 Specify which channels to filter, by default all available are filtered.
4764 @subsection Commands
4766 This filter supports the following commands:
4769 Change treble frequency.
4770 Syntax for the command is : "@var{frequency}"
4773 Change treble width_type.
4774 Syntax for the command is : "@var{width_type}"
4777 Change treble width.
4778 Syntax for the command is : "@var{width}"
4782 Syntax for the command is : "@var{gain}"
4787 Sinusoidal amplitude modulation.
4789 The filter accepts the following options:
4793 Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
4794 (20 Hz or lower) will result in a tremolo effect.
4795 This filter may also be used as a ring modulator by specifying
4796 a modulation frequency higher than 20 Hz.
4797 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
4800 Depth of modulation as a percentage. Range is 0.0 - 1.0.
4801 Default value is 0.5.
4806 Sinusoidal phase modulation.
4808 The filter accepts the following options:
4812 Modulation frequency in Hertz.
4813 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
4816 Depth of modulation as a percentage. Range is 0.0 - 1.0.
4817 Default value is 0.5.
4822 Adjust the input audio volume.
4824 It accepts the following parameters:
4828 Set audio volume expression.
4830 Output values are clipped to the maximum value.
4832 The output audio volume is given by the relation:
4834 @var{output_volume} = @var{volume} * @var{input_volume}
4837 The default value for @var{volume} is "1.0".
4840 This parameter represents the mathematical precision.
4842 It determines which input sample formats will be allowed, which affects the
4843 precision of the volume scaling.
4847 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
4849 32-bit floating-point; this limits input sample format to FLT. (default)
4851 64-bit floating-point; this limits input sample format to DBL.
4855 Choose the behaviour on encountering ReplayGain side data in input frames.
4859 Remove ReplayGain side data, ignoring its contents (the default).
4862 Ignore ReplayGain side data, but leave it in the frame.
4865 Prefer the track gain, if present.
4868 Prefer the album gain, if present.
4871 @item replaygain_preamp
4872 Pre-amplification gain in dB to apply to the selected replaygain gain.
4874 Default value for @var{replaygain_preamp} is 0.0.
4877 Set when the volume expression is evaluated.
4879 It accepts the following values:
4882 only evaluate expression once during the filter initialization, or
4883 when the @samp{volume} command is sent
4886 evaluate expression for each incoming frame
4889 Default value is @samp{once}.
4892 The volume expression can contain the following parameters.
4896 frame number (starting at zero)
4899 @item nb_consumed_samples
4900 number of samples consumed by the filter
4902 number of samples in the current frame
4904 original frame position in the file
4910 PTS at start of stream
4912 time at start of stream
4918 last set volume value
4921 Note that when @option{eval} is set to @samp{once} only the
4922 @var{sample_rate} and @var{tb} variables are available, all other
4923 variables will evaluate to NAN.
4925 @subsection Commands
4927 This filter supports the following commands:
4930 Modify the volume expression.
4931 The command accepts the same syntax of the corresponding option.
4933 If the specified expression is not valid, it is kept at its current
4935 @item replaygain_noclip
4936 Prevent clipping by limiting the gain applied.
4938 Default value for @var{replaygain_noclip} is 1.
4942 @subsection Examples
4946 Halve the input audio volume:
4950 volume=volume=-6.0206dB
4953 In all the above example the named key for @option{volume} can be
4954 omitted, for example like in:
4960 Increase input audio power by 6 decibels using fixed-point precision:
4962 volume=volume=6dB:precision=fixed
4966 Fade volume after time 10 with an annihilation period of 5 seconds:
4968 volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
4972 @section volumedetect
4974 Detect the volume of the input video.
4976 The filter has no parameters. The input is not modified. Statistics about
4977 the volume will be printed in the log when the input stream end is reached.
4979 In particular it will show the mean volume (root mean square), maximum
4980 volume (on a per-sample basis), and the beginning of a histogram of the
4981 registered volume values (from the maximum value to a cumulated 1/1000 of
4984 All volumes are in decibels relative to the maximum PCM value.
4986 @subsection Examples
4988 Here is an excerpt of the output:
4990 [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
4991 [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
4992 [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
4993 [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
4994 [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
4995 [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
4996 [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
4997 [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
4998 [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
5004 The mean square energy is approximately -27 dB, or 10^-2.7.
5006 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
5008 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
5011 In other words, raising the volume by +4 dB does not cause any clipping,
5012 raising it by +5 dB causes clipping for 6 samples, etc.
5014 @c man end AUDIO FILTERS
5016 @chapter Audio Sources
5017 @c man begin AUDIO SOURCES
5019 Below is a description of the currently available audio sources.
5023 Buffer audio frames, and make them available to the filter chain.
5025 This source is mainly intended for a programmatic use, in particular
5026 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
5028 It accepts the following parameters:
5032 The timebase which will be used for timestamps of submitted frames. It must be
5033 either a floating-point number or in @var{numerator}/@var{denominator} form.
5036 The sample rate of the incoming audio buffers.
5039 The sample format of the incoming audio buffers.
5040 Either a sample format name or its corresponding integer representation from
5041 the enum AVSampleFormat in @file{libavutil/samplefmt.h}
5043 @item channel_layout
5044 The channel layout of the incoming audio buffers.
5045 Either a channel layout name from channel_layout_map in
5046 @file{libavutil/channel_layout.c} or its corresponding integer representation
5047 from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
5050 The number of channels of the incoming audio buffers.
5051 If both @var{channels} and @var{channel_layout} are specified, then they
5056 @subsection Examples
5059 abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
5062 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
5063 Since the sample format with name "s16p" corresponds to the number
5064 6 and the "stereo" channel layout corresponds to the value 0x3, this is
5067 abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
5072 Generate an audio signal specified by an expression.
5074 This source accepts in input one or more expressions (one for each
5075 channel), which are evaluated and used to generate a corresponding
5078 This source accepts the following options:
5082 Set the '|'-separated expressions list for each separate channel. In case the
5083 @option{channel_layout} option is not specified, the selected channel layout
5084 depends on the number of provided expressions. Otherwise the last
5085 specified expression is applied to the remaining output channels.
5087 @item channel_layout, c
5088 Set the channel layout. The number of channels in the specified layout
5089 must be equal to the number of specified expressions.
5092 Set the minimum duration of the sourced audio. See
5093 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
5094 for the accepted syntax.
5095 Note that the resulting duration may be greater than the specified
5096 duration, as the generated audio is always cut at the end of a
5099 If not specified, or the expressed duration is negative, the audio is
5100 supposed to be generated forever.
5103 Set the number of samples per channel per each output frame,
5106 @item sample_rate, s
5107 Specify the sample rate, default to 44100.
5110 Each expression in @var{exprs} can contain the following constants:
5114 number of the evaluated sample, starting from 0
5117 time of the evaluated sample expressed in seconds, starting from 0
5124 @subsection Examples
5134 Generate a sin signal with frequency of 440 Hz, set sample rate to
5137 aevalsrc="sin(440*2*PI*t):s=8000"
5141 Generate a two channels signal, specify the channel layout (Front
5142 Center + Back Center) explicitly:
5144 aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
5148 Generate white noise:
5150 aevalsrc="-2+random(0)"
5154 Generate an amplitude modulated signal:
5156 aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
5160 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
5162 aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
5169 The null audio source, return unprocessed audio frames. It is mainly useful
5170 as a template and to be employed in analysis / debugging tools, or as
5171 the source for filters which ignore the input data (for example the sox
5174 This source accepts the following options:
5178 @item channel_layout, cl
5180 Specifies the channel layout, and can be either an integer or a string
5181 representing a channel layout. The default value of @var{channel_layout}
5184 Check the channel_layout_map definition in
5185 @file{libavutil/channel_layout.c} for the mapping between strings and
5186 channel layout values.
5188 @item sample_rate, r
5189 Specifies the sample rate, and defaults to 44100.
5192 Set the number of samples per requested frames.
5196 @subsection Examples
5200 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
5202 anullsrc=r=48000:cl=4
5206 Do the same operation with a more obvious syntax:
5208 anullsrc=r=48000:cl=mono
5212 All the parameters need to be explicitly defined.
5216 Synthesize a voice utterance using the libflite library.
5218 To enable compilation of this filter you need to configure FFmpeg with
5219 @code{--enable-libflite}.
5221 Note that versions of the flite library prior to 2.0 are not thread-safe.
5223 The filter accepts the following options:
5228 If set to 1, list the names of the available voices and exit
5229 immediately. Default value is 0.
5232 Set the maximum number of samples per frame. Default value is 512.
5235 Set the filename containing the text to speak.
5238 Set the text to speak.
5241 Set the voice to use for the speech synthesis. Default value is
5242 @code{kal}. See also the @var{list_voices} option.
5245 @subsection Examples
5249 Read from file @file{speech.txt}, and synthesize the text using the
5250 standard flite voice:
5252 flite=textfile=speech.txt
5256 Read the specified text selecting the @code{slt} voice:
5258 flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
5262 Input text to ffmpeg:
5264 ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
5268 Make @file{ffplay} speak the specified text, using @code{flite} and
5269 the @code{lavfi} device:
5271 ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
5275 For more information about libflite, check:
5276 @url{http://www.festvox.org/flite/}
5280 Generate a noise audio signal.
5282 The filter accepts the following options:
5285 @item sample_rate, r
5286 Specify the sample rate. Default value is 48000 Hz.
5289 Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
5293 Specify the duration of the generated audio stream. Not specifying this option
5294 results in noise with an infinite length.
5296 @item color, colour, c
5297 Specify the color of noise. Available noise colors are white, pink, brown,
5298 blue and violet. Default color is white.
5301 Specify a value used to seed the PRNG.
5304 Set the number of samples per each output frame, default is 1024.
5307 @subsection Examples
5312 Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
5314 anoisesrc=d=60:c=pink:r=44100:a=0.5
5320 Generate odd-tap Hilbert transform FIR coefficients.
5322 The resulting stream can be used with @ref{afir} filter for phase-shifting
5323 the signal by 90 degrees.
5325 This is used in many matrix coding schemes and for analytic signal generation.
5326 The process is often written as a multiplication by i (or j), the imaginary unit.
5328 The filter accepts the following options:
5332 @item sample_rate, s
5333 Set sample rate, default is 44100.
5336 Set length of FIR filter, default is 22051.
5339 Set number of samples per each frame.
5342 Set window function to be used when generating FIR coefficients.
5347 Generate an audio signal made of a sine wave with amplitude 1/8.
5349 The audio signal is bit-exact.
5351 The filter accepts the following options:
5356 Set the carrier frequency. Default is 440 Hz.
5358 @item beep_factor, b
5359 Enable a periodic beep every second with frequency @var{beep_factor} times
5360 the carrier frequency. Default is 0, meaning the beep is disabled.
5362 @item sample_rate, r
5363 Specify the sample rate, default is 44100.
5366 Specify the duration of the generated audio stream.
5368 @item samples_per_frame
5369 Set the number of samples per output frame.
5371 The expression can contain the following constants:
5375 The (sequential) number of the output audio frame, starting from 0.
5378 The PTS (Presentation TimeStamp) of the output audio frame,
5379 expressed in @var{TB} units.
5382 The PTS of the output audio frame, expressed in seconds.
5385 The timebase of the output audio frames.
5388 Default is @code{1024}.
5391 @subsection Examples
5396 Generate a simple 440 Hz sine wave:
5402 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
5406 sine=frequency=220:beep_factor=4:duration=5
5410 Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
5413 sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
5417 @c man end AUDIO SOURCES
5419 @chapter Audio Sinks
5420 @c man begin AUDIO SINKS
5422 Below is a description of the currently available audio sinks.
5424 @section abuffersink
5426 Buffer audio frames, and make them available to the end of filter chain.
5428 This sink is mainly intended for programmatic use, in particular
5429 through the interface defined in @file{libavfilter/buffersink.h}
5430 or the options system.
5432 It accepts a pointer to an AVABufferSinkContext structure, which
5433 defines the incoming buffers' formats, to be passed as the opaque
5434 parameter to @code{avfilter_init_filter} for initialization.
5437 Null audio sink; do absolutely nothing with the input audio. It is
5438 mainly useful as a template and for use in analysis / debugging
5441 @c man end AUDIO SINKS
5443 @chapter Video Filters
5444 @c man begin VIDEO FILTERS
5446 When you configure your FFmpeg build, you can disable any of the
5447 existing filters using @code{--disable-filters}.
5448 The configure output will show the video filters included in your
5451 Below is a description of the currently available video filters.
5453 @section alphaextract
5455 Extract the alpha component from the input as a grayscale video. This
5456 is especially useful with the @var{alphamerge} filter.
5460 Add or replace the alpha component of the primary input with the
5461 grayscale value of a second input. This is intended for use with
5462 @var{alphaextract} to allow the transmission or storage of frame
5463 sequences that have alpha in a format that doesn't support an alpha
5466 For example, to reconstruct full frames from a normal YUV-encoded video
5467 and a separate video created with @var{alphaextract}, you might use:
5469 movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
5472 Since this filter is designed for reconstruction, it operates on frame
5473 sequences without considering timestamps, and terminates when either
5474 input reaches end of stream. This will cause problems if your encoding
5475 pipeline drops frames. If you're trying to apply an image as an
5476 overlay to a video stream, consider the @var{overlay} filter instead.
5480 Amplify differences between current pixel and pixels of adjacent frames in
5481 same pixel location.
5483 This filter accepts the following options:
5487 Set frame radius. Default is 2. Allowed range is from 1 to 63.
5488 For example radius of 3 will instruct filter to calculate average of 7 frames.
5491 Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
5494 Set threshold for difference amplification. Any differrence greater or equal to
5495 this value will not alter source pixel. Default is 10.
5496 Allowed range is from 0 to 65535.
5499 Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
5500 This option controls maximum possible value that will decrease source pixel value.
5503 Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
5504 This option controls maximum possible value that will increase source pixel value.
5507 Set which planes to filter. Default is all. Allowed range is from 0 to 15.
5512 Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
5513 and libavformat to work. On the other hand, it is limited to ASS (Advanced
5514 Substation Alpha) subtitles files.
5516 This filter accepts the following option in addition to the common options from
5517 the @ref{subtitles} filter:
5521 Set the shaping engine
5523 Available values are:
5526 The default libass shaping engine, which is the best available.
5528 Fast, font-agnostic shaper that can do only substitutions
5530 Slower shaper using OpenType for substitutions and positioning
5533 The default is @code{auto}.
5537 Apply an Adaptive Temporal Averaging Denoiser to the video input.
5539 The filter accepts the following options:
5543 Set threshold A for 1st plane. Default is 0.02.
5544 Valid range is 0 to 0.3.
5547 Set threshold B for 1st plane. Default is 0.04.
5548 Valid range is 0 to 5.
5551 Set threshold A for 2nd plane. Default is 0.02.
5552 Valid range is 0 to 0.3.
5555 Set threshold B for 2nd plane. Default is 0.04.
5556 Valid range is 0 to 5.
5559 Set threshold A for 3rd plane. Default is 0.02.
5560 Valid range is 0 to 0.3.
5563 Set threshold B for 3rd plane. Default is 0.04.
5564 Valid range is 0 to 5.
5566 Threshold A is designed to react on abrupt changes in the input signal and
5567 threshold B is designed to react on continuous changes in the input signal.
5570 Set number of frames filter will use for averaging. Default is 9. Must be odd
5571 number in range [5, 129].
5574 Set what planes of frame filter will use for averaging. Default is all.
5579 Apply average blur filter.
5581 The filter accepts the following options:
5585 Set horizontal radius size.
5588 Set which planes to filter. By default all planes are filtered.
5591 Set vertical radius size, if zero it will be same as @code{sizeX}.
5592 Default is @code{0}.
5597 Compute the bounding box for the non-black pixels in the input frame
5600 This filter computes the bounding box containing all the pixels with a
5601 luminance value greater than the minimum allowed value.
5602 The parameters describing the bounding box are printed on the filter
5605 The filter accepts the following option:
5609 Set the minimal luminance value. Default is @code{16}.
5612 @section bitplanenoise
5614 Show and measure bit plane noise.
5616 The filter accepts the following options:
5620 Set which plane to analyze. Default is @code{1}.
5623 Filter out noisy pixels from @code{bitplane} set above.
5624 Default is disabled.
5627 @section blackdetect
5629 Detect video intervals that are (almost) completely black. Can be
5630 useful to detect chapter transitions, commercials, or invalid
5631 recordings. Output lines contains the time for the start, end and
5632 duration of the detected black interval expressed in seconds.
5634 In order to display the output lines, you need to set the loglevel at
5635 least to the AV_LOG_INFO value.
5637 The filter accepts the following options:
5640 @item black_min_duration, d
5641 Set the minimum detected black duration expressed in seconds. It must
5642 be a non-negative floating point number.
5644 Default value is 2.0.
5646 @item picture_black_ratio_th, pic_th
5647 Set the threshold for considering a picture "black".
5648 Express the minimum value for the ratio:
5650 @var{nb_black_pixels} / @var{nb_pixels}
5653 for which a picture is considered black.
5654 Default value is 0.98.
5656 @item pixel_black_th, pix_th
5657 Set the threshold for considering a pixel "black".
5659 The threshold expresses the maximum pixel luminance value for which a
5660 pixel is considered "black". The provided value is scaled according to
5661 the following equation:
5663 @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
5666 @var{luminance_range_size} and @var{luminance_minimum_value} depend on
5667 the input video format, the range is [0-255] for YUV full-range
5668 formats and [16-235] for YUV non full-range formats.
5670 Default value is 0.10.
5673 The following example sets the maximum pixel threshold to the minimum
5674 value, and detects only black intervals of 2 or more seconds:
5676 blackdetect=d=2:pix_th=0.00
5681 Detect frames that are (almost) completely black. Can be useful to
5682 detect chapter transitions or commercials. Output lines consist of
5683 the frame number of the detected frame, the percentage of blackness,
5684 the position in the file if known or -1 and the timestamp in seconds.
5686 In order to display the output lines, you need to set the loglevel at
5687 least to the AV_LOG_INFO value.
5689 This filter exports frame metadata @code{lavfi.blackframe.pblack}.
5690 The value represents the percentage of pixels in the picture that
5691 are below the threshold value.
5693 It accepts the following parameters:
5698 The percentage of the pixels that have to be below the threshold; it defaults to
5701 @item threshold, thresh
5702 The threshold below which a pixel value is considered black; it defaults to
5707 @section blend, tblend
5709 Blend two video frames into each other.
5711 The @code{blend} filter takes two input streams and outputs one
5712 stream, the first input is the "top" layer and second input is
5713 "bottom" layer. By default, the output terminates when the longest input terminates.
5715 The @code{tblend} (time blend) filter takes two consecutive frames
5716 from one single stream, and outputs the result obtained by blending
5717 the new frame on top of the old frame.
5719 A description of the accepted options follows.
5727 Set blend mode for specific pixel component or all pixel components in case
5728 of @var{all_mode}. Default value is @code{normal}.
5730 Available values for component modes are:
5772 Set blend opacity for specific pixel component or all pixel components in case
5773 of @var{all_opacity}. Only used in combination with pixel component blend modes.
5780 Set blend expression for specific pixel component or all pixel components in case
5781 of @var{all_expr}. Note that related mode options will be ignored if those are set.
5783 The expressions can use the following variables:
5787 The sequential number of the filtered frame, starting from @code{0}.
5791 the coordinates of the current sample
5795 the width and height of currently filtered plane
5799 Width and height scale for the plane being filtered. It is the
5800 ratio between the dimensions of the current plane to the luma plane,
5801 e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
5802 the luma plane and @code{0.5,0.5} for the chroma planes.
5805 Time of the current frame, expressed in seconds.
5808 Value of pixel component at current location for first video frame (top layer).
5811 Value of pixel component at current location for second video frame (bottom layer).
5815 The @code{blend} filter also supports the @ref{framesync} options.
5817 @subsection Examples
5821 Apply transition from bottom layer to top layer in first 10 seconds:
5823 blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
5827 Apply linear horizontal transition from top layer to bottom layer:
5829 blend=all_expr='A*(X/W)+B*(1-X/W)'
5833 Apply 1x1 checkerboard effect:
5835 blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
5839 Apply uncover left effect:
5841 blend=all_expr='if(gte(N*SW+X,W),A,B)'
5845 Apply uncover down effect:
5847 blend=all_expr='if(gte(Y-N*SH,0),A,B)'
5851 Apply uncover up-left effect:
5853 blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
5857 Split diagonally video and shows top and bottom layer on each side:
5859 blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
5863 Display differences between the current and the previous frame:
5865 tblend=all_mode=grainextract
5871 Denoise frames using Block-Matching 3D algorithm.
5873 The filter accepts the following options.
5877 Set denoising strength. Default value is 1.
5878 Allowed range is from 0 to 999.9.
5879 The denoising algorith is very sensitive to sigma, so adjust it
5880 according to the source.
5883 Set local patch size. This sets dimensions in 2D.
5886 Set sliding step for processing blocks. Default value is 4.
5887 Allowed range is from 1 to 64.
5888 Smaller values allows processing more reference blocks and is slower.
5891 Set maximal number of similar blocks for 3rd dimension. Default value is 1.
5892 When set to 1, no block matching is done. Larger values allows more blocks
5894 Allowed range is from 1 to 256.
5897 Set radius for search block matching. Default is 9.
5898 Allowed range is from 1 to INT32_MAX.
5901 Set step between two search locations for block matching. Default is 1.
5902 Allowed range is from 1 to 64. Smaller is slower.
5905 Set threshold of mean square error for block matching. Valid range is 0 to
5909 Set thresholding parameter for hard thresholding in 3D transformed domain.
5910 Larger values results in stronger hard-thresholding filtering in frequency
5914 Set filtering estimation mode. Can be @code{basic} or @code{final}.
5915 Default is @code{basic}.
5918 If enabled, filter will use 2nd stream for block matching.
5919 Default is disabled for @code{basic} value of @var{estim} option,
5920 and always enabled if value of @var{estim} is @code{final}.
5923 Set planes to filter. Default is all available except alpha.
5926 @subsection Examples
5930 Basic filtering with bm3d:
5932 bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
5936 Same as above, but filtering only luma:
5938 bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
5942 Same as above, but with both estimation modes:
5944 split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
5948 Same as above, but prefilter with @ref{nlmeans} filter instead:
5950 split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
5956 Apply a boxblur algorithm to the input video.
5958 It accepts the following parameters:
5962 @item luma_radius, lr
5963 @item luma_power, lp
5964 @item chroma_radius, cr
5965 @item chroma_power, cp
5966 @item alpha_radius, ar
5967 @item alpha_power, ap
5971 A description of the accepted options follows.
5974 @item luma_radius, lr
5975 @item chroma_radius, cr
5976 @item alpha_radius, ar
5977 Set an expression for the box radius in pixels used for blurring the
5978 corresponding input plane.
5980 The radius value must be a non-negative number, and must not be
5981 greater than the value of the expression @code{min(w,h)/2} for the
5982 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
5985 Default value for @option{luma_radius} is "2". If not specified,
5986 @option{chroma_radius} and @option{alpha_radius} default to the
5987 corresponding value set for @option{luma_radius}.
5989 The expressions can contain the following constants:
5993 The input width and height in pixels.
5997 The input chroma image width and height in pixels.
6001 The horizontal and vertical chroma subsample values. For example, for the
6002 pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
6005 @item luma_power, lp
6006 @item chroma_power, cp
6007 @item alpha_power, ap
6008 Specify how many times the boxblur filter is applied to the
6009 corresponding plane.
6011 Default value for @option{luma_power} is 2. If not specified,
6012 @option{chroma_power} and @option{alpha_power} default to the
6013 corresponding value set for @option{luma_power}.
6015 A value of 0 will disable the effect.
6018 @subsection Examples
6022 Apply a boxblur filter with the luma, chroma, and alpha radii
6025 boxblur=luma_radius=2:luma_power=1
6030 Set the luma radius to 2, and alpha and chroma radius to 0:
6032 boxblur=2:1:cr=0:ar=0
6036 Set the luma and chroma radii to a fraction of the video dimension:
6038 boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
6044 Deinterlace the input video ("bwdif" stands for "Bob Weaver
6045 Deinterlacing Filter").
6047 Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
6048 interpolation algorithms.
6049 It accepts the following parameters:
6053 The interlacing mode to adopt. It accepts one of the following values:
6057 Output one frame for each frame.
6059 Output one frame for each field.
6062 The default value is @code{send_field}.
6065 The picture field parity assumed for the input interlaced video. It accepts one
6066 of the following values:
6070 Assume the top field is first.
6072 Assume the bottom field is first.
6074 Enable automatic detection of field parity.
6077 The default value is @code{auto}.
6078 If the interlacing is unknown or the decoder does not export this information,
6079 top field first will be assumed.
6082 Specify which frames to deinterlace. Accept one of the following
6087 Deinterlace all frames.
6089 Only deinterlace frames marked as interlaced.
6092 The default value is @code{all}.
6096 YUV colorspace color/chroma keying.
6098 The filter accepts the following options:
6102 The color which will be replaced with transparency.
6105 Similarity percentage with the key color.
6107 0.01 matches only the exact key color, while 1.0 matches everything.
6112 0.0 makes pixels either fully transparent, or not transparent at all.
6114 Higher values result in semi-transparent pixels, with a higher transparency
6115 the more similar the pixels color is to the key color.
6118 Signals that the color passed is already in YUV instead of RGB.
6120 Literal colors like "green" or "red" don't make sense with this enabled anymore.
6121 This can be used to pass exact YUV values as hexadecimal numbers.
6124 @subsection Examples
6128 Make every green pixel in the input image transparent:
6130 ffmpeg -i input.png -vf chromakey=green out.png
6134 Overlay a greenscreen-video on top of a static black background.
6136 ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
6142 Display CIE color diagram with pixels overlaid onto it.
6144 The filter accepts the following options:
6159 @item uhdtv, rec2020
6172 Set what gamuts to draw.
6174 See @code{system} option for available values.
6177 Set ciescope size, by default set to 512.
6180 Set intensity used to map input pixel values to CIE diagram.
6183 Set contrast used to draw tongue colors that are out of active color system gamut.
6186 Correct gamma displayed on scope, by default enabled.
6189 Show white point on CIE diagram, by default disabled.
6192 Set input gamma. Used only with XYZ input color space.
6197 Visualize information exported by some codecs.
6199 Some codecs can export information through frames using side-data or other
6200 means. For example, some MPEG based codecs export motion vectors through the
6201 @var{export_mvs} flag in the codec @option{flags2} option.
6203 The filter accepts the following option:
6207 Set motion vectors to visualize.
6209 Available flags for @var{mv} are:
6213 forward predicted MVs of P-frames
6215 forward predicted MVs of B-frames
6217 backward predicted MVs of B-frames
6221 Display quantization parameters using the chroma planes.
6224 Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
6226 Available flags for @var{mv_type} are:
6230 forward predicted MVs
6232 backward predicted MVs
6235 @item frame_type, ft
6236 Set frame type to visualize motion vectors of.
6238 Available flags for @var{frame_type} are:
6242 intra-coded frames (I-frames)
6244 predicted frames (P-frames)
6246 bi-directionally predicted frames (B-frames)
6250 @subsection Examples
6254 Visualize forward predicted MVs of all frames using @command{ffplay}:
6256 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
6260 Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
6262 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
6266 @section colorbalance
6267 Modify intensity of primary colors (red, green and blue) of input frames.
6269 The filter allows an input frame to be adjusted in the shadows, midtones or highlights
6270 regions for the red-cyan, green-magenta or blue-yellow balance.
6272 A positive adjustment value shifts the balance towards the primary color, a negative
6273 value towards the complementary color.
6275 The filter accepts the following options:
6281 Adjust red, green and blue shadows (darkest pixels).
6286 Adjust red, green and blue midtones (medium pixels).
6291 Adjust red, green and blue highlights (brightest pixels).
6293 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
6296 @subsection Examples
6300 Add red color cast to shadows:
6307 RGB colorspace color keying.
6309 The filter accepts the following options:
6313 The color which will be replaced with transparency.
6316 Similarity percentage with the key color.
6318 0.01 matches only the exact key color, while 1.0 matches everything.
6323 0.0 makes pixels either fully transparent, or not transparent at all.
6325 Higher values result in semi-transparent pixels, with a higher transparency
6326 the more similar the pixels color is to the key color.
6329 @subsection Examples
6333 Make every green pixel in the input image transparent:
6335 ffmpeg -i input.png -vf colorkey=green out.png
6339 Overlay a greenscreen-video on top of a static background image.
6341 ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
6345 @section colorlevels
6347 Adjust video input frames using levels.
6349 The filter accepts the following options:
6356 Adjust red, green, blue and alpha input black point.
6357 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
6363 Adjust red, green, blue and alpha input white point.
6364 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
6366 Input levels are used to lighten highlights (bright tones), darken shadows
6367 (dark tones), change the balance of bright and dark tones.
6373 Adjust red, green, blue and alpha output black point.
6374 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
6380 Adjust red, green, blue and alpha output white point.
6381 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
6383 Output levels allows manual selection of a constrained output level range.
6386 @subsection Examples
6390 Make video output darker:
6392 colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
6398 colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
6402 Make video output lighter:
6404 colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
6408 Increase brightness:
6410 colorlevels=romin=0.5:gomin=0.5:bomin=0.5
6414 @section colorchannelmixer
6416 Adjust video input frames by re-mixing color channels.
6418 This filter modifies a color channel by adding the values associated to
6419 the other channels of the same pixels. For example if the value to
6420 modify is red, the output value will be:
6422 @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
6425 The filter accepts the following options:
6432 Adjust contribution of input red, green, blue and alpha channels for output red channel.
6433 Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
6439 Adjust contribution of input red, green, blue and alpha channels for output green channel.
6440 Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
6446 Adjust contribution of input red, green, blue and alpha channels for output blue channel.
6447 Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
6453 Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
6454 Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
6456 Allowed ranges for options are @code{[-2.0, 2.0]}.
6459 @subsection Examples
6463 Convert source to grayscale:
6465 colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
6468 Simulate sepia tones:
6470 colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
6474 @section colormatrix
6476 Convert color matrix.
6478 The filter accepts the following options:
6483 Specify the source and destination color matrix. Both values must be
6486 The accepted values are:
6514 For example to convert from BT.601 to SMPTE-240M, use the command:
6516 colormatrix=bt601:smpte240m
6521 Convert colorspace, transfer characteristics or color primaries.
6522 Input video needs to have an even size.
6524 The filter accepts the following options:
6529 Specify all color properties at once.
6531 The accepted values are:
6561 Specify output colorspace.
6563 The accepted values are:
6572 BT.470BG or BT.601-6 625
6575 SMPTE-170M or BT.601-6 525
6584 BT.2020 with non-constant luminance
6590 Specify output transfer characteristics.
6592 The accepted values are:
6604 Constant gamma of 2.2
6607 Constant gamma of 2.8
6610 SMPTE-170M, BT.601-6 625 or BT.601-6 525
6628 BT.2020 for 10-bits content
6631 BT.2020 for 12-bits content
6637 Specify output color primaries.
6639 The accepted values are:
6648 BT.470BG or BT.601-6 625
6651 SMPTE-170M or BT.601-6 525
6675 Specify output color range.
6677 The accepted values are:
6680 TV (restricted) range
6683 MPEG (restricted) range
6694 Specify output color format.
6696 The accepted values are:
6699 YUV 4:2:0 planar 8-bits
6702 YUV 4:2:0 planar 10-bits
6705 YUV 4:2:0 planar 12-bits
6708 YUV 4:2:2 planar 8-bits
6711 YUV 4:2:2 planar 10-bits
6714 YUV 4:2:2 planar 12-bits
6717 YUV 4:4:4 planar 8-bits
6720 YUV 4:4:4 planar 10-bits
6723 YUV 4:4:4 planar 12-bits
6728 Do a fast conversion, which skips gamma/primary correction. This will take
6729 significantly less CPU, but will be mathematically incorrect. To get output
6730 compatible with that produced by the colormatrix filter, use fast=1.
6733 Specify dithering mode.
6735 The accepted values are:
6741 Floyd-Steinberg dithering
6745 Whitepoint adaptation mode.
6747 The accepted values are:
6750 Bradford whitepoint adaptation
6753 von Kries whitepoint adaptation
6756 identity whitepoint adaptation (i.e. no whitepoint adaptation)
6760 Override all input properties at once. Same accepted values as @ref{all}.
6763 Override input colorspace. Same accepted values as @ref{space}.
6766 Override input color primaries. Same accepted values as @ref{primaries}.
6769 Override input transfer characteristics. Same accepted values as @ref{trc}.
6772 Override input color range. Same accepted values as @ref{range}.
6776 The filter converts the transfer characteristics, color space and color
6777 primaries to the specified user values. The output value, if not specified,
6778 is set to a default value based on the "all" property. If that property is
6779 also not specified, the filter will log an error. The output color range and
6780 format default to the same value as the input color range and format. The
6781 input transfer characteristics, color space, color primaries and color range
6782 should be set on the input data. If any of these are missing, the filter will
6783 log an error and no conversion will take place.
6785 For example to convert the input to SMPTE-240M, use the command:
6787 colorspace=smpte240m
6790 @section convolution
6792 Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
6794 The filter accepts the following options:
6801 Set matrix for each plane.
6802 Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
6803 and from 1 to 49 odd number of signed integers in @var{row} mode.
6809 Set multiplier for calculated value for each plane.
6810 If unset or 0, it will be sum of all matrix elements.
6816 Set bias for each plane. This value is added to the result of the multiplication.
6817 Useful for making the overall image brighter or darker. Default is 0.0.
6823 Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
6824 Default is @var{square}.
6827 @subsection Examples
6833 convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
6839 convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
6845 convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
6851 convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
6855 Apply laplacian edge detector which includes diagonals:
6857 convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
6863 convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
6869 Apply 2D convolution of video stream in frequency domain using second stream
6872 The filter accepts the following options:
6876 Set which planes to process.
6879 Set which impulse video frames will be processed, can be @var{first}
6880 or @var{all}. Default is @var{all}.
6883 The @code{convolve} filter also supports the @ref{framesync} options.
6887 Copy the input video source unchanged to the output. This is mainly useful for
6892 Video filtering on GPU using Apple's CoreImage API on OSX.
6894 Hardware acceleration is based on an OpenGL context. Usually, this means it is
6895 processed by video hardware. However, software-based OpenGL implementations
6896 exist which means there is no guarantee for hardware processing. It depends on
6899 There are many filters and image generators provided by Apple that come with a
6900 large variety of options. The filter has to be referenced by its name along
6903 The coreimage filter accepts the following options:
6906 List all available filters and generators along with all their respective
6907 options as well as possible minimum and maximum values along with the default
6914 Specify all filters by their respective name and options.
6915 Use @var{list_filters} to determine all valid filter names and options.
6916 Numerical options are specified by a float value and are automatically clamped
6917 to their respective value range. Vector and color options have to be specified
6918 by a list of space separated float values. Character escaping has to be done.
6919 A special option name @code{default} is available to use default options for a
6922 It is required to specify either @code{default} or at least one of the filter options.
6923 All omitted options are used with their default values.
6924 The syntax of the filter string is as follows:
6926 filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
6930 Specify a rectangle where the output of the filter chain is copied into the
6931 input image. It is given by a list of space separated float values:
6933 output_rect=x\ y\ width\ height
6935 If not given, the output rectangle equals the dimensions of the input image.
6936 The output rectangle is automatically cropped at the borders of the input
6937 image. Negative values are valid for each component.
6939 output_rect=25\ 25\ 100\ 100
6943 Several filters can be chained for successive processing without GPU-HOST
6944 transfers allowing for fast processing of complex filter chains.
6945 Currently, only filters with zero (generators) or exactly one (filters) input
6946 image and one output image are supported. Also, transition filters are not yet
6949 Some filters generate output images with additional padding depending on the
6950 respective filter kernel. The padding is automatically removed to ensure the
6951 filter output has the same size as the input image.
6953 For image generators, the size of the output image is determined by the
6954 previous output image of the filter chain or the input image of the whole
6955 filterchain, respectively. The generators do not use the pixel information of
6956 this image to generate their output. However, the generated output is
6957 blended onto this image, resulting in partial or complete coverage of the
6960 The @ref{coreimagesrc} video source can be used for generating input images
6961 which are directly fed into the filter chain. By using it, providing input
6962 images by another video source or an input video is not required.
6964 @subsection Examples
6969 List all filters available:
6971 coreimage=list_filters=true
6975 Use the CIBoxBlur filter with default options to blur an image:
6977 coreimage=filter=CIBoxBlur@@default
6981 Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
6982 its center at 100x100 and a radius of 50 pixels:
6984 coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
6988 Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
6989 given as complete and escaped command-line for Apple's standard bash shell:
6991 ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
6997 Crop the input video to given dimensions.
6999 It accepts the following parameters:
7003 The width of the output video. It defaults to @code{iw}.
7004 This expression is evaluated only once during the filter
7005 configuration, or when the @samp{w} or @samp{out_w} command is sent.
7008 The height of the output video. It defaults to @code{ih}.
7009 This expression is evaluated only once during the filter
7010 configuration, or when the @samp{h} or @samp{out_h} command is sent.
7013 The horizontal position, in the input video, of the left edge of the output
7014 video. It defaults to @code{(in_w-out_w)/2}.
7015 This expression is evaluated per-frame.
7018 The vertical position, in the input video, of the top edge of the output video.
7019 It defaults to @code{(in_h-out_h)/2}.
7020 This expression is evaluated per-frame.
7023 If set to 1 will force the output display aspect ratio
7024 to be the same of the input, by changing the output sample aspect
7025 ratio. It defaults to 0.
7028 Enable exact cropping. If enabled, subsampled videos will be cropped at exact
7029 width/height/x/y as specified and will not be rounded to nearest smaller value.
7033 The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
7034 expressions containing the following constants:
7039 The computed values for @var{x} and @var{y}. They are evaluated for
7044 The input width and height.
7048 These are the same as @var{in_w} and @var{in_h}.
7052 The output (cropped) width and height.
7056 These are the same as @var{out_w} and @var{out_h}.
7059 same as @var{iw} / @var{ih}
7062 input sample aspect ratio
7065 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
7069 horizontal and vertical chroma subsample values. For example for the
7070 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
7073 The number of the input frame, starting from 0.
7076 the position in the file of the input frame, NAN if unknown
7079 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
7083 The expression for @var{out_w} may depend on the value of @var{out_h},
7084 and the expression for @var{out_h} may depend on @var{out_w}, but they
7085 cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
7086 evaluated after @var{out_w} and @var{out_h}.
7088 The @var{x} and @var{y} parameters specify the expressions for the
7089 position of the top-left corner of the output (non-cropped) area. They
7090 are evaluated for each frame. If the evaluated value is not valid, it
7091 is approximated to the nearest valid value.
7093 The expression for @var{x} may depend on @var{y}, and the expression
7094 for @var{y} may depend on @var{x}.
7096 @subsection Examples
7100 Crop area with size 100x100 at position (12,34).
7105 Using named options, the example above becomes:
7107 crop=w=100:h=100:x=12:y=34
7111 Crop the central input area with size 100x100:
7117 Crop the central input area with size 2/3 of the input video:
7119 crop=2/3*in_w:2/3*in_h
7123 Crop the input video central square:
7130 Delimit the rectangle with the top-left corner placed at position
7131 100:100 and the right-bottom corner corresponding to the right-bottom
7132 corner of the input image.
7134 crop=in_w-100:in_h-100:100:100
7138 Crop 10 pixels from the left and right borders, and 20 pixels from
7139 the top and bottom borders
7141 crop=in_w-2*10:in_h-2*20
7145 Keep only the bottom right quarter of the input image:
7147 crop=in_w/2:in_h/2:in_w/2:in_h/2
7151 Crop height for getting Greek harmony:
7153 crop=in_w:1/PHI*in_w
7157 Apply trembling effect:
7159 crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
7163 Apply erratic camera effect depending on timestamp:
7165 crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
7169 Set x depending on the value of y:
7171 crop=in_w/2:in_h/2:y:10+10*sin(n/10)
7175 @subsection Commands
7177 This filter supports the following commands:
7183 Set width/height of the output video and the horizontal/vertical position
7185 The command accepts the same syntax of the corresponding option.
7187 If the specified expression is not valid, it is kept at its current
7193 Auto-detect the crop size.
7195 It calculates the necessary cropping parameters and prints the
7196 recommended parameters via the logging system. The detected dimensions
7197 correspond to the non-black area of the input video.
7199 It accepts the following parameters:
7204 Set higher black value threshold, which can be optionally specified
7205 from nothing (0) to everything (255 for 8-bit based formats). An intensity
7206 value greater to the set value is considered non-black. It defaults to 24.
7207 You can also specify a value between 0.0 and 1.0 which will be scaled depending
7208 on the bitdepth of the pixel format.
7211 The value which the width/height should be divisible by. It defaults to
7212 16. The offset is automatically adjusted to center the video. Use 2 to
7213 get only even dimensions (needed for 4:2:2 video). 16 is best when
7214 encoding to most video codecs.
7216 @item reset_count, reset
7217 Set the counter that determines after how many frames cropdetect will
7218 reset the previously detected largest video area and start over to
7219 detect the current optimal crop area. Default value is 0.
7221 This can be useful when channel logos distort the video area. 0
7222 indicates 'never reset', and returns the largest area encountered during
7229 Delay video filtering until a given wallclock timestamp. The filter first
7230 passes on @option{preroll} amount of frames, then it buffers at most
7231 @option{buffer} amount of frames and waits for the cue. After reaching the cue
7232 it forwards the buffered frames and also any subsequent frames coming in its
7235 The filter can be used synchronize the output of multiple ffmpeg processes for
7236 realtime output devices like decklink. By putting the delay in the filtering
7237 chain and pre-buffering frames the process can pass on data to output almost
7238 immediately after the target wallclock timestamp is reached.
7240 Perfect frame accuracy cannot be guaranteed, but the result is good enough for
7246 The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
7249 The duration of content to pass on as preroll expressed in seconds. Default is 0.
7252 The maximum duration of content to buffer before waiting for the cue expressed
7253 in seconds. Default is 0.
7260 Apply color adjustments using curves.
7262 This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
7263 component (red, green and blue) has its values defined by @var{N} key points
7264 tied from each other using a smooth curve. The x-axis represents the pixel
7265 values from the input frame, and the y-axis the new pixel values to be set for
7268 By default, a component curve is defined by the two points @var{(0;0)} and
7269 @var{(1;1)}. This creates a straight line where each original pixel value is
7270 "adjusted" to its own value, which means no change to the image.
7272 The filter allows you to redefine these two points and add some more. A new
7273 curve (using a natural cubic spline interpolation) will be define to pass
7274 smoothly through all these new coordinates. The new defined points needs to be
7275 strictly increasing over the x-axis, and their @var{x} and @var{y} values must
7276 be in the @var{[0;1]} interval. If the computed curves happened to go outside
7277 the vector spaces, the values will be clipped accordingly.
7279 The filter accepts the following options:
7283 Select one of the available color presets. This option can be used in addition
7284 to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
7285 options takes priority on the preset values.
7286 Available presets are:
7289 @item color_negative
7292 @item increase_contrast
7294 @item linear_contrast
7295 @item medium_contrast
7297 @item strong_contrast
7300 Default is @code{none}.
7302 Set the master key points. These points will define a second pass mapping. It
7303 is sometimes called a "luminance" or "value" mapping. It can be used with
7304 @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
7305 post-processing LUT.
7307 Set the key points for the red component.
7309 Set the key points for the green component.
7311 Set the key points for the blue component.
7313 Set the key points for all components (not including master).
7314 Can be used in addition to the other key points component
7315 options. In this case, the unset component(s) will fallback on this
7316 @option{all} setting.
7318 Specify a Photoshop curves file (@code{.acv}) to import the settings from.
7320 Save Gnuplot script of the curves in specified file.
7323 To avoid some filtergraph syntax conflicts, each key points list need to be
7324 defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
7326 @subsection Examples
7330 Increase slightly the middle level of blue:
7332 curves=blue='0/0 0.5/0.58 1/1'
7338 curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
7340 Here we obtain the following coordinates for each components:
7343 @code{(0;0.11) (0.42;0.51) (1;0.95)}
7345 @code{(0;0) (0.50;0.48) (1;1)}
7347 @code{(0;0.22) (0.49;0.44) (1;0.80)}
7351 The previous example can also be achieved with the associated built-in preset:
7353 curves=preset=vintage
7363 Use a Photoshop preset and redefine the points of the green component:
7365 curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
7369 Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
7370 and @command{gnuplot}:
7372 ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
7373 gnuplot -p /tmp/curves.plt
7379 Video data analysis filter.
7381 This filter shows hexadecimal pixel values of part of video.
7383 The filter accepts the following options:
7387 Set output video size.
7390 Set x offset from where to pick pixels.
7393 Set y offset from where to pick pixels.
7396 Set scope mode, can be one of the following:
7399 Draw hexadecimal pixel values with white color on black background.
7402 Draw hexadecimal pixel values with input video pixel color on black
7406 Draw hexadecimal pixel values on color background picked from input video,
7407 the text color is picked in such way so its always visible.
7411 Draw rows and columns numbers on left and top of video.
7414 Set background opacity.
7419 Denoise frames using 2D DCT (frequency domain filtering).
7421 This filter is not designed for real time.
7423 The filter accepts the following options:
7427 Set the noise sigma constant.
7429 This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
7430 coefficient (absolute value) below this threshold with be dropped.
7432 If you need a more advanced filtering, see @option{expr}.
7434 Default is @code{0}.
7437 Set number overlapping pixels for each block. Since the filter can be slow, you
7438 may want to reduce this value, at the cost of a less effective filter and the
7439 risk of various artefacts.
7441 If the overlapping value doesn't permit processing the whole input width or
7442 height, a warning will be displayed and according borders won't be denoised.
7444 Default value is @var{blocksize}-1, which is the best possible setting.
7447 Set the coefficient factor expression.
7449 For each coefficient of a DCT block, this expression will be evaluated as a
7450 multiplier value for the coefficient.
7452 If this is option is set, the @option{sigma} option will be ignored.
7454 The absolute value of the coefficient can be accessed through the @var{c}
7458 Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
7459 @var{blocksize}, which is the width and height of the processed blocks.
7461 The default value is @var{3} (8x8) and can be raised to @var{4} for a
7462 @var{blocksize} of 16x16. Note that changing this setting has huge consequences
7463 on the speed processing. Also, a larger block size does not necessarily means a
7467 @subsection Examples
7469 Apply a denoise with a @option{sigma} of @code{4.5}:
7474 The same operation can be achieved using the expression system:
7476 dctdnoiz=e='gte(c, 4.5*3)'
7479 Violent denoise using a block size of @code{16x16}:
7486 Remove banding artifacts from input video.
7487 It works by replacing banded pixels with average value of referenced pixels.
7489 The filter accepts the following options:
7496 Set banding detection threshold for each plane. Default is 0.02.
7497 Valid range is 0.00003 to 0.5.
7498 If difference between current pixel and reference pixel is less than threshold,
7499 it will be considered as banded.
7502 Banding detection range in pixels. Default is 16. If positive, random number
7503 in range 0 to set value will be used. If negative, exact absolute value
7505 The range defines square of four pixels around current pixel.
7508 Set direction in radians from which four pixel will be compared. If positive,
7509 random direction from 0 to set direction will be picked. If negative, exact of
7510 absolute value will be picked. For example direction 0, -PI or -2*PI radians
7511 will pick only pixels on same row and -PI/2 will pick only pixels on same
7515 If enabled, current pixel is compared with average value of all four
7516 surrounding pixels. The default is enabled. If disabled current pixel is
7517 compared with all four surrounding pixels. The pixel is considered banded
7518 if only all four differences with surrounding pixels are less than threshold.
7521 If enabled, current pixel is changed if and only if all pixel components are banded,
7522 e.g. banding detection threshold is triggered for all color components.
7523 The default is disabled.
7528 Remove blocking artifacts from input video.
7530 The filter accepts the following options:
7534 Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
7535 This controls what kind of deblocking is applied.
7538 Set size of block, allowed range is from 4 to 512. Default is @var{8}.
7544 Set blocking detection thresholds. Allowed range is 0 to 1.
7545 Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
7546 Using higher threshold gives more deblocking strength.
7547 Setting @var{alpha} controls threshold detection at exact edge of block.
7548 Remaining options controls threshold detection near the edge. Each one for
7549 below/above or left/right. Setting any of those to @var{0} disables
7553 Set planes to filter. Default is to filter all available planes.
7556 @subsection Examples
7560 Deblock using weak filter and block size of 4 pixels.
7562 deblock=filter=weak:block=4
7566 Deblock using strong filter, block size of 4 pixels and custom thresholds for
7567 deblocking more edges.
7569 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
7573 Similar as above, but filter only first plane.
7575 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
7579 Similar as above, but filter only second and third plane.
7581 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
7588 Drop duplicated frames at regular intervals.
7590 The filter accepts the following options:
7594 Set the number of frames from which one will be dropped. Setting this to
7595 @var{N} means one frame in every batch of @var{N} frames will be dropped.
7596 Default is @code{5}.
7599 Set the threshold for duplicate detection. If the difference metric for a frame
7600 is less than or equal to this value, then it is declared as duplicate. Default
7604 Set scene change threshold. Default is @code{15}.
7608 Set the size of the x and y-axis blocks used during metric calculations.
7609 Larger blocks give better noise suppression, but also give worse detection of
7610 small movements. Must be a power of two. Default is @code{32}.
7613 Mark main input as a pre-processed input and activate clean source input
7614 stream. This allows the input to be pre-processed with various filters to help
7615 the metrics calculation while keeping the frame selection lossless. When set to
7616 @code{1}, the first stream is for the pre-processed input, and the second
7617 stream is the clean source from where the kept frames are chosen. Default is
7621 Set whether or not chroma is considered in the metric calculations. Default is
7627 Apply 2D deconvolution of video stream in frequency domain using second stream
7630 The filter accepts the following options:
7634 Set which planes to process.
7637 Set which impulse video frames will be processed, can be @var{first}
7638 or @var{all}. Default is @var{all}.
7641 Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
7642 and height are not same and not power of 2 or if stream prior to convolving
7646 The @code{deconvolve} filter also supports the @ref{framesync} options.
7650 Apply deflate effect to the video.
7652 This filter replaces the pixel by the local(3x3) average by taking into account
7653 only values lower than the pixel.
7655 It accepts the following options:
7662 Limit the maximum change for each plane, default is 65535.
7663 If 0, plane will remain unchanged.
7668 Remove temporal frame luminance variations.
7670 It accepts the following options:
7674 Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
7677 Set averaging mode to smooth temporal luminance variations.
7679 Available values are:
7704 Do not actually modify frame. Useful when one only wants metadata.
7709 Remove judder produced by partially interlaced telecined content.
7711 Judder can be introduced, for instance, by @ref{pullup} filter. If the original
7712 source was partially telecined content then the output of @code{pullup,dejudder}
7713 will have a variable frame rate. May change the recorded frame rate of the
7714 container. Aside from that change, this filter will not affect constant frame
7717 The option available in this filter is:
7721 Specify the length of the window over which the judder repeats.
7723 Accepts any integer greater than 1. Useful values are:
7727 If the original was telecined from 24 to 30 fps (Film to NTSC).
7730 If the original was telecined from 25 to 30 fps (PAL to NTSC).
7733 If a mixture of the two.
7736 The default is @samp{4}.
7741 Suppress a TV station logo by a simple interpolation of the surrounding
7742 pixels. Just set a rectangle covering the logo and watch it disappear
7743 (and sometimes something even uglier appear - your mileage may vary).
7745 It accepts the following parameters:
7750 Specify the top left corner coordinates of the logo. They must be
7755 Specify the width and height of the logo to clear. They must be
7759 Specify the thickness of the fuzzy edge of the rectangle (added to
7760 @var{w} and @var{h}). The default value is 1. This option is
7761 deprecated, setting higher values should no longer be necessary and
7765 When set to 1, a green rectangle is drawn on the screen to simplify
7766 finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
7767 The default value is 0.
7769 The rectangle is drawn on the outermost pixels which will be (partly)
7770 replaced with interpolated values. The values of the next pixels
7771 immediately outside this rectangle in each direction will be used to
7772 compute the interpolated pixel values inside the rectangle.
7776 @subsection Examples
7780 Set a rectangle covering the area with top left corner coordinates 0,0
7781 and size 100x77, and a band of size 10:
7783 delogo=x=0:y=0:w=100:h=77:band=10
7790 Attempt to fix small changes in horizontal and/or vertical shift. This
7791 filter helps remove camera shake from hand-holding a camera, bumping a
7792 tripod, moving on a vehicle, etc.
7794 The filter accepts the following options:
7802 Specify a rectangular area where to limit the search for motion
7804 If desired the search for motion vectors can be limited to a
7805 rectangular area of the frame defined by its top left corner, width
7806 and height. These parameters have the same meaning as the drawbox
7807 filter which can be used to visualise the position of the bounding
7810 This is useful when simultaneous movement of subjects within the frame
7811 might be confused for camera motion by the motion vector search.
7813 If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
7814 then the full frame is used. This allows later options to be set
7815 without specifying the bounding box for the motion vector search.
7817 Default - search the whole frame.
7821 Specify the maximum extent of movement in x and y directions in the
7822 range 0-64 pixels. Default 16.
7825 Specify how to generate pixels to fill blanks at the edge of the
7826 frame. Available values are:
7829 Fill zeroes at blank locations
7831 Original image at blank locations
7833 Extruded edge value at blank locations
7835 Mirrored edge at blank locations
7837 Default value is @samp{mirror}.
7840 Specify the blocksize to use for motion search. Range 4-128 pixels,
7844 Specify the contrast threshold for blocks. Only blocks with more than
7845 the specified contrast (difference between darkest and lightest
7846 pixels) will be considered. Range 1-255, default 125.
7849 Specify the search strategy. Available values are:
7852 Set exhaustive search
7854 Set less exhaustive search.
7856 Default value is @samp{exhaustive}.
7859 If set then a detailed log of the motion search is written to the
7866 Remove unwanted contamination of foreground colors, caused by reflected color of
7867 greenscreen or bluescreen.
7869 This filter accepts the following options:
7873 Set what type of despill to use.
7876 Set how spillmap will be generated.
7879 Set how much to get rid of still remaining spill.
7882 Controls amount of red in spill area.
7885 Controls amount of green in spill area.
7886 Should be -1 for greenscreen.
7889 Controls amount of blue in spill area.
7890 Should be -1 for bluescreen.
7893 Controls brightness of spill area, preserving colors.
7896 Modify alpha from generated spillmap.
7901 Apply an exact inverse of the telecine operation. It requires a predefined
7902 pattern specified using the pattern option which must be the same as that passed
7903 to the telecine filter.
7905 This filter accepts the following options:
7914 The default value is @code{top}.
7918 A string of numbers representing the pulldown pattern you wish to apply.
7919 The default value is @code{23}.
7922 A number representing position of the first frame with respect to the telecine
7923 pattern. This is to be used if the stream is cut. The default value is @code{0}.
7928 Apply dilation effect to the video.
7930 This filter replaces the pixel by the local(3x3) maximum.
7932 It accepts the following options:
7939 Limit the maximum change for each plane, default is 65535.
7940 If 0, plane will remain unchanged.
7943 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
7946 Flags to local 3x3 coordinates maps like this:
7955 Displace pixels as indicated by second and third input stream.
7957 It takes three input streams and outputs one stream, the first input is the
7958 source, and second and third input are displacement maps.
7960 The second input specifies how much to displace pixels along the
7961 x-axis, while the third input specifies how much to displace pixels
7963 If one of displacement map streams terminates, last frame from that
7964 displacement map will be used.
7966 Note that once generated, displacements maps can be reused over and over again.
7968 A description of the accepted options follows.
7972 Set displace behavior for pixels that are out of range.
7974 Available values are:
7977 Missing pixels are replaced by black pixels.
7980 Adjacent pixels will spread out to replace missing pixels.
7983 Out of range pixels are wrapped so they point to pixels of other side.
7986 Out of range pixels will be replaced with mirrored pixels.
7988 Default is @samp{smear}.
7992 @subsection Examples
7996 Add ripple effect to rgb input of video size hd720:
7998 ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
8002 Add wave effect to rgb input of video size hd720:
8004 ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
8010 Draw a colored box on the input image.
8012 It accepts the following parameters:
8017 The expressions which specify the top left corner coordinates of the box. It defaults to 0.
8021 The expressions which specify the width and height of the box; if 0 they are interpreted as
8022 the input width and height. It defaults to 0.
8025 Specify the color of the box to write. For the general syntax of this option,
8026 check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
8027 value @code{invert} is used, the box edge color is the same as the
8028 video with inverted luma.
8031 The expression which sets the thickness of the box edge.
8032 A value of @code{fill} will create a filled box. Default value is @code{3}.
8034 See below for the list of accepted constants.
8037 Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
8038 will overwrite the video's color and alpha pixels.
8039 Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
8042 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
8043 following constants:
8047 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
8051 horizontal and vertical chroma subsample values. For example for the
8052 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8056 The input width and height.
8059 The input sample aspect ratio.
8063 The x and y offset coordinates where the box is drawn.
8067 The width and height of the drawn box.
8070 The thickness of the drawn box.
8072 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
8073 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
8077 @subsection Examples
8081 Draw a black box around the edge of the input image:
8087 Draw a box with color red and an opacity of 50%:
8089 drawbox=10:20:200:60:red@@0.5
8092 The previous example can be specified as:
8094 drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
8098 Fill the box with pink color:
8100 drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
8104 Draw a 2-pixel red 2.40:1 mask:
8106 drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
8112 Draw a grid on the input image.
8114 It accepts the following parameters:
8119 The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
8123 The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
8124 input width and height, respectively, minus @code{thickness}, so image gets
8125 framed. Default to 0.
8128 Specify the color of the grid. For the general syntax of this option,
8129 check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
8130 value @code{invert} is used, the grid color is the same as the
8131 video with inverted luma.
8134 The expression which sets the thickness of the grid line. Default value is @code{1}.
8136 See below for the list of accepted constants.
8139 Applicable if the input has alpha. With @code{1} the pixels of the painted grid
8140 will overwrite the video's color and alpha pixels.
8141 Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
8144 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
8145 following constants:
8149 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
8153 horizontal and vertical chroma subsample values. For example for the
8154 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8158 The input grid cell width and height.
8161 The input sample aspect ratio.
8165 The x and y coordinates of some point of grid intersection (meant to configure offset).
8169 The width and height of the drawn cell.
8172 The thickness of the drawn cell.
8174 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
8175 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
8179 @subsection Examples
8183 Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
8185 drawgrid=width=100:height=100:thickness=2:color=red@@0.5
8189 Draw a white 3x3 grid with an opacity of 50%:
8191 drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
8198 Draw a text string or text from a specified file on top of a video, using the
8199 libfreetype library.
8201 To enable compilation of this filter, you need to configure FFmpeg with
8202 @code{--enable-libfreetype}.
8203 To enable default font fallback and the @var{font} option you need to
8204 configure FFmpeg with @code{--enable-libfontconfig}.
8205 To enable the @var{text_shaping} option, you need to configure FFmpeg with
8206 @code{--enable-libfribidi}.
8210 It accepts the following parameters:
8215 Used to draw a box around text using the background color.
8216 The value must be either 1 (enable) or 0 (disable).
8217 The default value of @var{box} is 0.
8220 Set the width of the border to be drawn around the box using @var{boxcolor}.
8221 The default value of @var{boxborderw} is 0.
8224 The color to be used for drawing box around text. For the syntax of this
8225 option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8227 The default value of @var{boxcolor} is "white".
8230 Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
8231 The default value of @var{line_spacing} is 0.
8234 Set the width of the border to be drawn around the text using @var{bordercolor}.
8235 The default value of @var{borderw} is 0.
8238 Set the color to be used for drawing border around text. For the syntax of this
8239 option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8241 The default value of @var{bordercolor} is "black".
8244 Select how the @var{text} is expanded. Can be either @code{none},
8245 @code{strftime} (deprecated) or
8246 @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
8250 Set a start time for the count. Value is in microseconds. Only applied
8251 in the deprecated strftime expansion mode. To emulate in normal expansion
8252 mode use the @code{pts} function, supplying the start time (in seconds)
8253 as the second argument.
8256 If true, check and fix text coords to avoid clipping.
8259 The color to be used for drawing fonts. For the syntax of this option, check
8260 the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8262 The default value of @var{fontcolor} is "black".
8264 @item fontcolor_expr
8265 String which is expanded the same way as @var{text} to obtain dynamic
8266 @var{fontcolor} value. By default this option has empty value and is not
8267 processed. When this option is set, it overrides @var{fontcolor} option.
8270 The font family to be used for drawing text. By default Sans.
8273 The font file to be used for drawing text. The path must be included.
8274 This parameter is mandatory if the fontconfig support is disabled.
8277 Draw the text applying alpha blending. The value can
8278 be a number between 0.0 and 1.0.
8279 The expression accepts the same variables @var{x, y} as well.
8280 The default value is 1.
8281 Please see @var{fontcolor_expr}.
8284 The font size to be used for drawing text.
8285 The default value of @var{fontsize} is 16.
8288 If set to 1, attempt to shape the text (for example, reverse the order of
8289 right-to-left text and join Arabic characters) before drawing it.
8290 Otherwise, just draw the text exactly as given.
8291 By default 1 (if supported).
8294 The flags to be used for loading the fonts.
8296 The flags map the corresponding flags supported by libfreetype, and are
8297 a combination of the following values:
8304 @item vertical_layout
8305 @item force_autohint
8308 @item ignore_global_advance_width
8310 @item ignore_transform
8316 Default value is "default".
8318 For more information consult the documentation for the FT_LOAD_*
8322 The color to be used for drawing a shadow behind the drawn text. For the
8323 syntax of this option, check the @ref{color syntax,,"Color" section in the
8324 ffmpeg-utils manual,ffmpeg-utils}.
8326 The default value of @var{shadowcolor} is "black".
8330 The x and y offsets for the text shadow position with respect to the
8331 position of the text. They can be either positive or negative
8332 values. The default value for both is "0".
8335 The starting frame number for the n/frame_num variable. The default value
8339 The size in number of spaces to use for rendering the tab.
8343 Set the initial timecode representation in "hh:mm:ss[:;.]ff"
8344 format. It can be used with or without text parameter. @var{timecode_rate}
8345 option must be specified.
8347 @item timecode_rate, rate, r
8348 Set the timecode frame rate (timecode only). Value will be rounded to nearest
8349 integer. Minimum value is "1".
8350 Drop-frame timecode is supported for frame rates 30 & 60.
8353 If set to 1, the output of the timecode option will wrap around at 24 hours.
8354 Default is 0 (disabled).
8357 The text string to be drawn. The text must be a sequence of UTF-8
8359 This parameter is mandatory if no file is specified with the parameter
8363 A text file containing text to be drawn. The text must be a sequence
8364 of UTF-8 encoded characters.
8366 This parameter is mandatory if no text string is specified with the
8367 parameter @var{text}.
8369 If both @var{text} and @var{textfile} are specified, an error is thrown.
8372 If set to 1, the @var{textfile} will be reloaded before each frame.
8373 Be sure to update it atomically, or it may be read partially, or even fail.
8377 The expressions which specify the offsets where text will be drawn
8378 within the video frame. They are relative to the top/left border of the
8381 The default value of @var{x} and @var{y} is "0".
8383 See below for the list of accepted constants and functions.
8386 The parameters for @var{x} and @var{y} are expressions containing the
8387 following constants and functions:
8391 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
8395 horizontal and vertical chroma subsample values. For example for the
8396 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8399 the height of each text line
8407 @item max_glyph_a, ascent
8408 the maximum distance from the baseline to the highest/upper grid
8409 coordinate used to place a glyph outline point, for all the rendered
8411 It is a positive value, due to the grid's orientation with the Y axis
8414 @item max_glyph_d, descent
8415 the maximum distance from the baseline to the lowest grid coordinate
8416 used to place a glyph outline point, for all the rendered glyphs.
8417 This is a negative value, due to the grid's orientation, with the Y axis
8421 maximum glyph height, that is the maximum height for all the glyphs
8422 contained in the rendered text, it is equivalent to @var{ascent} -
8426 maximum glyph width, that is the maximum width for all the glyphs
8427 contained in the rendered text
8430 the number of input frame, starting from 0
8432 @item rand(min, max)
8433 return a random number included between @var{min} and @var{max}
8436 The input sample aspect ratio.
8439 timestamp expressed in seconds, NAN if the input timestamp is unknown
8442 the height of the rendered text
8445 the width of the rendered text
8449 the x and y offset coordinates where the text is drawn.
8451 These parameters allow the @var{x} and @var{y} expressions to refer
8452 each other, so you can for example specify @code{y=x/dar}.
8455 @anchor{drawtext_expansion}
8456 @subsection Text expansion
8458 If @option{expansion} is set to @code{strftime},
8459 the filter recognizes strftime() sequences in the provided text and
8460 expands them accordingly. Check the documentation of strftime(). This
8461 feature is deprecated.
8463 If @option{expansion} is set to @code{none}, the text is printed verbatim.
8465 If @option{expansion} is set to @code{normal} (which is the default),
8466 the following expansion mechanism is used.
8468 The backslash character @samp{\}, followed by any character, always expands to
8469 the second character.
8471 Sequences of the form @code{%@{...@}} are expanded. The text between the
8472 braces is a function name, possibly followed by arguments separated by ':'.
8473 If the arguments contain special characters or delimiters (':' or '@}'),
8474 they should be escaped.
8476 Note that they probably must also be escaped as the value for the
8477 @option{text} option in the filter argument string and as the filter
8478 argument in the filtergraph description, and possibly also for the shell,
8479 that makes up to four levels of escaping; using a text file avoids these
8482 The following functions are available:
8487 The expression evaluation result.
8489 It must take one argument specifying the expression to be evaluated,
8490 which accepts the same constants and functions as the @var{x} and
8491 @var{y} values. Note that not all constants should be used, for
8492 example the text size is not known when evaluating the expression, so
8493 the constants @var{text_w} and @var{text_h} will have an undefined
8496 @item expr_int_format, eif
8497 Evaluate the expression's value and output as formatted integer.
8499 The first argument is the expression to be evaluated, just as for the @var{expr} function.
8500 The second argument specifies the output format. Allowed values are @samp{x},
8501 @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
8502 @code{printf} function.
8503 The third parameter is optional and sets the number of positions taken by the output.
8504 It can be used to add padding with zeros from the left.
8507 The time at which the filter is running, expressed in UTC.
8508 It can accept an argument: a strftime() format string.
8511 The time at which the filter is running, expressed in the local time zone.
8512 It can accept an argument: a strftime() format string.
8515 Frame metadata. Takes one or two arguments.
8517 The first argument is mandatory and specifies the metadata key.
8519 The second argument is optional and specifies a default value, used when the
8520 metadata key is not found or empty.
8523 The frame number, starting from 0.
8526 A 1 character description of the current picture type.
8529 The timestamp of the current frame.
8530 It can take up to three arguments.
8532 The first argument is the format of the timestamp; it defaults to @code{flt}
8533 for seconds as a decimal number with microsecond accuracy; @code{hms} stands
8534 for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
8535 @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
8536 @code{localtime} stands for the timestamp of the frame formatted as
8537 local time zone time.
8539 The second argument is an offset added to the timestamp.
8541 If the format is set to @code{hms}, a third argument @code{24HH} may be
8542 supplied to present the hour part of the formatted timestamp in 24h format
8545 If the format is set to @code{localtime} or @code{gmtime},
8546 a third argument may be supplied: a strftime() format string.
8547 By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
8550 @subsection Examples
8554 Draw "Test Text" with font FreeSerif, using the default values for the
8555 optional parameters.
8558 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
8562 Draw 'Test Text' with font FreeSerif of size 24 at position x=100
8563 and y=50 (counting from the top-left corner of the screen), text is
8564 yellow with a red box around it. Both the text and the box have an
8568 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
8569 x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
8572 Note that the double quotes are not necessary if spaces are not used
8573 within the parameter list.
8576 Show the text at the center of the video frame:
8578 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
8582 Show the text at a random position, switching to a new position every 30 seconds:
8584 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
8588 Show a text line sliding from right to left in the last row of the video
8589 frame. The file @file{LONG_LINE} is assumed to contain a single line
8592 drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
8596 Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
8598 drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
8602 Draw a single green letter "g", at the center of the input video.
8603 The glyph baseline is placed at half screen height.
8605 drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
8609 Show text for 1 second every 3 seconds:
8611 drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
8615 Use fontconfig to set the font. Note that the colons need to be escaped.
8617 drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
8621 Print the date of a real-time encoding (see strftime(3)):
8623 drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
8627 Show text fading in and out (appearing/disappearing):
8630 DS=1.0 # display start
8631 DE=10.0 # display end
8632 FID=1.5 # fade in duration
8633 FOD=5 # fade out duration
8634 ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%@{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 @}"
8638 Horizontally align multiple separate texts. Note that @option{max_glyph_a}
8639 and the @option{fontsize} value are included in the @option{y} offset.
8641 drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
8642 drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
8647 For more information about libfreetype, check:
8648 @url{http://www.freetype.org/}.
8650 For more information about fontconfig, check:
8651 @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
8653 For more information about libfribidi, check:
8654 @url{http://fribidi.org/}.
8658 Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
8660 The filter accepts the following options:
8665 Set low and high threshold values used by the Canny thresholding
8668 The high threshold selects the "strong" edge pixels, which are then
8669 connected through 8-connectivity with the "weak" edge pixels selected
8670 by the low threshold.
8672 @var{low} and @var{high} threshold values must be chosen in the range
8673 [0,1], and @var{low} should be lesser or equal to @var{high}.
8675 Default value for @var{low} is @code{20/255}, and default value for @var{high}
8679 Define the drawing mode.
8683 Draw white/gray wires on black background.
8686 Mix the colors to create a paint/cartoon effect.
8689 Apply Canny edge detector on all selected planes.
8691 Default value is @var{wires}.
8694 Select planes for filtering. By default all available planes are filtered.
8697 @subsection Examples
8701 Standard edge detection with custom values for the hysteresis thresholding:
8703 edgedetect=low=0.1:high=0.4
8707 Painting effect without thresholding:
8709 edgedetect=mode=colormix:high=0
8714 Set brightness, contrast, saturation and approximate gamma adjustment.
8716 The filter accepts the following options:
8720 Set the contrast expression. The value must be a float value in range
8721 @code{-2.0} to @code{2.0}. The default value is "1".
8724 Set the brightness expression. The value must be a float value in
8725 range @code{-1.0} to @code{1.0}. The default value is "0".
8728 Set the saturation expression. The value must be a float in
8729 range @code{0.0} to @code{3.0}. The default value is "1".
8732 Set the gamma expression. The value must be a float in range
8733 @code{0.1} to @code{10.0}. The default value is "1".
8736 Set the gamma expression for red. The value must be a float in
8737 range @code{0.1} to @code{10.0}. The default value is "1".
8740 Set the gamma expression for green. The value must be a float in range
8741 @code{0.1} to @code{10.0}. The default value is "1".
8744 Set the gamma expression for blue. The value must be a float in range
8745 @code{0.1} to @code{10.0}. The default value is "1".
8748 Set the gamma weight expression. It can be used to reduce the effect
8749 of a high gamma value on bright image areas, e.g. keep them from
8750 getting overamplified and just plain white. The value must be a float
8751 in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
8752 gamma correction all the way down while @code{1.0} leaves it at its
8753 full strength. Default is "1".
8756 Set when the expressions for brightness, contrast, saturation and
8757 gamma expressions are evaluated.
8759 It accepts the following values:
8762 only evaluate expressions once during the filter initialization or
8763 when a command is processed
8766 evaluate expressions for each incoming frame
8769 Default value is @samp{init}.
8772 The expressions accept the following parameters:
8775 frame count of the input frame starting from 0
8778 byte position of the corresponding packet in the input file, NAN if
8782 frame rate of the input video, NAN if the input frame rate is unknown
8785 timestamp expressed in seconds, NAN if the input timestamp is unknown
8788 @subsection Commands
8789 The filter supports the following commands:
8793 Set the contrast expression.
8796 Set the brightness expression.
8799 Set the saturation expression.
8802 Set the gamma expression.
8805 Set the gamma_r expression.
8808 Set gamma_g expression.
8811 Set gamma_b expression.
8814 Set gamma_weight expression.
8816 The command accepts the same syntax of the corresponding option.
8818 If the specified expression is not valid, it is kept at its current
8825 Apply erosion effect to the video.
8827 This filter replaces the pixel by the local(3x3) minimum.
8829 It accepts the following options:
8836 Limit the maximum change for each plane, default is 65535.
8837 If 0, plane will remain unchanged.
8840 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
8843 Flags to local 3x3 coordinates maps like this:
8850 @section extractplanes
8852 Extract color channel components from input video stream into
8853 separate grayscale video streams.
8855 The filter accepts the following option:
8859 Set plane(s) to extract.
8861 Available values for planes are:
8872 Choosing planes not available in the input will result in an error.
8873 That means you cannot select @code{r}, @code{g}, @code{b} planes
8874 with @code{y}, @code{u}, @code{v} planes at same time.
8877 @subsection Examples
8881 Extract luma, u and v color channel component from input video frame
8882 into 3 grayscale outputs:
8884 ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
8890 Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
8892 For each input image, the filter will compute the optimal mapping from
8893 the input to the output given the codebook length, that is the number
8894 of distinct output colors.
8896 This filter accepts the following options.
8899 @item codebook_length, l
8900 Set codebook length. The value must be a positive integer, and
8901 represents the number of distinct output colors. Default value is 256.
8904 Set the maximum number of iterations to apply for computing the optimal
8905 mapping. The higher the value the better the result and the higher the
8906 computation time. Default value is 1.
8909 Set a random seed, must be an integer included between 0 and
8910 UINT32_MAX. If not specified, or if explicitly set to -1, the filter
8911 will try to use a good random seed on a best effort basis.
8914 Set pal8 output pixel format. This option does not work with codebook
8915 length greater than 256.
8920 Measure graylevel entropy in histogram of color channels of video frames.
8922 It accepts the following parameters:
8926 Can be either @var{normal} or @var{diff}. Default is @var{normal}.
8928 @var{diff} mode measures entropy of histogram delta values, absolute differences
8929 between neighbour histogram values.
8934 Apply a fade-in/out effect to the input video.
8936 It accepts the following parameters:
8940 The effect type can be either "in" for a fade-in, or "out" for a fade-out
8942 Default is @code{in}.
8944 @item start_frame, s
8945 Specify the number of the frame to start applying the fade
8946 effect at. Default is 0.
8949 The number of frames that the fade effect lasts. At the end of the
8950 fade-in effect, the output video will have the same intensity as the input video.
8951 At the end of the fade-out transition, the output video will be filled with the
8952 selected @option{color}.
8956 If set to 1, fade only alpha channel, if one exists on the input.
8959 @item start_time, st
8960 Specify the timestamp (in seconds) of the frame to start to apply the fade
8961 effect. If both start_frame and start_time are specified, the fade will start at
8962 whichever comes last. Default is 0.
8965 The number of seconds for which the fade effect has to last. At the end of the
8966 fade-in effect the output video will have the same intensity as the input video,
8967 at the end of the fade-out transition the output video will be filled with the
8968 selected @option{color}.
8969 If both duration and nb_frames are specified, duration is used. Default is 0
8970 (nb_frames is used by default).
8973 Specify the color of the fade. Default is "black".
8976 @subsection Examples
8980 Fade in the first 30 frames of video:
8985 The command above is equivalent to:
8991 Fade out the last 45 frames of a 200-frame video:
8994 fade=type=out:start_frame=155:nb_frames=45
8998 Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
9000 fade=in:0:25, fade=out:975:25
9004 Make the first 5 frames yellow, then fade in from frame 5-24:
9006 fade=in:5:20:color=yellow
9010 Fade in alpha over first 25 frames of video:
9012 fade=in:0:25:alpha=1
9016 Make the first 5.5 seconds black, then fade in for 0.5 seconds:
9018 fade=t=in:st=5.5:d=0.5
9024 Apply arbitrary expressions to samples in frequency domain
9028 Adjust the dc value (gain) of the luma plane of the image. The filter
9029 accepts an integer value in range @code{0} to @code{1000}. The default
9030 value is set to @code{0}.
9033 Adjust the dc value (gain) of the 1st chroma plane of the image. The
9034 filter accepts an integer value in range @code{0} to @code{1000}. The
9035 default value is set to @code{0}.
9038 Adjust the dc value (gain) of the 2nd chroma plane of the image. The
9039 filter accepts an integer value in range @code{0} to @code{1000}. The
9040 default value is set to @code{0}.
9043 Set the frequency domain weight expression for the luma plane.
9046 Set the frequency domain weight expression for the 1st chroma plane.
9049 Set the frequency domain weight expression for the 2nd chroma plane.
9052 Set when the expressions are evaluated.
9054 It accepts the following values:
9057 Only evaluate expressions once during the filter initialization.
9060 Evaluate expressions for each incoming frame.
9063 Default value is @samp{init}.
9065 The filter accepts the following variables:
9068 The coordinates of the current sample.
9072 The width and height of the image.
9075 The number of input frame, starting from 0.
9078 @subsection Examples
9084 fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
9090 fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
9096 fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
9102 fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
9108 Denoise frames using 3D FFT (frequency domain filtering).
9110 The filter accepts the following options:
9114 Set the noise sigma constant. This sets denoising strength.
9115 Default value is 1. Allowed range is from 0 to 30.
9116 Using very high sigma with low overlap may give blocking artifacts.
9119 Set amount of denoising. By default all detected noise is reduced.
9120 Default value is 1. Allowed range is from 0 to 1.
9123 Set size of block, Default is 4, can be 3, 4, 5 or 6.
9124 Actual size of block in pixels is 2 to power of @var{block}, so by default
9125 block size in pixels is 2^4 which is 16.
9128 Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
9131 Set number of previous frames to use for denoising. By default is set to 0.
9134 Set number of next frames to to use for denoising. By default is set to 0.
9137 Set planes which will be filtered, by default are all available filtered
9143 Extract a single field from an interlaced image using stride
9144 arithmetic to avoid wasting CPU time. The output frames are marked as
9147 The filter accepts the following options:
9151 Specify whether to extract the top (if the value is @code{0} or
9152 @code{top}) or the bottom field (if the value is @code{1} or
9158 Create new frames by copying the top and bottom fields from surrounding frames
9159 supplied as numbers by the hint file.
9163 Set file containing hints: absolute/relative frame numbers.
9165 There must be one line for each frame in a clip. Each line must contain two
9166 numbers separated by the comma, optionally followed by @code{-} or @code{+}.
9167 Numbers supplied on each line of file can not be out of [N-1,N+1] where N
9168 is current frame number for @code{absolute} mode or out of [-1, 1] range
9169 for @code{relative} mode. First number tells from which frame to pick up top
9170 field and second number tells from which frame to pick up bottom field.
9172 If optionally followed by @code{+} output frame will be marked as interlaced,
9173 else if followed by @code{-} output frame will be marked as progressive, else
9174 it will be marked same as input frame.
9175 If line starts with @code{#} or @code{;} that line is skipped.
9178 Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
9181 Example of first several lines of @code{hint} file for @code{relative} mode:
9184 1,0 - # second frame, use third's frame top field and second's frame bottom field
9185 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
9202 Field matching filter for inverse telecine. It is meant to reconstruct the
9203 progressive frames from a telecined stream. The filter does not drop duplicated
9204 frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
9205 followed by a decimation filter such as @ref{decimate} in the filtergraph.
9207 The separation of the field matching and the decimation is notably motivated by
9208 the possibility of inserting a de-interlacing filter fallback between the two.
9209 If the source has mixed telecined and real interlaced content,
9210 @code{fieldmatch} will not be able to match fields for the interlaced parts.
9211 But these remaining combed frames will be marked as interlaced, and thus can be
9212 de-interlaced by a later filter such as @ref{yadif} before decimation.
9214 In addition to the various configuration options, @code{fieldmatch} can take an
9215 optional second stream, activated through the @option{ppsrc} option. If
9216 enabled, the frames reconstruction will be based on the fields and frames from
9217 this second stream. This allows the first input to be pre-processed in order to
9218 help the various algorithms of the filter, while keeping the output lossless
9219 (assuming the fields are matched properly). Typically, a field-aware denoiser,
9220 or brightness/contrast adjustments can help.
9222 Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
9223 and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
9224 which @code{fieldmatch} is based on. While the semantic and usage are very
9225 close, some behaviour and options names can differ.
9227 The @ref{decimate} filter currently only works for constant frame rate input.
9228 If your input has mixed telecined (30fps) and progressive content with a lower
9229 framerate like 24fps use the following filterchain to produce the necessary cfr
9230 stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
9232 The filter accepts the following options:
9236 Specify the assumed field order of the input stream. Available values are:
9240 Auto detect parity (use FFmpeg's internal parity value).
9242 Assume bottom field first.
9244 Assume top field first.
9247 Note that it is sometimes recommended not to trust the parity announced by the
9250 Default value is @var{auto}.
9253 Set the matching mode or strategy to use. @option{pc} mode is the safest in the
9254 sense that it won't risk creating jerkiness due to duplicate frames when
9255 possible, but if there are bad edits or blended fields it will end up
9256 outputting combed frames when a good match might actually exist. On the other
9257 hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
9258 but will almost always find a good frame if there is one. The other values are
9259 all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
9260 jerkiness and creating duplicate frames versus finding good matches in sections
9261 with bad edits, orphaned fields, blended fields, etc.
9263 More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
9265 Available values are:
9269 2-way matching (p/c)
9271 2-way matching, and trying 3rd match if still combed (p/c + n)
9273 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
9275 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
9276 still combed (p/c + n + u/b)
9278 3-way matching (p/c/n)
9280 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
9281 detected as combed (p/c/n + u/b)
9284 The parenthesis at the end indicate the matches that would be used for that
9285 mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
9288 In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
9291 Default value is @var{pc_n}.
9294 Mark the main input stream as a pre-processed input, and enable the secondary
9295 input stream as the clean source to pick the fields from. See the filter
9296 introduction for more details. It is similar to the @option{clip2} feature from
9299 Default value is @code{0} (disabled).
9302 Set the field to match from. It is recommended to set this to the same value as
9303 @option{order} unless you experience matching failures with that setting. In
9304 certain circumstances changing the field that is used to match from can have a
9305 large impact on matching performance. Available values are:
9309 Automatic (same value as @option{order}).
9311 Match from the bottom field.
9313 Match from the top field.
9316 Default value is @var{auto}.
9319 Set whether or not chroma is included during the match comparisons. In most
9320 cases it is recommended to leave this enabled. You should set this to @code{0}
9321 only if your clip has bad chroma problems such as heavy rainbowing or other
9322 artifacts. Setting this to @code{0} could also be used to speed things up at
9323 the cost of some accuracy.
9325 Default value is @code{1}.
9329 These define an exclusion band which excludes the lines between @option{y0} and
9330 @option{y1} from being included in the field matching decision. An exclusion
9331 band can be used to ignore subtitles, a logo, or other things that may
9332 interfere with the matching. @option{y0} sets the starting scan line and
9333 @option{y1} sets the ending line; all lines in between @option{y0} and
9334 @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
9335 @option{y0} and @option{y1} to the same value will disable the feature.
9336 @option{y0} and @option{y1} defaults to @code{0}.
9339 Set the scene change detection threshold as a percentage of maximum change on
9340 the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
9341 detection is only relevant in case @option{combmatch}=@var{sc}. The range for
9342 @option{scthresh} is @code{[0.0, 100.0]}.
9344 Default value is @code{12.0}.
9347 When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
9348 account the combed scores of matches when deciding what match to use as the
9349 final match. Available values are:
9353 No final matching based on combed scores.
9355 Combed scores are only used when a scene change is detected.
9357 Use combed scores all the time.
9360 Default is @var{sc}.
9363 Force @code{fieldmatch} to calculate the combed metrics for certain matches and
9364 print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
9365 Available values are:
9369 No forced calculation.
9371 Force p/c/n calculations.
9373 Force p/c/n/u/b calculations.
9376 Default value is @var{none}.
9379 This is the area combing threshold used for combed frame detection. This
9380 essentially controls how "strong" or "visible" combing must be to be detected.
9381 Larger values mean combing must be more visible and smaller values mean combing
9382 can be less visible or strong and still be detected. Valid settings are from
9383 @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
9384 be detected as combed). This is basically a pixel difference value. A good
9385 range is @code{[8, 12]}.
9387 Default value is @code{9}.
9390 Sets whether or not chroma is considered in the combed frame decision. Only
9391 disable this if your source has chroma problems (rainbowing, etc.) that are
9392 causing problems for the combed frame detection with chroma enabled. Actually,
9393 using @option{chroma}=@var{0} is usually more reliable, except for the case
9394 where there is chroma only combing in the source.
9396 Default value is @code{0}.
9400 Respectively set the x-axis and y-axis size of the window used during combed
9401 frame detection. This has to do with the size of the area in which
9402 @option{combpel} pixels are required to be detected as combed for a frame to be
9403 declared combed. See the @option{combpel} parameter description for more info.
9404 Possible values are any number that is a power of 2 starting at 4 and going up
9407 Default value is @code{16}.
9410 The number of combed pixels inside any of the @option{blocky} by
9411 @option{blockx} size blocks on the frame for the frame to be detected as
9412 combed. While @option{cthresh} controls how "visible" the combing must be, this
9413 setting controls "how much" combing there must be in any localized area (a
9414 window defined by the @option{blockx} and @option{blocky} settings) on the
9415 frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
9416 which point no frames will ever be detected as combed). This setting is known
9417 as @option{MI} in TFM/VFM vocabulary.
9419 Default value is @code{80}.
9422 @anchor{p/c/n/u/b meaning}
9423 @subsection p/c/n/u/b meaning
9425 @subsubsection p/c/n
9427 We assume the following telecined stream:
9430 Top fields: 1 2 2 3 4
9431 Bottom fields: 1 2 3 4 4
9434 The numbers correspond to the progressive frame the fields relate to. Here, the
9435 first two frames are progressive, the 3rd and 4th are combed, and so on.
9437 When @code{fieldmatch} is configured to run a matching from bottom
9438 (@option{field}=@var{bottom}) this is how this input stream get transformed:
9443 B 1 2 3 4 4 <-- matching reference
9452 As a result of the field matching, we can see that some frames get duplicated.
9453 To perform a complete inverse telecine, you need to rely on a decimation filter
9454 after this operation. See for instance the @ref{decimate} filter.
9456 The same operation now matching from top fields (@option{field}=@var{top})
9461 T 1 2 2 3 4 <-- matching reference
9471 In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
9472 basically, they refer to the frame and field of the opposite parity:
9475 @item @var{p} matches the field of the opposite parity in the previous frame
9476 @item @var{c} matches the field of the opposite parity in the current frame
9477 @item @var{n} matches the field of the opposite parity in the next frame
9482 The @var{u} and @var{b} matching are a bit special in the sense that they match
9483 from the opposite parity flag. In the following examples, we assume that we are
9484 currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
9485 'x' is placed above and below each matched fields.
9487 With bottom matching (@option{field}=@var{bottom}):
9492 Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
9493 Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
9501 With top matching (@option{field}=@var{top}):
9506 Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
9507 Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
9515 @subsection Examples
9517 Simple IVTC of a top field first telecined stream:
9519 fieldmatch=order=tff:combmatch=none, decimate
9522 Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
9524 fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
9529 Transform the field order of the input video.
9531 It accepts the following parameters:
9536 The output field order. Valid values are @var{tff} for top field first or @var{bff}
9537 for bottom field first.
9540 The default value is @samp{tff}.
9542 The transformation is done by shifting the picture content up or down
9543 by one line, and filling the remaining line with appropriate picture content.
9544 This method is consistent with most broadcast field order converters.
9546 If the input video is not flagged as being interlaced, or it is already
9547 flagged as being of the required output field order, then this filter does
9548 not alter the incoming video.
9550 It is very useful when converting to or from PAL DV material,
9551 which is bottom field first.
9555 ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
9558 @section fifo, afifo
9560 Buffer input images and send them when they are requested.
9562 It is mainly useful when auto-inserted by the libavfilter
9565 It does not take parameters.
9567 @section fillborders
9569 Fill borders of the input video, without changing video stream dimensions.
9570 Sometimes video can have garbage at the four edges and you may not want to
9571 crop video input to keep size multiple of some number.
9573 This filter accepts the following options:
9577 Number of pixels to fill from left border.
9580 Number of pixels to fill from right border.
9583 Number of pixels to fill from top border.
9586 Number of pixels to fill from bottom border.
9591 It accepts the following values:
9594 fill pixels using outermost pixels
9597 fill pixels using mirroring
9600 fill pixels with constant value
9603 Default is @var{smear}.
9606 Set color for pixels in fixed mode. Default is @var{black}.
9611 Find a rectangular object
9613 It accepts the following options:
9617 Filepath of the object image, needs to be in gray8.
9620 Detection threshold, default is 0.5.
9623 Number of mipmaps, default is 3.
9625 @item xmin, ymin, xmax, ymax
9626 Specifies the rectangle in which to search.
9629 @subsection Examples
9633 Generate a representative palette of a given video using @command{ffmpeg}:
9635 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
9641 Cover a rectangular object
9643 It accepts the following options:
9647 Filepath of the optional cover image, needs to be in yuv420.
9652 It accepts the following values:
9655 cover it by the supplied image
9657 cover it by interpolating the surrounding pixels
9660 Default value is @var{blur}.
9663 @subsection Examples
9667 Generate a representative palette of a given video using @command{ffmpeg}:
9669 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
9675 Flood area with values of same pixel components with another values.
9677 It accepts the following options:
9680 Set pixel x coordinate.
9683 Set pixel y coordinate.
9686 Set source #0 component value.
9689 Set source #1 component value.
9692 Set source #2 component value.
9695 Set source #3 component value.
9698 Set destination #0 component value.
9701 Set destination #1 component value.
9704 Set destination #2 component value.
9707 Set destination #3 component value.
9713 Convert the input video to one of the specified pixel formats.
9714 Libavfilter will try to pick one that is suitable as input to
9717 It accepts the following parameters:
9721 A '|'-separated list of pixel format names, such as
9722 "pix_fmts=yuv420p|monow|rgb24".
9726 @subsection Examples
9730 Convert the input video to the @var{yuv420p} format
9732 format=pix_fmts=yuv420p
9735 Convert the input video to any of the formats in the list
9737 format=pix_fmts=yuv420p|yuv444p|yuv410p
9744 Convert the video to specified constant frame rate by duplicating or dropping
9745 frames as necessary.
9747 It accepts the following parameters:
9751 The desired output frame rate. The default is @code{25}.
9754 Assume the first PTS should be the given value, in seconds. This allows for
9755 padding/trimming at the start of stream. By default, no assumption is made
9756 about the first frame's expected PTS, so no padding or trimming is done.
9757 For example, this could be set to 0 to pad the beginning with duplicates of
9758 the first frame if a video stream starts after the audio stream or to trim any
9759 frames with a negative PTS.
9762 Timestamp (PTS) rounding method.
9764 Possible values are:
9771 round towards -infinity
9773 round towards +infinity
9777 The default is @code{near}.
9780 Action performed when reading the last frame.
9782 Possible values are:
9785 Use same timestamp rounding method as used for other frames.
9787 Pass through last frame if input duration has not been reached yet.
9789 The default is @code{round}.
9793 Alternatively, the options can be specified as a flat string:
9794 @var{fps}[:@var{start_time}[:@var{round}]].
9796 See also the @ref{setpts} filter.
9798 @subsection Examples
9802 A typical usage in order to set the fps to 25:
9808 Sets the fps to 24, using abbreviation and rounding method to round to nearest:
9810 fps=fps=film:round=near
9816 Pack two different video streams into a stereoscopic video, setting proper
9817 metadata on supported codecs. The two views should have the same size and
9818 framerate and processing will stop when the shorter video ends. Please note
9819 that you may conveniently adjust view properties with the @ref{scale} and
9822 It accepts the following parameters:
9826 The desired packing format. Supported values are:
9831 The views are next to each other (default).
9834 The views are on top of each other.
9837 The views are packed by line.
9840 The views are packed by column.
9843 The views are temporally interleaved.
9852 # Convert left and right views into a frame-sequential video
9853 ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
9855 # Convert views into a side-by-side video with the same output resolution as the input
9856 ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
9861 Change the frame rate by interpolating new video output frames from the source
9864 This filter is not designed to function correctly with interlaced media. If
9865 you wish to change the frame rate of interlaced media then you are required
9866 to deinterlace before this filter and re-interlace after this filter.
9868 A description of the accepted options follows.
9872 Specify the output frames per second. This option can also be specified
9873 as a value alone. The default is @code{50}.
9876 Specify the start of a range where the output frame will be created as a
9877 linear interpolation of two frames. The range is [@code{0}-@code{255}],
9878 the default is @code{15}.
9881 Specify the end of a range where the output frame will be created as a
9882 linear interpolation of two frames. The range is [@code{0}-@code{255}],
9883 the default is @code{240}.
9886 Specify the level at which a scene change is detected as a value between
9887 0 and 100 to indicate a new scene; a low value reflects a low
9888 probability for the current frame to introduce a new scene, while a higher
9889 value means the current frame is more likely to be one.
9890 The default is @code{8.2}.
9893 Specify flags influencing the filter process.
9895 Available value for @var{flags} is:
9898 @item scene_change_detect, scd
9899 Enable scene change detection using the value of the option @var{scene}.
9900 This flag is enabled by default.
9906 Select one frame every N-th frame.
9908 This filter accepts the following option:
9911 Select frame after every @code{step} frames.
9912 Allowed values are positive integers higher than 0. Default value is @code{1}.
9918 Apply a frei0r effect to the input video.
9920 To enable the compilation of this filter, you need to install the frei0r
9921 header and configure FFmpeg with @code{--enable-frei0r}.
9923 It accepts the following parameters:
9928 The name of the frei0r effect to load. If the environment variable
9929 @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
9930 directories specified by the colon-separated list in @env{FREI0R_PATH}.
9931 Otherwise, the standard frei0r paths are searched, in this order:
9932 @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
9933 @file{/usr/lib/frei0r-1/}.
9936 A '|'-separated list of parameters to pass to the frei0r effect.
9940 A frei0r effect parameter can be a boolean (its value is either
9941 "y" or "n"), a double, a color (specified as
9942 @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
9943 numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
9944 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
9945 a position (specified as @var{X}/@var{Y}, where
9946 @var{X} and @var{Y} are floating point numbers) and/or a string.
9948 The number and types of parameters depend on the loaded effect. If an
9949 effect parameter is not specified, the default value is set.
9951 @subsection Examples
9955 Apply the distort0r effect, setting the first two double parameters:
9957 frei0r=filter_name=distort0r:filter_params=0.5|0.01
9961 Apply the colordistance effect, taking a color as the first parameter:
9963 frei0r=colordistance:0.2/0.3/0.4
9964 frei0r=colordistance:violet
9965 frei0r=colordistance:0x112233
9969 Apply the perspective effect, specifying the top left and top right image
9972 frei0r=perspective:0.2/0.2|0.8/0.2
9976 For more information, see
9977 @url{http://frei0r.dyne.org}
9981 Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
9983 It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
9984 processing filter, one of them is performed once per block, not per pixel.
9985 This allows for much higher speed.
9987 The filter accepts the following options:
9991 Set quality. This option defines the number of levels for averaging. It accepts
9992 an integer in the range 4-5. Default value is @code{4}.
9995 Force a constant quantization parameter. It accepts an integer in range 0-63.
9996 If not set, the filter will use the QP from the video stream (if available).
9999 Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
10000 more details but also more artifacts, while higher values make the image smoother
10001 but also blurrier. Default value is @code{0} − PSNR optimal.
10003 @item use_bframe_qp
10004 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
10005 option may cause flicker since the B-Frames have often larger QP. Default is
10006 @code{0} (not enabled).
10012 Apply Gaussian blur filter.
10014 The filter accepts the following options:
10018 Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
10021 Set number of steps for Gaussian approximation. Defauls is @code{1}.
10024 Set which planes to filter. By default all planes are filtered.
10027 Set vertical sigma, if negative it will be same as @code{sigma}.
10028 Default is @code{-1}.
10033 The filter accepts the following options:
10036 @item lum_expr, lum
10037 Set the luminance expression.
10039 Set the chrominance blue expression.
10041 Set the chrominance red expression.
10042 @item alpha_expr, a
10043 Set the alpha expression.
10045 Set the red expression.
10046 @item green_expr, g
10047 Set the green expression.
10049 Set the blue expression.
10052 The colorspace is selected according to the specified options. If one
10053 of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
10054 options is specified, the filter will automatically select a YCbCr
10055 colorspace. If one of the @option{red_expr}, @option{green_expr}, or
10056 @option{blue_expr} options is specified, it will select an RGB
10059 If one of the chrominance expression is not defined, it falls back on the other
10060 one. If no alpha expression is specified it will evaluate to opaque value.
10061 If none of chrominance expressions are specified, they will evaluate
10062 to the luminance expression.
10064 The expressions can use the following variables and functions:
10068 The sequential number of the filtered frame, starting from @code{0}.
10072 The coordinates of the current sample.
10076 The width and height of the image.
10080 Width and height scale depending on the currently filtered plane. It is the
10081 ratio between the corresponding luma plane number of pixels and the current
10082 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
10083 @code{0.5,0.5} for chroma planes.
10086 Time of the current frame, expressed in seconds.
10089 Return the value of the pixel at location (@var{x},@var{y}) of the current
10093 Return the value of the pixel at location (@var{x},@var{y}) of the luminance
10097 Return the value of the pixel at location (@var{x},@var{y}) of the
10098 blue-difference chroma plane. Return 0 if there is no such plane.
10101 Return the value of the pixel at location (@var{x},@var{y}) of the
10102 red-difference chroma plane. Return 0 if there is no such plane.
10107 Return the value of the pixel at location (@var{x},@var{y}) of the
10108 red/green/blue component. Return 0 if there is no such component.
10111 Return the value of the pixel at location (@var{x},@var{y}) of the alpha
10112 plane. Return 0 if there is no such plane.
10115 For functions, if @var{x} and @var{y} are outside the area, the value will be
10116 automatically clipped to the closer edge.
10118 @subsection Examples
10122 Flip the image horizontally:
10128 Generate a bidimensional sine wave, with angle @code{PI/3} and a
10129 wavelength of 100 pixels:
10131 geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
10135 Generate a fancy enigmatic moving light:
10137 nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
10141 Generate a quick emboss effect:
10143 format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
10147 Modify RGB components depending on pixel position:
10149 geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
10153 Create a radial gradient that is the same size as the input (also see
10154 the @ref{vignette} filter):
10156 geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
10162 Fix the banding artifacts that are sometimes introduced into nearly flat
10163 regions by truncation to 8-bit color depth.
10164 Interpolate the gradients that should go where the bands are, and
10167 It is designed for playback only. Do not use it prior to
10168 lossy compression, because compression tends to lose the dither and
10169 bring back the bands.
10171 It accepts the following parameters:
10176 The maximum amount by which the filter will change any one pixel. This is also
10177 the threshold for detecting nearly flat regions. Acceptable values range from
10178 .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
10182 The neighborhood to fit the gradient to. A larger radius makes for smoother
10183 gradients, but also prevents the filter from modifying the pixels near detailed
10184 regions. Acceptable values are 8-32; the default value is 16. Out-of-range
10185 values will be clipped to the valid range.
10189 Alternatively, the options can be specified as a flat string:
10190 @var{strength}[:@var{radius}]
10192 @subsection Examples
10196 Apply the filter with a @code{3.5} strength and radius of @code{8}:
10202 Specify radius, omitting the strength (which will fall-back to the default
10211 A color constancy variation filter which estimates scene illumination via grey edge algorithm
10212 and corrects the scene colors accordingly.
10214 See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
10216 The filter accepts the following options:
10220 The order of differentiation to be applied on the scene. Must be chosen in the range
10221 [0,2] and default value is 1.
10224 The Minkowski parameter to be used for calculating the Minkowski distance. Must
10225 be chosen in the range [0,20] and default value is 1. Set to 0 for getting
10226 max value instead of calculating Minkowski distance.
10229 The standard deviation of Gaussian blur to be applied on the scene. Must be
10230 chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
10231 can't be euqal to 0 if @var{difford} is greater than 0.
10234 @subsection Examples
10240 greyedge=difford=1:minknorm=5:sigma=2
10246 greyedge=difford=1:minknorm=0:sigma=2
10254 Apply a Hald CLUT to a video stream.
10256 First input is the video stream to process, and second one is the Hald CLUT.
10257 The Hald CLUT input can be a simple picture or a complete video stream.
10259 The filter accepts the following options:
10263 Force termination when the shortest input terminates. Default is @code{0}.
10265 Continue applying the last CLUT after the end of the stream. A value of
10266 @code{0} disable the filter after the last frame of the CLUT is reached.
10267 Default is @code{1}.
10270 @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
10271 filters share the same internals).
10273 More information about the Hald CLUT can be found on Eskil Steenberg's website
10274 (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
10276 @subsection Workflow examples
10278 @subsubsection Hald CLUT video stream
10280 Generate an identity Hald CLUT stream altered with various effects:
10282 ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
10285 Note: make sure you use a lossless codec.
10287 Then use it with @code{haldclut} to apply it on some random stream:
10289 ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
10292 The Hald CLUT will be applied to the 10 first seconds (duration of
10293 @file{clut.nut}), then the latest picture of that CLUT stream will be applied
10294 to the remaining frames of the @code{mandelbrot} stream.
10296 @subsubsection Hald CLUT with preview
10298 A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
10299 @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
10300 biggest possible square starting at the top left of the picture. The remaining
10301 padding pixels (bottom or right) will be ignored. This area can be used to add
10302 a preview of the Hald CLUT.
10304 Typically, the following generated Hald CLUT will be supported by the
10305 @code{haldclut} filter:
10308 ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
10309 pad=iw+320 [padded_clut];
10310 smptebars=s=320x256, split [a][b];
10311 [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
10312 [main][b] overlay=W-320" -frames:v 1 clut.png
10315 It contains the original and a preview of the effect of the CLUT: SMPTE color
10316 bars are displayed on the right-top, and below the same color bars processed by
10319 Then, the effect of this Hald CLUT can be visualized with:
10321 ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
10326 Flip the input video horizontally.
10328 For example, to horizontally flip the input video with @command{ffmpeg}:
10330 ffmpeg -i in.avi -vf "hflip" out.avi
10334 This filter applies a global color histogram equalization on a
10337 It can be used to correct video that has a compressed range of pixel
10338 intensities. The filter redistributes the pixel intensities to
10339 equalize their distribution across the intensity range. It may be
10340 viewed as an "automatically adjusting contrast filter". This filter is
10341 useful only for correcting degraded or poorly captured source
10344 The filter accepts the following options:
10348 Determine the amount of equalization to be applied. As the strength
10349 is reduced, the distribution of pixel intensities more-and-more
10350 approaches that of the input frame. The value must be a float number
10351 in the range [0,1] and defaults to 0.200.
10354 Set the maximum intensity that can generated and scale the output
10355 values appropriately. The strength should be set as desired and then
10356 the intensity can be limited if needed to avoid washing-out. The value
10357 must be a float number in the range [0,1] and defaults to 0.210.
10360 Set the antibanding level. If enabled the filter will randomly vary
10361 the luminance of output pixels by a small amount to avoid banding of
10362 the histogram. Possible values are @code{none}, @code{weak} or
10363 @code{strong}. It defaults to @code{none}.
10368 Compute and draw a color distribution histogram for the input video.
10370 The computed histogram is a representation of the color component
10371 distribution in an image.
10373 Standard histogram displays the color components distribution in an image.
10374 Displays color graph for each color component. Shows distribution of
10375 the Y, U, V, A or R, G, B components, depending on input format, in the
10376 current frame. Below each graph a color component scale meter is shown.
10378 The filter accepts the following options:
10382 Set height of level. Default value is @code{200}.
10383 Allowed range is [50, 2048].
10386 Set height of color scale. Default value is @code{12}.
10387 Allowed range is [0, 40].
10391 It accepts the following values:
10394 Per color component graphs are placed below each other.
10397 Per color component graphs are placed side by side.
10400 Presents information identical to that in the @code{parade}, except
10401 that the graphs representing color components are superimposed directly
10404 Default is @code{stack}.
10407 Set mode. Can be either @code{linear}, or @code{logarithmic}.
10408 Default is @code{linear}.
10411 Set what color components to display.
10412 Default is @code{7}.
10415 Set foreground opacity. Default is @code{0.7}.
10418 Set background opacity. Default is @code{0.5}.
10421 @subsection Examples
10426 Calculate and draw histogram:
10428 ffplay -i input -vf histogram
10436 This is a high precision/quality 3d denoise filter. It aims to reduce
10437 image noise, producing smooth images and making still images really
10438 still. It should enhance compressibility.
10440 It accepts the following optional parameters:
10444 A non-negative floating point number which specifies spatial luma strength.
10445 It defaults to 4.0.
10447 @item chroma_spatial
10448 A non-negative floating point number which specifies spatial chroma strength.
10449 It defaults to 3.0*@var{luma_spatial}/4.0.
10452 A floating point number which specifies luma temporal strength. It defaults to
10453 6.0*@var{luma_spatial}/4.0.
10456 A floating point number which specifies chroma temporal strength. It defaults to
10457 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
10460 @section hwdownload
10462 Download hardware frames to system memory.
10464 The input must be in hardware frames, and the output a non-hardware format.
10465 Not all formats will be supported on the output - it may be necessary to insert
10466 an additional @option{format} filter immediately following in the graph to get
10467 the output in a supported format.
10471 Map hardware frames to system memory or to another device.
10473 This filter has several different modes of operation; which one is used depends
10474 on the input and output formats:
10477 Hardware frame input, normal frame output
10479 Map the input frames to system memory and pass them to the output. If the
10480 original hardware frame is later required (for example, after overlaying
10481 something else on part of it), the @option{hwmap} filter can be used again
10482 in the next mode to retrieve it.
10484 Normal frame input, hardware frame output
10486 If the input is actually a software-mapped hardware frame, then unmap it -
10487 that is, return the original hardware frame.
10489 Otherwise, a device must be provided. Create new hardware surfaces on that
10490 device for the output, then map them back to the software format at the input
10491 and give those frames to the preceding filter. This will then act like the
10492 @option{hwupload} filter, but may be able to avoid an additional copy when
10493 the input is already in a compatible format.
10495 Hardware frame input and output
10497 A device must be supplied for the output, either directly or with the
10498 @option{derive_device} option. The input and output devices must be of
10499 different types and compatible - the exact meaning of this is
10500 system-dependent, but typically it means that they must refer to the same
10501 underlying hardware context (for example, refer to the same graphics card).
10503 If the input frames were originally created on the output device, then unmap
10504 to retrieve the original frames.
10506 Otherwise, map the frames to the output device - create new hardware frames
10507 on the output corresponding to the frames on the input.
10510 The following additional parameters are accepted:
10514 Set the frame mapping mode. Some combination of:
10517 The mapped frame should be readable.
10519 The mapped frame should be writeable.
10521 The mapping will always overwrite the entire frame.
10523 This may improve performance in some cases, as the original contents of the
10524 frame need not be loaded.
10526 The mapping must not involve any copying.
10528 Indirect mappings to copies of frames are created in some cases where either
10529 direct mapping is not possible or it would have unexpected properties.
10530 Setting this flag ensures that the mapping is direct and will fail if that is
10533 Defaults to @var{read+write} if not specified.
10535 @item derive_device @var{type}
10536 Rather than using the device supplied at initialisation, instead derive a new
10537 device of type @var{type} from the device the input frames exist on.
10540 In a hardware to hardware mapping, map in reverse - create frames in the sink
10541 and map them back to the source. This may be necessary in some cases where
10542 a mapping in one direction is required but only the opposite direction is
10543 supported by the devices being used.
10545 This option is dangerous - it may break the preceding filter in undefined
10546 ways if there are any additional constraints on that filter's output.
10547 Do not use it without fully understanding the implications of its use.
10552 Upload system memory frames to hardware surfaces.
10554 The device to upload to must be supplied when the filter is initialised. If
10555 using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
10558 @anchor{hwupload_cuda}
10559 @section hwupload_cuda
10561 Upload system memory frames to a CUDA device.
10563 It accepts the following optional parameters:
10567 The number of the CUDA device to use
10572 Apply a high-quality magnification filter designed for pixel art. This filter
10573 was originally created by Maxim Stepin.
10575 It accepts the following option:
10579 Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
10580 @code{hq3x} and @code{4} for @code{hq4x}.
10581 Default is @code{3}.
10585 Stack input videos horizontally.
10587 All streams must be of same pixel format and of same height.
10589 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
10590 to create same output.
10592 The filter accept the following option:
10596 Set number of input streams. Default is 2.
10599 If set to 1, force the output to terminate when the shortest input
10600 terminates. Default value is 0.
10605 Modify the hue and/or the saturation of the input.
10607 It accepts the following parameters:
10611 Specify the hue angle as a number of degrees. It accepts an expression,
10612 and defaults to "0".
10615 Specify the saturation in the [-10,10] range. It accepts an expression and
10619 Specify the hue angle as a number of radians. It accepts an
10620 expression, and defaults to "0".
10623 Specify the brightness in the [-10,10] range. It accepts an expression and
10627 @option{h} and @option{H} are mutually exclusive, and can't be
10628 specified at the same time.
10630 The @option{b}, @option{h}, @option{H} and @option{s} option values are
10631 expressions containing the following constants:
10635 frame count of the input frame starting from 0
10638 presentation timestamp of the input frame expressed in time base units
10641 frame rate of the input video, NAN if the input frame rate is unknown
10644 timestamp expressed in seconds, NAN if the input timestamp is unknown
10647 time base of the input video
10650 @subsection Examples
10654 Set the hue to 90 degrees and the saturation to 1.0:
10660 Same command but expressing the hue in radians:
10666 Rotate hue and make the saturation swing between 0
10667 and 2 over a period of 1 second:
10669 hue="H=2*PI*t: s=sin(2*PI*t)+1"
10673 Apply a 3 seconds saturation fade-in effect starting at 0:
10675 hue="s=min(t/3\,1)"
10678 The general fade-in expression can be written as:
10680 hue="s=min(0\, max((t-START)/DURATION\, 1))"
10684 Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
10686 hue="s=max(0\, min(1\, (8-t)/3))"
10689 The general fade-out expression can be written as:
10691 hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
10696 @subsection Commands
10698 This filter supports the following commands:
10704 Modify the hue and/or the saturation and/or brightness of the input video.
10705 The command accepts the same syntax of the corresponding option.
10707 If the specified expression is not valid, it is kept at its current
10711 @section hysteresis
10713 Grow first stream into second stream by connecting components.
10714 This makes it possible to build more robust edge masks.
10716 This filter accepts the following options:
10720 Set which planes will be processed as bitmap, unprocessed planes will be
10721 copied from first stream.
10722 By default value 0xf, all planes will be processed.
10725 Set threshold which is used in filtering. If pixel component value is higher than
10726 this value filter algorithm for connecting components is activated.
10727 By default value is 0.
10732 Detect video interlacing type.
10734 This filter tries to detect if the input frames are interlaced, progressive,
10735 top or bottom field first. It will also try to detect fields that are
10736 repeated between adjacent frames (a sign of telecine).
10738 Single frame detection considers only immediately adjacent frames when classifying each frame.
10739 Multiple frame detection incorporates the classification history of previous frames.
10741 The filter will log these metadata values:
10744 @item single.current_frame
10745 Detected type of current frame using single-frame detection. One of:
10746 ``tff'' (top field first), ``bff'' (bottom field first),
10747 ``progressive'', or ``undetermined''
10750 Cumulative number of frames detected as top field first using single-frame detection.
10753 Cumulative number of frames detected as top field first using multiple-frame detection.
10756 Cumulative number of frames detected as bottom field first using single-frame detection.
10758 @item multiple.current_frame
10759 Detected type of current frame using multiple-frame detection. One of:
10760 ``tff'' (top field first), ``bff'' (bottom field first),
10761 ``progressive'', or ``undetermined''
10764 Cumulative number of frames detected as bottom field first using multiple-frame detection.
10766 @item single.progressive
10767 Cumulative number of frames detected as progressive using single-frame detection.
10769 @item multiple.progressive
10770 Cumulative number of frames detected as progressive using multiple-frame detection.
10772 @item single.undetermined
10773 Cumulative number of frames that could not be classified using single-frame detection.
10775 @item multiple.undetermined
10776 Cumulative number of frames that could not be classified using multiple-frame detection.
10778 @item repeated.current_frame
10779 Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
10781 @item repeated.neither
10782 Cumulative number of frames with no repeated field.
10785 Cumulative number of frames with the top field repeated from the previous frame's top field.
10787 @item repeated.bottom
10788 Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
10791 The filter accepts the following options:
10795 Set interlacing threshold.
10797 Set progressive threshold.
10799 Threshold for repeated field detection.
10801 Number of frames after which a given frame's contribution to the
10802 statistics is halved (i.e., it contributes only 0.5 to its
10803 classification). The default of 0 means that all frames seen are given
10804 full weight of 1.0 forever.
10805 @item analyze_interlaced_flag
10806 When this is not 0 then idet will use the specified number of frames to determine
10807 if the interlaced flag is accurate, it will not count undetermined frames.
10808 If the flag is found to be accurate it will be used without any further
10809 computations, if it is found to be inaccurate it will be cleared without any
10810 further computations. This allows inserting the idet filter as a low computational
10811 method to clean up the interlaced flag
10816 Deinterleave or interleave fields.
10818 This filter allows one to process interlaced images fields without
10819 deinterlacing them. Deinterleaving splits the input frame into 2
10820 fields (so called half pictures). Odd lines are moved to the top
10821 half of the output image, even lines to the bottom half.
10822 You can process (filter) them independently and then re-interleave them.
10824 The filter accepts the following options:
10828 @item chroma_mode, c
10829 @item alpha_mode, a
10830 Available values for @var{luma_mode}, @var{chroma_mode} and
10831 @var{alpha_mode} are:
10837 @item deinterleave, d
10838 Deinterleave fields, placing one above the other.
10840 @item interleave, i
10841 Interleave fields. Reverse the effect of deinterleaving.
10843 Default value is @code{none}.
10845 @item luma_swap, ls
10846 @item chroma_swap, cs
10847 @item alpha_swap, as
10848 Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
10853 Apply inflate effect to the video.
10855 This filter replaces the pixel by the local(3x3) average by taking into account
10856 only values higher than the pixel.
10858 It accepts the following options:
10865 Limit the maximum change for each plane, default is 65535.
10866 If 0, plane will remain unchanged.
10871 Simple interlacing filter from progressive contents. This interleaves upper (or
10872 lower) lines from odd frames with lower (or upper) lines from even frames,
10873 halving the frame rate and preserving image height.
10876 Original Original New Frame
10877 Frame 'j' Frame 'j+1' (tff)
10878 ========== =========== ==================
10879 Line 0 --------------------> Frame 'j' Line 0
10880 Line 1 Line 1 ----> Frame 'j+1' Line 1
10881 Line 2 ---------------------> Frame 'j' Line 2
10882 Line 3 Line 3 ----> Frame 'j+1' Line 3
10884 New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
10887 It accepts the following optional parameters:
10891 This determines whether the interlaced frame is taken from the even
10892 (tff - default) or odd (bff) lines of the progressive frame.
10895 Vertical lowpass filter to avoid twitter interlacing and
10896 reduce moire patterns.
10900 Disable vertical lowpass filter
10903 Enable linear filter (default)
10906 Enable complex filter. This will slightly less reduce twitter and moire
10907 but better retain detail and subjective sharpness impression.
10914 Deinterlace input video by applying Donald Graft's adaptive kernel
10915 deinterling. Work on interlaced parts of a video to produce
10916 progressive frames.
10918 The description of the accepted parameters follows.
10922 Set the threshold which affects the filter's tolerance when
10923 determining if a pixel line must be processed. It must be an integer
10924 in the range [0,255] and defaults to 10. A value of 0 will result in
10925 applying the process on every pixels.
10928 Paint pixels exceeding the threshold value to white if set to 1.
10932 Set the fields order. Swap fields if set to 1, leave fields alone if
10936 Enable additional sharpening if set to 1. Default is 0.
10939 Enable twoway sharpening if set to 1. Default is 0.
10942 @subsection Examples
10946 Apply default values:
10948 kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
10952 Enable additional sharpening:
10958 Paint processed pixels in white:
10964 @section lenscorrection
10966 Correct radial lens distortion
10968 This filter can be used to correct for radial distortion as can result from the use
10969 of wide angle lenses, and thereby re-rectify the image. To find the right parameters
10970 one can use tools available for example as part of opencv or simply trial-and-error.
10971 To use opencv use the calibration sample (under samples/cpp) from the opencv sources
10972 and extract the k1 and k2 coefficients from the resulting matrix.
10974 Note that effectively the same filter is available in the open-source tools Krita and
10975 Digikam from the KDE project.
10977 In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
10978 this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
10979 brightness distribution, so you may want to use both filters together in certain
10980 cases, though you will have to take care of ordering, i.e. whether vignetting should
10981 be applied before or after lens correction.
10983 @subsection Options
10985 The filter accepts the following options:
10989 Relative x-coordinate of the focal point of the image, and thereby the center of the
10990 distortion. This value has a range [0,1] and is expressed as fractions of the image
10991 width. Default is 0.5.
10993 Relative y-coordinate of the focal point of the image, and thereby the center of the
10994 distortion. This value has a range [0,1] and is expressed as fractions of the image
10995 height. Default is 0.5.
10997 Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
10998 no correction. Default is 0.
11000 Coefficient of the double quadratic correction term. This value has a range [-1,1].
11001 0 means no correction. Default is 0.
11004 The formula that generates the correction is:
11006 @var{r_src} = @var{r_tgt} * (1 + @var{k1} * (@var{r_tgt} / @var{r_0})^2 + @var{k2} * (@var{r_tgt} / @var{r_0})^4)
11008 where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
11009 distances from the focal point in the source and target images, respectively.
11013 Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
11015 The @code{lensfun} filter requires the camera make, camera model, and lens model
11016 to apply the lens correction. The filter will load the lensfun database and
11017 query it to find the corresponding camera and lens entries in the database. As
11018 long as these entries can be found with the given options, the filter can
11019 perform corrections on frames. Note that incomplete strings will result in the
11020 filter choosing the best match with the given options, and the filter will
11021 output the chosen camera and lens models (logged with level "info"). You must
11022 provide the make, camera model, and lens model as they are required.
11024 The filter accepts the following options:
11028 The make of the camera (for example, "Canon"). This option is required.
11031 The model of the camera (for example, "Canon EOS 100D"). This option is
11035 The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
11036 option is required.
11039 The type of correction to apply. The following values are valid options:
11043 Enables fixing lens vignetting.
11046 Enables fixing lens geometry. This is the default.
11049 Enables fixing chromatic aberrations.
11052 Enables fixing lens vignetting and lens geometry.
11055 Enables fixing lens vignetting and chromatic aberrations.
11058 Enables fixing both lens geometry and chromatic aberrations.
11061 Enables all possible corrections.
11065 The focal length of the image/video (zoom; expected constant for video). For
11066 example, a 18--55mm lens has focal length range of [18--55], so a value in that
11067 range should be chosen when using that lens. Default 18.
11070 The aperture of the image/video (expected constant for video). Note that
11071 aperture is only used for vignetting correction. Default 3.5.
11073 @item focus_distance
11074 The focus distance of the image/video (expected constant for video). Note that
11075 focus distance is only used for vignetting and only slightly affects the
11076 vignetting correction process. If unknown, leave it at the default value (which
11079 @item target_geometry
11080 The target geometry of the output image/video. The following values are valid
11084 @item rectilinear (default)
11087 @item equirectangular
11088 @item fisheye_orthographic
11089 @item fisheye_stereographic
11090 @item fisheye_equisolid
11091 @item fisheye_thoby
11094 Apply the reverse of image correction (instead of correcting distortion, apply
11097 @item interpolation
11098 The type of interpolation used when correcting distortion. The following values
11103 @item linear (default)
11108 @subsection Examples
11112 Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
11113 model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
11117 ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov
11121 Apply the same as before, but only for the first 5 seconds of video.
11124 ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:enable='lte(t\,5)' -c:v h264 -b:v 8000k output.mov
11131 Obtain the VMAF (Video Multi-Method Assessment Fusion)
11132 score between two input videos.
11134 The obtained VMAF score is printed through the logging system.
11136 It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
11137 After installing the library it can be enabled using:
11138 @code{./configure --enable-libvmaf --enable-version3}.
11139 If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
11141 The filter has following options:
11145 Set the model path which is to be used for SVM.
11146 Default value: @code{"vmaf_v0.6.1.pkl"}
11149 Set the file path to be used to store logs.
11152 Set the format of the log file (xml or json).
11154 @item enable_transform
11155 Enables transform for computing vmaf.
11158 Invokes the phone model which will generate VMAF scores higher than in the
11159 regular model, which is more suitable for laptop, TV, etc. viewing conditions.
11162 Enables computing psnr along with vmaf.
11165 Enables computing ssim along with vmaf.
11168 Enables computing ms_ssim along with vmaf.
11171 Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
11174 Set number of threads to be used when computing vmaf.
11177 Set interval for frame subsampling used when computing vmaf.
11179 @item enable_conf_interval
11180 Enables confidence interval.
11183 This filter also supports the @ref{framesync} options.
11185 On the below examples the input file @file{main.mpg} being processed is
11186 compared with the reference file @file{ref.mpg}.
11189 ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
11192 Example with options:
11194 ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
11199 Limits the pixel components values to the specified range [min, max].
11201 The filter accepts the following options:
11205 Lower bound. Defaults to the lowest allowed value for the input.
11208 Upper bound. Defaults to the highest allowed value for the input.
11211 Specify which planes will be processed. Defaults to all available.
11218 The filter accepts the following options:
11222 Set the number of loops. Setting this value to -1 will result in infinite loops.
11226 Set maximal size in number of frames. Default is 0.
11229 Set first frame of loop. Default is 0.
11234 Apply a 1D LUT to an input video.
11236 The filter accepts the following options:
11240 Set the 1D LUT file name.
11242 Currently supported formats:
11249 Select interpolation mode.
11251 Available values are:
11255 Use values from the nearest defined point.
11257 Interpolate values using the linear interpolation.
11259 Interpolate values using the cubic interpolation.
11266 Apply a 3D LUT to an input video.
11268 The filter accepts the following options:
11272 Set the 3D LUT file name.
11274 Currently supported formats:
11286 Select interpolation mode.
11288 Available values are:
11292 Use values from the nearest defined point.
11294 Interpolate values using the 8 points defining a cube.
11296 Interpolate values using a tetrahedron.
11300 This filter also supports the @ref{framesync} options.
11304 Turn certain luma values into transparency.
11306 The filter accepts the following options:
11310 Set the luma which will be used as base for transparency.
11311 Default value is @code{0}.
11314 Set the range of luma values to be keyed out.
11315 Default value is @code{0}.
11318 Set the range of softness. Default value is @code{0}.
11319 Use this to control gradual transition from zero to full transparency.
11322 @section lut, lutrgb, lutyuv
11324 Compute a look-up table for binding each pixel component input value
11325 to an output value, and apply it to the input video.
11327 @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
11328 to an RGB input video.
11330 These filters accept the following parameters:
11333 set first pixel component expression
11335 set second pixel component expression
11337 set third pixel component expression
11339 set fourth pixel component expression, corresponds to the alpha component
11342 set red component expression
11344 set green component expression
11346 set blue component expression
11348 alpha component expression
11351 set Y/luminance component expression
11353 set U/Cb component expression
11355 set V/Cr component expression
11358 Each of them specifies the expression to use for computing the lookup table for
11359 the corresponding pixel component values.
11361 The exact component associated to each of the @var{c*} options depends on the
11364 The @var{lut} filter requires either YUV or RGB pixel formats in input,
11365 @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
11367 The expressions can contain the following constants and functions:
11372 The input width and height.
11375 The input value for the pixel component.
11378 The input value, clipped to the @var{minval}-@var{maxval} range.
11381 The maximum value for the pixel component.
11384 The minimum value for the pixel component.
11387 The negated value for the pixel component value, clipped to the
11388 @var{minval}-@var{maxval} range; it corresponds to the expression
11389 "maxval-clipval+minval".
11392 The computed value in @var{val}, clipped to the
11393 @var{minval}-@var{maxval} range.
11395 @item gammaval(gamma)
11396 The computed gamma correction value of the pixel component value,
11397 clipped to the @var{minval}-@var{maxval} range. It corresponds to the
11399 "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
11403 All expressions default to "val".
11405 @subsection Examples
11409 Negate input video:
11411 lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
11412 lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
11415 The above is the same as:
11417 lutrgb="r=negval:g=negval:b=negval"
11418 lutyuv="y=negval:u=negval:v=negval"
11428 Remove chroma components, turning the video into a graytone image:
11430 lutyuv="u=128:v=128"
11434 Apply a luma burning effect:
11440 Remove green and blue components:
11446 Set a constant alpha channel value on input:
11448 format=rgba,lutrgb=a="maxval-minval/2"
11452 Correct luminance gamma by a factor of 0.5:
11454 lutyuv=y=gammaval(0.5)
11458 Discard least significant bits of luma:
11460 lutyuv=y='bitand(val, 128+64+32)'
11464 Technicolor like effect:
11466 lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
11470 @section lut2, tlut2
11472 The @code{lut2} filter takes two input streams and outputs one
11475 The @code{tlut2} (time lut2) filter takes two consecutive frames
11476 from one single stream.
11478 This filter accepts the following parameters:
11481 set first pixel component expression
11483 set second pixel component expression
11485 set third pixel component expression
11487 set fourth pixel component expression, corresponds to the alpha component
11490 Each of them specifies the expression to use for computing the lookup table for
11491 the corresponding pixel component values.
11493 The exact component associated to each of the @var{c*} options depends on the
11496 The expressions can contain the following constants:
11501 The input width and height.
11504 The first input value for the pixel component.
11507 The second input value for the pixel component.
11510 The first input video bit depth.
11513 The second input video bit depth.
11516 All expressions default to "x".
11518 @subsection Examples
11522 Highlight differences between two RGB video streams:
11524 lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
11528 Highlight differences between two YUV video streams:
11530 lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
11534 Show max difference between two video streams:
11536 lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
11540 @section maskedclamp
11542 Clamp the first input stream with the second input and third input stream.
11544 Returns the value of first stream to be between second input
11545 stream - @code{undershoot} and third input stream + @code{overshoot}.
11547 This filter accepts the following options:
11550 Default value is @code{0}.
11553 Default value is @code{0}.
11556 Set which planes will be processed as bitmap, unprocessed planes will be
11557 copied from first stream.
11558 By default value 0xf, all planes will be processed.
11561 @section maskedmerge
11563 Merge the first input stream with the second input stream using per pixel
11564 weights in the third input stream.
11566 A value of 0 in the third stream pixel component means that pixel component
11567 from first stream is returned unchanged, while maximum value (eg. 255 for
11568 8-bit videos) means that pixel component from second stream is returned
11569 unchanged. Intermediate values define the amount of merging between both
11570 input stream's pixel components.
11572 This filter accepts the following options:
11575 Set which planes will be processed as bitmap, unprocessed planes will be
11576 copied from first stream.
11577 By default value 0xf, all planes will be processed.
11582 Apply motion-compensation deinterlacing.
11584 It needs one field per frame as input and must thus be used together
11585 with yadif=1/3 or equivalent.
11587 This filter accepts the following options:
11590 Set the deinterlacing mode.
11592 It accepts one of the following values:
11597 use iterative motion estimation
11599 like @samp{slow}, but use multiple reference frames.
11601 Default value is @samp{fast}.
11604 Set the picture field parity assumed for the input video. It must be
11605 one of the following values:
11609 assume top field first
11611 assume bottom field first
11614 Default value is @samp{bff}.
11617 Set per-block quantization parameter (QP) used by the internal
11620 Higher values should result in a smoother motion vector field but less
11621 optimal individual vectors. Default value is 1.
11624 @section mergeplanes
11626 Merge color channel components from several video streams.
11628 The filter accepts up to 4 input streams, and merge selected input
11629 planes to the output video.
11631 This filter accepts the following options:
11634 Set input to output plane mapping. Default is @code{0}.
11636 The mappings is specified as a bitmap. It should be specified as a
11637 hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
11638 mapping for the first plane of the output stream. 'A' sets the number of
11639 the input stream to use (from 0 to 3), and 'a' the plane number of the
11640 corresponding input to use (from 0 to 3). The rest of the mappings is
11641 similar, 'Bb' describes the mapping for the output stream second
11642 plane, 'Cc' describes the mapping for the output stream third plane and
11643 'Dd' describes the mapping for the output stream fourth plane.
11646 Set output pixel format. Default is @code{yuva444p}.
11649 @subsection Examples
11653 Merge three gray video streams of same width and height into single video stream:
11655 [a0][a1][a2]mergeplanes=0x001020:yuv444p
11659 Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
11661 [a0][a1]mergeplanes=0x00010210:yuva444p
11665 Swap Y and A plane in yuva444p stream:
11667 format=yuva444p,mergeplanes=0x03010200:yuva444p
11671 Swap U and V plane in yuv420p stream:
11673 format=yuv420p,mergeplanes=0x000201:yuv420p
11677 Cast a rgb24 clip to yuv444p:
11679 format=rgb24,mergeplanes=0x000102:yuv444p
11685 Estimate and export motion vectors using block matching algorithms.
11686 Motion vectors are stored in frame side data to be used by other filters.
11688 This filter accepts the following options:
11691 Specify the motion estimation method. Accepts one of the following values:
11695 Exhaustive search algorithm.
11697 Three step search algorithm.
11699 Two dimensional logarithmic search algorithm.
11701 New three step search algorithm.
11703 Four step search algorithm.
11705 Diamond search algorithm.
11707 Hexagon-based search algorithm.
11709 Enhanced predictive zonal search algorithm.
11711 Uneven multi-hexagon search algorithm.
11713 Default value is @samp{esa}.
11716 Macroblock size. Default @code{16}.
11719 Search parameter. Default @code{7}.
11722 @section midequalizer
11724 Apply Midway Image Equalization effect using two video streams.
11726 Midway Image Equalization adjusts a pair of images to have the same
11727 histogram, while maintaining their dynamics as much as possible. It's
11728 useful for e.g. matching exposures from a pair of stereo cameras.
11730 This filter has two inputs and one output, which must be of same pixel format, but
11731 may be of different sizes. The output of filter is first input adjusted with
11732 midway histogram of both inputs.
11734 This filter accepts the following option:
11738 Set which planes to process. Default is @code{15}, which is all available planes.
11741 @section minterpolate
11743 Convert the video to specified frame rate using motion interpolation.
11745 This filter accepts the following options:
11748 Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
11751 Motion interpolation mode. Following values are accepted:
11754 Duplicate previous or next frame for interpolating new ones.
11756 Blend source frames. Interpolated frame is mean of previous and next frames.
11758 Motion compensated interpolation. Following options are effective when this mode is selected:
11762 Motion compensation mode. Following values are accepted:
11765 Overlapped block motion compensation.
11767 Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
11769 Default mode is @samp{obmc}.
11772 Motion estimation mode. Following values are accepted:
11775 Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
11777 Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
11779 Default mode is @samp{bilat}.
11782 The algorithm to be used for motion estimation. Following values are accepted:
11785 Exhaustive search algorithm.
11787 Three step search algorithm.
11789 Two dimensional logarithmic search algorithm.
11791 New three step search algorithm.
11793 Four step search algorithm.
11795 Diamond search algorithm.
11797 Hexagon-based search algorithm.
11799 Enhanced predictive zonal search algorithm.
11801 Uneven multi-hexagon search algorithm.
11803 Default algorithm is @samp{epzs}.
11806 Macroblock size. Default @code{16}.
11809 Motion estimation search parameter. Default @code{32}.
11812 Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
11817 Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
11820 Disable scene change detection.
11822 Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
11824 Default method is @samp{fdiff}.
11826 @item scd_threshold
11827 Scene change detection threshold. Default is @code{5.0}.
11832 Mix several video input streams into one video stream.
11834 A description of the accepted options follows.
11838 The number of inputs. If unspecified, it defaults to 2.
11841 Specify weight of each input video stream as sequence.
11842 Each weight is separated by space. If number of weights
11843 is smaller than number of @var{frames} last specified
11844 weight will be used for all remaining unset weights.
11847 Specify scale, if it is set it will be multiplied with sum
11848 of each weight multiplied with pixel values to give final destination
11849 pixel value. By default @var{scale} is auto scaled to sum of weights.
11852 Specify how end of stream is determined.
11855 The duration of the longest input. (default)
11858 The duration of the shortest input.
11861 The duration of the first input.
11865 @section mpdecimate
11867 Drop frames that do not differ greatly from the previous frame in
11868 order to reduce frame rate.
11870 The main use of this filter is for very-low-bitrate encoding
11871 (e.g. streaming over dialup modem), but it could in theory be used for
11872 fixing movies that were inverse-telecined incorrectly.
11874 A description of the accepted options follows.
11878 Set the maximum number of consecutive frames which can be dropped (if
11879 positive), or the minimum interval between dropped frames (if
11880 negative). If the value is 0, the frame is dropped disregarding the
11881 number of previous sequentially dropped frames.
11883 Default value is 0.
11888 Set the dropping threshold values.
11890 Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
11891 represent actual pixel value differences, so a threshold of 64
11892 corresponds to 1 unit of difference for each pixel, or the same spread
11893 out differently over the block.
11895 A frame is a candidate for dropping if no 8x8 blocks differ by more
11896 than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
11897 meaning the whole image) differ by more than a threshold of @option{lo}.
11899 Default value for @option{hi} is 64*12, default value for @option{lo} is
11900 64*5, and default value for @option{frac} is 0.33.
11906 Negate (invert) the input video.
11908 It accepts the following option:
11913 With value 1, it negates the alpha component, if present. Default value is 0.
11919 Denoise frames using Non-Local Means algorithm.
11921 Each pixel is adjusted by looking for other pixels with similar contexts. This
11922 context similarity is defined by comparing their surrounding patches of size
11923 @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
11926 Note that the research area defines centers for patches, which means some
11927 patches will be made of pixels outside that research area.
11929 The filter accepts the following options.
11933 Set denoising strength.
11939 Same as @option{p} but for chroma planes.
11941 The default value is @var{0} and means automatic.
11947 Same as @option{r} but for chroma planes.
11949 The default value is @var{0} and means automatic.
11954 Deinterlace video using neural network edge directed interpolation.
11956 This filter accepts the following options:
11960 Mandatory option, without binary file filter can not work.
11961 Currently file can be found here:
11962 https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
11965 Set which frames to deinterlace, by default it is @code{all}.
11966 Can be @code{all} or @code{interlaced}.
11969 Set mode of operation.
11971 Can be one of the following:
11975 Use frame flags, both fields.
11977 Use frame flags, single field.
11979 Use top field only.
11981 Use bottom field only.
11983 Use both fields, top first.
11985 Use both fields, bottom first.
11989 Set which planes to process, by default filter process all frames.
11992 Set size of local neighborhood around each pixel, used by the predictor neural
11995 Can be one of the following:
12008 Set the number of neurons in predictor neural network.
12009 Can be one of the following:
12020 Controls the number of different neural network predictions that are blended
12021 together to compute the final output value. Can be @code{fast}, default or
12025 Set which set of weights to use in the predictor.
12026 Can be one of the following:
12030 weights trained to minimize absolute error
12032 weights trained to minimize squared error
12036 Controls whether or not the prescreener neural network is used to decide
12037 which pixels should be processed by the predictor neural network and which
12038 can be handled by simple cubic interpolation.
12039 The prescreener is trained to know whether cubic interpolation will be
12040 sufficient for a pixel or whether it should be predicted by the predictor nn.
12041 The computational complexity of the prescreener nn is much less than that of
12042 the predictor nn. Since most pixels can be handled by cubic interpolation,
12043 using the prescreener generally results in much faster processing.
12044 The prescreener is pretty accurate, so the difference between using it and not
12045 using it is almost always unnoticeable.
12047 Can be one of the following:
12055 Default is @code{new}.
12058 Set various debugging flags.
12063 Force libavfilter not to use any of the specified pixel formats for the
12064 input to the next filter.
12066 It accepts the following parameters:
12070 A '|'-separated list of pixel format names, such as
12071 pix_fmts=yuv420p|monow|rgb24".
12075 @subsection Examples
12079 Force libavfilter to use a format different from @var{yuv420p} for the
12080 input to the vflip filter:
12082 noformat=pix_fmts=yuv420p,vflip
12086 Convert the input video to any of the formats not contained in the list:
12088 noformat=yuv420p|yuv444p|yuv410p
12094 Add noise on video input frame.
12096 The filter accepts the following options:
12104 Set noise seed for specific pixel component or all pixel components in case
12105 of @var{all_seed}. Default value is @code{123457}.
12107 @item all_strength, alls
12108 @item c0_strength, c0s
12109 @item c1_strength, c1s
12110 @item c2_strength, c2s
12111 @item c3_strength, c3s
12112 Set noise strength for specific pixel component or all pixel components in case
12113 @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
12115 @item all_flags, allf
12116 @item c0_flags, c0f
12117 @item c1_flags, c1f
12118 @item c2_flags, c2f
12119 @item c3_flags, c3f
12120 Set pixel component flags or set flags for all components if @var{all_flags}.
12121 Available values for component flags are:
12124 averaged temporal noise (smoother)
12126 mix random noise with a (semi)regular pattern
12128 temporal noise (noise pattern changes between frames)
12130 uniform noise (gaussian otherwise)
12134 @subsection Examples
12136 Add temporal and uniform noise to input video:
12138 noise=alls=20:allf=t+u
12143 Normalize RGB video (aka histogram stretching, contrast stretching).
12144 See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
12146 For each channel of each frame, the filter computes the input range and maps
12147 it linearly to the user-specified output range. The output range defaults
12148 to the full dynamic range from pure black to pure white.
12150 Temporal smoothing can be used on the input range to reduce flickering (rapid
12151 changes in brightness) caused when small dark or bright objects enter or leave
12152 the scene. This is similar to the auto-exposure (automatic gain control) on a
12153 video camera, and, like a video camera, it may cause a period of over- or
12154 under-exposure of the video.
12156 The R,G,B channels can be normalized independently, which may cause some
12157 color shifting, or linked together as a single channel, which prevents
12158 color shifting. Linked normalization preserves hue. Independent normalization
12159 does not, so it can be used to remove some color casts. Independent and linked
12160 normalization can be combined in any ratio.
12162 The normalize filter accepts the following options:
12167 Colors which define the output range. The minimum input value is mapped to
12168 the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
12169 The defaults are black and white respectively. Specifying white for
12170 @var{blackpt} and black for @var{whitept} will give color-inverted,
12171 normalized video. Shades of grey can be used to reduce the dynamic range
12172 (contrast). Specifying saturated colors here can create some interesting
12176 The number of previous frames to use for temporal smoothing. The input range
12177 of each channel is smoothed using a rolling average over the current frame
12178 and the @var{smoothing} previous frames. The default is 0 (no temporal
12182 Controls the ratio of independent (color shifting) channel normalization to
12183 linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
12184 independent. Defaults to 1.0 (fully independent).
12187 Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
12188 expensive no-op. Defaults to 1.0 (full strength).
12192 @subsection Examples
12194 Stretch video contrast to use the full dynamic range, with no temporal
12195 smoothing; may flicker depending on the source content:
12197 normalize=blackpt=black:whitept=white:smoothing=0
12200 As above, but with 50 frames of temporal smoothing; flicker should be
12201 reduced, depending on the source content:
12203 normalize=blackpt=black:whitept=white:smoothing=50
12206 As above, but with hue-preserving linked channel normalization:
12208 normalize=blackpt=black:whitept=white:smoothing=50:independence=0
12211 As above, but with half strength:
12213 normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
12216 Map the darkest input color to red, the brightest input color to cyan:
12218 normalize=blackpt=red:whitept=cyan
12223 Pass the video source unchanged to the output.
12226 Optical Character Recognition
12228 This filter uses Tesseract for optical character recognition. To enable
12229 compilation of this filter, you need to configure FFmpeg with
12230 @code{--enable-libtesseract}.
12232 It accepts the following options:
12236 Set datapath to tesseract data. Default is to use whatever was
12237 set at installation.
12240 Set language, default is "eng".
12243 Set character whitelist.
12246 Set character blacklist.
12249 The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
12253 Apply a video transform using libopencv.
12255 To enable this filter, install the libopencv library and headers and
12256 configure FFmpeg with @code{--enable-libopencv}.
12258 It accepts the following parameters:
12263 The name of the libopencv filter to apply.
12265 @item filter_params
12266 The parameters to pass to the libopencv filter. If not specified, the default
12267 values are assumed.
12271 Refer to the official libopencv documentation for more precise
12273 @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
12275 Several libopencv filters are supported; see the following subsections.
12280 Dilate an image by using a specific structuring element.
12281 It corresponds to the libopencv function @code{cvDilate}.
12283 It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
12285 @var{struct_el} represents a structuring element, and has the syntax:
12286 @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
12288 @var{cols} and @var{rows} represent the number of columns and rows of
12289 the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
12290 point, and @var{shape} the shape for the structuring element. @var{shape}
12291 must be "rect", "cross", "ellipse", or "custom".
12293 If the value for @var{shape} is "custom", it must be followed by a
12294 string of the form "=@var{filename}". The file with name
12295 @var{filename} is assumed to represent a binary image, with each
12296 printable character corresponding to a bright pixel. When a custom
12297 @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
12298 or columns and rows of the read file are assumed instead.
12300 The default value for @var{struct_el} is "3x3+0x0/rect".
12302 @var{nb_iterations} specifies the number of times the transform is
12303 applied to the image, and defaults to 1.
12307 # Use the default values
12310 # Dilate using a structuring element with a 5x5 cross, iterating two times
12311 ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
12313 # Read the shape from the file diamond.shape, iterating two times.
12314 # The file diamond.shape may contain a pattern of characters like this
12320 # The specified columns and rows are ignored
12321 # but the anchor point coordinates are not
12322 ocv=dilate:0x0+2x2/custom=diamond.shape|2
12327 Erode an image by using a specific structuring element.
12328 It corresponds to the libopencv function @code{cvErode}.
12330 It accepts the parameters: @var{struct_el}:@var{nb_iterations},
12331 with the same syntax and semantics as the @ref{dilate} filter.
12335 Smooth the input video.
12337 The filter takes the following parameters:
12338 @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
12340 @var{type} is the type of smooth filter to apply, and must be one of
12341 the following values: "blur", "blur_no_scale", "median", "gaussian",
12342 or "bilateral". The default value is "gaussian".
12344 The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
12345 depend on the smooth type. @var{param1} and
12346 @var{param2} accept integer positive values or 0. @var{param3} and
12347 @var{param4} accept floating point values.
12349 The default value for @var{param1} is 3. The default value for the
12350 other parameters is 0.
12352 These parameters correspond to the parameters assigned to the
12353 libopencv function @code{cvSmooth}.
12355 @section oscilloscope
12357 2D Video Oscilloscope.
12359 Useful to measure spatial impulse, step responses, chroma delays, etc.
12361 It accepts the following parameters:
12365 Set scope center x position.
12368 Set scope center y position.
12371 Set scope size, relative to frame diagonal.
12374 Set scope tilt/rotation.
12380 Set trace center x position.
12383 Set trace center y position.
12386 Set trace width, relative to width of frame.
12389 Set trace height, relative to height of frame.
12392 Set which components to trace. By default it traces first three components.
12395 Draw trace grid. By default is enabled.
12398 Draw some statistics. By default is enabled.
12401 Draw scope. By default is enabled.
12404 @subsection Examples
12408 Inspect full first row of video frame.
12410 oscilloscope=x=0.5:y=0:s=1
12414 Inspect full last row of video frame.
12416 oscilloscope=x=0.5:y=1:s=1
12420 Inspect full 5th line of video frame of height 1080.
12422 oscilloscope=x=0.5:y=5/1080:s=1
12426 Inspect full last column of video frame.
12428 oscilloscope=x=1:y=0.5:s=1:t=1
12436 Overlay one video on top of another.
12438 It takes two inputs and has one output. The first input is the "main"
12439 video on which the second input is overlaid.
12441 It accepts the following parameters:
12443 A description of the accepted options follows.
12448 Set the expression for the x and y coordinates of the overlaid video
12449 on the main video. Default value is "0" for both expressions. In case
12450 the expression is invalid, it is set to a huge value (meaning that the
12451 overlay will not be displayed within the output visible area).
12454 See @ref{framesync}.
12457 Set when the expressions for @option{x}, and @option{y} are evaluated.
12459 It accepts the following values:
12462 only evaluate expressions once during the filter initialization or
12463 when a command is processed
12466 evaluate expressions for each incoming frame
12469 Default value is @samp{frame}.
12472 See @ref{framesync}.
12475 Set the format for the output video.
12477 It accepts the following values:
12480 force YUV420 output
12483 force YUV422 output
12486 force YUV444 output
12489 force packed RGB output
12492 force planar RGB output
12495 automatically pick format
12498 Default value is @samp{yuv420}.
12501 See @ref{framesync}.
12504 Set format of alpha of the overlaid video, it can be @var{straight} or
12505 @var{premultiplied}. Default is @var{straight}.
12508 The @option{x}, and @option{y} expressions can contain the following
12514 The main input width and height.
12518 The overlay input width and height.
12522 The computed values for @var{x} and @var{y}. They are evaluated for
12527 horizontal and vertical chroma subsample values of the output
12528 format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
12532 the number of input frame, starting from 0
12535 the position in the file of the input frame, NAN if unknown
12538 The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
12542 This filter also supports the @ref{framesync} options.
12544 Note that the @var{n}, @var{pos}, @var{t} variables are available only
12545 when evaluation is done @emph{per frame}, and will evaluate to NAN
12546 when @option{eval} is set to @samp{init}.
12548 Be aware that frames are taken from each input video in timestamp
12549 order, hence, if their initial timestamps differ, it is a good idea
12550 to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
12551 have them begin in the same zero timestamp, as the example for
12552 the @var{movie} filter does.
12554 You can chain together more overlays but you should test the
12555 efficiency of such approach.
12557 @subsection Commands
12559 This filter supports the following commands:
12563 Modify the x and y of the overlay input.
12564 The command accepts the same syntax of the corresponding option.
12566 If the specified expression is not valid, it is kept at its current
12570 @subsection Examples
12574 Draw the overlay at 10 pixels from the bottom right corner of the main
12577 overlay=main_w-overlay_w-10:main_h-overlay_h-10
12580 Using named options the example above becomes:
12582 overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
12586 Insert a transparent PNG logo in the bottom left corner of the input,
12587 using the @command{ffmpeg} tool with the @code{-filter_complex} option:
12589 ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
12593 Insert 2 different transparent PNG logos (second logo on bottom
12594 right corner) using the @command{ffmpeg} tool:
12596 ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=x=10:y=H-h-10,overlay=x=W-w-10:y=H-h-10' output
12600 Add a transparent color layer on top of the main video; @code{WxH}
12601 must specify the size of the main input to the overlay filter:
12603 color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
12607 Play an original video and a filtered version (here with the deshake
12608 filter) side by side using the @command{ffplay} tool:
12610 ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
12613 The above command is the same as:
12615 ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
12619 Make a sliding overlay appearing from the left to the right top part of the
12620 screen starting since time 2:
12622 overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
12626 Compose output by putting two input videos side to side:
12628 ffmpeg -i left.avi -i right.avi -filter_complex "
12629 nullsrc=size=200x100 [background];
12630 [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
12631 [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
12632 [background][left] overlay=shortest=1 [background+left];
12633 [background+left][right] overlay=shortest=1:x=100 [left+right]
12638 Mask 10-20 seconds of a video by applying the delogo filter to a section
12640 ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
12641 -vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
12646 Chain several overlays in cascade:
12648 nullsrc=s=200x200 [bg];
12649 testsrc=s=100x100, split=4 [in0][in1][in2][in3];
12650 [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
12651 [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
12652 [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
12653 [in3] null, [mid2] overlay=100:100 [out0]
12660 Apply Overcomplete Wavelet denoiser.
12662 The filter accepts the following options:
12668 Larger depth values will denoise lower frequency components more, but
12669 slow down filtering.
12671 Must be an int in the range 8-16, default is @code{8}.
12673 @item luma_strength, ls
12676 Must be a double value in the range 0-1000, default is @code{1.0}.
12678 @item chroma_strength, cs
12679 Set chroma strength.
12681 Must be a double value in the range 0-1000, default is @code{1.0}.
12687 Add paddings to the input image, and place the original input at the
12688 provided @var{x}, @var{y} coordinates.
12690 It accepts the following parameters:
12695 Specify an expression for the size of the output image with the
12696 paddings added. If the value for @var{width} or @var{height} is 0, the
12697 corresponding input size is used for the output.
12699 The @var{width} expression can reference the value set by the
12700 @var{height} expression, and vice versa.
12702 The default value of @var{width} and @var{height} is 0.
12706 Specify the offsets to place the input image at within the padded area,
12707 with respect to the top/left border of the output image.
12709 The @var{x} expression can reference the value set by the @var{y}
12710 expression, and vice versa.
12712 The default value of @var{x} and @var{y} is 0.
12714 If @var{x} or @var{y} evaluate to a negative number, they'll be changed
12715 so the input image is centered on the padded area.
12718 Specify the color of the padded area. For the syntax of this option,
12719 check the @ref{color syntax,,"Color" section in the ffmpeg-utils
12720 manual,ffmpeg-utils}.
12722 The default value of @var{color} is "black".
12725 Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
12727 It accepts the following values:
12731 Only evaluate expressions once during the filter initialization or when
12732 a command is processed.
12735 Evaluate expressions for each incoming frame.
12739 Default value is @samp{init}.
12742 Pad to aspect instead to a resolution.
12746 The value for the @var{width}, @var{height}, @var{x}, and @var{y}
12747 options are expressions containing the following constants:
12752 The input video width and height.
12756 These are the same as @var{in_w} and @var{in_h}.
12760 The output width and height (the size of the padded area), as
12761 specified by the @var{width} and @var{height} expressions.
12765 These are the same as @var{out_w} and @var{out_h}.
12769 The x and y offsets as specified by the @var{x} and @var{y}
12770 expressions, or NAN if not yet specified.
12773 same as @var{iw} / @var{ih}
12776 input sample aspect ratio
12779 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
12783 The horizontal and vertical chroma subsample values. For example for the
12784 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
12787 @subsection Examples
12791 Add paddings with the color "violet" to the input video. The output video
12792 size is 640x480, and the top-left corner of the input video is placed at
12795 pad=640:480:0:40:violet
12798 The example above is equivalent to the following command:
12800 pad=width=640:height=480:x=0:y=40:color=violet
12804 Pad the input to get an output with dimensions increased by 3/2,
12805 and put the input video at the center of the padded area:
12807 pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
12811 Pad the input to get a squared output with size equal to the maximum
12812 value between the input width and height, and put the input video at
12813 the center of the padded area:
12815 pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
12819 Pad the input to get a final w/h ratio of 16:9:
12821 pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
12825 In case of anamorphic video, in order to set the output display aspect
12826 correctly, it is necessary to use @var{sar} in the expression,
12827 according to the relation:
12829 (ih * X / ih) * sar = output_dar
12830 X = output_dar / sar
12833 Thus the previous example needs to be modified to:
12835 pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
12839 Double the output size and put the input video in the bottom-right
12840 corner of the output padded area:
12842 pad="2*iw:2*ih:ow-iw:oh-ih"
12846 @anchor{palettegen}
12847 @section palettegen
12849 Generate one palette for a whole video stream.
12851 It accepts the following options:
12855 Set the maximum number of colors to quantize in the palette.
12856 Note: the palette will still contain 256 colors; the unused palette entries
12859 @item reserve_transparent
12860 Create a palette of 255 colors maximum and reserve the last one for
12861 transparency. Reserving the transparency color is useful for GIF optimization.
12862 If not set, the maximum of colors in the palette will be 256. You probably want
12863 to disable this option for a standalone image.
12866 @item transparency_color
12867 Set the color that will be used as background for transparency.
12870 Set statistics mode.
12872 It accepts the following values:
12875 Compute full frame histograms.
12877 Compute histograms only for the part that differs from previous frame. This
12878 might be relevant to give more importance to the moving part of your input if
12879 the background is static.
12881 Compute new histogram for each frame.
12884 Default value is @var{full}.
12887 The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
12888 (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
12889 color quantization of the palette. This information is also visible at
12890 @var{info} logging level.
12892 @subsection Examples
12896 Generate a representative palette of a given video using @command{ffmpeg}:
12898 ffmpeg -i input.mkv -vf palettegen palette.png
12902 @section paletteuse
12904 Use a palette to downsample an input video stream.
12906 The filter takes two inputs: one video stream and a palette. The palette must
12907 be a 256 pixels image.
12909 It accepts the following options:
12913 Select dithering mode. Available algorithms are:
12916 Ordered 8x8 bayer dithering (deterministic)
12918 Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
12919 Note: this dithering is sometimes considered "wrong" and is included as a
12921 @item floyd_steinberg
12922 Floyd and Steingberg dithering (error diffusion)
12924 Frankie Sierra dithering v2 (error diffusion)
12926 Frankie Sierra dithering v2 "Lite" (error diffusion)
12929 Default is @var{sierra2_4a}.
12932 When @var{bayer} dithering is selected, this option defines the scale of the
12933 pattern (how much the crosshatch pattern is visible). A low value means more
12934 visible pattern for less banding, and higher value means less visible pattern
12935 at the cost of more banding.
12937 The option must be an integer value in the range [0,5]. Default is @var{2}.
12940 If set, define the zone to process
12944 Only the changing rectangle will be reprocessed. This is similar to GIF
12945 cropping/offsetting compression mechanism. This option can be useful for speed
12946 if only a part of the image is changing, and has use cases such as limiting the
12947 scope of the error diffusal @option{dither} to the rectangle that bounds the
12948 moving scene (it leads to more deterministic output if the scene doesn't change
12949 much, and as a result less moving noise and better GIF compression).
12952 Default is @var{none}.
12955 Take new palette for each output frame.
12957 @item alpha_threshold
12958 Sets the alpha threshold for transparency. Alpha values above this threshold
12959 will be treated as completely opaque, and values below this threshold will be
12960 treated as completely transparent.
12962 The option must be an integer value in the range [0,255]. Default is @var{128}.
12965 @subsection Examples
12969 Use a palette (generated for example with @ref{palettegen}) to encode a GIF
12970 using @command{ffmpeg}:
12972 ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
12976 @section perspective
12978 Correct perspective of video not recorded perpendicular to the screen.
12980 A description of the accepted parameters follows.
12991 Set coordinates expression for top left, top right, bottom left and bottom right corners.
12992 Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
12993 If the @code{sense} option is set to @code{source}, then the specified points will be sent
12994 to the corners of the destination. If the @code{sense} option is set to @code{destination},
12995 then the corners of the source will be sent to the specified coordinates.
12997 The expressions can use the following variables:
13002 the width and height of video frame.
13006 Output frame count.
13009 @item interpolation
13010 Set interpolation for perspective correction.
13012 It accepts the following values:
13018 Default value is @samp{linear}.
13021 Set interpretation of coordinate options.
13023 It accepts the following values:
13027 Send point in the source specified by the given coordinates to
13028 the corners of the destination.
13030 @item 1, destination
13032 Send the corners of the source to the point in the destination specified
13033 by the given coordinates.
13035 Default value is @samp{source}.
13039 Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
13041 It accepts the following values:
13044 only evaluate expressions once during the filter initialization or
13045 when a command is processed
13048 evaluate expressions for each incoming frame
13051 Default value is @samp{init}.
13056 Delay interlaced video by one field time so that the field order changes.
13058 The intended use is to fix PAL movies that have been captured with the
13059 opposite field order to the film-to-video transfer.
13061 A description of the accepted parameters follows.
13067 It accepts the following values:
13070 Capture field order top-first, transfer bottom-first.
13071 Filter will delay the bottom field.
13074 Capture field order bottom-first, transfer top-first.
13075 Filter will delay the top field.
13078 Capture and transfer with the same field order. This mode only exists
13079 for the documentation of the other options to refer to, but if you
13080 actually select it, the filter will faithfully do nothing.
13083 Capture field order determined automatically by field flags, transfer
13085 Filter selects among @samp{t} and @samp{b} modes on a frame by frame
13086 basis using field flags. If no field information is available,
13087 then this works just like @samp{u}.
13090 Capture unknown or varying, transfer opposite.
13091 Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
13092 analyzing the images and selecting the alternative that produces best
13093 match between the fields.
13096 Capture top-first, transfer unknown or varying.
13097 Filter selects among @samp{t} and @samp{p} using image analysis.
13100 Capture bottom-first, transfer unknown or varying.
13101 Filter selects among @samp{b} and @samp{p} using image analysis.
13104 Capture determined by field flags, transfer unknown or varying.
13105 Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
13106 image analysis. If no field information is available, then this works just
13107 like @samp{U}. This is the default mode.
13110 Both capture and transfer unknown or varying.
13111 Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
13115 @section pixdesctest
13117 Pixel format descriptor test filter, mainly useful for internal
13118 testing. The output video should be equal to the input video.
13122 format=monow, pixdesctest
13125 can be used to test the monowhite pixel format descriptor definition.
13129 Display sample values of color channels. Mainly useful for checking color
13130 and levels. Minimum supported resolution is 640x480.
13132 The filters accept the following options:
13136 Set scope X position, relative offset on X axis.
13139 Set scope Y position, relative offset on Y axis.
13148 Set window opacity. This window also holds statistics about pixel area.
13151 Set window X position, relative offset on X axis.
13154 Set window Y position, relative offset on Y axis.
13159 Enable the specified chain of postprocessing subfilters using libpostproc. This
13160 library should be automatically selected with a GPL build (@code{--enable-gpl}).
13161 Subfilters must be separated by '/' and can be disabled by prepending a '-'.
13162 Each subfilter and some options have a short and a long name that can be used
13163 interchangeably, i.e. dr/dering are the same.
13165 The filters accept the following options:
13169 Set postprocessing subfilters string.
13172 All subfilters share common options to determine their scope:
13176 Honor the quality commands for this subfilter.
13179 Do chrominance filtering, too (default).
13182 Do luminance filtering only (no chrominance).
13185 Do chrominance filtering only (no luminance).
13188 These options can be appended after the subfilter name, separated by a '|'.
13190 Available subfilters are:
13193 @item hb/hdeblock[|difference[|flatness]]
13194 Horizontal deblocking filter
13197 Difference factor where higher values mean more deblocking (default: @code{32}).
13199 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13202 @item vb/vdeblock[|difference[|flatness]]
13203 Vertical deblocking filter
13206 Difference factor where higher values mean more deblocking (default: @code{32}).
13208 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13211 @item ha/hadeblock[|difference[|flatness]]
13212 Accurate horizontal deblocking filter
13215 Difference factor where higher values mean more deblocking (default: @code{32}).
13217 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13220 @item va/vadeblock[|difference[|flatness]]
13221 Accurate vertical deblocking filter
13224 Difference factor where higher values mean more deblocking (default: @code{32}).
13226 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13230 The horizontal and vertical deblocking filters share the difference and
13231 flatness values so you cannot set different horizontal and vertical
13235 @item h1/x1hdeblock
13236 Experimental horizontal deblocking filter
13238 @item v1/x1vdeblock
13239 Experimental vertical deblocking filter
13244 @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
13247 larger -> stronger filtering
13249 larger -> stronger filtering
13251 larger -> stronger filtering
13254 @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
13257 Stretch luminance to @code{0-255}.
13260 @item lb/linblenddeint
13261 Linear blend deinterlacing filter that deinterlaces the given block by
13262 filtering all lines with a @code{(1 2 1)} filter.
13264 @item li/linipoldeint
13265 Linear interpolating deinterlacing filter that deinterlaces the given block by
13266 linearly interpolating every second line.
13268 @item ci/cubicipoldeint
13269 Cubic interpolating deinterlacing filter deinterlaces the given block by
13270 cubically interpolating every second line.
13272 @item md/mediandeint
13273 Median deinterlacing filter that deinterlaces the given block by applying a
13274 median filter to every second line.
13276 @item fd/ffmpegdeint
13277 FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
13278 second line with a @code{(-1 4 2 4 -1)} filter.
13281 Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
13282 block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
13284 @item fq/forceQuant[|quantizer]
13285 Overrides the quantizer table from the input with the constant quantizer you
13293 Default pp filter combination (@code{hb|a,vb|a,dr|a})
13296 Fast pp filter combination (@code{h1|a,v1|a,dr|a})
13299 High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
13302 @subsection Examples
13306 Apply horizontal and vertical deblocking, deringing and automatic
13307 brightness/contrast:
13313 Apply default filters without brightness/contrast correction:
13319 Apply default filters and temporal denoiser:
13321 pp=default/tmpnoise|1|2|3
13325 Apply deblocking on luminance only, and switch vertical deblocking on or off
13326 automatically depending on available CPU time:
13333 Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
13334 similar to spp = 6 with 7 point DCT, where only the center sample is
13337 The filter accepts the following options:
13341 Force a constant quantization parameter. It accepts an integer in range
13342 0 to 63. If not set, the filter will use the QP from the video stream
13346 Set thresholding mode. Available modes are:
13350 Set hard thresholding.
13352 Set soft thresholding (better de-ringing effect, but likely blurrier).
13354 Set medium thresholding (good results, default).
13358 @section premultiply
13359 Apply alpha premultiply effect to input video stream using first plane
13360 of second stream as alpha.
13362 Both streams must have same dimensions and same pixel format.
13364 The filter accepts the following option:
13368 Set which planes will be processed, unprocessed planes will be copied.
13369 By default value 0xf, all planes will be processed.
13372 Do not require 2nd input for processing, instead use alpha plane from input stream.
13376 Apply prewitt operator to input video stream.
13378 The filter accepts the following option:
13382 Set which planes will be processed, unprocessed planes will be copied.
13383 By default value 0xf, all planes will be processed.
13386 Set value which will be multiplied with filtered result.
13389 Set value which will be added to filtered result.
13392 @anchor{program_opencl}
13393 @section program_opencl
13395 Filter video using an OpenCL program.
13400 OpenCL program source file.
13403 Kernel name in program.
13406 Number of inputs to the filter. Defaults to 1.
13409 Size of output frames. Defaults to the same as the first input.
13413 The program source file must contain a kernel function with the given name,
13414 which will be run once for each plane of the output. Each run on a plane
13415 gets enqueued as a separate 2D global NDRange with one work-item for each
13416 pixel to be generated. The global ID offset for each work-item is therefore
13417 the coordinates of a pixel in the destination image.
13419 The kernel function needs to take the following arguments:
13422 Destination image, @var{__write_only image2d_t}.
13424 This image will become the output; the kernel should write all of it.
13426 Frame index, @var{unsigned int}.
13428 This is a counter starting from zero and increasing by one for each frame.
13430 Source images, @var{__read_only image2d_t}.
13432 These are the most recent images on each input. The kernel may read from
13433 them to generate the output, but they can't be written to.
13440 Copy the input to the output (output must be the same size as the input).
13442 __kernel void copy(__write_only image2d_t destination,
13443 unsigned int index,
13444 __read_only image2d_t source)
13446 const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
13448 int2 location = (int2)(get_global_id(0), get_global_id(1));
13450 float4 value = read_imagef(source, sampler, location);
13452 write_imagef(destination, location, value);
13457 Apply a simple transformation, rotating the input by an amount increasing
13458 with the index counter. Pixel values are linearly interpolated by the
13459 sampler, and the output need not have the same dimensions as the input.
13461 __kernel void rotate_image(__write_only image2d_t dst,
13462 unsigned int index,
13463 __read_only image2d_t src)
13465 const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
13466 CLK_FILTER_LINEAR);
13468 float angle = (float)index / 100.0f;
13470 float2 dst_dim = convert_float2(get_image_dim(dst));
13471 float2 src_dim = convert_float2(get_image_dim(src));
13473 float2 dst_cen = dst_dim / 2.0f;
13474 float2 src_cen = src_dim / 2.0f;
13476 int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
13478 float2 dst_pos = convert_float2(dst_loc) - dst_cen;
13480 cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
13481 sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
13483 src_pos = src_pos * src_dim / dst_dim;
13485 float2 src_loc = src_pos + src_cen;
13487 if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
13488 src_loc.x > src_dim.x || src_loc.y > src_dim.y)
13489 write_imagef(dst, dst_loc, 0.5f);
13491 write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
13496 Blend two inputs together, with the amount of each input used varying
13497 with the index counter.
13499 __kernel void blend_images(__write_only image2d_t dst,
13500 unsigned int index,
13501 __read_only image2d_t src1,
13502 __read_only image2d_t src2)
13504 const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
13505 CLK_FILTER_LINEAR);
13507 float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
13509 int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
13510 int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
13511 int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
13513 float4 val1 = read_imagef(src1, sampler, src1_loc);
13514 float4 val2 = read_imagef(src2, sampler, src2_loc);
13516 write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
13522 @section pseudocolor
13524 Alter frame colors in video with pseudocolors.
13526 This filter accept the following options:
13530 set pixel first component expression
13533 set pixel second component expression
13536 set pixel third component expression
13539 set pixel fourth component expression, corresponds to the alpha component
13542 set component to use as base for altering colors
13545 Each of them specifies the expression to use for computing the lookup table for
13546 the corresponding pixel component values.
13548 The expressions can contain the following constants and functions:
13553 The input width and height.
13556 The input value for the pixel component.
13558 @item ymin, umin, vmin, amin
13559 The minimum allowed component value.
13561 @item ymax, umax, vmax, amax
13562 The maximum allowed component value.
13565 All expressions default to "val".
13567 @subsection Examples
13571 Change too high luma values to gradient:
13573 pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
13579 Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
13580 Ratio) between two input videos.
13582 This filter takes in input two input videos, the first input is
13583 considered the "main" source and is passed unchanged to the
13584 output. The second input is used as a "reference" video for computing
13587 Both video inputs must have the same resolution and pixel format for
13588 this filter to work correctly. Also it assumes that both inputs
13589 have the same number of frames, which are compared one by one.
13591 The obtained average PSNR is printed through the logging system.
13593 The filter stores the accumulated MSE (mean squared error) of each
13594 frame, and at the end of the processing it is averaged across all frames
13595 equally, and the following formula is applied to obtain the PSNR:
13598 PSNR = 10*log10(MAX^2/MSE)
13601 Where MAX is the average of the maximum values of each component of the
13604 The description of the accepted parameters follows.
13607 @item stats_file, f
13608 If specified the filter will use the named file to save the PSNR of
13609 each individual frame. When filename equals "-" the data is sent to
13612 @item stats_version
13613 Specifies which version of the stats file format to use. Details of
13614 each format are written below.
13615 Default value is 1.
13617 @item stats_add_max
13618 Determines whether the max value is output to the stats log.
13619 Default value is 0.
13620 Requires stats_version >= 2. If this is set and stats_version < 2,
13621 the filter will return an error.
13624 This filter also supports the @ref{framesync} options.
13626 The file printed if @var{stats_file} is selected, contains a sequence of
13627 key/value pairs of the form @var{key}:@var{value} for each compared
13630 If a @var{stats_version} greater than 1 is specified, a header line precedes
13631 the list of per-frame-pair stats, with key value pairs following the frame
13632 format with the following parameters:
13635 @item psnr_log_version
13636 The version of the log file format. Will match @var{stats_version}.
13639 A comma separated list of the per-frame-pair parameters included in
13643 A description of each shown per-frame-pair parameter follows:
13647 sequential number of the input frame, starting from 1
13650 Mean Square Error pixel-by-pixel average difference of the compared
13651 frames, averaged over all the image components.
13653 @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
13654 Mean Square Error pixel-by-pixel average difference of the compared
13655 frames for the component specified by the suffix.
13657 @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
13658 Peak Signal to Noise ratio of the compared frames for the component
13659 specified by the suffix.
13661 @item max_avg, max_y, max_u, max_v
13662 Maximum allowed value for each channel, and average over all
13668 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
13669 [main][ref] psnr="stats_file=stats.log" [out]
13672 On this example the input file being processed is compared with the
13673 reference file @file{ref_movie.mpg}. The PSNR of each individual frame
13674 is stored in @file{stats.log}.
13679 Pulldown reversal (inverse telecine) filter, capable of handling mixed
13680 hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
13683 The pullup filter is designed to take advantage of future context in making
13684 its decisions. This filter is stateless in the sense that it does not lock
13685 onto a pattern to follow, but it instead looks forward to the following
13686 fields in order to identify matches and rebuild progressive frames.
13688 To produce content with an even framerate, insert the fps filter after
13689 pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
13690 @code{fps=24} for 30fps and the (rare) telecined 25fps input.
13692 The filter accepts the following options:
13699 These options set the amount of "junk" to ignore at the left, right, top, and
13700 bottom of the image, respectively. Left and right are in units of 8 pixels,
13701 while top and bottom are in units of 2 lines.
13702 The default is 8 pixels on each side.
13705 Set the strict breaks. Setting this option to 1 will reduce the chances of
13706 filter generating an occasional mismatched frame, but it may also cause an
13707 excessive number of frames to be dropped during high motion sequences.
13708 Conversely, setting it to -1 will make filter match fields more easily.
13709 This may help processing of video where there is slight blurring between
13710 the fields, but may also cause there to be interlaced frames in the output.
13711 Default value is @code{0}.
13714 Set the metric plane to use. It accepts the following values:
13720 Use chroma blue plane.
13723 Use chroma red plane.
13726 This option may be set to use chroma plane instead of the default luma plane
13727 for doing filter's computations. This may improve accuracy on very clean
13728 source material, but more likely will decrease accuracy, especially if there
13729 is chroma noise (rainbow effect) or any grayscale video.
13730 The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
13731 load and make pullup usable in realtime on slow machines.
13734 For best results (without duplicated frames in the output file) it is
13735 necessary to change the output frame rate. For example, to inverse
13736 telecine NTSC input:
13738 ffmpeg -i input -vf pullup -r 24000/1001 ...
13743 Change video quantization parameters (QP).
13745 The filter accepts the following option:
13749 Set expression for quantization parameter.
13752 The expression is evaluated through the eval API and can contain, among others,
13753 the following constants:
13757 1 if index is not 129, 0 otherwise.
13760 Sequential index starting from -129 to 128.
13763 @subsection Examples
13767 Some equation like:
13775 Flush video frames from internal cache of frames into a random order.
13776 No frame is discarded.
13777 Inspired by @ref{frei0r} nervous filter.
13781 Set size in number of frames of internal cache, in range from @code{2} to
13782 @code{512}. Default is @code{30}.
13785 Set seed for random number generator, must be an integer included between
13786 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
13787 less than @code{0}, the filter will try to use a good random seed on a
13791 @section readeia608
13793 Read closed captioning (EIA-608) information from the top lines of a video frame.
13795 This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
13796 @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
13797 with EIA-608 data (starting from 0). A description of each metadata value follows:
13800 @item lavfi.readeia608.X.cc
13801 The two bytes stored as EIA-608 data (printed in hexadecimal).
13803 @item lavfi.readeia608.X.line
13804 The number of the line on which the EIA-608 data was identified and read.
13807 This filter accepts the following options:
13811 Set the line to start scanning for EIA-608 data. Default is @code{0}.
13814 Set the line to end scanning for EIA-608 data. Default is @code{29}.
13817 Set minimal acceptable amplitude change for sync codes detection.
13818 Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
13821 Set the ratio of width reserved for sync code detection.
13822 Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
13825 Set the max peaks height difference for sync code detection.
13826 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
13829 Set max peaks period difference for sync code detection.
13830 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
13833 Set the first two max start code bits differences.
13834 Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
13837 Set the minimum ratio of bits height compared to 3rd start code bit.
13838 Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
13841 Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
13844 Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
13847 Enable checking the parity bit. In the event of a parity error, the filter will output
13848 @code{0x00} for that character. Default is false.
13851 @subsection Examples
13855 Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
13857 ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
13863 Read vertical interval timecode (VITC) information from the top lines of a
13866 The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
13867 timecode value, if a valid timecode has been detected. Further metadata key
13868 @code{lavfi.readvitc.found} is set to 0/1 depending on whether
13869 timecode data has been found or not.
13871 This filter accepts the following options:
13875 Set the maximum number of lines to scan for VITC data. If the value is set to
13876 @code{-1} the full video frame is scanned. Default is @code{45}.
13879 Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
13880 default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
13883 Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
13884 default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
13887 @subsection Examples
13891 Detect and draw VITC data onto the video frame; if no valid VITC is detected,
13892 draw @code{--:--:--:--} as a placeholder:
13894 ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
13900 Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
13902 Destination pixel at position (X, Y) will be picked from source (x, y) position
13903 where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
13904 value for pixel will be used for destination pixel.
13906 Xmap and Ymap input video streams must be of same dimensions. Output video stream
13907 will have Xmap/Ymap video stream dimensions.
13908 Xmap and Ymap input video streams are 16bit depth, single channel.
13910 @section removegrain
13912 The removegrain filter is a spatial denoiser for progressive video.
13916 Set mode for the first plane.
13919 Set mode for the second plane.
13922 Set mode for the third plane.
13925 Set mode for the fourth plane.
13928 Range of mode is from 0 to 24. Description of each mode follows:
13932 Leave input plane unchanged. Default.
13935 Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
13938 Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
13941 Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
13944 Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
13945 This is equivalent to a median filter.
13948 Line-sensitive clipping giving the minimal change.
13951 Line-sensitive clipping, intermediate.
13954 Line-sensitive clipping, intermediate.
13957 Line-sensitive clipping, intermediate.
13960 Line-sensitive clipping on a line where the neighbours pixels are the closest.
13963 Replaces the target pixel with the closest neighbour.
13966 [1 2 1] horizontal and vertical kernel blur.
13972 Bob mode, interpolates top field from the line where the neighbours
13973 pixels are the closest.
13976 Bob mode, interpolates bottom field from the line where the neighbours
13977 pixels are the closest.
13980 Bob mode, interpolates top field. Same as 13 but with a more complicated
13981 interpolation formula.
13984 Bob mode, interpolates bottom field. Same as 14 but with a more complicated
13985 interpolation formula.
13988 Clips the pixel with the minimum and maximum of respectively the maximum and
13989 minimum of each pair of opposite neighbour pixels.
13992 Line-sensitive clipping using opposite neighbours whose greatest distance from
13993 the current pixel is minimal.
13996 Replaces the pixel with the average of its 8 neighbours.
13999 Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
14002 Clips pixels using the averages of opposite neighbour.
14005 Same as mode 21 but simpler and faster.
14008 Small edge and halo removal, but reputed useless.
14014 @section removelogo
14016 Suppress a TV station logo, using an image file to determine which
14017 pixels comprise the logo. It works by filling in the pixels that
14018 comprise the logo with neighboring pixels.
14020 The filter accepts the following options:
14024 Set the filter bitmap file, which can be any image format supported by
14025 libavformat. The width and height of the image file must match those of the
14026 video stream being processed.
14029 Pixels in the provided bitmap image with a value of zero are not
14030 considered part of the logo, non-zero pixels are considered part of
14031 the logo. If you use white (255) for the logo and black (0) for the
14032 rest, you will be safe. For making the filter bitmap, it is
14033 recommended to take a screen capture of a black frame with the logo
14034 visible, and then using a threshold filter followed by the erode
14035 filter once or twice.
14037 If needed, little splotches can be fixed manually. Remember that if
14038 logo pixels are not covered, the filter quality will be much
14039 reduced. Marking too many pixels as part of the logo does not hurt as
14040 much, but it will increase the amount of blurring needed to cover over
14041 the image and will destroy more information than necessary, and extra
14042 pixels will slow things down on a large logo.
14044 @section repeatfields
14046 This filter uses the repeat_field flag from the Video ES headers and hard repeats
14047 fields based on its value.
14051 Reverse a video clip.
14053 Warning: This filter requires memory to buffer the entire clip, so trimming
14056 @subsection Examples
14060 Take the first 5 seconds of a clip, and reverse it.
14067 Apply roberts cross operator to input video stream.
14069 The filter accepts the following option:
14073 Set which planes will be processed, unprocessed planes will be copied.
14074 By default value 0xf, all planes will be processed.
14077 Set value which will be multiplied with filtered result.
14080 Set value which will be added to filtered result.
14085 Rotate video by an arbitrary angle expressed in radians.
14087 The filter accepts the following options:
14089 A description of the optional parameters follows.
14092 Set an expression for the angle by which to rotate the input video
14093 clockwise, expressed as a number of radians. A negative value will
14094 result in a counter-clockwise rotation. By default it is set to "0".
14096 This expression is evaluated for each frame.
14099 Set the output width expression, default value is "iw".
14100 This expression is evaluated just once during configuration.
14103 Set the output height expression, default value is "ih".
14104 This expression is evaluated just once during configuration.
14107 Enable bilinear interpolation if set to 1, a value of 0 disables
14108 it. Default value is 1.
14111 Set the color used to fill the output area not covered by the rotated
14112 image. For the general syntax of this option, check the
14113 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
14114 If the special value "none" is selected then no
14115 background is printed (useful for example if the background is never shown).
14117 Default value is "black".
14120 The expressions for the angle and the output size can contain the
14121 following constants and functions:
14125 sequential number of the input frame, starting from 0. It is always NAN
14126 before the first frame is filtered.
14129 time in seconds of the input frame, it is set to 0 when the filter is
14130 configured. It is always NAN before the first frame is filtered.
14134 horizontal and vertical chroma subsample values. For example for the
14135 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14139 the input video width and height
14143 the output width and height, that is the size of the padded area as
14144 specified by the @var{width} and @var{height} expressions
14148 the minimal width/height required for completely containing the input
14149 video rotated by @var{a} radians.
14151 These are only available when computing the @option{out_w} and
14152 @option{out_h} expressions.
14155 @subsection Examples
14159 Rotate the input by PI/6 radians clockwise:
14165 Rotate the input by PI/6 radians counter-clockwise:
14171 Rotate the input by 45 degrees clockwise:
14177 Apply a constant rotation with period T, starting from an angle of PI/3:
14179 rotate=PI/3+2*PI*t/T
14183 Make the input video rotation oscillating with a period of T
14184 seconds and an amplitude of A radians:
14186 rotate=A*sin(2*PI/T*t)
14190 Rotate the video, output size is chosen so that the whole rotating
14191 input video is always completely contained in the output:
14193 rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
14197 Rotate the video, reduce the output size so that no background is ever
14200 rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
14204 @subsection Commands
14206 The filter supports the following commands:
14210 Set the angle expression.
14211 The command accepts the same syntax of the corresponding option.
14213 If the specified expression is not valid, it is kept at its current
14219 Apply Shape Adaptive Blur.
14221 The filter accepts the following options:
14224 @item luma_radius, lr
14225 Set luma blur filter strength, must be a value in range 0.1-4.0, default
14226 value is 1.0. A greater value will result in a more blurred image, and
14227 in slower processing.
14229 @item luma_pre_filter_radius, lpfr
14230 Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
14233 @item luma_strength, ls
14234 Set luma maximum difference between pixels to still be considered, must
14235 be a value in the 0.1-100.0 range, default value is 1.0.
14237 @item chroma_radius, cr
14238 Set chroma blur filter strength, must be a value in range -0.9-4.0. A
14239 greater value will result in a more blurred image, and in slower
14242 @item chroma_pre_filter_radius, cpfr
14243 Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
14245 @item chroma_strength, cs
14246 Set chroma maximum difference between pixels to still be considered,
14247 must be a value in the -0.9-100.0 range.
14250 Each chroma option value, if not explicitly specified, is set to the
14251 corresponding luma option value.
14256 Scale (resize) the input video, using the libswscale library.
14258 The scale filter forces the output display aspect ratio to be the same
14259 of the input, by changing the output sample aspect ratio.
14261 If the input image format is different from the format requested by
14262 the next filter, the scale filter will convert the input to the
14265 @subsection Options
14266 The filter accepts the following options, or any of the options
14267 supported by the libswscale scaler.
14269 See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
14270 the complete list of scaler options.
14275 Set the output video dimension expression. Default value is the input
14278 If the @var{width} or @var{w} value is 0, the input width is used for
14279 the output. If the @var{height} or @var{h} value is 0, the input height
14280 is used for the output.
14282 If one and only one of the values is -n with n >= 1, the scale filter
14283 will use a value that maintains the aspect ratio of the input image,
14284 calculated from the other specified dimension. After that it will,
14285 however, make sure that the calculated dimension is divisible by n and
14286 adjust the value if necessary.
14288 If both values are -n with n >= 1, the behavior will be identical to
14289 both values being set to 0 as previously detailed.
14291 See below for the list of accepted constants for use in the dimension
14295 Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
14299 Only evaluate expressions once during the filter initialization or when a command is processed.
14302 Evaluate expressions for each incoming frame.
14306 Default value is @samp{init}.
14310 Set the interlacing mode. It accepts the following values:
14314 Force interlaced aware scaling.
14317 Do not apply interlaced scaling.
14320 Select interlaced aware scaling depending on whether the source frames
14321 are flagged as interlaced or not.
14324 Default value is @samp{0}.
14327 Set libswscale scaling flags. See
14328 @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
14329 complete list of values. If not explicitly specified the filter applies
14333 @item param0, param1
14334 Set libswscale input parameters for scaling algorithms that need them. See
14335 @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
14336 complete documentation. If not explicitly specified the filter applies
14342 Set the video size. For the syntax of this option, check the
14343 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
14345 @item in_color_matrix
14346 @item out_color_matrix
14347 Set in/output YCbCr color space type.
14349 This allows the autodetected value to be overridden as well as allows forcing
14350 a specific value used for the output and encoder.
14352 If not specified, the color space type depends on the pixel format.
14358 Choose automatically.
14361 Format conforming to International Telecommunication Union (ITU)
14362 Recommendation BT.709.
14365 Set color space conforming to the United States Federal Communications
14366 Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
14369 Set color space conforming to:
14373 ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
14376 ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
14379 Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
14384 Set color space conforming to SMPTE ST 240:1999.
14389 Set in/output YCbCr sample range.
14391 This allows the autodetected value to be overridden as well as allows forcing
14392 a specific value used for the output and encoder. If not specified, the
14393 range depends on the pixel format. Possible values:
14397 Choose automatically.
14400 Set full range (0-255 in case of 8-bit luma).
14402 @item mpeg/limited/tv
14403 Set "MPEG" range (16-235 in case of 8-bit luma).
14406 @item force_original_aspect_ratio
14407 Enable decreasing or increasing output video width or height if necessary to
14408 keep the original aspect ratio. Possible values:
14412 Scale the video as specified and disable this feature.
14415 The output video dimensions will automatically be decreased if needed.
14418 The output video dimensions will automatically be increased if needed.
14422 One useful instance of this option is that when you know a specific device's
14423 maximum allowed resolution, you can use this to limit the output video to
14424 that, while retaining the aspect ratio. For example, device A allows
14425 1280x720 playback, and your video is 1920x800. Using this option (set it to
14426 decrease) and specifying 1280x720 to the command line makes the output
14429 Please note that this is a different thing than specifying -1 for @option{w}
14430 or @option{h}, you still need to specify the output resolution for this option
14435 The values of the @option{w} and @option{h} options are expressions
14436 containing the following constants:
14441 The input width and height
14445 These are the same as @var{in_w} and @var{in_h}.
14449 The output (scaled) width and height
14453 These are the same as @var{out_w} and @var{out_h}
14456 The same as @var{iw} / @var{ih}
14459 input sample aspect ratio
14462 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
14466 horizontal and vertical input chroma subsample values. For example for the
14467 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14471 horizontal and vertical output chroma subsample values. For example for the
14472 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14475 @subsection Examples
14479 Scale the input video to a size of 200x100
14484 This is equivalent to:
14495 Specify a size abbreviation for the output size:
14500 which can also be written as:
14506 Scale the input to 2x:
14508 scale=w=2*iw:h=2*ih
14512 The above is the same as:
14514 scale=2*in_w:2*in_h
14518 Scale the input to 2x with forced interlaced scaling:
14520 scale=2*iw:2*ih:interl=1
14524 Scale the input to half size:
14526 scale=w=iw/2:h=ih/2
14530 Increase the width, and set the height to the same size:
14536 Seek Greek harmony:
14543 Increase the height, and set the width to 3/2 of the height:
14545 scale=w=3/2*oh:h=3/5*ih
14549 Increase the size, making the size a multiple of the chroma
14552 scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
14556 Increase the width to a maximum of 500 pixels,
14557 keeping the same aspect ratio as the input:
14559 scale=w='min(500\, iw*3/2):h=-1'
14563 Make pixels square by combining scale and setsar:
14565 scale='trunc(ih*dar):ih',setsar=1/1
14569 Make pixels square by combining scale and setsar,
14570 making sure the resulting resolution is even (required by some codecs):
14572 scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
14576 @subsection Commands
14578 This filter supports the following commands:
14582 Set the output video dimension expression.
14583 The command accepts the same syntax of the corresponding option.
14585 If the specified expression is not valid, it is kept at its current
14591 Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
14592 format conversion on CUDA video frames. Setting the output width and height
14593 works in the same way as for the @var{scale} filter.
14595 The following additional options are accepted:
14598 The pixel format of the output CUDA frames. If set to the string "same" (the
14599 default), the input format will be kept. Note that automatic format negotiation
14600 and conversion is not yet supported for hardware frames
14603 The interpolation algorithm used for resizing. One of the following:
14610 @item cubic2p_bspline
14611 2-parameter cubic (B=1, C=0)
14613 @item cubic2p_catmullrom
14614 2-parameter cubic (B=0, C=1/2)
14616 @item cubic2p_b05c03
14617 2-parameter cubic (B=1/2, C=3/10)
14629 Scale (resize) the input video, based on a reference video.
14631 See the scale filter for available options, scale2ref supports the same but
14632 uses the reference video instead of the main input as basis. scale2ref also
14633 supports the following additional constants for the @option{w} and
14634 @option{h} options:
14639 The main input video's width and height
14642 The same as @var{main_w} / @var{main_h}
14645 The main input video's sample aspect ratio
14647 @item main_dar, mdar
14648 The main input video's display aspect ratio. Calculated from
14649 @code{(main_w / main_h) * main_sar}.
14653 The main input video's horizontal and vertical chroma subsample values.
14654 For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
14658 @subsection Examples
14662 Scale a subtitle stream (b) to match the main video (a) in size before overlaying
14664 'scale2ref[b][a];[a][b]overlay'
14668 @anchor{selectivecolor}
14669 @section selectivecolor
14671 Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
14672 as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
14673 by the "purity" of the color (that is, how saturated it already is).
14675 This filter is similar to the Adobe Photoshop Selective Color tool.
14677 The filter accepts the following options:
14680 @item correction_method
14681 Select color correction method.
14683 Available values are:
14686 Specified adjustments are applied "as-is" (added/subtracted to original pixel
14689 Specified adjustments are relative to the original component value.
14691 Default is @code{absolute}.
14693 Adjustments for red pixels (pixels where the red component is the maximum)
14695 Adjustments for yellow pixels (pixels where the blue component is the minimum)
14697 Adjustments for green pixels (pixels where the green component is the maximum)
14699 Adjustments for cyan pixels (pixels where the red component is the minimum)
14701 Adjustments for blue pixels (pixels where the blue component is the maximum)
14703 Adjustments for magenta pixels (pixels where the green component is the minimum)
14705 Adjustments for white pixels (pixels where all components are greater than 128)
14707 Adjustments for all pixels except pure black and pure white
14709 Adjustments for black pixels (pixels where all components are lesser than 128)
14711 Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
14714 All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
14715 4 space separated floating point adjustment values in the [-1,1] range,
14716 respectively to adjust the amount of cyan, magenta, yellow and black for the
14717 pixels of its range.
14719 @subsection Examples
14723 Increase cyan by 50% and reduce yellow by 33% in every green areas, and
14724 increase magenta by 27% in blue areas:
14726 selectivecolor=greens=.5 0 -.33 0:blues=0 .27
14730 Use a Photoshop selective color preset:
14732 selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
14736 @anchor{separatefields}
14737 @section separatefields
14739 The @code{separatefields} takes a frame-based video input and splits
14740 each frame into its components fields, producing a new half height clip
14741 with twice the frame rate and twice the frame count.
14743 This filter use field-dominance information in frame to decide which
14744 of each pair of fields to place first in the output.
14745 If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
14747 @section setdar, setsar
14749 The @code{setdar} filter sets the Display Aspect Ratio for the filter
14752 This is done by changing the specified Sample (aka Pixel) Aspect
14753 Ratio, according to the following equation:
14755 @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
14758 Keep in mind that the @code{setdar} filter does not modify the pixel
14759 dimensions of the video frame. Also, the display aspect ratio set by
14760 this filter may be changed by later filters in the filterchain,
14761 e.g. in case of scaling or if another "setdar" or a "setsar" filter is
14764 The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
14765 the filter output video.
14767 Note that as a consequence of the application of this filter, the
14768 output display aspect ratio will change according to the equation
14771 Keep in mind that the sample aspect ratio set by the @code{setsar}
14772 filter may be changed by later filters in the filterchain, e.g. if
14773 another "setsar" or a "setdar" filter is applied.
14775 It accepts the following parameters:
14778 @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
14779 Set the aspect ratio used by the filter.
14781 The parameter can be a floating point number string, an expression, or
14782 a string of the form @var{num}:@var{den}, where @var{num} and
14783 @var{den} are the numerator and denominator of the aspect ratio. If
14784 the parameter is not specified, it is assumed the value "0".
14785 In case the form "@var{num}:@var{den}" is used, the @code{:} character
14789 Set the maximum integer value to use for expressing numerator and
14790 denominator when reducing the expressed aspect ratio to a rational.
14791 Default value is @code{100}.
14795 The parameter @var{sar} is an expression containing
14796 the following constants:
14800 These are approximated values for the mathematical constants e
14801 (Euler's number), pi (Greek pi), and phi (the golden ratio).
14804 The input width and height.
14807 These are the same as @var{w} / @var{h}.
14810 The input sample aspect ratio.
14813 The input display aspect ratio. It is the same as
14814 (@var{w} / @var{h}) * @var{sar}.
14817 Horizontal and vertical chroma subsample values. For example, for the
14818 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14821 @subsection Examples
14826 To change the display aspect ratio to 16:9, specify one of the following:
14833 To change the sample aspect ratio to 10:11, specify:
14839 To set a display aspect ratio of 16:9, and specify a maximum integer value of
14840 1000 in the aspect ratio reduction, use the command:
14842 setdar=ratio=16/9:max=1000
14850 Force field for the output video frame.
14852 The @code{setfield} filter marks the interlace type field for the
14853 output frames. It does not change the input frame, but only sets the
14854 corresponding property, which affects how the frame is treated by
14855 following filters (e.g. @code{fieldorder} or @code{yadif}).
14857 The filter accepts the following options:
14862 Available values are:
14866 Keep the same field property.
14869 Mark the frame as bottom-field-first.
14872 Mark the frame as top-field-first.
14875 Mark the frame as progressive.
14881 Show a line containing various information for each input video frame.
14882 The input video is not modified.
14884 The shown line contains a sequence of key/value pairs of the form
14885 @var{key}:@var{value}.
14887 The following values are shown in the output:
14891 The (sequential) number of the input frame, starting from 0.
14894 The Presentation TimeStamp of the input frame, expressed as a number of
14895 time base units. The time base unit depends on the filter input pad.
14898 The Presentation TimeStamp of the input frame, expressed as a number of
14902 The position of the frame in the input stream, or -1 if this information is
14903 unavailable and/or meaningless (for example in case of synthetic video).
14906 The pixel format name.
14909 The sample aspect ratio of the input frame, expressed in the form
14910 @var{num}/@var{den}.
14913 The size of the input frame. For the syntax of this option, check the
14914 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
14917 The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
14918 for bottom field first).
14921 This is 1 if the frame is a key frame, 0 otherwise.
14924 The picture type of the input frame ("I" for an I-frame, "P" for a
14925 P-frame, "B" for a B-frame, or "?" for an unknown type).
14926 Also refer to the documentation of the @code{AVPictureType} enum and of
14927 the @code{av_get_picture_type_char} function defined in
14928 @file{libavutil/avutil.h}.
14931 The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
14933 @item plane_checksum
14934 The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
14935 expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
14938 @section showpalette
14940 Displays the 256 colors palette of each frame. This filter is only relevant for
14941 @var{pal8} pixel format frames.
14943 It accepts the following option:
14947 Set the size of the box used to represent one palette color entry. Default is
14948 @code{30} (for a @code{30x30} pixel box).
14951 @section shuffleframes
14953 Reorder and/or duplicate and/or drop video frames.
14955 It accepts the following parameters:
14959 Set the destination indexes of input frames.
14960 This is space or '|' separated list of indexes that maps input frames to output
14961 frames. Number of indexes also sets maximal value that each index may have.
14962 '-1' index have special meaning and that is to drop frame.
14965 The first frame has the index 0. The default is to keep the input unchanged.
14967 @subsection Examples
14971 Swap second and third frame of every three frames of the input:
14973 ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
14977 Swap 10th and 1st frame of every ten frames of the input:
14979 ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
14983 @section shuffleplanes
14985 Reorder and/or duplicate video planes.
14987 It accepts the following parameters:
14992 The index of the input plane to be used as the first output plane.
14995 The index of the input plane to be used as the second output plane.
14998 The index of the input plane to be used as the third output plane.
15001 The index of the input plane to be used as the fourth output plane.
15005 The first plane has the index 0. The default is to keep the input unchanged.
15007 @subsection Examples
15011 Swap the second and third planes of the input:
15013 ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
15017 @anchor{signalstats}
15018 @section signalstats
15019 Evaluate various visual metrics that assist in determining issues associated
15020 with the digitization of analog video media.
15022 By default the filter will log these metadata values:
15026 Display the minimal Y value contained within the input frame. Expressed in
15030 Display the Y value at the 10% percentile within the input frame. Expressed in
15034 Display the average Y value within the input frame. Expressed in range of
15038 Display the Y value at the 90% percentile within the input frame. Expressed in
15042 Display the maximum Y value contained within the input frame. Expressed in
15046 Display the minimal U value contained within the input frame. Expressed in
15050 Display the U value at the 10% percentile within the input frame. Expressed in
15054 Display the average U value within the input frame. Expressed in range of
15058 Display the U value at the 90% percentile within the input frame. Expressed in
15062 Display the maximum U value contained within the input frame. Expressed in
15066 Display the minimal V value contained within the input frame. Expressed in
15070 Display the V value at the 10% percentile within the input frame. Expressed in
15074 Display the average V value within the input frame. Expressed in range of
15078 Display the V value at the 90% percentile within the input frame. Expressed in
15082 Display the maximum V value contained within the input frame. Expressed in
15086 Display the minimal saturation value contained within the input frame.
15087 Expressed in range of [0-~181.02].
15090 Display the saturation value at the 10% percentile within the input frame.
15091 Expressed in range of [0-~181.02].
15094 Display the average saturation value within the input frame. Expressed in range
15098 Display the saturation value at the 90% percentile within the input frame.
15099 Expressed in range of [0-~181.02].
15102 Display the maximum saturation value contained within the input frame.
15103 Expressed in range of [0-~181.02].
15106 Display the median value for hue within the input frame. Expressed in range of
15110 Display the average value for hue within the input frame. Expressed in range of
15114 Display the average of sample value difference between all values of the Y
15115 plane in the current frame and corresponding values of the previous input frame.
15116 Expressed in range of [0-255].
15119 Display the average of sample value difference between all values of the U
15120 plane in the current frame and corresponding values of the previous input frame.
15121 Expressed in range of [0-255].
15124 Display the average of sample value difference between all values of the V
15125 plane in the current frame and corresponding values of the previous input frame.
15126 Expressed in range of [0-255].
15129 Display bit depth of Y plane in current frame.
15130 Expressed in range of [0-16].
15133 Display bit depth of U plane in current frame.
15134 Expressed in range of [0-16].
15137 Display bit depth of V plane in current frame.
15138 Expressed in range of [0-16].
15141 The filter accepts the following options:
15147 @option{stat} specify an additional form of image analysis.
15148 @option{out} output video with the specified type of pixel highlighted.
15150 Both options accept the following values:
15154 Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
15155 unlike the neighboring pixels of the same field. Examples of temporal outliers
15156 include the results of video dropouts, head clogs, or tape tracking issues.
15159 Identify @var{vertical line repetition}. Vertical line repetition includes
15160 similar rows of pixels within a frame. In born-digital video vertical line
15161 repetition is common, but this pattern is uncommon in video digitized from an
15162 analog source. When it occurs in video that results from the digitization of an
15163 analog source it can indicate concealment from a dropout compensator.
15166 Identify pixels that fall outside of legal broadcast range.
15170 Set the highlight color for the @option{out} option. The default color is
15174 @subsection Examples
15178 Output data of various video metrics:
15180 ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
15184 Output specific data about the minimum and maximum values of the Y plane per frame:
15186 ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
15190 Playback video while highlighting pixels that are outside of broadcast range in red.
15192 ffplay example.mov -vf signalstats="out=brng:color=red"
15196 Playback video with signalstats metadata drawn over the frame.
15198 ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
15201 The contents of signalstat_drawtext.txt used in the command are:
15204 Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
15205 U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
15206 V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
15207 saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
15215 Calculates the MPEG-7 Video Signature. The filter can handle more than one
15216 input. In this case the matching between the inputs can be calculated additionally.
15217 The filter always passes through the first input. The signature of each stream can
15218 be written into a file.
15220 It accepts the following options:
15224 Enable or disable the matching process.
15226 Available values are:
15230 Disable the calculation of a matching (default).
15232 Calculate the matching for the whole video and output whether the whole video
15233 matches or only parts.
15235 Calculate only until a matching is found or the video ends. Should be faster in
15240 Set the number of inputs. The option value must be a non negative integer.
15241 Default value is 1.
15244 Set the path to which the output is written. If there is more than one input,
15245 the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
15246 integer), that will be replaced with the input number. If no filename is
15247 specified, no output will be written. This is the default.
15250 Choose the output format.
15252 Available values are:
15256 Use the specified binary representation (default).
15258 Use the specified xml representation.
15262 Set threshold to detect one word as similar. The option value must be an integer
15263 greater than zero. The default value is 9000.
15266 Set threshold to detect all words as similar. The option value must be an integer
15267 greater than zero. The default value is 60000.
15270 Set threshold to detect frames as similar. The option value must be an integer
15271 greater than zero. The default value is 116.
15274 Set the minimum length of a sequence in frames to recognize it as matching
15275 sequence. The option value must be a non negative integer value.
15276 The default value is 0.
15279 Set the minimum relation, that matching frames to all frames must have.
15280 The option value must be a double value between 0 and 1. The default value is 0.5.
15283 @subsection Examples
15287 To calculate the signature of an input video and store it in signature.bin:
15289 ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
15293 To detect whether two videos match and store the signatures in XML format in
15294 signature0.xml and signature1.xml:
15296 ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
15304 Blur the input video without impacting the outlines.
15306 It accepts the following options:
15309 @item luma_radius, lr
15310 Set the luma radius. The option value must be a float number in
15311 the range [0.1,5.0] that specifies the variance of the gaussian filter
15312 used to blur the image (slower if larger). Default value is 1.0.
15314 @item luma_strength, ls
15315 Set the luma strength. The option value must be a float number
15316 in the range [-1.0,1.0] that configures the blurring. A value included
15317 in [0.0,1.0] will blur the image whereas a value included in
15318 [-1.0,0.0] will sharpen the image. Default value is 1.0.
15320 @item luma_threshold, lt
15321 Set the luma threshold used as a coefficient to determine
15322 whether a pixel should be blurred or not. The option value must be an
15323 integer in the range [-30,30]. A value of 0 will filter all the image,
15324 a value included in [0,30] will filter flat areas and a value included
15325 in [-30,0] will filter edges. Default value is 0.
15327 @item chroma_radius, cr
15328 Set the chroma radius. The option value must be a float number in
15329 the range [0.1,5.0] that specifies the variance of the gaussian filter
15330 used to blur the image (slower if larger). Default value is @option{luma_radius}.
15332 @item chroma_strength, cs
15333 Set the chroma strength. The option value must be a float number
15334 in the range [-1.0,1.0] that configures the blurring. A value included
15335 in [0.0,1.0] will blur the image whereas a value included in
15336 [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
15338 @item chroma_threshold, ct
15339 Set the chroma threshold used as a coefficient to determine
15340 whether a pixel should be blurred or not. The option value must be an
15341 integer in the range [-30,30]. A value of 0 will filter all the image,
15342 a value included in [0,30] will filter flat areas and a value included
15343 in [-30,0] will filter edges. Default value is @option{luma_threshold}.
15346 If a chroma option is not explicitly set, the corresponding luma value
15351 Obtain the SSIM (Structural SImilarity Metric) between two input videos.
15353 This filter takes in input two input videos, the first input is
15354 considered the "main" source and is passed unchanged to the
15355 output. The second input is used as a "reference" video for computing
15358 Both video inputs must have the same resolution and pixel format for
15359 this filter to work correctly. Also it assumes that both inputs
15360 have the same number of frames, which are compared one by one.
15362 The filter stores the calculated SSIM of each frame.
15364 The description of the accepted parameters follows.
15367 @item stats_file, f
15368 If specified the filter will use the named file to save the SSIM of
15369 each individual frame. When filename equals "-" the data is sent to
15373 The file printed if @var{stats_file} is selected, contains a sequence of
15374 key/value pairs of the form @var{key}:@var{value} for each compared
15377 A description of each shown parameter follows:
15381 sequential number of the input frame, starting from 1
15383 @item Y, U, V, R, G, B
15384 SSIM of the compared frames for the component specified by the suffix.
15387 SSIM of the compared frames for the whole frame.
15390 Same as above but in dB representation.
15393 This filter also supports the @ref{framesync} options.
15397 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
15398 [main][ref] ssim="stats_file=stats.log" [out]
15401 On this example the input file being processed is compared with the
15402 reference file @file{ref_movie.mpg}. The SSIM of each individual frame
15403 is stored in @file{stats.log}.
15405 Another example with both psnr and ssim at same time:
15407 ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
15412 Convert between different stereoscopic image formats.
15414 The filters accept the following options:
15418 Set stereoscopic image format of input.
15420 Available values for input image formats are:
15423 side by side parallel (left eye left, right eye right)
15426 side by side crosseye (right eye left, left eye right)
15429 side by side parallel with half width resolution
15430 (left eye left, right eye right)
15433 side by side crosseye with half width resolution
15434 (right eye left, left eye right)
15437 above-below (left eye above, right eye below)
15440 above-below (right eye above, left eye below)
15443 above-below with half height resolution
15444 (left eye above, right eye below)
15447 above-below with half height resolution
15448 (right eye above, left eye below)
15451 alternating frames (left eye first, right eye second)
15454 alternating frames (right eye first, left eye second)
15457 interleaved rows (left eye has top row, right eye starts on next row)
15460 interleaved rows (right eye has top row, left eye starts on next row)
15463 interleaved columns, left eye first
15466 interleaved columns, right eye first
15468 Default value is @samp{sbsl}.
15472 Set stereoscopic image format of output.
15476 side by side parallel (left eye left, right eye right)
15479 side by side crosseye (right eye left, left eye right)
15482 side by side parallel with half width resolution
15483 (left eye left, right eye right)
15486 side by side crosseye with half width resolution
15487 (right eye left, left eye right)
15490 above-below (left eye above, right eye below)
15493 above-below (right eye above, left eye below)
15496 above-below with half height resolution
15497 (left eye above, right eye below)
15500 above-below with half height resolution
15501 (right eye above, left eye below)
15504 alternating frames (left eye first, right eye second)
15507 alternating frames (right eye first, left eye second)
15510 interleaved rows (left eye has top row, right eye starts on next row)
15513 interleaved rows (right eye has top row, left eye starts on next row)
15516 anaglyph red/blue gray
15517 (red filter on left eye, blue filter on right eye)
15520 anaglyph red/green gray
15521 (red filter on left eye, green filter on right eye)
15524 anaglyph red/cyan gray
15525 (red filter on left eye, cyan filter on right eye)
15528 anaglyph red/cyan half colored
15529 (red filter on left eye, cyan filter on right eye)
15532 anaglyph red/cyan color
15533 (red filter on left eye, cyan filter on right eye)
15536 anaglyph red/cyan color optimized with the least squares projection of dubois
15537 (red filter on left eye, cyan filter on right eye)
15540 anaglyph green/magenta gray
15541 (green filter on left eye, magenta filter on right eye)
15544 anaglyph green/magenta half colored
15545 (green filter on left eye, magenta filter on right eye)
15548 anaglyph green/magenta colored
15549 (green filter on left eye, magenta filter on right eye)
15552 anaglyph green/magenta color optimized with the least squares projection of dubois
15553 (green filter on left eye, magenta filter on right eye)
15556 anaglyph yellow/blue gray
15557 (yellow filter on left eye, blue filter on right eye)
15560 anaglyph yellow/blue half colored
15561 (yellow filter on left eye, blue filter on right eye)
15564 anaglyph yellow/blue colored
15565 (yellow filter on left eye, blue filter on right eye)
15568 anaglyph yellow/blue color optimized with the least squares projection of dubois
15569 (yellow filter on left eye, blue filter on right eye)
15572 mono output (left eye only)
15575 mono output (right eye only)
15578 checkerboard, left eye first
15581 checkerboard, right eye first
15584 interleaved columns, left eye first
15587 interleaved columns, right eye first
15593 Default value is @samp{arcd}.
15596 @subsection Examples
15600 Convert input video from side by side parallel to anaglyph yellow/blue dubois:
15606 Convert input video from above below (left eye above, right eye below) to side by side crosseye.
15612 @section streamselect, astreamselect
15613 Select video or audio streams.
15615 The filter accepts the following options:
15619 Set number of inputs. Default is 2.
15622 Set input indexes to remap to outputs.
15625 @subsection Commands
15627 The @code{streamselect} and @code{astreamselect} filter supports the following
15632 Set input indexes to remap to outputs.
15635 @subsection Examples
15639 Select first 5 seconds 1st stream and rest of time 2nd stream:
15641 sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
15645 Same as above, but for audio:
15647 asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
15652 Apply sobel operator to input video stream.
15654 The filter accepts the following option:
15658 Set which planes will be processed, unprocessed planes will be copied.
15659 By default value 0xf, all planes will be processed.
15662 Set value which will be multiplied with filtered result.
15665 Set value which will be added to filtered result.
15671 Apply a simple postprocessing filter that compresses and decompresses the image
15672 at several (or - in the case of @option{quality} level @code{6} - all) shifts
15673 and average the results.
15675 The filter accepts the following options:
15679 Set quality. This option defines the number of levels for averaging. It accepts
15680 an integer in the range 0-6. If set to @code{0}, the filter will have no
15681 effect. A value of @code{6} means the higher quality. For each increment of
15682 that value the speed drops by a factor of approximately 2. Default value is
15686 Force a constant quantization parameter. If not set, the filter will use the QP
15687 from the video stream (if available).
15690 Set thresholding mode. Available modes are:
15694 Set hard thresholding (default).
15696 Set soft thresholding (better de-ringing effect, but likely blurrier).
15699 @item use_bframe_qp
15700 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
15701 option may cause flicker since the B-Frames have often larger QP. Default is
15702 @code{0} (not enabled).
15707 Scale the input by applying one of the super-resolution methods based on
15708 convolutional neural networks. Supported models:
15712 Super-Resolution Convolutional Neural Network model (SRCNN).
15713 See @url{https://arxiv.org/abs/1501.00092}.
15716 Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
15717 See @url{https://arxiv.org/abs/1609.05158}.
15720 Training scripts as well as scripts for model generation are provided in
15721 the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
15723 The filter accepts the following options:
15727 Specify which DNN backend to use for model loading and execution. This option accepts
15728 the following values:
15732 Native implementation of DNN loading and execution.
15735 TensorFlow backend. To enable this backend you
15736 need to install the TensorFlow for C library (see
15737 @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
15738 @code{--enable-libtensorflow}
15741 Default value is @samp{native}.
15744 Set path to model file specifying network architecture and its parameters.
15745 Note that different backends use different file formats. TensorFlow backend
15746 can load files for both formats, while native backend can load files for only
15750 Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
15751 Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
15752 input upscaled using bicubic upscaling with proper scale factor.
15758 Draw subtitles on top of input video using the libass library.
15760 To enable compilation of this filter you need to configure FFmpeg with
15761 @code{--enable-libass}. This filter also requires a build with libavcodec and
15762 libavformat to convert the passed subtitles file to ASS (Advanced Substation
15763 Alpha) subtitles format.
15765 The filter accepts the following options:
15769 Set the filename of the subtitle file to read. It must be specified.
15771 @item original_size
15772 Specify the size of the original video, the video for which the ASS file
15773 was composed. For the syntax of this option, check the
15774 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15775 Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
15776 correctly scale the fonts if the aspect ratio has been changed.
15779 Set a directory path containing fonts that can be used by the filter.
15780 These fonts will be used in addition to whatever the font provider uses.
15783 Process alpha channel, by default alpha channel is untouched.
15786 Set subtitles input character encoding. @code{subtitles} filter only. Only
15787 useful if not UTF-8.
15789 @item stream_index, si
15790 Set subtitles stream index. @code{subtitles} filter only.
15793 Override default style or script info parameters of the subtitles. It accepts a
15794 string containing ASS style format @code{KEY=VALUE} couples separated by ",".
15797 If the first key is not specified, it is assumed that the first value
15798 specifies the @option{filename}.
15800 For example, to render the file @file{sub.srt} on top of the input
15801 video, use the command:
15806 which is equivalent to:
15808 subtitles=filename=sub.srt
15811 To render the default subtitles stream from file @file{video.mkv}, use:
15813 subtitles=video.mkv
15816 To render the second subtitles stream from that file, use:
15818 subtitles=video.mkv:si=1
15821 To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
15822 @code{DejaVu Serif}, use:
15824 subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
15827 @section super2xsai
15829 Scale the input by 2x and smooth using the Super2xSaI (Scale and
15830 Interpolate) pixel art scaling algorithm.
15832 Useful for enlarging pixel art images without reducing sharpness.
15836 Swap two rectangular objects in video.
15838 This filter accepts the following options:
15848 Set 1st rect x coordinate.
15851 Set 1st rect y coordinate.
15854 Set 2nd rect x coordinate.
15857 Set 2nd rect y coordinate.
15859 All expressions are evaluated once for each frame.
15862 The all options are expressions containing the following constants:
15867 The input width and height.
15870 same as @var{w} / @var{h}
15873 input sample aspect ratio
15876 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
15879 The number of the input frame, starting from 0.
15882 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
15885 the position in the file of the input frame, NAN if unknown
15893 Apply telecine process to the video.
15895 This filter accepts the following options:
15904 The default value is @code{top}.
15908 A string of numbers representing the pulldown pattern you wish to apply.
15909 The default value is @code{23}.
15913 Some typical patterns:
15918 24p: 2332 (preferred)
15925 24p: 222222222223 ("Euro pulldown")
15932 Apply threshold effect to video stream.
15934 This filter needs four video streams to perform thresholding.
15935 First stream is stream we are filtering.
15936 Second stream is holding threshold values, third stream is holding min values,
15937 and last, fourth stream is holding max values.
15939 The filter accepts the following option:
15943 Set which planes will be processed, unprocessed planes will be copied.
15944 By default value 0xf, all planes will be processed.
15947 For example if first stream pixel's component value is less then threshold value
15948 of pixel component from 2nd threshold stream, third stream value will picked,
15949 otherwise fourth stream pixel component value will be picked.
15951 Using color source filter one can perform various types of thresholding:
15953 @subsection Examples
15957 Binary threshold, using gray color as threshold:
15959 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
15963 Inverted binary threshold, using gray color as threshold:
15965 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
15969 Truncate binary threshold, using gray color as threshold:
15971 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
15975 Threshold to zero, using gray color as threshold:
15977 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
15981 Inverted threshold to zero, using gray color as threshold:
15983 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
15988 Select the most representative frame in a given sequence of consecutive frames.
15990 The filter accepts the following options:
15994 Set the frames batch size to analyze; in a set of @var{n} frames, the filter
15995 will pick one of them, and then handle the next batch of @var{n} frames until
15996 the end. Default is @code{100}.
15999 Since the filter keeps track of the whole frames sequence, a bigger @var{n}
16000 value will result in a higher memory usage, so a high value is not recommended.
16002 @subsection Examples
16006 Extract one picture each 50 frames:
16012 Complete example of a thumbnail creation with @command{ffmpeg}:
16014 ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
16020 Tile several successive frames together.
16022 The filter accepts the following options:
16027 Set the grid size (i.e. the number of lines and columns). For the syntax of
16028 this option, check the
16029 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16032 Set the maximum number of frames to render in the given area. It must be less
16033 than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
16034 the area will be used.
16037 Set the outer border margin in pixels.
16040 Set the inner border thickness (i.e. the number of pixels between frames). For
16041 more advanced padding options (such as having different values for the edges),
16042 refer to the pad video filter.
16045 Specify the color of the unused area. For the syntax of this option, check the
16046 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
16047 The default value of @var{color} is "black".
16050 Set the number of frames to overlap when tiling several successive frames together.
16051 The value must be between @code{0} and @var{nb_frames - 1}.
16054 Set the number of frames to initially be empty before displaying first output frame.
16055 This controls how soon will one get first output frame.
16056 The value must be between @code{0} and @var{nb_frames - 1}.
16059 @subsection Examples
16063 Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
16065 ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
16067 The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
16068 duplicating each output frame to accommodate the originally detected frame
16072 Display @code{5} pictures in an area of @code{3x2} frames,
16073 with @code{7} pixels between them, and @code{2} pixels of initial margin, using
16074 mixed flat and named options:
16076 tile=3x2:nb_frames=5:padding=7:margin=2
16080 @section tinterlace
16082 Perform various types of temporal field interlacing.
16084 Frames are counted starting from 1, so the first input frame is
16087 The filter accepts the following options:
16092 Specify the mode of the interlacing. This option can also be specified
16093 as a value alone. See below for a list of values for this option.
16095 Available values are:
16099 Move odd frames into the upper field, even into the lower field,
16100 generating a double height frame at half frame rate.
16104 Frame 1 Frame 2 Frame 3 Frame 4
16106 11111 22222 33333 44444
16107 11111 22222 33333 44444
16108 11111 22222 33333 44444
16109 11111 22222 33333 44444
16123 Only output odd frames, even frames are dropped, generating a frame with
16124 unchanged height at half frame rate.
16129 Frame 1 Frame 2 Frame 3 Frame 4
16131 11111 22222 33333 44444
16132 11111 22222 33333 44444
16133 11111 22222 33333 44444
16134 11111 22222 33333 44444
16144 Only output even frames, odd frames are dropped, generating a frame with
16145 unchanged height at half frame rate.
16150 Frame 1 Frame 2 Frame 3 Frame 4
16152 11111 22222 33333 44444
16153 11111 22222 33333 44444
16154 11111 22222 33333 44444
16155 11111 22222 33333 44444
16165 Expand each frame to full height, but pad alternate lines with black,
16166 generating a frame with double height at the same input frame rate.
16171 Frame 1 Frame 2 Frame 3 Frame 4
16173 11111 22222 33333 44444
16174 11111 22222 33333 44444
16175 11111 22222 33333 44444
16176 11111 22222 33333 44444
16179 11111 ..... 33333 .....
16180 ..... 22222 ..... 44444
16181 11111 ..... 33333 .....
16182 ..... 22222 ..... 44444
16183 11111 ..... 33333 .....
16184 ..... 22222 ..... 44444
16185 11111 ..... 33333 .....
16186 ..... 22222 ..... 44444
16190 @item interleave_top, 4
16191 Interleave the upper field from odd frames with the lower field from
16192 even frames, generating a frame with unchanged height at half frame rate.
16197 Frame 1 Frame 2 Frame 3 Frame 4
16199 11111<- 22222 33333<- 44444
16200 11111 22222<- 33333 44444<-
16201 11111<- 22222 33333<- 44444
16202 11111 22222<- 33333 44444<-
16212 @item interleave_bottom, 5
16213 Interleave the lower field from odd frames with the upper field from
16214 even frames, generating a frame with unchanged height at half frame rate.
16219 Frame 1 Frame 2 Frame 3 Frame 4
16221 11111 22222<- 33333 44444<-
16222 11111<- 22222 33333<- 44444
16223 11111 22222<- 33333 44444<-
16224 11111<- 22222 33333<- 44444
16234 @item interlacex2, 6
16235 Double frame rate with unchanged height. Frames are inserted each
16236 containing the second temporal field from the previous input frame and
16237 the first temporal field from the next input frame. This mode relies on
16238 the top_field_first flag. Useful for interlaced video displays with no
16239 field synchronisation.
16244 Frame 1 Frame 2 Frame 3 Frame 4
16246 11111 22222 33333 44444
16247 11111 22222 33333 44444
16248 11111 22222 33333 44444
16249 11111 22222 33333 44444
16252 11111 22222 22222 33333 33333 44444 44444
16253 11111 11111 22222 22222 33333 33333 44444
16254 11111 22222 22222 33333 33333 44444 44444
16255 11111 11111 22222 22222 33333 33333 44444
16260 Move odd frames into the upper field, even into the lower field,
16261 generating a double height frame at same frame rate.
16266 Frame 1 Frame 2 Frame 3 Frame 4
16268 11111 22222 33333 44444
16269 11111 22222 33333 44444
16270 11111 22222 33333 44444
16271 11111 22222 33333 44444
16274 11111 33333 33333 55555
16275 22222 22222 44444 44444
16276 11111 33333 33333 55555
16277 22222 22222 44444 44444
16278 11111 33333 33333 55555
16279 22222 22222 44444 44444
16280 11111 33333 33333 55555
16281 22222 22222 44444 44444
16286 Numeric values are deprecated but are accepted for backward
16287 compatibility reasons.
16289 Default mode is @code{merge}.
16292 Specify flags influencing the filter process.
16294 Available value for @var{flags} is:
16297 @item low_pass_filter, vlfp
16298 Enable linear vertical low-pass filtering in the filter.
16299 Vertical low-pass filtering is required when creating an interlaced
16300 destination from a progressive source which contains high-frequency
16301 vertical detail. Filtering will reduce interlace 'twitter' and Moire
16304 @item complex_filter, cvlfp
16305 Enable complex vertical low-pass filtering.
16306 This will slightly less reduce interlace 'twitter' and Moire
16307 patterning but better retain detail and subjective sharpness impression.
16311 Vertical low-pass filtering can only be enabled for @option{mode}
16312 @var{interleave_top} and @var{interleave_bottom}.
16318 Mix successive video frames.
16320 A description of the accepted options follows.
16324 The number of successive frames to mix. If unspecified, it defaults to 3.
16327 Specify weight of each input video frame.
16328 Each weight is separated by space. If number of weights is smaller than
16329 number of @var{frames} last specified weight will be used for all remaining
16333 Specify scale, if it is set it will be multiplied with sum
16334 of each weight multiplied with pixel values to give final destination
16335 pixel value. By default @var{scale} is auto scaled to sum of weights.
16338 @subsection Examples
16342 Average 7 successive frames:
16344 tmix=frames=7:weights="1 1 1 1 1 1 1"
16348 Apply simple temporal convolution:
16350 tmix=frames=3:weights="-1 3 -1"
16354 Similar as above but only showing temporal differences:
16356 tmix=frames=3:weights="-1 2 -1":scale=1
16361 Tone map colors from different dynamic ranges.
16363 This filter expects data in single precision floating point, as it needs to
16364 operate on (and can output) out-of-range values. Another filter, such as
16365 @ref{zscale}, is needed to convert the resulting frame to a usable format.
16367 The tonemapping algorithms implemented only work on linear light, so input
16368 data should be linearized beforehand (and possibly correctly tagged).
16371 ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
16374 @subsection Options
16375 The filter accepts the following options.
16379 Set the tone map algorithm to use.
16381 Possible values are:
16384 Do not apply any tone map, only desaturate overbright pixels.
16387 Hard-clip any out-of-range values. Use it for perfect color accuracy for
16388 in-range values, while distorting out-of-range values.
16391 Stretch the entire reference gamut to a linear multiple of the display.
16394 Fit a logarithmic transfer between the tone curves.
16397 Preserve overall image brightness with a simple curve, using nonlinear
16398 contrast, which results in flattening details and degrading color accuracy.
16401 Preserve both dark and bright details better than @var{reinhard}, at the cost
16402 of slightly darkening everything. Use it when detail preservation is more
16403 important than color and brightness accuracy.
16406 Smoothly map out-of-range values, while retaining contrast and colors for
16407 in-range material as much as possible. Use it when color accuracy is more
16408 important than detail preservation.
16414 Tune the tone mapping algorithm.
16416 This affects the following algorithms:
16422 Specifies the scale factor to use while stretching.
16426 Specifies the exponent of the function.
16430 Specify an extra linear coefficient to multiply into the signal before clipping.
16434 Specify the local contrast coefficient at the display peak.
16435 Default to 0.5, which means that in-gamut values will be about half as bright
16442 Specify the transition point from linear to mobius transform. Every value
16443 below this point is guaranteed to be mapped 1:1. The higher the value, the
16444 more accurate the result will be, at the cost of losing bright details.
16445 Default to 0.3, which due to the steep initial slope still preserves in-range
16446 colors fairly accurately.
16450 Apply desaturation for highlights that exceed this level of brightness. The
16451 higher the parameter, the more color information will be preserved. This
16452 setting helps prevent unnaturally blown-out colors for super-highlights, by
16453 (smoothly) turning into white instead. This makes images feel more natural,
16454 at the cost of reducing information about out-of-range colors.
16456 The default of 2.0 is somewhat conservative and will mostly just apply to
16457 skies or directly sunlit surfaces. A setting of 0.0 disables this option.
16459 This option works only if the input frame has a supported color tag.
16462 Override signal/nominal/reference peak with this value. Useful when the
16463 embedded peak information in display metadata is not reliable or when tone
16464 mapping from a lower range to a higher range.
16470 Transpose rows with columns in the input video and optionally flip it.
16472 It accepts the following parameters:
16477 Specify the transposition direction.
16479 Can assume the following values:
16481 @item 0, 4, cclock_flip
16482 Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
16490 Rotate by 90 degrees clockwise, that is:
16498 Rotate by 90 degrees counterclockwise, that is:
16505 @item 3, 7, clock_flip
16506 Rotate by 90 degrees clockwise and vertically flip, that is:
16514 For values between 4-7, the transposition is only done if the input
16515 video geometry is portrait and not landscape. These values are
16516 deprecated, the @code{passthrough} option should be used instead.
16518 Numerical values are deprecated, and should be dropped in favor of
16519 symbolic constants.
16522 Do not apply the transposition if the input geometry matches the one
16523 specified by the specified value. It accepts the following values:
16526 Always apply transposition.
16528 Preserve portrait geometry (when @var{height} >= @var{width}).
16530 Preserve landscape geometry (when @var{width} >= @var{height}).
16533 Default value is @code{none}.
16536 For example to rotate by 90 degrees clockwise and preserve portrait
16539 transpose=dir=1:passthrough=portrait
16542 The command above can also be specified as:
16544 transpose=1:portrait
16547 @section transpose_npp
16549 Transpose rows with columns in the input video and optionally flip it.
16550 For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
16552 It accepts the following parameters:
16557 Specify the transposition direction.
16559 Can assume the following values:
16562 Rotate by 90 degrees counterclockwise and vertically flip. (default)
16565 Rotate by 90 degrees clockwise.
16568 Rotate by 90 degrees counterclockwise.
16571 Rotate by 90 degrees clockwise and vertically flip.
16575 Do not apply the transposition if the input geometry matches the one
16576 specified by the specified value. It accepts the following values:
16579 Always apply transposition. (default)
16581 Preserve portrait geometry (when @var{height} >= @var{width}).
16583 Preserve landscape geometry (when @var{width} >= @var{height}).
16589 Trim the input so that the output contains one continuous subpart of the input.
16591 It accepts the following parameters:
16594 Specify the time of the start of the kept section, i.e. the frame with the
16595 timestamp @var{start} will be the first frame in the output.
16598 Specify the time of the first frame that will be dropped, i.e. the frame
16599 immediately preceding the one with the timestamp @var{end} will be the last
16600 frame in the output.
16603 This is the same as @var{start}, except this option sets the start timestamp
16604 in timebase units instead of seconds.
16607 This is the same as @var{end}, except this option sets the end timestamp
16608 in timebase units instead of seconds.
16611 The maximum duration of the output in seconds.
16614 The number of the first frame that should be passed to the output.
16617 The number of the first frame that should be dropped.
16620 @option{start}, @option{end}, and @option{duration} are expressed as time
16621 duration specifications; see
16622 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
16623 for the accepted syntax.
16625 Note that the first two sets of the start/end options and the @option{duration}
16626 option look at the frame timestamp, while the _frame variants simply count the
16627 frames that pass through the filter. Also note that this filter does not modify
16628 the timestamps. If you wish for the output timestamps to start at zero, insert a
16629 setpts filter after the trim filter.
16631 If multiple start or end options are set, this filter tries to be greedy and
16632 keep all the frames that match at least one of the specified constraints. To keep
16633 only the part that matches all the constraints at once, chain multiple trim
16636 The defaults are such that all the input is kept. So it is possible to set e.g.
16637 just the end values to keep everything before the specified time.
16642 Drop everything except the second minute of input:
16644 ffmpeg -i INPUT -vf trim=60:120
16648 Keep only the first second:
16650 ffmpeg -i INPUT -vf trim=duration=1
16655 @section unpremultiply
16656 Apply alpha unpremultiply effect to input video stream using first plane
16657 of second stream as alpha.
16659 Both streams must have same dimensions and same pixel format.
16661 The filter accepts the following option:
16665 Set which planes will be processed, unprocessed planes will be copied.
16666 By default value 0xf, all planes will be processed.
16668 If the format has 1 or 2 components, then luma is bit 0.
16669 If the format has 3 or 4 components:
16670 for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
16671 for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
16672 If present, the alpha channel is always the last bit.
16675 Do not require 2nd input for processing, instead use alpha plane from input stream.
16681 Sharpen or blur the input video.
16683 It accepts the following parameters:
16686 @item luma_msize_x, lx
16687 Set the luma matrix horizontal size. It must be an odd integer between
16688 3 and 23. The default value is 5.
16690 @item luma_msize_y, ly
16691 Set the luma matrix vertical size. It must be an odd integer between 3
16692 and 23. The default value is 5.
16694 @item luma_amount, la
16695 Set the luma effect strength. It must be a floating point number, reasonable
16696 values lay between -1.5 and 1.5.
16698 Negative values will blur the input video, while positive values will
16699 sharpen it, a value of zero will disable the effect.
16701 Default value is 1.0.
16703 @item chroma_msize_x, cx
16704 Set the chroma matrix horizontal size. It must be an odd integer
16705 between 3 and 23. The default value is 5.
16707 @item chroma_msize_y, cy
16708 Set the chroma matrix vertical size. It must be an odd integer
16709 between 3 and 23. The default value is 5.
16711 @item chroma_amount, ca
16712 Set the chroma effect strength. It must be a floating point number, reasonable
16713 values lay between -1.5 and 1.5.
16715 Negative values will blur the input video, while positive values will
16716 sharpen it, a value of zero will disable the effect.
16718 Default value is 0.0.
16722 All parameters are optional and default to the equivalent of the
16723 string '5:5:1.0:5:5:0.0'.
16725 @subsection Examples
16729 Apply strong luma sharpen effect:
16731 unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
16735 Apply a strong blur of both luma and chroma parameters:
16737 unsharp=7:7:-2:7:7:-2
16743 Apply ultra slow/simple postprocessing filter that compresses and decompresses
16744 the image at several (or - in the case of @option{quality} level @code{8} - all)
16745 shifts and average the results.
16747 The way this differs from the behavior of spp is that uspp actually encodes &
16748 decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
16749 DCT similar to MJPEG.
16751 The filter accepts the following options:
16755 Set quality. This option defines the number of levels for averaging. It accepts
16756 an integer in the range 0-8. If set to @code{0}, the filter will have no
16757 effect. A value of @code{8} means the higher quality. For each increment of
16758 that value the speed drops by a factor of approximately 2. Default value is
16762 Force a constant quantization parameter. If not set, the filter will use the QP
16763 from the video stream (if available).
16766 @section vaguedenoiser
16768 Apply a wavelet based denoiser.
16770 It transforms each frame from the video input into the wavelet domain,
16771 using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
16772 the obtained coefficients. It does an inverse wavelet transform after.
16773 Due to wavelet properties, it should give a nice smoothed result, and
16774 reduced noise, without blurring picture features.
16776 This filter accepts the following options:
16780 The filtering strength. The higher, the more filtered the video will be.
16781 Hard thresholding can use a higher threshold than soft thresholding
16782 before the video looks overfiltered. Default value is 2.
16785 The filtering method the filter will use.
16787 It accepts the following values:
16790 All values under the threshold will be zeroed.
16793 All values under the threshold will be zeroed. All values above will be
16794 reduced by the threshold.
16797 Scales or nullifies coefficients - intermediary between (more) soft and
16798 (less) hard thresholding.
16801 Default is garrote.
16804 Number of times, the wavelet will decompose the picture. Picture can't
16805 be decomposed beyond a particular point (typically, 8 for a 640x480
16806 frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
16809 Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
16812 A list of the planes to process. By default all planes are processed.
16815 @section vectorscope
16817 Display 2 color component values in the two dimensional graph (which is called
16820 This filter accepts the following options:
16824 Set vectorscope mode.
16826 It accepts the following values:
16829 Gray values are displayed on graph, higher brightness means more pixels have
16830 same component color value on location in graph. This is the default mode.
16833 Gray values are displayed on graph. Surrounding pixels values which are not
16834 present in video frame are drawn in gradient of 2 color components which are
16835 set by option @code{x} and @code{y}. The 3rd color component is static.
16838 Actual color components values present in video frame are displayed on graph.
16841 Similar as color2 but higher frequency of same values @code{x} and @code{y}
16842 on graph increases value of another color component, which is luminance by
16843 default values of @code{x} and @code{y}.
16846 Actual colors present in video frame are displayed on graph. If two different
16847 colors map to same position on graph then color with higher value of component
16848 not present in graph is picked.
16851 Gray values are displayed on graph. Similar to @code{color} but with 3rd color
16852 component picked from radial gradient.
16856 Set which color component will be represented on X-axis. Default is @code{1}.
16859 Set which color component will be represented on Y-axis. Default is @code{2}.
16862 Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
16863 of color component which represents frequency of (X, Y) location in graph.
16868 No envelope, this is default.
16871 Instant envelope, even darkest single pixel will be clearly highlighted.
16874 Hold maximum and minimum values presented in graph over time. This way you
16875 can still spot out of range values without constantly looking at vectorscope.
16878 Peak and instant envelope combined together.
16882 Set what kind of graticule to draw.
16890 Set graticule opacity.
16893 Set graticule flags.
16897 Draw graticule for white point.
16900 Draw graticule for black point.
16903 Draw color points short names.
16907 Set background opacity.
16909 @item lthreshold, l
16910 Set low threshold for color component not represented on X or Y axis.
16911 Values lower than this value will be ignored. Default is 0.
16912 Note this value is multiplied with actual max possible value one pixel component
16913 can have. So for 8-bit input and low threshold value of 0.1 actual threshold
16916 @item hthreshold, h
16917 Set high threshold for color component not represented on X or Y axis.
16918 Values higher than this value will be ignored. Default is 1.
16919 Note this value is multiplied with actual max possible value one pixel component
16920 can have. So for 8-bit input and high threshold value of 0.9 actual threshold
16921 is 0.9 * 255 = 230.
16923 @item colorspace, c
16924 Set what kind of colorspace to use when drawing graticule.
16933 @anchor{vidstabdetect}
16934 @section vidstabdetect
16936 Analyze video stabilization/deshaking. Perform pass 1 of 2, see
16937 @ref{vidstabtransform} for pass 2.
16939 This filter generates a file with relative translation and rotation
16940 transform information about subsequent frames, which is then used by
16941 the @ref{vidstabtransform} filter.
16943 To enable compilation of this filter you need to configure FFmpeg with
16944 @code{--enable-libvidstab}.
16946 This filter accepts the following options:
16950 Set the path to the file used to write the transforms information.
16951 Default value is @file{transforms.trf}.
16954 Set how shaky the video is and how quick the camera is. It accepts an
16955 integer in the range 1-10, a value of 1 means little shakiness, a
16956 value of 10 means strong shakiness. Default value is 5.
16959 Set the accuracy of the detection process. It must be a value in the
16960 range 1-15. A value of 1 means low accuracy, a value of 15 means high
16961 accuracy. Default value is 15.
16964 Set stepsize of the search process. The region around minimum is
16965 scanned with 1 pixel resolution. Default value is 6.
16968 Set minimum contrast. Below this value a local measurement field is
16969 discarded. Must be a floating point value in the range 0-1. Default
16973 Set reference frame number for tripod mode.
16975 If enabled, the motion of the frames is compared to a reference frame
16976 in the filtered stream, identified by the specified number. The idea
16977 is to compensate all movements in a more-or-less static scene and keep
16978 the camera view absolutely still.
16980 If set to 0, it is disabled. The frames are counted starting from 1.
16983 Show fields and transforms in the resulting frames. It accepts an
16984 integer in the range 0-2. Default value is 0, which disables any
16988 @subsection Examples
16992 Use default values:
16998 Analyze strongly shaky movie and put the results in file
16999 @file{mytransforms.trf}:
17001 vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
17005 Visualize the result of internal transformations in the resulting
17008 vidstabdetect=show=1
17012 Analyze a video with medium shakiness using @command{ffmpeg}:
17014 ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
17018 @anchor{vidstabtransform}
17019 @section vidstabtransform
17021 Video stabilization/deshaking: pass 2 of 2,
17022 see @ref{vidstabdetect} for pass 1.
17024 Read a file with transform information for each frame and
17025 apply/compensate them. Together with the @ref{vidstabdetect}
17026 filter this can be used to deshake videos. See also
17027 @url{http://public.hronopik.de/vid.stab}. It is important to also use
17028 the @ref{unsharp} filter, see below.
17030 To enable compilation of this filter you need to configure FFmpeg with
17031 @code{--enable-libvidstab}.
17033 @subsection Options
17037 Set path to the file used to read the transforms. Default value is
17038 @file{transforms.trf}.
17041 Set the number of frames (value*2 + 1) used for lowpass filtering the
17042 camera movements. Default value is 10.
17044 For example a number of 10 means that 21 frames are used (10 in the
17045 past and 10 in the future) to smoothen the motion in the video. A
17046 larger value leads to a smoother video, but limits the acceleration of
17047 the camera (pan/tilt movements). 0 is a special case where a static
17048 camera is simulated.
17051 Set the camera path optimization algorithm.
17053 Accepted values are:
17056 gaussian kernel low-pass filter on camera motion (default)
17058 averaging on transformations
17062 Set maximal number of pixels to translate frames. Default value is -1,
17066 Set maximal angle in radians (degree*PI/180) to rotate frames. Default
17067 value is -1, meaning no limit.
17070 Specify how to deal with borders that may be visible due to movement
17073 Available values are:
17076 keep image information from previous frame (default)
17078 fill the border black
17082 Invert transforms if set to 1. Default value is 0.
17085 Consider transforms as relative to previous frame if set to 1,
17086 absolute if set to 0. Default value is 0.
17089 Set percentage to zoom. A positive value will result in a zoom-in
17090 effect, a negative value in a zoom-out effect. Default value is 0 (no
17094 Set optimal zooming to avoid borders.
17096 Accepted values are:
17101 optimal static zoom value is determined (only very strong movements
17102 will lead to visible borders) (default)
17104 optimal adaptive zoom value is determined (no borders will be
17105 visible), see @option{zoomspeed}
17108 Note that the value given at zoom is added to the one calculated here.
17111 Set percent to zoom maximally each frame (enabled when
17112 @option{optzoom} is set to 2). Range is from 0 to 5, default value is
17116 Specify type of interpolation.
17118 Available values are:
17123 linear only horizontal
17125 linear in both directions (default)
17127 cubic in both directions (slow)
17131 Enable virtual tripod mode if set to 1, which is equivalent to
17132 @code{relative=0:smoothing=0}. Default value is 0.
17134 Use also @code{tripod} option of @ref{vidstabdetect}.
17137 Increase log verbosity if set to 1. Also the detected global motions
17138 are written to the temporary file @file{global_motions.trf}. Default
17142 @subsection Examples
17146 Use @command{ffmpeg} for a typical stabilization with default values:
17148 ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
17151 Note the use of the @ref{unsharp} filter which is always recommended.
17154 Zoom in a bit more and load transform data from a given file:
17156 vidstabtransform=zoom=5:input="mytransforms.trf"
17160 Smoothen the video even more:
17162 vidstabtransform=smoothing=30
17168 Flip the input video vertically.
17170 For example, to vertically flip a video with @command{ffmpeg}:
17172 ffmpeg -i in.avi -vf "vflip" out.avi
17177 Detect variable frame rate video.
17179 This filter tries to detect if the input is variable or constant frame rate.
17181 At end it will output number of frames detected as having variable delta pts,
17182 and ones with constant delta pts.
17183 If there was frames with variable delta, than it will also show min and max delta
17189 Make or reverse a natural vignetting effect.
17191 The filter accepts the following options:
17195 Set lens angle expression as a number of radians.
17197 The value is clipped in the @code{[0,PI/2]} range.
17199 Default value: @code{"PI/5"}
17203 Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
17207 Set forward/backward mode.
17209 Available modes are:
17212 The larger the distance from the central point, the darker the image becomes.
17215 The larger the distance from the central point, the brighter the image becomes.
17216 This can be used to reverse a vignette effect, though there is no automatic
17217 detection to extract the lens @option{angle} and other settings (yet). It can
17218 also be used to create a burning effect.
17221 Default value is @samp{forward}.
17224 Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
17226 It accepts the following values:
17229 Evaluate expressions only once during the filter initialization.
17232 Evaluate expressions for each incoming frame. This is way slower than the
17233 @samp{init} mode since it requires all the scalers to be re-computed, but it
17234 allows advanced dynamic expressions.
17237 Default value is @samp{init}.
17240 Set dithering to reduce the circular banding effects. Default is @code{1}
17244 Set vignette aspect. This setting allows one to adjust the shape of the vignette.
17245 Setting this value to the SAR of the input will make a rectangular vignetting
17246 following the dimensions of the video.
17248 Default is @code{1/1}.
17251 @subsection Expressions
17253 The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
17254 following parameters.
17259 input width and height
17262 the number of input frame, starting from 0
17265 the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
17266 @var{TB} units, NAN if undefined
17269 frame rate of the input video, NAN if the input frame rate is unknown
17272 the PTS (Presentation TimeStamp) of the filtered video frame,
17273 expressed in seconds, NAN if undefined
17276 time base of the input video
17280 @subsection Examples
17284 Apply simple strong vignetting effect:
17290 Make a flickering vignetting:
17292 vignette='PI/4+random(1)*PI/50':eval=frame
17297 @section vmafmotion
17299 Obtain the average vmaf motion score of a video.
17300 It is one of the component filters of VMAF.
17302 The obtained average motion score is printed through the logging system.
17304 In the below example the input file @file{ref.mpg} is being processed and score
17308 ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
17312 Stack input videos vertically.
17314 All streams must be of same pixel format and of same width.
17316 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
17317 to create same output.
17319 The filter accept the following option:
17323 Set number of input streams. Default is 2.
17326 If set to 1, force the output to terminate when the shortest input
17327 terminates. Default value is 0.
17332 Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
17333 Deinterlacing Filter").
17335 Based on the process described by Martin Weston for BBC R&D, and
17336 implemented based on the de-interlace algorithm written by Jim
17337 Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
17338 uses filter coefficients calculated by BBC R&D.
17340 There are two sets of filter coefficients, so called "simple":
17341 and "complex". Which set of filter coefficients is used can
17342 be set by passing an optional parameter:
17346 Set the interlacing filter coefficients. Accepts one of the following values:
17350 Simple filter coefficient set.
17352 More-complex filter coefficient set.
17354 Default value is @samp{complex}.
17357 Specify which frames to deinterlace. Accept one of the following values:
17361 Deinterlace all frames,
17363 Only deinterlace frames marked as interlaced.
17366 Default value is @samp{all}.
17370 Video waveform monitor.
17372 The waveform monitor plots color component intensity. By default luminance
17373 only. Each column of the waveform corresponds to a column of pixels in the
17376 It accepts the following options:
17380 Can be either @code{row}, or @code{column}. Default is @code{column}.
17381 In row mode, the graph on the left side represents color component value 0 and
17382 the right side represents value = 255. In column mode, the top side represents
17383 color component value = 0 and bottom side represents value = 255.
17386 Set intensity. Smaller values are useful to find out how many values of the same
17387 luminance are distributed across input rows/columns.
17388 Default value is @code{0.04}. Allowed range is [0, 1].
17391 Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
17392 In mirrored mode, higher values will be represented on the left
17393 side for @code{row} mode and at the top for @code{column} mode. Default is
17394 @code{1} (mirrored).
17398 It accepts the following values:
17401 Presents information identical to that in the @code{parade}, except
17402 that the graphs representing color components are superimposed directly
17405 This display mode makes it easier to spot relative differences or similarities
17406 in overlapping areas of the color components that are supposed to be identical,
17407 such as neutral whites, grays, or blacks.
17410 Display separate graph for the color components side by side in
17411 @code{row} mode or one below the other in @code{column} mode.
17414 Display separate graph for the color components side by side in
17415 @code{column} mode or one below the other in @code{row} mode.
17417 Using this display mode makes it easy to spot color casts in the highlights
17418 and shadows of an image, by comparing the contours of the top and the bottom
17419 graphs of each waveform. Since whites, grays, and blacks are characterized
17420 by exactly equal amounts of red, green, and blue, neutral areas of the picture
17421 should display three waveforms of roughly equal width/height. If not, the
17422 correction is easy to perform by making level adjustments the three waveforms.
17424 Default is @code{stack}.
17426 @item components, c
17427 Set which color components to display. Default is 1, which means only luminance
17428 or red color component if input is in RGB colorspace. If is set for example to
17429 7 it will display all 3 (if) available color components.
17434 No envelope, this is default.
17437 Instant envelope, minimum and maximum values presented in graph will be easily
17438 visible even with small @code{step} value.
17441 Hold minimum and maximum values presented in graph across time. This way you
17442 can still spot out of range values without constantly looking at waveforms.
17445 Peak and instant envelope combined together.
17451 No filtering, this is default.
17454 Luma and chroma combined together.
17457 Similar as above, but shows difference between blue and red chroma.
17460 Similar as above, but use different colors.
17463 Displays only chroma.
17466 Displays actual color value on waveform.
17469 Similar as above, but with luma showing frequency of chroma values.
17473 Set which graticule to display.
17477 Do not display graticule.
17480 Display green graticule showing legal broadcast ranges.
17483 Display orange graticule showing legal broadcast ranges.
17487 Set graticule opacity.
17490 Set graticule flags.
17494 Draw numbers above lines. By default enabled.
17497 Draw dots instead of lines.
17501 Set scale used for displaying graticule.
17508 Default is digital.
17511 Set background opacity.
17514 @section weave, doubleweave
17516 The @code{weave} takes a field-based video input and join
17517 each two sequential fields into single frame, producing a new double
17518 height clip with half the frame rate and half the frame count.
17520 The @code{doubleweave} works same as @code{weave} but without
17521 halving frame rate and frame count.
17523 It accepts the following option:
17527 Set first field. Available values are:
17531 Set the frame as top-field-first.
17534 Set the frame as bottom-field-first.
17538 @subsection Examples
17542 Interlace video using @ref{select} and @ref{separatefields} filter:
17544 separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
17549 Apply the xBR high-quality magnification filter which is designed for pixel
17550 art. It follows a set of edge-detection rules, see
17551 @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
17553 It accepts the following option:
17557 Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
17558 @code{3xBR} and @code{4} for @code{4xBR}.
17559 Default is @code{3}.
17565 Deinterlace the input video ("yadif" means "yet another deinterlacing
17568 It accepts the following parameters:
17574 The interlacing mode to adopt. It accepts one of the following values:
17577 @item 0, send_frame
17578 Output one frame for each frame.
17579 @item 1, send_field
17580 Output one frame for each field.
17581 @item 2, send_frame_nospatial
17582 Like @code{send_frame}, but it skips the spatial interlacing check.
17583 @item 3, send_field_nospatial
17584 Like @code{send_field}, but it skips the spatial interlacing check.
17587 The default value is @code{send_frame}.
17590 The picture field parity assumed for the input interlaced video. It accepts one
17591 of the following values:
17595 Assume the top field is first.
17597 Assume the bottom field is first.
17599 Enable automatic detection of field parity.
17602 The default value is @code{auto}.
17603 If the interlacing is unknown or the decoder does not export this information,
17604 top field first will be assumed.
17607 Specify which frames to deinterlace. Accept one of the following
17612 Deinterlace all frames.
17613 @item 1, interlaced
17614 Only deinterlace frames marked as interlaced.
17617 The default value is @code{all}.
17622 Apply Zoom & Pan effect.
17624 This filter accepts the following options:
17628 Set the zoom expression. Default is 1.
17632 Set the x and y expression. Default is 0.
17635 Set the duration expression in number of frames.
17636 This sets for how many number of frames effect will last for
17637 single input image.
17640 Set the output image size, default is 'hd720'.
17643 Set the output frame rate, default is '25'.
17646 Each expression can contain the following constants:
17665 Output frame count.
17669 Last calculated 'x' and 'y' position from 'x' and 'y' expression
17670 for current input frame.
17674 'x' and 'y' of last output frame of previous input frame or 0 when there was
17675 not yet such frame (first input frame).
17678 Last calculated zoom from 'z' expression for current input frame.
17681 Last calculated zoom of last output frame of previous input frame.
17684 Number of output frames for current input frame. Calculated from 'd' expression
17685 for each input frame.
17688 number of output frames created for previous input frame
17691 Rational number: input width / input height
17694 sample aspect ratio
17697 display aspect ratio
17701 @subsection Examples
17705 Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
17707 zoompan=z='min(zoom+0.0015,1.5)':d=700:x='if(gte(zoom,1.5),x,x+1/a)':y='if(gte(zoom,1.5),y,y+1)':s=640x360
17711 Zoom-in up to 1.5 and pan always at center of picture:
17713 zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
17717 Same as above but without pausing:
17719 zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
17725 Scale (resize) the input video, using the z.lib library:
17726 @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
17727 filter, you need to configure FFmpeg with @code{--enable-libzimg}.
17729 The zscale filter forces the output display aspect ratio to be the same
17730 as the input, by changing the output sample aspect ratio.
17732 If the input image format is different from the format requested by
17733 the next filter, the zscale filter will convert the input to the
17736 @subsection Options
17737 The filter accepts the following options.
17742 Set the output video dimension expression. Default value is the input
17745 If the @var{width} or @var{w} value is 0, the input width is used for
17746 the output. If the @var{height} or @var{h} value is 0, the input height
17747 is used for the output.
17749 If one and only one of the values is -n with n >= 1, the zscale filter
17750 will use a value that maintains the aspect ratio of the input image,
17751 calculated from the other specified dimension. After that it will,
17752 however, make sure that the calculated dimension is divisible by n and
17753 adjust the value if necessary.
17755 If both values are -n with n >= 1, the behavior will be identical to
17756 both values being set to 0 as previously detailed.
17758 See below for the list of accepted constants for use in the dimension
17762 Set the video size. For the syntax of this option, check the
17763 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17766 Set the dither type.
17768 Possible values are:
17773 @item error_diffusion
17779 Set the resize filter type.
17781 Possible values are:
17791 Default is bilinear.
17794 Set the color range.
17796 Possible values are:
17803 Default is same as input.
17806 Set the color primaries.
17808 Possible values are:
17818 Default is same as input.
17821 Set the transfer characteristics.
17823 Possible values are:
17837 Default is same as input.
17840 Set the colorspace matrix.
17842 Possible value are:
17853 Default is same as input.
17856 Set the input color range.
17858 Possible values are:
17865 Default is same as input.
17867 @item primariesin, pin
17868 Set the input color primaries.
17870 Possible values are:
17880 Default is same as input.
17882 @item transferin, tin
17883 Set the input transfer characteristics.
17885 Possible values are:
17896 Default is same as input.
17898 @item matrixin, min
17899 Set the input colorspace matrix.
17901 Possible value are:
17913 Set the output chroma location.
17915 Possible values are:
17926 @item chromalin, cin
17927 Set the input chroma location.
17929 Possible values are:
17941 Set the nominal peak luminance.
17944 The values of the @option{w} and @option{h} options are expressions
17945 containing the following constants:
17950 The input width and height
17954 These are the same as @var{in_w} and @var{in_h}.
17958 The output (scaled) width and height
17962 These are the same as @var{out_w} and @var{out_h}
17965 The same as @var{iw} / @var{ih}
17968 input sample aspect ratio
17971 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
17975 horizontal and vertical input chroma subsample values. For example for the
17976 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
17980 horizontal and vertical output chroma subsample values. For example for the
17981 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
17987 @c man end VIDEO FILTERS
17989 @chapter Video Sources
17990 @c man begin VIDEO SOURCES
17992 Below is a description of the currently available video sources.
17996 Buffer video frames, and make them available to the filter chain.
17998 This source is mainly intended for a programmatic use, in particular
17999 through the interface defined in @file{libavfilter/vsrc_buffer.h}.
18001 It accepts the following parameters:
18006 Specify the size (width and height) of the buffered video frames. For the
18007 syntax of this option, check the
18008 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18011 The input video width.
18014 The input video height.
18017 A string representing the pixel format of the buffered video frames.
18018 It may be a number corresponding to a pixel format, or a pixel format
18022 Specify the timebase assumed by the timestamps of the buffered frames.
18025 Specify the frame rate expected for the video stream.
18027 @item pixel_aspect, sar
18028 The sample (pixel) aspect ratio of the input video.
18031 Specify the optional parameters to be used for the scale filter which
18032 is automatically inserted when an input change is detected in the
18033 input size or format.
18035 @item hw_frames_ctx
18036 When using a hardware pixel format, this should be a reference to an
18037 AVHWFramesContext describing input frames.
18042 buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
18045 will instruct the source to accept video frames with size 320x240 and
18046 with format "yuv410p", assuming 1/24 as the timestamps timebase and
18047 square pixels (1:1 sample aspect ratio).
18048 Since the pixel format with name "yuv410p" corresponds to the number 6
18049 (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
18050 this example corresponds to:
18052 buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
18055 Alternatively, the options can be specified as a flat string, but this
18056 syntax is deprecated:
18058 @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
18062 Create a pattern generated by an elementary cellular automaton.
18064 The initial state of the cellular automaton can be defined through the
18065 @option{filename} and @option{pattern} options. If such options are
18066 not specified an initial state is created randomly.
18068 At each new frame a new row in the video is filled with the result of
18069 the cellular automaton next generation. The behavior when the whole
18070 frame is filled is defined by the @option{scroll} option.
18072 This source accepts the following options:
18076 Read the initial cellular automaton state, i.e. the starting row, from
18077 the specified file.
18078 In the file, each non-whitespace character is considered an alive
18079 cell, a newline will terminate the row, and further characters in the
18080 file will be ignored.
18083 Read the initial cellular automaton state, i.e. the starting row, from
18084 the specified string.
18086 Each non-whitespace character in the string is considered an alive
18087 cell, a newline will terminate the row, and further characters in the
18088 string will be ignored.
18091 Set the video rate, that is the number of frames generated per second.
18094 @item random_fill_ratio, ratio
18095 Set the random fill ratio for the initial cellular automaton row. It
18096 is a floating point number value ranging from 0 to 1, defaults to
18099 This option is ignored when a file or a pattern is specified.
18101 @item random_seed, seed
18102 Set the seed for filling randomly the initial row, must be an integer
18103 included between 0 and UINT32_MAX. If not specified, or if explicitly
18104 set to -1, the filter will try to use a good random seed on a best
18108 Set the cellular automaton rule, it is a number ranging from 0 to 255.
18109 Default value is 110.
18112 Set the size of the output video. For the syntax of this option, check the
18113 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18115 If @option{filename} or @option{pattern} is specified, the size is set
18116 by default to the width of the specified initial state row, and the
18117 height is set to @var{width} * PHI.
18119 If @option{size} is set, it must contain the width of the specified
18120 pattern string, and the specified pattern will be centered in the
18123 If a filename or a pattern string is not specified, the size value
18124 defaults to "320x518" (used for a randomly generated initial state).
18127 If set to 1, scroll the output upward when all the rows in the output
18128 have been already filled. If set to 0, the new generated row will be
18129 written over the top row just after the bottom row is filled.
18132 @item start_full, full
18133 If set to 1, completely fill the output with generated rows before
18134 outputting the first frame.
18135 This is the default behavior, for disabling set the value to 0.
18138 If set to 1, stitch the left and right row edges together.
18139 This is the default behavior, for disabling set the value to 0.
18142 @subsection Examples
18146 Read the initial state from @file{pattern}, and specify an output of
18149 cellauto=f=pattern:s=200x400
18153 Generate a random initial row with a width of 200 cells, with a fill
18156 cellauto=ratio=2/3:s=200x200
18160 Create a pattern generated by rule 18 starting by a single alive cell
18161 centered on an initial row with width 100:
18163 cellauto=p=@@:s=100x400:full=0:rule=18
18167 Specify a more elaborated initial pattern:
18169 cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
18174 @anchor{coreimagesrc}
18175 @section coreimagesrc
18176 Video source generated on GPU using Apple's CoreImage API on OSX.
18178 This video source is a specialized version of the @ref{coreimage} video filter.
18179 Use a core image generator at the beginning of the applied filterchain to
18180 generate the content.
18182 The coreimagesrc video source accepts the following options:
18184 @item list_generators
18185 List all available generators along with all their respective options as well as
18186 possible minimum and maximum values along with the default values.
18188 list_generators=true
18192 Specify the size of the sourced video. For the syntax of this option, check the
18193 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18194 The default value is @code{320x240}.
18197 Specify the frame rate of the sourced video, as the number of frames
18198 generated per second. It has to be a string in the format
18199 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
18200 number or a valid video frame rate abbreviation. The default value is
18204 Set the sample aspect ratio of the sourced video.
18207 Set the duration of the sourced video. See
18208 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
18209 for the accepted syntax.
18211 If not specified, or the expressed duration is negative, the video is
18212 supposed to be generated forever.
18215 Additionally, all options of the @ref{coreimage} video filter are accepted.
18216 A complete filterchain can be used for further processing of the
18217 generated input without CPU-HOST transfer. See @ref{coreimage} documentation
18218 and examples for details.
18220 @subsection Examples
18225 Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
18226 given as complete and escaped command-line for Apple's standard bash shell:
18228 ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
18230 This example is equivalent to the QRCode example of @ref{coreimage} without the
18231 need for a nullsrc video source.
18235 @section mandelbrot
18237 Generate a Mandelbrot set fractal, and progressively zoom towards the
18238 point specified with @var{start_x} and @var{start_y}.
18240 This source accepts the following options:
18245 Set the terminal pts value. Default value is 400.
18248 Set the terminal scale value.
18249 Must be a floating point value. Default value is 0.3.
18252 Set the inner coloring mode, that is the algorithm used to draw the
18253 Mandelbrot fractal internal region.
18255 It shall assume one of the following values:
18260 Show time until convergence.
18262 Set color based on point closest to the origin of the iterations.
18267 Default value is @var{mincol}.
18270 Set the bailout value. Default value is 10.0.
18273 Set the maximum of iterations performed by the rendering
18274 algorithm. Default value is 7189.
18277 Set outer coloring mode.
18278 It shall assume one of following values:
18280 @item iteration_count
18281 Set iteration cound mode.
18282 @item normalized_iteration_count
18283 set normalized iteration count mode.
18285 Default value is @var{normalized_iteration_count}.
18288 Set frame rate, expressed as number of frames per second. Default
18292 Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
18293 size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
18296 Set the initial scale value. Default value is 3.0.
18299 Set the initial x position. Must be a floating point value between
18300 -100 and 100. Default value is -0.743643887037158704752191506114774.
18303 Set the initial y position. Must be a floating point value between
18304 -100 and 100. Default value is -0.131825904205311970493132056385139.
18309 Generate various test patterns, as generated by the MPlayer test filter.
18311 The size of the generated video is fixed, and is 256x256.
18312 This source is useful in particular for testing encoding features.
18314 This source accepts the following options:
18319 Specify the frame rate of the sourced video, as the number of frames
18320 generated per second. It has to be a string in the format
18321 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
18322 number or a valid video frame rate abbreviation. The default value is
18326 Set the duration of the sourced video. See
18327 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
18328 for the accepted syntax.
18330 If not specified, or the expressed duration is negative, the video is
18331 supposed to be generated forever.
18335 Set the number or the name of the test to perform. Supported tests are:
18351 Default value is "all", which will cycle through the list of all tests.
18356 mptestsrc=t=dc_luma
18359 will generate a "dc_luma" test pattern.
18361 @section frei0r_src
18363 Provide a frei0r source.
18365 To enable compilation of this filter you need to install the frei0r
18366 header and configure FFmpeg with @code{--enable-frei0r}.
18368 This source accepts the following parameters:
18373 The size of the video to generate. For the syntax of this option, check the
18374 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18377 The framerate of the generated video. It may be a string of the form
18378 @var{num}/@var{den} or a frame rate abbreviation.
18381 The name to the frei0r source to load. For more information regarding frei0r and
18382 how to set the parameters, read the @ref{frei0r} section in the video filters
18385 @item filter_params
18386 A '|'-separated list of parameters to pass to the frei0r source.
18390 For example, to generate a frei0r partik0l source with size 200x200
18391 and frame rate 10 which is overlaid on the overlay filter main input:
18393 frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
18398 Generate a life pattern.
18400 This source is based on a generalization of John Conway's life game.
18402 The sourced input represents a life grid, each pixel represents a cell
18403 which can be in one of two possible states, alive or dead. Every cell
18404 interacts with its eight neighbours, which are the cells that are
18405 horizontally, vertically, or diagonally adjacent.
18407 At each interaction the grid evolves according to the adopted rule,
18408 which specifies the number of neighbor alive cells which will make a
18409 cell stay alive or born. The @option{rule} option allows one to specify
18412 This source accepts the following options:
18416 Set the file from which to read the initial grid state. In the file,
18417 each non-whitespace character is considered an alive cell, and newline
18418 is used to delimit the end of each row.
18420 If this option is not specified, the initial grid is generated
18424 Set the video rate, that is the number of frames generated per second.
18427 @item random_fill_ratio, ratio
18428 Set the random fill ratio for the initial random grid. It is a
18429 floating point number value ranging from 0 to 1, defaults to 1/PHI.
18430 It is ignored when a file is specified.
18432 @item random_seed, seed
18433 Set the seed for filling the initial random grid, must be an integer
18434 included between 0 and UINT32_MAX. If not specified, or if explicitly
18435 set to -1, the filter will try to use a good random seed on a best
18441 A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
18442 where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
18443 @var{NS} specifies the number of alive neighbor cells which make a
18444 live cell stay alive, and @var{NB} the number of alive neighbor cells
18445 which make a dead cell to become alive (i.e. to "born").
18446 "s" and "b" can be used in place of "S" and "B", respectively.
18448 Alternatively a rule can be specified by an 18-bits integer. The 9
18449 high order bits are used to encode the next cell state if it is alive
18450 for each number of neighbor alive cells, the low order bits specify
18451 the rule for "borning" new cells. Higher order bits encode for an
18452 higher number of neighbor cells.
18453 For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
18454 rule of 12 and a born rule of 9, which corresponds to "S23/B03".
18456 Default value is "S23/B3", which is the original Conway's game of life
18457 rule, and will keep a cell alive if it has 2 or 3 neighbor alive
18458 cells, and will born a new cell if there are three alive cells around
18462 Set the size of the output video. For the syntax of this option, check the
18463 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18465 If @option{filename} is specified, the size is set by default to the
18466 same size of the input file. If @option{size} is set, it must contain
18467 the size specified in the input file, and the initial grid defined in
18468 that file is centered in the larger resulting area.
18470 If a filename is not specified, the size value defaults to "320x240"
18471 (used for a randomly generated initial grid).
18474 If set to 1, stitch the left and right grid edges together, and the
18475 top and bottom edges also. Defaults to 1.
18478 Set cell mold speed. If set, a dead cell will go from @option{death_color} to
18479 @option{mold_color} with a step of @option{mold}. @option{mold} can have a
18480 value from 0 to 255.
18483 Set the color of living (or new born) cells.
18486 Set the color of dead cells. If @option{mold} is set, this is the first color
18487 used to represent a dead cell.
18490 Set mold color, for definitely dead and moldy cells.
18492 For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
18493 ffmpeg-utils manual,ffmpeg-utils}.
18496 @subsection Examples
18500 Read a grid from @file{pattern}, and center it on a grid of size
18503 life=f=pattern:s=300x300
18507 Generate a random grid of size 200x200, with a fill ratio of 2/3:
18509 life=ratio=2/3:s=200x200
18513 Specify a custom rule for evolving a randomly generated grid:
18519 Full example with slow death effect (mold) using @command{ffplay}:
18521 ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
18528 @anchor{haldclutsrc}
18531 @anchor{pal100bars}
18532 @anchor{rgbtestsrc}
18534 @anchor{smptehdbars}
18537 @anchor{yuvtestsrc}
18538 @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
18540 The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
18542 The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
18544 The @code{color} source provides an uniformly colored input.
18546 The @code{haldclutsrc} source provides an identity Hald CLUT. See also
18547 @ref{haldclut} filter.
18549 The @code{nullsrc} source returns unprocessed video frames. It is
18550 mainly useful to be employed in analysis / debugging tools, or as the
18551 source for filters which ignore the input data.
18553 The @code{pal75bars} source generates a color bars pattern, based on
18554 EBU PAL recommendations with 75% color levels.
18556 The @code{pal100bars} source generates a color bars pattern, based on
18557 EBU PAL recommendations with 100% color levels.
18559 The @code{rgbtestsrc} source generates an RGB test pattern useful for
18560 detecting RGB vs BGR issues. You should see a red, green and blue
18561 stripe from top to bottom.
18563 The @code{smptebars} source generates a color bars pattern, based on
18564 the SMPTE Engineering Guideline EG 1-1990.
18566 The @code{smptehdbars} source generates a color bars pattern, based on
18567 the SMPTE RP 219-2002.
18569 The @code{testsrc} source generates a test video pattern, showing a
18570 color pattern, a scrolling gradient and a timestamp. This is mainly
18571 intended for testing purposes.
18573 The @code{testsrc2} source is similar to testsrc, but supports more
18574 pixel formats instead of just @code{rgb24}. This allows using it as an
18575 input for other tests without requiring a format conversion.
18577 The @code{yuvtestsrc} source generates an YUV test pattern. You should
18578 see a y, cb and cr stripe from top to bottom.
18580 The sources accept the following parameters:
18585 Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
18586 source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
18587 pixels to be used as identity matrix for 3D lookup tables. Each component is
18588 coded on a @code{1/(N*N)} scale.
18591 Specify the color of the source, only available in the @code{color}
18592 source. For the syntax of this option, check the
18593 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
18596 Specify the size of the sourced video. For the syntax of this option, check the
18597 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18598 The default value is @code{320x240}.
18600 This option is not available with the @code{allrgb}, @code{allyuv}, and
18601 @code{haldclutsrc} filters.
18604 Specify the frame rate of the sourced video, as the number of frames
18605 generated per second. It has to be a string in the format
18606 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
18607 number or a valid video frame rate abbreviation. The default value is
18611 Set the duration of the sourced video. See
18612 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
18613 for the accepted syntax.
18615 If not specified, or the expressed duration is negative, the video is
18616 supposed to be generated forever.
18619 Set the sample aspect ratio of the sourced video.
18622 Specify the alpha (opacity) of the background, only available in the
18623 @code{testsrc2} source. The value must be between 0 (fully transparent) and
18624 255 (fully opaque, the default).
18627 Set the number of decimals to show in the timestamp, only available in the
18628 @code{testsrc} source.
18630 The displayed timestamp value will correspond to the original
18631 timestamp value multiplied by the power of 10 of the specified
18632 value. Default value is 0.
18635 @subsection Examples
18639 Generate a video with a duration of 5.3 seconds, with size
18640 176x144 and a frame rate of 10 frames per second:
18642 testsrc=duration=5.3:size=qcif:rate=10
18646 The following graph description will generate a red source
18647 with an opacity of 0.2, with size "qcif" and a frame rate of 10
18650 color=c=red@@0.2:s=qcif:r=10
18654 If the input content is to be ignored, @code{nullsrc} can be used. The
18655 following command generates noise in the luminance plane by employing
18656 the @code{geq} filter:
18658 nullsrc=s=256x256, geq=random(1)*255:128:128
18662 @subsection Commands
18664 The @code{color} source supports the following commands:
18668 Set the color of the created image. Accepts the same syntax of the
18669 corresponding @option{color} option.
18674 Generate video using an OpenCL program.
18679 OpenCL program source file.
18682 Kernel name in program.
18685 Size of frames to generate. This must be set.
18688 Pixel format to use for the generated frames. This must be set.
18691 Number of frames generated every second. Default value is '25'.
18695 For details of how the program loading works, see the @ref{program_opencl}
18702 Generate a colour ramp by setting pixel values from the position of the pixel
18703 in the output image. (Note that this will work with all pixel formats, but
18704 the generated output will not be the same.)
18706 __kernel void ramp(__write_only image2d_t dst,
18707 unsigned int index)
18709 int2 loc = (int2)(get_global_id(0), get_global_id(1));
18712 val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
18714 write_imagef(dst, loc, val);
18719 Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
18721 __kernel void sierpinski_carpet(__write_only image2d_t dst,
18722 unsigned int index)
18724 int2 loc = (int2)(get_global_id(0), get_global_id(1));
18726 float4 value = 0.0f;
18727 int x = loc.x + index;
18728 int y = loc.y + index;
18729 while (x > 0 || y > 0) {
18730 if (x % 3 == 1 && y % 3 == 1) {
18738 write_imagef(dst, loc, value);
18744 @c man end VIDEO SOURCES
18746 @chapter Video Sinks
18747 @c man begin VIDEO SINKS
18749 Below is a description of the currently available video sinks.
18751 @section buffersink
18753 Buffer video frames, and make them available to the end of the filter
18756 This sink is mainly intended for programmatic use, in particular
18757 through the interface defined in @file{libavfilter/buffersink.h}
18758 or the options system.
18760 It accepts a pointer to an AVBufferSinkContext structure, which
18761 defines the incoming buffers' formats, to be passed as the opaque
18762 parameter to @code{avfilter_init_filter} for initialization.
18766 Null video sink: do absolutely nothing with the input video. It is
18767 mainly useful as a template and for use in analysis / debugging
18770 @c man end VIDEO SINKS
18772 @chapter Multimedia Filters
18773 @c man begin MULTIMEDIA FILTERS
18775 Below is a description of the currently available multimedia filters.
18779 Convert input audio to a video output, displaying the audio bit scope.
18781 The filter accepts the following options:
18785 Set frame rate, expressed as number of frames per second. Default
18789 Specify the video size for the output. For the syntax of this option, check the
18790 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18791 Default value is @code{1024x256}.
18794 Specify list of colors separated by space or by '|' which will be used to
18795 draw channels. Unrecognized or missing colors will be replaced
18799 @section ahistogram
18801 Convert input audio to a video output, displaying the volume histogram.
18803 The filter accepts the following options:
18807 Specify how histogram is calculated.
18809 It accepts the following values:
18812 Use single histogram for all channels.
18814 Use separate histogram for each channel.
18816 Default is @code{single}.
18819 Set frame rate, expressed as number of frames per second. Default
18823 Specify the video size for the output. For the syntax of this option, check the
18824 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18825 Default value is @code{hd720}.
18830 It accepts the following values:
18841 reverse logarithmic
18843 Default is @code{log}.
18846 Set amplitude scale.
18848 It accepts the following values:
18855 Default is @code{log}.
18858 Set how much frames to accumulate in histogram.
18859 Defauls is 1. Setting this to -1 accumulates all frames.
18862 Set histogram ratio of window height.
18865 Set sonogram sliding.
18867 It accepts the following values:
18870 replace old rows with new ones.
18872 scroll from top to bottom.
18874 Default is @code{replace}.
18877 @section aphasemeter
18879 Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
18880 representing mean phase of current audio frame. A video output can also be produced and is
18881 enabled by default. The audio is passed through as first output.
18883 Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
18884 range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
18885 and @code{1} means channels are in phase.
18887 The filter accepts the following options, all related to its video output:
18891 Set the output frame rate. Default value is @code{25}.
18894 Set the video size for the output. For the syntax of this option, check the
18895 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18896 Default value is @code{800x400}.
18901 Specify the red, green, blue contrast. Default values are @code{2},
18902 @code{7} and @code{1}.
18903 Allowed range is @code{[0, 255]}.
18906 Set color which will be used for drawing median phase. If color is
18907 @code{none} which is default, no median phase value will be drawn.
18910 Enable video output. Default is enabled.
18913 @section avectorscope
18915 Convert input audio to a video output, representing the audio vector
18918 The filter is used to measure the difference between channels of stereo
18919 audio stream. A monoaural signal, consisting of identical left and right
18920 signal, results in straight vertical line. Any stereo separation is visible
18921 as a deviation from this line, creating a Lissajous figure.
18922 If the straight (or deviation from it) but horizontal line appears this
18923 indicates that the left and right channels are out of phase.
18925 The filter accepts the following options:
18929 Set the vectorscope mode.
18931 Available values are:
18934 Lissajous rotated by 45 degrees.
18937 Same as above but not rotated.
18940 Shape resembling half of circle.
18943 Default value is @samp{lissajous}.
18946 Set the video size for the output. For the syntax of this option, check the
18947 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18948 Default value is @code{400x400}.
18951 Set the output frame rate. Default value is @code{25}.
18957 Specify the red, green, blue and alpha contrast. Default values are @code{40},
18958 @code{160}, @code{80} and @code{255}.
18959 Allowed range is @code{[0, 255]}.
18965 Specify the red, green, blue and alpha fade. Default values are @code{15},
18966 @code{10}, @code{5} and @code{5}.
18967 Allowed range is @code{[0, 255]}.
18970 Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
18971 Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
18974 Set the vectorscope drawing mode.
18976 Available values are:
18979 Draw dot for each sample.
18982 Draw line between previous and current sample.
18985 Default value is @samp{dot}.
18988 Specify amplitude scale of audio samples.
18990 Available values are:
19006 Swap left channel axis with right channel axis.
19016 Mirror only x axis.
19019 Mirror only y axis.
19027 @subsection Examples
19031 Complete example using @command{ffplay}:
19033 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
19034 [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
19038 @section bench, abench
19040 Benchmark part of a filtergraph.
19042 The filter accepts the following options:
19046 Start or stop a timer.
19048 Available values are:
19051 Get the current time, set it as frame metadata (using the key
19052 @code{lavfi.bench.start_time}), and forward the frame to the next filter.
19055 Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
19056 the input frame metadata to get the time difference. Time difference, average,
19057 maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
19058 @code{min}) are then printed. The timestamps are expressed in seconds.
19062 @subsection Examples
19066 Benchmark @ref{selectivecolor} filter:
19068 bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
19074 Concatenate audio and video streams, joining them together one after the
19077 The filter works on segments of synchronized video and audio streams. All
19078 segments must have the same number of streams of each type, and that will
19079 also be the number of streams at output.
19081 The filter accepts the following options:
19086 Set the number of segments. Default is 2.
19089 Set the number of output video streams, that is also the number of video
19090 streams in each segment. Default is 1.
19093 Set the number of output audio streams, that is also the number of audio
19094 streams in each segment. Default is 0.
19097 Activate unsafe mode: do not fail if segments have a different format.
19101 The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
19102 @var{a} audio outputs.
19104 There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
19105 segment, in the same order as the outputs, then the inputs for the second
19108 Related streams do not always have exactly the same duration, for various
19109 reasons including codec frame size or sloppy authoring. For that reason,
19110 related synchronized streams (e.g. a video and its audio track) should be
19111 concatenated at once. The concat filter will use the duration of the longest
19112 stream in each segment (except the last one), and if necessary pad shorter
19113 audio streams with silence.
19115 For this filter to work correctly, all segments must start at timestamp 0.
19117 All corresponding streams must have the same parameters in all segments; the
19118 filtering system will automatically select a common pixel format for video
19119 streams, and a common sample format, sample rate and channel layout for
19120 audio streams, but other settings, such as resolution, must be converted
19121 explicitly by the user.
19123 Different frame rates are acceptable but will result in variable frame rate
19124 at output; be sure to configure the output file to handle it.
19126 @subsection Examples
19130 Concatenate an opening, an episode and an ending, all in bilingual version
19131 (video in stream 0, audio in streams 1 and 2):
19133 ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
19134 '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
19135 concat=n=3:v=1:a=2 [v] [a1] [a2]' \
19136 -map '[v]' -map '[a1]' -map '[a2]' output.mkv
19140 Concatenate two parts, handling audio and video separately, using the
19141 (a)movie sources, and adjusting the resolution:
19143 movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
19144 movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
19145 [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
19147 Note that a desync will happen at the stitch if the audio and video streams
19148 do not have exactly the same duration in the first file.
19152 @subsection Commands
19154 This filter supports the following commands:
19157 Close the current segment and step to the next one
19160 @section drawgraph, adrawgraph
19162 Draw a graph using input video or audio metadata.
19164 It accepts the following parameters:
19168 Set 1st frame metadata key from which metadata values will be used to draw a graph.
19171 Set 1st foreground color expression.
19174 Set 2nd frame metadata key from which metadata values will be used to draw a graph.
19177 Set 2nd foreground color expression.
19180 Set 3rd frame metadata key from which metadata values will be used to draw a graph.
19183 Set 3rd foreground color expression.
19186 Set 4th frame metadata key from which metadata values will be used to draw a graph.
19189 Set 4th foreground color expression.
19192 Set minimal value of metadata value.
19195 Set maximal value of metadata value.
19198 Set graph background color. Default is white.
19203 Available values for mode is:
19210 Default is @code{line}.
19215 Available values for slide is:
19218 Draw new frame when right border is reached.
19221 Replace old columns with new ones.
19224 Scroll from right to left.
19227 Scroll from left to right.
19230 Draw single picture.
19233 Default is @code{frame}.
19236 Set size of graph video. For the syntax of this option, check the
19237 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19238 The default value is @code{900x256}.
19240 The foreground color expressions can use the following variables:
19243 Minimal value of metadata value.
19246 Maximal value of metadata value.
19249 Current metadata key value.
19252 The color is defined as 0xAABBGGRR.
19255 Example using metadata from @ref{signalstats} filter:
19257 signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
19260 Example using metadata from @ref{ebur128} filter:
19262 ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
19268 EBU R128 scanner filter. This filter takes an audio stream as input and outputs
19269 it unchanged. By default, it logs a message at a frequency of 10Hz with the
19270 Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
19271 Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
19273 The filter also has a video output (see the @var{video} option) with a real
19274 time graph to observe the loudness evolution. The graphic contains the logged
19275 message mentioned above, so it is not printed anymore when this option is set,
19276 unless the verbose logging is set. The main graphing area contains the
19277 short-term loudness (3 seconds of analysis), and the gauge on the right is for
19278 the momentary loudness (400 milliseconds).
19280 More information about the Loudness Recommendation EBU R128 on
19281 @url{http://tech.ebu.ch/loudness}.
19283 The filter accepts the following options:
19288 Activate the video output. The audio stream is passed unchanged whether this
19289 option is set or no. The video stream will be the first output stream if
19290 activated. Default is @code{0}.
19293 Set the video size. This option is for video only. For the syntax of this
19295 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19296 Default and minimum resolution is @code{640x480}.
19299 Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
19300 @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
19301 other integer value between this range is allowed.
19304 Set metadata injection. If set to @code{1}, the audio input will be segmented
19305 into 100ms output frames, each of them containing various loudness information
19306 in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
19308 Default is @code{0}.
19311 Force the frame logging level.
19313 Available values are:
19316 information logging level
19318 verbose logging level
19321 By default, the logging level is set to @var{info}. If the @option{video} or
19322 the @option{metadata} options are set, it switches to @var{verbose}.
19327 Available modes can be cumulated (the option is a @code{flag} type). Possible
19331 Disable any peak mode (default).
19333 Enable sample-peak mode.
19335 Simple peak mode looking for the higher sample value. It logs a message
19336 for sample-peak (identified by @code{SPK}).
19338 Enable true-peak mode.
19340 If enabled, the peak lookup is done on an over-sampled version of the input
19341 stream for better peak accuracy. It logs a message for true-peak.
19342 (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
19343 This mode requires a build with @code{libswresample}.
19347 Treat mono input files as "dual mono". If a mono file is intended for playback
19348 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
19349 If set to @code{true}, this option will compensate for this effect.
19350 Multi-channel input files are not affected by this option.
19353 Set a specific pan law to be used for the measurement of dual mono files.
19354 This parameter is optional, and has a default value of -3.01dB.
19357 @subsection Examples
19361 Real-time graph using @command{ffplay}, with a EBU scale meter +18:
19363 ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
19367 Run an analysis with @command{ffmpeg}:
19369 ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
19373 @section interleave, ainterleave
19375 Temporally interleave frames from several inputs.
19377 @code{interleave} works with video inputs, @code{ainterleave} with audio.
19379 These filters read frames from several inputs and send the oldest
19380 queued frame to the output.
19382 Input streams must have well defined, monotonically increasing frame
19385 In order to submit one frame to output, these filters need to enqueue
19386 at least one frame for each input, so they cannot work in case one
19387 input is not yet terminated and will not receive incoming frames.
19389 For example consider the case when one input is a @code{select} filter
19390 which always drops input frames. The @code{interleave} filter will keep
19391 reading from that input, but it will never be able to send new frames
19392 to output until the input sends an end-of-stream signal.
19394 Also, depending on inputs synchronization, the filters will drop
19395 frames in case one input receives more frames than the other ones, and
19396 the queue is already filled.
19398 These filters accept the following options:
19402 Set the number of different inputs, it is 2 by default.
19405 @subsection Examples
19409 Interleave frames belonging to different streams using @command{ffmpeg}:
19411 ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
19415 Add flickering blur effect:
19417 select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
19421 @section metadata, ametadata
19423 Manipulate frame metadata.
19425 This filter accepts the following options:
19429 Set mode of operation of the filter.
19431 Can be one of the following:
19435 If both @code{value} and @code{key} is set, select frames
19436 which have such metadata. If only @code{key} is set, select
19437 every frame that has such key in metadata.
19440 Add new metadata @code{key} and @code{value}. If key is already available
19444 Modify value of already present key.
19447 If @code{value} is set, delete only keys that have such value.
19448 Otherwise, delete key. If @code{key} is not set, delete all metadata values in
19452 Print key and its value if metadata was found. If @code{key} is not set print all
19453 metadata values available in frame.
19457 Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
19460 Set metadata value which will be used. This option is mandatory for
19461 @code{modify} and @code{add} mode.
19464 Which function to use when comparing metadata value and @code{value}.
19466 Can be one of following:
19470 Values are interpreted as strings, returns true if metadata value is same as @code{value}.
19473 Values are interpreted as strings, returns true if metadata value starts with
19474 the @code{value} option string.
19477 Values are interpreted as floats, returns true if metadata value is less than @code{value}.
19480 Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
19483 Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
19486 Values are interpreted as floats, returns true if expression from option @code{expr}
19491 Set expression which is used when @code{function} is set to @code{expr}.
19492 The expression is evaluated through the eval API and can contain the following
19497 Float representation of @code{value} from metadata key.
19500 Float representation of @code{value} as supplied by user in @code{value} option.
19504 If specified in @code{print} mode, output is written to the named file. Instead of
19505 plain filename any writable url can be specified. Filename ``-'' is a shorthand
19506 for standard output. If @code{file} option is not set, output is written to the log
19507 with AV_LOG_INFO loglevel.
19511 @subsection Examples
19515 Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
19518 signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
19521 Print silencedetect output to file @file{metadata.txt}.
19523 silencedetect,ametadata=mode=print:file=metadata.txt
19526 Direct all metadata to a pipe with file descriptor 4.
19528 metadata=mode=print:file='pipe\:4'
19532 @section perms, aperms
19534 Set read/write permissions for the output frames.
19536 These filters are mainly aimed at developers to test direct path in the
19537 following filter in the filtergraph.
19539 The filters accept the following options:
19543 Select the permissions mode.
19545 It accepts the following values:
19548 Do nothing. This is the default.
19550 Set all the output frames read-only.
19552 Set all the output frames directly writable.
19554 Make the frame read-only if writable, and writable if read-only.
19556 Set each output frame read-only or writable randomly.
19560 Set the seed for the @var{random} mode, must be an integer included between
19561 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
19562 @code{-1}, the filter will try to use a good random seed on a best effort
19566 Note: in case of auto-inserted filter between the permission filter and the
19567 following one, the permission might not be received as expected in that
19568 following filter. Inserting a @ref{format} or @ref{aformat} filter before the
19569 perms/aperms filter can avoid this problem.
19571 @section realtime, arealtime
19573 Slow down filtering to match real time approximately.
19575 These filters will pause the filtering for a variable amount of time to
19576 match the output rate with the input timestamps.
19577 They are similar to the @option{re} option to @code{ffmpeg}.
19579 They accept the following options:
19583 Time limit for the pauses. Any pause longer than that will be considered
19584 a timestamp discontinuity and reset the timer. Default is 2 seconds.
19588 @section select, aselect
19590 Select frames to pass in output.
19592 This filter accepts the following options:
19597 Set expression, which is evaluated for each input frame.
19599 If the expression is evaluated to zero, the frame is discarded.
19601 If the evaluation result is negative or NaN, the frame is sent to the
19602 first output; otherwise it is sent to the output with index
19603 @code{ceil(val)-1}, assuming that the input index starts from 0.
19605 For example a value of @code{1.2} corresponds to the output with index
19606 @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
19609 Set the number of outputs. The output to which to send the selected
19610 frame is based on the result of the evaluation. Default value is 1.
19613 The expression can contain the following constants:
19617 The (sequential) number of the filtered frame, starting from 0.
19620 The (sequential) number of the selected frame, starting from 0.
19622 @item prev_selected_n
19623 The sequential number of the last selected frame. It's NAN if undefined.
19626 The timebase of the input timestamps.
19629 The PTS (Presentation TimeStamp) of the filtered video frame,
19630 expressed in @var{TB} units. It's NAN if undefined.
19633 The PTS of the filtered video frame,
19634 expressed in seconds. It's NAN if undefined.
19637 The PTS of the previously filtered video frame. It's NAN if undefined.
19639 @item prev_selected_pts
19640 The PTS of the last previously filtered video frame. It's NAN if undefined.
19642 @item prev_selected_t
19643 The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
19646 The PTS of the first video frame in the video. It's NAN if undefined.
19649 The time of the first video frame in the video. It's NAN if undefined.
19651 @item pict_type @emph{(video only)}
19652 The type of the filtered frame. It can assume one of the following
19664 @item interlace_type @emph{(video only)}
19665 The frame interlace type. It can assume one of the following values:
19668 The frame is progressive (not interlaced).
19670 The frame is top-field-first.
19672 The frame is bottom-field-first.
19675 @item consumed_sample_n @emph{(audio only)}
19676 the number of selected samples before the current frame
19678 @item samples_n @emph{(audio only)}
19679 the number of samples in the current frame
19681 @item sample_rate @emph{(audio only)}
19682 the input sample rate
19685 This is 1 if the filtered frame is a key-frame, 0 otherwise.
19688 the position in the file of the filtered frame, -1 if the information
19689 is not available (e.g. for synthetic video)
19691 @item scene @emph{(video only)}
19692 value between 0 and 1 to indicate a new scene; a low value reflects a low
19693 probability for the current frame to introduce a new scene, while a higher
19694 value means the current frame is more likely to be one (see the example below)
19696 @item concatdec_select
19697 The concat demuxer can select only part of a concat input file by setting an
19698 inpoint and an outpoint, but the output packets may not be entirely contained
19699 in the selected interval. By using this variable, it is possible to skip frames
19700 generated by the concat demuxer which are not exactly contained in the selected
19703 This works by comparing the frame pts against the @var{lavf.concat.start_time}
19704 and the @var{lavf.concat.duration} packet metadata values which are also
19705 present in the decoded frames.
19707 The @var{concatdec_select} variable is -1 if the frame pts is at least
19708 start_time and either the duration metadata is missing or the frame pts is less
19709 than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
19712 That basically means that an input frame is selected if its pts is within the
19713 interval set by the concat demuxer.
19717 The default value of the select expression is "1".
19719 @subsection Examples
19723 Select all frames in input:
19728 The example above is the same as:
19740 Select only I-frames:
19742 select='eq(pict_type\,I)'
19746 Select one frame every 100:
19748 select='not(mod(n\,100))'
19752 Select only frames contained in the 10-20 time interval:
19754 select=between(t\,10\,20)
19758 Select only I-frames contained in the 10-20 time interval:
19760 select=between(t\,10\,20)*eq(pict_type\,I)
19764 Select frames with a minimum distance of 10 seconds:
19766 select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
19770 Use aselect to select only audio frames with samples number > 100:
19772 aselect='gt(samples_n\,100)'
19776 Create a mosaic of the first scenes:
19778 ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
19781 Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
19785 Send even and odd frames to separate outputs, and compose them:
19787 select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
19791 Select useful frames from an ffconcat file which is using inpoints and
19792 outpoints but where the source files are not intra frame only.
19794 ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
19798 @section sendcmd, asendcmd
19800 Send commands to filters in the filtergraph.
19802 These filters read commands to be sent to other filters in the
19805 @code{sendcmd} must be inserted between two video filters,
19806 @code{asendcmd} must be inserted between two audio filters, but apart
19807 from that they act the same way.
19809 The specification of commands can be provided in the filter arguments
19810 with the @var{commands} option, or in a file specified by the
19811 @var{filename} option.
19813 These filters accept the following options:
19816 Set the commands to be read and sent to the other filters.
19818 Set the filename of the commands to be read and sent to the other
19822 @subsection Commands syntax
19824 A commands description consists of a sequence of interval
19825 specifications, comprising a list of commands to be executed when a
19826 particular event related to that interval occurs. The occurring event
19827 is typically the current frame time entering or leaving a given time
19830 An interval is specified by the following syntax:
19832 @var{START}[-@var{END}] @var{COMMANDS};
19835 The time interval is specified by the @var{START} and @var{END} times.
19836 @var{END} is optional and defaults to the maximum time.
19838 The current frame time is considered within the specified interval if
19839 it is included in the interval [@var{START}, @var{END}), that is when
19840 the time is greater or equal to @var{START} and is lesser than
19843 @var{COMMANDS} consists of a sequence of one or more command
19844 specifications, separated by ",", relating to that interval. The
19845 syntax of a command specification is given by:
19847 [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
19850 @var{FLAGS} is optional and specifies the type of events relating to
19851 the time interval which enable sending the specified command, and must
19852 be a non-null sequence of identifier flags separated by "+" or "|" and
19853 enclosed between "[" and "]".
19855 The following flags are recognized:
19858 The command is sent when the current frame timestamp enters the
19859 specified interval. In other words, the command is sent when the
19860 previous frame timestamp was not in the given interval, and the
19864 The command is sent when the current frame timestamp leaves the
19865 specified interval. In other words, the command is sent when the
19866 previous frame timestamp was in the given interval, and the
19870 If @var{FLAGS} is not specified, a default value of @code{[enter]} is
19873 @var{TARGET} specifies the target of the command, usually the name of
19874 the filter class or a specific filter instance name.
19876 @var{COMMAND} specifies the name of the command for the target filter.
19878 @var{ARG} is optional and specifies the optional list of argument for
19879 the given @var{COMMAND}.
19881 Between one interval specification and another, whitespaces, or
19882 sequences of characters starting with @code{#} until the end of line,
19883 are ignored and can be used to annotate comments.
19885 A simplified BNF description of the commands specification syntax
19888 @var{COMMAND_FLAG} ::= "enter" | "leave"
19889 @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
19890 @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
19891 @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
19892 @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
19893 @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
19896 @subsection Examples
19900 Specify audio tempo change at second 4:
19902 asendcmd=c='4.0 atempo tempo 1.5',atempo
19906 Target a specific filter instance:
19908 asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
19912 Specify a list of drawtext and hue commands in a file.
19914 # show text in the interval 5-10
19915 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
19916 [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
19918 # desaturate the image in the interval 15-20
19919 15.0-20.0 [enter] hue s 0,
19920 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
19922 [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
19924 # apply an exponential saturation fade-out effect, starting from time 25
19925 25 [enter] hue s exp(25-t)
19928 A filtergraph allowing to read and process the above command list
19929 stored in a file @file{test.cmd}, can be specified with:
19931 sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
19936 @section setpts, asetpts
19938 Change the PTS (presentation timestamp) of the input frames.
19940 @code{setpts} works on video frames, @code{asetpts} on audio frames.
19942 This filter accepts the following options:
19947 The expression which is evaluated for each frame to construct its timestamp.
19951 The expression is evaluated through the eval API and can contain the following
19955 @item FRAME_RATE, FR
19956 frame rate, only defined for constant frame-rate video
19959 The presentation timestamp in input
19962 The count of the input frame for video or the number of consumed samples,
19963 not including the current frame for audio, starting from 0.
19965 @item NB_CONSUMED_SAMPLES
19966 The number of consumed samples, not including the current frame (only
19969 @item NB_SAMPLES, S
19970 The number of samples in the current frame (only audio)
19972 @item SAMPLE_RATE, SR
19973 The audio sample rate.
19976 The PTS of the first frame.
19979 the time in seconds of the first frame
19982 State whether the current frame is interlaced.
19985 the time in seconds of the current frame
19988 original position in the file of the frame, or undefined if undefined
19989 for the current frame
19992 The previous input PTS.
19995 previous input time in seconds
19998 The previous output PTS.
20001 previous output time in seconds
20004 The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
20008 The wallclock (RTC) time at the start of the movie in microseconds.
20011 The timebase of the input timestamps.
20015 @subsection Examples
20019 Start counting PTS from zero
20021 setpts=PTS-STARTPTS
20025 Apply fast motion effect:
20031 Apply slow motion effect:
20037 Set fixed rate of 25 frames per second:
20043 Set fixed rate 25 fps with some jitter:
20045 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
20049 Apply an offset of 10 seconds to the input PTS:
20055 Generate timestamps from a "live source" and rebase onto the current timebase:
20057 setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
20061 Generate timestamps by counting samples:
20070 Force color range for the output video frame.
20072 The @code{setrange} filter marks the color range property for the
20073 output frames. It does not change the input frame, but only sets the
20074 corresponding property, which affects how the frame is treated by
20077 The filter accepts the following options:
20082 Available values are:
20086 Keep the same color range property.
20088 @item unspecified, unknown
20089 Set the color range as unspecified.
20091 @item limited, tv, mpeg
20092 Set the color range as limited.
20094 @item full, pc, jpeg
20095 Set the color range as full.
20099 @section settb, asettb
20101 Set the timebase to use for the output frames timestamps.
20102 It is mainly useful for testing timebase configuration.
20104 It accepts the following parameters:
20109 The expression which is evaluated into the output timebase.
20113 The value for @option{tb} is an arithmetic expression representing a
20114 rational. The expression can contain the constants "AVTB" (the default
20115 timebase), "intb" (the input timebase) and "sr" (the sample rate,
20116 audio only). Default value is "intb".
20118 @subsection Examples
20122 Set the timebase to 1/25:
20128 Set the timebase to 1/10:
20134 Set the timebase to 1001/1000:
20140 Set the timebase to 2*intb:
20146 Set the default timebase value:
20153 Convert input audio to a video output representing frequency spectrum
20154 logarithmically using Brown-Puckette constant Q transform algorithm with
20155 direct frequency domain coefficient calculation (but the transform itself
20156 is not really constant Q, instead the Q factor is actually variable/clamped),
20157 with musical tone scale, from E0 to D#10.
20159 The filter accepts the following options:
20163 Specify the video size for the output. It must be even. For the syntax of this option,
20164 check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20165 Default value is @code{1920x1080}.
20168 Set the output frame rate. Default value is @code{25}.
20171 Set the bargraph height. It must be even. Default value is @code{-1} which
20172 computes the bargraph height automatically.
20175 Set the axis height. It must be even. Default value is @code{-1} which computes
20176 the axis height automatically.
20179 Set the sonogram height. It must be even. Default value is @code{-1} which
20180 computes the sonogram height automatically.
20183 Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
20184 instead. Default value is @code{1}.
20186 @item sono_v, volume
20187 Specify the sonogram volume expression. It can contain variables:
20190 the @var{bar_v} evaluated expression
20191 @item frequency, freq, f
20192 the frequency where it is evaluated
20193 @item timeclamp, tc
20194 the value of @var{timeclamp} option
20198 @item a_weighting(f)
20199 A-weighting of equal loudness
20200 @item b_weighting(f)
20201 B-weighting of equal loudness
20202 @item c_weighting(f)
20203 C-weighting of equal loudness.
20205 Default value is @code{16}.
20207 @item bar_v, volume2
20208 Specify the bargraph volume expression. It can contain variables:
20211 the @var{sono_v} evaluated expression
20212 @item frequency, freq, f
20213 the frequency where it is evaluated
20214 @item timeclamp, tc
20215 the value of @var{timeclamp} option
20219 @item a_weighting(f)
20220 A-weighting of equal loudness
20221 @item b_weighting(f)
20222 B-weighting of equal loudness
20223 @item c_weighting(f)
20224 C-weighting of equal loudness.
20226 Default value is @code{sono_v}.
20228 @item sono_g, gamma
20229 Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
20230 higher gamma makes the spectrum having more range. Default value is @code{3}.
20231 Acceptable range is @code{[1, 7]}.
20233 @item bar_g, gamma2
20234 Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
20238 Specify the bargraph transparency level. Lower value makes the bargraph sharper.
20239 Default value is @code{1}. Acceptable range is @code{[0, 1]}.
20241 @item timeclamp, tc
20242 Specify the transform timeclamp. At low frequency, there is trade-off between
20243 accuracy in time domain and frequency domain. If timeclamp is lower,
20244 event in time domain is represented more accurately (such as fast bass drum),
20245 otherwise event in frequency domain is represented more accurately
20246 (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
20249 Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
20250 limits future samples by applying asymmetric windowing in time domain, useful
20251 when low latency is required. Accepted range is @code{[0, 1]}.
20254 Specify the transform base frequency. Default value is @code{20.01523126408007475},
20255 which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
20258 Specify the transform end frequency. Default value is @code{20495.59681441799654},
20259 which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
20262 This option is deprecated and ignored.
20265 Specify the transform length in time domain. Use this option to control accuracy
20266 trade-off between time domain and frequency domain at every frequency sample.
20267 It can contain variables:
20269 @item frequency, freq, f
20270 the frequency where it is evaluated
20271 @item timeclamp, tc
20272 the value of @var{timeclamp} option.
20274 Default value is @code{384*tc/(384+tc*f)}.
20277 Specify the transform count for every video frame. Default value is @code{6}.
20278 Acceptable range is @code{[1, 30]}.
20281 Specify the transform count for every single pixel. Default value is @code{0},
20282 which makes it computed automatically. Acceptable range is @code{[0, 10]}.
20285 Specify font file for use with freetype to draw the axis. If not specified,
20286 use embedded font. Note that drawing with font file or embedded font is not
20287 implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
20291 Specify fontconfig pattern. This has lower priority than @var{fontfile}.
20292 The : in the pattern may be replaced by | to avoid unnecessary escaping.
20295 Specify font color expression. This is arithmetic expression that should return
20296 integer value 0xRRGGBB. It can contain variables:
20298 @item frequency, freq, f
20299 the frequency where it is evaluated
20300 @item timeclamp, tc
20301 the value of @var{timeclamp} option
20306 midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
20307 @item r(x), g(x), b(x)
20308 red, green, and blue value of intensity x.
20310 Default value is @code{st(0, (midi(f)-59.5)/12);
20311 st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
20312 r(1-ld(1)) + b(ld(1))}.
20315 Specify image file to draw the axis. This option override @var{fontfile} and
20316 @var{fontcolor} option.
20319 Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
20320 the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
20321 Default value is @code{1}.
20324 Set colorspace. The accepted values are:
20327 Unspecified (default)
20336 BT.470BG or BT.601-6 625
20339 SMPTE-170M or BT.601-6 525
20345 BT.2020 with non-constant luminance
20350 Set spectrogram color scheme. This is list of floating point values with format
20351 @code{left_r|left_g|left_b|right_r|right_g|right_b}.
20352 The default is @code{1|0.5|0|0|0.5|1}.
20356 @subsection Examples
20360 Playing audio while showing the spectrum:
20362 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
20366 Same as above, but with frame rate 30 fps:
20368 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
20372 Playing at 1280x720:
20374 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
20378 Disable sonogram display:
20384 A1 and its harmonics: A1, A2, (near)E3, A3:
20386 ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
20387 asplit[a][out1]; [a] showcqt [out0]'
20391 Same as above, but with more accuracy in frequency domain:
20393 ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
20394 asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
20400 bar_v=10:sono_v=bar_v*a_weighting(f)
20404 Custom gamma, now spectrum is linear to the amplitude.
20410 Custom tlength equation:
20412 tc=0.33:tlength='st(0,0.17); 384*tc / (384 / ld(0) + tc*f /(1-ld(0))) + 384*tc / (tc*f / ld(0) + 384 /(1-ld(0)))'
20416 Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
20418 fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
20422 Custom font using fontconfig:
20424 font='Courier New,Monospace,mono|bold'
20428 Custom frequency range with custom axis using image file:
20430 axisfile=myaxis.png:basefreq=40:endfreq=10000
20436 Convert input audio to video output representing the audio power spectrum.
20437 Audio amplitude is on Y-axis while frequency is on X-axis.
20439 The filter accepts the following options:
20443 Specify size of video. For the syntax of this option, check the
20444 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20445 Default is @code{1024x512}.
20449 This set how each frequency bin will be represented.
20451 It accepts the following values:
20457 Default is @code{bar}.
20460 Set amplitude scale.
20462 It accepts the following values:
20476 Default is @code{log}.
20479 Set frequency scale.
20481 It accepts the following values:
20490 Reverse logarithmic scale.
20492 Default is @code{lin}.
20497 It accepts the following values:
20513 Default is @code{w2048}
20516 Set windowing function.
20518 It accepts the following values:
20540 Default is @code{hanning}.
20543 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
20544 which means optimal overlap for selected window function will be picked.
20547 Set time averaging. Setting this to 0 will display current maximal peaks.
20548 Default is @code{1}, which means time averaging is disabled.
20551 Specify list of colors separated by space or by '|' which will be used to
20552 draw channel frequencies. Unrecognized or missing colors will be replaced
20556 Set channel display mode.
20558 It accepts the following values:
20563 Default is @code{combined}.
20566 Set minimum amplitude used in @code{log} amplitude scaler.
20570 @anchor{showspectrum}
20571 @section showspectrum
20573 Convert input audio to a video output, representing the audio frequency
20576 The filter accepts the following options:
20580 Specify the video size for the output. For the syntax of this option, check the
20581 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20582 Default value is @code{640x512}.
20585 Specify how the spectrum should slide along the window.
20587 It accepts the following values:
20590 the samples start again on the left when they reach the right
20592 the samples scroll from right to left
20594 frames are only produced when the samples reach the right
20596 the samples scroll from left to right
20599 Default value is @code{replace}.
20602 Specify display mode.
20604 It accepts the following values:
20607 all channels are displayed in the same row
20609 all channels are displayed in separate rows
20612 Default value is @samp{combined}.
20615 Specify display color mode.
20617 It accepts the following values:
20620 each channel is displayed in a separate color
20622 each channel is displayed using the same color scheme
20624 each channel is displayed using the rainbow color scheme
20626 each channel is displayed using the moreland color scheme
20628 each channel is displayed using the nebulae color scheme
20630 each channel is displayed using the fire color scheme
20632 each channel is displayed using the fiery color scheme
20634 each channel is displayed using the fruit color scheme
20636 each channel is displayed using the cool color scheme
20638 each channel is displayed using the magma color scheme
20641 Default value is @samp{channel}.
20644 Specify scale used for calculating intensity color values.
20646 It accepts the following values:
20651 square root, default
20662 Default value is @samp{sqrt}.
20665 Set saturation modifier for displayed colors. Negative values provide
20666 alternative color scheme. @code{0} is no saturation at all.
20667 Saturation must be in [-10.0, 10.0] range.
20668 Default value is @code{1}.
20671 Set window function.
20673 It accepts the following values:
20697 Default value is @code{hann}.
20700 Set orientation of time vs frequency axis. Can be @code{vertical} or
20701 @code{horizontal}. Default is @code{vertical}.
20704 Set ratio of overlap window. Default value is @code{0}.
20705 When value is @code{1} overlap is set to recommended size for specific
20706 window function currently used.
20709 Set scale gain for calculating intensity color values.
20710 Default value is @code{1}.
20713 Set which data to display. Can be @code{magnitude}, default or @code{phase}.
20716 Set color rotation, must be in [-1.0, 1.0] range.
20717 Default value is @code{0}.
20720 The usage is very similar to the showwaves filter; see the examples in that
20723 @subsection Examples
20727 Large window with logarithmic color scaling:
20729 showspectrum=s=1280x480:scale=log
20733 Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
20735 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
20736 [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
20740 @section showspectrumpic
20742 Convert input audio to a single video frame, representing the audio frequency
20745 The filter accepts the following options:
20749 Specify the video size for the output. For the syntax of this option, check the
20750 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20751 Default value is @code{4096x2048}.
20754 Specify display mode.
20756 It accepts the following values:
20759 all channels are displayed in the same row
20761 all channels are displayed in separate rows
20763 Default value is @samp{combined}.
20766 Specify display color mode.
20768 It accepts the following values:
20771 each channel is displayed in a separate color
20773 each channel is displayed using the same color scheme
20775 each channel is displayed using the rainbow color scheme
20777 each channel is displayed using the moreland color scheme
20779 each channel is displayed using the nebulae color scheme
20781 each channel is displayed using the fire color scheme
20783 each channel is displayed using the fiery color scheme
20785 each channel is displayed using the fruit color scheme
20787 each channel is displayed using the cool color scheme
20789 each channel is displayed using the magma color scheme
20791 Default value is @samp{intensity}.
20794 Specify scale used for calculating intensity color values.
20796 It accepts the following values:
20801 square root, default
20811 Default value is @samp{log}.
20814 Set saturation modifier for displayed colors. Negative values provide
20815 alternative color scheme. @code{0} is no saturation at all.
20816 Saturation must be in [-10.0, 10.0] range.
20817 Default value is @code{1}.
20820 Set window function.
20822 It accepts the following values:
20845 Default value is @code{hann}.
20848 Set orientation of time vs frequency axis. Can be @code{vertical} or
20849 @code{horizontal}. Default is @code{vertical}.
20852 Set scale gain for calculating intensity color values.
20853 Default value is @code{1}.
20856 Draw time and frequency axes and legends. Default is enabled.
20859 Set color rotation, must be in [-1.0, 1.0] range.
20860 Default value is @code{0}.
20863 @subsection Examples
20867 Extract an audio spectrogram of a whole audio track
20868 in a 1024x1024 picture using @command{ffmpeg}:
20870 ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
20874 @section showvolume
20876 Convert input audio volume to a video output.
20878 The filter accepts the following options:
20885 Set border width, allowed range is [0, 5]. Default is 1.
20888 Set channel width, allowed range is [80, 8192]. Default is 400.
20891 Set channel height, allowed range is [1, 900]. Default is 20.
20894 Set fade, allowed range is [0, 1]. Default is 0.95.
20897 Set volume color expression.
20899 The expression can use the following variables:
20903 Current max volume of channel in dB.
20909 Current channel number, starting from 0.
20913 If set, displays channel names. Default is enabled.
20916 If set, displays volume values. Default is enabled.
20919 Set orientation, can be horizontal: @code{h} or vertical: @code{v},
20920 default is @code{h}.
20923 Set step size, allowed range is [0, 5]. Default is 0, which means
20927 Set background opacity, allowed range is [0, 1]. Default is 0.
20930 Set metering mode, can be peak: @code{p} or rms: @code{r},
20931 default is @code{p}.
20934 Set display scale, can be linear: @code{lin} or log: @code{log},
20935 default is @code{lin}.
20939 If set to > 0., display a line for the max level
20940 in the previous seconds.
20941 default is disabled: @code{0.}
20944 The color of the max line. Use when @code{dm} option is set to > 0.
20945 default is: @code{orange}
20950 Convert input audio to a video output, representing the samples waves.
20952 The filter accepts the following options:
20956 Specify the video size for the output. For the syntax of this option, check the
20957 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20958 Default value is @code{600x240}.
20963 Available values are:
20966 Draw a point for each sample.
20969 Draw a vertical line for each sample.
20972 Draw a point for each sample and a line between them.
20975 Draw a centered vertical line for each sample.
20978 Default value is @code{point}.
20981 Set the number of samples which are printed on the same column. A
20982 larger value will decrease the frame rate. Must be a positive
20983 integer. This option can be set only if the value for @var{rate}
20984 is not explicitly specified.
20987 Set the (approximate) output frame rate. This is done by setting the
20988 option @var{n}. Default value is "25".
20990 @item split_channels
20991 Set if channels should be drawn separately or overlap. Default value is 0.
20994 Set colors separated by '|' which are going to be used for drawing of each channel.
20997 Set amplitude scale.
20999 Available values are:
21017 Set the draw mode. This is mostly useful to set for high @var{n}.
21019 Available values are:
21022 Scale pixel values for each drawn sample.
21025 Draw every sample directly.
21028 Default value is @code{scale}.
21031 @subsection Examples
21035 Output the input file audio and the corresponding video representation
21038 amovie=a.mp3,asplit[out0],showwaves[out1]
21042 Create a synthetic signal and show it with showwaves, forcing a
21043 frame rate of 30 frames per second:
21045 aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
21049 @section showwavespic
21051 Convert input audio to a single video frame, representing the samples waves.
21053 The filter accepts the following options:
21057 Specify the video size for the output. For the syntax of this option, check the
21058 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
21059 Default value is @code{600x240}.
21061 @item split_channels
21062 Set if channels should be drawn separately or overlap. Default value is 0.
21065 Set colors separated by '|' which are going to be used for drawing of each channel.
21068 Set amplitude scale.
21070 Available values are:
21088 @subsection Examples
21092 Extract a channel split representation of the wave form of a whole audio track
21093 in a 1024x800 picture using @command{ffmpeg}:
21095 ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
21099 @section sidedata, asidedata
21101 Delete frame side data, or select frames based on it.
21103 This filter accepts the following options:
21107 Set mode of operation of the filter.
21109 Can be one of the following:
21113 Select every frame with side data of @code{type}.
21116 Delete side data of @code{type}. If @code{type} is not set, delete all side
21122 Set side data type used with all modes. Must be set for @code{select} mode. For
21123 the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
21124 in @file{libavutil/frame.h}. For example, to choose
21125 @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
21129 @section spectrumsynth
21131 Sythesize audio from 2 input video spectrums, first input stream represents
21132 magnitude across time and second represents phase across time.
21133 The filter will transform from frequency domain as displayed in videos back
21134 to time domain as presented in audio output.
21136 This filter is primarily created for reversing processed @ref{showspectrum}
21137 filter outputs, but can synthesize sound from other spectrograms too.
21138 But in such case results are going to be poor if the phase data is not
21139 available, because in such cases phase data need to be recreated, usually
21140 its just recreated from random noise.
21141 For best results use gray only output (@code{channel} color mode in
21142 @ref{showspectrum} filter) and @code{log} scale for magnitude video and
21143 @code{lin} scale for phase video. To produce phase, for 2nd video, use
21144 @code{data} option. Inputs videos should generally use @code{fullframe}
21145 slide mode as that saves resources needed for decoding video.
21147 The filter accepts the following options:
21151 Specify sample rate of output audio, the sample rate of audio from which
21152 spectrum was generated may differ.
21155 Set number of channels represented in input video spectrums.
21158 Set scale which was used when generating magnitude input spectrum.
21159 Can be @code{lin} or @code{log}. Default is @code{log}.
21162 Set slide which was used when generating inputs spectrums.
21163 Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
21164 Default is @code{fullframe}.
21167 Set window function used for resynthesis.
21170 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
21171 which means optimal overlap for selected window function will be picked.
21174 Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
21175 Default is @code{vertical}.
21178 @subsection Examples
21182 First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
21183 then resynthesize videos back to audio with spectrumsynth:
21185 ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
21186 ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
21187 ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
21191 @section split, asplit
21193 Split input into several identical outputs.
21195 @code{asplit} works with audio input, @code{split} with video.
21197 The filter accepts a single parameter which specifies the number of outputs. If
21198 unspecified, it defaults to 2.
21200 @subsection Examples
21204 Create two separate outputs from the same input:
21206 [in] split [out0][out1]
21210 To create 3 or more outputs, you need to specify the number of
21213 [in] asplit=3 [out0][out1][out2]
21217 Create two separate outputs from the same input, one cropped and
21220 [in] split [splitout1][splitout2];
21221 [splitout1] crop=100:100:0:0 [cropout];
21222 [splitout2] pad=200:200:100:100 [padout];
21226 Create 5 copies of the input audio with @command{ffmpeg}:
21228 ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
21234 Receive commands sent through a libzmq client, and forward them to
21235 filters in the filtergraph.
21237 @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
21238 must be inserted between two video filters, @code{azmq} between two
21239 audio filters. Both are capable to send messages to any filter type.
21241 To enable these filters you need to install the libzmq library and
21242 headers and configure FFmpeg with @code{--enable-libzmq}.
21244 For more information about libzmq see:
21245 @url{http://www.zeromq.org/}
21247 The @code{zmq} and @code{azmq} filters work as a libzmq server, which
21248 receives messages sent through a network interface defined by the
21249 @option{bind_address} (or the abbreviation "@option{b}") option.
21250 Default value of this option is @file{tcp://localhost:5555}. You may
21251 want to alter this value to your needs, but do not forget to escape any
21252 ':' signs (see @ref{filtergraph escaping}).
21254 The received message must be in the form:
21256 @var{TARGET} @var{COMMAND} [@var{ARG}]
21259 @var{TARGET} specifies the target of the command, usually the name of
21260 the filter class or a specific filter instance name. The default
21261 filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
21262 but you can override this by using the @samp{filter_name@@id} syntax
21263 (see @ref{Filtergraph syntax}).
21265 @var{COMMAND} specifies the name of the command for the target filter.
21267 @var{ARG} is optional and specifies the optional argument list for the
21268 given @var{COMMAND}.
21270 Upon reception, the message is processed and the corresponding command
21271 is injected into the filtergraph. Depending on the result, the filter
21272 will send a reply to the client, adopting the format:
21274 @var{ERROR_CODE} @var{ERROR_REASON}
21278 @var{MESSAGE} is optional.
21280 @subsection Examples
21282 Look at @file{tools/zmqsend} for an example of a zmq client which can
21283 be used to send commands processed by these filters.
21285 Consider the following filtergraph generated by @command{ffplay}.
21286 In this example the last overlay filter has an instance name. All other
21287 filters will have default instance names.
21290 ffplay -dumpgraph 1 -f lavfi "
21291 color=s=100x100:c=red [l];
21292 color=s=100x100:c=blue [r];
21293 nullsrc=s=200x100, zmq [bg];
21294 [bg][l] overlay [bg+l];
21295 [bg+l][r] overlay@@my=x=100 "
21298 To change the color of the left side of the video, the following
21299 command can be used:
21301 echo Parsed_color_0 c yellow | tools/zmqsend
21304 To change the right side:
21306 echo Parsed_color_1 c pink | tools/zmqsend
21309 To change the position of the right side:
21311 echo overlay@@my x 150 | tools/zmqsend
21315 @c man end MULTIMEDIA FILTERS
21317 @chapter Multimedia Sources
21318 @c man begin MULTIMEDIA SOURCES
21320 Below is a description of the currently available multimedia sources.
21324 This is the same as @ref{movie} source, except it selects an audio
21330 Read audio and/or video stream(s) from a movie container.
21332 It accepts the following parameters:
21336 The name of the resource to read (not necessarily a file; it can also be a
21337 device or a stream accessed through some protocol).
21339 @item format_name, f
21340 Specifies the format assumed for the movie to read, and can be either
21341 the name of a container or an input device. If not specified, the
21342 format is guessed from @var{movie_name} or by probing.
21344 @item seek_point, sp
21345 Specifies the seek point in seconds. The frames will be output
21346 starting from this seek point. The parameter is evaluated with
21347 @code{av_strtod}, so the numerical value may be suffixed by an IS
21348 postfix. The default value is "0".
21351 Specifies the streams to read. Several streams can be specified,
21352 separated by "+". The source will then have as many outputs, in the
21353 same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
21354 section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
21355 respectively the default (best suited) video and audio stream. Default
21356 is "dv", or "da" if the filter is called as "amovie".
21358 @item stream_index, si
21359 Specifies the index of the video stream to read. If the value is -1,
21360 the most suitable video stream will be automatically selected. The default
21361 value is "-1". Deprecated. If the filter is called "amovie", it will select
21362 audio instead of video.
21365 Specifies how many times to read the stream in sequence.
21366 If the value is 0, the stream will be looped infinitely.
21367 Default value is "1".
21369 Note that when the movie is looped the source timestamps are not
21370 changed, so it will generate non monotonically increasing timestamps.
21372 @item discontinuity
21373 Specifies the time difference between frames above which the point is
21374 considered a timestamp discontinuity which is removed by adjusting the later
21378 It allows overlaying a second video on top of the main input of
21379 a filtergraph, as shown in this graph:
21381 input -----------> deltapts0 --> overlay --> output
21384 movie --> scale--> deltapts1 -------+
21386 @subsection Examples
21390 Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
21391 on top of the input labelled "in":
21393 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
21394 [in] setpts=PTS-STARTPTS [main];
21395 [main][over] overlay=16:16 [out]
21399 Read from a video4linux2 device, and overlay it on top of the input
21402 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
21403 [in] setpts=PTS-STARTPTS [main];
21404 [main][over] overlay=16:16 [out]
21408 Read the first video stream and the audio stream with id 0x81 from
21409 dvd.vob; the video is connected to the pad named "video" and the audio is
21410 connected to the pad named "audio":
21412 movie=dvd.vob:s=v:0+#0x81 [video] [audio]
21416 @subsection Commands
21418 Both movie and amovie support the following commands:
21421 Perform seek using "av_seek_frame".
21422 The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
21425 @var{stream_index}: If stream_index is -1, a default
21426 stream is selected, and @var{timestamp} is automatically converted
21427 from AV_TIME_BASE units to the stream specific time_base.
21429 @var{timestamp}: Timestamp in AVStream.time_base units
21430 or, if no stream is specified, in AV_TIME_BASE units.
21432 @var{flags}: Flags which select direction and seeking mode.
21436 Get movie duration in AV_TIME_BASE units.
21440 @c man end MULTIMEDIA SOURCES