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.
686 If you want instead to delay in seconds, append 's' to number.
693 Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
694 the second channel (and any other channels that may be present) unchanged.
700 Delay second channel by 500 samples, the third channel by 700 samples and leave
701 the first channel (and any other channels that may be present) unchanged.
707 @section aderivative, aintegral
709 Compute derivative/integral of audio stream.
711 Applying both filters one after another produces original audio.
715 Apply echoing to the input audio.
717 Echoes are reflected sound and can occur naturally amongst mountains
718 (and sometimes large buildings) when talking or shouting; digital echo
719 effects emulate this behaviour and are often used to help fill out the
720 sound of a single instrument or vocal. The time difference between the
721 original signal and the reflection is the @code{delay}, and the
722 loudness of the reflected signal is the @code{decay}.
723 Multiple echoes can have different delays and decays.
725 A description of the accepted parameters follows.
729 Set input gain of reflected signal. Default is @code{0.6}.
732 Set output gain of reflected signal. Default is @code{0.3}.
735 Set list of time intervals in milliseconds between original signal and reflections
736 separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
737 Default is @code{1000}.
740 Set list of loudness of reflected signals separated by '|'.
741 Allowed range for each @code{decay} is @code{(0 - 1.0]}.
742 Default is @code{0.5}.
749 Make it sound as if there are twice as many instruments as are actually playing:
751 aecho=0.8:0.88:60:0.4
755 If delay is very short, then it sound like a (metallic) robot playing music:
761 A longer delay will sound like an open air concert in the mountains:
763 aecho=0.8:0.9:1000:0.3
767 Same as above but with one more mountain:
769 aecho=0.8:0.9:1000|1800:0.3|0.25
774 Audio emphasis filter creates or restores material directly taken from LPs or
775 emphased CDs with different filter curves. E.g. to store music on vinyl the
776 signal has to be altered by a filter first to even out the disadvantages of
777 this recording medium.
778 Once the material is played back the inverse filter has to be applied to
779 restore the distortion of the frequency response.
781 The filter accepts the following options:
791 Set filter mode. For restoring material use @code{reproduction} mode, otherwise
792 use @code{production} mode. Default is @code{reproduction} mode.
795 Set filter type. Selects medium. Can be one of the following:
807 select Compact Disc (CD).
813 select 50µs (FM-KF).
815 select 75µs (FM-KF).
821 Modify an audio signal according to the specified expressions.
823 This filter accepts one or more expressions (one for each channel),
824 which are evaluated and used to modify a corresponding audio signal.
826 It accepts the following parameters:
830 Set the '|'-separated expressions list for each separate channel. If
831 the number of input channels is greater than the number of
832 expressions, the last specified expression is used for the remaining
835 @item channel_layout, c
836 Set output channel layout. If not specified, the channel layout is
837 specified by the number of expressions. If set to @samp{same}, it will
838 use by default the same input channel layout.
841 Each expression in @var{exprs} can contain the following constants and functions:
845 channel number of the current expression
848 number of the evaluated sample, starting from 0
854 time of the evaluated sample expressed in seconds
857 @item nb_out_channels
858 input and output number of channels
861 the value of input channel with number @var{CH}
864 Note: this filter is slow. For faster processing you should use a
873 aeval=val(ch)/2:c=same
877 Invert phase of the second channel:
886 Apply fade-in/out effect to input audio.
888 A description of the accepted parameters follows.
892 Specify the effect type, can be either @code{in} for fade-in, or
893 @code{out} for a fade-out effect. Default is @code{in}.
895 @item start_sample, ss
896 Specify the number of the start sample for starting to apply the fade
897 effect. Default is 0.
900 Specify the number of samples for which the fade effect has to last. At
901 the end of the fade-in effect the output audio will have the same
902 volume as the input audio, at the end of the fade-out transition
903 the output audio will be silence. Default is 44100.
906 Specify the start time of the fade effect. Default is 0.
907 The value must be specified as a time duration; see
908 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
909 for the accepted syntax.
910 If set this option is used instead of @var{start_sample}.
913 Specify the duration of the fade effect. See
914 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
915 for the accepted syntax.
916 At the end of the fade-in effect the output audio will have the same
917 volume as the input audio, at the end of the fade-out transition
918 the output audio will be silence.
919 By default the duration is determined by @var{nb_samples}.
920 If set this option is used instead of @var{nb_samples}.
923 Set curve for fade transition.
925 It accepts the following values:
928 select triangular, linear slope (default)
930 select quarter of sine wave
932 select half of sine wave
934 select exponential sine wave
938 select inverted parabola
952 select inverted quarter of sine wave
954 select inverted half of sine wave
956 select double-exponential seat
958 select double-exponential sigmoid
960 select logistic sigmoid
968 Fade in first 15 seconds of audio:
974 Fade out last 25 seconds of a 900 seconds audio:
976 afade=t=out:st=875:d=25
981 Denoise audio samples with FFT.
983 A description of the accepted parameters follows.
987 Set the noise reduction in dB, allowed range is 0.01 to 97.
988 Default value is 12 dB.
991 Set the noise floor in dB, allowed range is -80 to -20.
992 Default value is -50 dB.
997 It accepts the following values:
1006 Select shellac noise.
1009 Select custom noise, defined in @code{bn} option.
1011 Default value is white noise.
1015 Set custom band noise for every one of 15 bands.
1016 Bands are separated by ' ' or '|'.
1019 Set the residual floor in dB, allowed range is -80 to -20.
1020 Default value is -38 dB.
1023 Enable noise tracking. By default is disabled.
1024 With this enabled, noise floor is automatically adjusted.
1027 Enable residual tracking. By default is disabled.
1030 Set the output mode.
1032 It accepts the following values:
1035 Pass input unchanged.
1038 Pass noise filtered out.
1043 Default value is @var{o}.
1047 @subsection Commands
1049 This filter supports the following commands:
1051 @item sample_noise, sn
1052 Start or stop measuring noise profile.
1053 Syntax for the command is : "start" or "stop" string.
1054 After measuring noise profile is stopped it will be
1055 automatically applied in filtering.
1057 @item noise_reduction, nr
1058 Change noise reduction. Argument is single float number.
1059 Syntax for the command is : "@var{noise_reduction}"
1061 @item noise_floor, nf
1062 Change noise floor. Argument is single float number.
1063 Syntax for the command is : "@var{noise_floor}"
1065 @item output_mode, om
1066 Change output mode operation.
1067 Syntax for the command is : "i", "o" or "n" string.
1071 Apply arbitrary expressions to samples in frequency domain.
1075 Set frequency domain real expression for each separate channel separated
1076 by '|'. Default is "re".
1077 If the number of input channels is greater than the number of
1078 expressions, the last specified expression is used for the remaining
1082 Set frequency domain imaginary expression for each separate channel
1083 separated by '|'. Default is "im".
1085 Each expression in @var{real} and @var{imag} can contain the following
1086 constants and functions:
1093 current frequency bin number
1096 number of available bins
1099 channel number of the current expression
1108 current real part of frequency bin of current channel
1111 current imaginary part of frequency bin of current channel
1114 Return the value of real part of frequency bin at location (@var{bin},@var{channel})
1117 Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
1123 It accepts the following values:
1139 Default is @code{w4096}
1142 Set window function. Default is @code{hann}.
1145 Set window overlap. If set to 1, the recommended overlap for selected
1146 window function will be picked. Default is @code{0.75}.
1149 @subsection Examples
1153 Leave almost only low frequencies in audio:
1155 afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
1162 Apply an arbitrary Frequency Impulse Response filter.
1164 This filter is designed for applying long FIR filters,
1165 up to 60 seconds long.
1167 It can be used as component for digital crossover filters,
1168 room equalization, cross talk cancellation, wavefield synthesis,
1169 auralization, ambiophonics, ambisonics and spatialization.
1171 This filter uses second stream as FIR coefficients.
1172 If second stream holds single channel, it will be used
1173 for all input channels in first stream, otherwise
1174 number of channels in second stream must be same as
1175 number of channels in first stream.
1177 It accepts the following parameters:
1181 Set dry gain. This sets input gain.
1184 Set wet gain. This sets final output gain.
1187 Set Impulse Response filter length. Default is 1, which means whole IR is processed.
1190 Enable applying gain measured from power of IR.
1192 Set which approach to use for auto gain measurement.
1196 Do not apply any gain.
1199 select peak gain, very conservative approach. This is default value.
1202 select DC gain, limited application.
1205 select gain to noise approach, this is most popular one.
1209 Set gain to be applied to IR coefficients before filtering.
1210 Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
1213 Set format of IR stream. Can be @code{mono} or @code{input}.
1214 Default is @code{input}.
1217 Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
1218 Allowed range is 0.1 to 60 seconds.
1221 Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.
1222 By default it is disabled.
1225 Set for which IR channel to display frequency response. By default is first channel
1226 displayed. This option is used only when @var{response} is enabled.
1229 Set video stream size. This option is used only when @var{response} is enabled.
1232 Set video stream frame rate. This option is used only when @var{response} is enabled.
1235 Set minimal partition size used for convolution. Default is @var{8192}.
1236 Allowed range is from @var{8} to @var{32768}.
1237 Lower values decreases latency at cost of higher CPU usage.
1240 Set maximal partition size used for convolution. Default is @var{8192}.
1241 Allowed range is from @var{8} to @var{32768}.
1242 Lower values may increase CPU usage.
1245 @subsection Examples
1249 Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
1251 ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
1258 Set output format constraints for the input audio. The framework will
1259 negotiate the most appropriate format to minimize conversions.
1261 It accepts the following parameters:
1265 A '|'-separated list of requested sample formats.
1268 A '|'-separated list of requested sample rates.
1270 @item channel_layouts
1271 A '|'-separated list of requested channel layouts.
1273 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
1274 for the required syntax.
1277 If a parameter is omitted, all values are allowed.
1279 Force the output to either unsigned 8-bit or signed 16-bit stereo
1281 aformat=sample_fmts=u8|s16:channel_layouts=stereo
1286 A gate is mainly used to reduce lower parts of a signal. This kind of signal
1287 processing reduces disturbing noise between useful signals.
1289 Gating is done by detecting the volume below a chosen level @var{threshold}
1290 and dividing it by the factor set with @var{ratio}. The bottom of the noise
1291 floor is set via @var{range}. Because an exact manipulation of the signal
1292 would cause distortion of the waveform the reduction can be levelled over
1293 time. This is done by setting @var{attack} and @var{release}.
1295 @var{attack} determines how long the signal has to fall below the threshold
1296 before any reduction will occur and @var{release} sets the time the signal
1297 has to rise above the threshold to reduce the reduction again.
1298 Shorter signals than the chosen attack time will be left untouched.
1302 Set input level before filtering.
1303 Default is 1. Allowed range is from 0.015625 to 64.
1306 Set the level of gain reduction when the signal is below the threshold.
1307 Default is 0.06125. Allowed range is from 0 to 1.
1310 If a signal rises above this level the gain reduction is released.
1311 Default is 0.125. Allowed range is from 0 to 1.
1314 Set a ratio by which the signal is reduced.
1315 Default is 2. Allowed range is from 1 to 9000.
1318 Amount of milliseconds the signal has to rise above the threshold before gain
1320 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
1323 Amount of milliseconds the signal has to fall below the threshold before the
1324 reduction is increased again. Default is 250 milliseconds.
1325 Allowed range is from 0.01 to 9000.
1328 Set amount of amplification of signal after processing.
1329 Default is 1. Allowed range is from 1 to 64.
1332 Curve the sharp knee around the threshold to enter gain reduction more softly.
1333 Default is 2.828427125. Allowed range is from 1 to 8.
1336 Choose if exact signal should be taken for detection or an RMS like one.
1337 Default is @code{rms}. Can be @code{peak} or @code{rms}.
1340 Choose if the average level between all channels or the louder channel affects
1342 Default is @code{average}. Can be @code{average} or @code{maximum}.
1347 Apply an arbitrary Infinite Impulse Response filter.
1349 It accepts the following parameters:
1353 Set numerator/zeros coefficients.
1356 Set denominator/poles coefficients.
1368 Set coefficients format.
1374 Z-plane zeros/poles, cartesian (default)
1376 Z-plane zeros/poles, polar radians
1378 Z-plane zeros/poles, polar degrees
1382 Set kind of processing.
1383 Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
1386 Set filtering precision.
1390 double-precision floating-point (default)
1392 single-precision floating-point
1400 Show IR frequency reponse, magnitude and phase in additional video stream.
1401 By default it is disabled.
1404 Set for which IR channel to display frequency response. By default is first channel
1405 displayed. This option is used only when @var{response} is enabled.
1408 Set video stream size. This option is used only when @var{response} is enabled.
1411 Coefficients in @code{tf} format are separated by spaces and are in ascending
1414 Coefficients in @code{zp} format are separated by spaces and order of coefficients
1415 doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
1418 Different coefficients and gains can be provided for every channel, in such case
1419 use '|' to separate coefficients or gains. Last provided coefficients will be
1420 used for all remaining channels.
1422 @subsection Examples
1426 Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
1428 aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
1432 Same as above but in @code{zp} format:
1434 aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
1440 The limiter prevents an input signal from rising over a desired threshold.
1441 This limiter uses lookahead technology to prevent your signal from distorting.
1442 It means that there is a small delay after the signal is processed. Keep in mind
1443 that the delay it produces is the attack time you set.
1445 The filter accepts the following options:
1449 Set input gain. Default is 1.
1452 Set output gain. Default is 1.
1455 Don't let signals above this level pass the limiter. Default is 1.
1458 The limiter will reach its attenuation level in this amount of time in
1459 milliseconds. Default is 5 milliseconds.
1462 Come back from limiting to attenuation 1.0 in this amount of milliseconds.
1463 Default is 50 milliseconds.
1466 When gain reduction is always needed ASC takes care of releasing to an
1467 average reduction level rather than reaching a reduction of 0 in the release
1471 Select how much the release time is affected by ASC, 0 means nearly no changes
1472 in release time while 1 produces higher release times.
1475 Auto level output signal. Default is enabled.
1476 This normalizes audio back to 0dB if enabled.
1479 Depending on picked setting it is recommended to upsample input 2x or 4x times
1480 with @ref{aresample} before applying this filter.
1484 Apply a two-pole all-pass filter with central frequency (in Hz)
1485 @var{frequency}, and filter-width @var{width}.
1486 An all-pass filter changes the audio's frequency to phase relationship
1487 without changing its frequency to amplitude relationship.
1489 The filter accepts the following options:
1493 Set frequency in Hz.
1496 Set method to specify band-width of filter.
1511 Specify the band-width of a filter in width_type units.
1514 Specify which channels to filter, by default all available are filtered.
1517 @subsection Commands
1519 This filter supports the following commands:
1522 Change allpass frequency.
1523 Syntax for the command is : "@var{frequency}"
1526 Change allpass width_type.
1527 Syntax for the command is : "@var{width_type}"
1530 Change allpass width.
1531 Syntax for the command is : "@var{width}"
1538 The filter accepts the following options:
1542 Set the number of loops. Setting this value to -1 will result in infinite loops.
1546 Set maximal number of samples. Default is 0.
1549 Set first sample of loop. Default is 0.
1555 Merge two or more audio streams into a single multi-channel stream.
1557 The filter accepts the following options:
1562 Set the number of inputs. Default is 2.
1566 If the channel layouts of the inputs are disjoint, and therefore compatible,
1567 the channel layout of the output will be set accordingly and the channels
1568 will be reordered as necessary. If the channel layouts of the inputs are not
1569 disjoint, the output will have all the channels of the first input then all
1570 the channels of the second input, in that order, and the channel layout of
1571 the output will be the default value corresponding to the total number of
1574 For example, if the first input is in 2.1 (FL+FR+LF) and the second input
1575 is FC+BL+BR, then the output will be in 5.1, with the channels in the
1576 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
1577 first input, b1 is the first channel of the second input).
1579 On the other hand, if both input are in stereo, the output channels will be
1580 in the default order: a1, a2, b1, b2, and the channel layout will be
1581 arbitrarily set to 4.0, which may or may not be the expected value.
1583 All inputs must have the same sample rate, and format.
1585 If inputs do not have the same duration, the output will stop with the
1588 @subsection Examples
1592 Merge two mono files into a stereo stream:
1594 amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
1598 Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
1600 ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
1606 Mixes multiple audio inputs into a single output.
1608 Note that this filter only supports float samples (the @var{amerge}
1609 and @var{pan} audio filters support many formats). If the @var{amix}
1610 input has integer samples then @ref{aresample} will be automatically
1611 inserted to perform the conversion to float samples.
1615 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
1617 will mix 3 input audio streams to a single output with the same duration as the
1618 first input and a dropout transition time of 3 seconds.
1620 It accepts the following parameters:
1624 The number of inputs. If unspecified, it defaults to 2.
1627 How to determine the end-of-stream.
1631 The duration of the longest input. (default)
1634 The duration of the shortest input.
1637 The duration of the first input.
1641 @item dropout_transition
1642 The transition time, in seconds, for volume renormalization when an input
1643 stream ends. The default value is 2 seconds.
1646 Specify weight of each input audio stream as sequence.
1647 Each weight is separated by space. By default all inputs have same weight.
1652 Multiply first audio stream with second audio stream and store result
1653 in output audio stream. Multiplication is done by multiplying each
1654 sample from first stream with sample at same position from second stream.
1656 With this element-wise multiplication one can create amplitude fades and
1657 amplitude modulations.
1659 @section anequalizer
1661 High-order parametric multiband equalizer for each channel.
1663 It accepts the following parameters:
1667 This option string is in format:
1668 "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
1669 Each equalizer band is separated by '|'.
1673 Set channel number to which equalization will be applied.
1674 If input doesn't have that channel the entry is ignored.
1677 Set central frequency for band.
1678 If input doesn't have that frequency the entry is ignored.
1681 Set band width in hertz.
1684 Set band gain in dB.
1687 Set filter type for band, optional, can be:
1691 Butterworth, this is default.
1702 With this option activated frequency response of anequalizer is displayed
1706 Set video stream size. Only useful if curves option is activated.
1709 Set max gain that will be displayed. Only useful if curves option is activated.
1710 Setting this to a reasonable value makes it possible to display gain which is derived from
1711 neighbour bands which are too close to each other and thus produce higher gain
1712 when both are activated.
1715 Set frequency scale used to draw frequency response in video output.
1716 Can be linear or logarithmic. Default is logarithmic.
1719 Set color for each channel curve which is going to be displayed in video stream.
1720 This is list of color names separated by space or by '|'.
1721 Unrecognised or missing colors will be replaced by white color.
1724 @subsection Examples
1728 Lower gain by 10 of central frequency 200Hz and width 100 Hz
1729 for first 2 channels using Chebyshev type 1 filter:
1731 anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
1735 @subsection Commands
1737 This filter supports the following commands:
1740 Alter existing filter parameters.
1741 Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
1743 @var{fN} is existing filter number, starting from 0, if no such filter is available
1745 @var{freq} set new frequency parameter.
1746 @var{width} set new width parameter in herz.
1747 @var{gain} set new gain parameter in dB.
1749 Full filter invocation with asendcmd may look like this:
1750 asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
1755 Reduce broadband noise in audio samples using Non-Local Means algorithm.
1757 Each sample is adjusted by looking for other samples with similar contexts. This
1758 context similarity is defined by comparing their surrounding patches of size
1759 @option{p}. Patches are searched in an area of @option{r} around the sample.
1761 The filter accepts the following options.
1765 Set denoising strength. Allowed range is from 1 to 9999. Default value is 1.
1768 Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
1769 Default value is 2 milliseconds.
1772 Set research radius duration. Allowed range is from 2 to 300 milliseconds.
1773 Default value is 6 milliseconds.
1778 Pass the audio source unchanged to the output.
1782 Pad the end of an audio stream with silence.
1784 This can be used together with @command{ffmpeg} @option{-shortest} to
1785 extend audio streams to the same length as the video stream.
1787 A description of the accepted options follows.
1791 Set silence packet size. Default value is 4096.
1794 Set the number of samples of silence to add to the end. After the
1795 value is reached, the stream is terminated. This option is mutually
1796 exclusive with @option{whole_len}.
1799 Set the minimum total number of samples in the output audio stream. If
1800 the value is longer than the input audio length, silence is added to
1801 the end, until the value is reached. This option is mutually exclusive
1802 with @option{pad_len}.
1805 Specify the duration of samples of silence to add. See
1806 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
1807 for the accepted syntax. Used only if set to non-zero value.
1810 Specify the minimum total duration in the output audio stream. See
1811 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
1812 for the accepted syntax. Used only if set to non-zero value. If the value is longer than
1813 the input audio length, silence is added to the end, until the value is reached.
1814 This option is mutually exclusive with @option{pad_dur}
1817 If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
1818 nor @option{whole_dur} option is set, the filter will add silence to the end of
1819 the input stream indefinitely.
1821 @subsection Examples
1825 Add 1024 samples of silence to the end of the input:
1831 Make sure the audio output will contain at least 10000 samples, pad
1832 the input with silence if required:
1834 apad=whole_len=10000
1838 Use @command{ffmpeg} to pad the audio input with silence, so that the
1839 video stream will always result the shortest and will be converted
1840 until the end in the output file when using the @option{shortest}
1843 ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
1848 Add a phasing effect to the input audio.
1850 A phaser filter creates series of peaks and troughs in the frequency spectrum.
1851 The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
1853 A description of the accepted parameters follows.
1857 Set input gain. Default is 0.4.
1860 Set output gain. Default is 0.74
1863 Set delay in milliseconds. Default is 3.0.
1866 Set decay. Default is 0.4.
1869 Set modulation speed in Hz. Default is 0.5.
1872 Set modulation type. Default is triangular.
1874 It accepts the following values:
1883 Audio pulsator is something between an autopanner and a tremolo.
1884 But it can produce funny stereo effects as well. Pulsator changes the volume
1885 of the left and right channel based on a LFO (low frequency oscillator) with
1886 different waveforms and shifted phases.
1887 This filter have the ability to define an offset between left and right
1888 channel. An offset of 0 means that both LFO shapes match each other.
1889 The left and right channel are altered equally - a conventional tremolo.
1890 An offset of 50% means that the shape of the right channel is exactly shifted
1891 in phase (or moved backwards about half of the frequency) - pulsator acts as
1892 an autopanner. At 1 both curves match again. Every setting in between moves the
1893 phase shift gapless between all stages and produces some "bypassing" sounds with
1894 sine and triangle waveforms. The more you set the offset near 1 (starting from
1895 the 0.5) the faster the signal passes from the left to the right speaker.
1897 The filter accepts the following options:
1901 Set input gain. By default it is 1. Range is [0.015625 - 64].
1904 Set output gain. By default it is 1. Range is [0.015625 - 64].
1907 Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
1908 sawup or sawdown. Default is sine.
1911 Set modulation. Define how much of original signal is affected by the LFO.
1914 Set left channel offset. Default is 0. Allowed range is [0 - 1].
1917 Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
1920 Set pulse width. Default is 1. Allowed range is [0 - 2].
1923 Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
1926 Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
1930 Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
1934 Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
1935 if timing is set to hz.
1941 Resample the input audio to the specified parameters, using the
1942 libswresample library. If none are specified then the filter will
1943 automatically convert between its input and output.
1945 This filter is also able to stretch/squeeze the audio data to make it match
1946 the timestamps or to inject silence / cut out audio to make it match the
1947 timestamps, do a combination of both or do neither.
1949 The filter accepts the syntax
1950 [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
1951 expresses a sample rate and @var{resampler_options} is a list of
1952 @var{key}=@var{value} pairs, separated by ":". See the
1953 @ref{Resampler Options,,"Resampler Options" section in the
1954 ffmpeg-resampler(1) manual,ffmpeg-resampler}
1955 for the complete list of supported options.
1957 @subsection Examples
1961 Resample the input audio to 44100Hz:
1967 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
1968 samples per second compensation:
1970 aresample=async=1000
1976 Reverse an audio clip.
1978 Warning: This filter requires memory to buffer the entire clip, so trimming
1981 @subsection Examples
1985 Take the first 5 seconds of a clip, and reverse it.
1987 atrim=end=5,areverse
1991 @section asetnsamples
1993 Set the number of samples per each output audio frame.
1995 The last output packet may contain a different number of samples, as
1996 the filter will flush all the remaining samples when the input audio
1999 The filter accepts the following options:
2003 @item nb_out_samples, n
2004 Set the number of frames per each output audio frame. The number is
2005 intended as the number of samples @emph{per each channel}.
2006 Default value is 1024.
2009 If set to 1, the filter will pad the last audio frame with zeroes, so
2010 that the last frame will contain the same number of samples as the
2011 previous ones. Default value is 1.
2014 For example, to set the number of per-frame samples to 1234 and
2015 disable padding for the last frame, use:
2017 asetnsamples=n=1234:p=0
2022 Set the sample rate without altering the PCM data.
2023 This will result in a change of speed and pitch.
2025 The filter accepts the following options:
2028 @item sample_rate, r
2029 Set the output sample rate. Default is 44100 Hz.
2034 Show a line containing various information for each input audio frame.
2035 The input audio is not modified.
2037 The shown line contains a sequence of key/value pairs of the form
2038 @var{key}:@var{value}.
2040 The following values are shown in the output:
2044 The (sequential) number of the input frame, starting from 0.
2047 The presentation timestamp of the input frame, in time base units; the time base
2048 depends on the filter input pad, and is usually 1/@var{sample_rate}.
2051 The presentation timestamp of the input frame in seconds.
2054 position of the frame in the input stream, -1 if this information in
2055 unavailable and/or meaningless (for example in case of synthetic audio)
2064 The sample rate for the audio frame.
2067 The number of samples (per channel) in the frame.
2070 The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
2071 audio, the data is treated as if all the planes were concatenated.
2073 @item plane_checksums
2074 A list of Adler-32 checksums for each data plane.
2080 Display time domain statistical information about the audio channels.
2081 Statistics are calculated and displayed for each audio channel and,
2082 where applicable, an overall figure is also given.
2084 It accepts the following option:
2087 Short window length in seconds, used for peak and trough RMS measurement.
2088 Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
2092 Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
2093 where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
2096 Available keys for each channel are:
2132 For example full key look like this @code{lavfi.astats.1.DC_offset} or
2133 this @code{lavfi.astats.Overall.Peak_count}.
2135 For description what each key means read below.
2138 Set number of frame after which stats are going to be recalculated.
2139 Default is disabled.
2142 A description of each shown parameter follows:
2146 Mean amplitude displacement from zero.
2149 Minimal sample level.
2152 Maximal sample level.
2154 @item Min difference
2155 Minimal difference between two consecutive samples.
2157 @item Max difference
2158 Maximal difference between two consecutive samples.
2160 @item Mean difference
2161 Mean difference between two consecutive samples.
2162 The average of each difference between two consecutive samples.
2164 @item RMS difference
2165 Root Mean Square difference between two consecutive samples.
2169 Standard peak and RMS level measured in dBFS.
2173 Peak and trough values for RMS level measured over a short window.
2176 Standard ratio of peak to RMS level (note: not in dB).
2179 Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
2180 (i.e. either @var{Min level} or @var{Max level}).
2183 Number of occasions (not the number of samples) that the signal attained either
2184 @var{Min level} or @var{Max level}.
2187 Overall bit depth of audio. Number of bits used for each sample.
2190 Measured dynamic range of audio in dB.
2192 @item Zero crossings
2193 Number of points where the waveform crosses the zero level axis.
2195 @item Zero crossings rate
2196 Rate of Zero crossings and number of audio samples.
2203 The filter accepts exactly one parameter, the audio tempo. If not
2204 specified then the filter will assume nominal 1.0 tempo. Tempo must
2205 be in the [0.5, 100.0] range.
2207 Note that tempo greater than 2 will skip some samples rather than
2208 blend them in. If for any reason this is a concern it is always
2209 possible to daisy-chain several instances of atempo to achieve the
2210 desired product tempo.
2212 @subsection Examples
2216 Slow down audio to 80% tempo:
2222 To speed up audio to 300% tempo:
2228 To speed up audio to 300% tempo by daisy-chaining two atempo instances:
2230 atempo=sqrt(3),atempo=sqrt(3)
2236 Trim the input so that the output contains one continuous subpart of the input.
2238 It accepts the following parameters:
2241 Timestamp (in seconds) of the start of the section to keep. I.e. the audio
2242 sample with the timestamp @var{start} will be the first sample in the output.
2245 Specify time of the first audio sample that will be dropped, i.e. the
2246 audio sample immediately preceding the one with the timestamp @var{end} will be
2247 the last sample in the output.
2250 Same as @var{start}, except this option sets the start timestamp in samples
2254 Same as @var{end}, except this option sets the end timestamp in samples instead
2258 The maximum duration of the output in seconds.
2261 The number of the first sample that should be output.
2264 The number of the first sample that should be dropped.
2267 @option{start}, @option{end}, and @option{duration} are expressed as time
2268 duration specifications; see
2269 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
2271 Note that the first two sets of the start/end options and the @option{duration}
2272 option look at the frame timestamp, while the _sample options simply count the
2273 samples that pass through the filter. So start/end_pts and start/end_sample will
2274 give different results when the timestamps are wrong, inexact or do not start at
2275 zero. Also note that this filter does not modify the timestamps. If you wish
2276 to have the output timestamps start at zero, insert the asetpts filter after the
2279 If multiple start or end options are set, this filter tries to be greedy and
2280 keep all samples that match at least one of the specified constraints. To keep
2281 only the part that matches all the constraints at once, chain multiple atrim
2284 The defaults are such that all the input is kept. So it is possible to set e.g.
2285 just the end values to keep everything before the specified time.
2290 Drop everything except the second minute of input:
2292 ffmpeg -i INPUT -af atrim=60:120
2296 Keep only the first 1000 samples:
2298 ffmpeg -i INPUT -af atrim=end_sample=1000
2305 Apply a two-pole Butterworth band-pass filter with central
2306 frequency @var{frequency}, and (3dB-point) band-width width.
2307 The @var{csg} option selects a constant skirt gain (peak gain = Q)
2308 instead of the default: constant 0dB peak gain.
2309 The filter roll off at 6dB per octave (20dB per decade).
2311 The filter accepts the following options:
2315 Set the filter's central frequency. Default is @code{3000}.
2318 Constant skirt gain if set to 1. Defaults to 0.
2321 Set method to specify band-width of filter.
2336 Specify the band-width of a filter in width_type units.
2339 Specify which channels to filter, by default all available are filtered.
2342 @subsection Commands
2344 This filter supports the following commands:
2347 Change bandpass frequency.
2348 Syntax for the command is : "@var{frequency}"
2351 Change bandpass width_type.
2352 Syntax for the command is : "@var{width_type}"
2355 Change bandpass width.
2356 Syntax for the command is : "@var{width}"
2361 Apply a two-pole Butterworth band-reject filter with central
2362 frequency @var{frequency}, and (3dB-point) band-width @var{width}.
2363 The filter roll off at 6dB per octave (20dB per decade).
2365 The filter accepts the following options:
2369 Set the filter's central frequency. Default is @code{3000}.
2372 Set method to specify band-width of filter.
2387 Specify the band-width of a filter in width_type units.
2390 Specify which channels to filter, by default all available are filtered.
2393 @subsection Commands
2395 This filter supports the following commands:
2398 Change bandreject frequency.
2399 Syntax for the command is : "@var{frequency}"
2402 Change bandreject width_type.
2403 Syntax for the command is : "@var{width_type}"
2406 Change bandreject width.
2407 Syntax for the command is : "@var{width}"
2410 @section bass, lowshelf
2412 Boost or cut the bass (lower) frequencies of the audio using a two-pole
2413 shelving filter with a response similar to that of a standard
2414 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
2416 The filter accepts the following options:
2420 Give the gain at 0 Hz. Its useful range is about -20
2421 (for a large cut) to +20 (for a large boost).
2422 Beware of clipping when using a positive gain.
2425 Set the filter's central frequency and so can be used
2426 to extend or reduce the frequency range to be boosted or cut.
2427 The default value is @code{100} Hz.
2430 Set method to specify band-width of filter.
2445 Determine how steep is the filter's shelf transition.
2448 Specify which channels to filter, by default all available are filtered.
2451 @subsection Commands
2453 This filter supports the following commands:
2456 Change bass frequency.
2457 Syntax for the command is : "@var{frequency}"
2460 Change bass width_type.
2461 Syntax for the command is : "@var{width_type}"
2465 Syntax for the command is : "@var{width}"
2469 Syntax for the command is : "@var{gain}"
2474 Apply a biquad IIR filter with the given coefficients.
2475 Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
2476 are the numerator and denominator coefficients respectively.
2477 and @var{channels}, @var{c} specify which channels to filter, by default all
2478 available are filtered.
2480 @subsection Commands
2482 This filter supports the following commands:
2490 Change biquad parameter.
2491 Syntax for the command is : "@var{value}"
2495 Bauer stereo to binaural transformation, which improves headphone listening of
2496 stereo audio records.
2498 To enable compilation of this filter you need to configure FFmpeg with
2499 @code{--enable-libbs2b}.
2501 It accepts the following parameters:
2505 Pre-defined crossfeed level.
2509 Default level (fcut=700, feed=50).
2512 Chu Moy circuit (fcut=700, feed=60).
2515 Jan Meier circuit (fcut=650, feed=95).
2520 Cut frequency (in Hz).
2529 Remap input channels to new locations.
2531 It accepts the following parameters:
2534 Map channels from input to output. The argument is a '|'-separated list of
2535 mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
2536 @var{in_channel} form. @var{in_channel} can be either the name of the input
2537 channel (e.g. FL for front left) or its index in the input channel layout.
2538 @var{out_channel} is the name of the output channel or its index in the output
2539 channel layout. If @var{out_channel} is not given then it is implicitly an
2540 index, starting with zero and increasing by one for each mapping.
2542 @item channel_layout
2543 The channel layout of the output stream.
2546 If no mapping is present, the filter will implicitly map input channels to
2547 output channels, preserving indices.
2549 @subsection Examples
2553 For example, assuming a 5.1+downmix input MOV file,
2555 ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
2557 will create an output WAV file tagged as stereo from the downmix channels of
2561 To fix a 5.1 WAV improperly encoded in AAC's native channel order
2563 ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
2567 @section channelsplit
2569 Split each channel from an input audio stream into a separate output stream.
2571 It accepts the following parameters:
2573 @item channel_layout
2574 The channel layout of the input stream. The default is "stereo".
2576 A channel layout describing the channels to be extracted as separate output streams
2577 or "all" to extract each input channel as a separate stream. The default is "all".
2579 Choosing channels not present in channel layout in the input will result in an error.
2582 @subsection Examples
2586 For example, assuming a stereo input MP3 file,
2588 ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
2590 will create an output Matroska file with two audio streams, one containing only
2591 the left channel and the other the right channel.
2594 Split a 5.1 WAV file into per-channel files:
2596 ffmpeg -i in.wav -filter_complex
2597 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
2598 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
2599 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
2604 Extract only LFE from a 5.1 WAV file:
2606 ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
2607 -map '[LFE]' lfe.wav
2612 Add a chorus effect to the audio.
2614 Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
2616 Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
2617 constant, with chorus, it is varied using using sinusoidal or triangular modulation.
2618 The modulation depth defines the range the modulated delay is played before or after
2619 the delay. Hence the delayed sound will sound slower or faster, that is the delayed
2620 sound tuned around the original one, like in a chorus where some vocals are slightly
2623 It accepts the following parameters:
2626 Set input gain. Default is 0.4.
2629 Set output gain. Default is 0.4.
2632 Set delays. A typical delay is around 40ms to 60ms.
2644 @subsection Examples
2650 chorus=0.7:0.9:55:0.4:0.25:2
2656 chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
2660 Fuller sounding chorus with three delays:
2662 chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
2667 Compress or expand the audio's dynamic range.
2669 It accepts the following parameters:
2675 A list of times in seconds for each channel over which the instantaneous level
2676 of the input signal is averaged to determine its volume. @var{attacks} refers to
2677 increase of volume and @var{decays} refers to decrease of volume. For most
2678 situations, the attack time (response to the audio getting louder) should be
2679 shorter than the decay time, because the human ear is more sensitive to sudden
2680 loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
2681 a typical value for decay is 0.8 seconds.
2682 If specified number of attacks & decays is lower than number of channels, the last
2683 set attack/decay will be used for all remaining channels.
2686 A list of points for the transfer function, specified in dB relative to the
2687 maximum possible signal amplitude. Each key points list must be defined using
2688 the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
2689 @code{x0/y0 x1/y1 x2/y2 ....}
2691 The input values must be in strictly increasing order but the transfer function
2692 does not have to be monotonically rising. The point @code{0/0} is assumed but
2693 may be overridden (by @code{0/out-dBn}). Typical values for the transfer
2694 function are @code{-70/-70|-60/-20|1/0}.
2697 Set the curve radius in dB for all joints. It defaults to 0.01.
2700 Set the additional gain in dB to be applied at all points on the transfer
2701 function. This allows for easy adjustment of the overall gain.
2705 Set an initial volume, in dB, to be assumed for each channel when filtering
2706 starts. This permits the user to supply a nominal level initially, so that, for
2707 example, a very large gain is not applied to initial signal levels before the
2708 companding has begun to operate. A typical value for audio which is initially
2709 quiet is -90 dB. It defaults to 0.
2712 Set a delay, in seconds. The input audio is analyzed immediately, but audio is
2713 delayed before being fed to the volume adjuster. Specifying a delay
2714 approximately equal to the attack/decay times allows the filter to effectively
2715 operate in predictive rather than reactive mode. It defaults to 0.
2719 @subsection Examples
2723 Make music with both quiet and loud passages suitable for listening to in a
2726 compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
2729 Another example for audio with whisper and explosion parts:
2731 compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
2735 A noise gate for when the noise is at a lower level than the signal:
2737 compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
2741 Here is another noise gate, this time for when the noise is at a higher level
2742 than the signal (making it, in some ways, similar to squelch):
2744 compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
2748 2:1 compression starting at -6dB:
2750 compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
2754 2:1 compression starting at -9dB:
2756 compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
2760 2:1 compression starting at -12dB:
2762 compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
2766 2:1 compression starting at -18dB:
2768 compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
2772 3:1 compression starting at -15dB:
2774 compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
2780 compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
2786 compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
2790 Hard limiter at -6dB:
2792 compand=attacks=0:points=-80/-80|-6/-6|20/-6
2796 Hard limiter at -12dB:
2798 compand=attacks=0:points=-80/-80|-12/-12|20/-12
2802 Hard noise gate at -35 dB:
2804 compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
2810 compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
2814 @section compensationdelay
2816 Compensation Delay Line is a metric based delay to compensate differing
2817 positions of microphones or speakers.
2819 For example, you have recorded guitar with two microphones placed in
2820 different location. Because the front of sound wave has fixed speed in
2821 normal conditions, the phasing of microphones can vary and depends on
2822 their location and interposition. The best sound mix can be achieved when
2823 these microphones are in phase (synchronized). Note that distance of
2824 ~30 cm between microphones makes one microphone to capture signal in
2825 antiphase to another microphone. That makes the final mix sounding moody.
2826 This filter helps to solve phasing problems by adding different delays
2827 to each microphone track and make them synchronized.
2829 The best result can be reached when you take one track as base and
2830 synchronize other tracks one by one with it.
2831 Remember that synchronization/delay tolerance depends on sample rate, too.
2832 Higher sample rates will give more tolerance.
2834 It accepts the following parameters:
2838 Set millimeters distance. This is compensation distance for fine tuning.
2842 Set cm distance. This is compensation distance for tightening distance setup.
2846 Set meters distance. This is compensation distance for hard distance setup.
2850 Set dry amount. Amount of unprocessed (dry) signal.
2854 Set wet amount. Amount of processed (wet) signal.
2858 Set temperature degree in Celsius. This is the temperature of the environment.
2863 Apply headphone crossfeed filter.
2865 Crossfeed is the process of blending the left and right channels of stereo
2867 It is mainly used to reduce extreme stereo separation of low frequencies.
2869 The intent is to produce more speaker like sound to the listener.
2871 The filter accepts the following options:
2875 Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
2876 This sets gain of low shelf filter for side part of stereo image.
2877 Default is -6dB. Max allowed is -30db when strength is set to 1.
2880 Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
2881 This sets cut off frequency of low shelf filter. Default is cut off near
2882 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
2885 Set input gain. Default is 0.9.
2888 Set output gain. Default is 1.
2891 @section crystalizer
2892 Simple algorithm to expand audio dynamic range.
2894 The filter accepts the following options:
2898 Sets the intensity of effect (default: 2.0). Must be in range between 0.0
2899 (unchanged sound) to 10.0 (maximum effect).
2902 Enable clipping. By default is enabled.
2906 Apply a DC shift to the audio.
2908 This can be useful to remove a DC offset (caused perhaps by a hardware problem
2909 in the recording chain) from the audio. The effect of a DC offset is reduced
2910 headroom and hence volume. The @ref{astats} filter can be used to determine if
2911 a signal has a DC offset.
2915 Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
2919 Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
2920 used to prevent clipping.
2924 Measure audio dynamic range.
2926 DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
2927 is found in transition material. And anything less that 8 have very poor dynamics
2928 and is very compressed.
2930 The filter accepts the following options:
2934 Set window length in seconds used to split audio into segments of equal length.
2935 Default is 3 seconds.
2939 Dynamic Audio Normalizer.
2941 This filter applies a certain amount of gain to the input audio in order
2942 to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
2943 contrast to more "simple" normalization algorithms, the Dynamic Audio
2944 Normalizer *dynamically* re-adjusts the gain factor to the input audio.
2945 This allows for applying extra gain to the "quiet" sections of the audio
2946 while avoiding distortions or clipping the "loud" sections. In other words:
2947 The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
2948 sections, in the sense that the volume of each section is brought to the
2949 same target level. Note, however, that the Dynamic Audio Normalizer achieves
2950 this goal *without* applying "dynamic range compressing". It will retain 100%
2951 of the dynamic range *within* each section of the audio file.
2955 Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
2956 Default is 500 milliseconds.
2957 The Dynamic Audio Normalizer processes the input audio in small chunks,
2958 referred to as frames. This is required, because a peak magnitude has no
2959 meaning for just a single sample value. Instead, we need to determine the
2960 peak magnitude for a contiguous sequence of sample values. While a "standard"
2961 normalizer would simply use the peak magnitude of the complete file, the
2962 Dynamic Audio Normalizer determines the peak magnitude individually for each
2963 frame. The length of a frame is specified in milliseconds. By default, the
2964 Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
2965 been found to give good results with most files.
2966 Note that the exact frame length, in number of samples, will be determined
2967 automatically, based on the sampling rate of the individual input audio file.
2970 Set the Gaussian filter window size. In range from 3 to 301, must be odd
2971 number. Default is 31.
2972 Probably the most important parameter of the Dynamic Audio Normalizer is the
2973 @code{window size} of the Gaussian smoothing filter. The filter's window size
2974 is specified in frames, centered around the current frame. For the sake of
2975 simplicity, this must be an odd number. Consequently, the default value of 31
2976 takes into account the current frame, as well as the 15 preceding frames and
2977 the 15 subsequent frames. Using a larger window results in a stronger
2978 smoothing effect and thus in less gain variation, i.e. slower gain
2979 adaptation. Conversely, using a smaller window results in a weaker smoothing
2980 effect and thus in more gain variation, i.e. faster gain adaptation.
2981 In other words, the more you increase this value, the more the Dynamic Audio
2982 Normalizer will behave like a "traditional" normalization filter. On the
2983 contrary, the more you decrease this value, the more the Dynamic Audio
2984 Normalizer will behave like a dynamic range compressor.
2987 Set the target peak value. This specifies the highest permissible magnitude
2988 level for the normalized audio input. This filter will try to approach the
2989 target peak magnitude as closely as possible, but at the same time it also
2990 makes sure that the normalized signal will never exceed the peak magnitude.
2991 A frame's maximum local gain factor is imposed directly by the target peak
2992 magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
2993 It is not recommended to go above this value.
2996 Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
2997 The Dynamic Audio Normalizer determines the maximum possible (local) gain
2998 factor for each input frame, i.e. the maximum gain factor that does not
2999 result in clipping or distortion. The maximum gain factor is determined by
3000 the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
3001 additionally bounds the frame's maximum gain factor by a predetermined
3002 (global) maximum gain factor. This is done in order to avoid excessive gain
3003 factors in "silent" or almost silent frames. By default, the maximum gain
3004 factor is 10.0, For most inputs the default value should be sufficient and
3005 it usually is not recommended to increase this value. Though, for input
3006 with an extremely low overall volume level, it may be necessary to allow even
3007 higher gain factors. Note, however, that the Dynamic Audio Normalizer does
3008 not simply apply a "hard" threshold (i.e. cut off values above the threshold).
3009 Instead, a "sigmoid" threshold function will be applied. This way, the
3010 gain factors will smoothly approach the threshold value, but never exceed that
3014 Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
3015 By default, the Dynamic Audio Normalizer performs "peak" normalization.
3016 This means that the maximum local gain factor for each frame is defined
3017 (only) by the frame's highest magnitude sample. This way, the samples can
3018 be amplified as much as possible without exceeding the maximum signal
3019 level, i.e. without clipping. Optionally, however, the Dynamic Audio
3020 Normalizer can also take into account the frame's root mean square,
3021 abbreviated RMS. In electrical engineering, the RMS is commonly used to
3022 determine the power of a time-varying signal. It is therefore considered
3023 that the RMS is a better approximation of the "perceived loudness" than
3024 just looking at the signal's peak magnitude. Consequently, by adjusting all
3025 frames to a constant RMS value, a uniform "perceived loudness" can be
3026 established. If a target RMS value has been specified, a frame's local gain
3027 factor is defined as the factor that would result in exactly that RMS value.
3028 Note, however, that the maximum local gain factor is still restricted by the
3029 frame's highest magnitude sample, in order to prevent clipping.
3032 Enable channels coupling. By default is enabled.
3033 By default, the Dynamic Audio Normalizer will amplify all channels by the same
3034 amount. This means the same gain factor will be applied to all channels, i.e.
3035 the maximum possible gain factor is determined by the "loudest" channel.
3036 However, in some recordings, it may happen that the volume of the different
3037 channels is uneven, e.g. one channel may be "quieter" than the other one(s).
3038 In this case, this option can be used to disable the channel coupling. This way,
3039 the gain factor will be determined independently for each channel, depending
3040 only on the individual channel's highest magnitude sample. This allows for
3041 harmonizing the volume of the different channels.
3044 Enable DC bias correction. By default is disabled.
3045 An audio signal (in the time domain) is a sequence of sample values.
3046 In the Dynamic Audio Normalizer these sample values are represented in the
3047 -1.0 to 1.0 range, regardless of the original input format. Normally, the
3048 audio signal, or "waveform", should be centered around the zero point.
3049 That means if we calculate the mean value of all samples in a file, or in a
3050 single frame, then the result should be 0.0 or at least very close to that
3051 value. If, however, there is a significant deviation of the mean value from
3052 0.0, in either positive or negative direction, this is referred to as a
3053 DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
3054 Audio Normalizer provides optional DC bias correction.
3055 With DC bias correction enabled, the Dynamic Audio Normalizer will determine
3056 the mean value, or "DC correction" offset, of each input frame and subtract
3057 that value from all of the frame's sample values which ensures those samples
3058 are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
3059 boundaries, the DC correction offset values will be interpolated smoothly
3060 between neighbouring frames.
3063 Enable alternative boundary mode. By default is disabled.
3064 The Dynamic Audio Normalizer takes into account a certain neighbourhood
3065 around each frame. This includes the preceding frames as well as the
3066 subsequent frames. However, for the "boundary" frames, located at the very
3067 beginning and at the very end of the audio file, not all neighbouring
3068 frames are available. In particular, for the first few frames in the audio
3069 file, the preceding frames are not known. And, similarly, for the last few
3070 frames in the audio file, the subsequent frames are not known. Thus, the
3071 question arises which gain factors should be assumed for the missing frames
3072 in the "boundary" region. The Dynamic Audio Normalizer implements two modes
3073 to deal with this situation. The default boundary mode assumes a gain factor
3074 of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
3075 "fade out" at the beginning and at the end of the input, respectively.
3078 Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
3079 By default, the Dynamic Audio Normalizer does not apply "traditional"
3080 compression. This means that signal peaks will not be pruned and thus the
3081 full dynamic range will be retained within each local neighbourhood. However,
3082 in some cases it may be desirable to combine the Dynamic Audio Normalizer's
3083 normalization algorithm with a more "traditional" compression.
3084 For this purpose, the Dynamic Audio Normalizer provides an optional compression
3085 (thresholding) function. If (and only if) the compression feature is enabled,
3086 all input frames will be processed by a soft knee thresholding function prior
3087 to the actual normalization process. Put simply, the thresholding function is
3088 going to prune all samples whose magnitude exceeds a certain threshold value.
3089 However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
3090 value. Instead, the threshold value will be adjusted for each individual
3092 In general, smaller parameters result in stronger compression, and vice versa.
3093 Values below 3.0 are not recommended, because audible distortion may appear.
3098 Make audio easier to listen to on headphones.
3100 This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
3101 so that when listened to on headphones the stereo image is moved from
3102 inside your head (standard for headphones) to outside and in front of
3103 the listener (standard for speakers).
3109 Apply a two-pole peaking equalisation (EQ) filter. With this
3110 filter, the signal-level at and around a selected frequency can
3111 be increased or decreased, whilst (unlike bandpass and bandreject
3112 filters) that at all other frequencies is unchanged.
3114 In order to produce complex equalisation curves, this filter can
3115 be given several times, each with a different central frequency.
3117 The filter accepts the following options:
3121 Set the filter's central frequency in Hz.
3124 Set method to specify band-width of filter.
3139 Specify the band-width of a filter in width_type units.
3142 Set the required gain or attenuation in dB.
3143 Beware of clipping when using a positive gain.
3146 Specify which channels to filter, by default all available are filtered.
3149 @subsection Examples
3152 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
3154 equalizer=f=1000:t=h:width=200:g=-10
3158 Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
3160 equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
3164 @subsection Commands
3166 This filter supports the following commands:
3169 Change equalizer frequency.
3170 Syntax for the command is : "@var{frequency}"
3173 Change equalizer width_type.
3174 Syntax for the command is : "@var{width_type}"
3177 Change equalizer width.
3178 Syntax for the command is : "@var{width}"
3181 Change equalizer gain.
3182 Syntax for the command is : "@var{gain}"
3185 @section extrastereo
3187 Linearly increases the difference between left and right channels which
3188 adds some sort of "live" effect to playback.
3190 The filter accepts the following options:
3194 Sets the difference coefficient (default: 2.5). 0.0 means mono sound
3195 (average of both channels), with 1.0 sound will be unchanged, with
3196 -1.0 left and right channels will be swapped.
3199 Enable clipping. By default is enabled.
3202 @section firequalizer
3203 Apply FIR Equalization using arbitrary frequency response.
3205 The filter accepts the following option:
3209 Set gain curve equation (in dB). The expression can contain variables:
3212 the evaluated frequency
3216 channel number, set to 0 when multichannels evaluation is disabled
3218 channel id, see libavutil/channel_layout.h, set to the first channel id when
3219 multichannels evaluation is disabled
3223 channel_layout, see libavutil/channel_layout.h
3228 @item gain_interpolate(f)
3229 interpolate gain on frequency f based on gain_entry
3230 @item cubic_interpolate(f)
3231 same as gain_interpolate, but smoother
3233 This option is also available as command. Default is @code{gain_interpolate(f)}.
3236 Set gain entry for gain_interpolate function. The expression can
3240 store gain entry at frequency f with value g
3242 This option is also available as command.
3245 Set filter delay in seconds. Higher value means more accurate.
3246 Default is @code{0.01}.
3249 Set filter accuracy in Hz. Lower value means more accurate.
3250 Default is @code{5}.
3253 Set window function. Acceptable values are:
3256 rectangular window, useful when gain curve is already smooth
3258 hann window (default)
3264 3-terms continuous 1st derivative nuttall window
3266 minimum 3-terms discontinuous nuttall window
3268 4-terms continuous 1st derivative nuttall window
3270 minimum 4-terms discontinuous nuttall (blackman-nuttall) window
3272 blackman-harris window
3278 If enabled, use fixed number of audio samples. This improves speed when
3279 filtering with large delay. Default is disabled.
3282 Enable multichannels evaluation on gain. Default is disabled.
3285 Enable zero phase mode by subtracting timestamp to compensate delay.
3286 Default is disabled.
3289 Set scale used by gain. Acceptable values are:
3292 linear frequency, linear gain
3294 linear frequency, logarithmic (in dB) gain (default)
3296 logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
3298 logarithmic frequency, logarithmic gain
3302 Set file for dumping, suitable for gnuplot.
3305 Set scale for dumpfile. Acceptable values are same with scale option.
3309 Enable 2-channel convolution using complex FFT. This improves speed significantly.
3310 Default is disabled.
3313 Enable minimum phase impulse response. Default is disabled.
3316 @subsection Examples
3321 firequalizer=gain='if(lt(f,1000), 0, -INF)'
3324 lowpass at 1000 Hz with gain_entry:
3326 firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
3329 custom equalization:
3331 firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
3334 higher delay with zero phase to compensate delay:
3336 firequalizer=delay=0.1:fixed=on:zero_phase=on
3339 lowpass on left channel, highpass on right channel:
3341 firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
3342 :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
3347 Apply a flanging effect to the audio.
3349 The filter accepts the following options:
3353 Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
3356 Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
3359 Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
3363 Set percentage of delayed signal mixed with original. Range from 0 to 100.
3364 Default value is 71.
3367 Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
3370 Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
3371 Default value is @var{sinusoidal}.
3374 Set swept wave percentage-shift for multi channel. Range from 0 to 100.
3375 Default value is 25.
3378 Set delay-line interpolation, @var{linear} or @var{quadratic}.
3379 Default is @var{linear}.
3383 Apply Haas effect to audio.
3385 Note that this makes most sense to apply on mono signals.
3386 With this filter applied to mono signals it give some directionality and
3387 stretches its stereo image.
3389 The filter accepts the following options:
3393 Set input level. By default is @var{1}, or 0dB
3396 Set output level. By default is @var{1}, or 0dB.
3399 Set gain applied to side part of signal. By default is @var{1}.
3402 Set kind of middle source. Can be one of the following:
3412 Pick middle part signal of stereo image.
3415 Pick side part signal of stereo image.
3419 Change middle phase. By default is disabled.
3422 Set left channel delay. By default is @var{2.05} milliseconds.
3425 Set left channel balance. By default is @var{-1}.
3428 Set left channel gain. By default is @var{1}.
3431 Change left phase. By default is disabled.
3434 Set right channel delay. By defaults is @var{2.12} milliseconds.
3437 Set right channel balance. By default is @var{1}.
3440 Set right channel gain. By default is @var{1}.
3443 Change right phase. By default is enabled.
3448 Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
3449 embedded HDCD codes is expanded into a 20-bit PCM stream.
3451 The filter supports the Peak Extend and Low-level Gain Adjustment features
3452 of HDCD, and detects the Transient Filter flag.
3455 ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
3458 When using the filter with wav, note the default encoding for wav is 16-bit,
3459 so the resulting 20-bit stream will be truncated back to 16-bit. Use something
3460 like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
3462 ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
3463 ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
3466 The filter accepts the following options:
3469 @item disable_autoconvert
3470 Disable any automatic format conversion or resampling in the filter graph.
3472 @item process_stereo
3473 Process the stereo channels together. If target_gain does not match between
3474 channels, consider it invalid and use the last valid target_gain.
3477 Set the code detect timer period in ms.
3480 Always extend peaks above -3dBFS even if PE isn't signaled.
3483 Replace audio with a solid tone and adjust the amplitude to signal some
3484 specific aspect of the decoding process. The output file can be loaded in
3485 an audio editor alongside the original to aid analysis.
3487 @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
3494 Gain adjustment level at each sample
3496 Samples where peak extend occurs
3498 Samples where the code detect timer is active
3500 Samples where the target gain does not match between channels
3506 Apply head-related transfer functions (HRTFs) to create virtual
3507 loudspeakers around the user for binaural listening via headphones.
3508 The HRIRs are provided via additional streams, for each channel
3509 one stereo input stream is needed.
3511 The filter accepts the following options:
3515 Set mapping of input streams for convolution.
3516 The argument is a '|'-separated list of channel names in order as they
3517 are given as additional stream inputs for filter.
3518 This also specify number of input streams. Number of input streams
3519 must be not less than number of channels in first stream plus one.
3522 Set gain applied to audio. Value is in dB. Default is 0.
3525 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
3526 processing audio in time domain which is slow.
3527 @var{freq} is processing audio in frequency domain which is fast.
3528 Default is @var{freq}.
3531 Set custom gain for LFE channels. Value is in dB. Default is 0.
3534 Set size of frame in number of samples which will be processed at once.
3535 Default value is @var{1024}. Allowed range is from 1024 to 96000.
3538 Set format of hrir stream.
3539 Default value is @var{stereo}. Alternative value is @var{multich}.
3540 If value is set to @var{stereo}, number of additional streams should
3541 be greater or equal to number of input channels in first input stream.
3542 Also each additional stream should have stereo number of channels.
3543 If value is set to @var{multich}, number of additional streams should
3544 be exactly one. Also number of input channels of additional stream
3545 should be equal or greater than twice number of channels of first input
3549 @subsection Examples
3553 Full example using wav files as coefficients with amovie filters for 7.1 downmix,
3554 each amovie filter use stereo file with IR coefficients as input.
3555 The files give coefficients for each position of virtual loudspeaker:
3557 ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
3562 Full example using wav files as coefficients with amovie filters for 7.1 downmix,
3563 but now in @var{multich} @var{hrir} format.
3565 ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
3572 Apply a high-pass filter with 3dB point frequency.
3573 The filter can be either single-pole, or double-pole (the default).
3574 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
3576 The filter accepts the following options:
3580 Set frequency in Hz. Default is 3000.
3583 Set number of poles. Default is 2.
3586 Set method to specify band-width of filter.
3601 Specify the band-width of a filter in width_type units.
3602 Applies only to double-pole filter.
3603 The default is 0.707q and gives a Butterworth response.
3606 Specify which channels to filter, by default all available are filtered.
3609 @subsection Commands
3611 This filter supports the following commands:
3614 Change highpass frequency.
3615 Syntax for the command is : "@var{frequency}"
3618 Change highpass width_type.
3619 Syntax for the command is : "@var{width_type}"
3622 Change highpass width.
3623 Syntax for the command is : "@var{width}"
3628 Join multiple input streams into one multi-channel stream.
3630 It accepts the following parameters:
3634 The number of input streams. It defaults to 2.
3636 @item channel_layout
3637 The desired output channel layout. It defaults to stereo.
3640 Map channels from inputs to output. The argument is a '|'-separated list of
3641 mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
3642 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
3643 can be either the name of the input channel (e.g. FL for front left) or its
3644 index in the specified input stream. @var{out_channel} is the name of the output
3648 The filter will attempt to guess the mappings when they are not specified
3649 explicitly. It does so by first trying to find an unused matching input channel
3650 and if that fails it picks the first unused input channel.
3652 Join 3 inputs (with properly set channel layouts):
3654 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
3657 Build a 5.1 output from 6 single-channel streams:
3659 ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
3660 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
3666 Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
3668 To enable compilation of this filter you need to configure FFmpeg with
3669 @code{--enable-ladspa}.
3673 Specifies the name of LADSPA plugin library to load. If the environment
3674 variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
3675 each one of the directories specified by the colon separated list in
3676 @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
3677 this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
3678 @file{/usr/lib/ladspa/}.
3681 Specifies the plugin within the library. Some libraries contain only
3682 one plugin, but others contain many of them. If this is not set filter
3683 will list all available plugins within the specified library.
3686 Set the '|' separated list of controls which are zero or more floating point
3687 values that determine the behavior of the loaded plugin (for example delay,
3689 Controls need to be defined using the following syntax:
3690 c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
3691 @var{valuei} is the value set on the @var{i}-th control.
3692 Alternatively they can be also defined using the following syntax:
3693 @var{value0}|@var{value1}|@var{value2}|..., where
3694 @var{valuei} is the value set on the @var{i}-th control.
3695 If @option{controls} is set to @code{help}, all available controls and
3696 their valid ranges are printed.
3698 @item sample_rate, s
3699 Specify the sample rate, default to 44100. Only used if plugin have
3703 Set the number of samples per channel per each output frame, default
3704 is 1024. Only used if plugin have zero inputs.
3707 Set the minimum duration of the sourced audio. See
3708 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3709 for the accepted syntax.
3710 Note that the resulting duration may be greater than the specified duration,
3711 as the generated audio is always cut at the end of a complete frame.
3712 If not specified, or the expressed duration is negative, the audio is
3713 supposed to be generated forever.
3714 Only used if plugin have zero inputs.
3718 @subsection Examples
3722 List all available plugins within amp (LADSPA example plugin) library:
3728 List all available controls and their valid ranges for @code{vcf_notch}
3729 plugin from @code{VCF} library:
3731 ladspa=f=vcf:p=vcf_notch:c=help
3735 Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
3738 ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
3742 Add reverberation to the audio using TAP-plugins
3743 (Tom's Audio Processing plugins):
3745 ladspa=file=tap_reverb:tap_reverb
3749 Generate white noise, with 0.2 amplitude:
3751 ladspa=file=cmt:noise_source_white:c=c0=.2
3755 Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
3756 @code{C* Audio Plugin Suite} (CAPS) library:
3758 ladspa=file=caps:Click:c=c1=20'
3762 Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
3764 ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
3768 Increase volume by 20dB using fast lookahead limiter from Steve Harris
3769 @code{SWH Plugins} collection:
3771 ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
3775 Attenuate low frequencies using Multiband EQ from Steve Harris
3776 @code{SWH Plugins} collection:
3778 ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
3782 Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
3785 ladspa=caps:Narrower
3789 Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
3791 ladspa=caps:White:.2
3795 Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
3797 ladspa=caps:Fractal:c=c1=1
3801 Dynamic volume normalization using @code{VLevel} plugin:
3803 ladspa=vlevel-ladspa:vlevel_mono
3807 @subsection Commands
3809 This filter supports the following commands:
3812 Modify the @var{N}-th control value.
3814 If the specified value is not valid, it is ignored and prior one is kept.
3819 EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
3820 Support for both single pass (livestreams, files) and double pass (files) modes.
3821 This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
3822 the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
3823 Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
3825 The filter accepts the following options:
3829 Set integrated loudness target.
3830 Range is -70.0 - -5.0. Default value is -24.0.
3833 Set loudness range target.
3834 Range is 1.0 - 20.0. Default value is 7.0.
3837 Set maximum true peak.
3838 Range is -9.0 - +0.0. Default value is -2.0.
3840 @item measured_I, measured_i
3841 Measured IL of input file.
3842 Range is -99.0 - +0.0.
3844 @item measured_LRA, measured_lra
3845 Measured LRA of input file.
3846 Range is 0.0 - 99.0.
3848 @item measured_TP, measured_tp
3849 Measured true peak of input file.
3850 Range is -99.0 - +99.0.
3852 @item measured_thresh
3853 Measured threshold of input file.
3854 Range is -99.0 - +0.0.
3857 Set offset gain. Gain is applied before the true-peak limiter.
3858 Range is -99.0 - +99.0. Default is +0.0.
3861 Normalize linearly if possible.
3862 measured_I, measured_LRA, measured_TP, and measured_thresh must also
3863 to be specified in order to use this mode.
3864 Options are true or false. Default is true.
3867 Treat mono input files as "dual-mono". If a mono file is intended for playback
3868 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
3869 If set to @code{true}, this option will compensate for this effect.
3870 Multi-channel input files are not affected by this option.
3871 Options are true or false. Default is false.
3874 Set print format for stats. Options are summary, json, or none.
3875 Default value is none.
3880 Apply a low-pass filter with 3dB point frequency.
3881 The filter can be either single-pole or double-pole (the default).
3882 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
3884 The filter accepts the following options:
3888 Set frequency in Hz. Default is 500.
3891 Set number of poles. Default is 2.
3894 Set method to specify band-width of filter.
3909 Specify the band-width of a filter in width_type units.
3910 Applies only to double-pole filter.
3911 The default is 0.707q and gives a Butterworth response.
3914 Specify which channels to filter, by default all available are filtered.
3917 @subsection Examples
3920 Lowpass only LFE channel, it LFE is not present it does nothing:
3926 @subsection Commands
3928 This filter supports the following commands:
3931 Change lowpass frequency.
3932 Syntax for the command is : "@var{frequency}"
3935 Change lowpass width_type.
3936 Syntax for the command is : "@var{width_type}"
3939 Change lowpass width.
3940 Syntax for the command is : "@var{width}"
3945 Load a LV2 (LADSPA Version 2) plugin.
3947 To enable compilation of this filter you need to configure FFmpeg with
3948 @code{--enable-lv2}.
3952 Specifies the plugin URI. You may need to escape ':'.
3955 Set the '|' separated list of controls which are zero or more floating point
3956 values that determine the behavior of the loaded plugin (for example delay,
3958 If @option{controls} is set to @code{help}, all available controls and
3959 their valid ranges are printed.
3961 @item sample_rate, s
3962 Specify the sample rate, default to 44100. Only used if plugin have
3966 Set the number of samples per channel per each output frame, default
3967 is 1024. Only used if plugin have zero inputs.
3970 Set the minimum duration of the sourced audio. See
3971 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3972 for the accepted syntax.
3973 Note that the resulting duration may be greater than the specified duration,
3974 as the generated audio is always cut at the end of a complete frame.
3975 If not specified, or the expressed duration is negative, the audio is
3976 supposed to be generated forever.
3977 Only used if plugin have zero inputs.
3980 @subsection Examples
3984 Apply bass enhancer plugin from Calf:
3986 lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
3990 Apply vinyl plugin from Calf:
3992 lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
3996 Apply bit crusher plugin from ArtyFX:
3998 lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
4003 Multiband Compress or expand the audio's dynamic range.
4005 The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
4006 This is akin to the crossover of a loudspeaker, and results in flat frequency
4007 response when absent compander action.
4009 It accepts the following parameters:
4013 This option syntax is:
4014 attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
4015 For explanation of each item refer to compand filter documentation.
4021 Mix channels with specific gain levels. The filter accepts the output
4022 channel layout followed by a set of channels definitions.
4024 This filter is also designed to efficiently remap the channels of an audio
4027 The filter accepts parameters of the form:
4028 "@var{l}|@var{outdef}|@var{outdef}|..."
4032 output channel layout or number of channels
4035 output channel specification, of the form:
4036 "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
4039 output channel to define, either a channel name (FL, FR, etc.) or a channel
4040 number (c0, c1, etc.)
4043 multiplicative coefficient for the channel, 1 leaving the volume unchanged
4046 input channel to use, see out_name for details; it is not possible to mix
4047 named and numbered input channels
4050 If the `=' in a channel specification is replaced by `<', then the gains for
4051 that specification will be renormalized so that the total is 1, thus
4052 avoiding clipping noise.
4054 @subsection Mixing examples
4056 For example, if you want to down-mix from stereo to mono, but with a bigger
4057 factor for the left channel:
4059 pan=1c|c0=0.9*c0+0.1*c1
4062 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
4063 7-channels surround:
4065 pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
4068 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
4069 that should be preferred (see "-ac" option) unless you have very specific
4072 @subsection Remapping examples
4074 The channel remapping will be effective if, and only if:
4077 @item gain coefficients are zeroes or ones,
4078 @item only one input per channel output,
4081 If all these conditions are satisfied, the filter will notify the user ("Pure
4082 channel mapping detected"), and use an optimized and lossless method to do the
4085 For example, if you have a 5.1 source and want a stereo audio stream by
4086 dropping the extra channels:
4088 pan="stereo| c0=FL | c1=FR"
4091 Given the same source, you can also switch front left and front right channels
4092 and keep the input channel layout:
4094 pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
4097 If the input is a stereo audio stream, you can mute the front left channel (and
4098 still keep the stereo channel layout) with:
4103 Still with a stereo audio stream input, you can copy the right channel in both
4104 front left and right:
4106 pan="stereo| c0=FR | c1=FR"
4111 ReplayGain scanner filter. This filter takes an audio stream as an input and
4112 outputs it unchanged.
4113 At end of filtering it displays @code{track_gain} and @code{track_peak}.
4117 Convert the audio sample format, sample rate and channel layout. It is
4118 not meant to be used directly.
4121 Apply time-stretching and pitch-shifting with librubberband.
4123 To enable compilation of this filter, you need to configure FFmpeg with
4124 @code{--enable-librubberband}.
4126 The filter accepts the following options:
4130 Set tempo scale factor.
4133 Set pitch scale factor.
4136 Set transients detector.
4137 Possible values are:
4146 Possible values are:
4155 Possible values are:
4162 Set processing window size.
4163 Possible values are:
4172 Possible values are:
4179 Enable formant preservation when shift pitching.
4180 Possible values are:
4188 Possible values are:
4197 Possible values are:
4204 @section sidechaincompress
4206 This filter acts like normal compressor but has the ability to compress
4207 detected signal using second input signal.
4208 It needs two input streams and returns one output stream.
4209 First input stream will be processed depending on second stream signal.
4210 The filtered signal then can be filtered with other filters in later stages of
4211 processing. See @ref{pan} and @ref{amerge} filter.
4213 The filter accepts the following options:
4217 Set input gain. Default is 1. Range is between 0.015625 and 64.
4220 If a signal of second stream raises above this level it will affect the gain
4221 reduction of first stream.
4222 By default is 0.125. Range is between 0.00097563 and 1.
4225 Set a ratio about which the signal is reduced. 1:2 means that if the level
4226 raised 4dB above the threshold, it will be only 2dB above after the reduction.
4227 Default is 2. Range is between 1 and 20.
4230 Amount of milliseconds the signal has to rise above the threshold before gain
4231 reduction starts. Default is 20. Range is between 0.01 and 2000.
4234 Amount of milliseconds the signal has to fall below the threshold before
4235 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
4238 Set the amount by how much signal will be amplified after processing.
4239 Default is 1. Range is from 1 to 64.
4242 Curve the sharp knee around the threshold to enter gain reduction more softly.
4243 Default is 2.82843. Range is between 1 and 8.
4246 Choose if the @code{average} level between all channels of side-chain stream
4247 or the louder(@code{maximum}) channel of side-chain stream affects the
4248 reduction. Default is @code{average}.
4251 Should the exact signal be taken in case of @code{peak} or an RMS one in case
4252 of @code{rms}. Default is @code{rms} which is mainly smoother.
4255 Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
4258 How much to use compressed signal in output. Default is 1.
4259 Range is between 0 and 1.
4262 @subsection Examples
4266 Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
4267 depending on the signal of 2nd input and later compressed signal to be
4268 merged with 2nd input:
4270 ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
4274 @section sidechaingate
4276 A sidechain gate acts like a normal (wideband) gate but has the ability to
4277 filter the detected signal before sending it to the gain reduction stage.
4278 Normally a gate uses the full range signal to detect a level above the
4280 For example: If you cut all lower frequencies from your sidechain signal
4281 the gate will decrease the volume of your track only if not enough highs
4282 appear. With this technique you are able to reduce the resonation of a
4283 natural drum or remove "rumbling" of muted strokes from a heavily distorted
4285 It needs two input streams and returns one output stream.
4286 First input stream will be processed depending on second stream signal.
4288 The filter accepts the following options:
4292 Set input level before filtering.
4293 Default is 1. Allowed range is from 0.015625 to 64.
4296 Set the level of gain reduction when the signal is below the threshold.
4297 Default is 0.06125. Allowed range is from 0 to 1.
4300 If a signal rises above this level the gain reduction is released.
4301 Default is 0.125. Allowed range is from 0 to 1.
4304 Set a ratio about which the signal is reduced.
4305 Default is 2. Allowed range is from 1 to 9000.
4308 Amount of milliseconds the signal has to rise above the threshold before gain
4310 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
4313 Amount of milliseconds the signal has to fall below the threshold before the
4314 reduction is increased again. Default is 250 milliseconds.
4315 Allowed range is from 0.01 to 9000.
4318 Set amount of amplification of signal after processing.
4319 Default is 1. Allowed range is from 1 to 64.
4322 Curve the sharp knee around the threshold to enter gain reduction more softly.
4323 Default is 2.828427125. Allowed range is from 1 to 8.
4326 Choose if exact signal should be taken for detection or an RMS like one.
4327 Default is rms. Can be peak or rms.
4330 Choose if the average level between all channels or the louder channel affects
4332 Default is average. Can be average or maximum.
4335 Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
4338 @section silencedetect
4340 Detect silence in an audio stream.
4342 This filter logs a message when it detects that the input audio volume is less
4343 or equal to a noise tolerance value for a duration greater or equal to the
4344 minimum detected noise duration.
4346 The printed times and duration are expressed in seconds.
4348 The filter accepts the following options:
4352 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
4353 specified value) or amplitude ratio. Default is -60dB, or 0.001.
4356 Set silence duration until notification (default is 2 seconds).
4359 Process each channel separately, instead of combined. By default is disabled.
4362 @subsection Examples
4366 Detect 5 seconds of silence with -50dB noise tolerance:
4368 silencedetect=n=-50dB:d=5
4372 Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
4373 tolerance in @file{silence.mp3}:
4375 ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
4379 @section silenceremove
4381 Remove silence from the beginning, middle or end of the audio.
4383 The filter accepts the following options:
4387 This value is used to indicate if audio should be trimmed at beginning of
4388 the audio. A value of zero indicates no silence should be trimmed from the
4389 beginning. When specifying a non-zero value, it trims audio up until it
4390 finds non-silence. Normally, when trimming silence from beginning of audio
4391 the @var{start_periods} will be @code{1} but it can be increased to higher
4392 values to trim all audio up to specific count of non-silence periods.
4393 Default value is @code{0}.
4395 @item start_duration
4396 Specify the amount of time that non-silence must be detected before it stops
4397 trimming audio. By increasing the duration, bursts of noises can be treated
4398 as silence and trimmed off. Default value is @code{0}.
4400 @item start_threshold
4401 This indicates what sample value should be treated as silence. For digital
4402 audio, a value of @code{0} may be fine but for audio recorded from analog,
4403 you may wish to increase the value to account for background noise.
4404 Can be specified in dB (in case "dB" is appended to the specified value)
4405 or amplitude ratio. Default value is @code{0}.
4408 Specify max duration of silence at beginning that will be kept after
4409 trimming. Default is 0, which is equal to trimming all samples detected
4413 Specify mode of detection of silence end in start of multi-channel audio.
4414 Can be @var{any} or @var{all}. Default is @var{any}.
4415 With @var{any}, any sample that is detected as non-silence will cause
4416 stopped trimming of silence.
4417 With @var{all}, only if all channels are detected as non-silence will cause
4418 stopped trimming of silence.
4421 Set the count for trimming silence from the end of audio.
4422 To remove silence from the middle of a file, specify a @var{stop_periods}
4423 that is negative. This value is then treated as a positive value and is
4424 used to indicate the effect should restart processing as specified by
4425 @var{start_periods}, making it suitable for removing periods of silence
4426 in the middle of the audio.
4427 Default value is @code{0}.
4430 Specify a duration of silence that must exist before audio is not copied any
4431 more. By specifying a higher duration, silence that is wanted can be left in
4433 Default value is @code{0}.
4435 @item stop_threshold
4436 This is the same as @option{start_threshold} but for trimming silence from
4438 Can be specified in dB (in case "dB" is appended to the specified value)
4439 or amplitude ratio. Default value is @code{0}.
4442 Specify max duration of silence at end that will be kept after
4443 trimming. Default is 0, which is equal to trimming all samples detected
4447 Specify mode of detection of silence start in end of multi-channel audio.
4448 Can be @var{any} or @var{all}. Default is @var{any}.
4449 With @var{any}, any sample that is detected as non-silence will cause
4450 stopped trimming of silence.
4451 With @var{all}, only if all channels are detected as non-silence will cause
4452 stopped trimming of silence.
4455 Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
4456 and works better with digital silence which is exactly 0.
4457 Default value is @code{rms}.
4460 Set duration in number of seconds used to calculate size of window in number
4461 of samples for detecting silence.
4462 Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
4465 @subsection Examples
4469 The following example shows how this filter can be used to start a recording
4470 that does not contain the delay at the start which usually occurs between
4471 pressing the record button and the start of the performance:
4473 silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
4477 Trim all silence encountered from beginning to end where there is more than 1
4478 second of silence in audio:
4480 silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
4486 SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
4487 loudspeakers around the user for binaural listening via headphones (audio
4488 formats up to 9 channels supported).
4489 The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
4490 SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
4491 Austrian Academy of Sciences.
4493 To enable compilation of this filter you need to configure FFmpeg with
4494 @code{--enable-libmysofa}.
4496 The filter accepts the following options:
4500 Set the SOFA file used for rendering.
4503 Set gain applied to audio. Value is in dB. Default is 0.
4506 Set rotation of virtual loudspeakers in deg. Default is 0.
4509 Set elevation of virtual speakers in deg. Default is 0.
4512 Set distance in meters between loudspeakers and the listener with near-field
4513 HRTFs. Default is 1.
4516 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
4517 processing audio in time domain which is slow.
4518 @var{freq} is processing audio in frequency domain which is fast.
4519 Default is @var{freq}.
4522 Set custom positions of virtual loudspeakers. Syntax for this option is:
4523 <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
4524 Each virtual loudspeaker is described with short channel name following with
4525 azimuth and elevation in degrees.
4526 Each virtual loudspeaker description is separated by '|'.
4527 For example to override front left and front right channel positions use:
4528 'speakers=FL 45 15|FR 345 15'.
4529 Descriptions with unrecognised channel names are ignored.
4532 Set custom gain for LFE channels. Value is in dB. Default is 0.
4535 Set custom frame size in number of samples. Default is 1024.
4536 Allowed range is from 1024 to 96000. Only used if option @samp{type}
4537 is set to @var{freq}.
4540 Should all IRs be normalized upon importing SOFA file.
4541 By default is enabled.
4544 Should nearest IRs be interpolated with neighbor IRs if exact position
4545 does not match. By default is disabled.
4548 Minphase all IRs upon loading of SOFA file. By default is disabled.
4551 Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
4554 Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
4557 @subsection Examples
4561 Using ClubFritz6 sofa file:
4563 sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
4567 Using ClubFritz12 sofa file and bigger radius with small rotation:
4569 sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
4573 Similar as above but with custom speaker positions for front left, front right, back left and back right
4574 and also with custom gain:
4576 "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
4580 @section stereotools
4582 This filter has some handy utilities to manage stereo signals, for converting
4583 M/S stereo recordings to L/R signal while having control over the parameters
4584 or spreading the stereo image of master track.
4586 The filter accepts the following options:
4590 Set input level before filtering for both channels. Defaults is 1.
4591 Allowed range is from 0.015625 to 64.
4594 Set output level after filtering for both channels. Defaults is 1.
4595 Allowed range is from 0.015625 to 64.
4598 Set input balance between both channels. Default is 0.
4599 Allowed range is from -1 to 1.
4602 Set output balance between both channels. Default is 0.
4603 Allowed range is from -1 to 1.
4606 Enable softclipping. Results in analog distortion instead of harsh digital 0dB
4607 clipping. Disabled by default.
4610 Mute the left channel. Disabled by default.
4613 Mute the right channel. Disabled by default.
4616 Change the phase of the left channel. Disabled by default.
4619 Change the phase of the right channel. Disabled by default.
4622 Set stereo mode. Available values are:
4626 Left/Right to Left/Right, this is default.
4629 Left/Right to Mid/Side.
4632 Mid/Side to Left/Right.
4635 Left/Right to Left/Left.
4638 Left/Right to Right/Right.
4641 Left/Right to Left + Right.
4644 Left/Right to Right/Left.
4647 Mid/Side to Left/Left.
4650 Mid/Side to Right/Right.
4654 Set level of side signal. Default is 1.
4655 Allowed range is from 0.015625 to 64.
4658 Set balance of side signal. Default is 0.
4659 Allowed range is from -1 to 1.
4662 Set level of the middle signal. Default is 1.
4663 Allowed range is from 0.015625 to 64.
4666 Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
4669 Set stereo base between mono and inversed channels. Default is 0.
4670 Allowed range is from -1 to 1.
4673 Set delay in milliseconds how much to delay left from right channel and
4674 vice versa. Default is 0. Allowed range is from -20 to 20.
4677 Set S/C level. Default is 1. Allowed range is from 1 to 100.
4680 Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
4682 @item bmode_in, bmode_out
4683 Set balance mode for balance_in/balance_out option.
4685 Can be one of the following:
4689 Classic balance mode. Attenuate one channel at time.
4690 Gain is raised up to 1.
4693 Similar as classic mode above but gain is raised up to 2.
4696 Equal power distribution, from -6dB to +6dB range.
4700 @subsection Examples
4704 Apply karaoke like effect:
4706 stereotools=mlev=0.015625
4710 Convert M/S signal to L/R:
4712 "stereotools=mode=ms>lr"
4716 @section stereowiden
4718 This filter enhance the stereo effect by suppressing signal common to both
4719 channels and by delaying the signal of left into right and vice versa,
4720 thereby widening the stereo effect.
4722 The filter accepts the following options:
4726 Time in milliseconds of the delay of left signal into right and vice versa.
4727 Default is 20 milliseconds.
4730 Amount of gain in delayed signal into right and vice versa. Gives a delay
4731 effect of left signal in right output and vice versa which gives widening
4732 effect. Default is 0.3.
4735 Cross feed of left into right with inverted phase. This helps in suppressing
4736 the mono. If the value is 1 it will cancel all the signal common to both
4737 channels. Default is 0.3.
4740 Set level of input signal of original channel. Default is 0.8.
4743 @section superequalizer
4744 Apply 18 band equalizer.
4746 The filter accepts the following options:
4753 Set 131Hz band gain.
4755 Set 185Hz band gain.
4757 Set 262Hz band gain.
4759 Set 370Hz band gain.
4761 Set 523Hz band gain.
4763 Set 740Hz band gain.
4765 Set 1047Hz band gain.
4767 Set 1480Hz band gain.
4769 Set 2093Hz band gain.
4771 Set 2960Hz band gain.
4773 Set 4186Hz band gain.
4775 Set 5920Hz band gain.
4777 Set 8372Hz band gain.
4779 Set 11840Hz band gain.
4781 Set 16744Hz band gain.
4783 Set 20000Hz band gain.
4787 Apply audio surround upmix filter.
4789 This filter allows to produce multichannel output from audio stream.
4791 The filter accepts the following options:
4795 Set output channel layout. By default, this is @var{5.1}.
4797 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4798 for the required syntax.
4801 Set input channel layout. By default, this is @var{stereo}.
4803 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4804 for the required syntax.
4807 Set input volume level. By default, this is @var{1}.
4810 Set output volume level. By default, this is @var{1}.
4813 Enable LFE channel output if output channel layout has it. By default, this is enabled.
4816 Set LFE low cut off frequency. By default, this is @var{128} Hz.
4819 Set LFE high cut off frequency. By default, this is @var{256} Hz.
4822 Set front center input volume. By default, this is @var{1}.
4825 Set front center output volume. By default, this is @var{1}.
4828 Set LFE input volume. By default, this is @var{1}.
4831 Set LFE output volume. By default, this is @var{1}.
4834 @section treble, highshelf
4836 Boost or cut treble (upper) frequencies of the audio using a two-pole
4837 shelving filter with a response similar to that of a standard
4838 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
4840 The filter accepts the following options:
4844 Give the gain at whichever is the lower of ~22 kHz and the
4845 Nyquist frequency. Its useful range is about -20 (for a large cut)
4846 to +20 (for a large boost). Beware of clipping when using a positive gain.
4849 Set the filter's central frequency and so can be used
4850 to extend or reduce the frequency range to be boosted or cut.
4851 The default value is @code{3000} Hz.
4854 Set method to specify band-width of filter.
4869 Determine how steep is the filter's shelf transition.
4872 Specify which channels to filter, by default all available are filtered.
4875 @subsection Commands
4877 This filter supports the following commands:
4880 Change treble frequency.
4881 Syntax for the command is : "@var{frequency}"
4884 Change treble width_type.
4885 Syntax for the command is : "@var{width_type}"
4888 Change treble width.
4889 Syntax for the command is : "@var{width}"
4893 Syntax for the command is : "@var{gain}"
4898 Sinusoidal amplitude modulation.
4900 The filter accepts the following options:
4904 Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
4905 (20 Hz or lower) will result in a tremolo effect.
4906 This filter may also be used as a ring modulator by specifying
4907 a modulation frequency higher than 20 Hz.
4908 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
4911 Depth of modulation as a percentage. Range is 0.0 - 1.0.
4912 Default value is 0.5.
4917 Sinusoidal phase modulation.
4919 The filter accepts the following options:
4923 Modulation frequency in Hertz.
4924 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
4927 Depth of modulation as a percentage. Range is 0.0 - 1.0.
4928 Default value is 0.5.
4933 Adjust the input audio volume.
4935 It accepts the following parameters:
4939 Set audio volume expression.
4941 Output values are clipped to the maximum value.
4943 The output audio volume is given by the relation:
4945 @var{output_volume} = @var{volume} * @var{input_volume}
4948 The default value for @var{volume} is "1.0".
4951 This parameter represents the mathematical precision.
4953 It determines which input sample formats will be allowed, which affects the
4954 precision of the volume scaling.
4958 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
4960 32-bit floating-point; this limits input sample format to FLT. (default)
4962 64-bit floating-point; this limits input sample format to DBL.
4966 Choose the behaviour on encountering ReplayGain side data in input frames.
4970 Remove ReplayGain side data, ignoring its contents (the default).
4973 Ignore ReplayGain side data, but leave it in the frame.
4976 Prefer the track gain, if present.
4979 Prefer the album gain, if present.
4982 @item replaygain_preamp
4983 Pre-amplification gain in dB to apply to the selected replaygain gain.
4985 Default value for @var{replaygain_preamp} is 0.0.
4988 Set when the volume expression is evaluated.
4990 It accepts the following values:
4993 only evaluate expression once during the filter initialization, or
4994 when the @samp{volume} command is sent
4997 evaluate expression for each incoming frame
5000 Default value is @samp{once}.
5003 The volume expression can contain the following parameters.
5007 frame number (starting at zero)
5010 @item nb_consumed_samples
5011 number of samples consumed by the filter
5013 number of samples in the current frame
5015 original frame position in the file
5021 PTS at start of stream
5023 time at start of stream
5029 last set volume value
5032 Note that when @option{eval} is set to @samp{once} only the
5033 @var{sample_rate} and @var{tb} variables are available, all other
5034 variables will evaluate to NAN.
5036 @subsection Commands
5038 This filter supports the following commands:
5041 Modify the volume expression.
5042 The command accepts the same syntax of the corresponding option.
5044 If the specified expression is not valid, it is kept at its current
5046 @item replaygain_noclip
5047 Prevent clipping by limiting the gain applied.
5049 Default value for @var{replaygain_noclip} is 1.
5053 @subsection Examples
5057 Halve the input audio volume:
5061 volume=volume=-6.0206dB
5064 In all the above example the named key for @option{volume} can be
5065 omitted, for example like in:
5071 Increase input audio power by 6 decibels using fixed-point precision:
5073 volume=volume=6dB:precision=fixed
5077 Fade volume after time 10 with an annihilation period of 5 seconds:
5079 volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
5083 @section volumedetect
5085 Detect the volume of the input video.
5087 The filter has no parameters. The input is not modified. Statistics about
5088 the volume will be printed in the log when the input stream end is reached.
5090 In particular it will show the mean volume (root mean square), maximum
5091 volume (on a per-sample basis), and the beginning of a histogram of the
5092 registered volume values (from the maximum value to a cumulated 1/1000 of
5095 All volumes are in decibels relative to the maximum PCM value.
5097 @subsection Examples
5099 Here is an excerpt of the output:
5101 [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
5102 [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
5103 [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
5104 [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
5105 [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
5106 [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
5107 [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
5108 [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
5109 [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
5115 The mean square energy is approximately -27 dB, or 10^-2.7.
5117 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
5119 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
5122 In other words, raising the volume by +4 dB does not cause any clipping,
5123 raising it by +5 dB causes clipping for 6 samples, etc.
5125 @c man end AUDIO FILTERS
5127 @chapter Audio Sources
5128 @c man begin AUDIO SOURCES
5130 Below is a description of the currently available audio sources.
5134 Buffer audio frames, and make them available to the filter chain.
5136 This source is mainly intended for a programmatic use, in particular
5137 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
5139 It accepts the following parameters:
5143 The timebase which will be used for timestamps of submitted frames. It must be
5144 either a floating-point number or in @var{numerator}/@var{denominator} form.
5147 The sample rate of the incoming audio buffers.
5150 The sample format of the incoming audio buffers.
5151 Either a sample format name or its corresponding integer representation from
5152 the enum AVSampleFormat in @file{libavutil/samplefmt.h}
5154 @item channel_layout
5155 The channel layout of the incoming audio buffers.
5156 Either a channel layout name from channel_layout_map in
5157 @file{libavutil/channel_layout.c} or its corresponding integer representation
5158 from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
5161 The number of channels of the incoming audio buffers.
5162 If both @var{channels} and @var{channel_layout} are specified, then they
5167 @subsection Examples
5170 abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
5173 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
5174 Since the sample format with name "s16p" corresponds to the number
5175 6 and the "stereo" channel layout corresponds to the value 0x3, this is
5178 abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
5183 Generate an audio signal specified by an expression.
5185 This source accepts in input one or more expressions (one for each
5186 channel), which are evaluated and used to generate a corresponding
5189 This source accepts the following options:
5193 Set the '|'-separated expressions list for each separate channel. In case the
5194 @option{channel_layout} option is not specified, the selected channel layout
5195 depends on the number of provided expressions. Otherwise the last
5196 specified expression is applied to the remaining output channels.
5198 @item channel_layout, c
5199 Set the channel layout. The number of channels in the specified layout
5200 must be equal to the number of specified expressions.
5203 Set the minimum duration of the sourced audio. See
5204 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
5205 for the accepted syntax.
5206 Note that the resulting duration may be greater than the specified
5207 duration, as the generated audio is always cut at the end of a
5210 If not specified, or the expressed duration is negative, the audio is
5211 supposed to be generated forever.
5214 Set the number of samples per channel per each output frame,
5217 @item sample_rate, s
5218 Specify the sample rate, default to 44100.
5221 Each expression in @var{exprs} can contain the following constants:
5225 number of the evaluated sample, starting from 0
5228 time of the evaluated sample expressed in seconds, starting from 0
5235 @subsection Examples
5245 Generate a sin signal with frequency of 440 Hz, set sample rate to
5248 aevalsrc="sin(440*2*PI*t):s=8000"
5252 Generate a two channels signal, specify the channel layout (Front
5253 Center + Back Center) explicitly:
5255 aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
5259 Generate white noise:
5261 aevalsrc="-2+random(0)"
5265 Generate an amplitude modulated signal:
5267 aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
5271 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
5273 aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
5280 The null audio source, return unprocessed audio frames. It is mainly useful
5281 as a template and to be employed in analysis / debugging tools, or as
5282 the source for filters which ignore the input data (for example the sox
5285 This source accepts the following options:
5289 @item channel_layout, cl
5291 Specifies the channel layout, and can be either an integer or a string
5292 representing a channel layout. The default value of @var{channel_layout}
5295 Check the channel_layout_map definition in
5296 @file{libavutil/channel_layout.c} for the mapping between strings and
5297 channel layout values.
5299 @item sample_rate, r
5300 Specifies the sample rate, and defaults to 44100.
5303 Set the number of samples per requested frames.
5307 @subsection Examples
5311 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
5313 anullsrc=r=48000:cl=4
5317 Do the same operation with a more obvious syntax:
5319 anullsrc=r=48000:cl=mono
5323 All the parameters need to be explicitly defined.
5327 Synthesize a voice utterance using the libflite library.
5329 To enable compilation of this filter you need to configure FFmpeg with
5330 @code{--enable-libflite}.
5332 Note that versions of the flite library prior to 2.0 are not thread-safe.
5334 The filter accepts the following options:
5339 If set to 1, list the names of the available voices and exit
5340 immediately. Default value is 0.
5343 Set the maximum number of samples per frame. Default value is 512.
5346 Set the filename containing the text to speak.
5349 Set the text to speak.
5352 Set the voice to use for the speech synthesis. Default value is
5353 @code{kal}. See also the @var{list_voices} option.
5356 @subsection Examples
5360 Read from file @file{speech.txt}, and synthesize the text using the
5361 standard flite voice:
5363 flite=textfile=speech.txt
5367 Read the specified text selecting the @code{slt} voice:
5369 flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
5373 Input text to ffmpeg:
5375 ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
5379 Make @file{ffplay} speak the specified text, using @code{flite} and
5380 the @code{lavfi} device:
5382 ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
5386 For more information about libflite, check:
5387 @url{http://www.festvox.org/flite/}
5391 Generate a noise audio signal.
5393 The filter accepts the following options:
5396 @item sample_rate, r
5397 Specify the sample rate. Default value is 48000 Hz.
5400 Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
5404 Specify the duration of the generated audio stream. Not specifying this option
5405 results in noise with an infinite length.
5407 @item color, colour, c
5408 Specify the color of noise. Available noise colors are white, pink, brown,
5409 blue and violet. Default color is white.
5412 Specify a value used to seed the PRNG.
5415 Set the number of samples per each output frame, default is 1024.
5418 @subsection Examples
5423 Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
5425 anoisesrc=d=60:c=pink:r=44100:a=0.5
5431 Generate odd-tap Hilbert transform FIR coefficients.
5433 The resulting stream can be used with @ref{afir} filter for phase-shifting
5434 the signal by 90 degrees.
5436 This is used in many matrix coding schemes and for analytic signal generation.
5437 The process is often written as a multiplication by i (or j), the imaginary unit.
5439 The filter accepts the following options:
5443 @item sample_rate, s
5444 Set sample rate, default is 44100.
5447 Set length of FIR filter, default is 22051.
5450 Set number of samples per each frame.
5453 Set window function to be used when generating FIR coefficients.
5458 Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
5460 The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
5462 The filter accepts the following options:
5465 @item sample_rate, r
5466 Set sample rate, default is 44100.
5469 Set number of samples per each frame. Default is 1024.
5472 Set high-pass frequency. Default is 0.
5475 Set low-pass frequency. Default is 0.
5476 If high-pass frequency is lower than low-pass frequency and low-pass frequency
5477 is higher than 0 then filter will create band-pass filter coefficients,
5478 otherwise band-reject filter coefficients.
5481 Set filter phase response. Default is 50. Allowed range is from 0 to 100.
5484 Set Kaiser window beta.
5487 Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
5490 Enable rounding, by default is disabled.
5493 Set number of taps for high-pass filter.
5496 Set number of taps for low-pass filter.
5501 Generate an audio signal made of a sine wave with amplitude 1/8.
5503 The audio signal is bit-exact.
5505 The filter accepts the following options:
5510 Set the carrier frequency. Default is 440 Hz.
5512 @item beep_factor, b
5513 Enable a periodic beep every second with frequency @var{beep_factor} times
5514 the carrier frequency. Default is 0, meaning the beep is disabled.
5516 @item sample_rate, r
5517 Specify the sample rate, default is 44100.
5520 Specify the duration of the generated audio stream.
5522 @item samples_per_frame
5523 Set the number of samples per output frame.
5525 The expression can contain the following constants:
5529 The (sequential) number of the output audio frame, starting from 0.
5532 The PTS (Presentation TimeStamp) of the output audio frame,
5533 expressed in @var{TB} units.
5536 The PTS of the output audio frame, expressed in seconds.
5539 The timebase of the output audio frames.
5542 Default is @code{1024}.
5545 @subsection Examples
5550 Generate a simple 440 Hz sine wave:
5556 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
5560 sine=frequency=220:beep_factor=4:duration=5
5564 Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
5567 sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
5571 @c man end AUDIO SOURCES
5573 @chapter Audio Sinks
5574 @c man begin AUDIO SINKS
5576 Below is a description of the currently available audio sinks.
5578 @section abuffersink
5580 Buffer audio frames, and make them available to the end of filter chain.
5582 This sink is mainly intended for programmatic use, in particular
5583 through the interface defined in @file{libavfilter/buffersink.h}
5584 or the options system.
5586 It accepts a pointer to an AVABufferSinkContext structure, which
5587 defines the incoming buffers' formats, to be passed as the opaque
5588 parameter to @code{avfilter_init_filter} for initialization.
5591 Null audio sink; do absolutely nothing with the input audio. It is
5592 mainly useful as a template and for use in analysis / debugging
5595 @c man end AUDIO SINKS
5597 @chapter Video Filters
5598 @c man begin VIDEO FILTERS
5600 When you configure your FFmpeg build, you can disable any of the
5601 existing filters using @code{--disable-filters}.
5602 The configure output will show the video filters included in your
5605 Below is a description of the currently available video filters.
5607 @section alphaextract
5609 Extract the alpha component from the input as a grayscale video. This
5610 is especially useful with the @var{alphamerge} filter.
5614 Add or replace the alpha component of the primary input with the
5615 grayscale value of a second input. This is intended for use with
5616 @var{alphaextract} to allow the transmission or storage of frame
5617 sequences that have alpha in a format that doesn't support an alpha
5620 For example, to reconstruct full frames from a normal YUV-encoded video
5621 and a separate video created with @var{alphaextract}, you might use:
5623 movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
5626 Since this filter is designed for reconstruction, it operates on frame
5627 sequences without considering timestamps, and terminates when either
5628 input reaches end of stream. This will cause problems if your encoding
5629 pipeline drops frames. If you're trying to apply an image as an
5630 overlay to a video stream, consider the @var{overlay} filter instead.
5634 Amplify differences between current pixel and pixels of adjacent frames in
5635 same pixel location.
5637 This filter accepts the following options:
5641 Set frame radius. Default is 2. Allowed range is from 1 to 63.
5642 For example radius of 3 will instruct filter to calculate average of 7 frames.
5645 Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
5648 Set threshold for difference amplification. Any differrence greater or equal to
5649 this value will not alter source pixel. Default is 10.
5650 Allowed range is from 0 to 65535.
5653 Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
5654 This option controls maximum possible value that will decrease source pixel value.
5657 Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
5658 This option controls maximum possible value that will increase source pixel value.
5661 Set which planes to filter. Default is all. Allowed range is from 0 to 15.
5666 Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
5667 and libavformat to work. On the other hand, it is limited to ASS (Advanced
5668 Substation Alpha) subtitles files.
5670 This filter accepts the following option in addition to the common options from
5671 the @ref{subtitles} filter:
5675 Set the shaping engine
5677 Available values are:
5680 The default libass shaping engine, which is the best available.
5682 Fast, font-agnostic shaper that can do only substitutions
5684 Slower shaper using OpenType for substitutions and positioning
5687 The default is @code{auto}.
5691 Apply an Adaptive Temporal Averaging Denoiser to the video input.
5693 The filter accepts the following options:
5697 Set threshold A for 1st plane. Default is 0.02.
5698 Valid range is 0 to 0.3.
5701 Set threshold B for 1st plane. Default is 0.04.
5702 Valid range is 0 to 5.
5705 Set threshold A for 2nd plane. Default is 0.02.
5706 Valid range is 0 to 0.3.
5709 Set threshold B for 2nd plane. Default is 0.04.
5710 Valid range is 0 to 5.
5713 Set threshold A for 3rd plane. Default is 0.02.
5714 Valid range is 0 to 0.3.
5717 Set threshold B for 3rd plane. Default is 0.04.
5718 Valid range is 0 to 5.
5720 Threshold A is designed to react on abrupt changes in the input signal and
5721 threshold B is designed to react on continuous changes in the input signal.
5724 Set number of frames filter will use for averaging. Default is 9. Must be odd
5725 number in range [5, 129].
5728 Set what planes of frame filter will use for averaging. Default is all.
5733 Apply average blur filter.
5735 The filter accepts the following options:
5739 Set horizontal radius size.
5742 Set which planes to filter. By default all planes are filtered.
5745 Set vertical radius size, if zero it will be same as @code{sizeX}.
5746 Default is @code{0}.
5751 Compute the bounding box for the non-black pixels in the input frame
5754 This filter computes the bounding box containing all the pixels with a
5755 luminance value greater than the minimum allowed value.
5756 The parameters describing the bounding box are printed on the filter
5759 The filter accepts the following option:
5763 Set the minimal luminance value. Default is @code{16}.
5766 @section bitplanenoise
5768 Show and measure bit plane noise.
5770 The filter accepts the following options:
5774 Set which plane to analyze. Default is @code{1}.
5777 Filter out noisy pixels from @code{bitplane} set above.
5778 Default is disabled.
5781 @section blackdetect
5783 Detect video intervals that are (almost) completely black. Can be
5784 useful to detect chapter transitions, commercials, or invalid
5785 recordings. Output lines contains the time for the start, end and
5786 duration of the detected black interval expressed in seconds.
5788 In order to display the output lines, you need to set the loglevel at
5789 least to the AV_LOG_INFO value.
5791 The filter accepts the following options:
5794 @item black_min_duration, d
5795 Set the minimum detected black duration expressed in seconds. It must
5796 be a non-negative floating point number.
5798 Default value is 2.0.
5800 @item picture_black_ratio_th, pic_th
5801 Set the threshold for considering a picture "black".
5802 Express the minimum value for the ratio:
5804 @var{nb_black_pixels} / @var{nb_pixels}
5807 for which a picture is considered black.
5808 Default value is 0.98.
5810 @item pixel_black_th, pix_th
5811 Set the threshold for considering a pixel "black".
5813 The threshold expresses the maximum pixel luminance value for which a
5814 pixel is considered "black". The provided value is scaled according to
5815 the following equation:
5817 @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
5820 @var{luminance_range_size} and @var{luminance_minimum_value} depend on
5821 the input video format, the range is [0-255] for YUV full-range
5822 formats and [16-235] for YUV non full-range formats.
5824 Default value is 0.10.
5827 The following example sets the maximum pixel threshold to the minimum
5828 value, and detects only black intervals of 2 or more seconds:
5830 blackdetect=d=2:pix_th=0.00
5835 Detect frames that are (almost) completely black. Can be useful to
5836 detect chapter transitions or commercials. Output lines consist of
5837 the frame number of the detected frame, the percentage of blackness,
5838 the position in the file if known or -1 and the timestamp in seconds.
5840 In order to display the output lines, you need to set the loglevel at
5841 least to the AV_LOG_INFO value.
5843 This filter exports frame metadata @code{lavfi.blackframe.pblack}.
5844 The value represents the percentage of pixels in the picture that
5845 are below the threshold value.
5847 It accepts the following parameters:
5852 The percentage of the pixels that have to be below the threshold; it defaults to
5855 @item threshold, thresh
5856 The threshold below which a pixel value is considered black; it defaults to
5861 @section blend, tblend
5863 Blend two video frames into each other.
5865 The @code{blend} filter takes two input streams and outputs one
5866 stream, the first input is the "top" layer and second input is
5867 "bottom" layer. By default, the output terminates when the longest input terminates.
5869 The @code{tblend} (time blend) filter takes two consecutive frames
5870 from one single stream, and outputs the result obtained by blending
5871 the new frame on top of the old frame.
5873 A description of the accepted options follows.
5881 Set blend mode for specific pixel component or all pixel components in case
5882 of @var{all_mode}. Default value is @code{normal}.
5884 Available values for component modes are:
5926 Set blend opacity for specific pixel component or all pixel components in case
5927 of @var{all_opacity}. Only used in combination with pixel component blend modes.
5934 Set blend expression for specific pixel component or all pixel components in case
5935 of @var{all_expr}. Note that related mode options will be ignored if those are set.
5937 The expressions can use the following variables:
5941 The sequential number of the filtered frame, starting from @code{0}.
5945 the coordinates of the current sample
5949 the width and height of currently filtered plane
5953 Width and height scale for the plane being filtered. It is the
5954 ratio between the dimensions of the current plane to the luma plane,
5955 e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
5956 the luma plane and @code{0.5,0.5} for the chroma planes.
5959 Time of the current frame, expressed in seconds.
5962 Value of pixel component at current location for first video frame (top layer).
5965 Value of pixel component at current location for second video frame (bottom layer).
5969 The @code{blend} filter also supports the @ref{framesync} options.
5971 @subsection Examples
5975 Apply transition from bottom layer to top layer in first 10 seconds:
5977 blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
5981 Apply linear horizontal transition from top layer to bottom layer:
5983 blend=all_expr='A*(X/W)+B*(1-X/W)'
5987 Apply 1x1 checkerboard effect:
5989 blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
5993 Apply uncover left effect:
5995 blend=all_expr='if(gte(N*SW+X,W),A,B)'
5999 Apply uncover down effect:
6001 blend=all_expr='if(gte(Y-N*SH,0),A,B)'
6005 Apply uncover up-left effect:
6007 blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
6011 Split diagonally video and shows top and bottom layer on each side:
6013 blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
6017 Display differences between the current and the previous frame:
6019 tblend=all_mode=grainextract
6025 Denoise frames using Block-Matching 3D algorithm.
6027 The filter accepts the following options.
6031 Set denoising strength. Default value is 1.
6032 Allowed range is from 0 to 999.9.
6033 The denoising algorith is very sensitive to sigma, so adjust it
6034 according to the source.
6037 Set local patch size. This sets dimensions in 2D.
6040 Set sliding step for processing blocks. Default value is 4.
6041 Allowed range is from 1 to 64.
6042 Smaller values allows processing more reference blocks and is slower.
6045 Set maximal number of similar blocks for 3rd dimension. Default value is 1.
6046 When set to 1, no block matching is done. Larger values allows more blocks
6048 Allowed range is from 1 to 256.
6051 Set radius for search block matching. Default is 9.
6052 Allowed range is from 1 to INT32_MAX.
6055 Set step between two search locations for block matching. Default is 1.
6056 Allowed range is from 1 to 64. Smaller is slower.
6059 Set threshold of mean square error for block matching. Valid range is 0 to
6063 Set thresholding parameter for hard thresholding in 3D transformed domain.
6064 Larger values results in stronger hard-thresholding filtering in frequency
6068 Set filtering estimation mode. Can be @code{basic} or @code{final}.
6069 Default is @code{basic}.
6072 If enabled, filter will use 2nd stream for block matching.
6073 Default is disabled for @code{basic} value of @var{estim} option,
6074 and always enabled if value of @var{estim} is @code{final}.
6077 Set planes to filter. Default is all available except alpha.
6080 @subsection Examples
6084 Basic filtering with bm3d:
6086 bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
6090 Same as above, but filtering only luma:
6092 bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
6096 Same as above, but with both estimation modes:
6098 split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
6102 Same as above, but prefilter with @ref{nlmeans} filter instead:
6104 split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
6110 Apply a boxblur algorithm to the input video.
6112 It accepts the following parameters:
6116 @item luma_radius, lr
6117 @item luma_power, lp
6118 @item chroma_radius, cr
6119 @item chroma_power, cp
6120 @item alpha_radius, ar
6121 @item alpha_power, ap
6125 A description of the accepted options follows.
6128 @item luma_radius, lr
6129 @item chroma_radius, cr
6130 @item alpha_radius, ar
6131 Set an expression for the box radius in pixels used for blurring the
6132 corresponding input plane.
6134 The radius value must be a non-negative number, and must not be
6135 greater than the value of the expression @code{min(w,h)/2} for the
6136 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
6139 Default value for @option{luma_radius} is "2". If not specified,
6140 @option{chroma_radius} and @option{alpha_radius} default to the
6141 corresponding value set for @option{luma_radius}.
6143 The expressions can contain the following constants:
6147 The input width and height in pixels.
6151 The input chroma image width and height in pixels.
6155 The horizontal and vertical chroma subsample values. For example, for the
6156 pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
6159 @item luma_power, lp
6160 @item chroma_power, cp
6161 @item alpha_power, ap
6162 Specify how many times the boxblur filter is applied to the
6163 corresponding plane.
6165 Default value for @option{luma_power} is 2. If not specified,
6166 @option{chroma_power} and @option{alpha_power} default to the
6167 corresponding value set for @option{luma_power}.
6169 A value of 0 will disable the effect.
6172 @subsection Examples
6176 Apply a boxblur filter with the luma, chroma, and alpha radii
6179 boxblur=luma_radius=2:luma_power=1
6184 Set the luma radius to 2, and alpha and chroma radius to 0:
6186 boxblur=2:1:cr=0:ar=0
6190 Set the luma and chroma radii to a fraction of the video dimension:
6192 boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
6198 Deinterlace the input video ("bwdif" stands for "Bob Weaver
6199 Deinterlacing Filter").
6201 Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
6202 interpolation algorithms.
6203 It accepts the following parameters:
6207 The interlacing mode to adopt. It accepts one of the following values:
6211 Output one frame for each frame.
6213 Output one frame for each field.
6216 The default value is @code{send_field}.
6219 The picture field parity assumed for the input interlaced video. It accepts one
6220 of the following values:
6224 Assume the top field is first.
6226 Assume the bottom field is first.
6228 Enable automatic detection of field parity.
6231 The default value is @code{auto}.
6232 If the interlacing is unknown or the decoder does not export this information,
6233 top field first will be assumed.
6236 Specify which frames to deinterlace. Accept one of the following
6241 Deinterlace all frames.
6243 Only deinterlace frames marked as interlaced.
6246 The default value is @code{all}.
6250 Remove all color information for all colors except for certain one.
6252 The filter accepts the following options:
6256 The color which will not be replaced with neutral chroma.
6259 Similarity percentage with the above color.
6260 0.01 matches only the exact key color, while 1.0 matches everything.
6263 Signals that the color passed is already in YUV instead of RGB.
6265 Literal colors like "green" or "red" don't make sense with this enabled anymore.
6266 This can be used to pass exact YUV values as hexadecimal numbers.
6270 YUV colorspace color/chroma keying.
6272 The filter accepts the following options:
6276 The color which will be replaced with transparency.
6279 Similarity percentage with the key color.
6281 0.01 matches only the exact key color, while 1.0 matches everything.
6286 0.0 makes pixels either fully transparent, or not transparent at all.
6288 Higher values result in semi-transparent pixels, with a higher transparency
6289 the more similar the pixels color is to the key color.
6292 Signals that the color passed is already in YUV instead of RGB.
6294 Literal colors like "green" or "red" don't make sense with this enabled anymore.
6295 This can be used to pass exact YUV values as hexadecimal numbers.
6298 @subsection Examples
6302 Make every green pixel in the input image transparent:
6304 ffmpeg -i input.png -vf chromakey=green out.png
6308 Overlay a greenscreen-video on top of a static black background.
6310 ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
6314 @section chromashift
6315 Shift chroma pixels horizontally and/or vertically.
6317 The filter accepts the following options:
6320 Set amount to shift chroma-blue horizontally.
6322 Set amount to shift chroma-blue vertically.
6324 Set amount to shift chroma-red horizontally.
6326 Set amount to shift chroma-red vertically.
6328 Set edge mode, can be @var{smear}, default, or @var{warp}.
6333 Display CIE color diagram with pixels overlaid onto it.
6335 The filter accepts the following options:
6350 @item uhdtv, rec2020
6363 Set what gamuts to draw.
6365 See @code{system} option for available values.
6368 Set ciescope size, by default set to 512.
6371 Set intensity used to map input pixel values to CIE diagram.
6374 Set contrast used to draw tongue colors that are out of active color system gamut.
6377 Correct gamma displayed on scope, by default enabled.
6380 Show white point on CIE diagram, by default disabled.
6383 Set input gamma. Used only with XYZ input color space.
6388 Visualize information exported by some codecs.
6390 Some codecs can export information through frames using side-data or other
6391 means. For example, some MPEG based codecs export motion vectors through the
6392 @var{export_mvs} flag in the codec @option{flags2} option.
6394 The filter accepts the following option:
6398 Set motion vectors to visualize.
6400 Available flags for @var{mv} are:
6404 forward predicted MVs of P-frames
6406 forward predicted MVs of B-frames
6408 backward predicted MVs of B-frames
6412 Display quantization parameters using the chroma planes.
6415 Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
6417 Available flags for @var{mv_type} are:
6421 forward predicted MVs
6423 backward predicted MVs
6426 @item frame_type, ft
6427 Set frame type to visualize motion vectors of.
6429 Available flags for @var{frame_type} are:
6433 intra-coded frames (I-frames)
6435 predicted frames (P-frames)
6437 bi-directionally predicted frames (B-frames)
6441 @subsection Examples
6445 Visualize forward predicted MVs of all frames using @command{ffplay}:
6447 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
6451 Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
6453 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
6457 @section colorbalance
6458 Modify intensity of primary colors (red, green and blue) of input frames.
6460 The filter allows an input frame to be adjusted in the shadows, midtones or highlights
6461 regions for the red-cyan, green-magenta or blue-yellow balance.
6463 A positive adjustment value shifts the balance towards the primary color, a negative
6464 value towards the complementary color.
6466 The filter accepts the following options:
6472 Adjust red, green and blue shadows (darkest pixels).
6477 Adjust red, green and blue midtones (medium pixels).
6482 Adjust red, green and blue highlights (brightest pixels).
6484 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
6487 @subsection Examples
6491 Add red color cast to shadows:
6498 RGB colorspace color keying.
6500 The filter accepts the following options:
6504 The color which will be replaced with transparency.
6507 Similarity percentage with the key color.
6509 0.01 matches only the exact key color, while 1.0 matches everything.
6514 0.0 makes pixels either fully transparent, or not transparent at all.
6516 Higher values result in semi-transparent pixels, with a higher transparency
6517 the more similar the pixels color is to the key color.
6520 @subsection Examples
6524 Make every green pixel in the input image transparent:
6526 ffmpeg -i input.png -vf colorkey=green out.png
6530 Overlay a greenscreen-video on top of a static background image.
6532 ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
6536 @section colorlevels
6538 Adjust video input frames using levels.
6540 The filter accepts the following options:
6547 Adjust red, green, blue and alpha input black point.
6548 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
6554 Adjust red, green, blue and alpha input white point.
6555 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
6557 Input levels are used to lighten highlights (bright tones), darken shadows
6558 (dark tones), change the balance of bright and dark tones.
6564 Adjust red, green, blue and alpha output black point.
6565 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
6571 Adjust red, green, blue and alpha output white point.
6572 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
6574 Output levels allows manual selection of a constrained output level range.
6577 @subsection Examples
6581 Make video output darker:
6583 colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
6589 colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
6593 Make video output lighter:
6595 colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
6599 Increase brightness:
6601 colorlevels=romin=0.5:gomin=0.5:bomin=0.5
6605 @section colorchannelmixer
6607 Adjust video input frames by re-mixing color channels.
6609 This filter modifies a color channel by adding the values associated to
6610 the other channels of the same pixels. For example if the value to
6611 modify is red, the output value will be:
6613 @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
6616 The filter accepts the following options:
6623 Adjust contribution of input red, green, blue and alpha channels for output red channel.
6624 Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
6630 Adjust contribution of input red, green, blue and alpha channels for output green channel.
6631 Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
6637 Adjust contribution of input red, green, blue and alpha channels for output blue channel.
6638 Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
6644 Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
6645 Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
6647 Allowed ranges for options are @code{[-2.0, 2.0]}.
6650 @subsection Examples
6654 Convert source to grayscale:
6656 colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
6659 Simulate sepia tones:
6661 colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
6665 @section colormatrix
6667 Convert color matrix.
6669 The filter accepts the following options:
6674 Specify the source and destination color matrix. Both values must be
6677 The accepted values are:
6705 For example to convert from BT.601 to SMPTE-240M, use the command:
6707 colormatrix=bt601:smpte240m
6712 Convert colorspace, transfer characteristics or color primaries.
6713 Input video needs to have an even size.
6715 The filter accepts the following options:
6720 Specify all color properties at once.
6722 The accepted values are:
6752 Specify output colorspace.
6754 The accepted values are:
6763 BT.470BG or BT.601-6 625
6766 SMPTE-170M or BT.601-6 525
6775 BT.2020 with non-constant luminance
6781 Specify output transfer characteristics.
6783 The accepted values are:
6795 Constant gamma of 2.2
6798 Constant gamma of 2.8
6801 SMPTE-170M, BT.601-6 625 or BT.601-6 525
6819 BT.2020 for 10-bits content
6822 BT.2020 for 12-bits content
6828 Specify output color primaries.
6830 The accepted values are:
6839 BT.470BG or BT.601-6 625
6842 SMPTE-170M or BT.601-6 525
6866 Specify output color range.
6868 The accepted values are:
6871 TV (restricted) range
6874 MPEG (restricted) range
6885 Specify output color format.
6887 The accepted values are:
6890 YUV 4:2:0 planar 8-bits
6893 YUV 4:2:0 planar 10-bits
6896 YUV 4:2:0 planar 12-bits
6899 YUV 4:2:2 planar 8-bits
6902 YUV 4:2:2 planar 10-bits
6905 YUV 4:2:2 planar 12-bits
6908 YUV 4:4:4 planar 8-bits
6911 YUV 4:4:4 planar 10-bits
6914 YUV 4:4:4 planar 12-bits
6919 Do a fast conversion, which skips gamma/primary correction. This will take
6920 significantly less CPU, but will be mathematically incorrect. To get output
6921 compatible with that produced by the colormatrix filter, use fast=1.
6924 Specify dithering mode.
6926 The accepted values are:
6932 Floyd-Steinberg dithering
6936 Whitepoint adaptation mode.
6938 The accepted values are:
6941 Bradford whitepoint adaptation
6944 von Kries whitepoint adaptation
6947 identity whitepoint adaptation (i.e. no whitepoint adaptation)
6951 Override all input properties at once. Same accepted values as @ref{all}.
6954 Override input colorspace. Same accepted values as @ref{space}.
6957 Override input color primaries. Same accepted values as @ref{primaries}.
6960 Override input transfer characteristics. Same accepted values as @ref{trc}.
6963 Override input color range. Same accepted values as @ref{range}.
6967 The filter converts the transfer characteristics, color space and color
6968 primaries to the specified user values. The output value, if not specified,
6969 is set to a default value based on the "all" property. If that property is
6970 also not specified, the filter will log an error. The output color range and
6971 format default to the same value as the input color range and format. The
6972 input transfer characteristics, color space, color primaries and color range
6973 should be set on the input data. If any of these are missing, the filter will
6974 log an error and no conversion will take place.
6976 For example to convert the input to SMPTE-240M, use the command:
6978 colorspace=smpte240m
6981 @section convolution
6983 Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
6985 The filter accepts the following options:
6992 Set matrix for each plane.
6993 Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
6994 and from 1 to 49 odd number of signed integers in @var{row} mode.
7000 Set multiplier for calculated value for each plane.
7001 If unset or 0, it will be sum of all matrix elements.
7007 Set bias for each plane. This value is added to the result of the multiplication.
7008 Useful for making the overall image brighter or darker. Default is 0.0.
7014 Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
7015 Default is @var{square}.
7018 @subsection Examples
7024 convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
7030 convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
7036 convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
7042 convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
7046 Apply laplacian edge detector which includes diagonals:
7048 convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
7054 convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
7060 Apply 2D convolution of video stream in frequency domain using second stream
7063 The filter accepts the following options:
7067 Set which planes to process.
7070 Set which impulse video frames will be processed, can be @var{first}
7071 or @var{all}. Default is @var{all}.
7074 The @code{convolve} filter also supports the @ref{framesync} options.
7078 Copy the input video source unchanged to the output. This is mainly useful for
7083 Video filtering on GPU using Apple's CoreImage API on OSX.
7085 Hardware acceleration is based on an OpenGL context. Usually, this means it is
7086 processed by video hardware. However, software-based OpenGL implementations
7087 exist which means there is no guarantee for hardware processing. It depends on
7090 There are many filters and image generators provided by Apple that come with a
7091 large variety of options. The filter has to be referenced by its name along
7094 The coreimage filter accepts the following options:
7097 List all available filters and generators along with all their respective
7098 options as well as possible minimum and maximum values along with the default
7105 Specify all filters by their respective name and options.
7106 Use @var{list_filters} to determine all valid filter names and options.
7107 Numerical options are specified by a float value and are automatically clamped
7108 to their respective value range. Vector and color options have to be specified
7109 by a list of space separated float values. Character escaping has to be done.
7110 A special option name @code{default} is available to use default options for a
7113 It is required to specify either @code{default} or at least one of the filter options.
7114 All omitted options are used with their default values.
7115 The syntax of the filter string is as follows:
7117 filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
7121 Specify a rectangle where the output of the filter chain is copied into the
7122 input image. It is given by a list of space separated float values:
7124 output_rect=x\ y\ width\ height
7126 If not given, the output rectangle equals the dimensions of the input image.
7127 The output rectangle is automatically cropped at the borders of the input
7128 image. Negative values are valid for each component.
7130 output_rect=25\ 25\ 100\ 100
7134 Several filters can be chained for successive processing without GPU-HOST
7135 transfers allowing for fast processing of complex filter chains.
7136 Currently, only filters with zero (generators) or exactly one (filters) input
7137 image and one output image are supported. Also, transition filters are not yet
7140 Some filters generate output images with additional padding depending on the
7141 respective filter kernel. The padding is automatically removed to ensure the
7142 filter output has the same size as the input image.
7144 For image generators, the size of the output image is determined by the
7145 previous output image of the filter chain or the input image of the whole
7146 filterchain, respectively. The generators do not use the pixel information of
7147 this image to generate their output. However, the generated output is
7148 blended onto this image, resulting in partial or complete coverage of the
7151 The @ref{coreimagesrc} video source can be used for generating input images
7152 which are directly fed into the filter chain. By using it, providing input
7153 images by another video source or an input video is not required.
7155 @subsection Examples
7160 List all filters available:
7162 coreimage=list_filters=true
7166 Use the CIBoxBlur filter with default options to blur an image:
7168 coreimage=filter=CIBoxBlur@@default
7172 Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
7173 its center at 100x100 and a radius of 50 pixels:
7175 coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
7179 Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
7180 given as complete and escaped command-line for Apple's standard bash shell:
7182 ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
7188 Crop the input video to given dimensions.
7190 It accepts the following parameters:
7194 The width of the output video. It defaults to @code{iw}.
7195 This expression is evaluated only once during the filter
7196 configuration, or when the @samp{w} or @samp{out_w} command is sent.
7199 The height of the output video. It defaults to @code{ih}.
7200 This expression is evaluated only once during the filter
7201 configuration, or when the @samp{h} or @samp{out_h} command is sent.
7204 The horizontal position, in the input video, of the left edge of the output
7205 video. It defaults to @code{(in_w-out_w)/2}.
7206 This expression is evaluated per-frame.
7209 The vertical position, in the input video, of the top edge of the output video.
7210 It defaults to @code{(in_h-out_h)/2}.
7211 This expression is evaluated per-frame.
7214 If set to 1 will force the output display aspect ratio
7215 to be the same of the input, by changing the output sample aspect
7216 ratio. It defaults to 0.
7219 Enable exact cropping. If enabled, subsampled videos will be cropped at exact
7220 width/height/x/y as specified and will not be rounded to nearest smaller value.
7224 The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
7225 expressions containing the following constants:
7230 The computed values for @var{x} and @var{y}. They are evaluated for
7235 The input width and height.
7239 These are the same as @var{in_w} and @var{in_h}.
7243 The output (cropped) width and height.
7247 These are the same as @var{out_w} and @var{out_h}.
7250 same as @var{iw} / @var{ih}
7253 input sample aspect ratio
7256 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
7260 horizontal and vertical chroma subsample values. For example for the
7261 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
7264 The number of the input frame, starting from 0.
7267 the position in the file of the input frame, NAN if unknown
7270 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
7274 The expression for @var{out_w} may depend on the value of @var{out_h},
7275 and the expression for @var{out_h} may depend on @var{out_w}, but they
7276 cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
7277 evaluated after @var{out_w} and @var{out_h}.
7279 The @var{x} and @var{y} parameters specify the expressions for the
7280 position of the top-left corner of the output (non-cropped) area. They
7281 are evaluated for each frame. If the evaluated value is not valid, it
7282 is approximated to the nearest valid value.
7284 The expression for @var{x} may depend on @var{y}, and the expression
7285 for @var{y} may depend on @var{x}.
7287 @subsection Examples
7291 Crop area with size 100x100 at position (12,34).
7296 Using named options, the example above becomes:
7298 crop=w=100:h=100:x=12:y=34
7302 Crop the central input area with size 100x100:
7308 Crop the central input area with size 2/3 of the input video:
7310 crop=2/3*in_w:2/3*in_h
7314 Crop the input video central square:
7321 Delimit the rectangle with the top-left corner placed at position
7322 100:100 and the right-bottom corner corresponding to the right-bottom
7323 corner of the input image.
7325 crop=in_w-100:in_h-100:100:100
7329 Crop 10 pixels from the left and right borders, and 20 pixels from
7330 the top and bottom borders
7332 crop=in_w-2*10:in_h-2*20
7336 Keep only the bottom right quarter of the input image:
7338 crop=in_w/2:in_h/2:in_w/2:in_h/2
7342 Crop height for getting Greek harmony:
7344 crop=in_w:1/PHI*in_w
7348 Apply trembling effect:
7350 crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
7354 Apply erratic camera effect depending on timestamp:
7356 crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
7360 Set x depending on the value of y:
7362 crop=in_w/2:in_h/2:y:10+10*sin(n/10)
7366 @subsection Commands
7368 This filter supports the following commands:
7374 Set width/height of the output video and the horizontal/vertical position
7376 The command accepts the same syntax of the corresponding option.
7378 If the specified expression is not valid, it is kept at its current
7384 Auto-detect the crop size.
7386 It calculates the necessary cropping parameters and prints the
7387 recommended parameters via the logging system. The detected dimensions
7388 correspond to the non-black area of the input video.
7390 It accepts the following parameters:
7395 Set higher black value threshold, which can be optionally specified
7396 from nothing (0) to everything (255 for 8-bit based formats). An intensity
7397 value greater to the set value is considered non-black. It defaults to 24.
7398 You can also specify a value between 0.0 and 1.0 which will be scaled depending
7399 on the bitdepth of the pixel format.
7402 The value which the width/height should be divisible by. It defaults to
7403 16. The offset is automatically adjusted to center the video. Use 2 to
7404 get only even dimensions (needed for 4:2:2 video). 16 is best when
7405 encoding to most video codecs.
7407 @item reset_count, reset
7408 Set the counter that determines after how many frames cropdetect will
7409 reset the previously detected largest video area and start over to
7410 detect the current optimal crop area. Default value is 0.
7412 This can be useful when channel logos distort the video area. 0
7413 indicates 'never reset', and returns the largest area encountered during
7420 Delay video filtering until a given wallclock timestamp. The filter first
7421 passes on @option{preroll} amount of frames, then it buffers at most
7422 @option{buffer} amount of frames and waits for the cue. After reaching the cue
7423 it forwards the buffered frames and also any subsequent frames coming in its
7426 The filter can be used synchronize the output of multiple ffmpeg processes for
7427 realtime output devices like decklink. By putting the delay in the filtering
7428 chain and pre-buffering frames the process can pass on data to output almost
7429 immediately after the target wallclock timestamp is reached.
7431 Perfect frame accuracy cannot be guaranteed, but the result is good enough for
7437 The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
7440 The duration of content to pass on as preroll expressed in seconds. Default is 0.
7443 The maximum duration of content to buffer before waiting for the cue expressed
7444 in seconds. Default is 0.
7451 Apply color adjustments using curves.
7453 This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
7454 component (red, green and blue) has its values defined by @var{N} key points
7455 tied from each other using a smooth curve. The x-axis represents the pixel
7456 values from the input frame, and the y-axis the new pixel values to be set for
7459 By default, a component curve is defined by the two points @var{(0;0)} and
7460 @var{(1;1)}. This creates a straight line where each original pixel value is
7461 "adjusted" to its own value, which means no change to the image.
7463 The filter allows you to redefine these two points and add some more. A new
7464 curve (using a natural cubic spline interpolation) will be define to pass
7465 smoothly through all these new coordinates. The new defined points needs to be
7466 strictly increasing over the x-axis, and their @var{x} and @var{y} values must
7467 be in the @var{[0;1]} interval. If the computed curves happened to go outside
7468 the vector spaces, the values will be clipped accordingly.
7470 The filter accepts the following options:
7474 Select one of the available color presets. This option can be used in addition
7475 to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
7476 options takes priority on the preset values.
7477 Available presets are:
7480 @item color_negative
7483 @item increase_contrast
7485 @item linear_contrast
7486 @item medium_contrast
7488 @item strong_contrast
7491 Default is @code{none}.
7493 Set the master key points. These points will define a second pass mapping. It
7494 is sometimes called a "luminance" or "value" mapping. It can be used with
7495 @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
7496 post-processing LUT.
7498 Set the key points for the red component.
7500 Set the key points for the green component.
7502 Set the key points for the blue component.
7504 Set the key points for all components (not including master).
7505 Can be used in addition to the other key points component
7506 options. In this case, the unset component(s) will fallback on this
7507 @option{all} setting.
7509 Specify a Photoshop curves file (@code{.acv}) to import the settings from.
7511 Save Gnuplot script of the curves in specified file.
7514 To avoid some filtergraph syntax conflicts, each key points list need to be
7515 defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
7517 @subsection Examples
7521 Increase slightly the middle level of blue:
7523 curves=blue='0/0 0.5/0.58 1/1'
7529 curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
7531 Here we obtain the following coordinates for each components:
7534 @code{(0;0.11) (0.42;0.51) (1;0.95)}
7536 @code{(0;0) (0.50;0.48) (1;1)}
7538 @code{(0;0.22) (0.49;0.44) (1;0.80)}
7542 The previous example can also be achieved with the associated built-in preset:
7544 curves=preset=vintage
7554 Use a Photoshop preset and redefine the points of the green component:
7556 curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
7560 Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
7561 and @command{gnuplot}:
7563 ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
7564 gnuplot -p /tmp/curves.plt
7570 Video data analysis filter.
7572 This filter shows hexadecimal pixel values of part of video.
7574 The filter accepts the following options:
7578 Set output video size.
7581 Set x offset from where to pick pixels.
7584 Set y offset from where to pick pixels.
7587 Set scope mode, can be one of the following:
7590 Draw hexadecimal pixel values with white color on black background.
7593 Draw hexadecimal pixel values with input video pixel color on black
7597 Draw hexadecimal pixel values on color background picked from input video,
7598 the text color is picked in such way so its always visible.
7602 Draw rows and columns numbers on left and top of video.
7605 Set background opacity.
7610 Denoise frames using 2D DCT (frequency domain filtering).
7612 This filter is not designed for real time.
7614 The filter accepts the following options:
7618 Set the noise sigma constant.
7620 This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
7621 coefficient (absolute value) below this threshold with be dropped.
7623 If you need a more advanced filtering, see @option{expr}.
7625 Default is @code{0}.
7628 Set number overlapping pixels for each block. Since the filter can be slow, you
7629 may want to reduce this value, at the cost of a less effective filter and the
7630 risk of various artefacts.
7632 If the overlapping value doesn't permit processing the whole input width or
7633 height, a warning will be displayed and according borders won't be denoised.
7635 Default value is @var{blocksize}-1, which is the best possible setting.
7638 Set the coefficient factor expression.
7640 For each coefficient of a DCT block, this expression will be evaluated as a
7641 multiplier value for the coefficient.
7643 If this is option is set, the @option{sigma} option will be ignored.
7645 The absolute value of the coefficient can be accessed through the @var{c}
7649 Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
7650 @var{blocksize}, which is the width and height of the processed blocks.
7652 The default value is @var{3} (8x8) and can be raised to @var{4} for a
7653 @var{blocksize} of 16x16. Note that changing this setting has huge consequences
7654 on the speed processing. Also, a larger block size does not necessarily means a
7658 @subsection Examples
7660 Apply a denoise with a @option{sigma} of @code{4.5}:
7665 The same operation can be achieved using the expression system:
7667 dctdnoiz=e='gte(c, 4.5*3)'
7670 Violent denoise using a block size of @code{16x16}:
7677 Remove banding artifacts from input video.
7678 It works by replacing banded pixels with average value of referenced pixels.
7680 The filter accepts the following options:
7687 Set banding detection threshold for each plane. Default is 0.02.
7688 Valid range is 0.00003 to 0.5.
7689 If difference between current pixel and reference pixel is less than threshold,
7690 it will be considered as banded.
7693 Banding detection range in pixels. Default is 16. If positive, random number
7694 in range 0 to set value will be used. If negative, exact absolute value
7696 The range defines square of four pixels around current pixel.
7699 Set direction in radians from which four pixel will be compared. If positive,
7700 random direction from 0 to set direction will be picked. If negative, exact of
7701 absolute value will be picked. For example direction 0, -PI or -2*PI radians
7702 will pick only pixels on same row and -PI/2 will pick only pixels on same
7706 If enabled, current pixel is compared with average value of all four
7707 surrounding pixels. The default is enabled. If disabled current pixel is
7708 compared with all four surrounding pixels. The pixel is considered banded
7709 if only all four differences with surrounding pixels are less than threshold.
7712 If enabled, current pixel is changed if and only if all pixel components are banded,
7713 e.g. banding detection threshold is triggered for all color components.
7714 The default is disabled.
7719 Remove blocking artifacts from input video.
7721 The filter accepts the following options:
7725 Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
7726 This controls what kind of deblocking is applied.
7729 Set size of block, allowed range is from 4 to 512. Default is @var{8}.
7735 Set blocking detection thresholds. Allowed range is 0 to 1.
7736 Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
7737 Using higher threshold gives more deblocking strength.
7738 Setting @var{alpha} controls threshold detection at exact edge of block.
7739 Remaining options controls threshold detection near the edge. Each one for
7740 below/above or left/right. Setting any of those to @var{0} disables
7744 Set planes to filter. Default is to filter all available planes.
7747 @subsection Examples
7751 Deblock using weak filter and block size of 4 pixels.
7753 deblock=filter=weak:block=4
7757 Deblock using strong filter, block size of 4 pixels and custom thresholds for
7758 deblocking more edges.
7760 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
7764 Similar as above, but filter only first plane.
7766 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
7770 Similar as above, but filter only second and third plane.
7772 deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
7779 Drop duplicated frames at regular intervals.
7781 The filter accepts the following options:
7785 Set the number of frames from which one will be dropped. Setting this to
7786 @var{N} means one frame in every batch of @var{N} frames will be dropped.
7787 Default is @code{5}.
7790 Set the threshold for duplicate detection. If the difference metric for a frame
7791 is less than or equal to this value, then it is declared as duplicate. Default
7795 Set scene change threshold. Default is @code{15}.
7799 Set the size of the x and y-axis blocks used during metric calculations.
7800 Larger blocks give better noise suppression, but also give worse detection of
7801 small movements. Must be a power of two. Default is @code{32}.
7804 Mark main input as a pre-processed input and activate clean source input
7805 stream. This allows the input to be pre-processed with various filters to help
7806 the metrics calculation while keeping the frame selection lossless. When set to
7807 @code{1}, the first stream is for the pre-processed input, and the second
7808 stream is the clean source from where the kept frames are chosen. Default is
7812 Set whether or not chroma is considered in the metric calculations. Default is
7818 Apply 2D deconvolution of video stream in frequency domain using second stream
7821 The filter accepts the following options:
7825 Set which planes to process.
7828 Set which impulse video frames will be processed, can be @var{first}
7829 or @var{all}. Default is @var{all}.
7832 Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
7833 and height are not same and not power of 2 or if stream prior to convolving
7837 The @code{deconvolve} filter also supports the @ref{framesync} options.
7841 Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
7843 It accepts the following options:
7847 Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
7848 @var{rainbows} for cross-color reduction.
7851 Set spatial luma threshold. Lower values increases reduction of cross-luminance.
7854 Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
7857 Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
7860 Set temporal chroma threshold. Lower values increases reduction of cross-color.
7865 Apply deflate effect to the video.
7867 This filter replaces the pixel by the local(3x3) average by taking into account
7868 only values lower than the pixel.
7870 It accepts the following options:
7877 Limit the maximum change for each plane, default is 65535.
7878 If 0, plane will remain unchanged.
7883 Remove temporal frame luminance variations.
7885 It accepts the following options:
7889 Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
7892 Set averaging mode to smooth temporal luminance variations.
7894 Available values are:
7919 Do not actually modify frame. Useful when one only wants metadata.
7924 Remove judder produced by partially interlaced telecined content.
7926 Judder can be introduced, for instance, by @ref{pullup} filter. If the original
7927 source was partially telecined content then the output of @code{pullup,dejudder}
7928 will have a variable frame rate. May change the recorded frame rate of the
7929 container. Aside from that change, this filter will not affect constant frame
7932 The option available in this filter is:
7936 Specify the length of the window over which the judder repeats.
7938 Accepts any integer greater than 1. Useful values are:
7942 If the original was telecined from 24 to 30 fps (Film to NTSC).
7945 If the original was telecined from 25 to 30 fps (PAL to NTSC).
7948 If a mixture of the two.
7951 The default is @samp{4}.
7956 Suppress a TV station logo by a simple interpolation of the surrounding
7957 pixels. Just set a rectangle covering the logo and watch it disappear
7958 (and sometimes something even uglier appear - your mileage may vary).
7960 It accepts the following parameters:
7965 Specify the top left corner coordinates of the logo. They must be
7970 Specify the width and height of the logo to clear. They must be
7974 Specify the thickness of the fuzzy edge of the rectangle (added to
7975 @var{w} and @var{h}). The default value is 1. This option is
7976 deprecated, setting higher values should no longer be necessary and
7980 When set to 1, a green rectangle is drawn on the screen to simplify
7981 finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
7982 The default value is 0.
7984 The rectangle is drawn on the outermost pixels which will be (partly)
7985 replaced with interpolated values. The values of the next pixels
7986 immediately outside this rectangle in each direction will be used to
7987 compute the interpolated pixel values inside the rectangle.
7991 @subsection Examples
7995 Set a rectangle covering the area with top left corner coordinates 0,0
7996 and size 100x77, and a band of size 10:
7998 delogo=x=0:y=0:w=100:h=77:band=10
8005 Attempt to fix small changes in horizontal and/or vertical shift. This
8006 filter helps remove camera shake from hand-holding a camera, bumping a
8007 tripod, moving on a vehicle, etc.
8009 The filter accepts the following options:
8017 Specify a rectangular area where to limit the search for motion
8019 If desired the search for motion vectors can be limited to a
8020 rectangular area of the frame defined by its top left corner, width
8021 and height. These parameters have the same meaning as the drawbox
8022 filter which can be used to visualise the position of the bounding
8025 This is useful when simultaneous movement of subjects within the frame
8026 might be confused for camera motion by the motion vector search.
8028 If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
8029 then the full frame is used. This allows later options to be set
8030 without specifying the bounding box for the motion vector search.
8032 Default - search the whole frame.
8036 Specify the maximum extent of movement in x and y directions in the
8037 range 0-64 pixels. Default 16.
8040 Specify how to generate pixels to fill blanks at the edge of the
8041 frame. Available values are:
8044 Fill zeroes at blank locations
8046 Original image at blank locations
8048 Extruded edge value at blank locations
8050 Mirrored edge at blank locations
8052 Default value is @samp{mirror}.
8055 Specify the blocksize to use for motion search. Range 4-128 pixels,
8059 Specify the contrast threshold for blocks. Only blocks with more than
8060 the specified contrast (difference between darkest and lightest
8061 pixels) will be considered. Range 1-255, default 125.
8064 Specify the search strategy. Available values are:
8067 Set exhaustive search
8069 Set less exhaustive search.
8071 Default value is @samp{exhaustive}.
8074 If set then a detailed log of the motion search is written to the
8081 Remove unwanted contamination of foreground colors, caused by reflected color of
8082 greenscreen or bluescreen.
8084 This filter accepts the following options:
8088 Set what type of despill to use.
8091 Set how spillmap will be generated.
8094 Set how much to get rid of still remaining spill.
8097 Controls amount of red in spill area.
8100 Controls amount of green in spill area.
8101 Should be -1 for greenscreen.
8104 Controls amount of blue in spill area.
8105 Should be -1 for bluescreen.
8108 Controls brightness of spill area, preserving colors.
8111 Modify alpha from generated spillmap.
8116 Apply an exact inverse of the telecine operation. It requires a predefined
8117 pattern specified using the pattern option which must be the same as that passed
8118 to the telecine filter.
8120 This filter accepts the following options:
8129 The default value is @code{top}.
8133 A string of numbers representing the pulldown pattern you wish to apply.
8134 The default value is @code{23}.
8137 A number representing position of the first frame with respect to the telecine
8138 pattern. This is to be used if the stream is cut. The default value is @code{0}.
8143 Apply dilation effect to the video.
8145 This filter replaces the pixel by the local(3x3) maximum.
8147 It accepts the following options:
8154 Limit the maximum change for each plane, default is 65535.
8155 If 0, plane will remain unchanged.
8158 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
8161 Flags to local 3x3 coordinates maps like this:
8170 Displace pixels as indicated by second and third input stream.
8172 It takes three input streams and outputs one stream, the first input is the
8173 source, and second and third input are displacement maps.
8175 The second input specifies how much to displace pixels along the
8176 x-axis, while the third input specifies how much to displace pixels
8178 If one of displacement map streams terminates, last frame from that
8179 displacement map will be used.
8181 Note that once generated, displacements maps can be reused over and over again.
8183 A description of the accepted options follows.
8187 Set displace behavior for pixels that are out of range.
8189 Available values are:
8192 Missing pixels are replaced by black pixels.
8195 Adjacent pixels will spread out to replace missing pixels.
8198 Out of range pixels are wrapped so they point to pixels of other side.
8201 Out of range pixels will be replaced with mirrored pixels.
8203 Default is @samp{smear}.
8207 @subsection Examples
8211 Add ripple effect to rgb input of video size hd720:
8213 ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
8217 Add wave effect to rgb input of video size hd720:
8219 ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
8225 Draw a colored box on the input image.
8227 It accepts the following parameters:
8232 The expressions which specify the top left corner coordinates of the box. It defaults to 0.
8236 The expressions which specify the width and height of the box; if 0 they are interpreted as
8237 the input width and height. It defaults to 0.
8240 Specify the color of the box to write. For the general syntax of this option,
8241 check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
8242 value @code{invert} is used, the box edge color is the same as the
8243 video with inverted luma.
8246 The expression which sets the thickness of the box edge.
8247 A value of @code{fill} will create a filled box. Default value is @code{3}.
8249 See below for the list of accepted constants.
8252 Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
8253 will overwrite the video's color and alpha pixels.
8254 Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
8257 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
8258 following constants:
8262 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
8266 horizontal and vertical chroma subsample values. For example for the
8267 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8271 The input width and height.
8274 The input sample aspect ratio.
8278 The x and y offset coordinates where the box is drawn.
8282 The width and height of the drawn box.
8285 The thickness of the drawn box.
8287 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
8288 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
8292 @subsection Examples
8296 Draw a black box around the edge of the input image:
8302 Draw a box with color red and an opacity of 50%:
8304 drawbox=10:20:200:60:red@@0.5
8307 The previous example can be specified as:
8309 drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
8313 Fill the box with pink color:
8315 drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
8319 Draw a 2-pixel red 2.40:1 mask:
8321 drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
8327 Draw a grid on the input image.
8329 It accepts the following parameters:
8334 The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
8338 The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
8339 input width and height, respectively, minus @code{thickness}, so image gets
8340 framed. Default to 0.
8343 Specify the color of the grid. For the general syntax of this option,
8344 check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
8345 value @code{invert} is used, the grid color is the same as the
8346 video with inverted luma.
8349 The expression which sets the thickness of the grid line. Default value is @code{1}.
8351 See below for the list of accepted constants.
8354 Applicable if the input has alpha. With @code{1} the pixels of the painted grid
8355 will overwrite the video's color and alpha pixels.
8356 Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
8359 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
8360 following constants:
8364 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
8368 horizontal and vertical chroma subsample values. For example for the
8369 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8373 The input grid cell width and height.
8376 The input sample aspect ratio.
8380 The x and y coordinates of some point of grid intersection (meant to configure offset).
8384 The width and height of the drawn cell.
8387 The thickness of the drawn cell.
8389 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
8390 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
8394 @subsection Examples
8398 Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
8400 drawgrid=width=100:height=100:thickness=2:color=red@@0.5
8404 Draw a white 3x3 grid with an opacity of 50%:
8406 drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
8413 Draw a text string or text from a specified file on top of a video, using the
8414 libfreetype library.
8416 To enable compilation of this filter, you need to configure FFmpeg with
8417 @code{--enable-libfreetype}.
8418 To enable default font fallback and the @var{font} option you need to
8419 configure FFmpeg with @code{--enable-libfontconfig}.
8420 To enable the @var{text_shaping} option, you need to configure FFmpeg with
8421 @code{--enable-libfribidi}.
8425 It accepts the following parameters:
8430 Used to draw a box around text using the background color.
8431 The value must be either 1 (enable) or 0 (disable).
8432 The default value of @var{box} is 0.
8435 Set the width of the border to be drawn around the box using @var{boxcolor}.
8436 The default value of @var{boxborderw} is 0.
8439 The color to be used for drawing box around text. For the syntax of this
8440 option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8442 The default value of @var{boxcolor} is "white".
8445 Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
8446 The default value of @var{line_spacing} is 0.
8449 Set the width of the border to be drawn around the text using @var{bordercolor}.
8450 The default value of @var{borderw} is 0.
8453 Set the color to be used for drawing border around text. For the syntax of this
8454 option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8456 The default value of @var{bordercolor} is "black".
8459 Select how the @var{text} is expanded. Can be either @code{none},
8460 @code{strftime} (deprecated) or
8461 @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
8465 Set a start time for the count. Value is in microseconds. Only applied
8466 in the deprecated strftime expansion mode. To emulate in normal expansion
8467 mode use the @code{pts} function, supplying the start time (in seconds)
8468 as the second argument.
8471 If true, check and fix text coords to avoid clipping.
8474 The color to be used for drawing fonts. For the syntax of this option, check
8475 the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
8477 The default value of @var{fontcolor} is "black".
8479 @item fontcolor_expr
8480 String which is expanded the same way as @var{text} to obtain dynamic
8481 @var{fontcolor} value. By default this option has empty value and is not
8482 processed. When this option is set, it overrides @var{fontcolor} option.
8485 The font family to be used for drawing text. By default Sans.
8488 The font file to be used for drawing text. The path must be included.
8489 This parameter is mandatory if the fontconfig support is disabled.
8492 Draw the text applying alpha blending. The value can
8493 be a number between 0.0 and 1.0.
8494 The expression accepts the same variables @var{x, y} as well.
8495 The default value is 1.
8496 Please see @var{fontcolor_expr}.
8499 The font size to be used for drawing text.
8500 The default value of @var{fontsize} is 16.
8503 If set to 1, attempt to shape the text (for example, reverse the order of
8504 right-to-left text and join Arabic characters) before drawing it.
8505 Otherwise, just draw the text exactly as given.
8506 By default 1 (if supported).
8509 The flags to be used for loading the fonts.
8511 The flags map the corresponding flags supported by libfreetype, and are
8512 a combination of the following values:
8519 @item vertical_layout
8520 @item force_autohint
8523 @item ignore_global_advance_width
8525 @item ignore_transform
8531 Default value is "default".
8533 For more information consult the documentation for the FT_LOAD_*
8537 The color to be used for drawing a shadow behind the drawn text. For the
8538 syntax of this option, check the @ref{color syntax,,"Color" section in the
8539 ffmpeg-utils manual,ffmpeg-utils}.
8541 The default value of @var{shadowcolor} is "black".
8545 The x and y offsets for the text shadow position with respect to the
8546 position of the text. They can be either positive or negative
8547 values. The default value for both is "0".
8550 The starting frame number for the n/frame_num variable. The default value
8554 The size in number of spaces to use for rendering the tab.
8558 Set the initial timecode representation in "hh:mm:ss[:;.]ff"
8559 format. It can be used with or without text parameter. @var{timecode_rate}
8560 option must be specified.
8562 @item timecode_rate, rate, r
8563 Set the timecode frame rate (timecode only). Value will be rounded to nearest
8564 integer. Minimum value is "1".
8565 Drop-frame timecode is supported for frame rates 30 & 60.
8568 If set to 1, the output of the timecode option will wrap around at 24 hours.
8569 Default is 0 (disabled).
8572 The text string to be drawn. The text must be a sequence of UTF-8
8574 This parameter is mandatory if no file is specified with the parameter
8578 A text file containing text to be drawn. The text must be a sequence
8579 of UTF-8 encoded characters.
8581 This parameter is mandatory if no text string is specified with the
8582 parameter @var{text}.
8584 If both @var{text} and @var{textfile} are specified, an error is thrown.
8587 If set to 1, the @var{textfile} will be reloaded before each frame.
8588 Be sure to update it atomically, or it may be read partially, or even fail.
8592 The expressions which specify the offsets where text will be drawn
8593 within the video frame. They are relative to the top/left border of the
8596 The default value of @var{x} and @var{y} is "0".
8598 See below for the list of accepted constants and functions.
8601 The parameters for @var{x} and @var{y} are expressions containing the
8602 following constants and functions:
8606 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
8610 horizontal and vertical chroma subsample values. For example for the
8611 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
8614 the height of each text line
8622 @item max_glyph_a, ascent
8623 the maximum distance from the baseline to the highest/upper grid
8624 coordinate used to place a glyph outline point, for all the rendered
8626 It is a positive value, due to the grid's orientation with the Y axis
8629 @item max_glyph_d, descent
8630 the maximum distance from the baseline to the lowest grid coordinate
8631 used to place a glyph outline point, for all the rendered glyphs.
8632 This is a negative value, due to the grid's orientation, with the Y axis
8636 maximum glyph height, that is the maximum height for all the glyphs
8637 contained in the rendered text, it is equivalent to @var{ascent} -
8641 maximum glyph width, that is the maximum width for all the glyphs
8642 contained in the rendered text
8645 the number of input frame, starting from 0
8647 @item rand(min, max)
8648 return a random number included between @var{min} and @var{max}
8651 The input sample aspect ratio.
8654 timestamp expressed in seconds, NAN if the input timestamp is unknown
8657 the height of the rendered text
8660 the width of the rendered text
8664 the x and y offset coordinates where the text is drawn.
8666 These parameters allow the @var{x} and @var{y} expressions to refer
8667 each other, so you can for example specify @code{y=x/dar}.
8670 @anchor{drawtext_expansion}
8671 @subsection Text expansion
8673 If @option{expansion} is set to @code{strftime},
8674 the filter recognizes strftime() sequences in the provided text and
8675 expands them accordingly. Check the documentation of strftime(). This
8676 feature is deprecated.
8678 If @option{expansion} is set to @code{none}, the text is printed verbatim.
8680 If @option{expansion} is set to @code{normal} (which is the default),
8681 the following expansion mechanism is used.
8683 The backslash character @samp{\}, followed by any character, always expands to
8684 the second character.
8686 Sequences of the form @code{%@{...@}} are expanded. The text between the
8687 braces is a function name, possibly followed by arguments separated by ':'.
8688 If the arguments contain special characters or delimiters (':' or '@}'),
8689 they should be escaped.
8691 Note that they probably must also be escaped as the value for the
8692 @option{text} option in the filter argument string and as the filter
8693 argument in the filtergraph description, and possibly also for the shell,
8694 that makes up to four levels of escaping; using a text file avoids these
8697 The following functions are available:
8702 The expression evaluation result.
8704 It must take one argument specifying the expression to be evaluated,
8705 which accepts the same constants and functions as the @var{x} and
8706 @var{y} values. Note that not all constants should be used, for
8707 example the text size is not known when evaluating the expression, so
8708 the constants @var{text_w} and @var{text_h} will have an undefined
8711 @item expr_int_format, eif
8712 Evaluate the expression's value and output as formatted integer.
8714 The first argument is the expression to be evaluated, just as for the @var{expr} function.
8715 The second argument specifies the output format. Allowed values are @samp{x},
8716 @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
8717 @code{printf} function.
8718 The third parameter is optional and sets the number of positions taken by the output.
8719 It can be used to add padding with zeros from the left.
8722 The time at which the filter is running, expressed in UTC.
8723 It can accept an argument: a strftime() format string.
8726 The time at which the filter is running, expressed in the local time zone.
8727 It can accept an argument: a strftime() format string.
8730 Frame metadata. Takes one or two arguments.
8732 The first argument is mandatory and specifies the metadata key.
8734 The second argument is optional and specifies a default value, used when the
8735 metadata key is not found or empty.
8738 The frame number, starting from 0.
8741 A 1 character description of the current picture type.
8744 The timestamp of the current frame.
8745 It can take up to three arguments.
8747 The first argument is the format of the timestamp; it defaults to @code{flt}
8748 for seconds as a decimal number with microsecond accuracy; @code{hms} stands
8749 for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
8750 @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
8751 @code{localtime} stands for the timestamp of the frame formatted as
8752 local time zone time.
8754 The second argument is an offset added to the timestamp.
8756 If the format is set to @code{hms}, a third argument @code{24HH} may be
8757 supplied to present the hour part of the formatted timestamp in 24h format
8760 If the format is set to @code{localtime} or @code{gmtime},
8761 a third argument may be supplied: a strftime() format string.
8762 By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
8765 @subsection Examples
8769 Draw "Test Text" with font FreeSerif, using the default values for the
8770 optional parameters.
8773 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
8777 Draw 'Test Text' with font FreeSerif of size 24 at position x=100
8778 and y=50 (counting from the top-left corner of the screen), text is
8779 yellow with a red box around it. Both the text and the box have an
8783 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
8784 x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
8787 Note that the double quotes are not necessary if spaces are not used
8788 within the parameter list.
8791 Show the text at the center of the video frame:
8793 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
8797 Show the text at a random position, switching to a new position every 30 seconds:
8799 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
8803 Show a text line sliding from right to left in the last row of the video
8804 frame. The file @file{LONG_LINE} is assumed to contain a single line
8807 drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
8811 Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
8813 drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
8817 Draw a single green letter "g", at the center of the input video.
8818 The glyph baseline is placed at half screen height.
8820 drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
8824 Show text for 1 second every 3 seconds:
8826 drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
8830 Use fontconfig to set the font. Note that the colons need to be escaped.
8832 drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
8836 Print the date of a real-time encoding (see strftime(3)):
8838 drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
8842 Show text fading in and out (appearing/disappearing):
8845 DS=1.0 # display start
8846 DE=10.0 # display end
8847 FID=1.5 # fade in duration
8848 FOD=5 # fade out duration
8849 ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%@{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 @}"
8853 Horizontally align multiple separate texts. Note that @option{max_glyph_a}
8854 and the @option{fontsize} value are included in the @option{y} offset.
8856 drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
8857 drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
8862 For more information about libfreetype, check:
8863 @url{http://www.freetype.org/}.
8865 For more information about fontconfig, check:
8866 @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
8868 For more information about libfribidi, check:
8869 @url{http://fribidi.org/}.
8873 Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
8875 The filter accepts the following options:
8880 Set low and high threshold values used by the Canny thresholding
8883 The high threshold selects the "strong" edge pixels, which are then
8884 connected through 8-connectivity with the "weak" edge pixels selected
8885 by the low threshold.
8887 @var{low} and @var{high} threshold values must be chosen in the range
8888 [0,1], and @var{low} should be lesser or equal to @var{high}.
8890 Default value for @var{low} is @code{20/255}, and default value for @var{high}
8894 Define the drawing mode.
8898 Draw white/gray wires on black background.
8901 Mix the colors to create a paint/cartoon effect.
8904 Apply Canny edge detector on all selected planes.
8906 Default value is @var{wires}.
8909 Select planes for filtering. By default all available planes are filtered.
8912 @subsection Examples
8916 Standard edge detection with custom values for the hysteresis thresholding:
8918 edgedetect=low=0.1:high=0.4
8922 Painting effect without thresholding:
8924 edgedetect=mode=colormix:high=0
8929 Set brightness, contrast, saturation and approximate gamma adjustment.
8931 The filter accepts the following options:
8935 Set the contrast expression. The value must be a float value in range
8936 @code{-2.0} to @code{2.0}. The default value is "1".
8939 Set the brightness expression. The value must be a float value in
8940 range @code{-1.0} to @code{1.0}. The default value is "0".
8943 Set the saturation expression. The value must be a float in
8944 range @code{0.0} to @code{3.0}. The default value is "1".
8947 Set the gamma expression. The value must be a float in range
8948 @code{0.1} to @code{10.0}. The default value is "1".
8951 Set the gamma expression for red. The value must be a float in
8952 range @code{0.1} to @code{10.0}. The default value is "1".
8955 Set the gamma expression for green. The value must be a float in range
8956 @code{0.1} to @code{10.0}. The default value is "1".
8959 Set the gamma expression for blue. The value must be a float in range
8960 @code{0.1} to @code{10.0}. The default value is "1".
8963 Set the gamma weight expression. It can be used to reduce the effect
8964 of a high gamma value on bright image areas, e.g. keep them from
8965 getting overamplified and just plain white. The value must be a float
8966 in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
8967 gamma correction all the way down while @code{1.0} leaves it at its
8968 full strength. Default is "1".
8971 Set when the expressions for brightness, contrast, saturation and
8972 gamma expressions are evaluated.
8974 It accepts the following values:
8977 only evaluate expressions once during the filter initialization or
8978 when a command is processed
8981 evaluate expressions for each incoming frame
8984 Default value is @samp{init}.
8987 The expressions accept the following parameters:
8990 frame count of the input frame starting from 0
8993 byte position of the corresponding packet in the input file, NAN if
8997 frame rate of the input video, NAN if the input frame rate is unknown
9000 timestamp expressed in seconds, NAN if the input timestamp is unknown
9003 @subsection Commands
9004 The filter supports the following commands:
9008 Set the contrast expression.
9011 Set the brightness expression.
9014 Set the saturation expression.
9017 Set the gamma expression.
9020 Set the gamma_r expression.
9023 Set gamma_g expression.
9026 Set gamma_b expression.
9029 Set gamma_weight expression.
9031 The command accepts the same syntax of the corresponding option.
9033 If the specified expression is not valid, it is kept at its current
9040 Apply erosion effect to the video.
9042 This filter replaces the pixel by the local(3x3) minimum.
9044 It accepts the following options:
9051 Limit the maximum change for each plane, default is 65535.
9052 If 0, plane will remain unchanged.
9055 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
9058 Flags to local 3x3 coordinates maps like this:
9065 @section extractplanes
9067 Extract color channel components from input video stream into
9068 separate grayscale video streams.
9070 The filter accepts the following option:
9074 Set plane(s) to extract.
9076 Available values for planes are:
9087 Choosing planes not available in the input will result in an error.
9088 That means you cannot select @code{r}, @code{g}, @code{b} planes
9089 with @code{y}, @code{u}, @code{v} planes at same time.
9092 @subsection Examples
9096 Extract luma, u and v color channel component from input video frame
9097 into 3 grayscale outputs:
9099 ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
9105 Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
9107 For each input image, the filter will compute the optimal mapping from
9108 the input to the output given the codebook length, that is the number
9109 of distinct output colors.
9111 This filter accepts the following options.
9114 @item codebook_length, l
9115 Set codebook length. The value must be a positive integer, and
9116 represents the number of distinct output colors. Default value is 256.
9119 Set the maximum number of iterations to apply for computing the optimal
9120 mapping. The higher the value the better the result and the higher the
9121 computation time. Default value is 1.
9124 Set a random seed, must be an integer included between 0 and
9125 UINT32_MAX. If not specified, or if explicitly set to -1, the filter
9126 will try to use a good random seed on a best effort basis.
9129 Set pal8 output pixel format. This option does not work with codebook
9130 length greater than 256.
9135 Measure graylevel entropy in histogram of color channels of video frames.
9137 It accepts the following parameters:
9141 Can be either @var{normal} or @var{diff}. Default is @var{normal}.
9143 @var{diff} mode measures entropy of histogram delta values, absolute differences
9144 between neighbour histogram values.
9149 Apply a fade-in/out effect to the input video.
9151 It accepts the following parameters:
9155 The effect type can be either "in" for a fade-in, or "out" for a fade-out
9157 Default is @code{in}.
9159 @item start_frame, s
9160 Specify the number of the frame to start applying the fade
9161 effect at. Default is 0.
9164 The number of frames that the fade effect lasts. At the end of the
9165 fade-in effect, the output video will have the same intensity as the input video.
9166 At the end of the fade-out transition, the output video will be filled with the
9167 selected @option{color}.
9171 If set to 1, fade only alpha channel, if one exists on the input.
9174 @item start_time, st
9175 Specify the timestamp (in seconds) of the frame to start to apply the fade
9176 effect. If both start_frame and start_time are specified, the fade will start at
9177 whichever comes last. Default is 0.
9180 The number of seconds for which the fade effect has to last. At the end of the
9181 fade-in effect the output video will have the same intensity as the input video,
9182 at the end of the fade-out transition the output video will be filled with the
9183 selected @option{color}.
9184 If both duration and nb_frames are specified, duration is used. Default is 0
9185 (nb_frames is used by default).
9188 Specify the color of the fade. Default is "black".
9191 @subsection Examples
9195 Fade in the first 30 frames of video:
9200 The command above is equivalent to:
9206 Fade out the last 45 frames of a 200-frame video:
9209 fade=type=out:start_frame=155:nb_frames=45
9213 Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
9215 fade=in:0:25, fade=out:975:25
9219 Make the first 5 frames yellow, then fade in from frame 5-24:
9221 fade=in:5:20:color=yellow
9225 Fade in alpha over first 25 frames of video:
9227 fade=in:0:25:alpha=1
9231 Make the first 5.5 seconds black, then fade in for 0.5 seconds:
9233 fade=t=in:st=5.5:d=0.5
9239 Apply arbitrary expressions to samples in frequency domain
9243 Adjust the dc value (gain) of the luma plane of the image. The filter
9244 accepts an integer value in range @code{0} to @code{1000}. The default
9245 value is set to @code{0}.
9248 Adjust the dc value (gain) of the 1st chroma plane of the image. The
9249 filter accepts an integer value in range @code{0} to @code{1000}. The
9250 default value is set to @code{0}.
9253 Adjust the dc value (gain) of the 2nd chroma plane of the image. The
9254 filter accepts an integer value in range @code{0} to @code{1000}. The
9255 default value is set to @code{0}.
9258 Set the frequency domain weight expression for the luma plane.
9261 Set the frequency domain weight expression for the 1st chroma plane.
9264 Set the frequency domain weight expression for the 2nd chroma plane.
9267 Set when the expressions are evaluated.
9269 It accepts the following values:
9272 Only evaluate expressions once during the filter initialization.
9275 Evaluate expressions for each incoming frame.
9278 Default value is @samp{init}.
9280 The filter accepts the following variables:
9283 The coordinates of the current sample.
9287 The width and height of the image.
9290 The number of input frame, starting from 0.
9293 @subsection Examples
9299 fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
9305 fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
9311 fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
9317 fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
9323 Denoise frames using 3D FFT (frequency domain filtering).
9325 The filter accepts the following options:
9329 Set the noise sigma constant. This sets denoising strength.
9330 Default value is 1. Allowed range is from 0 to 30.
9331 Using very high sigma with low overlap may give blocking artifacts.
9334 Set amount of denoising. By default all detected noise is reduced.
9335 Default value is 1. Allowed range is from 0 to 1.
9338 Set size of block, Default is 4, can be 3, 4, 5 or 6.
9339 Actual size of block in pixels is 2 to power of @var{block}, so by default
9340 block size in pixels is 2^4 which is 16.
9343 Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
9346 Set number of previous frames to use for denoising. By default is set to 0.
9349 Set number of next frames to to use for denoising. By default is set to 0.
9352 Set planes which will be filtered, by default are all available filtered
9358 Extract a single field from an interlaced image using stride
9359 arithmetic to avoid wasting CPU time. The output frames are marked as
9362 The filter accepts the following options:
9366 Specify whether to extract the top (if the value is @code{0} or
9367 @code{top}) or the bottom field (if the value is @code{1} or
9373 Create new frames by copying the top and bottom fields from surrounding frames
9374 supplied as numbers by the hint file.
9378 Set file containing hints: absolute/relative frame numbers.
9380 There must be one line for each frame in a clip. Each line must contain two
9381 numbers separated by the comma, optionally followed by @code{-} or @code{+}.
9382 Numbers supplied on each line of file can not be out of [N-1,N+1] where N
9383 is current frame number for @code{absolute} mode or out of [-1, 1] range
9384 for @code{relative} mode. First number tells from which frame to pick up top
9385 field and second number tells from which frame to pick up bottom field.
9387 If optionally followed by @code{+} output frame will be marked as interlaced,
9388 else if followed by @code{-} output frame will be marked as progressive, else
9389 it will be marked same as input frame.
9390 If line starts with @code{#} or @code{;} that line is skipped.
9393 Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
9396 Example of first several lines of @code{hint} file for @code{relative} mode:
9399 1,0 - # second frame, use third's frame top field and second's frame bottom field
9400 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
9417 Field matching filter for inverse telecine. It is meant to reconstruct the
9418 progressive frames from a telecined stream. The filter does not drop duplicated
9419 frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
9420 followed by a decimation filter such as @ref{decimate} in the filtergraph.
9422 The separation of the field matching and the decimation is notably motivated by
9423 the possibility of inserting a de-interlacing filter fallback between the two.
9424 If the source has mixed telecined and real interlaced content,
9425 @code{fieldmatch} will not be able to match fields for the interlaced parts.
9426 But these remaining combed frames will be marked as interlaced, and thus can be
9427 de-interlaced by a later filter such as @ref{yadif} before decimation.
9429 In addition to the various configuration options, @code{fieldmatch} can take an
9430 optional second stream, activated through the @option{ppsrc} option. If
9431 enabled, the frames reconstruction will be based on the fields and frames from
9432 this second stream. This allows the first input to be pre-processed in order to
9433 help the various algorithms of the filter, while keeping the output lossless
9434 (assuming the fields are matched properly). Typically, a field-aware denoiser,
9435 or brightness/contrast adjustments can help.
9437 Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
9438 and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
9439 which @code{fieldmatch} is based on. While the semantic and usage are very
9440 close, some behaviour and options names can differ.
9442 The @ref{decimate} filter currently only works for constant frame rate input.
9443 If your input has mixed telecined (30fps) and progressive content with a lower
9444 framerate like 24fps use the following filterchain to produce the necessary cfr
9445 stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
9447 The filter accepts the following options:
9451 Specify the assumed field order of the input stream. Available values are:
9455 Auto detect parity (use FFmpeg's internal parity value).
9457 Assume bottom field first.
9459 Assume top field first.
9462 Note that it is sometimes recommended not to trust the parity announced by the
9465 Default value is @var{auto}.
9468 Set the matching mode or strategy to use. @option{pc} mode is the safest in the
9469 sense that it won't risk creating jerkiness due to duplicate frames when
9470 possible, but if there are bad edits or blended fields it will end up
9471 outputting combed frames when a good match might actually exist. On the other
9472 hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
9473 but will almost always find a good frame if there is one. The other values are
9474 all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
9475 jerkiness and creating duplicate frames versus finding good matches in sections
9476 with bad edits, orphaned fields, blended fields, etc.
9478 More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
9480 Available values are:
9484 2-way matching (p/c)
9486 2-way matching, and trying 3rd match if still combed (p/c + n)
9488 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
9490 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
9491 still combed (p/c + n + u/b)
9493 3-way matching (p/c/n)
9495 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
9496 detected as combed (p/c/n + u/b)
9499 The parenthesis at the end indicate the matches that would be used for that
9500 mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
9503 In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
9506 Default value is @var{pc_n}.
9509 Mark the main input stream as a pre-processed input, and enable the secondary
9510 input stream as the clean source to pick the fields from. See the filter
9511 introduction for more details. It is similar to the @option{clip2} feature from
9514 Default value is @code{0} (disabled).
9517 Set the field to match from. It is recommended to set this to the same value as
9518 @option{order} unless you experience matching failures with that setting. In
9519 certain circumstances changing the field that is used to match from can have a
9520 large impact on matching performance. Available values are:
9524 Automatic (same value as @option{order}).
9526 Match from the bottom field.
9528 Match from the top field.
9531 Default value is @var{auto}.
9534 Set whether or not chroma is included during the match comparisons. In most
9535 cases it is recommended to leave this enabled. You should set this to @code{0}
9536 only if your clip has bad chroma problems such as heavy rainbowing or other
9537 artifacts. Setting this to @code{0} could also be used to speed things up at
9538 the cost of some accuracy.
9540 Default value is @code{1}.
9544 These define an exclusion band which excludes the lines between @option{y0} and
9545 @option{y1} from being included in the field matching decision. An exclusion
9546 band can be used to ignore subtitles, a logo, or other things that may
9547 interfere with the matching. @option{y0} sets the starting scan line and
9548 @option{y1} sets the ending line; all lines in between @option{y0} and
9549 @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
9550 @option{y0} and @option{y1} to the same value will disable the feature.
9551 @option{y0} and @option{y1} defaults to @code{0}.
9554 Set the scene change detection threshold as a percentage of maximum change on
9555 the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
9556 detection is only relevant in case @option{combmatch}=@var{sc}. The range for
9557 @option{scthresh} is @code{[0.0, 100.0]}.
9559 Default value is @code{12.0}.
9562 When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
9563 account the combed scores of matches when deciding what match to use as the
9564 final match. Available values are:
9568 No final matching based on combed scores.
9570 Combed scores are only used when a scene change is detected.
9572 Use combed scores all the time.
9575 Default is @var{sc}.
9578 Force @code{fieldmatch} to calculate the combed metrics for certain matches and
9579 print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
9580 Available values are:
9584 No forced calculation.
9586 Force p/c/n calculations.
9588 Force p/c/n/u/b calculations.
9591 Default value is @var{none}.
9594 This is the area combing threshold used for combed frame detection. This
9595 essentially controls how "strong" or "visible" combing must be to be detected.
9596 Larger values mean combing must be more visible and smaller values mean combing
9597 can be less visible or strong and still be detected. Valid settings are from
9598 @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
9599 be detected as combed). This is basically a pixel difference value. A good
9600 range is @code{[8, 12]}.
9602 Default value is @code{9}.
9605 Sets whether or not chroma is considered in the combed frame decision. Only
9606 disable this if your source has chroma problems (rainbowing, etc.) that are
9607 causing problems for the combed frame detection with chroma enabled. Actually,
9608 using @option{chroma}=@var{0} is usually more reliable, except for the case
9609 where there is chroma only combing in the source.
9611 Default value is @code{0}.
9615 Respectively set the x-axis and y-axis size of the window used during combed
9616 frame detection. This has to do with the size of the area in which
9617 @option{combpel} pixels are required to be detected as combed for a frame to be
9618 declared combed. See the @option{combpel} parameter description for more info.
9619 Possible values are any number that is a power of 2 starting at 4 and going up
9622 Default value is @code{16}.
9625 The number of combed pixels inside any of the @option{blocky} by
9626 @option{blockx} size blocks on the frame for the frame to be detected as
9627 combed. While @option{cthresh} controls how "visible" the combing must be, this
9628 setting controls "how much" combing there must be in any localized area (a
9629 window defined by the @option{blockx} and @option{blocky} settings) on the
9630 frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
9631 which point no frames will ever be detected as combed). This setting is known
9632 as @option{MI} in TFM/VFM vocabulary.
9634 Default value is @code{80}.
9637 @anchor{p/c/n/u/b meaning}
9638 @subsection p/c/n/u/b meaning
9640 @subsubsection p/c/n
9642 We assume the following telecined stream:
9645 Top fields: 1 2 2 3 4
9646 Bottom fields: 1 2 3 4 4
9649 The numbers correspond to the progressive frame the fields relate to. Here, the
9650 first two frames are progressive, the 3rd and 4th are combed, and so on.
9652 When @code{fieldmatch} is configured to run a matching from bottom
9653 (@option{field}=@var{bottom}) this is how this input stream get transformed:
9658 B 1 2 3 4 4 <-- matching reference
9667 As a result of the field matching, we can see that some frames get duplicated.
9668 To perform a complete inverse telecine, you need to rely on a decimation filter
9669 after this operation. See for instance the @ref{decimate} filter.
9671 The same operation now matching from top fields (@option{field}=@var{top})
9676 T 1 2 2 3 4 <-- matching reference
9686 In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
9687 basically, they refer to the frame and field of the opposite parity:
9690 @item @var{p} matches the field of the opposite parity in the previous frame
9691 @item @var{c} matches the field of the opposite parity in the current frame
9692 @item @var{n} matches the field of the opposite parity in the next frame
9697 The @var{u} and @var{b} matching are a bit special in the sense that they match
9698 from the opposite parity flag. In the following examples, we assume that we are
9699 currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
9700 'x' is placed above and below each matched fields.
9702 With bottom matching (@option{field}=@var{bottom}):
9707 Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
9708 Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
9716 With top matching (@option{field}=@var{top}):
9721 Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
9722 Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
9730 @subsection Examples
9732 Simple IVTC of a top field first telecined stream:
9734 fieldmatch=order=tff:combmatch=none, decimate
9737 Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
9739 fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
9744 Transform the field order of the input video.
9746 It accepts the following parameters:
9751 The output field order. Valid values are @var{tff} for top field first or @var{bff}
9752 for bottom field first.
9755 The default value is @samp{tff}.
9757 The transformation is done by shifting the picture content up or down
9758 by one line, and filling the remaining line with appropriate picture content.
9759 This method is consistent with most broadcast field order converters.
9761 If the input video is not flagged as being interlaced, or it is already
9762 flagged as being of the required output field order, then this filter does
9763 not alter the incoming video.
9765 It is very useful when converting to or from PAL DV material,
9766 which is bottom field first.
9770 ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
9773 @section fifo, afifo
9775 Buffer input images and send them when they are requested.
9777 It is mainly useful when auto-inserted by the libavfilter
9780 It does not take parameters.
9782 @section fillborders
9784 Fill borders of the input video, without changing video stream dimensions.
9785 Sometimes video can have garbage at the four edges and you may not want to
9786 crop video input to keep size multiple of some number.
9788 This filter accepts the following options:
9792 Number of pixels to fill from left border.
9795 Number of pixels to fill from right border.
9798 Number of pixels to fill from top border.
9801 Number of pixels to fill from bottom border.
9806 It accepts the following values:
9809 fill pixels using outermost pixels
9812 fill pixels using mirroring
9815 fill pixels with constant value
9818 Default is @var{smear}.
9821 Set color for pixels in fixed mode. Default is @var{black}.
9826 Find a rectangular object
9828 It accepts the following options:
9832 Filepath of the object image, needs to be in gray8.
9835 Detection threshold, default is 0.5.
9838 Number of mipmaps, default is 3.
9840 @item xmin, ymin, xmax, ymax
9841 Specifies the rectangle in which to search.
9844 @subsection Examples
9848 Generate a representative palette of a given video using @command{ffmpeg}:
9850 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
9856 Cover a rectangular object
9858 It accepts the following options:
9862 Filepath of the optional cover image, needs to be in yuv420.
9867 It accepts the following values:
9870 cover it by the supplied image
9872 cover it by interpolating the surrounding pixels
9875 Default value is @var{blur}.
9878 @subsection Examples
9882 Generate a representative palette of a given video using @command{ffmpeg}:
9884 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
9890 Flood area with values of same pixel components with another values.
9892 It accepts the following options:
9895 Set pixel x coordinate.
9898 Set pixel y coordinate.
9901 Set source #0 component value.
9904 Set source #1 component value.
9907 Set source #2 component value.
9910 Set source #3 component value.
9913 Set destination #0 component value.
9916 Set destination #1 component value.
9919 Set destination #2 component value.
9922 Set destination #3 component value.
9928 Convert the input video to one of the specified pixel formats.
9929 Libavfilter will try to pick one that is suitable as input to
9932 It accepts the following parameters:
9936 A '|'-separated list of pixel format names, such as
9937 "pix_fmts=yuv420p|monow|rgb24".
9941 @subsection Examples
9945 Convert the input video to the @var{yuv420p} format
9947 format=pix_fmts=yuv420p
9950 Convert the input video to any of the formats in the list
9952 format=pix_fmts=yuv420p|yuv444p|yuv410p
9959 Convert the video to specified constant frame rate by duplicating or dropping
9960 frames as necessary.
9962 It accepts the following parameters:
9966 The desired output frame rate. The default is @code{25}.
9969 Assume the first PTS should be the given value, in seconds. This allows for
9970 padding/trimming at the start of stream. By default, no assumption is made
9971 about the first frame's expected PTS, so no padding or trimming is done.
9972 For example, this could be set to 0 to pad the beginning with duplicates of
9973 the first frame if a video stream starts after the audio stream or to trim any
9974 frames with a negative PTS.
9977 Timestamp (PTS) rounding method.
9979 Possible values are:
9986 round towards -infinity
9988 round towards +infinity
9992 The default is @code{near}.
9995 Action performed when reading the last frame.
9997 Possible values are:
10000 Use same timestamp rounding method as used for other frames.
10002 Pass through last frame if input duration has not been reached yet.
10004 The default is @code{round}.
10008 Alternatively, the options can be specified as a flat string:
10009 @var{fps}[:@var{start_time}[:@var{round}]].
10011 See also the @ref{setpts} filter.
10013 @subsection Examples
10017 A typical usage in order to set the fps to 25:
10023 Sets the fps to 24, using abbreviation and rounding method to round to nearest:
10025 fps=fps=film:round=near
10031 Pack two different video streams into a stereoscopic video, setting proper
10032 metadata on supported codecs. The two views should have the same size and
10033 framerate and processing will stop when the shorter video ends. Please note
10034 that you may conveniently adjust view properties with the @ref{scale} and
10037 It accepts the following parameters:
10041 The desired packing format. Supported values are:
10046 The views are next to each other (default).
10049 The views are on top of each other.
10052 The views are packed by line.
10055 The views are packed by column.
10058 The views are temporally interleaved.
10067 # Convert left and right views into a frame-sequential video
10068 ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
10070 # Convert views into a side-by-side video with the same output resolution as the input
10071 ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
10076 Change the frame rate by interpolating new video output frames from the source
10079 This filter is not designed to function correctly with interlaced media. If
10080 you wish to change the frame rate of interlaced media then you are required
10081 to deinterlace before this filter and re-interlace after this filter.
10083 A description of the accepted options follows.
10087 Specify the output frames per second. This option can also be specified
10088 as a value alone. The default is @code{50}.
10091 Specify the start of a range where the output frame will be created as a
10092 linear interpolation of two frames. The range is [@code{0}-@code{255}],
10093 the default is @code{15}.
10096 Specify the end of a range where the output frame will be created as a
10097 linear interpolation of two frames. The range is [@code{0}-@code{255}],
10098 the default is @code{240}.
10101 Specify the level at which a scene change is detected as a value between
10102 0 and 100 to indicate a new scene; a low value reflects a low
10103 probability for the current frame to introduce a new scene, while a higher
10104 value means the current frame is more likely to be one.
10105 The default is @code{8.2}.
10108 Specify flags influencing the filter process.
10110 Available value for @var{flags} is:
10113 @item scene_change_detect, scd
10114 Enable scene change detection using the value of the option @var{scene}.
10115 This flag is enabled by default.
10121 Select one frame every N-th frame.
10123 This filter accepts the following option:
10126 Select frame after every @code{step} frames.
10127 Allowed values are positive integers higher than 0. Default value is @code{1}.
10130 @section freezedetect
10132 Detect frozen video.
10134 This filter logs a message and sets frame metadata when it detects that the
10135 input video has no significant change in content during a specified duration.
10136 Video freeze detection calculates the mean average absolute difference of all
10137 the components of video frames and compares it to a noise floor.
10139 The printed times and duration are expressed in seconds. The
10140 @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
10141 whose timestamp equals or exceeds the detection duration and it contains the
10142 timestamp of the first frame of the freeze. The
10143 @code{lavfi.freezedetect.freeze_duration} and
10144 @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
10147 The filter accepts the following options:
10151 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
10152 specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
10156 Set freeze duration until notification (default is 2 seconds).
10162 Apply a frei0r effect to the input video.
10164 To enable the compilation of this filter, you need to install the frei0r
10165 header and configure FFmpeg with @code{--enable-frei0r}.
10167 It accepts the following parameters:
10172 The name of the frei0r effect to load. If the environment variable
10173 @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
10174 directories specified by the colon-separated list in @env{FREI0R_PATH}.
10175 Otherwise, the standard frei0r paths are searched, in this order:
10176 @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
10177 @file{/usr/lib/frei0r-1/}.
10179 @item filter_params
10180 A '|'-separated list of parameters to pass to the frei0r effect.
10184 A frei0r effect parameter can be a boolean (its value is either
10185 "y" or "n"), a double, a color (specified as
10186 @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
10187 numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
10188 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
10189 a position (specified as @var{X}/@var{Y}, where
10190 @var{X} and @var{Y} are floating point numbers) and/or a string.
10192 The number and types of parameters depend on the loaded effect. If an
10193 effect parameter is not specified, the default value is set.
10195 @subsection Examples
10199 Apply the distort0r effect, setting the first two double parameters:
10201 frei0r=filter_name=distort0r:filter_params=0.5|0.01
10205 Apply the colordistance effect, taking a color as the first parameter:
10207 frei0r=colordistance:0.2/0.3/0.4
10208 frei0r=colordistance:violet
10209 frei0r=colordistance:0x112233
10213 Apply the perspective effect, specifying the top left and top right image
10216 frei0r=perspective:0.2/0.2|0.8/0.2
10220 For more information, see
10221 @url{http://frei0r.dyne.org}
10225 Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
10227 It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
10228 processing filter, one of them is performed once per block, not per pixel.
10229 This allows for much higher speed.
10231 The filter accepts the following options:
10235 Set quality. This option defines the number of levels for averaging. It accepts
10236 an integer in the range 4-5. Default value is @code{4}.
10239 Force a constant quantization parameter. It accepts an integer in range 0-63.
10240 If not set, the filter will use the QP from the video stream (if available).
10243 Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
10244 more details but also more artifacts, while higher values make the image smoother
10245 but also blurrier. Default value is @code{0} − PSNR optimal.
10247 @item use_bframe_qp
10248 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
10249 option may cause flicker since the B-Frames have often larger QP. Default is
10250 @code{0} (not enabled).
10256 Apply Gaussian blur filter.
10258 The filter accepts the following options:
10262 Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
10265 Set number of steps for Gaussian approximation. Defauls is @code{1}.
10268 Set which planes to filter. By default all planes are filtered.
10271 Set vertical sigma, if negative it will be same as @code{sigma}.
10272 Default is @code{-1}.
10277 Apply generic equation to each pixel.
10279 The filter accepts the following options:
10282 @item lum_expr, lum
10283 Set the luminance expression.
10285 Set the chrominance blue expression.
10287 Set the chrominance red expression.
10288 @item alpha_expr, a
10289 Set the alpha expression.
10291 Set the red expression.
10292 @item green_expr, g
10293 Set the green expression.
10295 Set the blue expression.
10298 The colorspace is selected according to the specified options. If one
10299 of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
10300 options is specified, the filter will automatically select a YCbCr
10301 colorspace. If one of the @option{red_expr}, @option{green_expr}, or
10302 @option{blue_expr} options is specified, it will select an RGB
10305 If one of the chrominance expression is not defined, it falls back on the other
10306 one. If no alpha expression is specified it will evaluate to opaque value.
10307 If none of chrominance expressions are specified, they will evaluate
10308 to the luminance expression.
10310 The expressions can use the following variables and functions:
10314 The sequential number of the filtered frame, starting from @code{0}.
10318 The coordinates of the current sample.
10322 The width and height of the image.
10326 Width and height scale depending on the currently filtered plane. It is the
10327 ratio between the corresponding luma plane number of pixels and the current
10328 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
10329 @code{0.5,0.5} for chroma planes.
10332 Time of the current frame, expressed in seconds.
10335 Return the value of the pixel at location (@var{x},@var{y}) of the current
10339 Return the value of the pixel at location (@var{x},@var{y}) of the luminance
10343 Return the value of the pixel at location (@var{x},@var{y}) of the
10344 blue-difference chroma plane. Return 0 if there is no such plane.
10347 Return the value of the pixel at location (@var{x},@var{y}) of the
10348 red-difference chroma plane. Return 0 if there is no such plane.
10353 Return the value of the pixel at location (@var{x},@var{y}) of the
10354 red/green/blue component. Return 0 if there is no such component.
10357 Return the value of the pixel at location (@var{x},@var{y}) of the alpha
10358 plane. Return 0 if there is no such plane.
10361 For functions, if @var{x} and @var{y} are outside the area, the value will be
10362 automatically clipped to the closer edge.
10364 @subsection Examples
10368 Flip the image horizontally:
10374 Generate a bidimensional sine wave, with angle @code{PI/3} and a
10375 wavelength of 100 pixels:
10377 geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
10381 Generate a fancy enigmatic moving light:
10383 nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
10387 Generate a quick emboss effect:
10389 format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
10393 Modify RGB components depending on pixel position:
10395 geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
10399 Create a radial gradient that is the same size as the input (also see
10400 the @ref{vignette} filter):
10402 geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
10408 Fix the banding artifacts that are sometimes introduced into nearly flat
10409 regions by truncation to 8-bit color depth.
10410 Interpolate the gradients that should go where the bands are, and
10413 It is designed for playback only. Do not use it prior to
10414 lossy compression, because compression tends to lose the dither and
10415 bring back the bands.
10417 It accepts the following parameters:
10422 The maximum amount by which the filter will change any one pixel. This is also
10423 the threshold for detecting nearly flat regions. Acceptable values range from
10424 .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
10428 The neighborhood to fit the gradient to. A larger radius makes for smoother
10429 gradients, but also prevents the filter from modifying the pixels near detailed
10430 regions. Acceptable values are 8-32; the default value is 16. Out-of-range
10431 values will be clipped to the valid range.
10435 Alternatively, the options can be specified as a flat string:
10436 @var{strength}[:@var{radius}]
10438 @subsection Examples
10442 Apply the filter with a @code{3.5} strength and radius of @code{8}:
10448 Specify radius, omitting the strength (which will fall-back to the default
10456 @section graphmonitor, agraphmonitor
10457 Show various filtergraph stats.
10459 With this filter one can debug complete filtergraph.
10460 Especially issues with links filling with queued frames.
10462 The filter accepts the following options:
10466 Set video output size. Default is @var{hd720}.
10469 Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
10472 Set output mode, can be @var{fulll} or @var{compact}.
10473 In @var{compact} mode only filters with some queued frames have displayed stats.
10476 Set flags which enable which stats are shown in video.
10478 Available values for flags are:
10481 Display number of queued frames in each link.
10483 @item frame_count_in
10484 Display number of frames taken from filter.
10486 @item frame_count_out
10487 Display number of frames given out from filter.
10490 Display current filtered frame pts.
10493 Display current filtered frame time.
10496 Display time base for filter link.
10499 Display used format for filter link.
10502 Display video size or number of audio channels in case of audio used by filter link.
10505 Display video frame rate or sample rate in case of audio used by filter link.
10509 Set upper limit for video rate of output stream, Default value is @var{25}.
10510 This guarantee that output video frame rate will not be higher than this value.
10514 A color constancy variation filter which estimates scene illumination via grey edge algorithm
10515 and corrects the scene colors accordingly.
10517 See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
10519 The filter accepts the following options:
10523 The order of differentiation to be applied on the scene. Must be chosen in the range
10524 [0,2] and default value is 1.
10527 The Minkowski parameter to be used for calculating the Minkowski distance. Must
10528 be chosen in the range [0,20] and default value is 1. Set to 0 for getting
10529 max value instead of calculating Minkowski distance.
10532 The standard deviation of Gaussian blur to be applied on the scene. Must be
10533 chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
10534 can't be euqal to 0 if @var{difford} is greater than 0.
10537 @subsection Examples
10543 greyedge=difford=1:minknorm=5:sigma=2
10549 greyedge=difford=1:minknorm=0:sigma=2
10557 Apply a Hald CLUT to a video stream.
10559 First input is the video stream to process, and second one is the Hald CLUT.
10560 The Hald CLUT input can be a simple picture or a complete video stream.
10562 The filter accepts the following options:
10566 Force termination when the shortest input terminates. Default is @code{0}.
10568 Continue applying the last CLUT after the end of the stream. A value of
10569 @code{0} disable the filter after the last frame of the CLUT is reached.
10570 Default is @code{1}.
10573 @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
10574 filters share the same internals).
10576 More information about the Hald CLUT can be found on Eskil Steenberg's website
10577 (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
10579 @subsection Workflow examples
10581 @subsubsection Hald CLUT video stream
10583 Generate an identity Hald CLUT stream altered with various effects:
10585 ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
10588 Note: make sure you use a lossless codec.
10590 Then use it with @code{haldclut} to apply it on some random stream:
10592 ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
10595 The Hald CLUT will be applied to the 10 first seconds (duration of
10596 @file{clut.nut}), then the latest picture of that CLUT stream will be applied
10597 to the remaining frames of the @code{mandelbrot} stream.
10599 @subsubsection Hald CLUT with preview
10601 A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
10602 @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
10603 biggest possible square starting at the top left of the picture. The remaining
10604 padding pixels (bottom or right) will be ignored. This area can be used to add
10605 a preview of the Hald CLUT.
10607 Typically, the following generated Hald CLUT will be supported by the
10608 @code{haldclut} filter:
10611 ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
10612 pad=iw+320 [padded_clut];
10613 smptebars=s=320x256, split [a][b];
10614 [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
10615 [main][b] overlay=W-320" -frames:v 1 clut.png
10618 It contains the original and a preview of the effect of the CLUT: SMPTE color
10619 bars are displayed on the right-top, and below the same color bars processed by
10622 Then, the effect of this Hald CLUT can be visualized with:
10624 ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
10629 Flip the input video horizontally.
10631 For example, to horizontally flip the input video with @command{ffmpeg}:
10633 ffmpeg -i in.avi -vf "hflip" out.avi
10637 This filter applies a global color histogram equalization on a
10640 It can be used to correct video that has a compressed range of pixel
10641 intensities. The filter redistributes the pixel intensities to
10642 equalize their distribution across the intensity range. It may be
10643 viewed as an "automatically adjusting contrast filter". This filter is
10644 useful only for correcting degraded or poorly captured source
10647 The filter accepts the following options:
10651 Determine the amount of equalization to be applied. As the strength
10652 is reduced, the distribution of pixel intensities more-and-more
10653 approaches that of the input frame. The value must be a float number
10654 in the range [0,1] and defaults to 0.200.
10657 Set the maximum intensity that can generated and scale the output
10658 values appropriately. The strength should be set as desired and then
10659 the intensity can be limited if needed to avoid washing-out. The value
10660 must be a float number in the range [0,1] and defaults to 0.210.
10663 Set the antibanding level. If enabled the filter will randomly vary
10664 the luminance of output pixels by a small amount to avoid banding of
10665 the histogram. Possible values are @code{none}, @code{weak} or
10666 @code{strong}. It defaults to @code{none}.
10671 Compute and draw a color distribution histogram for the input video.
10673 The computed histogram is a representation of the color component
10674 distribution in an image.
10676 Standard histogram displays the color components distribution in an image.
10677 Displays color graph for each color component. Shows distribution of
10678 the Y, U, V, A or R, G, B components, depending on input format, in the
10679 current frame. Below each graph a color component scale meter is shown.
10681 The filter accepts the following options:
10685 Set height of level. Default value is @code{200}.
10686 Allowed range is [50, 2048].
10689 Set height of color scale. Default value is @code{12}.
10690 Allowed range is [0, 40].
10694 It accepts the following values:
10697 Per color component graphs are placed below each other.
10700 Per color component graphs are placed side by side.
10703 Presents information identical to that in the @code{parade}, except
10704 that the graphs representing color components are superimposed directly
10707 Default is @code{stack}.
10710 Set mode. Can be either @code{linear}, or @code{logarithmic}.
10711 Default is @code{linear}.
10714 Set what color components to display.
10715 Default is @code{7}.
10718 Set foreground opacity. Default is @code{0.7}.
10721 Set background opacity. Default is @code{0.5}.
10724 @subsection Examples
10729 Calculate and draw histogram:
10731 ffplay -i input -vf histogram
10739 This is a high precision/quality 3d denoise filter. It aims to reduce
10740 image noise, producing smooth images and making still images really
10741 still. It should enhance compressibility.
10743 It accepts the following optional parameters:
10747 A non-negative floating point number which specifies spatial luma strength.
10748 It defaults to 4.0.
10750 @item chroma_spatial
10751 A non-negative floating point number which specifies spatial chroma strength.
10752 It defaults to 3.0*@var{luma_spatial}/4.0.
10755 A floating point number which specifies luma temporal strength. It defaults to
10756 6.0*@var{luma_spatial}/4.0.
10759 A floating point number which specifies chroma temporal strength. It defaults to
10760 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
10763 @anchor{hwdownload}
10764 @section hwdownload
10766 Download hardware frames to system memory.
10768 The input must be in hardware frames, and the output a non-hardware format.
10769 Not all formats will be supported on the output - it may be necessary to insert
10770 an additional @option{format} filter immediately following in the graph to get
10771 the output in a supported format.
10775 Map hardware frames to system memory or to another device.
10777 This filter has several different modes of operation; which one is used depends
10778 on the input and output formats:
10781 Hardware frame input, normal frame output
10783 Map the input frames to system memory and pass them to the output. If the
10784 original hardware frame is later required (for example, after overlaying
10785 something else on part of it), the @option{hwmap} filter can be used again
10786 in the next mode to retrieve it.
10788 Normal frame input, hardware frame output
10790 If the input is actually a software-mapped hardware frame, then unmap it -
10791 that is, return the original hardware frame.
10793 Otherwise, a device must be provided. Create new hardware surfaces on that
10794 device for the output, then map them back to the software format at the input
10795 and give those frames to the preceding filter. This will then act like the
10796 @option{hwupload} filter, but may be able to avoid an additional copy when
10797 the input is already in a compatible format.
10799 Hardware frame input and output
10801 A device must be supplied for the output, either directly or with the
10802 @option{derive_device} option. The input and output devices must be of
10803 different types and compatible - the exact meaning of this is
10804 system-dependent, but typically it means that they must refer to the same
10805 underlying hardware context (for example, refer to the same graphics card).
10807 If the input frames were originally created on the output device, then unmap
10808 to retrieve the original frames.
10810 Otherwise, map the frames to the output device - create new hardware frames
10811 on the output corresponding to the frames on the input.
10814 The following additional parameters are accepted:
10818 Set the frame mapping mode. Some combination of:
10821 The mapped frame should be readable.
10823 The mapped frame should be writeable.
10825 The mapping will always overwrite the entire frame.
10827 This may improve performance in some cases, as the original contents of the
10828 frame need not be loaded.
10830 The mapping must not involve any copying.
10832 Indirect mappings to copies of frames are created in some cases where either
10833 direct mapping is not possible or it would have unexpected properties.
10834 Setting this flag ensures that the mapping is direct and will fail if that is
10837 Defaults to @var{read+write} if not specified.
10839 @item derive_device @var{type}
10840 Rather than using the device supplied at initialisation, instead derive a new
10841 device of type @var{type} from the device the input frames exist on.
10844 In a hardware to hardware mapping, map in reverse - create frames in the sink
10845 and map them back to the source. This may be necessary in some cases where
10846 a mapping in one direction is required but only the opposite direction is
10847 supported by the devices being used.
10849 This option is dangerous - it may break the preceding filter in undefined
10850 ways if there are any additional constraints on that filter's output.
10851 Do not use it without fully understanding the implications of its use.
10857 Upload system memory frames to hardware surfaces.
10859 The device to upload to must be supplied when the filter is initialised. If
10860 using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
10863 @anchor{hwupload_cuda}
10864 @section hwupload_cuda
10866 Upload system memory frames to a CUDA device.
10868 It accepts the following optional parameters:
10872 The number of the CUDA device to use
10877 Apply a high-quality magnification filter designed for pixel art. This filter
10878 was originally created by Maxim Stepin.
10880 It accepts the following option:
10884 Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
10885 @code{hq3x} and @code{4} for @code{hq4x}.
10886 Default is @code{3}.
10890 Stack input videos horizontally.
10892 All streams must be of same pixel format and of same height.
10894 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
10895 to create same output.
10897 The filter accept the following option:
10901 Set number of input streams. Default is 2.
10904 If set to 1, force the output to terminate when the shortest input
10905 terminates. Default value is 0.
10910 Modify the hue and/or the saturation of the input.
10912 It accepts the following parameters:
10916 Specify the hue angle as a number of degrees. It accepts an expression,
10917 and defaults to "0".
10920 Specify the saturation in the [-10,10] range. It accepts an expression and
10924 Specify the hue angle as a number of radians. It accepts an
10925 expression, and defaults to "0".
10928 Specify the brightness in the [-10,10] range. It accepts an expression and
10932 @option{h} and @option{H} are mutually exclusive, and can't be
10933 specified at the same time.
10935 The @option{b}, @option{h}, @option{H} and @option{s} option values are
10936 expressions containing the following constants:
10940 frame count of the input frame starting from 0
10943 presentation timestamp of the input frame expressed in time base units
10946 frame rate of the input video, NAN if the input frame rate is unknown
10949 timestamp expressed in seconds, NAN if the input timestamp is unknown
10952 time base of the input video
10955 @subsection Examples
10959 Set the hue to 90 degrees and the saturation to 1.0:
10965 Same command but expressing the hue in radians:
10971 Rotate hue and make the saturation swing between 0
10972 and 2 over a period of 1 second:
10974 hue="H=2*PI*t: s=sin(2*PI*t)+1"
10978 Apply a 3 seconds saturation fade-in effect starting at 0:
10980 hue="s=min(t/3\,1)"
10983 The general fade-in expression can be written as:
10985 hue="s=min(0\, max((t-START)/DURATION\, 1))"
10989 Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
10991 hue="s=max(0\, min(1\, (8-t)/3))"
10994 The general fade-out expression can be written as:
10996 hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
11001 @subsection Commands
11003 This filter supports the following commands:
11009 Modify the hue and/or the saturation and/or brightness of the input video.
11010 The command accepts the same syntax of the corresponding option.
11012 If the specified expression is not valid, it is kept at its current
11016 @section hysteresis
11018 Grow first stream into second stream by connecting components.
11019 This makes it possible to build more robust edge masks.
11021 This filter accepts the following options:
11025 Set which planes will be processed as bitmap, unprocessed planes will be
11026 copied from first stream.
11027 By default value 0xf, all planes will be processed.
11030 Set threshold which is used in filtering. If pixel component value is higher than
11031 this value filter algorithm for connecting components is activated.
11032 By default value is 0.
11037 Detect video interlacing type.
11039 This filter tries to detect if the input frames are interlaced, progressive,
11040 top or bottom field first. It will also try to detect fields that are
11041 repeated between adjacent frames (a sign of telecine).
11043 Single frame detection considers only immediately adjacent frames when classifying each frame.
11044 Multiple frame detection incorporates the classification history of previous frames.
11046 The filter will log these metadata values:
11049 @item single.current_frame
11050 Detected type of current frame using single-frame detection. One of:
11051 ``tff'' (top field first), ``bff'' (bottom field first),
11052 ``progressive'', or ``undetermined''
11055 Cumulative number of frames detected as top field first using single-frame detection.
11058 Cumulative number of frames detected as top field first using multiple-frame detection.
11061 Cumulative number of frames detected as bottom field first using single-frame detection.
11063 @item multiple.current_frame
11064 Detected type of current frame using multiple-frame detection. One of:
11065 ``tff'' (top field first), ``bff'' (bottom field first),
11066 ``progressive'', or ``undetermined''
11069 Cumulative number of frames detected as bottom field first using multiple-frame detection.
11071 @item single.progressive
11072 Cumulative number of frames detected as progressive using single-frame detection.
11074 @item multiple.progressive
11075 Cumulative number of frames detected as progressive using multiple-frame detection.
11077 @item single.undetermined
11078 Cumulative number of frames that could not be classified using single-frame detection.
11080 @item multiple.undetermined
11081 Cumulative number of frames that could not be classified using multiple-frame detection.
11083 @item repeated.current_frame
11084 Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
11086 @item repeated.neither
11087 Cumulative number of frames with no repeated field.
11090 Cumulative number of frames with the top field repeated from the previous frame's top field.
11092 @item repeated.bottom
11093 Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
11096 The filter accepts the following options:
11100 Set interlacing threshold.
11102 Set progressive threshold.
11104 Threshold for repeated field detection.
11106 Number of frames after which a given frame's contribution to the
11107 statistics is halved (i.e., it contributes only 0.5 to its
11108 classification). The default of 0 means that all frames seen are given
11109 full weight of 1.0 forever.
11110 @item analyze_interlaced_flag
11111 When this is not 0 then idet will use the specified number of frames to determine
11112 if the interlaced flag is accurate, it will not count undetermined frames.
11113 If the flag is found to be accurate it will be used without any further
11114 computations, if it is found to be inaccurate it will be cleared without any
11115 further computations. This allows inserting the idet filter as a low computational
11116 method to clean up the interlaced flag
11121 Deinterleave or interleave fields.
11123 This filter allows one to process interlaced images fields without
11124 deinterlacing them. Deinterleaving splits the input frame into 2
11125 fields (so called half pictures). Odd lines are moved to the top
11126 half of the output image, even lines to the bottom half.
11127 You can process (filter) them independently and then re-interleave them.
11129 The filter accepts the following options:
11133 @item chroma_mode, c
11134 @item alpha_mode, a
11135 Available values for @var{luma_mode}, @var{chroma_mode} and
11136 @var{alpha_mode} are:
11142 @item deinterleave, d
11143 Deinterleave fields, placing one above the other.
11145 @item interleave, i
11146 Interleave fields. Reverse the effect of deinterleaving.
11148 Default value is @code{none}.
11150 @item luma_swap, ls
11151 @item chroma_swap, cs
11152 @item alpha_swap, as
11153 Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
11158 Apply inflate effect to the video.
11160 This filter replaces the pixel by the local(3x3) average by taking into account
11161 only values higher than the pixel.
11163 It accepts the following options:
11170 Limit the maximum change for each plane, default is 65535.
11171 If 0, plane will remain unchanged.
11176 Simple interlacing filter from progressive contents. This interleaves upper (or
11177 lower) lines from odd frames with lower (or upper) lines from even frames,
11178 halving the frame rate and preserving image height.
11181 Original Original New Frame
11182 Frame 'j' Frame 'j+1' (tff)
11183 ========== =========== ==================
11184 Line 0 --------------------> Frame 'j' Line 0
11185 Line 1 Line 1 ----> Frame 'j+1' Line 1
11186 Line 2 ---------------------> Frame 'j' Line 2
11187 Line 3 Line 3 ----> Frame 'j+1' Line 3
11189 New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
11192 It accepts the following optional parameters:
11196 This determines whether the interlaced frame is taken from the even
11197 (tff - default) or odd (bff) lines of the progressive frame.
11200 Vertical lowpass filter to avoid twitter interlacing and
11201 reduce moire patterns.
11205 Disable vertical lowpass filter
11208 Enable linear filter (default)
11211 Enable complex filter. This will slightly less reduce twitter and moire
11212 but better retain detail and subjective sharpness impression.
11219 Deinterlace input video by applying Donald Graft's adaptive kernel
11220 deinterling. Work on interlaced parts of a video to produce
11221 progressive frames.
11223 The description of the accepted parameters follows.
11227 Set the threshold which affects the filter's tolerance when
11228 determining if a pixel line must be processed. It must be an integer
11229 in the range [0,255] and defaults to 10. A value of 0 will result in
11230 applying the process on every pixels.
11233 Paint pixels exceeding the threshold value to white if set to 1.
11237 Set the fields order. Swap fields if set to 1, leave fields alone if
11241 Enable additional sharpening if set to 1. Default is 0.
11244 Enable twoway sharpening if set to 1. Default is 0.
11247 @subsection Examples
11251 Apply default values:
11253 kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
11257 Enable additional sharpening:
11263 Paint processed pixels in white:
11269 @section lenscorrection
11271 Correct radial lens distortion
11273 This filter can be used to correct for radial distortion as can result from the use
11274 of wide angle lenses, and thereby re-rectify the image. To find the right parameters
11275 one can use tools available for example as part of opencv or simply trial-and-error.
11276 To use opencv use the calibration sample (under samples/cpp) from the opencv sources
11277 and extract the k1 and k2 coefficients from the resulting matrix.
11279 Note that effectively the same filter is available in the open-source tools Krita and
11280 Digikam from the KDE project.
11282 In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
11283 this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
11284 brightness distribution, so you may want to use both filters together in certain
11285 cases, though you will have to take care of ordering, i.e. whether vignetting should
11286 be applied before or after lens correction.
11288 @subsection Options
11290 The filter accepts the following options:
11294 Relative x-coordinate of the focal point of the image, and thereby the center of the
11295 distortion. This value has a range [0,1] and is expressed as fractions of the image
11296 width. Default is 0.5.
11298 Relative y-coordinate of the focal point of the image, and thereby the center of the
11299 distortion. This value has a range [0,1] and is expressed as fractions of the image
11300 height. Default is 0.5.
11302 Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
11303 no correction. Default is 0.
11305 Coefficient of the double quadratic correction term. This value has a range [-1,1].
11306 0 means no correction. Default is 0.
11309 The formula that generates the correction is:
11311 @var{r_src} = @var{r_tgt} * (1 + @var{k1} * (@var{r_tgt} / @var{r_0})^2 + @var{k2} * (@var{r_tgt} / @var{r_0})^4)
11313 where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
11314 distances from the focal point in the source and target images, respectively.
11318 Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
11320 The @code{lensfun} filter requires the camera make, camera model, and lens model
11321 to apply the lens correction. The filter will load the lensfun database and
11322 query it to find the corresponding camera and lens entries in the database. As
11323 long as these entries can be found with the given options, the filter can
11324 perform corrections on frames. Note that incomplete strings will result in the
11325 filter choosing the best match with the given options, and the filter will
11326 output the chosen camera and lens models (logged with level "info"). You must
11327 provide the make, camera model, and lens model as they are required.
11329 The filter accepts the following options:
11333 The make of the camera (for example, "Canon"). This option is required.
11336 The model of the camera (for example, "Canon EOS 100D"). This option is
11340 The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
11341 option is required.
11344 The type of correction to apply. The following values are valid options:
11348 Enables fixing lens vignetting.
11351 Enables fixing lens geometry. This is the default.
11354 Enables fixing chromatic aberrations.
11357 Enables fixing lens vignetting and lens geometry.
11360 Enables fixing lens vignetting and chromatic aberrations.
11363 Enables fixing both lens geometry and chromatic aberrations.
11366 Enables all possible corrections.
11370 The focal length of the image/video (zoom; expected constant for video). For
11371 example, a 18--55mm lens has focal length range of [18--55], so a value in that
11372 range should be chosen when using that lens. Default 18.
11375 The aperture of the image/video (expected constant for video). Note that
11376 aperture is only used for vignetting correction. Default 3.5.
11378 @item focus_distance
11379 The focus distance of the image/video (expected constant for video). Note that
11380 focus distance is only used for vignetting and only slightly affects the
11381 vignetting correction process. If unknown, leave it at the default value (which
11384 @item target_geometry
11385 The target geometry of the output image/video. The following values are valid
11389 @item rectilinear (default)
11392 @item equirectangular
11393 @item fisheye_orthographic
11394 @item fisheye_stereographic
11395 @item fisheye_equisolid
11396 @item fisheye_thoby
11399 Apply the reverse of image correction (instead of correcting distortion, apply
11402 @item interpolation
11403 The type of interpolation used when correcting distortion. The following values
11408 @item linear (default)
11413 @subsection Examples
11417 Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
11418 model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
11422 ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov
11426 Apply the same as before, but only for the first 5 seconds of video.
11429 ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:enable='lte(t\,5)' -c:v h264 -b:v 8000k output.mov
11436 Obtain the VMAF (Video Multi-Method Assessment Fusion)
11437 score between two input videos.
11439 The obtained VMAF score is printed through the logging system.
11441 It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
11442 After installing the library it can be enabled using:
11443 @code{./configure --enable-libvmaf --enable-version3}.
11444 If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
11446 The filter has following options:
11450 Set the model path which is to be used for SVM.
11451 Default value: @code{"vmaf_v0.6.1.pkl"}
11454 Set the file path to be used to store logs.
11457 Set the format of the log file (xml or json).
11459 @item enable_transform
11460 This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
11461 if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
11462 Default value: @code{false}
11465 Invokes the phone model which will generate VMAF scores higher than in the
11466 regular model, which is more suitable for laptop, TV, etc. viewing conditions.
11469 Enables computing psnr along with vmaf.
11472 Enables computing ssim along with vmaf.
11475 Enables computing ms_ssim along with vmaf.
11478 Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
11481 Set number of threads to be used when computing vmaf.
11484 Set interval for frame subsampling used when computing vmaf.
11486 @item enable_conf_interval
11487 Enables confidence interval.
11490 This filter also supports the @ref{framesync} options.
11492 On the below examples the input file @file{main.mpg} being processed is
11493 compared with the reference file @file{ref.mpg}.
11496 ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
11499 Example with options:
11501 ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
11506 Limits the pixel components values to the specified range [min, max].
11508 The filter accepts the following options:
11512 Lower bound. Defaults to the lowest allowed value for the input.
11515 Upper bound. Defaults to the highest allowed value for the input.
11518 Specify which planes will be processed. Defaults to all available.
11525 The filter accepts the following options:
11529 Set the number of loops. Setting this value to -1 will result in infinite loops.
11533 Set maximal size in number of frames. Default is 0.
11536 Set first frame of loop. Default is 0.
11539 @subsection Examples
11543 Loop single first frame infinitely:
11545 loop=loop=-1:size=1:start=0
11549 Loop single first frame 10 times:
11551 loop=loop=10:size=1:start=0
11555 Loop 10 first frames 5 times:
11557 loop=loop=5:size=10:start=0
11563 Apply a 1D LUT to an input video.
11565 The filter accepts the following options:
11569 Set the 1D LUT file name.
11571 Currently supported formats:
11578 Select interpolation mode.
11580 Available values are:
11584 Use values from the nearest defined point.
11586 Interpolate values using the linear interpolation.
11588 Interpolate values using the cosine interpolation.
11590 Interpolate values using the cubic interpolation.
11592 Interpolate values using the spline interpolation.
11599 Apply a 3D LUT to an input video.
11601 The filter accepts the following options:
11605 Set the 3D LUT file name.
11607 Currently supported formats:
11619 Select interpolation mode.
11621 Available values are:
11625 Use values from the nearest defined point.
11627 Interpolate values using the 8 points defining a cube.
11629 Interpolate values using a tetrahedron.
11633 This filter also supports the @ref{framesync} options.
11637 Turn certain luma values into transparency.
11639 The filter accepts the following options:
11643 Set the luma which will be used as base for transparency.
11644 Default value is @code{0}.
11647 Set the range of luma values to be keyed out.
11648 Default value is @code{0}.
11651 Set the range of softness. Default value is @code{0}.
11652 Use this to control gradual transition from zero to full transparency.
11655 @section lut, lutrgb, lutyuv
11657 Compute a look-up table for binding each pixel component input value
11658 to an output value, and apply it to the input video.
11660 @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
11661 to an RGB input video.
11663 These filters accept the following parameters:
11666 set first pixel component expression
11668 set second pixel component expression
11670 set third pixel component expression
11672 set fourth pixel component expression, corresponds to the alpha component
11675 set red component expression
11677 set green component expression
11679 set blue component expression
11681 alpha component expression
11684 set Y/luminance component expression
11686 set U/Cb component expression
11688 set V/Cr component expression
11691 Each of them specifies the expression to use for computing the lookup table for
11692 the corresponding pixel component values.
11694 The exact component associated to each of the @var{c*} options depends on the
11697 The @var{lut} filter requires either YUV or RGB pixel formats in input,
11698 @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
11700 The expressions can contain the following constants and functions:
11705 The input width and height.
11708 The input value for the pixel component.
11711 The input value, clipped to the @var{minval}-@var{maxval} range.
11714 The maximum value for the pixel component.
11717 The minimum value for the pixel component.
11720 The negated value for the pixel component value, clipped to the
11721 @var{minval}-@var{maxval} range; it corresponds to the expression
11722 "maxval-clipval+minval".
11725 The computed value in @var{val}, clipped to the
11726 @var{minval}-@var{maxval} range.
11728 @item gammaval(gamma)
11729 The computed gamma correction value of the pixel component value,
11730 clipped to the @var{minval}-@var{maxval} range. It corresponds to the
11732 "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
11736 All expressions default to "val".
11738 @subsection Examples
11742 Negate input video:
11744 lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
11745 lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
11748 The above is the same as:
11750 lutrgb="r=negval:g=negval:b=negval"
11751 lutyuv="y=negval:u=negval:v=negval"
11761 Remove chroma components, turning the video into a graytone image:
11763 lutyuv="u=128:v=128"
11767 Apply a luma burning effect:
11773 Remove green and blue components:
11779 Set a constant alpha channel value on input:
11781 format=rgba,lutrgb=a="maxval-minval/2"
11785 Correct luminance gamma by a factor of 0.5:
11787 lutyuv=y=gammaval(0.5)
11791 Discard least significant bits of luma:
11793 lutyuv=y='bitand(val, 128+64+32)'
11797 Technicolor like effect:
11799 lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
11803 @section lut2, tlut2
11805 The @code{lut2} filter takes two input streams and outputs one
11808 The @code{tlut2} (time lut2) filter takes two consecutive frames
11809 from one single stream.
11811 This filter accepts the following parameters:
11814 set first pixel component expression
11816 set second pixel component expression
11818 set third pixel component expression
11820 set fourth pixel component expression, corresponds to the alpha component
11823 set output bit depth, only available for @code{lut2} filter. By default is 0,
11824 which means bit depth is automatically picked from first input format.
11827 Each of them specifies the expression to use for computing the lookup table for
11828 the corresponding pixel component values.
11830 The exact component associated to each of the @var{c*} options depends on the
11833 The expressions can contain the following constants:
11838 The input width and height.
11841 The first input value for the pixel component.
11844 The second input value for the pixel component.
11847 The first input video bit depth.
11850 The second input video bit depth.
11853 All expressions default to "x".
11855 @subsection Examples
11859 Highlight differences between two RGB video streams:
11861 lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
11865 Highlight differences between two YUV video streams:
11867 lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
11871 Show max difference between two video streams:
11873 lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
11877 @section maskedclamp
11879 Clamp the first input stream with the second input and third input stream.
11881 Returns the value of first stream to be between second input
11882 stream - @code{undershoot} and third input stream + @code{overshoot}.
11884 This filter accepts the following options:
11887 Default value is @code{0}.
11890 Default value is @code{0}.
11893 Set which planes will be processed as bitmap, unprocessed planes will be
11894 copied from first stream.
11895 By default value 0xf, all planes will be processed.
11898 @section maskedmerge
11900 Merge the first input stream with the second input stream using per pixel
11901 weights in the third input stream.
11903 A value of 0 in the third stream pixel component means that pixel component
11904 from first stream is returned unchanged, while maximum value (eg. 255 for
11905 8-bit videos) means that pixel component from second stream is returned
11906 unchanged. Intermediate values define the amount of merging between both
11907 input stream's pixel components.
11909 This filter accepts the following options:
11912 Set which planes will be processed as bitmap, unprocessed planes will be
11913 copied from first stream.
11914 By default value 0xf, all planes will be processed.
11919 Apply motion-compensation deinterlacing.
11921 It needs one field per frame as input and must thus be used together
11922 with yadif=1/3 or equivalent.
11924 This filter accepts the following options:
11927 Set the deinterlacing mode.
11929 It accepts one of the following values:
11934 use iterative motion estimation
11936 like @samp{slow}, but use multiple reference frames.
11938 Default value is @samp{fast}.
11941 Set the picture field parity assumed for the input video. It must be
11942 one of the following values:
11946 assume top field first
11948 assume bottom field first
11951 Default value is @samp{bff}.
11954 Set per-block quantization parameter (QP) used by the internal
11957 Higher values should result in a smoother motion vector field but less
11958 optimal individual vectors. Default value is 1.
11961 @section mergeplanes
11963 Merge color channel components from several video streams.
11965 The filter accepts up to 4 input streams, and merge selected input
11966 planes to the output video.
11968 This filter accepts the following options:
11971 Set input to output plane mapping. Default is @code{0}.
11973 The mappings is specified as a bitmap. It should be specified as a
11974 hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
11975 mapping for the first plane of the output stream. 'A' sets the number of
11976 the input stream to use (from 0 to 3), and 'a' the plane number of the
11977 corresponding input to use (from 0 to 3). The rest of the mappings is
11978 similar, 'Bb' describes the mapping for the output stream second
11979 plane, 'Cc' describes the mapping for the output stream third plane and
11980 'Dd' describes the mapping for the output stream fourth plane.
11983 Set output pixel format. Default is @code{yuva444p}.
11986 @subsection Examples
11990 Merge three gray video streams of same width and height into single video stream:
11992 [a0][a1][a2]mergeplanes=0x001020:yuv444p
11996 Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
11998 [a0][a1]mergeplanes=0x00010210:yuva444p
12002 Swap Y and A plane in yuva444p stream:
12004 format=yuva444p,mergeplanes=0x03010200:yuva444p
12008 Swap U and V plane in yuv420p stream:
12010 format=yuv420p,mergeplanes=0x000201:yuv420p
12014 Cast a rgb24 clip to yuv444p:
12016 format=rgb24,mergeplanes=0x000102:yuv444p
12022 Estimate and export motion vectors using block matching algorithms.
12023 Motion vectors are stored in frame side data to be used by other filters.
12025 This filter accepts the following options:
12028 Specify the motion estimation method. Accepts one of the following values:
12032 Exhaustive search algorithm.
12034 Three step search algorithm.
12036 Two dimensional logarithmic search algorithm.
12038 New three step search algorithm.
12040 Four step search algorithm.
12042 Diamond search algorithm.
12044 Hexagon-based search algorithm.
12046 Enhanced predictive zonal search algorithm.
12048 Uneven multi-hexagon search algorithm.
12050 Default value is @samp{esa}.
12053 Macroblock size. Default @code{16}.
12056 Search parameter. Default @code{7}.
12059 @section midequalizer
12061 Apply Midway Image Equalization effect using two video streams.
12063 Midway Image Equalization adjusts a pair of images to have the same
12064 histogram, while maintaining their dynamics as much as possible. It's
12065 useful for e.g. matching exposures from a pair of stereo cameras.
12067 This filter has two inputs and one output, which must be of same pixel format, but
12068 may be of different sizes. The output of filter is first input adjusted with
12069 midway histogram of both inputs.
12071 This filter accepts the following option:
12075 Set which planes to process. Default is @code{15}, which is all available planes.
12078 @section minterpolate
12080 Convert the video to specified frame rate using motion interpolation.
12082 This filter accepts the following options:
12085 Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
12088 Motion interpolation mode. Following values are accepted:
12091 Duplicate previous or next frame for interpolating new ones.
12093 Blend source frames. Interpolated frame is mean of previous and next frames.
12095 Motion compensated interpolation. Following options are effective when this mode is selected:
12099 Motion compensation mode. Following values are accepted:
12102 Overlapped block motion compensation.
12104 Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
12106 Default mode is @samp{obmc}.
12109 Motion estimation mode. Following values are accepted:
12112 Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
12114 Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
12116 Default mode is @samp{bilat}.
12119 The algorithm to be used for motion estimation. Following values are accepted:
12122 Exhaustive search algorithm.
12124 Three step search algorithm.
12126 Two dimensional logarithmic search algorithm.
12128 New three step search algorithm.
12130 Four step search algorithm.
12132 Diamond search algorithm.
12134 Hexagon-based search algorithm.
12136 Enhanced predictive zonal search algorithm.
12138 Uneven multi-hexagon search algorithm.
12140 Default algorithm is @samp{epzs}.
12143 Macroblock size. Default @code{16}.
12146 Motion estimation search parameter. Default @code{32}.
12149 Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
12154 Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
12157 Disable scene change detection.
12159 Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
12161 Default method is @samp{fdiff}.
12163 @item scd_threshold
12164 Scene change detection threshold. Default is @code{5.0}.
12169 Mix several video input streams into one video stream.
12171 A description of the accepted options follows.
12175 The number of inputs. If unspecified, it defaults to 2.
12178 Specify weight of each input video stream as sequence.
12179 Each weight is separated by space. If number of weights
12180 is smaller than number of @var{frames} last specified
12181 weight will be used for all remaining unset weights.
12184 Specify scale, if it is set it will be multiplied with sum
12185 of each weight multiplied with pixel values to give final destination
12186 pixel value. By default @var{scale} is auto scaled to sum of weights.
12189 Specify how end of stream is determined.
12192 The duration of the longest input. (default)
12195 The duration of the shortest input.
12198 The duration of the first input.
12202 @section mpdecimate
12204 Drop frames that do not differ greatly from the previous frame in
12205 order to reduce frame rate.
12207 The main use of this filter is for very-low-bitrate encoding
12208 (e.g. streaming over dialup modem), but it could in theory be used for
12209 fixing movies that were inverse-telecined incorrectly.
12211 A description of the accepted options follows.
12215 Set the maximum number of consecutive frames which can be dropped (if
12216 positive), or the minimum interval between dropped frames (if
12217 negative). If the value is 0, the frame is dropped disregarding the
12218 number of previous sequentially dropped frames.
12220 Default value is 0.
12225 Set the dropping threshold values.
12227 Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
12228 represent actual pixel value differences, so a threshold of 64
12229 corresponds to 1 unit of difference for each pixel, or the same spread
12230 out differently over the block.
12232 A frame is a candidate for dropping if no 8x8 blocks differ by more
12233 than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
12234 meaning the whole image) differ by more than a threshold of @option{lo}.
12236 Default value for @option{hi} is 64*12, default value for @option{lo} is
12237 64*5, and default value for @option{frac} is 0.33.
12243 Negate (invert) the input video.
12245 It accepts the following option:
12250 With value 1, it negates the alpha component, if present. Default value is 0.
12256 Denoise frames using Non-Local Means algorithm.
12258 Each pixel is adjusted by looking for other pixels with similar contexts. This
12259 context similarity is defined by comparing their surrounding patches of size
12260 @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
12263 Note that the research area defines centers for patches, which means some
12264 patches will be made of pixels outside that research area.
12266 The filter accepts the following options.
12270 Set denoising strength.
12276 Same as @option{p} but for chroma planes.
12278 The default value is @var{0} and means automatic.
12284 Same as @option{r} but for chroma planes.
12286 The default value is @var{0} and means automatic.
12291 Deinterlace video using neural network edge directed interpolation.
12293 This filter accepts the following options:
12297 Mandatory option, without binary file filter can not work.
12298 Currently file can be found here:
12299 https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
12302 Set which frames to deinterlace, by default it is @code{all}.
12303 Can be @code{all} or @code{interlaced}.
12306 Set mode of operation.
12308 Can be one of the following:
12312 Use frame flags, both fields.
12314 Use frame flags, single field.
12316 Use top field only.
12318 Use bottom field only.
12320 Use both fields, top first.
12322 Use both fields, bottom first.
12326 Set which planes to process, by default filter process all frames.
12329 Set size of local neighborhood around each pixel, used by the predictor neural
12332 Can be one of the following:
12345 Set the number of neurons in predictor neural network.
12346 Can be one of the following:
12357 Controls the number of different neural network predictions that are blended
12358 together to compute the final output value. Can be @code{fast}, default or
12362 Set which set of weights to use in the predictor.
12363 Can be one of the following:
12367 weights trained to minimize absolute error
12369 weights trained to minimize squared error
12373 Controls whether or not the prescreener neural network is used to decide
12374 which pixels should be processed by the predictor neural network and which
12375 can be handled by simple cubic interpolation.
12376 The prescreener is trained to know whether cubic interpolation will be
12377 sufficient for a pixel or whether it should be predicted by the predictor nn.
12378 The computational complexity of the prescreener nn is much less than that of
12379 the predictor nn. Since most pixels can be handled by cubic interpolation,
12380 using the prescreener generally results in much faster processing.
12381 The prescreener is pretty accurate, so the difference between using it and not
12382 using it is almost always unnoticeable.
12384 Can be one of the following:
12392 Default is @code{new}.
12395 Set various debugging flags.
12400 Force libavfilter not to use any of the specified pixel formats for the
12401 input to the next filter.
12403 It accepts the following parameters:
12407 A '|'-separated list of pixel format names, such as
12408 pix_fmts=yuv420p|monow|rgb24".
12412 @subsection Examples
12416 Force libavfilter to use a format different from @var{yuv420p} for the
12417 input to the vflip filter:
12419 noformat=pix_fmts=yuv420p,vflip
12423 Convert the input video to any of the formats not contained in the list:
12425 noformat=yuv420p|yuv444p|yuv410p
12431 Add noise on video input frame.
12433 The filter accepts the following options:
12441 Set noise seed for specific pixel component or all pixel components in case
12442 of @var{all_seed}. Default value is @code{123457}.
12444 @item all_strength, alls
12445 @item c0_strength, c0s
12446 @item c1_strength, c1s
12447 @item c2_strength, c2s
12448 @item c3_strength, c3s
12449 Set noise strength for specific pixel component or all pixel components in case
12450 @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
12452 @item all_flags, allf
12453 @item c0_flags, c0f
12454 @item c1_flags, c1f
12455 @item c2_flags, c2f
12456 @item c3_flags, c3f
12457 Set pixel component flags or set flags for all components if @var{all_flags}.
12458 Available values for component flags are:
12461 averaged temporal noise (smoother)
12463 mix random noise with a (semi)regular pattern
12465 temporal noise (noise pattern changes between frames)
12467 uniform noise (gaussian otherwise)
12471 @subsection Examples
12473 Add temporal and uniform noise to input video:
12475 noise=alls=20:allf=t+u
12480 Normalize RGB video (aka histogram stretching, contrast stretching).
12481 See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
12483 For each channel of each frame, the filter computes the input range and maps
12484 it linearly to the user-specified output range. The output range defaults
12485 to the full dynamic range from pure black to pure white.
12487 Temporal smoothing can be used on the input range to reduce flickering (rapid
12488 changes in brightness) caused when small dark or bright objects enter or leave
12489 the scene. This is similar to the auto-exposure (automatic gain control) on a
12490 video camera, and, like a video camera, it may cause a period of over- or
12491 under-exposure of the video.
12493 The R,G,B channels can be normalized independently, which may cause some
12494 color shifting, or linked together as a single channel, which prevents
12495 color shifting. Linked normalization preserves hue. Independent normalization
12496 does not, so it can be used to remove some color casts. Independent and linked
12497 normalization can be combined in any ratio.
12499 The normalize filter accepts the following options:
12504 Colors which define the output range. The minimum input value is mapped to
12505 the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
12506 The defaults are black and white respectively. Specifying white for
12507 @var{blackpt} and black for @var{whitept} will give color-inverted,
12508 normalized video. Shades of grey can be used to reduce the dynamic range
12509 (contrast). Specifying saturated colors here can create some interesting
12513 The number of previous frames to use for temporal smoothing. The input range
12514 of each channel is smoothed using a rolling average over the current frame
12515 and the @var{smoothing} previous frames. The default is 0 (no temporal
12519 Controls the ratio of independent (color shifting) channel normalization to
12520 linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
12521 independent. Defaults to 1.0 (fully independent).
12524 Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
12525 expensive no-op. Defaults to 1.0 (full strength).
12529 @subsection Examples
12531 Stretch video contrast to use the full dynamic range, with no temporal
12532 smoothing; may flicker depending on the source content:
12534 normalize=blackpt=black:whitept=white:smoothing=0
12537 As above, but with 50 frames of temporal smoothing; flicker should be
12538 reduced, depending on the source content:
12540 normalize=blackpt=black:whitept=white:smoothing=50
12543 As above, but with hue-preserving linked channel normalization:
12545 normalize=blackpt=black:whitept=white:smoothing=50:independence=0
12548 As above, but with half strength:
12550 normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
12553 Map the darkest input color to red, the brightest input color to cyan:
12555 normalize=blackpt=red:whitept=cyan
12560 Pass the video source unchanged to the output.
12563 Optical Character Recognition
12565 This filter uses Tesseract for optical character recognition. To enable
12566 compilation of this filter, you need to configure FFmpeg with
12567 @code{--enable-libtesseract}.
12569 It accepts the following options:
12573 Set datapath to tesseract data. Default is to use whatever was
12574 set at installation.
12577 Set language, default is "eng".
12580 Set character whitelist.
12583 Set character blacklist.
12586 The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
12590 Apply a video transform using libopencv.
12592 To enable this filter, install the libopencv library and headers and
12593 configure FFmpeg with @code{--enable-libopencv}.
12595 It accepts the following parameters:
12600 The name of the libopencv filter to apply.
12602 @item filter_params
12603 The parameters to pass to the libopencv filter. If not specified, the default
12604 values are assumed.
12608 Refer to the official libopencv documentation for more precise
12610 @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
12612 Several libopencv filters are supported; see the following subsections.
12617 Dilate an image by using a specific structuring element.
12618 It corresponds to the libopencv function @code{cvDilate}.
12620 It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
12622 @var{struct_el} represents a structuring element, and has the syntax:
12623 @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
12625 @var{cols} and @var{rows} represent the number of columns and rows of
12626 the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
12627 point, and @var{shape} the shape for the structuring element. @var{shape}
12628 must be "rect", "cross", "ellipse", or "custom".
12630 If the value for @var{shape} is "custom", it must be followed by a
12631 string of the form "=@var{filename}". The file with name
12632 @var{filename} is assumed to represent a binary image, with each
12633 printable character corresponding to a bright pixel. When a custom
12634 @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
12635 or columns and rows of the read file are assumed instead.
12637 The default value for @var{struct_el} is "3x3+0x0/rect".
12639 @var{nb_iterations} specifies the number of times the transform is
12640 applied to the image, and defaults to 1.
12644 # Use the default values
12647 # Dilate using a structuring element with a 5x5 cross, iterating two times
12648 ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
12650 # Read the shape from the file diamond.shape, iterating two times.
12651 # The file diamond.shape may contain a pattern of characters like this
12657 # The specified columns and rows are ignored
12658 # but the anchor point coordinates are not
12659 ocv=dilate:0x0+2x2/custom=diamond.shape|2
12664 Erode an image by using a specific structuring element.
12665 It corresponds to the libopencv function @code{cvErode}.
12667 It accepts the parameters: @var{struct_el}:@var{nb_iterations},
12668 with the same syntax and semantics as the @ref{dilate} filter.
12672 Smooth the input video.
12674 The filter takes the following parameters:
12675 @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
12677 @var{type} is the type of smooth filter to apply, and must be one of
12678 the following values: "blur", "blur_no_scale", "median", "gaussian",
12679 or "bilateral". The default value is "gaussian".
12681 The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
12682 depend on the smooth type. @var{param1} and
12683 @var{param2} accept integer positive values or 0. @var{param3} and
12684 @var{param4} accept floating point values.
12686 The default value for @var{param1} is 3. The default value for the
12687 other parameters is 0.
12689 These parameters correspond to the parameters assigned to the
12690 libopencv function @code{cvSmooth}.
12692 @section oscilloscope
12694 2D Video Oscilloscope.
12696 Useful to measure spatial impulse, step responses, chroma delays, etc.
12698 It accepts the following parameters:
12702 Set scope center x position.
12705 Set scope center y position.
12708 Set scope size, relative to frame diagonal.
12711 Set scope tilt/rotation.
12717 Set trace center x position.
12720 Set trace center y position.
12723 Set trace width, relative to width of frame.
12726 Set trace height, relative to height of frame.
12729 Set which components to trace. By default it traces first three components.
12732 Draw trace grid. By default is enabled.
12735 Draw some statistics. By default is enabled.
12738 Draw scope. By default is enabled.
12741 @subsection Examples
12745 Inspect full first row of video frame.
12747 oscilloscope=x=0.5:y=0:s=1
12751 Inspect full last row of video frame.
12753 oscilloscope=x=0.5:y=1:s=1
12757 Inspect full 5th line of video frame of height 1080.
12759 oscilloscope=x=0.5:y=5/1080:s=1
12763 Inspect full last column of video frame.
12765 oscilloscope=x=1:y=0.5:s=1:t=1
12773 Overlay one video on top of another.
12775 It takes two inputs and has one output. The first input is the "main"
12776 video on which the second input is overlaid.
12778 It accepts the following parameters:
12780 A description of the accepted options follows.
12785 Set the expression for the x and y coordinates of the overlaid video
12786 on the main video. Default value is "0" for both expressions. In case
12787 the expression is invalid, it is set to a huge value (meaning that the
12788 overlay will not be displayed within the output visible area).
12791 See @ref{framesync}.
12794 Set when the expressions for @option{x}, and @option{y} are evaluated.
12796 It accepts the following values:
12799 only evaluate expressions once during the filter initialization or
12800 when a command is processed
12803 evaluate expressions for each incoming frame
12806 Default value is @samp{frame}.
12809 See @ref{framesync}.
12812 Set the format for the output video.
12814 It accepts the following values:
12817 force YUV420 output
12820 force YUV422 output
12823 force YUV444 output
12826 force packed RGB output
12829 force planar RGB output
12832 automatically pick format
12835 Default value is @samp{yuv420}.
12838 See @ref{framesync}.
12841 Set format of alpha of the overlaid video, it can be @var{straight} or
12842 @var{premultiplied}. Default is @var{straight}.
12845 The @option{x}, and @option{y} expressions can contain the following
12851 The main input width and height.
12855 The overlay input width and height.
12859 The computed values for @var{x} and @var{y}. They are evaluated for
12864 horizontal and vertical chroma subsample values of the output
12865 format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
12869 the number of input frame, starting from 0
12872 the position in the file of the input frame, NAN if unknown
12875 The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
12879 This filter also supports the @ref{framesync} options.
12881 Note that the @var{n}, @var{pos}, @var{t} variables are available only
12882 when evaluation is done @emph{per frame}, and will evaluate to NAN
12883 when @option{eval} is set to @samp{init}.
12885 Be aware that frames are taken from each input video in timestamp
12886 order, hence, if their initial timestamps differ, it is a good idea
12887 to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
12888 have them begin in the same zero timestamp, as the example for
12889 the @var{movie} filter does.
12891 You can chain together more overlays but you should test the
12892 efficiency of such approach.
12894 @subsection Commands
12896 This filter supports the following commands:
12900 Modify the x and y of the overlay input.
12901 The command accepts the same syntax of the corresponding option.
12903 If the specified expression is not valid, it is kept at its current
12907 @subsection Examples
12911 Draw the overlay at 10 pixels from the bottom right corner of the main
12914 overlay=main_w-overlay_w-10:main_h-overlay_h-10
12917 Using named options the example above becomes:
12919 overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
12923 Insert a transparent PNG logo in the bottom left corner of the input,
12924 using the @command{ffmpeg} tool with the @code{-filter_complex} option:
12926 ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
12930 Insert 2 different transparent PNG logos (second logo on bottom
12931 right corner) using the @command{ffmpeg} tool:
12933 ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=x=10:y=H-h-10,overlay=x=W-w-10:y=H-h-10' output
12937 Add a transparent color layer on top of the main video; @code{WxH}
12938 must specify the size of the main input to the overlay filter:
12940 color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
12944 Play an original video and a filtered version (here with the deshake
12945 filter) side by side using the @command{ffplay} tool:
12947 ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
12950 The above command is the same as:
12952 ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
12956 Make a sliding overlay appearing from the left to the right top part of the
12957 screen starting since time 2:
12959 overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
12963 Compose output by putting two input videos side to side:
12965 ffmpeg -i left.avi -i right.avi -filter_complex "
12966 nullsrc=size=200x100 [background];
12967 [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
12968 [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
12969 [background][left] overlay=shortest=1 [background+left];
12970 [background+left][right] overlay=shortest=1:x=100 [left+right]
12975 Mask 10-20 seconds of a video by applying the delogo filter to a section
12977 ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
12978 -vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
12983 Chain several overlays in cascade:
12985 nullsrc=s=200x200 [bg];
12986 testsrc=s=100x100, split=4 [in0][in1][in2][in3];
12987 [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
12988 [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
12989 [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
12990 [in3] null, [mid2] overlay=100:100 [out0]
12997 Apply Overcomplete Wavelet denoiser.
12999 The filter accepts the following options:
13005 Larger depth values will denoise lower frequency components more, but
13006 slow down filtering.
13008 Must be an int in the range 8-16, default is @code{8}.
13010 @item luma_strength, ls
13013 Must be a double value in the range 0-1000, default is @code{1.0}.
13015 @item chroma_strength, cs
13016 Set chroma strength.
13018 Must be a double value in the range 0-1000, default is @code{1.0}.
13024 Add paddings to the input image, and place the original input at the
13025 provided @var{x}, @var{y} coordinates.
13027 It accepts the following parameters:
13032 Specify an expression for the size of the output image with the
13033 paddings added. If the value for @var{width} or @var{height} is 0, the
13034 corresponding input size is used for the output.
13036 The @var{width} expression can reference the value set by the
13037 @var{height} expression, and vice versa.
13039 The default value of @var{width} and @var{height} is 0.
13043 Specify the offsets to place the input image at within the padded area,
13044 with respect to the top/left border of the output image.
13046 The @var{x} expression can reference the value set by the @var{y}
13047 expression, and vice versa.
13049 The default value of @var{x} and @var{y} is 0.
13051 If @var{x} or @var{y} evaluate to a negative number, they'll be changed
13052 so the input image is centered on the padded area.
13055 Specify the color of the padded area. For the syntax of this option,
13056 check the @ref{color syntax,,"Color" section in the ffmpeg-utils
13057 manual,ffmpeg-utils}.
13059 The default value of @var{color} is "black".
13062 Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
13064 It accepts the following values:
13068 Only evaluate expressions once during the filter initialization or when
13069 a command is processed.
13072 Evaluate expressions for each incoming frame.
13076 Default value is @samp{init}.
13079 Pad to aspect instead to a resolution.
13083 The value for the @var{width}, @var{height}, @var{x}, and @var{y}
13084 options are expressions containing the following constants:
13089 The input video width and height.
13093 These are the same as @var{in_w} and @var{in_h}.
13097 The output width and height (the size of the padded area), as
13098 specified by the @var{width} and @var{height} expressions.
13102 These are the same as @var{out_w} and @var{out_h}.
13106 The x and y offsets as specified by the @var{x} and @var{y}
13107 expressions, or NAN if not yet specified.
13110 same as @var{iw} / @var{ih}
13113 input sample aspect ratio
13116 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
13120 The horizontal and vertical chroma subsample values. For example for the
13121 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
13124 @subsection Examples
13128 Add paddings with the color "violet" to the input video. The output video
13129 size is 640x480, and the top-left corner of the input video is placed at
13132 pad=640:480:0:40:violet
13135 The example above is equivalent to the following command:
13137 pad=width=640:height=480:x=0:y=40:color=violet
13141 Pad the input to get an output with dimensions increased by 3/2,
13142 and put the input video at the center of the padded area:
13144 pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
13148 Pad the input to get a squared output with size equal to the maximum
13149 value between the input width and height, and put the input video at
13150 the center of the padded area:
13152 pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
13156 Pad the input to get a final w/h ratio of 16:9:
13158 pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
13162 In case of anamorphic video, in order to set the output display aspect
13163 correctly, it is necessary to use @var{sar} in the expression,
13164 according to the relation:
13166 (ih * X / ih) * sar = output_dar
13167 X = output_dar / sar
13170 Thus the previous example needs to be modified to:
13172 pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
13176 Double the output size and put the input video in the bottom-right
13177 corner of the output padded area:
13179 pad="2*iw:2*ih:ow-iw:oh-ih"
13183 @anchor{palettegen}
13184 @section palettegen
13186 Generate one palette for a whole video stream.
13188 It accepts the following options:
13192 Set the maximum number of colors to quantize in the palette.
13193 Note: the palette will still contain 256 colors; the unused palette entries
13196 @item reserve_transparent
13197 Create a palette of 255 colors maximum and reserve the last one for
13198 transparency. Reserving the transparency color is useful for GIF optimization.
13199 If not set, the maximum of colors in the palette will be 256. You probably want
13200 to disable this option for a standalone image.
13203 @item transparency_color
13204 Set the color that will be used as background for transparency.
13207 Set statistics mode.
13209 It accepts the following values:
13212 Compute full frame histograms.
13214 Compute histograms only for the part that differs from previous frame. This
13215 might be relevant to give more importance to the moving part of your input if
13216 the background is static.
13218 Compute new histogram for each frame.
13221 Default value is @var{full}.
13224 The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
13225 (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
13226 color quantization of the palette. This information is also visible at
13227 @var{info} logging level.
13229 @subsection Examples
13233 Generate a representative palette of a given video using @command{ffmpeg}:
13235 ffmpeg -i input.mkv -vf palettegen palette.png
13239 @section paletteuse
13241 Use a palette to downsample an input video stream.
13243 The filter takes two inputs: one video stream and a palette. The palette must
13244 be a 256 pixels image.
13246 It accepts the following options:
13250 Select dithering mode. Available algorithms are:
13253 Ordered 8x8 bayer dithering (deterministic)
13255 Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
13256 Note: this dithering is sometimes considered "wrong" and is included as a
13258 @item floyd_steinberg
13259 Floyd and Steingberg dithering (error diffusion)
13261 Frankie Sierra dithering v2 (error diffusion)
13263 Frankie Sierra dithering v2 "Lite" (error diffusion)
13266 Default is @var{sierra2_4a}.
13269 When @var{bayer} dithering is selected, this option defines the scale of the
13270 pattern (how much the crosshatch pattern is visible). A low value means more
13271 visible pattern for less banding, and higher value means less visible pattern
13272 at the cost of more banding.
13274 The option must be an integer value in the range [0,5]. Default is @var{2}.
13277 If set, define the zone to process
13281 Only the changing rectangle will be reprocessed. This is similar to GIF
13282 cropping/offsetting compression mechanism. This option can be useful for speed
13283 if only a part of the image is changing, and has use cases such as limiting the
13284 scope of the error diffusal @option{dither} to the rectangle that bounds the
13285 moving scene (it leads to more deterministic output if the scene doesn't change
13286 much, and as a result less moving noise and better GIF compression).
13289 Default is @var{none}.
13292 Take new palette for each output frame.
13294 @item alpha_threshold
13295 Sets the alpha threshold for transparency. Alpha values above this threshold
13296 will be treated as completely opaque, and values below this threshold will be
13297 treated as completely transparent.
13299 The option must be an integer value in the range [0,255]. Default is @var{128}.
13302 @subsection Examples
13306 Use a palette (generated for example with @ref{palettegen}) to encode a GIF
13307 using @command{ffmpeg}:
13309 ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
13313 @section perspective
13315 Correct perspective of video not recorded perpendicular to the screen.
13317 A description of the accepted parameters follows.
13328 Set coordinates expression for top left, top right, bottom left and bottom right corners.
13329 Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
13330 If the @code{sense} option is set to @code{source}, then the specified points will be sent
13331 to the corners of the destination. If the @code{sense} option is set to @code{destination},
13332 then the corners of the source will be sent to the specified coordinates.
13334 The expressions can use the following variables:
13339 the width and height of video frame.
13343 Output frame count.
13346 @item interpolation
13347 Set interpolation for perspective correction.
13349 It accepts the following values:
13355 Default value is @samp{linear}.
13358 Set interpretation of coordinate options.
13360 It accepts the following values:
13364 Send point in the source specified by the given coordinates to
13365 the corners of the destination.
13367 @item 1, destination
13369 Send the corners of the source to the point in the destination specified
13370 by the given coordinates.
13372 Default value is @samp{source}.
13376 Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
13378 It accepts the following values:
13381 only evaluate expressions once during the filter initialization or
13382 when a command is processed
13385 evaluate expressions for each incoming frame
13388 Default value is @samp{init}.
13393 Delay interlaced video by one field time so that the field order changes.
13395 The intended use is to fix PAL movies that have been captured with the
13396 opposite field order to the film-to-video transfer.
13398 A description of the accepted parameters follows.
13404 It accepts the following values:
13407 Capture field order top-first, transfer bottom-first.
13408 Filter will delay the bottom field.
13411 Capture field order bottom-first, transfer top-first.
13412 Filter will delay the top field.
13415 Capture and transfer with the same field order. This mode only exists
13416 for the documentation of the other options to refer to, but if you
13417 actually select it, the filter will faithfully do nothing.
13420 Capture field order determined automatically by field flags, transfer
13422 Filter selects among @samp{t} and @samp{b} modes on a frame by frame
13423 basis using field flags. If no field information is available,
13424 then this works just like @samp{u}.
13427 Capture unknown or varying, transfer opposite.
13428 Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
13429 analyzing the images and selecting the alternative that produces best
13430 match between the fields.
13433 Capture top-first, transfer unknown or varying.
13434 Filter selects among @samp{t} and @samp{p} using image analysis.
13437 Capture bottom-first, transfer unknown or varying.
13438 Filter selects among @samp{b} and @samp{p} using image analysis.
13441 Capture determined by field flags, transfer unknown or varying.
13442 Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
13443 image analysis. If no field information is available, then this works just
13444 like @samp{U}. This is the default mode.
13447 Both capture and transfer unknown or varying.
13448 Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
13452 @section pixdesctest
13454 Pixel format descriptor test filter, mainly useful for internal
13455 testing. The output video should be equal to the input video.
13459 format=monow, pixdesctest
13462 can be used to test the monowhite pixel format descriptor definition.
13466 Display sample values of color channels. Mainly useful for checking color
13467 and levels. Minimum supported resolution is 640x480.
13469 The filters accept the following options:
13473 Set scope X position, relative offset on X axis.
13476 Set scope Y position, relative offset on Y axis.
13485 Set window opacity. This window also holds statistics about pixel area.
13488 Set window X position, relative offset on X axis.
13491 Set window Y position, relative offset on Y axis.
13496 Enable the specified chain of postprocessing subfilters using libpostproc. This
13497 library should be automatically selected with a GPL build (@code{--enable-gpl}).
13498 Subfilters must be separated by '/' and can be disabled by prepending a '-'.
13499 Each subfilter and some options have a short and a long name that can be used
13500 interchangeably, i.e. dr/dering are the same.
13502 The filters accept the following options:
13506 Set postprocessing subfilters string.
13509 All subfilters share common options to determine their scope:
13513 Honor the quality commands for this subfilter.
13516 Do chrominance filtering, too (default).
13519 Do luminance filtering only (no chrominance).
13522 Do chrominance filtering only (no luminance).
13525 These options can be appended after the subfilter name, separated by a '|'.
13527 Available subfilters are:
13530 @item hb/hdeblock[|difference[|flatness]]
13531 Horizontal deblocking filter
13534 Difference factor where higher values mean more deblocking (default: @code{32}).
13536 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13539 @item vb/vdeblock[|difference[|flatness]]
13540 Vertical deblocking filter
13543 Difference factor where higher values mean more deblocking (default: @code{32}).
13545 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13548 @item ha/hadeblock[|difference[|flatness]]
13549 Accurate horizontal deblocking filter
13552 Difference factor where higher values mean more deblocking (default: @code{32}).
13554 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13557 @item va/vadeblock[|difference[|flatness]]
13558 Accurate vertical deblocking filter
13561 Difference factor where higher values mean more deblocking (default: @code{32}).
13563 Flatness threshold where lower values mean more deblocking (default: @code{39}).
13567 The horizontal and vertical deblocking filters share the difference and
13568 flatness values so you cannot set different horizontal and vertical
13572 @item h1/x1hdeblock
13573 Experimental horizontal deblocking filter
13575 @item v1/x1vdeblock
13576 Experimental vertical deblocking filter
13581 @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
13584 larger -> stronger filtering
13586 larger -> stronger filtering
13588 larger -> stronger filtering
13591 @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
13594 Stretch luminance to @code{0-255}.
13597 @item lb/linblenddeint
13598 Linear blend deinterlacing filter that deinterlaces the given block by
13599 filtering all lines with a @code{(1 2 1)} filter.
13601 @item li/linipoldeint
13602 Linear interpolating deinterlacing filter that deinterlaces the given block by
13603 linearly interpolating every second line.
13605 @item ci/cubicipoldeint
13606 Cubic interpolating deinterlacing filter deinterlaces the given block by
13607 cubically interpolating every second line.
13609 @item md/mediandeint
13610 Median deinterlacing filter that deinterlaces the given block by applying a
13611 median filter to every second line.
13613 @item fd/ffmpegdeint
13614 FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
13615 second line with a @code{(-1 4 2 4 -1)} filter.
13618 Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
13619 block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
13621 @item fq/forceQuant[|quantizer]
13622 Overrides the quantizer table from the input with the constant quantizer you
13630 Default pp filter combination (@code{hb|a,vb|a,dr|a})
13633 Fast pp filter combination (@code{h1|a,v1|a,dr|a})
13636 High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
13639 @subsection Examples
13643 Apply horizontal and vertical deblocking, deringing and automatic
13644 brightness/contrast:
13650 Apply default filters without brightness/contrast correction:
13656 Apply default filters and temporal denoiser:
13658 pp=default/tmpnoise|1|2|3
13662 Apply deblocking on luminance only, and switch vertical deblocking on or off
13663 automatically depending on available CPU time:
13670 Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
13671 similar to spp = 6 with 7 point DCT, where only the center sample is
13674 The filter accepts the following options:
13678 Force a constant quantization parameter. It accepts an integer in range
13679 0 to 63. If not set, the filter will use the QP from the video stream
13683 Set thresholding mode. Available modes are:
13687 Set hard thresholding.
13689 Set soft thresholding (better de-ringing effect, but likely blurrier).
13691 Set medium thresholding (good results, default).
13695 @section premultiply
13696 Apply alpha premultiply effect to input video stream using first plane
13697 of second stream as alpha.
13699 Both streams must have same dimensions and same pixel format.
13701 The filter accepts the following option:
13705 Set which planes will be processed, unprocessed planes will be copied.
13706 By default value 0xf, all planes will be processed.
13709 Do not require 2nd input for processing, instead use alpha plane from input stream.
13713 Apply prewitt operator to input video stream.
13715 The filter accepts the following option:
13719 Set which planes will be processed, unprocessed planes will be copied.
13720 By default value 0xf, all planes will be processed.
13723 Set value which will be multiplied with filtered result.
13726 Set value which will be added to filtered result.
13729 @anchor{program_opencl}
13730 @section program_opencl
13732 Filter video using an OpenCL program.
13737 OpenCL program source file.
13740 Kernel name in program.
13743 Number of inputs to the filter. Defaults to 1.
13746 Size of output frames. Defaults to the same as the first input.
13750 The program source file must contain a kernel function with the given name,
13751 which will be run once for each plane of the output. Each run on a plane
13752 gets enqueued as a separate 2D global NDRange with one work-item for each
13753 pixel to be generated. The global ID offset for each work-item is therefore
13754 the coordinates of a pixel in the destination image.
13756 The kernel function needs to take the following arguments:
13759 Destination image, @var{__write_only image2d_t}.
13761 This image will become the output; the kernel should write all of it.
13763 Frame index, @var{unsigned int}.
13765 This is a counter starting from zero and increasing by one for each frame.
13767 Source images, @var{__read_only image2d_t}.
13769 These are the most recent images on each input. The kernel may read from
13770 them to generate the output, but they can't be written to.
13777 Copy the input to the output (output must be the same size as the input).
13779 __kernel void copy(__write_only image2d_t destination,
13780 unsigned int index,
13781 __read_only image2d_t source)
13783 const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
13785 int2 location = (int2)(get_global_id(0), get_global_id(1));
13787 float4 value = read_imagef(source, sampler, location);
13789 write_imagef(destination, location, value);
13794 Apply a simple transformation, rotating the input by an amount increasing
13795 with the index counter. Pixel values are linearly interpolated by the
13796 sampler, and the output need not have the same dimensions as the input.
13798 __kernel void rotate_image(__write_only image2d_t dst,
13799 unsigned int index,
13800 __read_only image2d_t src)
13802 const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
13803 CLK_FILTER_LINEAR);
13805 float angle = (float)index / 100.0f;
13807 float2 dst_dim = convert_float2(get_image_dim(dst));
13808 float2 src_dim = convert_float2(get_image_dim(src));
13810 float2 dst_cen = dst_dim / 2.0f;
13811 float2 src_cen = src_dim / 2.0f;
13813 int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
13815 float2 dst_pos = convert_float2(dst_loc) - dst_cen;
13817 cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
13818 sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
13820 src_pos = src_pos * src_dim / dst_dim;
13822 float2 src_loc = src_pos + src_cen;
13824 if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
13825 src_loc.x > src_dim.x || src_loc.y > src_dim.y)
13826 write_imagef(dst, dst_loc, 0.5f);
13828 write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
13833 Blend two inputs together, with the amount of each input used varying
13834 with the index counter.
13836 __kernel void blend_images(__write_only image2d_t dst,
13837 unsigned int index,
13838 __read_only image2d_t src1,
13839 __read_only image2d_t src2)
13841 const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
13842 CLK_FILTER_LINEAR);
13844 float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
13846 int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
13847 int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
13848 int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
13850 float4 val1 = read_imagef(src1, sampler, src1_loc);
13851 float4 val2 = read_imagef(src2, sampler, src2_loc);
13853 write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
13859 @section pseudocolor
13861 Alter frame colors in video with pseudocolors.
13863 This filter accept the following options:
13867 set pixel first component expression
13870 set pixel second component expression
13873 set pixel third component expression
13876 set pixel fourth component expression, corresponds to the alpha component
13879 set component to use as base for altering colors
13882 Each of them specifies the expression to use for computing the lookup table for
13883 the corresponding pixel component values.
13885 The expressions can contain the following constants and functions:
13890 The input width and height.
13893 The input value for the pixel component.
13895 @item ymin, umin, vmin, amin
13896 The minimum allowed component value.
13898 @item ymax, umax, vmax, amax
13899 The maximum allowed component value.
13902 All expressions default to "val".
13904 @subsection Examples
13908 Change too high luma values to gradient:
13910 pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
13916 Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
13917 Ratio) between two input videos.
13919 This filter takes in input two input videos, the first input is
13920 considered the "main" source and is passed unchanged to the
13921 output. The second input is used as a "reference" video for computing
13924 Both video inputs must have the same resolution and pixel format for
13925 this filter to work correctly. Also it assumes that both inputs
13926 have the same number of frames, which are compared one by one.
13928 The obtained average PSNR is printed through the logging system.
13930 The filter stores the accumulated MSE (mean squared error) of each
13931 frame, and at the end of the processing it is averaged across all frames
13932 equally, and the following formula is applied to obtain the PSNR:
13935 PSNR = 10*log10(MAX^2/MSE)
13938 Where MAX is the average of the maximum values of each component of the
13941 The description of the accepted parameters follows.
13944 @item stats_file, f
13945 If specified the filter will use the named file to save the PSNR of
13946 each individual frame. When filename equals "-" the data is sent to
13949 @item stats_version
13950 Specifies which version of the stats file format to use. Details of
13951 each format are written below.
13952 Default value is 1.
13954 @item stats_add_max
13955 Determines whether the max value is output to the stats log.
13956 Default value is 0.
13957 Requires stats_version >= 2. If this is set and stats_version < 2,
13958 the filter will return an error.
13961 This filter also supports the @ref{framesync} options.
13963 The file printed if @var{stats_file} is selected, contains a sequence of
13964 key/value pairs of the form @var{key}:@var{value} for each compared
13967 If a @var{stats_version} greater than 1 is specified, a header line precedes
13968 the list of per-frame-pair stats, with key value pairs following the frame
13969 format with the following parameters:
13972 @item psnr_log_version
13973 The version of the log file format. Will match @var{stats_version}.
13976 A comma separated list of the per-frame-pair parameters included in
13980 A description of each shown per-frame-pair parameter follows:
13984 sequential number of the input frame, starting from 1
13987 Mean Square Error pixel-by-pixel average difference of the compared
13988 frames, averaged over all the image components.
13990 @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
13991 Mean Square Error pixel-by-pixel average difference of the compared
13992 frames for the component specified by the suffix.
13994 @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
13995 Peak Signal to Noise ratio of the compared frames for the component
13996 specified by the suffix.
13998 @item max_avg, max_y, max_u, max_v
13999 Maximum allowed value for each channel, and average over all
14005 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
14006 [main][ref] psnr="stats_file=stats.log" [out]
14009 On this example the input file being processed is compared with the
14010 reference file @file{ref_movie.mpg}. The PSNR of each individual frame
14011 is stored in @file{stats.log}.
14016 Pulldown reversal (inverse telecine) filter, capable of handling mixed
14017 hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
14020 The pullup filter is designed to take advantage of future context in making
14021 its decisions. This filter is stateless in the sense that it does not lock
14022 onto a pattern to follow, but it instead looks forward to the following
14023 fields in order to identify matches and rebuild progressive frames.
14025 To produce content with an even framerate, insert the fps filter after
14026 pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
14027 @code{fps=24} for 30fps and the (rare) telecined 25fps input.
14029 The filter accepts the following options:
14036 These options set the amount of "junk" to ignore at the left, right, top, and
14037 bottom of the image, respectively. Left and right are in units of 8 pixels,
14038 while top and bottom are in units of 2 lines.
14039 The default is 8 pixels on each side.
14042 Set the strict breaks. Setting this option to 1 will reduce the chances of
14043 filter generating an occasional mismatched frame, but it may also cause an
14044 excessive number of frames to be dropped during high motion sequences.
14045 Conversely, setting it to -1 will make filter match fields more easily.
14046 This may help processing of video where there is slight blurring between
14047 the fields, but may also cause there to be interlaced frames in the output.
14048 Default value is @code{0}.
14051 Set the metric plane to use. It accepts the following values:
14057 Use chroma blue plane.
14060 Use chroma red plane.
14063 This option may be set to use chroma plane instead of the default luma plane
14064 for doing filter's computations. This may improve accuracy on very clean
14065 source material, but more likely will decrease accuracy, especially if there
14066 is chroma noise (rainbow effect) or any grayscale video.
14067 The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
14068 load and make pullup usable in realtime on slow machines.
14071 For best results (without duplicated frames in the output file) it is
14072 necessary to change the output frame rate. For example, to inverse
14073 telecine NTSC input:
14075 ffmpeg -i input -vf pullup -r 24000/1001 ...
14080 Change video quantization parameters (QP).
14082 The filter accepts the following option:
14086 Set expression for quantization parameter.
14089 The expression is evaluated through the eval API and can contain, among others,
14090 the following constants:
14094 1 if index is not 129, 0 otherwise.
14097 Sequential index starting from -129 to 128.
14100 @subsection Examples
14104 Some equation like:
14112 Flush video frames from internal cache of frames into a random order.
14113 No frame is discarded.
14114 Inspired by @ref{frei0r} nervous filter.
14118 Set size in number of frames of internal cache, in range from @code{2} to
14119 @code{512}. Default is @code{30}.
14122 Set seed for random number generator, must be an integer included between
14123 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
14124 less than @code{0}, the filter will try to use a good random seed on a
14128 @section readeia608
14130 Read closed captioning (EIA-608) information from the top lines of a video frame.
14132 This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
14133 @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
14134 with EIA-608 data (starting from 0). A description of each metadata value follows:
14137 @item lavfi.readeia608.X.cc
14138 The two bytes stored as EIA-608 data (printed in hexadecimal).
14140 @item lavfi.readeia608.X.line
14141 The number of the line on which the EIA-608 data was identified and read.
14144 This filter accepts the following options:
14148 Set the line to start scanning for EIA-608 data. Default is @code{0}.
14151 Set the line to end scanning for EIA-608 data. Default is @code{29}.
14154 Set minimal acceptable amplitude change for sync codes detection.
14155 Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
14158 Set the ratio of width reserved for sync code detection.
14159 Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
14162 Set the max peaks height difference for sync code detection.
14163 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
14166 Set max peaks period difference for sync code detection.
14167 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
14170 Set the first two max start code bits differences.
14171 Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
14174 Set the minimum ratio of bits height compared to 3rd start code bit.
14175 Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
14178 Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
14181 Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
14184 Enable checking the parity bit. In the event of a parity error, the filter will output
14185 @code{0x00} for that character. Default is false.
14188 @subsection Examples
14192 Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
14194 ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
14200 Read vertical interval timecode (VITC) information from the top lines of a
14203 The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
14204 timecode value, if a valid timecode has been detected. Further metadata key
14205 @code{lavfi.readvitc.found} is set to 0/1 depending on whether
14206 timecode data has been found or not.
14208 This filter accepts the following options:
14212 Set the maximum number of lines to scan for VITC data. If the value is set to
14213 @code{-1} the full video frame is scanned. Default is @code{45}.
14216 Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
14217 default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
14220 Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
14221 default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
14224 @subsection Examples
14228 Detect and draw VITC data onto the video frame; if no valid VITC is detected,
14229 draw @code{--:--:--:--} as a placeholder:
14231 ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
14237 Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
14239 Destination pixel at position (X, Y) will be picked from source (x, y) position
14240 where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
14241 value for pixel will be used for destination pixel.
14243 Xmap and Ymap input video streams must be of same dimensions. Output video stream
14244 will have Xmap/Ymap video stream dimensions.
14245 Xmap and Ymap input video streams are 16bit depth, single channel.
14247 @section removegrain
14249 The removegrain filter is a spatial denoiser for progressive video.
14253 Set mode for the first plane.
14256 Set mode for the second plane.
14259 Set mode for the third plane.
14262 Set mode for the fourth plane.
14265 Range of mode is from 0 to 24. Description of each mode follows:
14269 Leave input plane unchanged. Default.
14272 Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
14275 Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
14278 Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
14281 Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
14282 This is equivalent to a median filter.
14285 Line-sensitive clipping giving the minimal change.
14288 Line-sensitive clipping, intermediate.
14291 Line-sensitive clipping, intermediate.
14294 Line-sensitive clipping, intermediate.
14297 Line-sensitive clipping on a line where the neighbours pixels are the closest.
14300 Replaces the target pixel with the closest neighbour.
14303 [1 2 1] horizontal and vertical kernel blur.
14309 Bob mode, interpolates top field from the line where the neighbours
14310 pixels are the closest.
14313 Bob mode, interpolates bottom field from the line where the neighbours
14314 pixels are the closest.
14317 Bob mode, interpolates top field. Same as 13 but with a more complicated
14318 interpolation formula.
14321 Bob mode, interpolates bottom field. Same as 14 but with a more complicated
14322 interpolation formula.
14325 Clips the pixel with the minimum and maximum of respectively the maximum and
14326 minimum of each pair of opposite neighbour pixels.
14329 Line-sensitive clipping using opposite neighbours whose greatest distance from
14330 the current pixel is minimal.
14333 Replaces the pixel with the average of its 8 neighbours.
14336 Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
14339 Clips pixels using the averages of opposite neighbour.
14342 Same as mode 21 but simpler and faster.
14345 Small edge and halo removal, but reputed useless.
14351 @section removelogo
14353 Suppress a TV station logo, using an image file to determine which
14354 pixels comprise the logo. It works by filling in the pixels that
14355 comprise the logo with neighboring pixels.
14357 The filter accepts the following options:
14361 Set the filter bitmap file, which can be any image format supported by
14362 libavformat. The width and height of the image file must match those of the
14363 video stream being processed.
14366 Pixels in the provided bitmap image with a value of zero are not
14367 considered part of the logo, non-zero pixels are considered part of
14368 the logo. If you use white (255) for the logo and black (0) for the
14369 rest, you will be safe. For making the filter bitmap, it is
14370 recommended to take a screen capture of a black frame with the logo
14371 visible, and then using a threshold filter followed by the erode
14372 filter once or twice.
14374 If needed, little splotches can be fixed manually. Remember that if
14375 logo pixels are not covered, the filter quality will be much
14376 reduced. Marking too many pixels as part of the logo does not hurt as
14377 much, but it will increase the amount of blurring needed to cover over
14378 the image and will destroy more information than necessary, and extra
14379 pixels will slow things down on a large logo.
14381 @section repeatfields
14383 This filter uses the repeat_field flag from the Video ES headers and hard repeats
14384 fields based on its value.
14388 Reverse a video clip.
14390 Warning: This filter requires memory to buffer the entire clip, so trimming
14393 @subsection Examples
14397 Take the first 5 seconds of a clip, and reverse it.
14404 Shift R/G/B/A pixels horizontally and/or vertically.
14406 The filter accepts the following options:
14409 Set amount to shift red horizontally.
14411 Set amount to shift red vertically.
14413 Set amount to shift green horizontally.
14415 Set amount to shift green vertically.
14417 Set amount to shift blue horizontally.
14419 Set amount to shift blue vertically.
14421 Set amount to shift alpha horizontally.
14423 Set amount to shift alpha vertically.
14425 Set edge mode, can be @var{smear}, default, or @var{warp}.
14429 Apply roberts cross operator to input video stream.
14431 The filter accepts the following option:
14435 Set which planes will be processed, unprocessed planes will be copied.
14436 By default value 0xf, all planes will be processed.
14439 Set value which will be multiplied with filtered result.
14442 Set value which will be added to filtered result.
14447 Rotate video by an arbitrary angle expressed in radians.
14449 The filter accepts the following options:
14451 A description of the optional parameters follows.
14454 Set an expression for the angle by which to rotate the input video
14455 clockwise, expressed as a number of radians. A negative value will
14456 result in a counter-clockwise rotation. By default it is set to "0".
14458 This expression is evaluated for each frame.
14461 Set the output width expression, default value is "iw".
14462 This expression is evaluated just once during configuration.
14465 Set the output height expression, default value is "ih".
14466 This expression is evaluated just once during configuration.
14469 Enable bilinear interpolation if set to 1, a value of 0 disables
14470 it. Default value is 1.
14473 Set the color used to fill the output area not covered by the rotated
14474 image. For the general syntax of this option, check the
14475 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
14476 If the special value "none" is selected then no
14477 background is printed (useful for example if the background is never shown).
14479 Default value is "black".
14482 The expressions for the angle and the output size can contain the
14483 following constants and functions:
14487 sequential number of the input frame, starting from 0. It is always NAN
14488 before the first frame is filtered.
14491 time in seconds of the input frame, it is set to 0 when the filter is
14492 configured. It is always NAN before the first frame is filtered.
14496 horizontal and vertical chroma subsample values. For example for the
14497 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14501 the input video width and height
14505 the output width and height, that is the size of the padded area as
14506 specified by the @var{width} and @var{height} expressions
14510 the minimal width/height required for completely containing the input
14511 video rotated by @var{a} radians.
14513 These are only available when computing the @option{out_w} and
14514 @option{out_h} expressions.
14517 @subsection Examples
14521 Rotate the input by PI/6 radians clockwise:
14527 Rotate the input by PI/6 radians counter-clockwise:
14533 Rotate the input by 45 degrees clockwise:
14539 Apply a constant rotation with period T, starting from an angle of PI/3:
14541 rotate=PI/3+2*PI*t/T
14545 Make the input video rotation oscillating with a period of T
14546 seconds and an amplitude of A radians:
14548 rotate=A*sin(2*PI/T*t)
14552 Rotate the video, output size is chosen so that the whole rotating
14553 input video is always completely contained in the output:
14555 rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
14559 Rotate the video, reduce the output size so that no background is ever
14562 rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
14566 @subsection Commands
14568 The filter supports the following commands:
14572 Set the angle expression.
14573 The command accepts the same syntax of the corresponding option.
14575 If the specified expression is not valid, it is kept at its current
14581 Apply Shape Adaptive Blur.
14583 The filter accepts the following options:
14586 @item luma_radius, lr
14587 Set luma blur filter strength, must be a value in range 0.1-4.0, default
14588 value is 1.0. A greater value will result in a more blurred image, and
14589 in slower processing.
14591 @item luma_pre_filter_radius, lpfr
14592 Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
14595 @item luma_strength, ls
14596 Set luma maximum difference between pixels to still be considered, must
14597 be a value in the 0.1-100.0 range, default value is 1.0.
14599 @item chroma_radius, cr
14600 Set chroma blur filter strength, must be a value in range -0.9-4.0. A
14601 greater value will result in a more blurred image, and in slower
14604 @item chroma_pre_filter_radius, cpfr
14605 Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
14607 @item chroma_strength, cs
14608 Set chroma maximum difference between pixels to still be considered,
14609 must be a value in the -0.9-100.0 range.
14612 Each chroma option value, if not explicitly specified, is set to the
14613 corresponding luma option value.
14618 Scale (resize) the input video, using the libswscale library.
14620 The scale filter forces the output display aspect ratio to be the same
14621 of the input, by changing the output sample aspect ratio.
14623 If the input image format is different from the format requested by
14624 the next filter, the scale filter will convert the input to the
14627 @subsection Options
14628 The filter accepts the following options, or any of the options
14629 supported by the libswscale scaler.
14631 See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
14632 the complete list of scaler options.
14637 Set the output video dimension expression. Default value is the input
14640 If the @var{width} or @var{w} value is 0, the input width is used for
14641 the output. If the @var{height} or @var{h} value is 0, the input height
14642 is used for the output.
14644 If one and only one of the values is -n with n >= 1, the scale filter
14645 will use a value that maintains the aspect ratio of the input image,
14646 calculated from the other specified dimension. After that it will,
14647 however, make sure that the calculated dimension is divisible by n and
14648 adjust the value if necessary.
14650 If both values are -n with n >= 1, the behavior will be identical to
14651 both values being set to 0 as previously detailed.
14653 See below for the list of accepted constants for use in the dimension
14657 Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
14661 Only evaluate expressions once during the filter initialization or when a command is processed.
14664 Evaluate expressions for each incoming frame.
14668 Default value is @samp{init}.
14672 Set the interlacing mode. It accepts the following values:
14676 Force interlaced aware scaling.
14679 Do not apply interlaced scaling.
14682 Select interlaced aware scaling depending on whether the source frames
14683 are flagged as interlaced or not.
14686 Default value is @samp{0}.
14689 Set libswscale scaling flags. See
14690 @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
14691 complete list of values. If not explicitly specified the filter applies
14695 @item param0, param1
14696 Set libswscale input parameters for scaling algorithms that need them. See
14697 @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
14698 complete documentation. If not explicitly specified the filter applies
14704 Set the video size. For the syntax of this option, check the
14705 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
14707 @item in_color_matrix
14708 @item out_color_matrix
14709 Set in/output YCbCr color space type.
14711 This allows the autodetected value to be overridden as well as allows forcing
14712 a specific value used for the output and encoder.
14714 If not specified, the color space type depends on the pixel format.
14720 Choose automatically.
14723 Format conforming to International Telecommunication Union (ITU)
14724 Recommendation BT.709.
14727 Set color space conforming to the United States Federal Communications
14728 Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
14731 Set color space conforming to:
14735 ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
14738 ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
14741 Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
14746 Set color space conforming to SMPTE ST 240:1999.
14751 Set in/output YCbCr sample range.
14753 This allows the autodetected value to be overridden as well as allows forcing
14754 a specific value used for the output and encoder. If not specified, the
14755 range depends on the pixel format. Possible values:
14759 Choose automatically.
14762 Set full range (0-255 in case of 8-bit luma).
14764 @item mpeg/limited/tv
14765 Set "MPEG" range (16-235 in case of 8-bit luma).
14768 @item force_original_aspect_ratio
14769 Enable decreasing or increasing output video width or height if necessary to
14770 keep the original aspect ratio. Possible values:
14774 Scale the video as specified and disable this feature.
14777 The output video dimensions will automatically be decreased if needed.
14780 The output video dimensions will automatically be increased if needed.
14784 One useful instance of this option is that when you know a specific device's
14785 maximum allowed resolution, you can use this to limit the output video to
14786 that, while retaining the aspect ratio. For example, device A allows
14787 1280x720 playback, and your video is 1920x800. Using this option (set it to
14788 decrease) and specifying 1280x720 to the command line makes the output
14791 Please note that this is a different thing than specifying -1 for @option{w}
14792 or @option{h}, you still need to specify the output resolution for this option
14797 The values of the @option{w} and @option{h} options are expressions
14798 containing the following constants:
14803 The input width and height
14807 These are the same as @var{in_w} and @var{in_h}.
14811 The output (scaled) width and height
14815 These are the same as @var{out_w} and @var{out_h}
14818 The same as @var{iw} / @var{ih}
14821 input sample aspect ratio
14824 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
14828 horizontal and vertical input chroma subsample values. For example for the
14829 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14833 horizontal and vertical output chroma subsample values. For example for the
14834 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
14837 @subsection Examples
14841 Scale the input video to a size of 200x100
14846 This is equivalent to:
14857 Specify a size abbreviation for the output size:
14862 which can also be written as:
14868 Scale the input to 2x:
14870 scale=w=2*iw:h=2*ih
14874 The above is the same as:
14876 scale=2*in_w:2*in_h
14880 Scale the input to 2x with forced interlaced scaling:
14882 scale=2*iw:2*ih:interl=1
14886 Scale the input to half size:
14888 scale=w=iw/2:h=ih/2
14892 Increase the width, and set the height to the same size:
14898 Seek Greek harmony:
14905 Increase the height, and set the width to 3/2 of the height:
14907 scale=w=3/2*oh:h=3/5*ih
14911 Increase the size, making the size a multiple of the chroma
14914 scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
14918 Increase the width to a maximum of 500 pixels,
14919 keeping the same aspect ratio as the input:
14921 scale=w='min(500\, iw*3/2):h=-1'
14925 Make pixels square by combining scale and setsar:
14927 scale='trunc(ih*dar):ih',setsar=1/1
14931 Make pixels square by combining scale and setsar,
14932 making sure the resulting resolution is even (required by some codecs):
14934 scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
14938 @subsection Commands
14940 This filter supports the following commands:
14944 Set the output video dimension expression.
14945 The command accepts the same syntax of the corresponding option.
14947 If the specified expression is not valid, it is kept at its current
14953 Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
14954 format conversion on CUDA video frames. Setting the output width and height
14955 works in the same way as for the @var{scale} filter.
14957 The following additional options are accepted:
14960 The pixel format of the output CUDA frames. If set to the string "same" (the
14961 default), the input format will be kept. Note that automatic format negotiation
14962 and conversion is not yet supported for hardware frames
14965 The interpolation algorithm used for resizing. One of the following:
14972 @item cubic2p_bspline
14973 2-parameter cubic (B=1, C=0)
14975 @item cubic2p_catmullrom
14976 2-parameter cubic (B=0, C=1/2)
14978 @item cubic2p_b05c03
14979 2-parameter cubic (B=1/2, C=3/10)
14991 Scale (resize) the input video, based on a reference video.
14993 See the scale filter for available options, scale2ref supports the same but
14994 uses the reference video instead of the main input as basis. scale2ref also
14995 supports the following additional constants for the @option{w} and
14996 @option{h} options:
15001 The main input video's width and height
15004 The same as @var{main_w} / @var{main_h}
15007 The main input video's sample aspect ratio
15009 @item main_dar, mdar
15010 The main input video's display aspect ratio. Calculated from
15011 @code{(main_w / main_h) * main_sar}.
15015 The main input video's horizontal and vertical chroma subsample values.
15016 For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
15020 @subsection Examples
15024 Scale a subtitle stream (b) to match the main video (a) in size before overlaying
15026 'scale2ref[b][a];[a][b]overlay'
15030 @anchor{selectivecolor}
15031 @section selectivecolor
15033 Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
15034 as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
15035 by the "purity" of the color (that is, how saturated it already is).
15037 This filter is similar to the Adobe Photoshop Selective Color tool.
15039 The filter accepts the following options:
15042 @item correction_method
15043 Select color correction method.
15045 Available values are:
15048 Specified adjustments are applied "as-is" (added/subtracted to original pixel
15051 Specified adjustments are relative to the original component value.
15053 Default is @code{absolute}.
15055 Adjustments for red pixels (pixels where the red component is the maximum)
15057 Adjustments for yellow pixels (pixels where the blue component is the minimum)
15059 Adjustments for green pixels (pixels where the green component is the maximum)
15061 Adjustments for cyan pixels (pixels where the red component is the minimum)
15063 Adjustments for blue pixels (pixels where the blue component is the maximum)
15065 Adjustments for magenta pixels (pixels where the green component is the minimum)
15067 Adjustments for white pixels (pixels where all components are greater than 128)
15069 Adjustments for all pixels except pure black and pure white
15071 Adjustments for black pixels (pixels where all components are lesser than 128)
15073 Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
15076 All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
15077 4 space separated floating point adjustment values in the [-1,1] range,
15078 respectively to adjust the amount of cyan, magenta, yellow and black for the
15079 pixels of its range.
15081 @subsection Examples
15085 Increase cyan by 50% and reduce yellow by 33% in every green areas, and
15086 increase magenta by 27% in blue areas:
15088 selectivecolor=greens=.5 0 -.33 0:blues=0 .27
15092 Use a Photoshop selective color preset:
15094 selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
15098 @anchor{separatefields}
15099 @section separatefields
15101 The @code{separatefields} takes a frame-based video input and splits
15102 each frame into its components fields, producing a new half height clip
15103 with twice the frame rate and twice the frame count.
15105 This filter use field-dominance information in frame to decide which
15106 of each pair of fields to place first in the output.
15107 If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
15109 @section setdar, setsar
15111 The @code{setdar} filter sets the Display Aspect Ratio for the filter
15114 This is done by changing the specified Sample (aka Pixel) Aspect
15115 Ratio, according to the following equation:
15117 @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
15120 Keep in mind that the @code{setdar} filter does not modify the pixel
15121 dimensions of the video frame. Also, the display aspect ratio set by
15122 this filter may be changed by later filters in the filterchain,
15123 e.g. in case of scaling or if another "setdar" or a "setsar" filter is
15126 The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
15127 the filter output video.
15129 Note that as a consequence of the application of this filter, the
15130 output display aspect ratio will change according to the equation
15133 Keep in mind that the sample aspect ratio set by the @code{setsar}
15134 filter may be changed by later filters in the filterchain, e.g. if
15135 another "setsar" or a "setdar" filter is applied.
15137 It accepts the following parameters:
15140 @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
15141 Set the aspect ratio used by the filter.
15143 The parameter can be a floating point number string, an expression, or
15144 a string of the form @var{num}:@var{den}, where @var{num} and
15145 @var{den} are the numerator and denominator of the aspect ratio. If
15146 the parameter is not specified, it is assumed the value "0".
15147 In case the form "@var{num}:@var{den}" is used, the @code{:} character
15151 Set the maximum integer value to use for expressing numerator and
15152 denominator when reducing the expressed aspect ratio to a rational.
15153 Default value is @code{100}.
15157 The parameter @var{sar} is an expression containing
15158 the following constants:
15162 These are approximated values for the mathematical constants e
15163 (Euler's number), pi (Greek pi), and phi (the golden ratio).
15166 The input width and height.
15169 These are the same as @var{w} / @var{h}.
15172 The input sample aspect ratio.
15175 The input display aspect ratio. It is the same as
15176 (@var{w} / @var{h}) * @var{sar}.
15179 Horizontal and vertical chroma subsample values. For example, for the
15180 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
15183 @subsection Examples
15188 To change the display aspect ratio to 16:9, specify one of the following:
15195 To change the sample aspect ratio to 10:11, specify:
15201 To set a display aspect ratio of 16:9, and specify a maximum integer value of
15202 1000 in the aspect ratio reduction, use the command:
15204 setdar=ratio=16/9:max=1000
15212 Force field for the output video frame.
15214 The @code{setfield} filter marks the interlace type field for the
15215 output frames. It does not change the input frame, but only sets the
15216 corresponding property, which affects how the frame is treated by
15217 following filters (e.g. @code{fieldorder} or @code{yadif}).
15219 The filter accepts the following options:
15224 Available values are:
15228 Keep the same field property.
15231 Mark the frame as bottom-field-first.
15234 Mark the frame as top-field-first.
15237 Mark the frame as progressive.
15244 Force frame parameter for the output video frame.
15246 The @code{setparams} filter marks interlace and color range for the
15247 output frames. It does not change the input frame, but only sets the
15248 corresponding property, which affects how the frame is treated by
15253 Available values are:
15257 Keep the same field property (default).
15260 Mark the frame as bottom-field-first.
15263 Mark the frame as top-field-first.
15266 Mark the frame as progressive.
15270 Available values are:
15274 Keep the same color range property (default).
15276 @item unspecified, unknown
15277 Mark the frame as unspecified color range.
15279 @item limited, tv, mpeg
15280 Mark the frame as limited range.
15282 @item full, pc, jpeg
15283 Mark the frame as full range.
15286 @item color_primaries
15287 Set the color primaries.
15288 Available values are:
15292 Keep the same color primaries property (default).
15309 Set the color transfert.
15310 Available values are:
15314 Keep the same color trc property (default).
15336 Set the colorspace.
15337 Available values are:
15341 Keep the same colorspace property (default).
15354 @item chroma-derived-nc
15355 @item chroma-derived-c
15362 Show a line containing various information for each input video frame.
15363 The input video is not modified.
15365 This filter supports the following options:
15369 Calculate checksums of each plane. By default enabled.
15372 The shown line contains a sequence of key/value pairs of the form
15373 @var{key}:@var{value}.
15375 The following values are shown in the output:
15379 The (sequential) number of the input frame, starting from 0.
15382 The Presentation TimeStamp of the input frame, expressed as a number of
15383 time base units. The time base unit depends on the filter input pad.
15386 The Presentation TimeStamp of the input frame, expressed as a number of
15390 The position of the frame in the input stream, or -1 if this information is
15391 unavailable and/or meaningless (for example in case of synthetic video).
15394 The pixel format name.
15397 The sample aspect ratio of the input frame, expressed in the form
15398 @var{num}/@var{den}.
15401 The size of the input frame. For the syntax of this option, check the
15402 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
15405 The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
15406 for bottom field first).
15409 This is 1 if the frame is a key frame, 0 otherwise.
15412 The picture type of the input frame ("I" for an I-frame, "P" for a
15413 P-frame, "B" for a B-frame, or "?" for an unknown type).
15414 Also refer to the documentation of the @code{AVPictureType} enum and of
15415 the @code{av_get_picture_type_char} function defined in
15416 @file{libavutil/avutil.h}.
15419 The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
15421 @item plane_checksum
15422 The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
15423 expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
15426 @section showpalette
15428 Displays the 256 colors palette of each frame. This filter is only relevant for
15429 @var{pal8} pixel format frames.
15431 It accepts the following option:
15435 Set the size of the box used to represent one palette color entry. Default is
15436 @code{30} (for a @code{30x30} pixel box).
15439 @section shuffleframes
15441 Reorder and/or duplicate and/or drop video frames.
15443 It accepts the following parameters:
15447 Set the destination indexes of input frames.
15448 This is space or '|' separated list of indexes that maps input frames to output
15449 frames. Number of indexes also sets maximal value that each index may have.
15450 '-1' index have special meaning and that is to drop frame.
15453 The first frame has the index 0. The default is to keep the input unchanged.
15455 @subsection Examples
15459 Swap second and third frame of every three frames of the input:
15461 ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
15465 Swap 10th and 1st frame of every ten frames of the input:
15467 ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
15471 @section shuffleplanes
15473 Reorder and/or duplicate video planes.
15475 It accepts the following parameters:
15480 The index of the input plane to be used as the first output plane.
15483 The index of the input plane to be used as the second output plane.
15486 The index of the input plane to be used as the third output plane.
15489 The index of the input plane to be used as the fourth output plane.
15493 The first plane has the index 0. The default is to keep the input unchanged.
15495 @subsection Examples
15499 Swap the second and third planes of the input:
15501 ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
15505 @anchor{signalstats}
15506 @section signalstats
15507 Evaluate various visual metrics that assist in determining issues associated
15508 with the digitization of analog video media.
15510 By default the filter will log these metadata values:
15514 Display the minimal Y value contained within the input frame. Expressed in
15518 Display the Y value at the 10% percentile within the input frame. Expressed in
15522 Display the average Y value within the input frame. Expressed in range of
15526 Display the Y value at the 90% percentile within the input frame. Expressed in
15530 Display the maximum Y value contained within the input frame. Expressed in
15534 Display the minimal U value contained within the input frame. Expressed in
15538 Display the U value at the 10% percentile within the input frame. Expressed in
15542 Display the average U value within the input frame. Expressed in range of
15546 Display the U value at the 90% percentile within the input frame. Expressed in
15550 Display the maximum U value contained within the input frame. Expressed in
15554 Display the minimal V value contained within the input frame. Expressed in
15558 Display the V value at the 10% percentile within the input frame. Expressed in
15562 Display the average V value within the input frame. Expressed in range of
15566 Display the V value at the 90% percentile within the input frame. Expressed in
15570 Display the maximum V value contained within the input frame. Expressed in
15574 Display the minimal saturation value contained within the input frame.
15575 Expressed in range of [0-~181.02].
15578 Display the saturation value at the 10% percentile within the input frame.
15579 Expressed in range of [0-~181.02].
15582 Display the average saturation value within the input frame. Expressed in range
15586 Display the saturation value at the 90% percentile within the input frame.
15587 Expressed in range of [0-~181.02].
15590 Display the maximum saturation value contained within the input frame.
15591 Expressed in range of [0-~181.02].
15594 Display the median value for hue within the input frame. Expressed in range of
15598 Display the average value for hue within the input frame. Expressed in range of
15602 Display the average of sample value difference between all values of the Y
15603 plane in the current frame and corresponding values of the previous input frame.
15604 Expressed in range of [0-255].
15607 Display the average of sample value difference between all values of the U
15608 plane in the current frame and corresponding values of the previous input frame.
15609 Expressed in range of [0-255].
15612 Display the average of sample value difference between all values of the V
15613 plane in the current frame and corresponding values of the previous input frame.
15614 Expressed in range of [0-255].
15617 Display bit depth of Y plane in current frame.
15618 Expressed in range of [0-16].
15621 Display bit depth of U plane in current frame.
15622 Expressed in range of [0-16].
15625 Display bit depth of V plane in current frame.
15626 Expressed in range of [0-16].
15629 The filter accepts the following options:
15635 @option{stat} specify an additional form of image analysis.
15636 @option{out} output video with the specified type of pixel highlighted.
15638 Both options accept the following values:
15642 Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
15643 unlike the neighboring pixels of the same field. Examples of temporal outliers
15644 include the results of video dropouts, head clogs, or tape tracking issues.
15647 Identify @var{vertical line repetition}. Vertical line repetition includes
15648 similar rows of pixels within a frame. In born-digital video vertical line
15649 repetition is common, but this pattern is uncommon in video digitized from an
15650 analog source. When it occurs in video that results from the digitization of an
15651 analog source it can indicate concealment from a dropout compensator.
15654 Identify pixels that fall outside of legal broadcast range.
15658 Set the highlight color for the @option{out} option. The default color is
15662 @subsection Examples
15666 Output data of various video metrics:
15668 ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
15672 Output specific data about the minimum and maximum values of the Y plane per frame:
15674 ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
15678 Playback video while highlighting pixels that are outside of broadcast range in red.
15680 ffplay example.mov -vf signalstats="out=brng:color=red"
15684 Playback video with signalstats metadata drawn over the frame.
15686 ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
15689 The contents of signalstat_drawtext.txt used in the command are:
15692 Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
15693 U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
15694 V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
15695 saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
15703 Calculates the MPEG-7 Video Signature. The filter can handle more than one
15704 input. In this case the matching between the inputs can be calculated additionally.
15705 The filter always passes through the first input. The signature of each stream can
15706 be written into a file.
15708 It accepts the following options:
15712 Enable or disable the matching process.
15714 Available values are:
15718 Disable the calculation of a matching (default).
15720 Calculate the matching for the whole video and output whether the whole video
15721 matches or only parts.
15723 Calculate only until a matching is found or the video ends. Should be faster in
15728 Set the number of inputs. The option value must be a non negative integer.
15729 Default value is 1.
15732 Set the path to which the output is written. If there is more than one input,
15733 the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
15734 integer), that will be replaced with the input number. If no filename is
15735 specified, no output will be written. This is the default.
15738 Choose the output format.
15740 Available values are:
15744 Use the specified binary representation (default).
15746 Use the specified xml representation.
15750 Set threshold to detect one word as similar. The option value must be an integer
15751 greater than zero. The default value is 9000.
15754 Set threshold to detect all words as similar. The option value must be an integer
15755 greater than zero. The default value is 60000.
15758 Set threshold to detect frames as similar. The option value must be an integer
15759 greater than zero. The default value is 116.
15762 Set the minimum length of a sequence in frames to recognize it as matching
15763 sequence. The option value must be a non negative integer value.
15764 The default value is 0.
15767 Set the minimum relation, that matching frames to all frames must have.
15768 The option value must be a double value between 0 and 1. The default value is 0.5.
15771 @subsection Examples
15775 To calculate the signature of an input video and store it in signature.bin:
15777 ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
15781 To detect whether two videos match and store the signatures in XML format in
15782 signature0.xml and signature1.xml:
15784 ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
15792 Blur the input video without impacting the outlines.
15794 It accepts the following options:
15797 @item luma_radius, lr
15798 Set the luma radius. The option value must be a float number in
15799 the range [0.1,5.0] that specifies the variance of the gaussian filter
15800 used to blur the image (slower if larger). Default value is 1.0.
15802 @item luma_strength, ls
15803 Set the luma strength. The option value must be a float number
15804 in the range [-1.0,1.0] that configures the blurring. A value included
15805 in [0.0,1.0] will blur the image whereas a value included in
15806 [-1.0,0.0] will sharpen the image. Default value is 1.0.
15808 @item luma_threshold, lt
15809 Set the luma threshold used as a coefficient to determine
15810 whether a pixel should be blurred or not. The option value must be an
15811 integer in the range [-30,30]. A value of 0 will filter all the image,
15812 a value included in [0,30] will filter flat areas and a value included
15813 in [-30,0] will filter edges. Default value is 0.
15815 @item chroma_radius, cr
15816 Set the chroma radius. The option value must be a float number in
15817 the range [0.1,5.0] that specifies the variance of the gaussian filter
15818 used to blur the image (slower if larger). Default value is @option{luma_radius}.
15820 @item chroma_strength, cs
15821 Set the chroma strength. The option value must be a float number
15822 in the range [-1.0,1.0] that configures the blurring. A value included
15823 in [0.0,1.0] will blur the image whereas a value included in
15824 [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
15826 @item chroma_threshold, ct
15827 Set the chroma threshold used as a coefficient to determine
15828 whether a pixel should be blurred or not. The option value must be an
15829 integer in the range [-30,30]. A value of 0 will filter all the image,
15830 a value included in [0,30] will filter flat areas and a value included
15831 in [-30,0] will filter edges. Default value is @option{luma_threshold}.
15834 If a chroma option is not explicitly set, the corresponding luma value
15839 Obtain the SSIM (Structural SImilarity Metric) between two input videos.
15841 This filter takes in input two input videos, the first input is
15842 considered the "main" source and is passed unchanged to the
15843 output. The second input is used as a "reference" video for computing
15846 Both video inputs must have the same resolution and pixel format for
15847 this filter to work correctly. Also it assumes that both inputs
15848 have the same number of frames, which are compared one by one.
15850 The filter stores the calculated SSIM of each frame.
15852 The description of the accepted parameters follows.
15855 @item stats_file, f
15856 If specified the filter will use the named file to save the SSIM of
15857 each individual frame. When filename equals "-" the data is sent to
15861 The file printed if @var{stats_file} is selected, contains a sequence of
15862 key/value pairs of the form @var{key}:@var{value} for each compared
15865 A description of each shown parameter follows:
15869 sequential number of the input frame, starting from 1
15871 @item Y, U, V, R, G, B
15872 SSIM of the compared frames for the component specified by the suffix.
15875 SSIM of the compared frames for the whole frame.
15878 Same as above but in dB representation.
15881 This filter also supports the @ref{framesync} options.
15885 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
15886 [main][ref] ssim="stats_file=stats.log" [out]
15889 On this example the input file being processed is compared with the
15890 reference file @file{ref_movie.mpg}. The SSIM of each individual frame
15891 is stored in @file{stats.log}.
15893 Another example with both psnr and ssim at same time:
15895 ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
15900 Convert between different stereoscopic image formats.
15902 The filters accept the following options:
15906 Set stereoscopic image format of input.
15908 Available values for input image formats are:
15911 side by side parallel (left eye left, right eye right)
15914 side by side crosseye (right eye left, left eye right)
15917 side by side parallel with half width resolution
15918 (left eye left, right eye right)
15921 side by side crosseye with half width resolution
15922 (right eye left, left eye right)
15925 above-below (left eye above, right eye below)
15928 above-below (right eye above, left eye below)
15931 above-below with half height resolution
15932 (left eye above, right eye below)
15935 above-below with half height resolution
15936 (right eye above, left eye below)
15939 alternating frames (left eye first, right eye second)
15942 alternating frames (right eye first, left eye second)
15945 interleaved rows (left eye has top row, right eye starts on next row)
15948 interleaved rows (right eye has top row, left eye starts on next row)
15951 interleaved columns, left eye first
15954 interleaved columns, right eye first
15956 Default value is @samp{sbsl}.
15960 Set stereoscopic image format of output.
15964 side by side parallel (left eye left, right eye right)
15967 side by side crosseye (right eye left, left eye right)
15970 side by side parallel with half width resolution
15971 (left eye left, right eye right)
15974 side by side crosseye with half width resolution
15975 (right eye left, left eye right)
15978 above-below (left eye above, right eye below)
15981 above-below (right eye above, left eye below)
15984 above-below with half height resolution
15985 (left eye above, right eye below)
15988 above-below with half height resolution
15989 (right eye above, left eye below)
15992 alternating frames (left eye first, right eye second)
15995 alternating frames (right eye first, left eye second)
15998 interleaved rows (left eye has top row, right eye starts on next row)
16001 interleaved rows (right eye has top row, left eye starts on next row)
16004 anaglyph red/blue gray
16005 (red filter on left eye, blue filter on right eye)
16008 anaglyph red/green gray
16009 (red filter on left eye, green filter on right eye)
16012 anaglyph red/cyan gray
16013 (red filter on left eye, cyan filter on right eye)
16016 anaglyph red/cyan half colored
16017 (red filter on left eye, cyan filter on right eye)
16020 anaglyph red/cyan color
16021 (red filter on left eye, cyan filter on right eye)
16024 anaglyph red/cyan color optimized with the least squares projection of dubois
16025 (red filter on left eye, cyan filter on right eye)
16028 anaglyph green/magenta gray
16029 (green filter on left eye, magenta filter on right eye)
16032 anaglyph green/magenta half colored
16033 (green filter on left eye, magenta filter on right eye)
16036 anaglyph green/magenta colored
16037 (green filter on left eye, magenta filter on right eye)
16040 anaglyph green/magenta color optimized with the least squares projection of dubois
16041 (green filter on left eye, magenta filter on right eye)
16044 anaglyph yellow/blue gray
16045 (yellow filter on left eye, blue filter on right eye)
16048 anaglyph yellow/blue half colored
16049 (yellow filter on left eye, blue filter on right eye)
16052 anaglyph yellow/blue colored
16053 (yellow filter on left eye, blue filter on right eye)
16056 anaglyph yellow/blue color optimized with the least squares projection of dubois
16057 (yellow filter on left eye, blue filter on right eye)
16060 mono output (left eye only)
16063 mono output (right eye only)
16066 checkerboard, left eye first
16069 checkerboard, right eye first
16072 interleaved columns, left eye first
16075 interleaved columns, right eye first
16081 Default value is @samp{arcd}.
16084 @subsection Examples
16088 Convert input video from side by side parallel to anaglyph yellow/blue dubois:
16094 Convert input video from above below (left eye above, right eye below) to side by side crosseye.
16100 @section streamselect, astreamselect
16101 Select video or audio streams.
16103 The filter accepts the following options:
16107 Set number of inputs. Default is 2.
16110 Set input indexes to remap to outputs.
16113 @subsection Commands
16115 The @code{streamselect} and @code{astreamselect} filter supports the following
16120 Set input indexes to remap to outputs.
16123 @subsection Examples
16127 Select first 5 seconds 1st stream and rest of time 2nd stream:
16129 sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
16133 Same as above, but for audio:
16135 asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
16140 Apply sobel operator to input video stream.
16142 The filter accepts the following option:
16146 Set which planes will be processed, unprocessed planes will be copied.
16147 By default value 0xf, all planes will be processed.
16150 Set value which will be multiplied with filtered result.
16153 Set value which will be added to filtered result.
16159 Apply a simple postprocessing filter that compresses and decompresses the image
16160 at several (or - in the case of @option{quality} level @code{6} - all) shifts
16161 and average the results.
16163 The filter accepts the following options:
16167 Set quality. This option defines the number of levels for averaging. It accepts
16168 an integer in the range 0-6. If set to @code{0}, the filter will have no
16169 effect. A value of @code{6} means the higher quality. For each increment of
16170 that value the speed drops by a factor of approximately 2. Default value is
16174 Force a constant quantization parameter. If not set, the filter will use the QP
16175 from the video stream (if available).
16178 Set thresholding mode. Available modes are:
16182 Set hard thresholding (default).
16184 Set soft thresholding (better de-ringing effect, but likely blurrier).
16187 @item use_bframe_qp
16188 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
16189 option may cause flicker since the B-Frames have often larger QP. Default is
16190 @code{0} (not enabled).
16195 Scale the input by applying one of the super-resolution methods based on
16196 convolutional neural networks. Supported models:
16200 Super-Resolution Convolutional Neural Network model (SRCNN).
16201 See @url{https://arxiv.org/abs/1501.00092}.
16204 Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
16205 See @url{https://arxiv.org/abs/1609.05158}.
16208 Training scripts as well as scripts for model generation are provided in
16209 the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
16211 The filter accepts the following options:
16215 Specify which DNN backend to use for model loading and execution. This option accepts
16216 the following values:
16220 Native implementation of DNN loading and execution.
16223 TensorFlow backend. To enable this backend you
16224 need to install the TensorFlow for C library (see
16225 @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
16226 @code{--enable-libtensorflow}
16229 Default value is @samp{native}.
16232 Set path to model file specifying network architecture and its parameters.
16233 Note that different backends use different file formats. TensorFlow backend
16234 can load files for both formats, while native backend can load files for only
16238 Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
16239 Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
16240 input upscaled using bicubic upscaling with proper scale factor.
16246 Draw subtitles on top of input video using the libass library.
16248 To enable compilation of this filter you need to configure FFmpeg with
16249 @code{--enable-libass}. This filter also requires a build with libavcodec and
16250 libavformat to convert the passed subtitles file to ASS (Advanced Substation
16251 Alpha) subtitles format.
16253 The filter accepts the following options:
16257 Set the filename of the subtitle file to read. It must be specified.
16259 @item original_size
16260 Specify the size of the original video, the video for which the ASS file
16261 was composed. For the syntax of this option, check the
16262 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16263 Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
16264 correctly scale the fonts if the aspect ratio has been changed.
16267 Set a directory path containing fonts that can be used by the filter.
16268 These fonts will be used in addition to whatever the font provider uses.
16271 Process alpha channel, by default alpha channel is untouched.
16274 Set subtitles input character encoding. @code{subtitles} filter only. Only
16275 useful if not UTF-8.
16277 @item stream_index, si
16278 Set subtitles stream index. @code{subtitles} filter only.
16281 Override default style or script info parameters of the subtitles. It accepts a
16282 string containing ASS style format @code{KEY=VALUE} couples separated by ",".
16285 If the first key is not specified, it is assumed that the first value
16286 specifies the @option{filename}.
16288 For example, to render the file @file{sub.srt} on top of the input
16289 video, use the command:
16294 which is equivalent to:
16296 subtitles=filename=sub.srt
16299 To render the default subtitles stream from file @file{video.mkv}, use:
16301 subtitles=video.mkv
16304 To render the second subtitles stream from that file, use:
16306 subtitles=video.mkv:si=1
16309 To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
16310 @code{DejaVu Serif}, use:
16312 subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
16315 @section super2xsai
16317 Scale the input by 2x and smooth using the Super2xSaI (Scale and
16318 Interpolate) pixel art scaling algorithm.
16320 Useful for enlarging pixel art images without reducing sharpness.
16324 Swap two rectangular objects in video.
16326 This filter accepts the following options:
16336 Set 1st rect x coordinate.
16339 Set 1st rect y coordinate.
16342 Set 2nd rect x coordinate.
16345 Set 2nd rect y coordinate.
16347 All expressions are evaluated once for each frame.
16350 The all options are expressions containing the following constants:
16355 The input width and height.
16358 same as @var{w} / @var{h}
16361 input sample aspect ratio
16364 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
16367 The number of the input frame, starting from 0.
16370 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
16373 the position in the file of the input frame, NAN if unknown
16381 Apply telecine process to the video.
16383 This filter accepts the following options:
16392 The default value is @code{top}.
16396 A string of numbers representing the pulldown pattern you wish to apply.
16397 The default value is @code{23}.
16401 Some typical patterns:
16406 24p: 2332 (preferred)
16413 24p: 222222222223 ("Euro pulldown")
16420 Apply threshold effect to video stream.
16422 This filter needs four video streams to perform thresholding.
16423 First stream is stream we are filtering.
16424 Second stream is holding threshold values, third stream is holding min values,
16425 and last, fourth stream is holding max values.
16427 The filter accepts the following option:
16431 Set which planes will be processed, unprocessed planes will be copied.
16432 By default value 0xf, all planes will be processed.
16435 For example if first stream pixel's component value is less then threshold value
16436 of pixel component from 2nd threshold stream, third stream value will picked,
16437 otherwise fourth stream pixel component value will be picked.
16439 Using color source filter one can perform various types of thresholding:
16441 @subsection Examples
16445 Binary threshold, using gray color as threshold:
16447 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
16451 Inverted binary threshold, using gray color as threshold:
16453 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
16457 Truncate binary threshold, using gray color as threshold:
16459 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
16463 Threshold to zero, using gray color as threshold:
16465 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
16469 Inverted threshold to zero, using gray color as threshold:
16471 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
16476 Select the most representative frame in a given sequence of consecutive frames.
16478 The filter accepts the following options:
16482 Set the frames batch size to analyze; in a set of @var{n} frames, the filter
16483 will pick one of them, and then handle the next batch of @var{n} frames until
16484 the end. Default is @code{100}.
16487 Since the filter keeps track of the whole frames sequence, a bigger @var{n}
16488 value will result in a higher memory usage, so a high value is not recommended.
16490 @subsection Examples
16494 Extract one picture each 50 frames:
16500 Complete example of a thumbnail creation with @command{ffmpeg}:
16502 ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
16508 Tile several successive frames together.
16510 The filter accepts the following options:
16515 Set the grid size (i.e. the number of lines and columns). For the syntax of
16516 this option, check the
16517 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16520 Set the maximum number of frames to render in the given area. It must be less
16521 than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
16522 the area will be used.
16525 Set the outer border margin in pixels.
16528 Set the inner border thickness (i.e. the number of pixels between frames). For
16529 more advanced padding options (such as having different values for the edges),
16530 refer to the pad video filter.
16533 Specify the color of the unused area. For the syntax of this option, check the
16534 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
16535 The default value of @var{color} is "black".
16538 Set the number of frames to overlap when tiling several successive frames together.
16539 The value must be between @code{0} and @var{nb_frames - 1}.
16542 Set the number of frames to initially be empty before displaying first output frame.
16543 This controls how soon will one get first output frame.
16544 The value must be between @code{0} and @var{nb_frames - 1}.
16547 @subsection Examples
16551 Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
16553 ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
16555 The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
16556 duplicating each output frame to accommodate the originally detected frame
16560 Display @code{5} pictures in an area of @code{3x2} frames,
16561 with @code{7} pixels between them, and @code{2} pixels of initial margin, using
16562 mixed flat and named options:
16564 tile=3x2:nb_frames=5:padding=7:margin=2
16568 @section tinterlace
16570 Perform various types of temporal field interlacing.
16572 Frames are counted starting from 1, so the first input frame is
16575 The filter accepts the following options:
16580 Specify the mode of the interlacing. This option can also be specified
16581 as a value alone. See below for a list of values for this option.
16583 Available values are:
16587 Move odd frames into the upper field, even into the lower field,
16588 generating a double height frame at half frame rate.
16592 Frame 1 Frame 2 Frame 3 Frame 4
16594 11111 22222 33333 44444
16595 11111 22222 33333 44444
16596 11111 22222 33333 44444
16597 11111 22222 33333 44444
16611 Only output odd frames, even frames are dropped, generating a frame with
16612 unchanged height at half frame rate.
16617 Frame 1 Frame 2 Frame 3 Frame 4
16619 11111 22222 33333 44444
16620 11111 22222 33333 44444
16621 11111 22222 33333 44444
16622 11111 22222 33333 44444
16632 Only output even frames, odd frames are dropped, generating a frame with
16633 unchanged height at half frame rate.
16638 Frame 1 Frame 2 Frame 3 Frame 4
16640 11111 22222 33333 44444
16641 11111 22222 33333 44444
16642 11111 22222 33333 44444
16643 11111 22222 33333 44444
16653 Expand each frame to full height, but pad alternate lines with black,
16654 generating a frame with double height at the same input frame rate.
16659 Frame 1 Frame 2 Frame 3 Frame 4
16661 11111 22222 33333 44444
16662 11111 22222 33333 44444
16663 11111 22222 33333 44444
16664 11111 22222 33333 44444
16667 11111 ..... 33333 .....
16668 ..... 22222 ..... 44444
16669 11111 ..... 33333 .....
16670 ..... 22222 ..... 44444
16671 11111 ..... 33333 .....
16672 ..... 22222 ..... 44444
16673 11111 ..... 33333 .....
16674 ..... 22222 ..... 44444
16678 @item interleave_top, 4
16679 Interleave the upper field from odd frames with the lower field from
16680 even frames, generating a frame with unchanged height at half frame rate.
16685 Frame 1 Frame 2 Frame 3 Frame 4
16687 11111<- 22222 33333<- 44444
16688 11111 22222<- 33333 44444<-
16689 11111<- 22222 33333<- 44444
16690 11111 22222<- 33333 44444<-
16700 @item interleave_bottom, 5
16701 Interleave the lower field from odd frames with the upper field from
16702 even frames, generating a frame with unchanged height at half frame rate.
16707 Frame 1 Frame 2 Frame 3 Frame 4
16709 11111 22222<- 33333 44444<-
16710 11111<- 22222 33333<- 44444
16711 11111 22222<- 33333 44444<-
16712 11111<- 22222 33333<- 44444
16722 @item interlacex2, 6
16723 Double frame rate with unchanged height. Frames are inserted each
16724 containing the second temporal field from the previous input frame and
16725 the first temporal field from the next input frame. This mode relies on
16726 the top_field_first flag. Useful for interlaced video displays with no
16727 field synchronisation.
16732 Frame 1 Frame 2 Frame 3 Frame 4
16734 11111 22222 33333 44444
16735 11111 22222 33333 44444
16736 11111 22222 33333 44444
16737 11111 22222 33333 44444
16740 11111 22222 22222 33333 33333 44444 44444
16741 11111 11111 22222 22222 33333 33333 44444
16742 11111 22222 22222 33333 33333 44444 44444
16743 11111 11111 22222 22222 33333 33333 44444
16748 Move odd frames into the upper field, even into the lower field,
16749 generating a double height frame at same frame rate.
16754 Frame 1 Frame 2 Frame 3 Frame 4
16756 11111 22222 33333 44444
16757 11111 22222 33333 44444
16758 11111 22222 33333 44444
16759 11111 22222 33333 44444
16762 11111 33333 33333 55555
16763 22222 22222 44444 44444
16764 11111 33333 33333 55555
16765 22222 22222 44444 44444
16766 11111 33333 33333 55555
16767 22222 22222 44444 44444
16768 11111 33333 33333 55555
16769 22222 22222 44444 44444
16774 Numeric values are deprecated but are accepted for backward
16775 compatibility reasons.
16777 Default mode is @code{merge}.
16780 Specify flags influencing the filter process.
16782 Available value for @var{flags} is:
16785 @item low_pass_filter, vlfp
16786 Enable linear vertical low-pass filtering in the filter.
16787 Vertical low-pass filtering is required when creating an interlaced
16788 destination from a progressive source which contains high-frequency
16789 vertical detail. Filtering will reduce interlace 'twitter' and Moire
16792 @item complex_filter, cvlfp
16793 Enable complex vertical low-pass filtering.
16794 This will slightly less reduce interlace 'twitter' and Moire
16795 patterning but better retain detail and subjective sharpness impression.
16799 Vertical low-pass filtering can only be enabled for @option{mode}
16800 @var{interleave_top} and @var{interleave_bottom}.
16806 Mix successive video frames.
16808 A description of the accepted options follows.
16812 The number of successive frames to mix. If unspecified, it defaults to 3.
16815 Specify weight of each input video frame.
16816 Each weight is separated by space. If number of weights is smaller than
16817 number of @var{frames} last specified weight will be used for all remaining
16821 Specify scale, if it is set it will be multiplied with sum
16822 of each weight multiplied with pixel values to give final destination
16823 pixel value. By default @var{scale} is auto scaled to sum of weights.
16826 @subsection Examples
16830 Average 7 successive frames:
16832 tmix=frames=7:weights="1 1 1 1 1 1 1"
16836 Apply simple temporal convolution:
16838 tmix=frames=3:weights="-1 3 -1"
16842 Similar as above but only showing temporal differences:
16844 tmix=frames=3:weights="-1 2 -1":scale=1
16850 Tone map colors from different dynamic ranges.
16852 This filter expects data in single precision floating point, as it needs to
16853 operate on (and can output) out-of-range values. Another filter, such as
16854 @ref{zscale}, is needed to convert the resulting frame to a usable format.
16856 The tonemapping algorithms implemented only work on linear light, so input
16857 data should be linearized beforehand (and possibly correctly tagged).
16860 ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
16863 @subsection Options
16864 The filter accepts the following options.
16868 Set the tone map algorithm to use.
16870 Possible values are:
16873 Do not apply any tone map, only desaturate overbright pixels.
16876 Hard-clip any out-of-range values. Use it for perfect color accuracy for
16877 in-range values, while distorting out-of-range values.
16880 Stretch the entire reference gamut to a linear multiple of the display.
16883 Fit a logarithmic transfer between the tone curves.
16886 Preserve overall image brightness with a simple curve, using nonlinear
16887 contrast, which results in flattening details and degrading color accuracy.
16890 Preserve both dark and bright details better than @var{reinhard}, at the cost
16891 of slightly darkening everything. Use it when detail preservation is more
16892 important than color and brightness accuracy.
16895 Smoothly map out-of-range values, while retaining contrast and colors for
16896 in-range material as much as possible. Use it when color accuracy is more
16897 important than detail preservation.
16903 Tune the tone mapping algorithm.
16905 This affects the following algorithms:
16911 Specifies the scale factor to use while stretching.
16915 Specifies the exponent of the function.
16919 Specify an extra linear coefficient to multiply into the signal before clipping.
16923 Specify the local contrast coefficient at the display peak.
16924 Default to 0.5, which means that in-gamut values will be about half as bright
16931 Specify the transition point from linear to mobius transform. Every value
16932 below this point is guaranteed to be mapped 1:1. The higher the value, the
16933 more accurate the result will be, at the cost of losing bright details.
16934 Default to 0.3, which due to the steep initial slope still preserves in-range
16935 colors fairly accurately.
16939 Apply desaturation for highlights that exceed this level of brightness. The
16940 higher the parameter, the more color information will be preserved. This
16941 setting helps prevent unnaturally blown-out colors for super-highlights, by
16942 (smoothly) turning into white instead. This makes images feel more natural,
16943 at the cost of reducing information about out-of-range colors.
16945 The default of 2.0 is somewhat conservative and will mostly just apply to
16946 skies or directly sunlit surfaces. A setting of 0.0 disables this option.
16948 This option works only if the input frame has a supported color tag.
16951 Override signal/nominal/reference peak with this value. Useful when the
16952 embedded peak information in display metadata is not reliable or when tone
16953 mapping from a lower range to a higher range.
16958 Temporarily pad video frames.
16960 The filter accepts the following options:
16964 Specify number of delay frames before input video stream.
16967 Specify number of padding frames after input video stream.
16968 Set to -1 to pad indefinitely.
16971 Set kind of frames added to beginning of stream.
16972 Can be either @var{add} or @var{clone}.
16973 With @var{add} frames of solid-color are added.
16974 With @var{clone} frames are clones of first frame.
16977 Set kind of frames added to end of stream.
16978 Can be either @var{add} or @var{clone}.
16979 With @var{add} frames of solid-color are added.
16980 With @var{clone} frames are clones of last frame.
16982 @item start_duration, stop_duration
16983 Specify the duration of the start/stop delay. See
16984 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
16985 for the accepted syntax.
16986 These options override @var{start} and @var{stop}.
16989 Specify the color of the padded area. For the syntax of this option,
16990 check the @ref{color syntax,,"Color" section in the ffmpeg-utils
16991 manual,ffmpeg-utils}.
16993 The default value of @var{color} is "black".
16999 Transpose rows with columns in the input video and optionally flip it.
17001 It accepts the following parameters:
17006 Specify the transposition direction.
17008 Can assume the following values:
17010 @item 0, 4, cclock_flip
17011 Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
17019 Rotate by 90 degrees clockwise, that is:
17027 Rotate by 90 degrees counterclockwise, that is:
17034 @item 3, 7, clock_flip
17035 Rotate by 90 degrees clockwise and vertically flip, that is:
17043 For values between 4-7, the transposition is only done if the input
17044 video geometry is portrait and not landscape. These values are
17045 deprecated, the @code{passthrough} option should be used instead.
17047 Numerical values are deprecated, and should be dropped in favor of
17048 symbolic constants.
17051 Do not apply the transposition if the input geometry matches the one
17052 specified by the specified value. It accepts the following values:
17055 Always apply transposition.
17057 Preserve portrait geometry (when @var{height} >= @var{width}).
17059 Preserve landscape geometry (when @var{width} >= @var{height}).
17062 Default value is @code{none}.
17065 For example to rotate by 90 degrees clockwise and preserve portrait
17068 transpose=dir=1:passthrough=portrait
17071 The command above can also be specified as:
17073 transpose=1:portrait
17076 @section transpose_npp
17078 Transpose rows with columns in the input video and optionally flip it.
17079 For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
17081 It accepts the following parameters:
17086 Specify the transposition direction.
17088 Can assume the following values:
17091 Rotate by 90 degrees counterclockwise and vertically flip. (default)
17094 Rotate by 90 degrees clockwise.
17097 Rotate by 90 degrees counterclockwise.
17100 Rotate by 90 degrees clockwise and vertically flip.
17104 Do not apply the transposition if the input geometry matches the one
17105 specified by the specified value. It accepts the following values:
17108 Always apply transposition. (default)
17110 Preserve portrait geometry (when @var{height} >= @var{width}).
17112 Preserve landscape geometry (when @var{width} >= @var{height}).
17118 Trim the input so that the output contains one continuous subpart of the input.
17120 It accepts the following parameters:
17123 Specify the time of the start of the kept section, i.e. the frame with the
17124 timestamp @var{start} will be the first frame in the output.
17127 Specify the time of the first frame that will be dropped, i.e. the frame
17128 immediately preceding the one with the timestamp @var{end} will be the last
17129 frame in the output.
17132 This is the same as @var{start}, except this option sets the start timestamp
17133 in timebase units instead of seconds.
17136 This is the same as @var{end}, except this option sets the end timestamp
17137 in timebase units instead of seconds.
17140 The maximum duration of the output in seconds.
17143 The number of the first frame that should be passed to the output.
17146 The number of the first frame that should be dropped.
17149 @option{start}, @option{end}, and @option{duration} are expressed as time
17150 duration specifications; see
17151 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
17152 for the accepted syntax.
17154 Note that the first two sets of the start/end options and the @option{duration}
17155 option look at the frame timestamp, while the _frame variants simply count the
17156 frames that pass through the filter. Also note that this filter does not modify
17157 the timestamps. If you wish for the output timestamps to start at zero, insert a
17158 setpts filter after the trim filter.
17160 If multiple start or end options are set, this filter tries to be greedy and
17161 keep all the frames that match at least one of the specified constraints. To keep
17162 only the part that matches all the constraints at once, chain multiple trim
17165 The defaults are such that all the input is kept. So it is possible to set e.g.
17166 just the end values to keep everything before the specified time.
17171 Drop everything except the second minute of input:
17173 ffmpeg -i INPUT -vf trim=60:120
17177 Keep only the first second:
17179 ffmpeg -i INPUT -vf trim=duration=1
17184 @section unpremultiply
17185 Apply alpha unpremultiply effect to input video stream using first plane
17186 of second stream as alpha.
17188 Both streams must have same dimensions and same pixel format.
17190 The filter accepts the following option:
17194 Set which planes will be processed, unprocessed planes will be copied.
17195 By default value 0xf, all planes will be processed.
17197 If the format has 1 or 2 components, then luma is bit 0.
17198 If the format has 3 or 4 components:
17199 for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
17200 for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
17201 If present, the alpha channel is always the last bit.
17204 Do not require 2nd input for processing, instead use alpha plane from input stream.
17210 Sharpen or blur the input video.
17212 It accepts the following parameters:
17215 @item luma_msize_x, lx
17216 Set the luma matrix horizontal size. It must be an odd integer between
17217 3 and 23. The default value is 5.
17219 @item luma_msize_y, ly
17220 Set the luma matrix vertical size. It must be an odd integer between 3
17221 and 23. The default value is 5.
17223 @item luma_amount, la
17224 Set the luma effect strength. It must be a floating point number, reasonable
17225 values lay between -1.5 and 1.5.
17227 Negative values will blur the input video, while positive values will
17228 sharpen it, a value of zero will disable the effect.
17230 Default value is 1.0.
17232 @item chroma_msize_x, cx
17233 Set the chroma matrix horizontal size. It must be an odd integer
17234 between 3 and 23. The default value is 5.
17236 @item chroma_msize_y, cy
17237 Set the chroma matrix vertical size. It must be an odd integer
17238 between 3 and 23. The default value is 5.
17240 @item chroma_amount, ca
17241 Set the chroma effect strength. It must be a floating point number, reasonable
17242 values lay between -1.5 and 1.5.
17244 Negative values will blur the input video, while positive values will
17245 sharpen it, a value of zero will disable the effect.
17247 Default value is 0.0.
17251 All parameters are optional and default to the equivalent of the
17252 string '5:5:1.0:5:5:0.0'.
17254 @subsection Examples
17258 Apply strong luma sharpen effect:
17260 unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
17264 Apply a strong blur of both luma and chroma parameters:
17266 unsharp=7:7:-2:7:7:-2
17272 Apply ultra slow/simple postprocessing filter that compresses and decompresses
17273 the image at several (or - in the case of @option{quality} level @code{8} - all)
17274 shifts and average the results.
17276 The way this differs from the behavior of spp is that uspp actually encodes &
17277 decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
17278 DCT similar to MJPEG.
17280 The filter accepts the following options:
17284 Set quality. This option defines the number of levels for averaging. It accepts
17285 an integer in the range 0-8. If set to @code{0}, the filter will have no
17286 effect. A value of @code{8} means the higher quality. For each increment of
17287 that value the speed drops by a factor of approximately 2. Default value is
17291 Force a constant quantization parameter. If not set, the filter will use the QP
17292 from the video stream (if available).
17295 @section vaguedenoiser
17297 Apply a wavelet based denoiser.
17299 It transforms each frame from the video input into the wavelet domain,
17300 using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
17301 the obtained coefficients. It does an inverse wavelet transform after.
17302 Due to wavelet properties, it should give a nice smoothed result, and
17303 reduced noise, without blurring picture features.
17305 This filter accepts the following options:
17309 The filtering strength. The higher, the more filtered the video will be.
17310 Hard thresholding can use a higher threshold than soft thresholding
17311 before the video looks overfiltered. Default value is 2.
17314 The filtering method the filter will use.
17316 It accepts the following values:
17319 All values under the threshold will be zeroed.
17322 All values under the threshold will be zeroed. All values above will be
17323 reduced by the threshold.
17326 Scales or nullifies coefficients - intermediary between (more) soft and
17327 (less) hard thresholding.
17330 Default is garrote.
17333 Number of times, the wavelet will decompose the picture. Picture can't
17334 be decomposed beyond a particular point (typically, 8 for a 640x480
17335 frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
17338 Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
17341 A list of the planes to process. By default all planes are processed.
17344 @section vectorscope
17346 Display 2 color component values in the two dimensional graph (which is called
17349 This filter accepts the following options:
17353 Set vectorscope mode.
17355 It accepts the following values:
17358 Gray values are displayed on graph, higher brightness means more pixels have
17359 same component color value on location in graph. This is the default mode.
17362 Gray values are displayed on graph. Surrounding pixels values which are not
17363 present in video frame are drawn in gradient of 2 color components which are
17364 set by option @code{x} and @code{y}. The 3rd color component is static.
17367 Actual color components values present in video frame are displayed on graph.
17370 Similar as color2 but higher frequency of same values @code{x} and @code{y}
17371 on graph increases value of another color component, which is luminance by
17372 default values of @code{x} and @code{y}.
17375 Actual colors present in video frame are displayed on graph. If two different
17376 colors map to same position on graph then color with higher value of component
17377 not present in graph is picked.
17380 Gray values are displayed on graph. Similar to @code{color} but with 3rd color
17381 component picked from radial gradient.
17385 Set which color component will be represented on X-axis. Default is @code{1}.
17388 Set which color component will be represented on Y-axis. Default is @code{2}.
17391 Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
17392 of color component which represents frequency of (X, Y) location in graph.
17397 No envelope, this is default.
17400 Instant envelope, even darkest single pixel will be clearly highlighted.
17403 Hold maximum and minimum values presented in graph over time. This way you
17404 can still spot out of range values without constantly looking at vectorscope.
17407 Peak and instant envelope combined together.
17411 Set what kind of graticule to draw.
17419 Set graticule opacity.
17422 Set graticule flags.
17426 Draw graticule for white point.
17429 Draw graticule for black point.
17432 Draw color points short names.
17436 Set background opacity.
17438 @item lthreshold, l
17439 Set low threshold for color component not represented on X or Y axis.
17440 Values lower than this value will be ignored. Default is 0.
17441 Note this value is multiplied with actual max possible value one pixel component
17442 can have. So for 8-bit input and low threshold value of 0.1 actual threshold
17445 @item hthreshold, h
17446 Set high threshold for color component not represented on X or Y axis.
17447 Values higher than this value will be ignored. Default is 1.
17448 Note this value is multiplied with actual max possible value one pixel component
17449 can have. So for 8-bit input and high threshold value of 0.9 actual threshold
17450 is 0.9 * 255 = 230.
17452 @item colorspace, c
17453 Set what kind of colorspace to use when drawing graticule.
17462 @anchor{vidstabdetect}
17463 @section vidstabdetect
17465 Analyze video stabilization/deshaking. Perform pass 1 of 2, see
17466 @ref{vidstabtransform} for pass 2.
17468 This filter generates a file with relative translation and rotation
17469 transform information about subsequent frames, which is then used by
17470 the @ref{vidstabtransform} filter.
17472 To enable compilation of this filter you need to configure FFmpeg with
17473 @code{--enable-libvidstab}.
17475 This filter accepts the following options:
17479 Set the path to the file used to write the transforms information.
17480 Default value is @file{transforms.trf}.
17483 Set how shaky the video is and how quick the camera is. It accepts an
17484 integer in the range 1-10, a value of 1 means little shakiness, a
17485 value of 10 means strong shakiness. Default value is 5.
17488 Set the accuracy of the detection process. It must be a value in the
17489 range 1-15. A value of 1 means low accuracy, a value of 15 means high
17490 accuracy. Default value is 15.
17493 Set stepsize of the search process. The region around minimum is
17494 scanned with 1 pixel resolution. Default value is 6.
17497 Set minimum contrast. Below this value a local measurement field is
17498 discarded. Must be a floating point value in the range 0-1. Default
17502 Set reference frame number for tripod mode.
17504 If enabled, the motion of the frames is compared to a reference frame
17505 in the filtered stream, identified by the specified number. The idea
17506 is to compensate all movements in a more-or-less static scene and keep
17507 the camera view absolutely still.
17509 If set to 0, it is disabled. The frames are counted starting from 1.
17512 Show fields and transforms in the resulting frames. It accepts an
17513 integer in the range 0-2. Default value is 0, which disables any
17517 @subsection Examples
17521 Use default values:
17527 Analyze strongly shaky movie and put the results in file
17528 @file{mytransforms.trf}:
17530 vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
17534 Visualize the result of internal transformations in the resulting
17537 vidstabdetect=show=1
17541 Analyze a video with medium shakiness using @command{ffmpeg}:
17543 ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
17547 @anchor{vidstabtransform}
17548 @section vidstabtransform
17550 Video stabilization/deshaking: pass 2 of 2,
17551 see @ref{vidstabdetect} for pass 1.
17553 Read a file with transform information for each frame and
17554 apply/compensate them. Together with the @ref{vidstabdetect}
17555 filter this can be used to deshake videos. See also
17556 @url{http://public.hronopik.de/vid.stab}. It is important to also use
17557 the @ref{unsharp} filter, see below.
17559 To enable compilation of this filter you need to configure FFmpeg with
17560 @code{--enable-libvidstab}.
17562 @subsection Options
17566 Set path to the file used to read the transforms. Default value is
17567 @file{transforms.trf}.
17570 Set the number of frames (value*2 + 1) used for lowpass filtering the
17571 camera movements. Default value is 10.
17573 For example a number of 10 means that 21 frames are used (10 in the
17574 past and 10 in the future) to smoothen the motion in the video. A
17575 larger value leads to a smoother video, but limits the acceleration of
17576 the camera (pan/tilt movements). 0 is a special case where a static
17577 camera is simulated.
17580 Set the camera path optimization algorithm.
17582 Accepted values are:
17585 gaussian kernel low-pass filter on camera motion (default)
17587 averaging on transformations
17591 Set maximal number of pixels to translate frames. Default value is -1,
17595 Set maximal angle in radians (degree*PI/180) to rotate frames. Default
17596 value is -1, meaning no limit.
17599 Specify how to deal with borders that may be visible due to movement
17602 Available values are:
17605 keep image information from previous frame (default)
17607 fill the border black
17611 Invert transforms if set to 1. Default value is 0.
17614 Consider transforms as relative to previous frame if set to 1,
17615 absolute if set to 0. Default value is 0.
17618 Set percentage to zoom. A positive value will result in a zoom-in
17619 effect, a negative value in a zoom-out effect. Default value is 0 (no
17623 Set optimal zooming to avoid borders.
17625 Accepted values are:
17630 optimal static zoom value is determined (only very strong movements
17631 will lead to visible borders) (default)
17633 optimal adaptive zoom value is determined (no borders will be
17634 visible), see @option{zoomspeed}
17637 Note that the value given at zoom is added to the one calculated here.
17640 Set percent to zoom maximally each frame (enabled when
17641 @option{optzoom} is set to 2). Range is from 0 to 5, default value is
17645 Specify type of interpolation.
17647 Available values are:
17652 linear only horizontal
17654 linear in both directions (default)
17656 cubic in both directions (slow)
17660 Enable virtual tripod mode if set to 1, which is equivalent to
17661 @code{relative=0:smoothing=0}. Default value is 0.
17663 Use also @code{tripod} option of @ref{vidstabdetect}.
17666 Increase log verbosity if set to 1. Also the detected global motions
17667 are written to the temporary file @file{global_motions.trf}. Default
17671 @subsection Examples
17675 Use @command{ffmpeg} for a typical stabilization with default values:
17677 ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
17680 Note the use of the @ref{unsharp} filter which is always recommended.
17683 Zoom in a bit more and load transform data from a given file:
17685 vidstabtransform=zoom=5:input="mytransforms.trf"
17689 Smoothen the video even more:
17691 vidstabtransform=smoothing=30
17697 Flip the input video vertically.
17699 For example, to vertically flip a video with @command{ffmpeg}:
17701 ffmpeg -i in.avi -vf "vflip" out.avi
17706 Detect variable frame rate video.
17708 This filter tries to detect if the input is variable or constant frame rate.
17710 At end it will output number of frames detected as having variable delta pts,
17711 and ones with constant delta pts.
17712 If there was frames with variable delta, than it will also show min and max delta
17717 Boost or alter saturation.
17719 The filter accepts the following options:
17722 Set strength of boost if positive value or strength of alter if negative value.
17723 Default is 0. Allowed range is from -2 to 2.
17726 Set the red balance. Default is 1. Allowed range is from -10 to 10.
17729 Set the green balance. Default is 1. Allowed range is from -10 to 10.
17732 Set the blue balance. Default is 1. Allowed range is from -10 to 10.
17735 Set the red luma coefficient.
17738 Set the green luma coefficient.
17741 Set the blue luma coefficient.
17747 Make or reverse a natural vignetting effect.
17749 The filter accepts the following options:
17753 Set lens angle expression as a number of radians.
17755 The value is clipped in the @code{[0,PI/2]} range.
17757 Default value: @code{"PI/5"}
17761 Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
17765 Set forward/backward mode.
17767 Available modes are:
17770 The larger the distance from the central point, the darker the image becomes.
17773 The larger the distance from the central point, the brighter the image becomes.
17774 This can be used to reverse a vignette effect, though there is no automatic
17775 detection to extract the lens @option{angle} and other settings (yet). It can
17776 also be used to create a burning effect.
17779 Default value is @samp{forward}.
17782 Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
17784 It accepts the following values:
17787 Evaluate expressions only once during the filter initialization.
17790 Evaluate expressions for each incoming frame. This is way slower than the
17791 @samp{init} mode since it requires all the scalers to be re-computed, but it
17792 allows advanced dynamic expressions.
17795 Default value is @samp{init}.
17798 Set dithering to reduce the circular banding effects. Default is @code{1}
17802 Set vignette aspect. This setting allows one to adjust the shape of the vignette.
17803 Setting this value to the SAR of the input will make a rectangular vignetting
17804 following the dimensions of the video.
17806 Default is @code{1/1}.
17809 @subsection Expressions
17811 The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
17812 following parameters.
17817 input width and height
17820 the number of input frame, starting from 0
17823 the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
17824 @var{TB} units, NAN if undefined
17827 frame rate of the input video, NAN if the input frame rate is unknown
17830 the PTS (Presentation TimeStamp) of the filtered video frame,
17831 expressed in seconds, NAN if undefined
17834 time base of the input video
17838 @subsection Examples
17842 Apply simple strong vignetting effect:
17848 Make a flickering vignetting:
17850 vignette='PI/4+random(1)*PI/50':eval=frame
17855 @section vmafmotion
17857 Obtain the average vmaf motion score of a video.
17858 It is one of the component filters of VMAF.
17860 The obtained average motion score is printed through the logging system.
17862 In the below example the input file @file{ref.mpg} is being processed and score
17866 ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
17870 Stack input videos vertically.
17872 All streams must be of same pixel format and of same width.
17874 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
17875 to create same output.
17877 The filter accept the following option:
17881 Set number of input streams. Default is 2.
17884 If set to 1, force the output to terminate when the shortest input
17885 terminates. Default value is 0.
17890 Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
17891 Deinterlacing Filter").
17893 Based on the process described by Martin Weston for BBC R&D, and
17894 implemented based on the de-interlace algorithm written by Jim
17895 Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
17896 uses filter coefficients calculated by BBC R&D.
17898 There are two sets of filter coefficients, so called "simple":
17899 and "complex". Which set of filter coefficients is used can
17900 be set by passing an optional parameter:
17904 Set the interlacing filter coefficients. Accepts one of the following values:
17908 Simple filter coefficient set.
17910 More-complex filter coefficient set.
17912 Default value is @samp{complex}.
17915 Specify which frames to deinterlace. Accept one of the following values:
17919 Deinterlace all frames,
17921 Only deinterlace frames marked as interlaced.
17924 Default value is @samp{all}.
17928 Video waveform monitor.
17930 The waveform monitor plots color component intensity. By default luminance
17931 only. Each column of the waveform corresponds to a column of pixels in the
17934 It accepts the following options:
17938 Can be either @code{row}, or @code{column}. Default is @code{column}.
17939 In row mode, the graph on the left side represents color component value 0 and
17940 the right side represents value = 255. In column mode, the top side represents
17941 color component value = 0 and bottom side represents value = 255.
17944 Set intensity. Smaller values are useful to find out how many values of the same
17945 luminance are distributed across input rows/columns.
17946 Default value is @code{0.04}. Allowed range is [0, 1].
17949 Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
17950 In mirrored mode, higher values will be represented on the left
17951 side for @code{row} mode and at the top for @code{column} mode. Default is
17952 @code{1} (mirrored).
17956 It accepts the following values:
17959 Presents information identical to that in the @code{parade}, except
17960 that the graphs representing color components are superimposed directly
17963 This display mode makes it easier to spot relative differences or similarities
17964 in overlapping areas of the color components that are supposed to be identical,
17965 such as neutral whites, grays, or blacks.
17968 Display separate graph for the color components side by side in
17969 @code{row} mode or one below the other in @code{column} mode.
17972 Display separate graph for the color components side by side in
17973 @code{column} mode or one below the other in @code{row} mode.
17975 Using this display mode makes it easy to spot color casts in the highlights
17976 and shadows of an image, by comparing the contours of the top and the bottom
17977 graphs of each waveform. Since whites, grays, and blacks are characterized
17978 by exactly equal amounts of red, green, and blue, neutral areas of the picture
17979 should display three waveforms of roughly equal width/height. If not, the
17980 correction is easy to perform by making level adjustments the three waveforms.
17982 Default is @code{stack}.
17984 @item components, c
17985 Set which color components to display. Default is 1, which means only luminance
17986 or red color component if input is in RGB colorspace. If is set for example to
17987 7 it will display all 3 (if) available color components.
17992 No envelope, this is default.
17995 Instant envelope, minimum and maximum values presented in graph will be easily
17996 visible even with small @code{step} value.
17999 Hold minimum and maximum values presented in graph across time. This way you
18000 can still spot out of range values without constantly looking at waveforms.
18003 Peak and instant envelope combined together.
18009 No filtering, this is default.
18012 Luma and chroma combined together.
18015 Similar as above, but shows difference between blue and red chroma.
18018 Similar as above, but use different colors.
18021 Displays only chroma.
18024 Displays actual color value on waveform.
18027 Similar as above, but with luma showing frequency of chroma values.
18031 Set which graticule to display.
18035 Do not display graticule.
18038 Display green graticule showing legal broadcast ranges.
18041 Display orange graticule showing legal broadcast ranges.
18045 Set graticule opacity.
18048 Set graticule flags.
18052 Draw numbers above lines. By default enabled.
18055 Draw dots instead of lines.
18059 Set scale used for displaying graticule.
18066 Default is digital.
18069 Set background opacity.
18072 @section weave, doubleweave
18074 The @code{weave} takes a field-based video input and join
18075 each two sequential fields into single frame, producing a new double
18076 height clip with half the frame rate and half the frame count.
18078 The @code{doubleweave} works same as @code{weave} but without
18079 halving frame rate and frame count.
18081 It accepts the following option:
18085 Set first field. Available values are:
18089 Set the frame as top-field-first.
18092 Set the frame as bottom-field-first.
18096 @subsection Examples
18100 Interlace video using @ref{select} and @ref{separatefields} filter:
18102 separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
18107 Apply the xBR high-quality magnification filter which is designed for pixel
18108 art. It follows a set of edge-detection rules, see
18109 @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
18111 It accepts the following option:
18115 Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
18116 @code{3xBR} and @code{4} for @code{4xBR}.
18117 Default is @code{3}.
18121 Stack video inputs into custom layout.
18123 All streams must be of same pixel format.
18125 The filter accept the following option:
18129 Set number of input streams. Default is 2.
18132 Specify layout of inputs.
18133 This option requires the desired layout configuration to be explicitly set by the user.
18134 This sets position of each video input in output. Each input
18135 is separated by '|'.
18136 The first number represents the column, and the second number represents the row.
18137 Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
18138 where X is video input from which to take width or height.
18139 Multiple values can be used when separated by '+'. In such
18140 case values are summed together.
18143 If set to 1, force the output to terminate when the shortest input
18144 terminates. Default value is 0.
18147 @subsection Examples
18151 Display 4 inputs into 2x2 grid,
18152 note that if inputs are of different sizes unused gaps might appear,
18153 as not all of output video is used.
18155 xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
18159 Display 4 inputs into 1x4 grid,
18160 note that if inputs are of different sizes unused gaps might appear,
18161 as not all of output video is used.
18163 xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
18167 Display 9 inputs into 3x3 grid,
18168 note that if inputs are of different sizes unused gaps might appear,
18169 as not all of output video is used.
18171 xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
18178 Deinterlace the input video ("yadif" means "yet another deinterlacing
18181 It accepts the following parameters:
18187 The interlacing mode to adopt. It accepts one of the following values:
18190 @item 0, send_frame
18191 Output one frame for each frame.
18192 @item 1, send_field
18193 Output one frame for each field.
18194 @item 2, send_frame_nospatial
18195 Like @code{send_frame}, but it skips the spatial interlacing check.
18196 @item 3, send_field_nospatial
18197 Like @code{send_field}, but it skips the spatial interlacing check.
18200 The default value is @code{send_frame}.
18203 The picture field parity assumed for the input interlaced video. It accepts one
18204 of the following values:
18208 Assume the top field is first.
18210 Assume the bottom field is first.
18212 Enable automatic detection of field parity.
18215 The default value is @code{auto}.
18216 If the interlacing is unknown or the decoder does not export this information,
18217 top field first will be assumed.
18220 Specify which frames to deinterlace. Accept one of the following
18225 Deinterlace all frames.
18226 @item 1, interlaced
18227 Only deinterlace frames marked as interlaced.
18230 The default value is @code{all}.
18233 @section yadif_cuda
18235 Deinterlace the input video using the @ref{yadif} algorithm, but implemented
18236 in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
18239 It accepts the following parameters:
18245 The interlacing mode to adopt. It accepts one of the following values:
18248 @item 0, send_frame
18249 Output one frame for each frame.
18250 @item 1, send_field
18251 Output one frame for each field.
18252 @item 2, send_frame_nospatial
18253 Like @code{send_frame}, but it skips the spatial interlacing check.
18254 @item 3, send_field_nospatial
18255 Like @code{send_field}, but it skips the spatial interlacing check.
18258 The default value is @code{send_frame}.
18261 The picture field parity assumed for the input interlaced video. It accepts one
18262 of the following values:
18266 Assume the top field is first.
18268 Assume the bottom field is first.
18270 Enable automatic detection of field parity.
18273 The default value is @code{auto}.
18274 If the interlacing is unknown or the decoder does not export this information,
18275 top field first will be assumed.
18278 Specify which frames to deinterlace. Accept one of the following
18283 Deinterlace all frames.
18284 @item 1, interlaced
18285 Only deinterlace frames marked as interlaced.
18288 The default value is @code{all}.
18293 Apply Zoom & Pan effect.
18295 This filter accepts the following options:
18299 Set the zoom expression. Default is 1.
18303 Set the x and y expression. Default is 0.
18306 Set the duration expression in number of frames.
18307 This sets for how many number of frames effect will last for
18308 single input image.
18311 Set the output image size, default is 'hd720'.
18314 Set the output frame rate, default is '25'.
18317 Each expression can contain the following constants:
18336 Output frame count.
18340 Last calculated 'x' and 'y' position from 'x' and 'y' expression
18341 for current input frame.
18345 'x' and 'y' of last output frame of previous input frame or 0 when there was
18346 not yet such frame (first input frame).
18349 Last calculated zoom from 'z' expression for current input frame.
18352 Last calculated zoom of last output frame of previous input frame.
18355 Number of output frames for current input frame. Calculated from 'd' expression
18356 for each input frame.
18359 number of output frames created for previous input frame
18362 Rational number: input width / input height
18365 sample aspect ratio
18368 display aspect ratio
18372 @subsection Examples
18376 Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
18378 zoompan=z='min(zoom+0.0015,1.5)':d=700:x='if(gte(zoom,1.5),x,x+1/a)':y='if(gte(zoom,1.5),y,y+1)':s=640x360
18382 Zoom-in up to 1.5 and pan always at center of picture:
18384 zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
18388 Same as above but without pausing:
18390 zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
18396 Scale (resize) the input video, using the z.lib library:
18397 @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
18398 filter, you need to configure FFmpeg with @code{--enable-libzimg}.
18400 The zscale filter forces the output display aspect ratio to be the same
18401 as the input, by changing the output sample aspect ratio.
18403 If the input image format is different from the format requested by
18404 the next filter, the zscale filter will convert the input to the
18407 @subsection Options
18408 The filter accepts the following options.
18413 Set the output video dimension expression. Default value is the input
18416 If the @var{width} or @var{w} value is 0, the input width is used for
18417 the output. If the @var{height} or @var{h} value is 0, the input height
18418 is used for the output.
18420 If one and only one of the values is -n with n >= 1, the zscale filter
18421 will use a value that maintains the aspect ratio of the input image,
18422 calculated from the other specified dimension. After that it will,
18423 however, make sure that the calculated dimension is divisible by n and
18424 adjust the value if necessary.
18426 If both values are -n with n >= 1, the behavior will be identical to
18427 both values being set to 0 as previously detailed.
18429 See below for the list of accepted constants for use in the dimension
18433 Set the video size. For the syntax of this option, check the
18434 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18437 Set the dither type.
18439 Possible values are:
18444 @item error_diffusion
18450 Set the resize filter type.
18452 Possible values are:
18462 Default is bilinear.
18465 Set the color range.
18467 Possible values are:
18474 Default is same as input.
18477 Set the color primaries.
18479 Possible values are:
18489 Default is same as input.
18492 Set the transfer characteristics.
18494 Possible values are:
18508 Default is same as input.
18511 Set the colorspace matrix.
18513 Possible value are:
18524 Default is same as input.
18527 Set the input color range.
18529 Possible values are:
18536 Default is same as input.
18538 @item primariesin, pin
18539 Set the input color primaries.
18541 Possible values are:
18551 Default is same as input.
18553 @item transferin, tin
18554 Set the input transfer characteristics.
18556 Possible values are:
18567 Default is same as input.
18569 @item matrixin, min
18570 Set the input colorspace matrix.
18572 Possible value are:
18584 Set the output chroma location.
18586 Possible values are:
18597 @item chromalin, cin
18598 Set the input chroma location.
18600 Possible values are:
18612 Set the nominal peak luminance.
18615 The values of the @option{w} and @option{h} options are expressions
18616 containing the following constants:
18621 The input width and height
18625 These are the same as @var{in_w} and @var{in_h}.
18629 The output (scaled) width and height
18633 These are the same as @var{out_w} and @var{out_h}
18636 The same as @var{iw} / @var{ih}
18639 input sample aspect ratio
18642 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
18646 horizontal and vertical input chroma subsample values. For example for the
18647 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
18651 horizontal and vertical output chroma subsample values. For example for the
18652 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
18658 @c man end VIDEO FILTERS
18660 @chapter OpenCL Video Filters
18661 @c man begin OPENCL VIDEO FILTERS
18663 Below is a description of the currently available OpenCL video filters.
18665 To enable compilation of these filters you need to configure FFmpeg with
18666 @code{--enable-opencl}.
18668 Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
18671 @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
18672 Initialise a new hardware device of type @var{opencl} called @var{name}, using the
18673 given device parameters.
18675 @item -filter_hw_device @var{name}
18676 Pass the hardware device called @var{name} to all filters in any filter graph.
18680 For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
18684 Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
18686 -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
18690 Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it may be necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
18692 @section avgblur_opencl
18694 Apply average blur filter.
18696 The filter accepts the following options:
18700 Set horizontal radius size.
18701 Range is @code{[1, 1024]} and default value is @code{1}.
18704 Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
18707 Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
18710 @subsection Example
18714 Apply average blur filter with horizontal and vertical size of 3, setting each pixel of the output to the average value of the 7x7 region centered on it in the input. For pixels on the edges of the image, the region does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
18716 -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
18720 @section boxblur_opencl
18722 Apply a boxblur algorithm to the input video.
18724 It accepts the following parameters:
18728 @item luma_radius, lr
18729 @item luma_power, lp
18730 @item chroma_radius, cr
18731 @item chroma_power, cp
18732 @item alpha_radius, ar
18733 @item alpha_power, ap
18737 A description of the accepted options follows.
18740 @item luma_radius, lr
18741 @item chroma_radius, cr
18742 @item alpha_radius, ar
18743 Set an expression for the box radius in pixels used for blurring the
18744 corresponding input plane.
18746 The radius value must be a non-negative number, and must not be
18747 greater than the value of the expression @code{min(w,h)/2} for the
18748 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
18751 Default value for @option{luma_radius} is "2". If not specified,
18752 @option{chroma_radius} and @option{alpha_radius} default to the
18753 corresponding value set for @option{luma_radius}.
18755 The expressions can contain the following constants:
18759 The input width and height in pixels.
18763 The input chroma image width and height in pixels.
18767 The horizontal and vertical chroma subsample values. For example, for the
18768 pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
18771 @item luma_power, lp
18772 @item chroma_power, cp
18773 @item alpha_power, ap
18774 Specify how many times the boxblur filter is applied to the
18775 corresponding plane.
18777 Default value for @option{luma_power} is 2. If not specified,
18778 @option{chroma_power} and @option{alpha_power} default to the
18779 corresponding value set for @option{luma_power}.
18781 A value of 0 will disable the effect.
18784 @subsection Examples
18786 Apply boxblur filter, setting each pixel of the output to the average value of box-radiuses @var{luma_radius}, @var{chroma_radius}, @var{alpha_radius} for each plane respectively. The filter will apply @var{luma_power}, @var{chroma_power}, @var{alpha_power} times onto the corresponding plane. For pixels on the edges of the image, the radius does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
18790 Apply a boxblur filter with the luma, chroma, and alpha radius
18791 set to 2 and luma, chroma, and alpha power set to 3. The filter will run 3 times with box-radius set to 2 for every plane of the image.
18793 -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
18794 -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
18798 Apply a boxblur filter with luma radius set to 2, luma_power to 1, chroma_radius to 4, chroma_power to 5, alpha_radius to 3 and alpha_power to 7.
18800 For the luma plane, a 2x2 box radius will be run once.
18802 For the chroma plane, a 4x4 box radius will be run 5 times.
18804 For the alpha plane, a 3x3 box radius will be run 7 times.
18806 -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
18810 @section convolution_opencl
18812 Apply convolution of 3x3, 5x5, 7x7 matrix.
18814 The filter accepts the following options:
18821 Set matrix for each plane.
18822 Matrix is sequence of 9, 25 or 49 signed numbers.
18823 Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
18829 Set multiplier for calculated value for each plane.
18830 If unset or 0, it will be sum of all matrix elements.
18831 The option value must be an float number greater or equal to @code{0.0}. Default value is @code{1.0}.
18837 Set bias for each plane. This value is added to the result of the multiplication.
18838 Useful for making the overall image brighter or darker.
18839 The option value must be an float number greater or equal to @code{0.0}. Default value is @code{0.0}.
18843 @subsection Examples
18849 -i INPUT -vf "hwupload, convolution_opencl=0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0, hwdownload" OUTPUT
18855 -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9, hwdownload" OUTPUT
18859 Apply edge enhance:
18861 -i INPUT -vf "hwupload, convolution_opencl=0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128, hwdownload" OUTPUT
18867 -i INPUT -vf "hwupload, convolution_opencl=0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128, hwdownload" OUTPUT
18871 Apply laplacian edge detector which includes diagonals:
18873 -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0, hwdownload" OUTPUT
18879 -i INPUT -vf "hwupload, convolution_opencl=-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2, hwdownload" OUTPUT
18883 @section dilation_opencl
18885 Apply dilation effect to the video.
18887 This filter replaces the pixel by the local(3x3) maximum.
18889 It accepts the following options:
18896 Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
18897 If @code{0}, plane will remain unchanged.
18900 Flag which specifies the pixel to refer to.
18901 Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
18903 Flags to local 3x3 coordinates region centered on @code{x}:
18912 @subsection Example
18916 Apply dilation filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local maximum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local maximum is more then threshold of the corresponding plane, output pixel will be set to input pixel + threshold of corresponding plane.
18918 -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
18922 @section erosion_opencl
18924 Apply erosion effect to the video.
18926 This filter replaces the pixel by the local(3x3) minimum.
18928 It accepts the following options:
18935 Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
18936 If @code{0}, plane will remain unchanged.
18939 Flag which specifies the pixel to refer to.
18940 Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
18942 Flags to local 3x3 coordinates region centered on @code{x}:
18951 @subsection Example
18955 Apply erosion filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local minimum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local minimum is more then threshold of the corresponding plane, output pixel will be set to input pixel - threshold of corresponding plane.
18957 -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
18961 @section overlay_opencl
18963 Overlay one video on top of another.
18965 It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
18966 This filter requires same memory layout for all the inputs. So, format conversion may be needed.
18968 The filter accepts the following options:
18973 Set the x coordinate of the overlaid video on the main video.
18974 Default value is @code{0}.
18977 Set the x coordinate of the overlaid video on the main video.
18978 Default value is @code{0}.
18982 @subsection Examples
18986 Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
18988 -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
18991 The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
18993 -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
18998 @section prewitt_opencl
19000 Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
19002 The filter accepts the following option:
19006 Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
19009 Set value which will be multiplied with filtered result.
19010 Range is @code{[0.0, 65535]} and default value is @code{1.0}.
19013 Set value which will be added to filtered result.
19014 Range is @code{[-65535, 65535]} and default value is @code{0.0}.
19017 @subsection Example
19021 Apply the Prewitt operator with scale set to 2 and delta set to 10.
19023 -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
19027 @section roberts_opencl
19028 Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
19030 The filter accepts the following option:
19034 Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
19037 Set value which will be multiplied with filtered result.
19038 Range is @code{[0.0, 65535]} and default value is @code{1.0}.
19041 Set value which will be added to filtered result.
19042 Range is @code{[-65535, 65535]} and default value is @code{0.0}.
19045 @subsection Example
19049 Apply the Roberts cross operator with scale set to 2 and delta set to 10
19051 -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
19055 @section sobel_opencl
19057 Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
19059 The filter accepts the following option:
19063 Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
19066 Set value which will be multiplied with filtered result.
19067 Range is @code{[0.0, 65535]} and default value is @code{1.0}.
19070 Set value which will be added to filtered result.
19071 Range is @code{[-65535, 65535]} and default value is @code{0.0}.
19074 @subsection Example
19078 Apply sobel operator with scale set to 2 and delta set to 10
19080 -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
19084 @section tonemap_opencl
19086 Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
19088 It accepts the following parameters:
19092 Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
19095 Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
19098 Apply desaturation for highlights that exceed this level of brightness. The
19099 higher the parameter, the more color information will be preserved. This
19100 setting helps prevent unnaturally blown-out colors for super-highlights, by
19101 (smoothly) turning into white instead. This makes images feel more natural,
19102 at the cost of reducing information about out-of-range colors.
19104 The default value is 0.5, and the algorithm here is a little different from
19105 the cpu version tonemap currently. A setting of 0.0 disables this option.
19108 The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
19109 is used to detect whether the scene has changed or not. If the distance beween
19110 the current frame average brightness and the current running average exceeds
19111 a threshold value, we would re-calculate scene average and peak brightness.
19112 The default value is 0.2.
19115 Specify the output pixel format.
19117 Currently supported formats are:
19124 Set the output color range.
19126 Possible values are:
19132 Default is same as input.
19135 Set the output color primaries.
19137 Possible values are:
19143 Default is same as input.
19146 Set the output transfer characteristics.
19148 Possible values are:
19157 Set the output colorspace matrix.
19159 Possible value are:
19165 Default is same as input.
19169 @subsection Example
19173 Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
19175 -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
19179 @section unsharp_opencl
19181 Sharpen or blur the input video.
19183 It accepts the following parameters:
19186 @item luma_msize_x, lx
19187 Set the luma matrix horizontal size.
19188 Range is @code{[1, 23]} and default value is @code{5}.
19190 @item luma_msize_y, ly
19191 Set the luma matrix vertical size.
19192 Range is @code{[1, 23]} and default value is @code{5}.
19194 @item luma_amount, la
19195 Set the luma effect strength.
19196 Range is @code{[-10, 10]} and default value is @code{1.0}.
19198 Negative values will blur the input video, while positive values will
19199 sharpen it, a value of zero will disable the effect.
19201 @item chroma_msize_x, cx
19202 Set the chroma matrix horizontal size.
19203 Range is @code{[1, 23]} and default value is @code{5}.
19205 @item chroma_msize_y, cy
19206 Set the chroma matrix vertical size.
19207 Range is @code{[1, 23]} and default value is @code{5}.
19209 @item chroma_amount, ca
19210 Set the chroma effect strength.
19211 Range is @code{[-10, 10]} and default value is @code{0.0}.
19213 Negative values will blur the input video, while positive values will
19214 sharpen it, a value of zero will disable the effect.
19218 All parameters are optional and default to the equivalent of the
19219 string '5:5:1.0:5:5:0.0'.
19221 @subsection Examples
19225 Apply strong luma sharpen effect:
19227 -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
19231 Apply a strong blur of both luma and chroma parameters:
19233 -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
19237 @c man end OPENCL VIDEO FILTERS
19239 @chapter Video Sources
19240 @c man begin VIDEO SOURCES
19242 Below is a description of the currently available video sources.
19246 Buffer video frames, and make them available to the filter chain.
19248 This source is mainly intended for a programmatic use, in particular
19249 through the interface defined in @file{libavfilter/vsrc_buffer.h}.
19251 It accepts the following parameters:
19256 Specify the size (width and height) of the buffered video frames. For the
19257 syntax of this option, check the
19258 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19261 The input video width.
19264 The input video height.
19267 A string representing the pixel format of the buffered video frames.
19268 It may be a number corresponding to a pixel format, or a pixel format
19272 Specify the timebase assumed by the timestamps of the buffered frames.
19275 Specify the frame rate expected for the video stream.
19277 @item pixel_aspect, sar
19278 The sample (pixel) aspect ratio of the input video.
19281 Specify the optional parameters to be used for the scale filter which
19282 is automatically inserted when an input change is detected in the
19283 input size or format.
19285 @item hw_frames_ctx
19286 When using a hardware pixel format, this should be a reference to an
19287 AVHWFramesContext describing input frames.
19292 buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
19295 will instruct the source to accept video frames with size 320x240 and
19296 with format "yuv410p", assuming 1/24 as the timestamps timebase and
19297 square pixels (1:1 sample aspect ratio).
19298 Since the pixel format with name "yuv410p" corresponds to the number 6
19299 (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
19300 this example corresponds to:
19302 buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
19305 Alternatively, the options can be specified as a flat string, but this
19306 syntax is deprecated:
19308 @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
19312 Create a pattern generated by an elementary cellular automaton.
19314 The initial state of the cellular automaton can be defined through the
19315 @option{filename} and @option{pattern} options. If such options are
19316 not specified an initial state is created randomly.
19318 At each new frame a new row in the video is filled with the result of
19319 the cellular automaton next generation. The behavior when the whole
19320 frame is filled is defined by the @option{scroll} option.
19322 This source accepts the following options:
19326 Read the initial cellular automaton state, i.e. the starting row, from
19327 the specified file.
19328 In the file, each non-whitespace character is considered an alive
19329 cell, a newline will terminate the row, and further characters in the
19330 file will be ignored.
19333 Read the initial cellular automaton state, i.e. the starting row, from
19334 the specified string.
19336 Each non-whitespace character in the string is considered an alive
19337 cell, a newline will terminate the row, and further characters in the
19338 string will be ignored.
19341 Set the video rate, that is the number of frames generated per second.
19344 @item random_fill_ratio, ratio
19345 Set the random fill ratio for the initial cellular automaton row. It
19346 is a floating point number value ranging from 0 to 1, defaults to
19349 This option is ignored when a file or a pattern is specified.
19351 @item random_seed, seed
19352 Set the seed for filling randomly the initial row, must be an integer
19353 included between 0 and UINT32_MAX. If not specified, or if explicitly
19354 set to -1, the filter will try to use a good random seed on a best
19358 Set the cellular automaton rule, it is a number ranging from 0 to 255.
19359 Default value is 110.
19362 Set the size of the output video. For the syntax of this option, check the
19363 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19365 If @option{filename} or @option{pattern} is specified, the size is set
19366 by default to the width of the specified initial state row, and the
19367 height is set to @var{width} * PHI.
19369 If @option{size} is set, it must contain the width of the specified
19370 pattern string, and the specified pattern will be centered in the
19373 If a filename or a pattern string is not specified, the size value
19374 defaults to "320x518" (used for a randomly generated initial state).
19377 If set to 1, scroll the output upward when all the rows in the output
19378 have been already filled. If set to 0, the new generated row will be
19379 written over the top row just after the bottom row is filled.
19382 @item start_full, full
19383 If set to 1, completely fill the output with generated rows before
19384 outputting the first frame.
19385 This is the default behavior, for disabling set the value to 0.
19388 If set to 1, stitch the left and right row edges together.
19389 This is the default behavior, for disabling set the value to 0.
19392 @subsection Examples
19396 Read the initial state from @file{pattern}, and specify an output of
19399 cellauto=f=pattern:s=200x400
19403 Generate a random initial row with a width of 200 cells, with a fill
19406 cellauto=ratio=2/3:s=200x200
19410 Create a pattern generated by rule 18 starting by a single alive cell
19411 centered on an initial row with width 100:
19413 cellauto=p=@@:s=100x400:full=0:rule=18
19417 Specify a more elaborated initial pattern:
19419 cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
19424 @anchor{coreimagesrc}
19425 @section coreimagesrc
19426 Video source generated on GPU using Apple's CoreImage API on OSX.
19428 This video source is a specialized version of the @ref{coreimage} video filter.
19429 Use a core image generator at the beginning of the applied filterchain to
19430 generate the content.
19432 The coreimagesrc video source accepts the following options:
19434 @item list_generators
19435 List all available generators along with all their respective options as well as
19436 possible minimum and maximum values along with the default values.
19438 list_generators=true
19442 Specify the size of the sourced video. For the syntax of this option, check the
19443 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19444 The default value is @code{320x240}.
19447 Specify the frame rate of the sourced video, as the number of frames
19448 generated per second. It has to be a string in the format
19449 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
19450 number or a valid video frame rate abbreviation. The default value is
19454 Set the sample aspect ratio of the sourced video.
19457 Set the duration of the sourced video. See
19458 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
19459 for the accepted syntax.
19461 If not specified, or the expressed duration is negative, the video is
19462 supposed to be generated forever.
19465 Additionally, all options of the @ref{coreimage} video filter are accepted.
19466 A complete filterchain can be used for further processing of the
19467 generated input without CPU-HOST transfer. See @ref{coreimage} documentation
19468 and examples for details.
19470 @subsection Examples
19475 Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
19476 given as complete and escaped command-line for Apple's standard bash shell:
19478 ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
19480 This example is equivalent to the QRCode example of @ref{coreimage} without the
19481 need for a nullsrc video source.
19485 @section mandelbrot
19487 Generate a Mandelbrot set fractal, and progressively zoom towards the
19488 point specified with @var{start_x} and @var{start_y}.
19490 This source accepts the following options:
19495 Set the terminal pts value. Default value is 400.
19498 Set the terminal scale value.
19499 Must be a floating point value. Default value is 0.3.
19502 Set the inner coloring mode, that is the algorithm used to draw the
19503 Mandelbrot fractal internal region.
19505 It shall assume one of the following values:
19510 Show time until convergence.
19512 Set color based on point closest to the origin of the iterations.
19517 Default value is @var{mincol}.
19520 Set the bailout value. Default value is 10.0.
19523 Set the maximum of iterations performed by the rendering
19524 algorithm. Default value is 7189.
19527 Set outer coloring mode.
19528 It shall assume one of following values:
19530 @item iteration_count
19531 Set iteration cound mode.
19532 @item normalized_iteration_count
19533 set normalized iteration count mode.
19535 Default value is @var{normalized_iteration_count}.
19538 Set frame rate, expressed as number of frames per second. Default
19542 Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
19543 size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
19546 Set the initial scale value. Default value is 3.0.
19549 Set the initial x position. Must be a floating point value between
19550 -100 and 100. Default value is -0.743643887037158704752191506114774.
19553 Set the initial y position. Must be a floating point value between
19554 -100 and 100. Default value is -0.131825904205311970493132056385139.
19559 Generate various test patterns, as generated by the MPlayer test filter.
19561 The size of the generated video is fixed, and is 256x256.
19562 This source is useful in particular for testing encoding features.
19564 This source accepts the following options:
19569 Specify the frame rate of the sourced video, as the number of frames
19570 generated per second. It has to be a string in the format
19571 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
19572 number or a valid video frame rate abbreviation. The default value is
19576 Set the duration of the sourced video. See
19577 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
19578 for the accepted syntax.
19580 If not specified, or the expressed duration is negative, the video is
19581 supposed to be generated forever.
19585 Set the number or the name of the test to perform. Supported tests are:
19601 Default value is "all", which will cycle through the list of all tests.
19606 mptestsrc=t=dc_luma
19609 will generate a "dc_luma" test pattern.
19611 @section frei0r_src
19613 Provide a frei0r source.
19615 To enable compilation of this filter you need to install the frei0r
19616 header and configure FFmpeg with @code{--enable-frei0r}.
19618 This source accepts the following parameters:
19623 The size of the video to generate. For the syntax of this option, check the
19624 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19627 The framerate of the generated video. It may be a string of the form
19628 @var{num}/@var{den} or a frame rate abbreviation.
19631 The name to the frei0r source to load. For more information regarding frei0r and
19632 how to set the parameters, read the @ref{frei0r} section in the video filters
19635 @item filter_params
19636 A '|'-separated list of parameters to pass to the frei0r source.
19640 For example, to generate a frei0r partik0l source with size 200x200
19641 and frame rate 10 which is overlaid on the overlay filter main input:
19643 frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
19648 Generate a life pattern.
19650 This source is based on a generalization of John Conway's life game.
19652 The sourced input represents a life grid, each pixel represents a cell
19653 which can be in one of two possible states, alive or dead. Every cell
19654 interacts with its eight neighbours, which are the cells that are
19655 horizontally, vertically, or diagonally adjacent.
19657 At each interaction the grid evolves according to the adopted rule,
19658 which specifies the number of neighbor alive cells which will make a
19659 cell stay alive or born. The @option{rule} option allows one to specify
19662 This source accepts the following options:
19666 Set the file from which to read the initial grid state. In the file,
19667 each non-whitespace character is considered an alive cell, and newline
19668 is used to delimit the end of each row.
19670 If this option is not specified, the initial grid is generated
19674 Set the video rate, that is the number of frames generated per second.
19677 @item random_fill_ratio, ratio
19678 Set the random fill ratio for the initial random grid. It is a
19679 floating point number value ranging from 0 to 1, defaults to 1/PHI.
19680 It is ignored when a file is specified.
19682 @item random_seed, seed
19683 Set the seed for filling the initial random grid, must be an integer
19684 included between 0 and UINT32_MAX. If not specified, or if explicitly
19685 set to -1, the filter will try to use a good random seed on a best
19691 A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
19692 where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
19693 @var{NS} specifies the number of alive neighbor cells which make a
19694 live cell stay alive, and @var{NB} the number of alive neighbor cells
19695 which make a dead cell to become alive (i.e. to "born").
19696 "s" and "b" can be used in place of "S" and "B", respectively.
19698 Alternatively a rule can be specified by an 18-bits integer. The 9
19699 high order bits are used to encode the next cell state if it is alive
19700 for each number of neighbor alive cells, the low order bits specify
19701 the rule for "borning" new cells. Higher order bits encode for an
19702 higher number of neighbor cells.
19703 For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
19704 rule of 12 and a born rule of 9, which corresponds to "S23/B03".
19706 Default value is "S23/B3", which is the original Conway's game of life
19707 rule, and will keep a cell alive if it has 2 or 3 neighbor alive
19708 cells, and will born a new cell if there are three alive cells around
19712 Set the size of the output video. For the syntax of this option, check the
19713 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19715 If @option{filename} is specified, the size is set by default to the
19716 same size of the input file. If @option{size} is set, it must contain
19717 the size specified in the input file, and the initial grid defined in
19718 that file is centered in the larger resulting area.
19720 If a filename is not specified, the size value defaults to "320x240"
19721 (used for a randomly generated initial grid).
19724 If set to 1, stitch the left and right grid edges together, and the
19725 top and bottom edges also. Defaults to 1.
19728 Set cell mold speed. If set, a dead cell will go from @option{death_color} to
19729 @option{mold_color} with a step of @option{mold}. @option{mold} can have a
19730 value from 0 to 255.
19733 Set the color of living (or new born) cells.
19736 Set the color of dead cells. If @option{mold} is set, this is the first color
19737 used to represent a dead cell.
19740 Set mold color, for definitely dead and moldy cells.
19742 For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
19743 ffmpeg-utils manual,ffmpeg-utils}.
19746 @subsection Examples
19750 Read a grid from @file{pattern}, and center it on a grid of size
19753 life=f=pattern:s=300x300
19757 Generate a random grid of size 200x200, with a fill ratio of 2/3:
19759 life=ratio=2/3:s=200x200
19763 Specify a custom rule for evolving a randomly generated grid:
19769 Full example with slow death effect (mold) using @command{ffplay}:
19771 ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
19778 @anchor{haldclutsrc}
19781 @anchor{pal100bars}
19782 @anchor{rgbtestsrc}
19784 @anchor{smptehdbars}
19787 @anchor{yuvtestsrc}
19788 @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
19790 The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
19792 The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
19794 The @code{color} source provides an uniformly colored input.
19796 The @code{haldclutsrc} source provides an identity Hald CLUT. See also
19797 @ref{haldclut} filter.
19799 The @code{nullsrc} source returns unprocessed video frames. It is
19800 mainly useful to be employed in analysis / debugging tools, or as the
19801 source for filters which ignore the input data.
19803 The @code{pal75bars} source generates a color bars pattern, based on
19804 EBU PAL recommendations with 75% color levels.
19806 The @code{pal100bars} source generates a color bars pattern, based on
19807 EBU PAL recommendations with 100% color levels.
19809 The @code{rgbtestsrc} source generates an RGB test pattern useful for
19810 detecting RGB vs BGR issues. You should see a red, green and blue
19811 stripe from top to bottom.
19813 The @code{smptebars} source generates a color bars pattern, based on
19814 the SMPTE Engineering Guideline EG 1-1990.
19816 The @code{smptehdbars} source generates a color bars pattern, based on
19817 the SMPTE RP 219-2002.
19819 The @code{testsrc} source generates a test video pattern, showing a
19820 color pattern, a scrolling gradient and a timestamp. This is mainly
19821 intended for testing purposes.
19823 The @code{testsrc2} source is similar to testsrc, but supports more
19824 pixel formats instead of just @code{rgb24}. This allows using it as an
19825 input for other tests without requiring a format conversion.
19827 The @code{yuvtestsrc} source generates an YUV test pattern. You should
19828 see a y, cb and cr stripe from top to bottom.
19830 The sources accept the following parameters:
19835 Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
19836 source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
19837 pixels to be used as identity matrix for 3D lookup tables. Each component is
19838 coded on a @code{1/(N*N)} scale.
19841 Specify the color of the source, only available in the @code{color}
19842 source. For the syntax of this option, check the
19843 @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
19846 Specify the size of the sourced video. For the syntax of this option, check the
19847 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19848 The default value is @code{320x240}.
19850 This option is not available with the @code{allrgb}, @code{allyuv}, and
19851 @code{haldclutsrc} filters.
19854 Specify the frame rate of the sourced video, as the number of frames
19855 generated per second. It has to be a string in the format
19856 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
19857 number or a valid video frame rate abbreviation. The default value is
19861 Set the duration of the sourced video. See
19862 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
19863 for the accepted syntax.
19865 If not specified, or the expressed duration is negative, the video is
19866 supposed to be generated forever.
19869 Set the sample aspect ratio of the sourced video.
19872 Specify the alpha (opacity) of the background, only available in the
19873 @code{testsrc2} source. The value must be between 0 (fully transparent) and
19874 255 (fully opaque, the default).
19877 Set the number of decimals to show in the timestamp, only available in the
19878 @code{testsrc} source.
19880 The displayed timestamp value will correspond to the original
19881 timestamp value multiplied by the power of 10 of the specified
19882 value. Default value is 0.
19885 @subsection Examples
19889 Generate a video with a duration of 5.3 seconds, with size
19890 176x144 and a frame rate of 10 frames per second:
19892 testsrc=duration=5.3:size=qcif:rate=10
19896 The following graph description will generate a red source
19897 with an opacity of 0.2, with size "qcif" and a frame rate of 10
19900 color=c=red@@0.2:s=qcif:r=10
19904 If the input content is to be ignored, @code{nullsrc} can be used. The
19905 following command generates noise in the luminance plane by employing
19906 the @code{geq} filter:
19908 nullsrc=s=256x256, geq=random(1)*255:128:128
19912 @subsection Commands
19914 The @code{color} source supports the following commands:
19918 Set the color of the created image. Accepts the same syntax of the
19919 corresponding @option{color} option.
19924 Generate video using an OpenCL program.
19929 OpenCL program source file.
19932 Kernel name in program.
19935 Size of frames to generate. This must be set.
19938 Pixel format to use for the generated frames. This must be set.
19941 Number of frames generated every second. Default value is '25'.
19945 For details of how the program loading works, see the @ref{program_opencl}
19952 Generate a colour ramp by setting pixel values from the position of the pixel
19953 in the output image. (Note that this will work with all pixel formats, but
19954 the generated output will not be the same.)
19956 __kernel void ramp(__write_only image2d_t dst,
19957 unsigned int index)
19959 int2 loc = (int2)(get_global_id(0), get_global_id(1));
19962 val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
19964 write_imagef(dst, loc, val);
19969 Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
19971 __kernel void sierpinski_carpet(__write_only image2d_t dst,
19972 unsigned int index)
19974 int2 loc = (int2)(get_global_id(0), get_global_id(1));
19976 float4 value = 0.0f;
19977 int x = loc.x + index;
19978 int y = loc.y + index;
19979 while (x > 0 || y > 0) {
19980 if (x % 3 == 1 && y % 3 == 1) {
19988 write_imagef(dst, loc, value);
19994 @c man end VIDEO SOURCES
19996 @chapter Video Sinks
19997 @c man begin VIDEO SINKS
19999 Below is a description of the currently available video sinks.
20001 @section buffersink
20003 Buffer video frames, and make them available to the end of the filter
20006 This sink is mainly intended for programmatic use, in particular
20007 through the interface defined in @file{libavfilter/buffersink.h}
20008 or the options system.
20010 It accepts a pointer to an AVBufferSinkContext structure, which
20011 defines the incoming buffers' formats, to be passed as the opaque
20012 parameter to @code{avfilter_init_filter} for initialization.
20016 Null video sink: do absolutely nothing with the input video. It is
20017 mainly useful as a template and for use in analysis / debugging
20020 @c man end VIDEO SINKS
20022 @chapter Multimedia Filters
20023 @c man begin MULTIMEDIA FILTERS
20025 Below is a description of the currently available multimedia filters.
20029 Convert input audio to a video output, displaying the audio bit scope.
20031 The filter accepts the following options:
20035 Set frame rate, expressed as number of frames per second. Default
20039 Specify the video size for the output. For the syntax of this option, check the
20040 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20041 Default value is @code{1024x256}.
20044 Specify list of colors separated by space or by '|' which will be used to
20045 draw channels. Unrecognized or missing colors will be replaced
20049 @section ahistogram
20051 Convert input audio to a video output, displaying the volume histogram.
20053 The filter accepts the following options:
20057 Specify how histogram is calculated.
20059 It accepts the following values:
20062 Use single histogram for all channels.
20064 Use separate histogram for each channel.
20066 Default is @code{single}.
20069 Set frame rate, expressed as number of frames per second. Default
20073 Specify the video size for the output. For the syntax of this option, check the
20074 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20075 Default value is @code{hd720}.
20080 It accepts the following values:
20091 reverse logarithmic
20093 Default is @code{log}.
20096 Set amplitude scale.
20098 It accepts the following values:
20105 Default is @code{log}.
20108 Set how much frames to accumulate in histogram.
20109 Defauls is 1. Setting this to -1 accumulates all frames.
20112 Set histogram ratio of window height.
20115 Set sonogram sliding.
20117 It accepts the following values:
20120 replace old rows with new ones.
20122 scroll from top to bottom.
20124 Default is @code{replace}.
20127 @section aphasemeter
20129 Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
20130 representing mean phase of current audio frame. A video output can also be produced and is
20131 enabled by default. The audio is passed through as first output.
20133 Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
20134 range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
20135 and @code{1} means channels are in phase.
20137 The filter accepts the following options, all related to its video output:
20141 Set the output frame rate. Default value is @code{25}.
20144 Set the video size for the output. For the syntax of this option, check the
20145 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20146 Default value is @code{800x400}.
20151 Specify the red, green, blue contrast. Default values are @code{2},
20152 @code{7} and @code{1}.
20153 Allowed range is @code{[0, 255]}.
20156 Set color which will be used for drawing median phase. If color is
20157 @code{none} which is default, no median phase value will be drawn.
20160 Enable video output. Default is enabled.
20163 @section avectorscope
20165 Convert input audio to a video output, representing the audio vector
20168 The filter is used to measure the difference between channels of stereo
20169 audio stream. A monoaural signal, consisting of identical left and right
20170 signal, results in straight vertical line. Any stereo separation is visible
20171 as a deviation from this line, creating a Lissajous figure.
20172 If the straight (or deviation from it) but horizontal line appears this
20173 indicates that the left and right channels are out of phase.
20175 The filter accepts the following options:
20179 Set the vectorscope mode.
20181 Available values are:
20184 Lissajous rotated by 45 degrees.
20187 Same as above but not rotated.
20190 Shape resembling half of circle.
20193 Default value is @samp{lissajous}.
20196 Set the video size for the output. For the syntax of this option, check the
20197 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20198 Default value is @code{400x400}.
20201 Set the output frame rate. Default value is @code{25}.
20207 Specify the red, green, blue and alpha contrast. Default values are @code{40},
20208 @code{160}, @code{80} and @code{255}.
20209 Allowed range is @code{[0, 255]}.
20215 Specify the red, green, blue and alpha fade. Default values are @code{15},
20216 @code{10}, @code{5} and @code{5}.
20217 Allowed range is @code{[0, 255]}.
20220 Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
20221 Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
20224 Set the vectorscope drawing mode.
20226 Available values are:
20229 Draw dot for each sample.
20232 Draw line between previous and current sample.
20235 Default value is @samp{dot}.
20238 Specify amplitude scale of audio samples.
20240 Available values are:
20256 Swap left channel axis with right channel axis.
20266 Mirror only x axis.
20269 Mirror only y axis.
20277 @subsection Examples
20281 Complete example using @command{ffplay}:
20283 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
20284 [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
20288 @section bench, abench
20290 Benchmark part of a filtergraph.
20292 The filter accepts the following options:
20296 Start or stop a timer.
20298 Available values are:
20301 Get the current time, set it as frame metadata (using the key
20302 @code{lavfi.bench.start_time}), and forward the frame to the next filter.
20305 Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
20306 the input frame metadata to get the time difference. Time difference, average,
20307 maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
20308 @code{min}) are then printed. The timestamps are expressed in seconds.
20312 @subsection Examples
20316 Benchmark @ref{selectivecolor} filter:
20318 bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
20324 Concatenate audio and video streams, joining them together one after the
20327 The filter works on segments of synchronized video and audio streams. All
20328 segments must have the same number of streams of each type, and that will
20329 also be the number of streams at output.
20331 The filter accepts the following options:
20336 Set the number of segments. Default is 2.
20339 Set the number of output video streams, that is also the number of video
20340 streams in each segment. Default is 1.
20343 Set the number of output audio streams, that is also the number of audio
20344 streams in each segment. Default is 0.
20347 Activate unsafe mode: do not fail if segments have a different format.
20351 The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
20352 @var{a} audio outputs.
20354 There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
20355 segment, in the same order as the outputs, then the inputs for the second
20358 Related streams do not always have exactly the same duration, for various
20359 reasons including codec frame size or sloppy authoring. For that reason,
20360 related synchronized streams (e.g. a video and its audio track) should be
20361 concatenated at once. The concat filter will use the duration of the longest
20362 stream in each segment (except the last one), and if necessary pad shorter
20363 audio streams with silence.
20365 For this filter to work correctly, all segments must start at timestamp 0.
20367 All corresponding streams must have the same parameters in all segments; the
20368 filtering system will automatically select a common pixel format for video
20369 streams, and a common sample format, sample rate and channel layout for
20370 audio streams, but other settings, such as resolution, must be converted
20371 explicitly by the user.
20373 Different frame rates are acceptable but will result in variable frame rate
20374 at output; be sure to configure the output file to handle it.
20376 @subsection Examples
20380 Concatenate an opening, an episode and an ending, all in bilingual version
20381 (video in stream 0, audio in streams 1 and 2):
20383 ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
20384 '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
20385 concat=n=3:v=1:a=2 [v] [a1] [a2]' \
20386 -map '[v]' -map '[a1]' -map '[a2]' output.mkv
20390 Concatenate two parts, handling audio and video separately, using the
20391 (a)movie sources, and adjusting the resolution:
20393 movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
20394 movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
20395 [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
20397 Note that a desync will happen at the stitch if the audio and video streams
20398 do not have exactly the same duration in the first file.
20402 @subsection Commands
20404 This filter supports the following commands:
20407 Close the current segment and step to the next one
20410 @section drawgraph, adrawgraph
20412 Draw a graph using input video or audio metadata.
20414 It accepts the following parameters:
20418 Set 1st frame metadata key from which metadata values will be used to draw a graph.
20421 Set 1st foreground color expression.
20424 Set 2nd frame metadata key from which metadata values will be used to draw a graph.
20427 Set 2nd foreground color expression.
20430 Set 3rd frame metadata key from which metadata values will be used to draw a graph.
20433 Set 3rd foreground color expression.
20436 Set 4th frame metadata key from which metadata values will be used to draw a graph.
20439 Set 4th foreground color expression.
20442 Set minimal value of metadata value.
20445 Set maximal value of metadata value.
20448 Set graph background color. Default is white.
20453 Available values for mode is:
20460 Default is @code{line}.
20465 Available values for slide is:
20468 Draw new frame when right border is reached.
20471 Replace old columns with new ones.
20474 Scroll from right to left.
20477 Scroll from left to right.
20480 Draw single picture.
20483 Default is @code{frame}.
20486 Set size of graph video. For the syntax of this option, check the
20487 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20488 The default value is @code{900x256}.
20490 The foreground color expressions can use the following variables:
20493 Minimal value of metadata value.
20496 Maximal value of metadata value.
20499 Current metadata key value.
20502 The color is defined as 0xAABBGGRR.
20505 Example using metadata from @ref{signalstats} filter:
20507 signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
20510 Example using metadata from @ref{ebur128} filter:
20512 ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
20518 EBU R128 scanner filter. This filter takes an audio stream as input and outputs
20519 it unchanged. By default, it logs a message at a frequency of 10Hz with the
20520 Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
20521 Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
20523 The filter also has a video output (see the @var{video} option) with a real
20524 time graph to observe the loudness evolution. The graphic contains the logged
20525 message mentioned above, so it is not printed anymore when this option is set,
20526 unless the verbose logging is set. The main graphing area contains the
20527 short-term loudness (3 seconds of analysis), and the gauge on the right is for
20528 the momentary loudness (400 milliseconds), but can optionally be configured
20529 to instead display short-term loudness (see @var{gauge}).
20531 The green area marks a +/- 1LU target range around the target loudness
20532 (-23LUFS by default, unless modified through @var{target}).
20534 More information about the Loudness Recommendation EBU R128 on
20535 @url{http://tech.ebu.ch/loudness}.
20537 The filter accepts the following options:
20542 Activate the video output. The audio stream is passed unchanged whether this
20543 option is set or no. The video stream will be the first output stream if
20544 activated. Default is @code{0}.
20547 Set the video size. This option is for video only. For the syntax of this
20549 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
20550 Default and minimum resolution is @code{640x480}.
20553 Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
20554 @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
20555 other integer value between this range is allowed.
20558 Set metadata injection. If set to @code{1}, the audio input will be segmented
20559 into 100ms output frames, each of them containing various loudness information
20560 in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
20562 Default is @code{0}.
20565 Force the frame logging level.
20567 Available values are:
20570 information logging level
20572 verbose logging level
20575 By default, the logging level is set to @var{info}. If the @option{video} or
20576 the @option{metadata} options are set, it switches to @var{verbose}.
20581 Available modes can be cumulated (the option is a @code{flag} type). Possible
20585 Disable any peak mode (default).
20587 Enable sample-peak mode.
20589 Simple peak mode looking for the higher sample value. It logs a message
20590 for sample-peak (identified by @code{SPK}).
20592 Enable true-peak mode.
20594 If enabled, the peak lookup is done on an over-sampled version of the input
20595 stream for better peak accuracy. It logs a message for true-peak.
20596 (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
20597 This mode requires a build with @code{libswresample}.
20601 Treat mono input files as "dual mono". If a mono file is intended for playback
20602 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
20603 If set to @code{true}, this option will compensate for this effect.
20604 Multi-channel input files are not affected by this option.
20607 Set a specific pan law to be used for the measurement of dual mono files.
20608 This parameter is optional, and has a default value of -3.01dB.
20611 Set a specific target level (in LUFS) used as relative zero in the visualization.
20612 This parameter is optional and has a default value of -23LUFS as specified
20613 by EBU R128. However, material published online may prefer a level of -16LUFS
20614 (e.g. for use with podcasts or video platforms).
20617 Set the value displayed by the gauge. Valid values are @code{momentary} and s
20618 @code{shortterm}. By default the momentary value will be used, but in certain
20619 scenarios it may be more useful to observe the short term value instead (e.g.
20623 Sets the display scale for the loudness. Valid parameters are @code{absolute}
20624 (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
20625 video output, not the summary or continuous log output.
20628 @subsection Examples
20632 Real-time graph using @command{ffplay}, with a EBU scale meter +18:
20634 ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
20638 Run an analysis with @command{ffmpeg}:
20640 ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
20644 @section interleave, ainterleave
20646 Temporally interleave frames from several inputs.
20648 @code{interleave} works with video inputs, @code{ainterleave} with audio.
20650 These filters read frames from several inputs and send the oldest
20651 queued frame to the output.
20653 Input streams must have well defined, monotonically increasing frame
20656 In order to submit one frame to output, these filters need to enqueue
20657 at least one frame for each input, so they cannot work in case one
20658 input is not yet terminated and will not receive incoming frames.
20660 For example consider the case when one input is a @code{select} filter
20661 which always drops input frames. The @code{interleave} filter will keep
20662 reading from that input, but it will never be able to send new frames
20663 to output until the input sends an end-of-stream signal.
20665 Also, depending on inputs synchronization, the filters will drop
20666 frames in case one input receives more frames than the other ones, and
20667 the queue is already filled.
20669 These filters accept the following options:
20673 Set the number of different inputs, it is 2 by default.
20676 @subsection Examples
20680 Interleave frames belonging to different streams using @command{ffmpeg}:
20682 ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
20686 Add flickering blur effect:
20688 select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
20692 @section metadata, ametadata
20694 Manipulate frame metadata.
20696 This filter accepts the following options:
20700 Set mode of operation of the filter.
20702 Can be one of the following:
20706 If both @code{value} and @code{key} is set, select frames
20707 which have such metadata. If only @code{key} is set, select
20708 every frame that has such key in metadata.
20711 Add new metadata @code{key} and @code{value}. If key is already available
20715 Modify value of already present key.
20718 If @code{value} is set, delete only keys that have such value.
20719 Otherwise, delete key. If @code{key} is not set, delete all metadata values in
20723 Print key and its value if metadata was found. If @code{key} is not set print all
20724 metadata values available in frame.
20728 Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
20731 Set metadata value which will be used. This option is mandatory for
20732 @code{modify} and @code{add} mode.
20735 Which function to use when comparing metadata value and @code{value}.
20737 Can be one of following:
20741 Values are interpreted as strings, returns true if metadata value is same as @code{value}.
20744 Values are interpreted as strings, returns true if metadata value starts with
20745 the @code{value} option string.
20748 Values are interpreted as floats, returns true if metadata value is less than @code{value}.
20751 Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
20754 Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
20757 Values are interpreted as floats, returns true if expression from option @code{expr}
20762 Set expression which is used when @code{function} is set to @code{expr}.
20763 The expression is evaluated through the eval API and can contain the following
20768 Float representation of @code{value} from metadata key.
20771 Float representation of @code{value} as supplied by user in @code{value} option.
20775 If specified in @code{print} mode, output is written to the named file. Instead of
20776 plain filename any writable url can be specified. Filename ``-'' is a shorthand
20777 for standard output. If @code{file} option is not set, output is written to the log
20778 with AV_LOG_INFO loglevel.
20782 @subsection Examples
20786 Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
20789 signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
20792 Print silencedetect output to file @file{metadata.txt}.
20794 silencedetect,ametadata=mode=print:file=metadata.txt
20797 Direct all metadata to a pipe with file descriptor 4.
20799 metadata=mode=print:file='pipe\:4'
20803 @section perms, aperms
20805 Set read/write permissions for the output frames.
20807 These filters are mainly aimed at developers to test direct path in the
20808 following filter in the filtergraph.
20810 The filters accept the following options:
20814 Select the permissions mode.
20816 It accepts the following values:
20819 Do nothing. This is the default.
20821 Set all the output frames read-only.
20823 Set all the output frames directly writable.
20825 Make the frame read-only if writable, and writable if read-only.
20827 Set each output frame read-only or writable randomly.
20831 Set the seed for the @var{random} mode, must be an integer included between
20832 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
20833 @code{-1}, the filter will try to use a good random seed on a best effort
20837 Note: in case of auto-inserted filter between the permission filter and the
20838 following one, the permission might not be received as expected in that
20839 following filter. Inserting a @ref{format} or @ref{aformat} filter before the
20840 perms/aperms filter can avoid this problem.
20842 @section realtime, arealtime
20844 Slow down filtering to match real time approximately.
20846 These filters will pause the filtering for a variable amount of time to
20847 match the output rate with the input timestamps.
20848 They are similar to the @option{re} option to @code{ffmpeg}.
20850 They accept the following options:
20854 Time limit for the pauses. Any pause longer than that will be considered
20855 a timestamp discontinuity and reset the timer. Default is 2 seconds.
20859 @section select, aselect
20861 Select frames to pass in output.
20863 This filter accepts the following options:
20868 Set expression, which is evaluated for each input frame.
20870 If the expression is evaluated to zero, the frame is discarded.
20872 If the evaluation result is negative or NaN, the frame is sent to the
20873 first output; otherwise it is sent to the output with index
20874 @code{ceil(val)-1}, assuming that the input index starts from 0.
20876 For example a value of @code{1.2} corresponds to the output with index
20877 @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
20880 Set the number of outputs. The output to which to send the selected
20881 frame is based on the result of the evaluation. Default value is 1.
20884 The expression can contain the following constants:
20888 The (sequential) number of the filtered frame, starting from 0.
20891 The (sequential) number of the selected frame, starting from 0.
20893 @item prev_selected_n
20894 The sequential number of the last selected frame. It's NAN if undefined.
20897 The timebase of the input timestamps.
20900 The PTS (Presentation TimeStamp) of the filtered video frame,
20901 expressed in @var{TB} units. It's NAN if undefined.
20904 The PTS of the filtered video frame,
20905 expressed in seconds. It's NAN if undefined.
20908 The PTS of the previously filtered video frame. It's NAN if undefined.
20910 @item prev_selected_pts
20911 The PTS of the last previously filtered video frame. It's NAN if undefined.
20913 @item prev_selected_t
20914 The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
20917 The PTS of the first video frame in the video. It's NAN if undefined.
20920 The time of the first video frame in the video. It's NAN if undefined.
20922 @item pict_type @emph{(video only)}
20923 The type of the filtered frame. It can assume one of the following
20935 @item interlace_type @emph{(video only)}
20936 The frame interlace type. It can assume one of the following values:
20939 The frame is progressive (not interlaced).
20941 The frame is top-field-first.
20943 The frame is bottom-field-first.
20946 @item consumed_sample_n @emph{(audio only)}
20947 the number of selected samples before the current frame
20949 @item samples_n @emph{(audio only)}
20950 the number of samples in the current frame
20952 @item sample_rate @emph{(audio only)}
20953 the input sample rate
20956 This is 1 if the filtered frame is a key-frame, 0 otherwise.
20959 the position in the file of the filtered frame, -1 if the information
20960 is not available (e.g. for synthetic video)
20962 @item scene @emph{(video only)}
20963 value between 0 and 1 to indicate a new scene; a low value reflects a low
20964 probability for the current frame to introduce a new scene, while a higher
20965 value means the current frame is more likely to be one (see the example below)
20967 @item concatdec_select
20968 The concat demuxer can select only part of a concat input file by setting an
20969 inpoint and an outpoint, but the output packets may not be entirely contained
20970 in the selected interval. By using this variable, it is possible to skip frames
20971 generated by the concat demuxer which are not exactly contained in the selected
20974 This works by comparing the frame pts against the @var{lavf.concat.start_time}
20975 and the @var{lavf.concat.duration} packet metadata values which are also
20976 present in the decoded frames.
20978 The @var{concatdec_select} variable is -1 if the frame pts is at least
20979 start_time and either the duration metadata is missing or the frame pts is less
20980 than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
20983 That basically means that an input frame is selected if its pts is within the
20984 interval set by the concat demuxer.
20988 The default value of the select expression is "1".
20990 @subsection Examples
20994 Select all frames in input:
20999 The example above is the same as:
21011 Select only I-frames:
21013 select='eq(pict_type\,I)'
21017 Select one frame every 100:
21019 select='not(mod(n\,100))'
21023 Select only frames contained in the 10-20 time interval:
21025 select=between(t\,10\,20)
21029 Select only I-frames contained in the 10-20 time interval:
21031 select=between(t\,10\,20)*eq(pict_type\,I)
21035 Select frames with a minimum distance of 10 seconds:
21037 select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
21041 Use aselect to select only audio frames with samples number > 100:
21043 aselect='gt(samples_n\,100)'
21047 Create a mosaic of the first scenes:
21049 ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
21052 Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
21056 Send even and odd frames to separate outputs, and compose them:
21058 select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
21062 Select useful frames from an ffconcat file which is using inpoints and
21063 outpoints but where the source files are not intra frame only.
21065 ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
21069 @section sendcmd, asendcmd
21071 Send commands to filters in the filtergraph.
21073 These filters read commands to be sent to other filters in the
21076 @code{sendcmd} must be inserted between two video filters,
21077 @code{asendcmd} must be inserted between two audio filters, but apart
21078 from that they act the same way.
21080 The specification of commands can be provided in the filter arguments
21081 with the @var{commands} option, or in a file specified by the
21082 @var{filename} option.
21084 These filters accept the following options:
21087 Set the commands to be read and sent to the other filters.
21089 Set the filename of the commands to be read and sent to the other
21093 @subsection Commands syntax
21095 A commands description consists of a sequence of interval
21096 specifications, comprising a list of commands to be executed when a
21097 particular event related to that interval occurs. The occurring event
21098 is typically the current frame time entering or leaving a given time
21101 An interval is specified by the following syntax:
21103 @var{START}[-@var{END}] @var{COMMANDS};
21106 The time interval is specified by the @var{START} and @var{END} times.
21107 @var{END} is optional and defaults to the maximum time.
21109 The current frame time is considered within the specified interval if
21110 it is included in the interval [@var{START}, @var{END}), that is when
21111 the time is greater or equal to @var{START} and is lesser than
21114 @var{COMMANDS} consists of a sequence of one or more command
21115 specifications, separated by ",", relating to that interval. The
21116 syntax of a command specification is given by:
21118 [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
21121 @var{FLAGS} is optional and specifies the type of events relating to
21122 the time interval which enable sending the specified command, and must
21123 be a non-null sequence of identifier flags separated by "+" or "|" and
21124 enclosed between "[" and "]".
21126 The following flags are recognized:
21129 The command is sent when the current frame timestamp enters the
21130 specified interval. In other words, the command is sent when the
21131 previous frame timestamp was not in the given interval, and the
21135 The command is sent when the current frame timestamp leaves the
21136 specified interval. In other words, the command is sent when the
21137 previous frame timestamp was in the given interval, and the
21141 If @var{FLAGS} is not specified, a default value of @code{[enter]} is
21144 @var{TARGET} specifies the target of the command, usually the name of
21145 the filter class or a specific filter instance name.
21147 @var{COMMAND} specifies the name of the command for the target filter.
21149 @var{ARG} is optional and specifies the optional list of argument for
21150 the given @var{COMMAND}.
21152 Between one interval specification and another, whitespaces, or
21153 sequences of characters starting with @code{#} until the end of line,
21154 are ignored and can be used to annotate comments.
21156 A simplified BNF description of the commands specification syntax
21159 @var{COMMAND_FLAG} ::= "enter" | "leave"
21160 @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
21161 @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
21162 @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
21163 @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
21164 @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
21167 @subsection Examples
21171 Specify audio tempo change at second 4:
21173 asendcmd=c='4.0 atempo tempo 1.5',atempo
21177 Target a specific filter instance:
21179 asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
21183 Specify a list of drawtext and hue commands in a file.
21185 # show text in the interval 5-10
21186 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
21187 [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
21189 # desaturate the image in the interval 15-20
21190 15.0-20.0 [enter] hue s 0,
21191 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
21193 [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
21195 # apply an exponential saturation fade-out effect, starting from time 25
21196 25 [enter] hue s exp(25-t)
21199 A filtergraph allowing to read and process the above command list
21200 stored in a file @file{test.cmd}, can be specified with:
21202 sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
21207 @section setpts, asetpts
21209 Change the PTS (presentation timestamp) of the input frames.
21211 @code{setpts} works on video frames, @code{asetpts} on audio frames.
21213 This filter accepts the following options:
21218 The expression which is evaluated for each frame to construct its timestamp.
21222 The expression is evaluated through the eval API and can contain the following
21226 @item FRAME_RATE, FR
21227 frame rate, only defined for constant frame-rate video
21230 The presentation timestamp in input
21233 The count of the input frame for video or the number of consumed samples,
21234 not including the current frame for audio, starting from 0.
21236 @item NB_CONSUMED_SAMPLES
21237 The number of consumed samples, not including the current frame (only
21240 @item NB_SAMPLES, S
21241 The number of samples in the current frame (only audio)
21243 @item SAMPLE_RATE, SR
21244 The audio sample rate.
21247 The PTS of the first frame.
21250 the time in seconds of the first frame
21253 State whether the current frame is interlaced.
21256 the time in seconds of the current frame
21259 original position in the file of the frame, or undefined if undefined
21260 for the current frame
21263 The previous input PTS.
21266 previous input time in seconds
21269 The previous output PTS.
21272 previous output time in seconds
21275 The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
21279 The wallclock (RTC) time at the start of the movie in microseconds.
21282 The timebase of the input timestamps.
21286 @subsection Examples
21290 Start counting PTS from zero
21292 setpts=PTS-STARTPTS
21296 Apply fast motion effect:
21302 Apply slow motion effect:
21308 Set fixed rate of 25 frames per second:
21314 Set fixed rate 25 fps with some jitter:
21316 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
21320 Apply an offset of 10 seconds to the input PTS:
21326 Generate timestamps from a "live source" and rebase onto the current timebase:
21328 setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
21332 Generate timestamps by counting samples:
21341 Force color range for the output video frame.
21343 The @code{setrange} filter marks the color range property for the
21344 output frames. It does not change the input frame, but only sets the
21345 corresponding property, which affects how the frame is treated by
21348 The filter accepts the following options:
21353 Available values are:
21357 Keep the same color range property.
21359 @item unspecified, unknown
21360 Set the color range as unspecified.
21362 @item limited, tv, mpeg
21363 Set the color range as limited.
21365 @item full, pc, jpeg
21366 Set the color range as full.
21370 @section settb, asettb
21372 Set the timebase to use for the output frames timestamps.
21373 It is mainly useful for testing timebase configuration.
21375 It accepts the following parameters:
21380 The expression which is evaluated into the output timebase.
21384 The value for @option{tb} is an arithmetic expression representing a
21385 rational. The expression can contain the constants "AVTB" (the default
21386 timebase), "intb" (the input timebase) and "sr" (the sample rate,
21387 audio only). Default value is "intb".
21389 @subsection Examples
21393 Set the timebase to 1/25:
21399 Set the timebase to 1/10:
21405 Set the timebase to 1001/1000:
21411 Set the timebase to 2*intb:
21417 Set the default timebase value:
21424 Convert input audio to a video output representing frequency spectrum
21425 logarithmically using Brown-Puckette constant Q transform algorithm with
21426 direct frequency domain coefficient calculation (but the transform itself
21427 is not really constant Q, instead the Q factor is actually variable/clamped),
21428 with musical tone scale, from E0 to D#10.
21430 The filter accepts the following options:
21434 Specify the video size for the output. It must be even. For the syntax of this option,
21435 check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
21436 Default value is @code{1920x1080}.
21439 Set the output frame rate. Default value is @code{25}.
21442 Set the bargraph height. It must be even. Default value is @code{-1} which
21443 computes the bargraph height automatically.
21446 Set the axis height. It must be even. Default value is @code{-1} which computes
21447 the axis height automatically.
21450 Set the sonogram height. It must be even. Default value is @code{-1} which
21451 computes the sonogram height automatically.
21454 Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
21455 instead. Default value is @code{1}.
21457 @item sono_v, volume
21458 Specify the sonogram volume expression. It can contain variables:
21461 the @var{bar_v} evaluated expression
21462 @item frequency, freq, f
21463 the frequency where it is evaluated
21464 @item timeclamp, tc
21465 the value of @var{timeclamp} option
21469 @item a_weighting(f)
21470 A-weighting of equal loudness
21471 @item b_weighting(f)
21472 B-weighting of equal loudness
21473 @item c_weighting(f)
21474 C-weighting of equal loudness.
21476 Default value is @code{16}.
21478 @item bar_v, volume2
21479 Specify the bargraph volume expression. It can contain variables:
21482 the @var{sono_v} evaluated expression
21483 @item frequency, freq, f
21484 the frequency where it is evaluated
21485 @item timeclamp, tc
21486 the value of @var{timeclamp} option
21490 @item a_weighting(f)
21491 A-weighting of equal loudness
21492 @item b_weighting(f)
21493 B-weighting of equal loudness
21494 @item c_weighting(f)
21495 C-weighting of equal loudness.
21497 Default value is @code{sono_v}.
21499 @item sono_g, gamma
21500 Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
21501 higher gamma makes the spectrum having more range. Default value is @code{3}.
21502 Acceptable range is @code{[1, 7]}.
21504 @item bar_g, gamma2
21505 Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
21509 Specify the bargraph transparency level. Lower value makes the bargraph sharper.
21510 Default value is @code{1}. Acceptable range is @code{[0, 1]}.
21512 @item timeclamp, tc
21513 Specify the transform timeclamp. At low frequency, there is trade-off between
21514 accuracy in time domain and frequency domain. If timeclamp is lower,
21515 event in time domain is represented more accurately (such as fast bass drum),
21516 otherwise event in frequency domain is represented more accurately
21517 (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
21520 Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
21521 limits future samples by applying asymmetric windowing in time domain, useful
21522 when low latency is required. Accepted range is @code{[0, 1]}.
21525 Specify the transform base frequency. Default value is @code{20.01523126408007475},
21526 which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
21529 Specify the transform end frequency. Default value is @code{20495.59681441799654},
21530 which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
21533 This option is deprecated and ignored.
21536 Specify the transform length in time domain. Use this option to control accuracy
21537 trade-off between time domain and frequency domain at every frequency sample.
21538 It can contain variables:
21540 @item frequency, freq, f
21541 the frequency where it is evaluated
21542 @item timeclamp, tc
21543 the value of @var{timeclamp} option.
21545 Default value is @code{384*tc/(384+tc*f)}.
21548 Specify the transform count for every video frame. Default value is @code{6}.
21549 Acceptable range is @code{[1, 30]}.
21552 Specify the transform count for every single pixel. Default value is @code{0},
21553 which makes it computed automatically. Acceptable range is @code{[0, 10]}.
21556 Specify font file for use with freetype to draw the axis. If not specified,
21557 use embedded font. Note that drawing with font file or embedded font is not
21558 implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
21562 Specify fontconfig pattern. This has lower priority than @var{fontfile}.
21563 The : in the pattern may be replaced by | to avoid unnecessary escaping.
21566 Specify font color expression. This is arithmetic expression that should return
21567 integer value 0xRRGGBB. It can contain variables:
21569 @item frequency, freq, f
21570 the frequency where it is evaluated
21571 @item timeclamp, tc
21572 the value of @var{timeclamp} option
21577 midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
21578 @item r(x), g(x), b(x)
21579 red, green, and blue value of intensity x.
21581 Default value is @code{st(0, (midi(f)-59.5)/12);
21582 st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
21583 r(1-ld(1)) + b(ld(1))}.
21586 Specify image file to draw the axis. This option override @var{fontfile} and
21587 @var{fontcolor} option.
21590 Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
21591 the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
21592 Default value is @code{1}.
21595 Set colorspace. The accepted values are:
21598 Unspecified (default)
21607 BT.470BG or BT.601-6 625
21610 SMPTE-170M or BT.601-6 525
21616 BT.2020 with non-constant luminance
21621 Set spectrogram color scheme. This is list of floating point values with format
21622 @code{left_r|left_g|left_b|right_r|right_g|right_b}.
21623 The default is @code{1|0.5|0|0|0.5|1}.
21627 @subsection Examples
21631 Playing audio while showing the spectrum:
21633 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
21637 Same as above, but with frame rate 30 fps:
21639 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
21643 Playing at 1280x720:
21645 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
21649 Disable sonogram display:
21655 A1 and its harmonics: A1, A2, (near)E3, A3:
21657 ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
21658 asplit[a][out1]; [a] showcqt [out0]'
21662 Same as above, but with more accuracy in frequency domain:
21664 ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
21665 asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
21671 bar_v=10:sono_v=bar_v*a_weighting(f)
21675 Custom gamma, now spectrum is linear to the amplitude.
21681 Custom tlength equation:
21683 tc=0.33:tlength='st(0,0.17); 384*tc / (384 / ld(0) + tc*f /(1-ld(0))) + 384*tc / (tc*f / ld(0) + 384 /(1-ld(0)))'
21687 Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
21689 fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
21693 Custom font using fontconfig:
21695 font='Courier New,Monospace,mono|bold'
21699 Custom frequency range with custom axis using image file:
21701 axisfile=myaxis.png:basefreq=40:endfreq=10000
21707 Convert input audio to video output representing the audio power spectrum.
21708 Audio amplitude is on Y-axis while frequency is on X-axis.
21710 The filter accepts the following options:
21714 Specify size of video. For the syntax of this option, check the
21715 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
21716 Default is @code{1024x512}.
21720 This set how each frequency bin will be represented.
21722 It accepts the following values:
21728 Default is @code{bar}.
21731 Set amplitude scale.
21733 It accepts the following values:
21747 Default is @code{log}.
21750 Set frequency scale.
21752 It accepts the following values:
21761 Reverse logarithmic scale.
21763 Default is @code{lin}.
21768 It accepts the following values:
21784 Default is @code{w2048}
21787 Set windowing function.
21789 It accepts the following values:
21812 Default is @code{hanning}.
21815 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
21816 which means optimal overlap for selected window function will be picked.
21819 Set time averaging. Setting this to 0 will display current maximal peaks.
21820 Default is @code{1}, which means time averaging is disabled.
21823 Specify list of colors separated by space or by '|' which will be used to
21824 draw channel frequencies. Unrecognized or missing colors will be replaced
21828 Set channel display mode.
21830 It accepts the following values:
21835 Default is @code{combined}.
21838 Set minimum amplitude used in @code{log} amplitude scaler.
21842 @anchor{showspectrum}
21843 @section showspectrum
21845 Convert input audio to a video output, representing the audio frequency
21848 The filter accepts the following options:
21852 Specify the video size for the output. For the syntax of this option, check the
21853 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
21854 Default value is @code{640x512}.
21857 Specify how the spectrum should slide along the window.
21859 It accepts the following values:
21862 the samples start again on the left when they reach the right
21864 the samples scroll from right to left
21866 frames are only produced when the samples reach the right
21868 the samples scroll from left to right
21871 Default value is @code{replace}.
21874 Specify display mode.
21876 It accepts the following values:
21879 all channels are displayed in the same row
21881 all channels are displayed in separate rows
21884 Default value is @samp{combined}.
21887 Specify display color mode.
21889 It accepts the following values:
21892 each channel is displayed in a separate color
21894 each channel is displayed using the same color scheme
21896 each channel is displayed using the rainbow color scheme
21898 each channel is displayed using the moreland color scheme
21900 each channel is displayed using the nebulae color scheme
21902 each channel is displayed using the fire color scheme
21904 each channel is displayed using the fiery color scheme
21906 each channel is displayed using the fruit color scheme
21908 each channel is displayed using the cool color scheme
21910 each channel is displayed using the magma color scheme
21912 each channel is displayed using the green color scheme
21914 each channel is displayed using the viridis color scheme
21916 each channel is displayed using the plasma color scheme
21918 each channel is displayed using the cividis color scheme
21920 each channel is displayed using the terrain color scheme
21923 Default value is @samp{channel}.
21926 Specify scale used for calculating intensity color values.
21928 It accepts the following values:
21933 square root, default
21944 Default value is @samp{sqrt}.
21947 Set saturation modifier for displayed colors. Negative values provide
21948 alternative color scheme. @code{0} is no saturation at all.
21949 Saturation must be in [-10.0, 10.0] range.
21950 Default value is @code{1}.
21953 Set window function.
21955 It accepts the following values:
21980 Default value is @code{hann}.
21983 Set orientation of time vs frequency axis. Can be @code{vertical} or
21984 @code{horizontal}. Default is @code{vertical}.
21987 Set ratio of overlap window. Default value is @code{0}.
21988 When value is @code{1} overlap is set to recommended size for specific
21989 window function currently used.
21992 Set scale gain for calculating intensity color values.
21993 Default value is @code{1}.
21996 Set which data to display. Can be @code{magnitude}, default or @code{phase}.
21999 Set color rotation, must be in [-1.0, 1.0] range.
22000 Default value is @code{0}.
22003 Set start frequency from which to display spectrogram. Default is @code{0}.
22006 Set stop frequency to which to display spectrogram. Default is @code{0}.
22009 Set upper frame rate limit. Default is @code{auto}, unlimited.
22012 Draw time and frequency axes and legends. Default is disabled.
22015 The usage is very similar to the showwaves filter; see the examples in that
22018 @subsection Examples
22022 Large window with logarithmic color scaling:
22024 showspectrum=s=1280x480:scale=log
22028 Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
22030 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
22031 [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
22035 @section showspectrumpic
22037 Convert input audio to a single video frame, representing the audio frequency
22040 The filter accepts the following options:
22044 Specify the video size for the output. For the syntax of this option, check the
22045 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
22046 Default value is @code{4096x2048}.
22049 Specify display mode.
22051 It accepts the following values:
22054 all channels are displayed in the same row
22056 all channels are displayed in separate rows
22058 Default value is @samp{combined}.
22061 Specify display color mode.
22063 It accepts the following values:
22066 each channel is displayed in a separate color
22068 each channel is displayed using the same color scheme
22070 each channel is displayed using the rainbow color scheme
22072 each channel is displayed using the moreland color scheme
22074 each channel is displayed using the nebulae color scheme
22076 each channel is displayed using the fire color scheme
22078 each channel is displayed using the fiery color scheme
22080 each channel is displayed using the fruit color scheme
22082 each channel is displayed using the cool color scheme
22084 each channel is displayed using the magma color scheme
22086 each channel is displayed using the green color scheme
22088 each channel is displayed using the viridis color scheme
22090 each channel is displayed using the plasma color scheme
22092 each channel is displayed using the cividis color scheme
22094 each channel is displayed using the terrain color scheme
22096 Default value is @samp{intensity}.
22099 Specify scale used for calculating intensity color values.
22101 It accepts the following values:
22106 square root, default
22116 Default value is @samp{log}.
22119 Set saturation modifier for displayed colors. Negative values provide
22120 alternative color scheme. @code{0} is no saturation at all.
22121 Saturation must be in [-10.0, 10.0] range.
22122 Default value is @code{1}.
22125 Set window function.
22127 It accepts the following values:
22151 Default value is @code{hann}.
22154 Set orientation of time vs frequency axis. Can be @code{vertical} or
22155 @code{horizontal}. Default is @code{vertical}.
22158 Set scale gain for calculating intensity color values.
22159 Default value is @code{1}.
22162 Draw time and frequency axes and legends. Default is enabled.
22165 Set color rotation, must be in [-1.0, 1.0] range.
22166 Default value is @code{0}.
22169 Set start frequency from which to display spectrogram. Default is @code{0}.
22172 Set stop frequency to which to display spectrogram. Default is @code{0}.
22175 @subsection Examples
22179 Extract an audio spectrogram of a whole audio track
22180 in a 1024x1024 picture using @command{ffmpeg}:
22182 ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
22186 @section showvolume
22188 Convert input audio volume to a video output.
22190 The filter accepts the following options:
22197 Set border width, allowed range is [0, 5]. Default is 1.
22200 Set channel width, allowed range is [80, 8192]. Default is 400.
22203 Set channel height, allowed range is [1, 900]. Default is 20.
22206 Set fade, allowed range is [0, 1]. Default is 0.95.
22209 Set volume color expression.
22211 The expression can use the following variables:
22215 Current max volume of channel in dB.
22221 Current channel number, starting from 0.
22225 If set, displays channel names. Default is enabled.
22228 If set, displays volume values. Default is enabled.
22231 Set orientation, can be horizontal: @code{h} or vertical: @code{v},
22232 default is @code{h}.
22235 Set step size, allowed range is [0, 5]. Default is 0, which means
22239 Set background opacity, allowed range is [0, 1]. Default is 0.
22242 Set metering mode, can be peak: @code{p} or rms: @code{r},
22243 default is @code{p}.
22246 Set display scale, can be linear: @code{lin} or log: @code{log},
22247 default is @code{lin}.
22251 If set to > 0., display a line for the max level
22252 in the previous seconds.
22253 default is disabled: @code{0.}
22256 The color of the max line. Use when @code{dm} option is set to > 0.
22257 default is: @code{orange}
22262 Convert input audio to a video output, representing the samples waves.
22264 The filter accepts the following options:
22268 Specify the video size for the output. For the syntax of this option, check the
22269 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
22270 Default value is @code{600x240}.
22275 Available values are:
22278 Draw a point for each sample.
22281 Draw a vertical line for each sample.
22284 Draw a point for each sample and a line between them.
22287 Draw a centered vertical line for each sample.
22290 Default value is @code{point}.
22293 Set the number of samples which are printed on the same column. A
22294 larger value will decrease the frame rate. Must be a positive
22295 integer. This option can be set only if the value for @var{rate}
22296 is not explicitly specified.
22299 Set the (approximate) output frame rate. This is done by setting the
22300 option @var{n}. Default value is "25".
22302 @item split_channels
22303 Set if channels should be drawn separately or overlap. Default value is 0.
22306 Set colors separated by '|' which are going to be used for drawing of each channel.
22309 Set amplitude scale.
22311 Available values are:
22329 Set the draw mode. This is mostly useful to set for high @var{n}.
22331 Available values are:
22334 Scale pixel values for each drawn sample.
22337 Draw every sample directly.
22340 Default value is @code{scale}.
22343 @subsection Examples
22347 Output the input file audio and the corresponding video representation
22350 amovie=a.mp3,asplit[out0],showwaves[out1]
22354 Create a synthetic signal and show it with showwaves, forcing a
22355 frame rate of 30 frames per second:
22357 aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
22361 @section showwavespic
22363 Convert input audio to a single video frame, representing the samples waves.
22365 The filter accepts the following options:
22369 Specify the video size for the output. For the syntax of this option, check the
22370 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
22371 Default value is @code{600x240}.
22373 @item split_channels
22374 Set if channels should be drawn separately or overlap. Default value is 0.
22377 Set colors separated by '|' which are going to be used for drawing of each channel.
22380 Set amplitude scale.
22382 Available values are:
22400 @subsection Examples
22404 Extract a channel split representation of the wave form of a whole audio track
22405 in a 1024x800 picture using @command{ffmpeg}:
22407 ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
22411 @section sidedata, asidedata
22413 Delete frame side data, or select frames based on it.
22415 This filter accepts the following options:
22419 Set mode of operation of the filter.
22421 Can be one of the following:
22425 Select every frame with side data of @code{type}.
22428 Delete side data of @code{type}. If @code{type} is not set, delete all side
22434 Set side data type used with all modes. Must be set for @code{select} mode. For
22435 the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
22436 in @file{libavutil/frame.h}. For example, to choose
22437 @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
22441 @section spectrumsynth
22443 Sythesize audio from 2 input video spectrums, first input stream represents
22444 magnitude across time and second represents phase across time.
22445 The filter will transform from frequency domain as displayed in videos back
22446 to time domain as presented in audio output.
22448 This filter is primarily created for reversing processed @ref{showspectrum}
22449 filter outputs, but can synthesize sound from other spectrograms too.
22450 But in such case results are going to be poor if the phase data is not
22451 available, because in such cases phase data need to be recreated, usually
22452 its just recreated from random noise.
22453 For best results use gray only output (@code{channel} color mode in
22454 @ref{showspectrum} filter) and @code{log} scale for magnitude video and
22455 @code{lin} scale for phase video. To produce phase, for 2nd video, use
22456 @code{data} option. Inputs videos should generally use @code{fullframe}
22457 slide mode as that saves resources needed for decoding video.
22459 The filter accepts the following options:
22463 Specify sample rate of output audio, the sample rate of audio from which
22464 spectrum was generated may differ.
22467 Set number of channels represented in input video spectrums.
22470 Set scale which was used when generating magnitude input spectrum.
22471 Can be @code{lin} or @code{log}. Default is @code{log}.
22474 Set slide which was used when generating inputs spectrums.
22475 Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
22476 Default is @code{fullframe}.
22479 Set window function used for resynthesis.
22482 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
22483 which means optimal overlap for selected window function will be picked.
22486 Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
22487 Default is @code{vertical}.
22490 @subsection Examples
22494 First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
22495 then resynthesize videos back to audio with spectrumsynth:
22497 ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
22498 ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
22499 ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
22503 @section split, asplit
22505 Split input into several identical outputs.
22507 @code{asplit} works with audio input, @code{split} with video.
22509 The filter accepts a single parameter which specifies the number of outputs. If
22510 unspecified, it defaults to 2.
22512 @subsection Examples
22516 Create two separate outputs from the same input:
22518 [in] split [out0][out1]
22522 To create 3 or more outputs, you need to specify the number of
22525 [in] asplit=3 [out0][out1][out2]
22529 Create two separate outputs from the same input, one cropped and
22532 [in] split [splitout1][splitout2];
22533 [splitout1] crop=100:100:0:0 [cropout];
22534 [splitout2] pad=200:200:100:100 [padout];
22538 Create 5 copies of the input audio with @command{ffmpeg}:
22540 ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
22546 Receive commands sent through a libzmq client, and forward them to
22547 filters in the filtergraph.
22549 @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
22550 must be inserted between two video filters, @code{azmq} between two
22551 audio filters. Both are capable to send messages to any filter type.
22553 To enable these filters you need to install the libzmq library and
22554 headers and configure FFmpeg with @code{--enable-libzmq}.
22556 For more information about libzmq see:
22557 @url{http://www.zeromq.org/}
22559 The @code{zmq} and @code{azmq} filters work as a libzmq server, which
22560 receives messages sent through a network interface defined by the
22561 @option{bind_address} (or the abbreviation "@option{b}") option.
22562 Default value of this option is @file{tcp://localhost:5555}. You may
22563 want to alter this value to your needs, but do not forget to escape any
22564 ':' signs (see @ref{filtergraph escaping}).
22566 The received message must be in the form:
22568 @var{TARGET} @var{COMMAND} [@var{ARG}]
22571 @var{TARGET} specifies the target of the command, usually the name of
22572 the filter class or a specific filter instance name. The default
22573 filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
22574 but you can override this by using the @samp{filter_name@@id} syntax
22575 (see @ref{Filtergraph syntax}).
22577 @var{COMMAND} specifies the name of the command for the target filter.
22579 @var{ARG} is optional and specifies the optional argument list for the
22580 given @var{COMMAND}.
22582 Upon reception, the message is processed and the corresponding command
22583 is injected into the filtergraph. Depending on the result, the filter
22584 will send a reply to the client, adopting the format:
22586 @var{ERROR_CODE} @var{ERROR_REASON}
22590 @var{MESSAGE} is optional.
22592 @subsection Examples
22594 Look at @file{tools/zmqsend} for an example of a zmq client which can
22595 be used to send commands processed by these filters.
22597 Consider the following filtergraph generated by @command{ffplay}.
22598 In this example the last overlay filter has an instance name. All other
22599 filters will have default instance names.
22602 ffplay -dumpgraph 1 -f lavfi "
22603 color=s=100x100:c=red [l];
22604 color=s=100x100:c=blue [r];
22605 nullsrc=s=200x100, zmq [bg];
22606 [bg][l] overlay [bg+l];
22607 [bg+l][r] overlay@@my=x=100 "
22610 To change the color of the left side of the video, the following
22611 command can be used:
22613 echo Parsed_color_0 c yellow | tools/zmqsend
22616 To change the right side:
22618 echo Parsed_color_1 c pink | tools/zmqsend
22621 To change the position of the right side:
22623 echo overlay@@my x 150 | tools/zmqsend
22627 @c man end MULTIMEDIA FILTERS
22629 @chapter Multimedia Sources
22630 @c man begin MULTIMEDIA SOURCES
22632 Below is a description of the currently available multimedia sources.
22636 This is the same as @ref{movie} source, except it selects an audio
22642 Read audio and/or video stream(s) from a movie container.
22644 It accepts the following parameters:
22648 The name of the resource to read (not necessarily a file; it can also be a
22649 device or a stream accessed through some protocol).
22651 @item format_name, f
22652 Specifies the format assumed for the movie to read, and can be either
22653 the name of a container or an input device. If not specified, the
22654 format is guessed from @var{movie_name} or by probing.
22656 @item seek_point, sp
22657 Specifies the seek point in seconds. The frames will be output
22658 starting from this seek point. The parameter is evaluated with
22659 @code{av_strtod}, so the numerical value may be suffixed by an IS
22660 postfix. The default value is "0".
22663 Specifies the streams to read. Several streams can be specified,
22664 separated by "+". The source will then have as many outputs, in the
22665 same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
22666 section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
22667 respectively the default (best suited) video and audio stream. Default
22668 is "dv", or "da" if the filter is called as "amovie".
22670 @item stream_index, si
22671 Specifies the index of the video stream to read. If the value is -1,
22672 the most suitable video stream will be automatically selected. The default
22673 value is "-1". Deprecated. If the filter is called "amovie", it will select
22674 audio instead of video.
22677 Specifies how many times to read the stream in sequence.
22678 If the value is 0, the stream will be looped infinitely.
22679 Default value is "1".
22681 Note that when the movie is looped the source timestamps are not
22682 changed, so it will generate non monotonically increasing timestamps.
22684 @item discontinuity
22685 Specifies the time difference between frames above which the point is
22686 considered a timestamp discontinuity which is removed by adjusting the later
22690 It allows overlaying a second video on top of the main input of
22691 a filtergraph, as shown in this graph:
22693 input -----------> deltapts0 --> overlay --> output
22696 movie --> scale--> deltapts1 -------+
22698 @subsection Examples
22702 Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
22703 on top of the input labelled "in":
22705 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
22706 [in] setpts=PTS-STARTPTS [main];
22707 [main][over] overlay=16:16 [out]
22711 Read from a video4linux2 device, and overlay it on top of the input
22714 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
22715 [in] setpts=PTS-STARTPTS [main];
22716 [main][over] overlay=16:16 [out]
22720 Read the first video stream and the audio stream with id 0x81 from
22721 dvd.vob; the video is connected to the pad named "video" and the audio is
22722 connected to the pad named "audio":
22724 movie=dvd.vob:s=v:0+#0x81 [video] [audio]
22728 @subsection Commands
22730 Both movie and amovie support the following commands:
22733 Perform seek using "av_seek_frame".
22734 The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
22737 @var{stream_index}: If stream_index is -1, a default
22738 stream is selected, and @var{timestamp} is automatically converted
22739 from AV_TIME_BASE units to the stream specific time_base.
22741 @var{timestamp}: Timestamp in AVStream.time_base units
22742 or, if no stream is specified, in AV_TIME_BASE units.
22744 @var{flags}: Flags which select direction and seeking mode.
22748 Get movie duration in AV_TIME_BASE units.
22752 @c man end MULTIMEDIA SOURCES