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 @section Notes on filtergraph escaping
226 Filtergraph description composition entails several levels of
227 escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
228 section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
229 information about the employed escaping procedure.
231 A first level escaping affects the content of each filter option
232 value, which may contain the special character @code{:} used to
233 separate values, or one of the escaping characters @code{\'}.
235 A second level escaping affects the whole filter description, which
236 may contain the escaping characters @code{\'} or the special
237 characters @code{[],;} used by the filtergraph description.
239 Finally, when you specify a filtergraph on a shell commandline, you
240 need to perform a third level escaping for the shell special
241 characters contained within it.
243 For example, consider the following string to be embedded in
244 the @ref{drawtext} filter description @option{text} value:
246 this is a 'string': may contain one, or more, special characters
249 This string contains the @code{'} special escaping character, and the
250 @code{:} special character, so it needs to be escaped in this way:
252 text=this is a \'string\'\: may contain one, or more, special characters
255 A second level of escaping is required when embedding the filter
256 description in a filtergraph description, in order to escape all the
257 filtergraph special characters. Thus the example above becomes:
259 drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
261 (note that in addition to the @code{\'} escaping special characters,
262 also @code{,} needs to be escaped).
264 Finally an additional level of escaping is needed when writing the
265 filtergraph description in a shell command, which depends on the
266 escaping rules of the adopted shell. For example, assuming that
267 @code{\} is special and needs to be escaped with another @code{\}, the
268 previous string will finally result in:
270 -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
273 @chapter Timeline editing
275 Some filters support a generic @option{enable} option. For the filters
276 supporting timeline editing, this option can be set to an expression which is
277 evaluated before sending a frame to the filter. If the evaluation is non-zero,
278 the filter will be enabled, otherwise the frame will be sent unchanged to the
279 next filter in the filtergraph.
281 The expression accepts the following values:
284 timestamp expressed in seconds, NAN if the input timestamp is unknown
287 sequential number of the input frame, starting from 0
290 the position in the file of the input frame, NAN if unknown
294 width and height of the input frame if video
297 Additionally, these filters support an @option{enable} command that can be used
298 to re-define the expression.
300 Like any other filtering option, the @option{enable} option follows the same
303 For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
304 minutes, and a @ref{curves} filter starting at 3 seconds:
306 smartblur = enable='between(t,10,3*60)',
307 curves = enable='gte(t,3)' : preset=cross_process
310 See @code{ffmpeg -filters} to view which filters have timeline support.
312 @c man end FILTERGRAPH DESCRIPTION
315 @chapter Options for filters with several inputs (framesync)
316 @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
318 Some filters with several inputs support a common set of options.
319 These options can only be set by name, not with the short notation.
323 The action to take when EOF is encountered on the secondary input; it accepts
324 one of the following values:
328 Repeat the last frame (the default).
332 Pass the main input through.
336 If set to 1, force the output to terminate when the shortest input
337 terminates. Default value is 0.
340 If set to 1, force the filter to extend the last frame of secondary streams
341 until the end of the primary stream. A value of 0 disables this behavior.
345 @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
347 @chapter Audio Filters
348 @c man begin AUDIO FILTERS
350 When you configure your FFmpeg build, you can disable any of the
351 existing filters using @code{--disable-filters}.
352 The configure output will show the audio filters included in your
355 Below is a description of the currently available audio filters.
359 A compressor is mainly used to reduce the dynamic range of a signal.
360 Especially modern music is mostly compressed at a high ratio to
361 improve the overall loudness. It's done to get the highest attention
362 of a listener, "fatten" the sound and bring more "power" to the track.
363 If a signal is compressed too much it may sound dull or "dead"
364 afterwards or it may start to "pump" (which could be a powerful effect
365 but can also destroy a track completely).
366 The right compression is the key to reach a professional sound and is
367 the high art of mixing and mastering. Because of its complex settings
368 it may take a long time to get the right feeling for this kind of effect.
370 Compression is done by detecting the volume above a chosen level
371 @code{threshold} and dividing it by the factor set with @code{ratio}.
372 So if you set the threshold to -12dB and your signal reaches -6dB a ratio
373 of 2:1 will result in a signal at -9dB. Because an exact manipulation of
374 the signal would cause distortion of the waveform the reduction can be
375 levelled over the time. This is done by setting "Attack" and "Release".
376 @code{attack} determines how long the signal has to rise above the threshold
377 before any reduction will occur and @code{release} sets the time the signal
378 has to fall below the threshold to reduce the reduction again. Shorter signals
379 than the chosen attack time will be left untouched.
380 The overall reduction of the signal can be made up afterwards with the
381 @code{makeup} setting. So compressing the peaks of a signal about 6dB and
382 raising the makeup to this level results in a signal twice as loud than the
383 source. To gain a softer entry in the compression the @code{knee} flattens the
384 hard edge at the threshold in the range of the chosen decibels.
386 The filter accepts the following options:
390 Set input gain. Default is 1. Range is between 0.015625 and 64.
393 If a signal of stream rises above this level it will affect the gain
395 By default it is 0.125. Range is between 0.00097563 and 1.
398 Set a ratio by which the signal is reduced. 1:2 means that if the level
399 rose 4dB above the threshold, it will be only 2dB above after the reduction.
400 Default is 2. Range is between 1 and 20.
403 Amount of milliseconds the signal has to rise above the threshold before gain
404 reduction starts. Default is 20. Range is between 0.01 and 2000.
407 Amount of milliseconds the signal has to fall below the threshold before
408 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
411 Set the amount by how much signal will be amplified after processing.
412 Default is 1. Range is from 1 to 64.
415 Curve the sharp knee around the threshold to enter gain reduction more softly.
416 Default is 2.82843. Range is between 1 and 8.
419 Choose if the @code{average} level between all channels of input stream
420 or the louder(@code{maximum}) channel of input stream affects the
421 reduction. Default is @code{average}.
424 Should the exact signal be taken in case of @code{peak} or an RMS one in case
425 of @code{rms}. Default is @code{rms} which is mostly smoother.
428 How much to use compressed signal in output. Default is 1.
429 Range is between 0 and 1.
433 Simple audio dynamic range commpression/expansion filter.
435 The filter accepts the following options:
439 Set contrast. Default is 33. Allowed range is between 0 and 100.
444 Copy the input audio source unchanged to the output. This is mainly useful for
449 Apply cross fade from one input audio stream to another input audio stream.
450 The cross fade is applied for specified duration near the end of first stream.
452 The filter accepts the following options:
456 Specify the number of samples for which the cross fade effect has to last.
457 At the end of the cross fade effect the first input audio will be completely
458 silent. Default is 44100.
461 Specify the duration of the cross fade effect. See
462 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
463 for the accepted syntax.
464 By default the duration is determined by @var{nb_samples}.
465 If set this option is used instead of @var{nb_samples}.
468 Should first stream end overlap with second stream start. Default is enabled.
471 Set curve for cross fade transition for first stream.
474 Set curve for cross fade transition for second stream.
476 For description of available curve types see @ref{afade} filter description.
483 Cross fade from one input to another:
485 ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
489 Cross fade from one input to another but without overlapping:
491 ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
497 Reduce audio bit resolution.
499 This filter is bit crusher with enhanced functionality. A bit crusher
500 is used to audibly reduce number of bits an audio signal is sampled
501 with. This doesn't change the bit depth at all, it just produces the
502 effect. Material reduced in bit depth sounds more harsh and "digital".
503 This filter is able to even round to continuous values instead of discrete
505 Additionally it has a D/C offset which results in different crushing of
506 the lower and the upper half of the signal.
507 An Anti-Aliasing setting is able to produce "softer" crushing sounds.
509 Another feature of this filter is the logarithmic mode.
510 This setting switches from linear distances between bits to logarithmic ones.
511 The result is a much more "natural" sounding crusher which doesn't gate low
512 signals for example. The human ear has a logarithmic perception, too
513 so this kind of crushing is much more pleasant.
514 Logarithmic crushing is also able to get anti-aliased.
516 The filter accepts the following options:
532 Can be linear: @code{lin} or logarithmic: @code{log}.
541 Set sample reduction.
544 Enable LFO. By default disabled.
555 Delay one or more audio channels.
557 Samples in delayed channel are filled with silence.
559 The filter accepts the following option:
563 Set list of delays in milliseconds for each channel separated by '|'.
564 Unused delays will be silently ignored. If number of given delays is
565 smaller than number of channels all remaining channels will not be delayed.
566 If you want to delay exact number of samples, append 'S' to number.
573 Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
574 the second channel (and any other channels that may be present) unchanged.
580 Delay second channel by 500 samples, the third channel by 700 samples and leave
581 the first channel (and any other channels that may be present) unchanged.
589 Apply echoing to the input audio.
591 Echoes are reflected sound and can occur naturally amongst mountains
592 (and sometimes large buildings) when talking or shouting; digital echo
593 effects emulate this behaviour and are often used to help fill out the
594 sound of a single instrument or vocal. The time difference between the
595 original signal and the reflection is the @code{delay}, and the
596 loudness of the reflected signal is the @code{decay}.
597 Multiple echoes can have different delays and decays.
599 A description of the accepted parameters follows.
603 Set input gain of reflected signal. Default is @code{0.6}.
606 Set output gain of reflected signal. Default is @code{0.3}.
609 Set list of time intervals in milliseconds between original signal and reflections
610 separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
611 Default is @code{1000}.
614 Set list of loudness of reflected signals separated by '|'.
615 Allowed range for each @code{decay} is @code{(0 - 1.0]}.
616 Default is @code{0.5}.
623 Make it sound as if there are twice as many instruments as are actually playing:
625 aecho=0.8:0.88:60:0.4
629 If delay is very short, then it sound like a (metallic) robot playing music:
635 A longer delay will sound like an open air concert in the mountains:
637 aecho=0.8:0.9:1000:0.3
641 Same as above but with one more mountain:
643 aecho=0.8:0.9:1000|1800:0.3|0.25
648 Audio emphasis filter creates or restores material directly taken from LPs or
649 emphased CDs with different filter curves. E.g. to store music on vinyl the
650 signal has to be altered by a filter first to even out the disadvantages of
651 this recording medium.
652 Once the material is played back the inverse filter has to be applied to
653 restore the distortion of the frequency response.
655 The filter accepts the following options:
665 Set filter mode. For restoring material use @code{reproduction} mode, otherwise
666 use @code{production} mode. Default is @code{reproduction} mode.
669 Set filter type. Selects medium. Can be one of the following:
681 select Compact Disc (CD).
687 select 50µs (FM-KF).
689 select 75µs (FM-KF).
695 Modify an audio signal according to the specified expressions.
697 This filter accepts one or more expressions (one for each channel),
698 which are evaluated and used to modify a corresponding audio signal.
700 It accepts the following parameters:
704 Set the '|'-separated expressions list for each separate channel. If
705 the number of input channels is greater than the number of
706 expressions, the last specified expression is used for the remaining
709 @item channel_layout, c
710 Set output channel layout. If not specified, the channel layout is
711 specified by the number of expressions. If set to @samp{same}, it will
712 use by default the same input channel layout.
715 Each expression in @var{exprs} can contain the following constants and functions:
719 channel number of the current expression
722 number of the evaluated sample, starting from 0
728 time of the evaluated sample expressed in seconds
731 @item nb_out_channels
732 input and output number of channels
735 the value of input channel with number @var{CH}
738 Note: this filter is slow. For faster processing you should use a
747 aeval=val(ch)/2:c=same
751 Invert phase of the second channel:
760 Apply fade-in/out effect to input audio.
762 A description of the accepted parameters follows.
766 Specify the effect type, can be either @code{in} for fade-in, or
767 @code{out} for a fade-out effect. Default is @code{in}.
769 @item start_sample, ss
770 Specify the number of the start sample for starting to apply the fade
771 effect. Default is 0.
774 Specify the number of samples for which the fade effect has to last. At
775 the end of the fade-in effect the output audio will have the same
776 volume as the input audio, at the end of the fade-out transition
777 the output audio will be silence. Default is 44100.
780 Specify the start time of the fade effect. Default is 0.
781 The value must be specified as a time duration; see
782 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
783 for the accepted syntax.
784 If set this option is used instead of @var{start_sample}.
787 Specify the duration of the fade effect. See
788 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
789 for the accepted syntax.
790 At the end of the fade-in effect the output audio will have the same
791 volume as the input audio, at the end of the fade-out transition
792 the output audio will be silence.
793 By default the duration is determined by @var{nb_samples}.
794 If set this option is used instead of @var{nb_samples}.
797 Set curve for fade transition.
799 It accepts the following values:
802 select triangular, linear slope (default)
804 select quarter of sine wave
806 select half of sine wave
808 select exponential sine wave
812 select inverted parabola
826 select inverted quarter of sine wave
828 select inverted half of sine wave
830 select double-exponential seat
832 select double-exponential sigmoid
840 Fade in first 15 seconds of audio:
846 Fade out last 25 seconds of a 900 seconds audio:
848 afade=t=out:st=875:d=25
853 Apply arbitrary expressions to samples in frequency domain.
857 Set frequency domain real expression for each separate channel separated
858 by '|'. Default is "1".
859 If the number of input channels is greater than the number of
860 expressions, the last specified expression is used for the remaining
864 Set frequency domain imaginary expression for each separate channel
865 separated by '|'. If not set, @var{real} option is used.
867 Each expression in @var{real} and @var{imag} can contain the following
875 current frequency bin number
878 number of available bins
881 channel number of the current expression
893 It accepts the following values:
909 Default is @code{w4096}
912 Set window function. Default is @code{hann}.
915 Set window overlap. If set to 1, the recommended overlap for selected
916 window function will be picked. Default is @code{0.75}.
923 Leave almost only low frequencies in audio:
925 afftfilt="1-clip((b/nb)*b,0,1)"
931 Apply an arbitrary Frequency Impulse Response filter.
933 This filter is designed for applying long FIR filters,
934 up to 30 seconds long.
936 It can be used as component for digital crossover filters,
937 room equalization, cross talk cancellation, wavefield synthesis,
938 auralization, ambiophonics and ambisonics.
940 This filter uses second stream as FIR coefficients.
941 If second stream holds single channel, it will be used
942 for all input channels in first stream, otherwise
943 number of channels in second stream must be same as
944 number of channels in first stream.
946 It accepts the following parameters:
950 Set dry gain. This sets input gain.
953 Set wet gain. This sets final output gain.
956 Set Impulse Response filter length. Default is 1, which means whole IR is processed.
959 Enable applying gain measured from power of IR.
966 Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
968 ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
975 Set output format constraints for the input audio. The framework will
976 negotiate the most appropriate format to minimize conversions.
978 It accepts the following parameters:
982 A '|'-separated list of requested sample formats.
985 A '|'-separated list of requested sample rates.
987 @item channel_layouts
988 A '|'-separated list of requested channel layouts.
990 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
991 for the required syntax.
994 If a parameter is omitted, all values are allowed.
996 Force the output to either unsigned 8-bit or signed 16-bit stereo
998 aformat=sample_fmts=u8|s16:channel_layouts=stereo
1003 A gate is mainly used to reduce lower parts of a signal. This kind of signal
1004 processing reduces disturbing noise between useful signals.
1006 Gating is done by detecting the volume below a chosen level @var{threshold}
1007 and dividing it by the factor set with @var{ratio}. The bottom of the noise
1008 floor is set via @var{range}. Because an exact manipulation of the signal
1009 would cause distortion of the waveform the reduction can be levelled over
1010 time. This is done by setting @var{attack} and @var{release}.
1012 @var{attack} determines how long the signal has to fall below the threshold
1013 before any reduction will occur and @var{release} sets the time the signal
1014 has to rise above the threshold to reduce the reduction again.
1015 Shorter signals than the chosen attack time will be left untouched.
1019 Set input level before filtering.
1020 Default is 1. Allowed range is from 0.015625 to 64.
1023 Set the level of gain reduction when the signal is below the threshold.
1024 Default is 0.06125. Allowed range is from 0 to 1.
1027 If a signal rises above this level the gain reduction is released.
1028 Default is 0.125. Allowed range is from 0 to 1.
1031 Set a ratio by which the signal is reduced.
1032 Default is 2. Allowed range is from 1 to 9000.
1035 Amount of milliseconds the signal has to rise above the threshold before gain
1037 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
1040 Amount of milliseconds the signal has to fall below the threshold before the
1041 reduction is increased again. Default is 250 milliseconds.
1042 Allowed range is from 0.01 to 9000.
1045 Set amount of amplification of signal after processing.
1046 Default is 1. Allowed range is from 1 to 64.
1049 Curve the sharp knee around the threshold to enter gain reduction more softly.
1050 Default is 2.828427125. Allowed range is from 1 to 8.
1053 Choose if exact signal should be taken for detection or an RMS like one.
1054 Default is @code{rms}. Can be @code{peak} or @code{rms}.
1057 Choose if the average level between all channels or the louder channel affects
1059 Default is @code{average}. Can be @code{average} or @code{maximum}.
1064 The limiter prevents an input signal from rising over a desired threshold.
1065 This limiter uses lookahead technology to prevent your signal from distorting.
1066 It means that there is a small delay after the signal is processed. Keep in mind
1067 that the delay it produces is the attack time you set.
1069 The filter accepts the following options:
1073 Set input gain. Default is 1.
1076 Set output gain. Default is 1.
1079 Don't let signals above this level pass the limiter. Default is 1.
1082 The limiter will reach its attenuation level in this amount of time in
1083 milliseconds. Default is 5 milliseconds.
1086 Come back from limiting to attenuation 1.0 in this amount of milliseconds.
1087 Default is 50 milliseconds.
1090 When gain reduction is always needed ASC takes care of releasing to an
1091 average reduction level rather than reaching a reduction of 0 in the release
1095 Select how much the release time is affected by ASC, 0 means nearly no changes
1096 in release time while 1 produces higher release times.
1099 Auto level output signal. Default is enabled.
1100 This normalizes audio back to 0dB if enabled.
1103 Depending on picked setting it is recommended to upsample input 2x or 4x times
1104 with @ref{aresample} before applying this filter.
1108 Apply a two-pole all-pass filter with central frequency (in Hz)
1109 @var{frequency}, and filter-width @var{width}.
1110 An all-pass filter changes the audio's frequency to phase relationship
1111 without changing its frequency to amplitude relationship.
1113 The filter accepts the following options:
1117 Set frequency in Hz.
1120 Set method to specify band-width of filter.
1133 Specify the band-width of a filter in width_type units.
1136 Specify which channels to filter, by default all available are filtered.
1143 The filter accepts the following options:
1147 Set the number of loops. Setting this value to -1 will result in infinite loops.
1151 Set maximal number of samples. Default is 0.
1154 Set first sample of loop. Default is 0.
1160 Merge two or more audio streams into a single multi-channel stream.
1162 The filter accepts the following options:
1167 Set the number of inputs. Default is 2.
1171 If the channel layouts of the inputs are disjoint, and therefore compatible,
1172 the channel layout of the output will be set accordingly and the channels
1173 will be reordered as necessary. If the channel layouts of the inputs are not
1174 disjoint, the output will have all the channels of the first input then all
1175 the channels of the second input, in that order, and the channel layout of
1176 the output will be the default value corresponding to the total number of
1179 For example, if the first input is in 2.1 (FL+FR+LF) and the second input
1180 is FC+BL+BR, then the output will be in 5.1, with the channels in the
1181 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
1182 first input, b1 is the first channel of the second input).
1184 On the other hand, if both input are in stereo, the output channels will be
1185 in the default order: a1, a2, b1, b2, and the channel layout will be
1186 arbitrarily set to 4.0, which may or may not be the expected value.
1188 All inputs must have the same sample rate, and format.
1190 If inputs do not have the same duration, the output will stop with the
1193 @subsection Examples
1197 Merge two mono files into a stereo stream:
1199 amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
1203 Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
1205 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
1211 Mixes multiple audio inputs into a single output.
1213 Note that this filter only supports float samples (the @var{amerge}
1214 and @var{pan} audio filters support many formats). If the @var{amix}
1215 input has integer samples then @ref{aresample} will be automatically
1216 inserted to perform the conversion to float samples.
1220 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
1222 will mix 3 input audio streams to a single output with the same duration as the
1223 first input and a dropout transition time of 3 seconds.
1225 It accepts the following parameters:
1229 The number of inputs. If unspecified, it defaults to 2.
1232 How to determine the end-of-stream.
1236 The duration of the longest input. (default)
1239 The duration of the shortest input.
1242 The duration of the first input.
1246 @item dropout_transition
1247 The transition time, in seconds, for volume renormalization when an input
1248 stream ends. The default value is 2 seconds.
1252 @section anequalizer
1254 High-order parametric multiband equalizer for each channel.
1256 It accepts the following parameters:
1260 This option string is in format:
1261 "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
1262 Each equalizer band is separated by '|'.
1266 Set channel number to which equalization will be applied.
1267 If input doesn't have that channel the entry is ignored.
1270 Set central frequency for band.
1271 If input doesn't have that frequency the entry is ignored.
1274 Set band width in hertz.
1277 Set band gain in dB.
1280 Set filter type for band, optional, can be:
1284 Butterworth, this is default.
1295 With this option activated frequency response of anequalizer is displayed
1299 Set video stream size. Only useful if curves option is activated.
1302 Set max gain that will be displayed. Only useful if curves option is activated.
1303 Setting this to a reasonable value makes it possible to display gain which is derived from
1304 neighbour bands which are too close to each other and thus produce higher gain
1305 when both are activated.
1308 Set frequency scale used to draw frequency response in video output.
1309 Can be linear or logarithmic. Default is logarithmic.
1312 Set color for each channel curve which is going to be displayed in video stream.
1313 This is list of color names separated by space or by '|'.
1314 Unrecognised or missing colors will be replaced by white color.
1317 @subsection Examples
1321 Lower gain by 10 of central frequency 200Hz and width 100 Hz
1322 for first 2 channels using Chebyshev type 1 filter:
1324 anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
1328 @subsection Commands
1330 This filter supports the following commands:
1333 Alter existing filter parameters.
1334 Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
1336 @var{fN} is existing filter number, starting from 0, if no such filter is available
1338 @var{freq} set new frequency parameter.
1339 @var{width} set new width parameter in herz.
1340 @var{gain} set new gain parameter in dB.
1342 Full filter invocation with asendcmd may look like this:
1343 asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
1348 Pass the audio source unchanged to the output.
1352 Pad the end of an audio stream with silence.
1354 This can be used together with @command{ffmpeg} @option{-shortest} to
1355 extend audio streams to the same length as the video stream.
1357 A description of the accepted options follows.
1361 Set silence packet size. Default value is 4096.
1364 Set the number of samples of silence to add to the end. After the
1365 value is reached, the stream is terminated. This option is mutually
1366 exclusive with @option{whole_len}.
1369 Set the minimum total number of samples in the output audio stream. If
1370 the value is longer than the input audio length, silence is added to
1371 the end, until the value is reached. This option is mutually exclusive
1372 with @option{pad_len}.
1375 If neither the @option{pad_len} nor the @option{whole_len} option is
1376 set, the filter will add silence to the end of the input stream
1379 @subsection Examples
1383 Add 1024 samples of silence to the end of the input:
1389 Make sure the audio output will contain at least 10000 samples, pad
1390 the input with silence if required:
1392 apad=whole_len=10000
1396 Use @command{ffmpeg} to pad the audio input with silence, so that the
1397 video stream will always result the shortest and will be converted
1398 until the end in the output file when using the @option{shortest}
1401 ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
1406 Add a phasing effect to the input audio.
1408 A phaser filter creates series of peaks and troughs in the frequency spectrum.
1409 The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
1411 A description of the accepted parameters follows.
1415 Set input gain. Default is 0.4.
1418 Set output gain. Default is 0.74
1421 Set delay in milliseconds. Default is 3.0.
1424 Set decay. Default is 0.4.
1427 Set modulation speed in Hz. Default is 0.5.
1430 Set modulation type. Default is triangular.
1432 It accepts the following values:
1441 Audio pulsator is something between an autopanner and a tremolo.
1442 But it can produce funny stereo effects as well. Pulsator changes the volume
1443 of the left and right channel based on a LFO (low frequency oscillator) with
1444 different waveforms and shifted phases.
1445 This filter have the ability to define an offset between left and right
1446 channel. An offset of 0 means that both LFO shapes match each other.
1447 The left and right channel are altered equally - a conventional tremolo.
1448 An offset of 50% means that the shape of the right channel is exactly shifted
1449 in phase (or moved backwards about half of the frequency) - pulsator acts as
1450 an autopanner. At 1 both curves match again. Every setting in between moves the
1451 phase shift gapless between all stages and produces some "bypassing" sounds with
1452 sine and triangle waveforms. The more you set the offset near 1 (starting from
1453 the 0.5) the faster the signal passes from the left to the right speaker.
1455 The filter accepts the following options:
1459 Set input gain. By default it is 1. Range is [0.015625 - 64].
1462 Set output gain. By default it is 1. Range is [0.015625 - 64].
1465 Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
1466 sawup or sawdown. Default is sine.
1469 Set modulation. Define how much of original signal is affected by the LFO.
1472 Set left channel offset. Default is 0. Allowed range is [0 - 1].
1475 Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
1478 Set pulse width. Default is 1. Allowed range is [0 - 2].
1481 Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
1484 Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
1488 Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
1492 Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
1493 if timing is set to hz.
1499 Resample the input audio to the specified parameters, using the
1500 libswresample library. If none are specified then the filter will
1501 automatically convert between its input and output.
1503 This filter is also able to stretch/squeeze the audio data to make it match
1504 the timestamps or to inject silence / cut out audio to make it match the
1505 timestamps, do a combination of both or do neither.
1507 The filter accepts the syntax
1508 [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
1509 expresses a sample rate and @var{resampler_options} is a list of
1510 @var{key}=@var{value} pairs, separated by ":". See the
1511 @ref{Resampler Options,,the "Resampler Options" section in the
1512 ffmpeg-resampler(1) manual,ffmpeg-resampler}
1513 for the complete list of supported options.
1515 @subsection Examples
1519 Resample the input audio to 44100Hz:
1525 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
1526 samples per second compensation:
1528 aresample=async=1000
1534 Reverse an audio clip.
1536 Warning: This filter requires memory to buffer the entire clip, so trimming
1539 @subsection Examples
1543 Take the first 5 seconds of a clip, and reverse it.
1545 atrim=end=5,areverse
1549 @section asetnsamples
1551 Set the number of samples per each output audio frame.
1553 The last output packet may contain a different number of samples, as
1554 the filter will flush all the remaining samples when the input audio
1557 The filter accepts the following options:
1561 @item nb_out_samples, n
1562 Set the number of frames per each output audio frame. The number is
1563 intended as the number of samples @emph{per each channel}.
1564 Default value is 1024.
1567 If set to 1, the filter will pad the last audio frame with zeroes, so
1568 that the last frame will contain the same number of samples as the
1569 previous ones. Default value is 1.
1572 For example, to set the number of per-frame samples to 1234 and
1573 disable padding for the last frame, use:
1575 asetnsamples=n=1234:p=0
1580 Set the sample rate without altering the PCM data.
1581 This will result in a change of speed and pitch.
1583 The filter accepts the following options:
1586 @item sample_rate, r
1587 Set the output sample rate. Default is 44100 Hz.
1592 Show a line containing various information for each input audio frame.
1593 The input audio is not modified.
1595 The shown line contains a sequence of key/value pairs of the form
1596 @var{key}:@var{value}.
1598 The following values are shown in the output:
1602 The (sequential) number of the input frame, starting from 0.
1605 The presentation timestamp of the input frame, in time base units; the time base
1606 depends on the filter input pad, and is usually 1/@var{sample_rate}.
1609 The presentation timestamp of the input frame in seconds.
1612 position of the frame in the input stream, -1 if this information in
1613 unavailable and/or meaningless (for example in case of synthetic audio)
1622 The sample rate for the audio frame.
1625 The number of samples (per channel) in the frame.
1628 The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
1629 audio, the data is treated as if all the planes were concatenated.
1631 @item plane_checksums
1632 A list of Adler-32 checksums for each data plane.
1638 Display time domain statistical information about the audio channels.
1639 Statistics are calculated and displayed for each audio channel and,
1640 where applicable, an overall figure is also given.
1642 It accepts the following option:
1645 Short window length in seconds, used for peak and trough RMS measurement.
1646 Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
1650 Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
1651 where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
1654 Available keys for each channel are:
1688 For example full key look like this @code{lavfi.astats.1.DC_offset} or
1689 this @code{lavfi.astats.Overall.Peak_count}.
1691 For description what each key means read below.
1694 Set number of frame after which stats are going to be recalculated.
1695 Default is disabled.
1698 A description of each shown parameter follows:
1702 Mean amplitude displacement from zero.
1705 Minimal sample level.
1708 Maximal sample level.
1710 @item Min difference
1711 Minimal difference between two consecutive samples.
1713 @item Max difference
1714 Maximal difference between two consecutive samples.
1716 @item Mean difference
1717 Mean difference between two consecutive samples.
1718 The average of each difference between two consecutive samples.
1720 @item RMS difference
1721 Root Mean Square difference between two consecutive samples.
1725 Standard peak and RMS level measured in dBFS.
1729 Peak and trough values for RMS level measured over a short window.
1732 Standard ratio of peak to RMS level (note: not in dB).
1735 Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
1736 (i.e. either @var{Min level} or @var{Max level}).
1739 Number of occasions (not the number of samples) that the signal attained either
1740 @var{Min level} or @var{Max level}.
1743 Overall bit depth of audio. Number of bits used for each sample.
1746 Measured dynamic range of audio in dB.
1753 The filter accepts exactly one parameter, the audio tempo. If not
1754 specified then the filter will assume nominal 1.0 tempo. Tempo must
1755 be in the [0.5, 2.0] range.
1757 @subsection Examples
1761 Slow down audio to 80% tempo:
1767 To speed up audio to 125% tempo:
1775 Trim the input so that the output contains one continuous subpart of the input.
1777 It accepts the following parameters:
1780 Timestamp (in seconds) of the start of the section to keep. I.e. the audio
1781 sample with the timestamp @var{start} will be the first sample in the output.
1784 Specify time of the first audio sample that will be dropped, i.e. the
1785 audio sample immediately preceding the one with the timestamp @var{end} will be
1786 the last sample in the output.
1789 Same as @var{start}, except this option sets the start timestamp in samples
1793 Same as @var{end}, except this option sets the end timestamp in samples instead
1797 The maximum duration of the output in seconds.
1800 The number of the first sample that should be output.
1803 The number of the first sample that should be dropped.
1806 @option{start}, @option{end}, and @option{duration} are expressed as time
1807 duration specifications; see
1808 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
1810 Note that the first two sets of the start/end options and the @option{duration}
1811 option look at the frame timestamp, while the _sample options simply count the
1812 samples that pass through the filter. So start/end_pts and start/end_sample will
1813 give different results when the timestamps are wrong, inexact or do not start at
1814 zero. Also note that this filter does not modify the timestamps. If you wish
1815 to have the output timestamps start at zero, insert the asetpts filter after the
1818 If multiple start or end options are set, this filter tries to be greedy and
1819 keep all samples that match at least one of the specified constraints. To keep
1820 only the part that matches all the constraints at once, chain multiple atrim
1823 The defaults are such that all the input is kept. So it is possible to set e.g.
1824 just the end values to keep everything before the specified time.
1829 Drop everything except the second minute of input:
1831 ffmpeg -i INPUT -af atrim=60:120
1835 Keep only the first 1000 samples:
1837 ffmpeg -i INPUT -af atrim=end_sample=1000
1844 Apply a two-pole Butterworth band-pass filter with central
1845 frequency @var{frequency}, and (3dB-point) band-width width.
1846 The @var{csg} option selects a constant skirt gain (peak gain = Q)
1847 instead of the default: constant 0dB peak gain.
1848 The filter roll off at 6dB per octave (20dB per decade).
1850 The filter accepts the following options:
1854 Set the filter's central frequency. Default is @code{3000}.
1857 Constant skirt gain if set to 1. Defaults to 0.
1860 Set method to specify band-width of filter.
1873 Specify the band-width of a filter in width_type units.
1876 Specify which channels to filter, by default all available are filtered.
1881 Apply a two-pole Butterworth band-reject filter with central
1882 frequency @var{frequency}, and (3dB-point) band-width @var{width}.
1883 The filter roll off at 6dB per octave (20dB per decade).
1885 The filter accepts the following options:
1889 Set the filter's central frequency. Default is @code{3000}.
1892 Set method to specify band-width of filter.
1905 Specify the band-width of a filter in width_type units.
1908 Specify which channels to filter, by default all available are filtered.
1913 Boost or cut the bass (lower) frequencies of the audio using a two-pole
1914 shelving filter with a response similar to that of a standard
1915 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
1917 The filter accepts the following options:
1921 Give the gain at 0 Hz. Its useful range is about -20
1922 (for a large cut) to +20 (for a large boost).
1923 Beware of clipping when using a positive gain.
1926 Set the filter's central frequency and so can be used
1927 to extend or reduce the frequency range to be boosted or cut.
1928 The default value is @code{100} Hz.
1931 Set method to specify band-width of filter.
1944 Determine how steep is the filter's shelf transition.
1947 Specify which channels to filter, by default all available are filtered.
1952 Apply a biquad IIR filter with the given coefficients.
1953 Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
1954 are the numerator and denominator coefficients respectively.
1955 and @var{channels}, @var{c} specify which channels to filter, by default all
1956 available are filtered.
1959 Bauer stereo to binaural transformation, which improves headphone listening of
1960 stereo audio records.
1962 To enable compilation of this filter you need to configure FFmpeg with
1963 @code{--enable-libbs2b}.
1965 It accepts the following parameters:
1969 Pre-defined crossfeed level.
1973 Default level (fcut=700, feed=50).
1976 Chu Moy circuit (fcut=700, feed=60).
1979 Jan Meier circuit (fcut=650, feed=95).
1984 Cut frequency (in Hz).
1993 Remap input channels to new locations.
1995 It accepts the following parameters:
1998 Map channels from input to output. The argument is a '|'-separated list of
1999 mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
2000 @var{in_channel} form. @var{in_channel} can be either the name of the input
2001 channel (e.g. FL for front left) or its index in the input channel layout.
2002 @var{out_channel} is the name of the output channel or its index in the output
2003 channel layout. If @var{out_channel} is not given then it is implicitly an
2004 index, starting with zero and increasing by one for each mapping.
2006 @item channel_layout
2007 The channel layout of the output stream.
2010 If no mapping is present, the filter will implicitly map input channels to
2011 output channels, preserving indices.
2013 For example, assuming a 5.1+downmix input MOV file,
2015 ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
2017 will create an output WAV file tagged as stereo from the downmix channels of
2020 To fix a 5.1 WAV improperly encoded in AAC's native channel order
2022 ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
2025 @section channelsplit
2027 Split each channel from an input audio stream into a separate output stream.
2029 It accepts the following parameters:
2031 @item channel_layout
2032 The channel layout of the input stream. The default is "stereo".
2035 For example, assuming a stereo input MP3 file,
2037 ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
2039 will create an output Matroska file with two audio streams, one containing only
2040 the left channel and the other the right channel.
2042 Split a 5.1 WAV file into per-channel files:
2044 ffmpeg -i in.wav -filter_complex
2045 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
2046 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
2047 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
2052 Add a chorus effect to the audio.
2054 Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
2056 Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
2057 constant, with chorus, it is varied using using sinusoidal or triangular modulation.
2058 The modulation depth defines the range the modulated delay is played before or after
2059 the delay. Hence the delayed sound will sound slower or faster, that is the delayed
2060 sound tuned around the original one, like in a chorus where some vocals are slightly
2063 It accepts the following parameters:
2066 Set input gain. Default is 0.4.
2069 Set output gain. Default is 0.4.
2072 Set delays. A typical delay is around 40ms to 60ms.
2084 @subsection Examples
2090 chorus=0.7:0.9:55:0.4:0.25:2
2096 chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
2100 Fuller sounding chorus with three delays:
2102 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
2107 Compress or expand the audio's dynamic range.
2109 It accepts the following parameters:
2115 A list of times in seconds for each channel over which the instantaneous level
2116 of the input signal is averaged to determine its volume. @var{attacks} refers to
2117 increase of volume and @var{decays} refers to decrease of volume. For most
2118 situations, the attack time (response to the audio getting louder) should be
2119 shorter than the decay time, because the human ear is more sensitive to sudden
2120 loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
2121 a typical value for decay is 0.8 seconds.
2122 If specified number of attacks & decays is lower than number of channels, the last
2123 set attack/decay will be used for all remaining channels.
2126 A list of points for the transfer function, specified in dB relative to the
2127 maximum possible signal amplitude. Each key points list must be defined using
2128 the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
2129 @code{x0/y0 x1/y1 x2/y2 ....}
2131 The input values must be in strictly increasing order but the transfer function
2132 does not have to be monotonically rising. The point @code{0/0} is assumed but
2133 may be overridden (by @code{0/out-dBn}). Typical values for the transfer
2134 function are @code{-70/-70|-60/-20|1/0}.
2137 Set the curve radius in dB for all joints. It defaults to 0.01.
2140 Set the additional gain in dB to be applied at all points on the transfer
2141 function. This allows for easy adjustment of the overall gain.
2145 Set an initial volume, in dB, to be assumed for each channel when filtering
2146 starts. This permits the user to supply a nominal level initially, so that, for
2147 example, a very large gain is not applied to initial signal levels before the
2148 companding has begun to operate. A typical value for audio which is initially
2149 quiet is -90 dB. It defaults to 0.
2152 Set a delay, in seconds. The input audio is analyzed immediately, but audio is
2153 delayed before being fed to the volume adjuster. Specifying a delay
2154 approximately equal to the attack/decay times allows the filter to effectively
2155 operate in predictive rather than reactive mode. It defaults to 0.
2159 @subsection Examples
2163 Make music with both quiet and loud passages suitable for listening to in a
2166 compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
2169 Another example for audio with whisper and explosion parts:
2171 compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
2175 A noise gate for when the noise is at a lower level than the signal:
2177 compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
2181 Here is another noise gate, this time for when the noise is at a higher level
2182 than the signal (making it, in some ways, similar to squelch):
2184 compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
2188 2:1 compression starting at -6dB:
2190 compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
2194 2:1 compression starting at -9dB:
2196 compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
2200 2:1 compression starting at -12dB:
2202 compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
2206 2:1 compression starting at -18dB:
2208 compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
2212 3:1 compression starting at -15dB:
2214 compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
2220 compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
2226 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
2230 Hard limiter at -6dB:
2232 compand=attacks=0:points=-80/-80|-6/-6|20/-6
2236 Hard limiter at -12dB:
2238 compand=attacks=0:points=-80/-80|-12/-12|20/-12
2242 Hard noise gate at -35 dB:
2244 compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
2250 compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
2254 @section compensationdelay
2256 Compensation Delay Line is a metric based delay to compensate differing
2257 positions of microphones or speakers.
2259 For example, you have recorded guitar with two microphones placed in
2260 different location. Because the front of sound wave has fixed speed in
2261 normal conditions, the phasing of microphones can vary and depends on
2262 their location and interposition. The best sound mix can be achieved when
2263 these microphones are in phase (synchronized). Note that distance of
2264 ~30 cm between microphones makes one microphone to capture signal in
2265 antiphase to another microphone. That makes the final mix sounding moody.
2266 This filter helps to solve phasing problems by adding different delays
2267 to each microphone track and make them synchronized.
2269 The best result can be reached when you take one track as base and
2270 synchronize other tracks one by one with it.
2271 Remember that synchronization/delay tolerance depends on sample rate, too.
2272 Higher sample rates will give more tolerance.
2274 It accepts the following parameters:
2278 Set millimeters distance. This is compensation distance for fine tuning.
2282 Set cm distance. This is compensation distance for tightening distance setup.
2286 Set meters distance. This is compensation distance for hard distance setup.
2290 Set dry amount. Amount of unprocessed (dry) signal.
2294 Set wet amount. Amount of processed (wet) signal.
2298 Set temperature degree in Celsius. This is the temperature of the environment.
2303 Apply headphone crossfeed filter.
2305 Crossfeed is the process of blending the left and right channels of stereo
2307 It is mainly used to reduce extreme stereo separation of low frequencies.
2309 The intent is to produce more speaker like sound to the listener.
2311 The filter accepts the following options:
2315 Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
2316 This sets gain of low shelf filter for side part of stereo image.
2317 Default is -6dB. Max allowed is -30db when strength is set to 1.
2320 Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
2321 This sets cut off frequency of low shelf filter. Default is cut off near
2322 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
2325 Set input gain. Default is 0.9.
2328 Set output gain. Default is 1.
2331 @section crystalizer
2332 Simple algorithm to expand audio dynamic range.
2334 The filter accepts the following options:
2338 Sets the intensity of effect (default: 2.0). Must be in range between 0.0
2339 (unchanged sound) to 10.0 (maximum effect).
2342 Enable clipping. By default is enabled.
2346 Apply a DC shift to the audio.
2348 This can be useful to remove a DC offset (caused perhaps by a hardware problem
2349 in the recording chain) from the audio. The effect of a DC offset is reduced
2350 headroom and hence volume. The @ref{astats} filter can be used to determine if
2351 a signal has a DC offset.
2355 Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
2359 Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
2360 used to prevent clipping.
2364 Dynamic Audio Normalizer.
2366 This filter applies a certain amount of gain to the input audio in order
2367 to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
2368 contrast to more "simple" normalization algorithms, the Dynamic Audio
2369 Normalizer *dynamically* re-adjusts the gain factor to the input audio.
2370 This allows for applying extra gain to the "quiet" sections of the audio
2371 while avoiding distortions or clipping the "loud" sections. In other words:
2372 The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
2373 sections, in the sense that the volume of each section is brought to the
2374 same target level. Note, however, that the Dynamic Audio Normalizer achieves
2375 this goal *without* applying "dynamic range compressing". It will retain 100%
2376 of the dynamic range *within* each section of the audio file.
2380 Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
2381 Default is 500 milliseconds.
2382 The Dynamic Audio Normalizer processes the input audio in small chunks,
2383 referred to as frames. This is required, because a peak magnitude has no
2384 meaning for just a single sample value. Instead, we need to determine the
2385 peak magnitude for a contiguous sequence of sample values. While a "standard"
2386 normalizer would simply use the peak magnitude of the complete file, the
2387 Dynamic Audio Normalizer determines the peak magnitude individually for each
2388 frame. The length of a frame is specified in milliseconds. By default, the
2389 Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
2390 been found to give good results with most files.
2391 Note that the exact frame length, in number of samples, will be determined
2392 automatically, based on the sampling rate of the individual input audio file.
2395 Set the Gaussian filter window size. In range from 3 to 301, must be odd
2396 number. Default is 31.
2397 Probably the most important parameter of the Dynamic Audio Normalizer is the
2398 @code{window size} of the Gaussian smoothing filter. The filter's window size
2399 is specified in frames, centered around the current frame. For the sake of
2400 simplicity, this must be an odd number. Consequently, the default value of 31
2401 takes into account the current frame, as well as the 15 preceding frames and
2402 the 15 subsequent frames. Using a larger window results in a stronger
2403 smoothing effect and thus in less gain variation, i.e. slower gain
2404 adaptation. Conversely, using a smaller window results in a weaker smoothing
2405 effect and thus in more gain variation, i.e. faster gain adaptation.
2406 In other words, the more you increase this value, the more the Dynamic Audio
2407 Normalizer will behave like a "traditional" normalization filter. On the
2408 contrary, the more you decrease this value, the more the Dynamic Audio
2409 Normalizer will behave like a dynamic range compressor.
2412 Set the target peak value. This specifies the highest permissible magnitude
2413 level for the normalized audio input. This filter will try to approach the
2414 target peak magnitude as closely as possible, but at the same time it also
2415 makes sure that the normalized signal will never exceed the peak magnitude.
2416 A frame's maximum local gain factor is imposed directly by the target peak
2417 magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
2418 It is not recommended to go above this value.
2421 Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
2422 The Dynamic Audio Normalizer determines the maximum possible (local) gain
2423 factor for each input frame, i.e. the maximum gain factor that does not
2424 result in clipping or distortion. The maximum gain factor is determined by
2425 the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
2426 additionally bounds the frame's maximum gain factor by a predetermined
2427 (global) maximum gain factor. This is done in order to avoid excessive gain
2428 factors in "silent" or almost silent frames. By default, the maximum gain
2429 factor is 10.0, For most inputs the default value should be sufficient and
2430 it usually is not recommended to increase this value. Though, for input
2431 with an extremely low overall volume level, it may be necessary to allow even
2432 higher gain factors. Note, however, that the Dynamic Audio Normalizer does
2433 not simply apply a "hard" threshold (i.e. cut off values above the threshold).
2434 Instead, a "sigmoid" threshold function will be applied. This way, the
2435 gain factors will smoothly approach the threshold value, but never exceed that
2439 Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
2440 By default, the Dynamic Audio Normalizer performs "peak" normalization.
2441 This means that the maximum local gain factor for each frame is defined
2442 (only) by the frame's highest magnitude sample. This way, the samples can
2443 be amplified as much as possible without exceeding the maximum signal
2444 level, i.e. without clipping. Optionally, however, the Dynamic Audio
2445 Normalizer can also take into account the frame's root mean square,
2446 abbreviated RMS. In electrical engineering, the RMS is commonly used to
2447 determine the power of a time-varying signal. It is therefore considered
2448 that the RMS is a better approximation of the "perceived loudness" than
2449 just looking at the signal's peak magnitude. Consequently, by adjusting all
2450 frames to a constant RMS value, a uniform "perceived loudness" can be
2451 established. If a target RMS value has been specified, a frame's local gain
2452 factor is defined as the factor that would result in exactly that RMS value.
2453 Note, however, that the maximum local gain factor is still restricted by the
2454 frame's highest magnitude sample, in order to prevent clipping.
2457 Enable channels coupling. By default is enabled.
2458 By default, the Dynamic Audio Normalizer will amplify all channels by the same
2459 amount. This means the same gain factor will be applied to all channels, i.e.
2460 the maximum possible gain factor is determined by the "loudest" channel.
2461 However, in some recordings, it may happen that the volume of the different
2462 channels is uneven, e.g. one channel may be "quieter" than the other one(s).
2463 In this case, this option can be used to disable the channel coupling. This way,
2464 the gain factor will be determined independently for each channel, depending
2465 only on the individual channel's highest magnitude sample. This allows for
2466 harmonizing the volume of the different channels.
2469 Enable DC bias correction. By default is disabled.
2470 An audio signal (in the time domain) is a sequence of sample values.
2471 In the Dynamic Audio Normalizer these sample values are represented in the
2472 -1.0 to 1.0 range, regardless of the original input format. Normally, the
2473 audio signal, or "waveform", should be centered around the zero point.
2474 That means if we calculate the mean value of all samples in a file, or in a
2475 single frame, then the result should be 0.0 or at least very close to that
2476 value. If, however, there is a significant deviation of the mean value from
2477 0.0, in either positive or negative direction, this is referred to as a
2478 DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
2479 Audio Normalizer provides optional DC bias correction.
2480 With DC bias correction enabled, the Dynamic Audio Normalizer will determine
2481 the mean value, or "DC correction" offset, of each input frame and subtract
2482 that value from all of the frame's sample values which ensures those samples
2483 are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
2484 boundaries, the DC correction offset values will be interpolated smoothly
2485 between neighbouring frames.
2488 Enable alternative boundary mode. By default is disabled.
2489 The Dynamic Audio Normalizer takes into account a certain neighbourhood
2490 around each frame. This includes the preceding frames as well as the
2491 subsequent frames. However, for the "boundary" frames, located at the very
2492 beginning and at the very end of the audio file, not all neighbouring
2493 frames are available. In particular, for the first few frames in the audio
2494 file, the preceding frames are not known. And, similarly, for the last few
2495 frames in the audio file, the subsequent frames are not known. Thus, the
2496 question arises which gain factors should be assumed for the missing frames
2497 in the "boundary" region. The Dynamic Audio Normalizer implements two modes
2498 to deal with this situation. The default boundary mode assumes a gain factor
2499 of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
2500 "fade out" at the beginning and at the end of the input, respectively.
2503 Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
2504 By default, the Dynamic Audio Normalizer does not apply "traditional"
2505 compression. This means that signal peaks will not be pruned and thus the
2506 full dynamic range will be retained within each local neighbourhood. However,
2507 in some cases it may be desirable to combine the Dynamic Audio Normalizer's
2508 normalization algorithm with a more "traditional" compression.
2509 For this purpose, the Dynamic Audio Normalizer provides an optional compression
2510 (thresholding) function. If (and only if) the compression feature is enabled,
2511 all input frames will be processed by a soft knee thresholding function prior
2512 to the actual normalization process. Put simply, the thresholding function is
2513 going to prune all samples whose magnitude exceeds a certain threshold value.
2514 However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
2515 value. Instead, the threshold value will be adjusted for each individual
2517 In general, smaller parameters result in stronger compression, and vice versa.
2518 Values below 3.0 are not recommended, because audible distortion may appear.
2523 Make audio easier to listen to on headphones.
2525 This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
2526 so that when listened to on headphones the stereo image is moved from
2527 inside your head (standard for headphones) to outside and in front of
2528 the listener (standard for speakers).
2534 Apply a two-pole peaking equalisation (EQ) filter. With this
2535 filter, the signal-level at and around a selected frequency can
2536 be increased or decreased, whilst (unlike bandpass and bandreject
2537 filters) that at all other frequencies is unchanged.
2539 In order to produce complex equalisation curves, this filter can
2540 be given several times, each with a different central frequency.
2542 The filter accepts the following options:
2546 Set the filter's central frequency in Hz.
2549 Set method to specify band-width of filter.
2562 Specify the band-width of a filter in width_type units.
2565 Set the required gain or attenuation in dB.
2566 Beware of clipping when using a positive gain.
2569 Specify which channels to filter, by default all available are filtered.
2572 @subsection Examples
2575 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
2577 equalizer=f=1000:t=h:width=200:g=-10
2581 Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
2583 equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
2587 @section extrastereo
2589 Linearly increases the difference between left and right channels which
2590 adds some sort of "live" effect to playback.
2592 The filter accepts the following options:
2596 Sets the difference coefficient (default: 2.5). 0.0 means mono sound
2597 (average of both channels), with 1.0 sound will be unchanged, with
2598 -1.0 left and right channels will be swapped.
2601 Enable clipping. By default is enabled.
2604 @section firequalizer
2605 Apply FIR Equalization using arbitrary frequency response.
2607 The filter accepts the following option:
2611 Set gain curve equation (in dB). The expression can contain variables:
2614 the evaluated frequency
2618 channel number, set to 0 when multichannels evaluation is disabled
2620 channel id, see libavutil/channel_layout.h, set to the first channel id when
2621 multichannels evaluation is disabled
2625 channel_layout, see libavutil/channel_layout.h
2630 @item gain_interpolate(f)
2631 interpolate gain on frequency f based on gain_entry
2632 @item cubic_interpolate(f)
2633 same as gain_interpolate, but smoother
2635 This option is also available as command. Default is @code{gain_interpolate(f)}.
2638 Set gain entry for gain_interpolate function. The expression can
2642 store gain entry at frequency f with value g
2644 This option is also available as command.
2647 Set filter delay in seconds. Higher value means more accurate.
2648 Default is @code{0.01}.
2651 Set filter accuracy in Hz. Lower value means more accurate.
2652 Default is @code{5}.
2655 Set window function. Acceptable values are:
2658 rectangular window, useful when gain curve is already smooth
2660 hann window (default)
2666 3-terms continuous 1st derivative nuttall window
2668 minimum 3-terms discontinuous nuttall window
2670 4-terms continuous 1st derivative nuttall window
2672 minimum 4-terms discontinuous nuttall (blackman-nuttall) window
2674 blackman-harris window
2680 If enabled, use fixed number of audio samples. This improves speed when
2681 filtering with large delay. Default is disabled.
2684 Enable multichannels evaluation on gain. Default is disabled.
2687 Enable zero phase mode by subtracting timestamp to compensate delay.
2688 Default is disabled.
2691 Set scale used by gain. Acceptable values are:
2694 linear frequency, linear gain
2696 linear frequency, logarithmic (in dB) gain (default)
2698 logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
2700 logarithmic frequency, logarithmic gain
2704 Set file for dumping, suitable for gnuplot.
2707 Set scale for dumpfile. Acceptable values are same with scale option.
2711 Enable 2-channel convolution using complex FFT. This improves speed significantly.
2712 Default is disabled.
2715 Enable minimum phase impulse response. Default is disabled.
2718 @subsection Examples
2723 firequalizer=gain='if(lt(f,1000), 0, -INF)'
2726 lowpass at 1000 Hz with gain_entry:
2728 firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
2731 custom equalization:
2733 firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
2736 higher delay with zero phase to compensate delay:
2738 firequalizer=delay=0.1:fixed=on:zero_phase=on
2741 lowpass on left channel, highpass on right channel:
2743 firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
2744 :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
2749 Apply a flanging effect to the audio.
2751 The filter accepts the following options:
2755 Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
2758 Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
2761 Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
2765 Set percentage of delayed signal mixed with original. Range from 0 to 100.
2766 Default value is 71.
2769 Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
2772 Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
2773 Default value is @var{sinusoidal}.
2776 Set swept wave percentage-shift for multi channel. Range from 0 to 100.
2777 Default value is 25.
2780 Set delay-line interpolation, @var{linear} or @var{quadratic}.
2781 Default is @var{linear}.
2785 Apply Haas effect to audio.
2787 Note that this makes most sense to apply on mono signals.
2788 With this filter applied to mono signals it give some directionality and
2789 stretches its stereo image.
2791 The filter accepts the following options:
2795 Set input level. By default is @var{1}, or 0dB
2798 Set output level. By default is @var{1}, or 0dB.
2801 Set gain applied to side part of signal. By default is @var{1}.
2804 Set kind of middle source. Can be one of the following:
2814 Pick middle part signal of stereo image.
2817 Pick side part signal of stereo image.
2821 Change middle phase. By default is disabled.
2824 Set left channel delay. By default is @var{2.05} milliseconds.
2827 Set left channel balance. By default is @var{-1}.
2830 Set left channel gain. By default is @var{1}.
2833 Change left phase. By default is disabled.
2836 Set right channel delay. By defaults is @var{2.12} milliseconds.
2839 Set right channel balance. By default is @var{1}.
2842 Set right channel gain. By default is @var{1}.
2845 Change right phase. By default is enabled.
2850 Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
2851 embedded HDCD codes is expanded into a 20-bit PCM stream.
2853 The filter supports the Peak Extend and Low-level Gain Adjustment features
2854 of HDCD, and detects the Transient Filter flag.
2857 ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
2860 When using the filter with wav, note the default encoding for wav is 16-bit,
2861 so the resulting 20-bit stream will be truncated back to 16-bit. Use something
2862 like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
2864 ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
2865 ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
2868 The filter accepts the following options:
2871 @item disable_autoconvert
2872 Disable any automatic format conversion or resampling in the filter graph.
2874 @item process_stereo
2875 Process the stereo channels together. If target_gain does not match between
2876 channels, consider it invalid and use the last valid target_gain.
2879 Set the code detect timer period in ms.
2882 Always extend peaks above -3dBFS even if PE isn't signaled.
2885 Replace audio with a solid tone and adjust the amplitude to signal some
2886 specific aspect of the decoding process. The output file can be loaded in
2887 an audio editor alongside the original to aid analysis.
2889 @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
2896 Gain adjustment level at each sample
2898 Samples where peak extend occurs
2900 Samples where the code detect timer is active
2902 Samples where the target gain does not match between channels
2908 Apply head-related transfer functions (HRTFs) to create virtual
2909 loudspeakers around the user for binaural listening via headphones.
2910 The HRIRs are provided via additional streams, for each channel
2911 one stereo input stream is needed.
2913 The filter accepts the following options:
2917 Set mapping of input streams for convolution.
2918 The argument is a '|'-separated list of channel names in order as they
2919 are given as additional stream inputs for filter.
2920 This also specify number of input streams. Number of input streams
2921 must be not less than number of channels in first stream plus one.
2924 Set gain applied to audio. Value is in dB. Default is 0.
2927 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
2928 processing audio in time domain which is slow.
2929 @var{freq} is processing audio in frequency domain which is fast.
2930 Default is @var{freq}.
2933 Set custom gain for LFE channels. Value is in dB. Default is 0.
2936 @subsection Examples
2940 Full example using wav files as coefficients with amovie filters for 7.1 downmix,
2941 each amovie filter use stereo file with IR coefficients as input.
2942 The files give coefficients for each position of virtual loudspeaker:
2944 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"
2951 Apply a high-pass filter with 3dB point frequency.
2952 The filter can be either single-pole, or double-pole (the default).
2953 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
2955 The filter accepts the following options:
2959 Set frequency in Hz. Default is 3000.
2962 Set number of poles. Default is 2.
2965 Set method to specify band-width of filter.
2978 Specify the band-width of a filter in width_type units.
2979 Applies only to double-pole filter.
2980 The default is 0.707q and gives a Butterworth response.
2983 Specify which channels to filter, by default all available are filtered.
2988 Join multiple input streams into one multi-channel stream.
2990 It accepts the following parameters:
2994 The number of input streams. It defaults to 2.
2996 @item channel_layout
2997 The desired output channel layout. It defaults to stereo.
3000 Map channels from inputs to output. The argument is a '|'-separated list of
3001 mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
3002 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
3003 can be either the name of the input channel (e.g. FL for front left) or its
3004 index in the specified input stream. @var{out_channel} is the name of the output
3008 The filter will attempt to guess the mappings when they are not specified
3009 explicitly. It does so by first trying to find an unused matching input channel
3010 and if that fails it picks the first unused input channel.
3012 Join 3 inputs (with properly set channel layouts):
3014 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
3017 Build a 5.1 output from 6 single-channel streams:
3019 ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
3020 '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'
3026 Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
3028 To enable compilation of this filter you need to configure FFmpeg with
3029 @code{--enable-ladspa}.
3033 Specifies the name of LADSPA plugin library to load. If the environment
3034 variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
3035 each one of the directories specified by the colon separated list in
3036 @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
3037 this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
3038 @file{/usr/lib/ladspa/}.
3041 Specifies the plugin within the library. Some libraries contain only
3042 one plugin, but others contain many of them. If this is not set filter
3043 will list all available plugins within the specified library.
3046 Set the '|' separated list of controls which are zero or more floating point
3047 values that determine the behavior of the loaded plugin (for example delay,
3049 Controls need to be defined using the following syntax:
3050 c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
3051 @var{valuei} is the value set on the @var{i}-th control.
3052 Alternatively they can be also defined using the following syntax:
3053 @var{value0}|@var{value1}|@var{value2}|..., where
3054 @var{valuei} is the value set on the @var{i}-th control.
3055 If @option{controls} is set to @code{help}, all available controls and
3056 their valid ranges are printed.
3058 @item sample_rate, s
3059 Specify the sample rate, default to 44100. Only used if plugin have
3063 Set the number of samples per channel per each output frame, default
3064 is 1024. Only used if plugin have zero inputs.
3067 Set the minimum duration of the sourced audio. See
3068 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3069 for the accepted syntax.
3070 Note that the resulting duration may be greater than the specified duration,
3071 as the generated audio is always cut at the end of a complete frame.
3072 If not specified, or the expressed duration is negative, the audio is
3073 supposed to be generated forever.
3074 Only used if plugin have zero inputs.
3078 @subsection Examples
3082 List all available plugins within amp (LADSPA example plugin) library:
3088 List all available controls and their valid ranges for @code{vcf_notch}
3089 plugin from @code{VCF} library:
3091 ladspa=f=vcf:p=vcf_notch:c=help
3095 Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
3098 ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
3102 Add reverberation to the audio using TAP-plugins
3103 (Tom's Audio Processing plugins):
3105 ladspa=file=tap_reverb:tap_reverb
3109 Generate white noise, with 0.2 amplitude:
3111 ladspa=file=cmt:noise_source_white:c=c0=.2
3115 Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
3116 @code{C* Audio Plugin Suite} (CAPS) library:
3118 ladspa=file=caps:Click:c=c1=20'
3122 Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
3124 ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
3128 Increase volume by 20dB using fast lookahead limiter from Steve Harris
3129 @code{SWH Plugins} collection:
3131 ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
3135 Attenuate low frequencies using Multiband EQ from Steve Harris
3136 @code{SWH Plugins} collection:
3138 ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
3142 Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
3145 ladspa=caps:Narrower
3149 Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
3151 ladspa=caps:White:.2
3155 Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
3157 ladspa=caps:Fractal:c=c1=1
3161 Dynamic volume normalization using @code{VLevel} plugin:
3163 ladspa=vlevel-ladspa:vlevel_mono
3167 @subsection Commands
3169 This filter supports the following commands:
3172 Modify the @var{N}-th control value.
3174 If the specified value is not valid, it is ignored and prior one is kept.
3179 EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
3180 Support for both single pass (livestreams, files) and double pass (files) modes.
3181 This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
3182 the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
3183 Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
3185 The filter accepts the following options:
3189 Set integrated loudness target.
3190 Range is -70.0 - -5.0. Default value is -24.0.
3193 Set loudness range target.
3194 Range is 1.0 - 20.0. Default value is 7.0.
3197 Set maximum true peak.
3198 Range is -9.0 - +0.0. Default value is -2.0.
3200 @item measured_I, measured_i
3201 Measured IL of input file.
3202 Range is -99.0 - +0.0.
3204 @item measured_LRA, measured_lra
3205 Measured LRA of input file.
3206 Range is 0.0 - 99.0.
3208 @item measured_TP, measured_tp
3209 Measured true peak of input file.
3210 Range is -99.0 - +99.0.
3212 @item measured_thresh
3213 Measured threshold of input file.
3214 Range is -99.0 - +0.0.
3217 Set offset gain. Gain is applied before the true-peak limiter.
3218 Range is -99.0 - +99.0. Default is +0.0.
3221 Normalize linearly if possible.
3222 measured_I, measured_LRA, measured_TP, and measured_thresh must also
3223 to be specified in order to use this mode.
3224 Options are true or false. Default is true.
3227 Treat mono input files as "dual-mono". If a mono file is intended for playback
3228 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
3229 If set to @code{true}, this option will compensate for this effect.
3230 Multi-channel input files are not affected by this option.
3231 Options are true or false. Default is false.
3234 Set print format for stats. Options are summary, json, or none.
3235 Default value is none.
3240 Apply a low-pass filter with 3dB point frequency.
3241 The filter can be either single-pole or double-pole (the default).
3242 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
3244 The filter accepts the following options:
3248 Set frequency in Hz. Default is 500.
3251 Set number of poles. Default is 2.
3254 Set method to specify band-width of filter.
3267 Specify the band-width of a filter in width_type units.
3268 Applies only to double-pole filter.
3269 The default is 0.707q and gives a Butterworth response.
3272 Specify which channels to filter, by default all available are filtered.
3275 @subsection Examples
3278 Lowpass only LFE channel, it LFE is not present it does nothing:
3286 Load a LV2 (LADSPA Version 2) plugin.
3288 To enable compilation of this filter you need to configure FFmpeg with
3289 @code{--enable-lv2}.
3293 Specifies the plugin URI. You may need to escape ':'.
3296 Set the '|' separated list of controls which are zero or more floating point
3297 values that determine the behavior of the loaded plugin (for example delay,
3299 If @option{controls} is set to @code{help}, all available controls and
3300 their valid ranges are printed.
3302 @item sample_rate, s
3303 Specify the sample rate, default to 44100. Only used if plugin have
3307 Set the number of samples per channel per each output frame, default
3308 is 1024. Only used if plugin have zero inputs.
3311 Set the minimum duration of the sourced audio. See
3312 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3313 for the accepted syntax.
3314 Note that the resulting duration may be greater than the specified duration,
3315 as the generated audio is always cut at the end of a complete frame.
3316 If not specified, or the expressed duration is negative, the audio is
3317 supposed to be generated forever.
3318 Only used if plugin have zero inputs.
3321 @subsection Examples
3325 Apply bass enhancer plugin from Calf:
3327 lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
3331 Apply bass vinyl plugin from Calf:
3333 lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
3337 Apply bit crusher plugin from ArtyFX:
3339 lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
3344 Multiband Compress or expand the audio's dynamic range.
3346 The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
3347 This is akin to the crossover of a loudspeaker, and results in flat frequency
3348 response when absent compander action.
3350 It accepts the following parameters:
3354 This option syntax is:
3355 attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
3356 For explanation of each item refer to compand filter documentation.
3362 Mix channels with specific gain levels. The filter accepts the output
3363 channel layout followed by a set of channels definitions.
3365 This filter is also designed to efficiently remap the channels of an audio
3368 The filter accepts parameters of the form:
3369 "@var{l}|@var{outdef}|@var{outdef}|..."
3373 output channel layout or number of channels
3376 output channel specification, of the form:
3377 "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
3380 output channel to define, either a channel name (FL, FR, etc.) or a channel
3381 number (c0, c1, etc.)
3384 multiplicative coefficient for the channel, 1 leaving the volume unchanged
3387 input channel to use, see out_name for details; it is not possible to mix
3388 named and numbered input channels
3391 If the `=' in a channel specification is replaced by `<', then the gains for
3392 that specification will be renormalized so that the total is 1, thus
3393 avoiding clipping noise.
3395 @subsection Mixing examples
3397 For example, if you want to down-mix from stereo to mono, but with a bigger
3398 factor for the left channel:
3400 pan=1c|c0=0.9*c0+0.1*c1
3403 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
3404 7-channels surround:
3406 pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
3409 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
3410 that should be preferred (see "-ac" option) unless you have very specific
3413 @subsection Remapping examples
3415 The channel remapping will be effective if, and only if:
3418 @item gain coefficients are zeroes or ones,
3419 @item only one input per channel output,
3422 If all these conditions are satisfied, the filter will notify the user ("Pure
3423 channel mapping detected"), and use an optimized and lossless method to do the
3426 For example, if you have a 5.1 source and want a stereo audio stream by
3427 dropping the extra channels:
3429 pan="stereo| c0=FL | c1=FR"
3432 Given the same source, you can also switch front left and front right channels
3433 and keep the input channel layout:
3435 pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
3438 If the input is a stereo audio stream, you can mute the front left channel (and
3439 still keep the stereo channel layout) with:
3444 Still with a stereo audio stream input, you can copy the right channel in both
3445 front left and right:
3447 pan="stereo| c0=FR | c1=FR"
3452 ReplayGain scanner filter. This filter takes an audio stream as an input and
3453 outputs it unchanged.
3454 At end of filtering it displays @code{track_gain} and @code{track_peak}.
3458 Convert the audio sample format, sample rate and channel layout. It is
3459 not meant to be used directly.
3462 Apply time-stretching and pitch-shifting with librubberband.
3464 The filter accepts the following options:
3468 Set tempo scale factor.
3471 Set pitch scale factor.
3474 Set transients detector.
3475 Possible values are:
3484 Possible values are:
3493 Possible values are:
3500 Set processing window size.
3501 Possible values are:
3510 Possible values are:
3517 Enable formant preservation when shift pitching.
3518 Possible values are:
3526 Possible values are:
3535 Possible values are:
3542 @section sidechaincompress
3544 This filter acts like normal compressor but has the ability to compress
3545 detected signal using second input signal.
3546 It needs two input streams and returns one output stream.
3547 First input stream will be processed depending on second stream signal.
3548 The filtered signal then can be filtered with other filters in later stages of
3549 processing. See @ref{pan} and @ref{amerge} filter.
3551 The filter accepts the following options:
3555 Set input gain. Default is 1. Range is between 0.015625 and 64.
3558 If a signal of second stream raises above this level it will affect the gain
3559 reduction of first stream.
3560 By default is 0.125. Range is between 0.00097563 and 1.
3563 Set a ratio about which the signal is reduced. 1:2 means that if the level
3564 raised 4dB above the threshold, it will be only 2dB above after the reduction.
3565 Default is 2. Range is between 1 and 20.
3568 Amount of milliseconds the signal has to rise above the threshold before gain
3569 reduction starts. Default is 20. Range is between 0.01 and 2000.
3572 Amount of milliseconds the signal has to fall below the threshold before
3573 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
3576 Set the amount by how much signal will be amplified after processing.
3577 Default is 1. Range is from 1 to 64.
3580 Curve the sharp knee around the threshold to enter gain reduction more softly.
3581 Default is 2.82843. Range is between 1 and 8.
3584 Choose if the @code{average} level between all channels of side-chain stream
3585 or the louder(@code{maximum}) channel of side-chain stream affects the
3586 reduction. Default is @code{average}.
3589 Should the exact signal be taken in case of @code{peak} or an RMS one in case
3590 of @code{rms}. Default is @code{rms} which is mainly smoother.
3593 Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
3596 How much to use compressed signal in output. Default is 1.
3597 Range is between 0 and 1.
3600 @subsection Examples
3604 Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
3605 depending on the signal of 2nd input and later compressed signal to be
3606 merged with 2nd input:
3608 ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
3612 @section sidechaingate
3614 A sidechain gate acts like a normal (wideband) gate but has the ability to
3615 filter the detected signal before sending it to the gain reduction stage.
3616 Normally a gate uses the full range signal to detect a level above the
3618 For example: If you cut all lower frequencies from your sidechain signal
3619 the gate will decrease the volume of your track only if not enough highs
3620 appear. With this technique you are able to reduce the resonation of a
3621 natural drum or remove "rumbling" of muted strokes from a heavily distorted
3623 It needs two input streams and returns one output stream.
3624 First input stream will be processed depending on second stream signal.
3626 The filter accepts the following options:
3630 Set input level before filtering.
3631 Default is 1. Allowed range is from 0.015625 to 64.
3634 Set the level of gain reduction when the signal is below the threshold.
3635 Default is 0.06125. Allowed range is from 0 to 1.
3638 If a signal rises above this level the gain reduction is released.
3639 Default is 0.125. Allowed range is from 0 to 1.
3642 Set a ratio about which the signal is reduced.
3643 Default is 2. Allowed range is from 1 to 9000.
3646 Amount of milliseconds the signal has to rise above the threshold before gain
3648 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
3651 Amount of milliseconds the signal has to fall below the threshold before the
3652 reduction is increased again. Default is 250 milliseconds.
3653 Allowed range is from 0.01 to 9000.
3656 Set amount of amplification of signal after processing.
3657 Default is 1. Allowed range is from 1 to 64.
3660 Curve the sharp knee around the threshold to enter gain reduction more softly.
3661 Default is 2.828427125. Allowed range is from 1 to 8.
3664 Choose if exact signal should be taken for detection or an RMS like one.
3665 Default is rms. Can be peak or rms.
3668 Choose if the average level between all channels or the louder channel affects
3670 Default is average. Can be average or maximum.
3673 Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
3676 @section silencedetect
3678 Detect silence in an audio stream.
3680 This filter logs a message when it detects that the input audio volume is less
3681 or equal to a noise tolerance value for a duration greater or equal to the
3682 minimum detected noise duration.
3684 The printed times and duration are expressed in seconds.
3686 The filter accepts the following options:
3690 Set silence duration until notification (default is 2 seconds).
3693 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
3694 specified value) or amplitude ratio. Default is -60dB, or 0.001.
3697 @subsection Examples
3701 Detect 5 seconds of silence with -50dB noise tolerance:
3703 silencedetect=n=-50dB:d=5
3707 Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
3708 tolerance in @file{silence.mp3}:
3710 ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
3714 @section silenceremove
3716 Remove silence from the beginning, middle or end of the audio.
3718 The filter accepts the following options:
3722 This value is used to indicate if audio should be trimmed at beginning of
3723 the audio. A value of zero indicates no silence should be trimmed from the
3724 beginning. When specifying a non-zero value, it trims audio up until it
3725 finds non-silence. Normally, when trimming silence from beginning of audio
3726 the @var{start_periods} will be @code{1} but it can be increased to higher
3727 values to trim all audio up to specific count of non-silence periods.
3728 Default value is @code{0}.
3730 @item start_duration
3731 Specify the amount of time that non-silence must be detected before it stops
3732 trimming audio. By increasing the duration, bursts of noises can be treated
3733 as silence and trimmed off. Default value is @code{0}.
3735 @item start_threshold
3736 This indicates what sample value should be treated as silence. For digital
3737 audio, a value of @code{0} may be fine but for audio recorded from analog,
3738 you may wish to increase the value to account for background noise.
3739 Can be specified in dB (in case "dB" is appended to the specified value)
3740 or amplitude ratio. Default value is @code{0}.
3743 Set the count for trimming silence from the end of audio.
3744 To remove silence from the middle of a file, specify a @var{stop_periods}
3745 that is negative. This value is then treated as a positive value and is
3746 used to indicate the effect should restart processing as specified by
3747 @var{start_periods}, making it suitable for removing periods of silence
3748 in the middle of the audio.
3749 Default value is @code{0}.
3752 Specify a duration of silence that must exist before audio is not copied any
3753 more. By specifying a higher duration, silence that is wanted can be left in
3755 Default value is @code{0}.
3757 @item stop_threshold
3758 This is the same as @option{start_threshold} but for trimming silence from
3760 Can be specified in dB (in case "dB" is appended to the specified value)
3761 or amplitude ratio. Default value is @code{0}.
3764 This indicates that @var{stop_duration} length of audio should be left intact
3765 at the beginning of each period of silence.
3766 For example, if you want to remove long pauses between words but do not want
3767 to remove the pauses completely. Default value is @code{0}.
3770 Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
3771 and works better with digital silence which is exactly 0.
3772 Default value is @code{rms}.
3775 Set ratio used to calculate size of window for detecting silence.
3776 Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
3779 @subsection Examples
3783 The following example shows how this filter can be used to start a recording
3784 that does not contain the delay at the start which usually occurs between
3785 pressing the record button and the start of the performance:
3787 silenceremove=1:5:0.02
3791 Trim all silence encountered from beginning to end where there is more than 1
3792 second of silence in audio:
3794 silenceremove=0:0:0:-1:1:-90dB
3800 SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
3801 loudspeakers around the user for binaural listening via headphones (audio
3802 formats up to 9 channels supported).
3803 The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
3804 SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
3805 Austrian Academy of Sciences.
3807 To enable compilation of this filter you need to configure FFmpeg with
3808 @code{--enable-libmysofa}.
3810 The filter accepts the following options:
3814 Set the SOFA file used for rendering.
3817 Set gain applied to audio. Value is in dB. Default is 0.
3820 Set rotation of virtual loudspeakers in deg. Default is 0.
3823 Set elevation of virtual speakers in deg. Default is 0.
3826 Set distance in meters between loudspeakers and the listener with near-field
3827 HRTFs. Default is 1.
3830 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
3831 processing audio in time domain which is slow.
3832 @var{freq} is processing audio in frequency domain which is fast.
3833 Default is @var{freq}.
3836 Set custom positions of virtual loudspeakers. Syntax for this option is:
3837 <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
3838 Each virtual loudspeaker is described with short channel name following with
3839 azimuth and elevation in degrees.
3840 Each virtual loudspeaker description is separated by '|'.
3841 For example to override front left and front right channel positions use:
3842 'speakers=FL 45 15|FR 345 15'.
3843 Descriptions with unrecognised channel names are ignored.
3846 Set custom gain for LFE channels. Value is in dB. Default is 0.
3849 @subsection Examples
3853 Using ClubFritz6 sofa file:
3855 sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
3859 Using ClubFritz12 sofa file and bigger radius with small rotation:
3861 sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
3865 Similar as above but with custom speaker positions for front left, front right, back left and back right
3866 and also with custom gain:
3868 "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
3872 @section stereotools
3874 This filter has some handy utilities to manage stereo signals, for converting
3875 M/S stereo recordings to L/R signal while having control over the parameters
3876 or spreading the stereo image of master track.
3878 The filter accepts the following options:
3882 Set input level before filtering for both channels. Defaults is 1.
3883 Allowed range is from 0.015625 to 64.
3886 Set output level after filtering for both channels. Defaults is 1.
3887 Allowed range is from 0.015625 to 64.
3890 Set input balance between both channels. Default is 0.
3891 Allowed range is from -1 to 1.
3894 Set output balance between both channels. Default is 0.
3895 Allowed range is from -1 to 1.
3898 Enable softclipping. Results in analog distortion instead of harsh digital 0dB
3899 clipping. Disabled by default.
3902 Mute the left channel. Disabled by default.
3905 Mute the right channel. Disabled by default.
3908 Change the phase of the left channel. Disabled by default.
3911 Change the phase of the right channel. Disabled by default.
3914 Set stereo mode. Available values are:
3918 Left/Right to Left/Right, this is default.
3921 Left/Right to Mid/Side.
3924 Mid/Side to Left/Right.
3927 Left/Right to Left/Left.
3930 Left/Right to Right/Right.
3933 Left/Right to Left + Right.
3936 Left/Right to Right/Left.
3939 Mid/Side to Left/Left.
3942 Mid/Side to Right/Right.
3946 Set level of side signal. Default is 1.
3947 Allowed range is from 0.015625 to 64.
3950 Set balance of side signal. Default is 0.
3951 Allowed range is from -1 to 1.
3954 Set level of the middle signal. Default is 1.
3955 Allowed range is from 0.015625 to 64.
3958 Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
3961 Set stereo base between mono and inversed channels. Default is 0.
3962 Allowed range is from -1 to 1.
3965 Set delay in milliseconds how much to delay left from right channel and
3966 vice versa. Default is 0. Allowed range is from -20 to 20.
3969 Set S/C level. Default is 1. Allowed range is from 1 to 100.
3972 Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
3974 @item bmode_in, bmode_out
3975 Set balance mode for balance_in/balance_out option.
3977 Can be one of the following:
3981 Classic balance mode. Attenuate one channel at time.
3982 Gain is raised up to 1.
3985 Similar as classic mode above but gain is raised up to 2.
3988 Equal power distribution, from -6dB to +6dB range.
3992 @subsection Examples
3996 Apply karaoke like effect:
3998 stereotools=mlev=0.015625
4002 Convert M/S signal to L/R:
4004 "stereotools=mode=ms>lr"
4008 @section stereowiden
4010 This filter enhance the stereo effect by suppressing signal common to both
4011 channels and by delaying the signal of left into right and vice versa,
4012 thereby widening the stereo effect.
4014 The filter accepts the following options:
4018 Time in milliseconds of the delay of left signal into right and vice versa.
4019 Default is 20 milliseconds.
4022 Amount of gain in delayed signal into right and vice versa. Gives a delay
4023 effect of left signal in right output and vice versa which gives widening
4024 effect. Default is 0.3.
4027 Cross feed of left into right with inverted phase. This helps in suppressing
4028 the mono. If the value is 1 it will cancel all the signal common to both
4029 channels. Default is 0.3.
4032 Set level of input signal of original channel. Default is 0.8.
4035 @section superequalizer
4036 Apply 18 band equalizer.
4038 The filter accepts the following options:
4045 Set 131Hz band gain.
4047 Set 185Hz band gain.
4049 Set 262Hz band gain.
4051 Set 370Hz band gain.
4053 Set 523Hz band gain.
4055 Set 740Hz band gain.
4057 Set 1047Hz band gain.
4059 Set 1480Hz band gain.
4061 Set 2093Hz band gain.
4063 Set 2960Hz band gain.
4065 Set 4186Hz band gain.
4067 Set 5920Hz band gain.
4069 Set 8372Hz band gain.
4071 Set 11840Hz band gain.
4073 Set 16744Hz band gain.
4075 Set 20000Hz band gain.
4079 Apply audio surround upmix filter.
4081 This filter allows to produce multichannel output from audio stream.
4083 The filter accepts the following options:
4087 Set output channel layout. By default, this is @var{5.1}.
4089 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4090 for the required syntax.
4093 Set input channel layout. By default, this is @var{stereo}.
4095 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4096 for the required syntax.
4099 Set input volume level. By default, this is @var{1}.
4102 Set output volume level. By default, this is @var{1}.
4105 Enable LFE channel output if output channel layout has it. By default, this is enabled.
4108 Set LFE low cut off frequency. By default, this is @var{128} Hz.
4111 Set LFE high cut off frequency. By default, this is @var{256} Hz.
4114 Set front center input volume. By default, this is @var{1}.
4117 Set front center output volume. By default, this is @var{1}.
4120 Set LFE input volume. By default, this is @var{1}.
4123 Set LFE output volume. By default, this is @var{1}.
4128 Boost or cut treble (upper) frequencies of the audio using a two-pole
4129 shelving filter with a response similar to that of a standard
4130 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
4132 The filter accepts the following options:
4136 Give the gain at whichever is the lower of ~22 kHz and the
4137 Nyquist frequency. Its useful range is about -20 (for a large cut)
4138 to +20 (for a large boost). Beware of clipping when using a positive gain.
4141 Set the filter's central frequency and so can be used
4142 to extend or reduce the frequency range to be boosted or cut.
4143 The default value is @code{3000} Hz.
4146 Set method to specify band-width of filter.
4159 Determine how steep is the filter's shelf transition.
4162 Specify which channels to filter, by default all available are filtered.
4167 Sinusoidal amplitude modulation.
4169 The filter accepts the following options:
4173 Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
4174 (20 Hz or lower) will result in a tremolo effect.
4175 This filter may also be used as a ring modulator by specifying
4176 a modulation frequency higher than 20 Hz.
4177 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
4180 Depth of modulation as a percentage. Range is 0.0 - 1.0.
4181 Default value is 0.5.
4186 Sinusoidal phase modulation.
4188 The filter accepts the following options:
4192 Modulation frequency in Hertz.
4193 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
4196 Depth of modulation as a percentage. Range is 0.0 - 1.0.
4197 Default value is 0.5.
4202 Adjust the input audio volume.
4204 It accepts the following parameters:
4208 Set audio volume expression.
4210 Output values are clipped to the maximum value.
4212 The output audio volume is given by the relation:
4214 @var{output_volume} = @var{volume} * @var{input_volume}
4217 The default value for @var{volume} is "1.0".
4220 This parameter represents the mathematical precision.
4222 It determines which input sample formats will be allowed, which affects the
4223 precision of the volume scaling.
4227 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
4229 32-bit floating-point; this limits input sample format to FLT. (default)
4231 64-bit floating-point; this limits input sample format to DBL.
4235 Choose the behaviour on encountering ReplayGain side data in input frames.
4239 Remove ReplayGain side data, ignoring its contents (the default).
4242 Ignore ReplayGain side data, but leave it in the frame.
4245 Prefer the track gain, if present.
4248 Prefer the album gain, if present.
4251 @item replaygain_preamp
4252 Pre-amplification gain in dB to apply to the selected replaygain gain.
4254 Default value for @var{replaygain_preamp} is 0.0.
4257 Set when the volume expression is evaluated.
4259 It accepts the following values:
4262 only evaluate expression once during the filter initialization, or
4263 when the @samp{volume} command is sent
4266 evaluate expression for each incoming frame
4269 Default value is @samp{once}.
4272 The volume expression can contain the following parameters.
4276 frame number (starting at zero)
4279 @item nb_consumed_samples
4280 number of samples consumed by the filter
4282 number of samples in the current frame
4284 original frame position in the file
4290 PTS at start of stream
4292 time at start of stream
4298 last set volume value
4301 Note that when @option{eval} is set to @samp{once} only the
4302 @var{sample_rate} and @var{tb} variables are available, all other
4303 variables will evaluate to NAN.
4305 @subsection Commands
4307 This filter supports the following commands:
4310 Modify the volume expression.
4311 The command accepts the same syntax of the corresponding option.
4313 If the specified expression is not valid, it is kept at its current
4315 @item replaygain_noclip
4316 Prevent clipping by limiting the gain applied.
4318 Default value for @var{replaygain_noclip} is 1.
4322 @subsection Examples
4326 Halve the input audio volume:
4330 volume=volume=-6.0206dB
4333 In all the above example the named key for @option{volume} can be
4334 omitted, for example like in:
4340 Increase input audio power by 6 decibels using fixed-point precision:
4342 volume=volume=6dB:precision=fixed
4346 Fade volume after time 10 with an annihilation period of 5 seconds:
4348 volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
4352 @section volumedetect
4354 Detect the volume of the input video.
4356 The filter has no parameters. The input is not modified. Statistics about
4357 the volume will be printed in the log when the input stream end is reached.
4359 In particular it will show the mean volume (root mean square), maximum
4360 volume (on a per-sample basis), and the beginning of a histogram of the
4361 registered volume values (from the maximum value to a cumulated 1/1000 of
4364 All volumes are in decibels relative to the maximum PCM value.
4366 @subsection Examples
4368 Here is an excerpt of the output:
4370 [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
4371 [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
4372 [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
4373 [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
4374 [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
4375 [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
4376 [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
4377 [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
4378 [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
4384 The mean square energy is approximately -27 dB, or 10^-2.7.
4386 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
4388 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
4391 In other words, raising the volume by +4 dB does not cause any clipping,
4392 raising it by +5 dB causes clipping for 6 samples, etc.
4394 @c man end AUDIO FILTERS
4396 @chapter Audio Sources
4397 @c man begin AUDIO SOURCES
4399 Below is a description of the currently available audio sources.
4403 Buffer audio frames, and make them available to the filter chain.
4405 This source is mainly intended for a programmatic use, in particular
4406 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
4408 It accepts the following parameters:
4412 The timebase which will be used for timestamps of submitted frames. It must be
4413 either a floating-point number or in @var{numerator}/@var{denominator} form.
4416 The sample rate of the incoming audio buffers.
4419 The sample format of the incoming audio buffers.
4420 Either a sample format name or its corresponding integer representation from
4421 the enum AVSampleFormat in @file{libavutil/samplefmt.h}
4423 @item channel_layout
4424 The channel layout of the incoming audio buffers.
4425 Either a channel layout name from channel_layout_map in
4426 @file{libavutil/channel_layout.c} or its corresponding integer representation
4427 from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
4430 The number of channels of the incoming audio buffers.
4431 If both @var{channels} and @var{channel_layout} are specified, then they
4436 @subsection Examples
4439 abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
4442 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
4443 Since the sample format with name "s16p" corresponds to the number
4444 6 and the "stereo" channel layout corresponds to the value 0x3, this is
4447 abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
4452 Generate an audio signal specified by an expression.
4454 This source accepts in input one or more expressions (one for each
4455 channel), which are evaluated and used to generate a corresponding
4458 This source accepts the following options:
4462 Set the '|'-separated expressions list for each separate channel. In case the
4463 @option{channel_layout} option is not specified, the selected channel layout
4464 depends on the number of provided expressions. Otherwise the last
4465 specified expression is applied to the remaining output channels.
4467 @item channel_layout, c
4468 Set the channel layout. The number of channels in the specified layout
4469 must be equal to the number of specified expressions.
4472 Set the minimum duration of the sourced audio. See
4473 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
4474 for the accepted syntax.
4475 Note that the resulting duration may be greater than the specified
4476 duration, as the generated audio is always cut at the end of a
4479 If not specified, or the expressed duration is negative, the audio is
4480 supposed to be generated forever.
4483 Set the number of samples per channel per each output frame,
4486 @item sample_rate, s
4487 Specify the sample rate, default to 44100.
4490 Each expression in @var{exprs} can contain the following constants:
4494 number of the evaluated sample, starting from 0
4497 time of the evaluated sample expressed in seconds, starting from 0
4504 @subsection Examples
4514 Generate a sin signal with frequency of 440 Hz, set sample rate to
4517 aevalsrc="sin(440*2*PI*t):s=8000"
4521 Generate a two channels signal, specify the channel layout (Front
4522 Center + Back Center) explicitly:
4524 aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
4528 Generate white noise:
4530 aevalsrc="-2+random(0)"
4534 Generate an amplitude modulated signal:
4536 aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
4540 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
4542 aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
4549 The null audio source, return unprocessed audio frames. It is mainly useful
4550 as a template and to be employed in analysis / debugging tools, or as
4551 the source for filters which ignore the input data (for example the sox
4554 This source accepts the following options:
4558 @item channel_layout, cl
4560 Specifies the channel layout, and can be either an integer or a string
4561 representing a channel layout. The default value of @var{channel_layout}
4564 Check the channel_layout_map definition in
4565 @file{libavutil/channel_layout.c} for the mapping between strings and
4566 channel layout values.
4568 @item sample_rate, r
4569 Specifies the sample rate, and defaults to 44100.
4572 Set the number of samples per requested frames.
4576 @subsection Examples
4580 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
4582 anullsrc=r=48000:cl=4
4586 Do the same operation with a more obvious syntax:
4588 anullsrc=r=48000:cl=mono
4592 All the parameters need to be explicitly defined.
4596 Synthesize a voice utterance using the libflite library.
4598 To enable compilation of this filter you need to configure FFmpeg with
4599 @code{--enable-libflite}.
4601 Note that versions of the flite library prior to 2.0 are not thread-safe.
4603 The filter accepts the following options:
4608 If set to 1, list the names of the available voices and exit
4609 immediately. Default value is 0.
4612 Set the maximum number of samples per frame. Default value is 512.
4615 Set the filename containing the text to speak.
4618 Set the text to speak.
4621 Set the voice to use for the speech synthesis. Default value is
4622 @code{kal}. See also the @var{list_voices} option.
4625 @subsection Examples
4629 Read from file @file{speech.txt}, and synthesize the text using the
4630 standard flite voice:
4632 flite=textfile=speech.txt
4636 Read the specified text selecting the @code{slt} voice:
4638 flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
4642 Input text to ffmpeg:
4644 ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
4648 Make @file{ffplay} speak the specified text, using @code{flite} and
4649 the @code{lavfi} device:
4651 ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
4655 For more information about libflite, check:
4656 @url{http://www.festvox.org/flite/}
4660 Generate a noise audio signal.
4662 The filter accepts the following options:
4665 @item sample_rate, r
4666 Specify the sample rate. Default value is 48000 Hz.
4669 Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
4673 Specify the duration of the generated audio stream. Not specifying this option
4674 results in noise with an infinite length.
4676 @item color, colour, c
4677 Specify the color of noise. Available noise colors are white, pink, brown,
4678 blue and violet. Default color is white.
4681 Specify a value used to seed the PRNG.
4684 Set the number of samples per each output frame, default is 1024.
4687 @subsection Examples
4692 Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
4694 anoisesrc=d=60:c=pink:r=44100:a=0.5
4700 Generate an audio signal made of a sine wave with amplitude 1/8.
4702 The audio signal is bit-exact.
4704 The filter accepts the following options:
4709 Set the carrier frequency. Default is 440 Hz.
4711 @item beep_factor, b
4712 Enable a periodic beep every second with frequency @var{beep_factor} times
4713 the carrier frequency. Default is 0, meaning the beep is disabled.
4715 @item sample_rate, r
4716 Specify the sample rate, default is 44100.
4719 Specify the duration of the generated audio stream.
4721 @item samples_per_frame
4722 Set the number of samples per output frame.
4724 The expression can contain the following constants:
4728 The (sequential) number of the output audio frame, starting from 0.
4731 The PTS (Presentation TimeStamp) of the output audio frame,
4732 expressed in @var{TB} units.
4735 The PTS of the output audio frame, expressed in seconds.
4738 The timebase of the output audio frames.
4741 Default is @code{1024}.
4744 @subsection Examples
4749 Generate a simple 440 Hz sine wave:
4755 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
4759 sine=frequency=220:beep_factor=4:duration=5
4763 Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
4766 sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
4770 @c man end AUDIO SOURCES
4772 @chapter Audio Sinks
4773 @c man begin AUDIO SINKS
4775 Below is a description of the currently available audio sinks.
4777 @section abuffersink
4779 Buffer audio frames, and make them available to the end of filter chain.
4781 This sink is mainly intended for programmatic use, in particular
4782 through the interface defined in @file{libavfilter/buffersink.h}
4783 or the options system.
4785 It accepts a pointer to an AVABufferSinkContext structure, which
4786 defines the incoming buffers' formats, to be passed as the opaque
4787 parameter to @code{avfilter_init_filter} for initialization.
4790 Null audio sink; do absolutely nothing with the input audio. It is
4791 mainly useful as a template and for use in analysis / debugging
4794 @c man end AUDIO SINKS
4796 @chapter Video Filters
4797 @c man begin VIDEO FILTERS
4799 When you configure your FFmpeg build, you can disable any of the
4800 existing filters using @code{--disable-filters}.
4801 The configure output will show the video filters included in your
4804 Below is a description of the currently available video filters.
4806 @section alphaextract
4808 Extract the alpha component from the input as a grayscale video. This
4809 is especially useful with the @var{alphamerge} filter.
4813 Add or replace the alpha component of the primary input with the
4814 grayscale value of a second input. This is intended for use with
4815 @var{alphaextract} to allow the transmission or storage of frame
4816 sequences that have alpha in a format that doesn't support an alpha
4819 For example, to reconstruct full frames from a normal YUV-encoded video
4820 and a separate video created with @var{alphaextract}, you might use:
4822 movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
4825 Since this filter is designed for reconstruction, it operates on frame
4826 sequences without considering timestamps, and terminates when either
4827 input reaches end of stream. This will cause problems if your encoding
4828 pipeline drops frames. If you're trying to apply an image as an
4829 overlay to a video stream, consider the @var{overlay} filter instead.
4833 Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
4834 and libavformat to work. On the other hand, it is limited to ASS (Advanced
4835 Substation Alpha) subtitles files.
4837 This filter accepts the following option in addition to the common options from
4838 the @ref{subtitles} filter:
4842 Set the shaping engine
4844 Available values are:
4847 The default libass shaping engine, which is the best available.
4849 Fast, font-agnostic shaper that can do only substitutions
4851 Slower shaper using OpenType for substitutions and positioning
4854 The default is @code{auto}.
4858 Apply an Adaptive Temporal Averaging Denoiser to the video input.
4860 The filter accepts the following options:
4864 Set threshold A for 1st plane. Default is 0.02.
4865 Valid range is 0 to 0.3.
4868 Set threshold B for 1st plane. Default is 0.04.
4869 Valid range is 0 to 5.
4872 Set threshold A for 2nd plane. Default is 0.02.
4873 Valid range is 0 to 0.3.
4876 Set threshold B for 2nd plane. Default is 0.04.
4877 Valid range is 0 to 5.
4880 Set threshold A for 3rd plane. Default is 0.02.
4881 Valid range is 0 to 0.3.
4884 Set threshold B for 3rd plane. Default is 0.04.
4885 Valid range is 0 to 5.
4887 Threshold A is designed to react on abrupt changes in the input signal and
4888 threshold B is designed to react on continuous changes in the input signal.
4891 Set number of frames filter will use for averaging. Default is 33. Must be odd
4892 number in range [5, 129].
4895 Set what planes of frame filter will use for averaging. Default is all.
4900 Apply average blur filter.
4902 The filter accepts the following options:
4906 Set horizontal kernel size.
4909 Set which planes to filter. By default all planes are filtered.
4912 Set vertical kernel size, if zero it will be same as @code{sizeX}.
4913 Default is @code{0}.
4918 Compute the bounding box for the non-black pixels in the input frame
4921 This filter computes the bounding box containing all the pixels with a
4922 luminance value greater than the minimum allowed value.
4923 The parameters describing the bounding box are printed on the filter
4926 The filter accepts the following option:
4930 Set the minimal luminance value. Default is @code{16}.
4933 @section bitplanenoise
4935 Show and measure bit plane noise.
4937 The filter accepts the following options:
4941 Set which plane to analyze. Default is @code{1}.
4944 Filter out noisy pixels from @code{bitplane} set above.
4945 Default is disabled.
4948 @section blackdetect
4950 Detect video intervals that are (almost) completely black. Can be
4951 useful to detect chapter transitions, commercials, or invalid
4952 recordings. Output lines contains the time for the start, end and
4953 duration of the detected black interval expressed in seconds.
4955 In order to display the output lines, you need to set the loglevel at
4956 least to the AV_LOG_INFO value.
4958 The filter accepts the following options:
4961 @item black_min_duration, d
4962 Set the minimum detected black duration expressed in seconds. It must
4963 be a non-negative floating point number.
4965 Default value is 2.0.
4967 @item picture_black_ratio_th, pic_th
4968 Set the threshold for considering a picture "black".
4969 Express the minimum value for the ratio:
4971 @var{nb_black_pixels} / @var{nb_pixels}
4974 for which a picture is considered black.
4975 Default value is 0.98.
4977 @item pixel_black_th, pix_th
4978 Set the threshold for considering a pixel "black".
4980 The threshold expresses the maximum pixel luminance value for which a
4981 pixel is considered "black". The provided value is scaled according to
4982 the following equation:
4984 @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
4987 @var{luminance_range_size} and @var{luminance_minimum_value} depend on
4988 the input video format, the range is [0-255] for YUV full-range
4989 formats and [16-235] for YUV non full-range formats.
4991 Default value is 0.10.
4994 The following example sets the maximum pixel threshold to the minimum
4995 value, and detects only black intervals of 2 or more seconds:
4997 blackdetect=d=2:pix_th=0.00
5002 Detect frames that are (almost) completely black. Can be useful to
5003 detect chapter transitions or commercials. Output lines consist of
5004 the frame number of the detected frame, the percentage of blackness,
5005 the position in the file if known or -1 and the timestamp in seconds.
5007 In order to display the output lines, you need to set the loglevel at
5008 least to the AV_LOG_INFO value.
5010 This filter exports frame metadata @code{lavfi.blackframe.pblack}.
5011 The value represents the percentage of pixels in the picture that
5012 are below the threshold value.
5014 It accepts the following parameters:
5019 The percentage of the pixels that have to be below the threshold; it defaults to
5022 @item threshold, thresh
5023 The threshold below which a pixel value is considered black; it defaults to
5028 @section blend, tblend
5030 Blend two video frames into each other.
5032 The @code{blend} filter takes two input streams and outputs one
5033 stream, the first input is the "top" layer and second input is
5034 "bottom" layer. By default, the output terminates when the longest input terminates.
5036 The @code{tblend} (time blend) filter takes two consecutive frames
5037 from one single stream, and outputs the result obtained by blending
5038 the new frame on top of the old frame.
5040 A description of the accepted options follows.
5048 Set blend mode for specific pixel component or all pixel components in case
5049 of @var{all_mode}. Default value is @code{normal}.
5051 Available values for component modes are:
5093 Set blend opacity for specific pixel component or all pixel components in case
5094 of @var{all_opacity}. Only used in combination with pixel component blend modes.
5101 Set blend expression for specific pixel component or all pixel components in case
5102 of @var{all_expr}. Note that related mode options will be ignored if those are set.
5104 The expressions can use the following variables:
5108 The sequential number of the filtered frame, starting from @code{0}.
5112 the coordinates of the current sample
5116 the width and height of currently filtered plane
5120 Width and height scale depending on the currently filtered plane. It is the
5121 ratio between the corresponding luma plane number of pixels and the current
5122 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
5123 @code{0.5,0.5} for chroma planes.
5126 Time of the current frame, expressed in seconds.
5129 Value of pixel component at current location for first video frame (top layer).
5132 Value of pixel component at current location for second video frame (bottom layer).
5136 The @code{blend} filter also supports the @ref{framesync} options.
5138 @subsection Examples
5142 Apply transition from bottom layer to top layer in first 10 seconds:
5144 blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
5148 Apply linear horizontal transition from top layer to bottom layer:
5150 blend=all_expr='A*(X/W)+B*(1-X/W)'
5154 Apply 1x1 checkerboard effect:
5156 blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
5160 Apply uncover left effect:
5162 blend=all_expr='if(gte(N*SW+X,W),A,B)'
5166 Apply uncover down effect:
5168 blend=all_expr='if(gte(Y-N*SH,0),A,B)'
5172 Apply uncover up-left effect:
5174 blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
5178 Split diagonally video and shows top and bottom layer on each side:
5180 blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
5184 Display differences between the current and the previous frame:
5186 tblend=all_mode=grainextract
5192 Apply a boxblur algorithm to the input video.
5194 It accepts the following parameters:
5198 @item luma_radius, lr
5199 @item luma_power, lp
5200 @item chroma_radius, cr
5201 @item chroma_power, cp
5202 @item alpha_radius, ar
5203 @item alpha_power, ap
5207 A description of the accepted options follows.
5210 @item luma_radius, lr
5211 @item chroma_radius, cr
5212 @item alpha_radius, ar
5213 Set an expression for the box radius in pixels used for blurring the
5214 corresponding input plane.
5216 The radius value must be a non-negative number, and must not be
5217 greater than the value of the expression @code{min(w,h)/2} for the
5218 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
5221 Default value for @option{luma_radius} is "2". If not specified,
5222 @option{chroma_radius} and @option{alpha_radius} default to the
5223 corresponding value set for @option{luma_radius}.
5225 The expressions can contain the following constants:
5229 The input width and height in pixels.
5233 The input chroma image width and height in pixels.
5237 The horizontal and vertical chroma subsample values. For example, for the
5238 pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
5241 @item luma_power, lp
5242 @item chroma_power, cp
5243 @item alpha_power, ap
5244 Specify how many times the boxblur filter is applied to the
5245 corresponding plane.
5247 Default value for @option{luma_power} is 2. If not specified,
5248 @option{chroma_power} and @option{alpha_power} default to the
5249 corresponding value set for @option{luma_power}.
5251 A value of 0 will disable the effect.
5254 @subsection Examples
5258 Apply a boxblur filter with the luma, chroma, and alpha radii
5261 boxblur=luma_radius=2:luma_power=1
5266 Set the luma radius to 2, and alpha and chroma radius to 0:
5268 boxblur=2:1:cr=0:ar=0
5272 Set the luma and chroma radii to a fraction of the video dimension:
5274 boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
5280 Deinterlace the input video ("bwdif" stands for "Bob Weaver
5281 Deinterlacing Filter").
5283 Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
5284 interpolation algorithms.
5285 It accepts the following parameters:
5289 The interlacing mode to adopt. It accepts one of the following values:
5293 Output one frame for each frame.
5295 Output one frame for each field.
5298 The default value is @code{send_field}.
5301 The picture field parity assumed for the input interlaced video. It accepts one
5302 of the following values:
5306 Assume the top field is first.
5308 Assume the bottom field is first.
5310 Enable automatic detection of field parity.
5313 The default value is @code{auto}.
5314 If the interlacing is unknown or the decoder does not export this information,
5315 top field first will be assumed.
5318 Specify which frames to deinterlace. Accept one of the following
5323 Deinterlace all frames.
5325 Only deinterlace frames marked as interlaced.
5328 The default value is @code{all}.
5332 YUV colorspace color/chroma keying.
5334 The filter accepts the following options:
5338 The color which will be replaced with transparency.
5341 Similarity percentage with the key color.
5343 0.01 matches only the exact key color, while 1.0 matches everything.
5348 0.0 makes pixels either fully transparent, or not transparent at all.
5350 Higher values result in semi-transparent pixels, with a higher transparency
5351 the more similar the pixels color is to the key color.
5354 Signals that the color passed is already in YUV instead of RGB.
5356 Literal colors like "green" or "red" don't make sense with this enabled anymore.
5357 This can be used to pass exact YUV values as hexadecimal numbers.
5360 @subsection Examples
5364 Make every green pixel in the input image transparent:
5366 ffmpeg -i input.png -vf chromakey=green out.png
5370 Overlay a greenscreen-video on top of a static black background.
5372 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
5378 Display CIE color diagram with pixels overlaid onto it.
5380 The filter accepts the following options:
5395 @item uhdtv, rec2020
5408 Set what gamuts to draw.
5410 See @code{system} option for available values.
5413 Set ciescope size, by default set to 512.
5416 Set intensity used to map input pixel values to CIE diagram.
5419 Set contrast used to draw tongue colors that are out of active color system gamut.
5422 Correct gamma displayed on scope, by default enabled.
5425 Show white point on CIE diagram, by default disabled.
5428 Set input gamma. Used only with XYZ input color space.
5433 Visualize information exported by some codecs.
5435 Some codecs can export information through frames using side-data or other
5436 means. For example, some MPEG based codecs export motion vectors through the
5437 @var{export_mvs} flag in the codec @option{flags2} option.
5439 The filter accepts the following option:
5443 Set motion vectors to visualize.
5445 Available flags for @var{mv} are:
5449 forward predicted MVs of P-frames
5451 forward predicted MVs of B-frames
5453 backward predicted MVs of B-frames
5457 Display quantization parameters using the chroma planes.
5460 Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
5462 Available flags for @var{mv_type} are:
5466 forward predicted MVs
5468 backward predicted MVs
5471 @item frame_type, ft
5472 Set frame type to visualize motion vectors of.
5474 Available flags for @var{frame_type} are:
5478 intra-coded frames (I-frames)
5480 predicted frames (P-frames)
5482 bi-directionally predicted frames (B-frames)
5486 @subsection Examples
5490 Visualize forward predicted MVs of all frames using @command{ffplay}:
5492 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
5496 Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
5498 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
5502 @section colorbalance
5503 Modify intensity of primary colors (red, green and blue) of input frames.
5505 The filter allows an input frame to be adjusted in the shadows, midtones or highlights
5506 regions for the red-cyan, green-magenta or blue-yellow balance.
5508 A positive adjustment value shifts the balance towards the primary color, a negative
5509 value towards the complementary color.
5511 The filter accepts the following options:
5517 Adjust red, green and blue shadows (darkest pixels).
5522 Adjust red, green and blue midtones (medium pixels).
5527 Adjust red, green and blue highlights (brightest pixels).
5529 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
5532 @subsection Examples
5536 Add red color cast to shadows:
5543 RGB colorspace color keying.
5545 The filter accepts the following options:
5549 The color which will be replaced with transparency.
5552 Similarity percentage with the key color.
5554 0.01 matches only the exact key color, while 1.0 matches everything.
5559 0.0 makes pixels either fully transparent, or not transparent at all.
5561 Higher values result in semi-transparent pixels, with a higher transparency
5562 the more similar the pixels color is to the key color.
5565 @subsection Examples
5569 Make every green pixel in the input image transparent:
5571 ffmpeg -i input.png -vf colorkey=green out.png
5575 Overlay a greenscreen-video on top of a static background image.
5577 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
5581 @section colorlevels
5583 Adjust video input frames using levels.
5585 The filter accepts the following options:
5592 Adjust red, green, blue and alpha input black point.
5593 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
5599 Adjust red, green, blue and alpha input white point.
5600 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
5602 Input levels are used to lighten highlights (bright tones), darken shadows
5603 (dark tones), change the balance of bright and dark tones.
5609 Adjust red, green, blue and alpha output black point.
5610 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
5616 Adjust red, green, blue and alpha output white point.
5617 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
5619 Output levels allows manual selection of a constrained output level range.
5622 @subsection Examples
5626 Make video output darker:
5628 colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
5634 colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
5638 Make video output lighter:
5640 colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
5644 Increase brightness:
5646 colorlevels=romin=0.5:gomin=0.5:bomin=0.5
5650 @section colorchannelmixer
5652 Adjust video input frames by re-mixing color channels.
5654 This filter modifies a color channel by adding the values associated to
5655 the other channels of the same pixels. For example if the value to
5656 modify is red, the output value will be:
5658 @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
5661 The filter accepts the following options:
5668 Adjust contribution of input red, green, blue and alpha channels for output red channel.
5669 Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
5675 Adjust contribution of input red, green, blue and alpha channels for output green channel.
5676 Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
5682 Adjust contribution of input red, green, blue and alpha channels for output blue channel.
5683 Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
5689 Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
5690 Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
5692 Allowed ranges for options are @code{[-2.0, 2.0]}.
5695 @subsection Examples
5699 Convert source to grayscale:
5701 colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
5704 Simulate sepia tones:
5706 colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
5710 @section colormatrix
5712 Convert color matrix.
5714 The filter accepts the following options:
5719 Specify the source and destination color matrix. Both values must be
5722 The accepted values are:
5750 For example to convert from BT.601 to SMPTE-240M, use the command:
5752 colormatrix=bt601:smpte240m
5757 Convert colorspace, transfer characteristics or color primaries.
5758 Input video needs to have an even size.
5760 The filter accepts the following options:
5765 Specify all color properties at once.
5767 The accepted values are:
5797 Specify output colorspace.
5799 The accepted values are:
5808 BT.470BG or BT.601-6 625
5811 SMPTE-170M or BT.601-6 525
5820 BT.2020 with non-constant luminance
5826 Specify output transfer characteristics.
5828 The accepted values are:
5840 Constant gamma of 2.2
5843 Constant gamma of 2.8
5846 SMPTE-170M, BT.601-6 625 or BT.601-6 525
5864 BT.2020 for 10-bits content
5867 BT.2020 for 12-bits content
5873 Specify output color primaries.
5875 The accepted values are:
5884 BT.470BG or BT.601-6 625
5887 SMPTE-170M or BT.601-6 525
5911 Specify output color range.
5913 The accepted values are:
5916 TV (restricted) range
5919 MPEG (restricted) range
5930 Specify output color format.
5932 The accepted values are:
5935 YUV 4:2:0 planar 8-bits
5938 YUV 4:2:0 planar 10-bits
5941 YUV 4:2:0 planar 12-bits
5944 YUV 4:2:2 planar 8-bits
5947 YUV 4:2:2 planar 10-bits
5950 YUV 4:2:2 planar 12-bits
5953 YUV 4:4:4 planar 8-bits
5956 YUV 4:4:4 planar 10-bits
5959 YUV 4:4:4 planar 12-bits
5964 Do a fast conversion, which skips gamma/primary correction. This will take
5965 significantly less CPU, but will be mathematically incorrect. To get output
5966 compatible with that produced by the colormatrix filter, use fast=1.
5969 Specify dithering mode.
5971 The accepted values are:
5977 Floyd-Steinberg dithering
5981 Whitepoint adaptation mode.
5983 The accepted values are:
5986 Bradford whitepoint adaptation
5989 von Kries whitepoint adaptation
5992 identity whitepoint adaptation (i.e. no whitepoint adaptation)
5996 Override all input properties at once. Same accepted values as @ref{all}.
5999 Override input colorspace. Same accepted values as @ref{space}.
6002 Override input color primaries. Same accepted values as @ref{primaries}.
6005 Override input transfer characteristics. Same accepted values as @ref{trc}.
6008 Override input color range. Same accepted values as @ref{range}.
6012 The filter converts the transfer characteristics, color space and color
6013 primaries to the specified user values. The output value, if not specified,
6014 is set to a default value based on the "all" property. If that property is
6015 also not specified, the filter will log an error. The output color range and
6016 format default to the same value as the input color range and format. The
6017 input transfer characteristics, color space, color primaries and color range
6018 should be set on the input data. If any of these are missing, the filter will
6019 log an error and no conversion will take place.
6021 For example to convert the input to SMPTE-240M, use the command:
6023 colorspace=smpte240m
6026 @section convolution
6028 Apply convolution 3x3, 5x5 or 7x7 filter.
6030 The filter accepts the following options:
6037 Set matrix for each plane.
6038 Matrix is sequence of 9, 25 or 49 signed integers.
6044 Set multiplier for calculated value for each plane.
6050 Set bias for each plane. This value is added to the result of the multiplication.
6051 Useful for making the overall image brighter or darker. Default is 0.0.
6054 @subsection Examples
6060 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"
6066 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"
6072 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"
6078 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"
6082 Apply laplacian edge detector which includes diagonals:
6084 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"
6090 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"
6096 Apply 2D convolution of video stream in frequency domain using second stream
6099 The filter accepts the following options:
6103 Set which planes to process.
6106 Set which impulse video frames will be processed, can be @var{first}
6107 or @var{all}. Default is @var{all}.
6110 The @code{convolve} filter also supports the @ref{framesync} options.
6114 Copy the input video source unchanged to the output. This is mainly useful for
6119 Video filtering on GPU using Apple's CoreImage API on OSX.
6121 Hardware acceleration is based on an OpenGL context. Usually, this means it is
6122 processed by video hardware. However, software-based OpenGL implementations
6123 exist which means there is no guarantee for hardware processing. It depends on
6126 There are many filters and image generators provided by Apple that come with a
6127 large variety of options. The filter has to be referenced by its name along
6130 The coreimage filter accepts the following options:
6133 List all available filters and generators along with all their respective
6134 options as well as possible minimum and maximum values along with the default
6141 Specify all filters by their respective name and options.
6142 Use @var{list_filters} to determine all valid filter names and options.
6143 Numerical options are specified by a float value and are automatically clamped
6144 to their respective value range. Vector and color options have to be specified
6145 by a list of space separated float values. Character escaping has to be done.
6146 A special option name @code{default} is available to use default options for a
6149 It is required to specify either @code{default} or at least one of the filter options.
6150 All omitted options are used with their default values.
6151 The syntax of the filter string is as follows:
6153 filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
6157 Specify a rectangle where the output of the filter chain is copied into the
6158 input image. It is given by a list of space separated float values:
6160 output_rect=x\ y\ width\ height
6162 If not given, the output rectangle equals the dimensions of the input image.
6163 The output rectangle is automatically cropped at the borders of the input
6164 image. Negative values are valid for each component.
6166 output_rect=25\ 25\ 100\ 100
6170 Several filters can be chained for successive processing without GPU-HOST
6171 transfers allowing for fast processing of complex filter chains.
6172 Currently, only filters with zero (generators) or exactly one (filters) input
6173 image and one output image are supported. Also, transition filters are not yet
6176 Some filters generate output images with additional padding depending on the
6177 respective filter kernel. The padding is automatically removed to ensure the
6178 filter output has the same size as the input image.
6180 For image generators, the size of the output image is determined by the
6181 previous output image of the filter chain or the input image of the whole
6182 filterchain, respectively. The generators do not use the pixel information of
6183 this image to generate their output. However, the generated output is
6184 blended onto this image, resulting in partial or complete coverage of the
6187 The @ref{coreimagesrc} video source can be used for generating input images
6188 which are directly fed into the filter chain. By using it, providing input
6189 images by another video source or an input video is not required.
6191 @subsection Examples
6196 List all filters available:
6198 coreimage=list_filters=true
6202 Use the CIBoxBlur filter with default options to blur an image:
6204 coreimage=filter=CIBoxBlur@@default
6208 Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
6209 its center at 100x100 and a radius of 50 pixels:
6211 coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
6215 Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
6216 given as complete and escaped command-line for Apple's standard bash shell:
6218 ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
6224 Crop the input video to given dimensions.
6226 It accepts the following parameters:
6230 The width of the output video. It defaults to @code{iw}.
6231 This expression is evaluated only once during the filter
6232 configuration, or when the @samp{w} or @samp{out_w} command is sent.
6235 The height of the output video. It defaults to @code{ih}.
6236 This expression is evaluated only once during the filter
6237 configuration, or when the @samp{h} or @samp{out_h} command is sent.
6240 The horizontal position, in the input video, of the left edge of the output
6241 video. It defaults to @code{(in_w-out_w)/2}.
6242 This expression is evaluated per-frame.
6245 The vertical position, in the input video, of the top edge of the output video.
6246 It defaults to @code{(in_h-out_h)/2}.
6247 This expression is evaluated per-frame.
6250 If set to 1 will force the output display aspect ratio
6251 to be the same of the input, by changing the output sample aspect
6252 ratio. It defaults to 0.
6255 Enable exact cropping. If enabled, subsampled videos will be cropped at exact
6256 width/height/x/y as specified and will not be rounded to nearest smaller value.
6260 The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
6261 expressions containing the following constants:
6266 The computed values for @var{x} and @var{y}. They are evaluated for
6271 The input width and height.
6275 These are the same as @var{in_w} and @var{in_h}.
6279 The output (cropped) width and height.
6283 These are the same as @var{out_w} and @var{out_h}.
6286 same as @var{iw} / @var{ih}
6289 input sample aspect ratio
6292 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
6296 horizontal and vertical chroma subsample values. For example for the
6297 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
6300 The number of the input frame, starting from 0.
6303 the position in the file of the input frame, NAN if unknown
6306 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
6310 The expression for @var{out_w} may depend on the value of @var{out_h},
6311 and the expression for @var{out_h} may depend on @var{out_w}, but they
6312 cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
6313 evaluated after @var{out_w} and @var{out_h}.
6315 The @var{x} and @var{y} parameters specify the expressions for the
6316 position of the top-left corner of the output (non-cropped) area. They
6317 are evaluated for each frame. If the evaluated value is not valid, it
6318 is approximated to the nearest valid value.
6320 The expression for @var{x} may depend on @var{y}, and the expression
6321 for @var{y} may depend on @var{x}.
6323 @subsection Examples
6327 Crop area with size 100x100 at position (12,34).
6332 Using named options, the example above becomes:
6334 crop=w=100:h=100:x=12:y=34
6338 Crop the central input area with size 100x100:
6344 Crop the central input area with size 2/3 of the input video:
6346 crop=2/3*in_w:2/3*in_h
6350 Crop the input video central square:
6357 Delimit the rectangle with the top-left corner placed at position
6358 100:100 and the right-bottom corner corresponding to the right-bottom
6359 corner of the input image.
6361 crop=in_w-100:in_h-100:100:100
6365 Crop 10 pixels from the left and right borders, and 20 pixels from
6366 the top and bottom borders
6368 crop=in_w-2*10:in_h-2*20
6372 Keep only the bottom right quarter of the input image:
6374 crop=in_w/2:in_h/2:in_w/2:in_h/2
6378 Crop height for getting Greek harmony:
6380 crop=in_w:1/PHI*in_w
6384 Apply trembling effect:
6386 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)
6390 Apply erratic camera effect depending on timestamp:
6392 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)"
6396 Set x depending on the value of y:
6398 crop=in_w/2:in_h/2:y:10+10*sin(n/10)
6402 @subsection Commands
6404 This filter supports the following commands:
6410 Set width/height of the output video and the horizontal/vertical position
6412 The command accepts the same syntax of the corresponding option.
6414 If the specified expression is not valid, it is kept at its current
6420 Auto-detect the crop size.
6422 It calculates the necessary cropping parameters and prints the
6423 recommended parameters via the logging system. The detected dimensions
6424 correspond to the non-black area of the input video.
6426 It accepts the following parameters:
6431 Set higher black value threshold, which can be optionally specified
6432 from nothing (0) to everything (255 for 8-bit based formats). An intensity
6433 value greater to the set value is considered non-black. It defaults to 24.
6434 You can also specify a value between 0.0 and 1.0 which will be scaled depending
6435 on the bitdepth of the pixel format.
6438 The value which the width/height should be divisible by. It defaults to
6439 16. The offset is automatically adjusted to center the video. Use 2 to
6440 get only even dimensions (needed for 4:2:2 video). 16 is best when
6441 encoding to most video codecs.
6443 @item reset_count, reset
6444 Set the counter that determines after how many frames cropdetect will
6445 reset the previously detected largest video area and start over to
6446 detect the current optimal crop area. Default value is 0.
6448 This can be useful when channel logos distort the video area. 0
6449 indicates 'never reset', and returns the largest area encountered during
6456 Apply color adjustments using curves.
6458 This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
6459 component (red, green and blue) has its values defined by @var{N} key points
6460 tied from each other using a smooth curve. The x-axis represents the pixel
6461 values from the input frame, and the y-axis the new pixel values to be set for
6464 By default, a component curve is defined by the two points @var{(0;0)} and
6465 @var{(1;1)}. This creates a straight line where each original pixel value is
6466 "adjusted" to its own value, which means no change to the image.
6468 The filter allows you to redefine these two points and add some more. A new
6469 curve (using a natural cubic spline interpolation) will be define to pass
6470 smoothly through all these new coordinates. The new defined points needs to be
6471 strictly increasing over the x-axis, and their @var{x} and @var{y} values must
6472 be in the @var{[0;1]} interval. If the computed curves happened to go outside
6473 the vector spaces, the values will be clipped accordingly.
6475 The filter accepts the following options:
6479 Select one of the available color presets. This option can be used in addition
6480 to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
6481 options takes priority on the preset values.
6482 Available presets are:
6485 @item color_negative
6488 @item increase_contrast
6490 @item linear_contrast
6491 @item medium_contrast
6493 @item strong_contrast
6496 Default is @code{none}.
6498 Set the master key points. These points will define a second pass mapping. It
6499 is sometimes called a "luminance" or "value" mapping. It can be used with
6500 @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
6501 post-processing LUT.
6503 Set the key points for the red component.
6505 Set the key points for the green component.
6507 Set the key points for the blue component.
6509 Set the key points for all components (not including master).
6510 Can be used in addition to the other key points component
6511 options. In this case, the unset component(s) will fallback on this
6512 @option{all} setting.
6514 Specify a Photoshop curves file (@code{.acv}) to import the settings from.
6516 Save Gnuplot script of the curves in specified file.
6519 To avoid some filtergraph syntax conflicts, each key points list need to be
6520 defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
6522 @subsection Examples
6526 Increase slightly the middle level of blue:
6528 curves=blue='0/0 0.5/0.58 1/1'
6534 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'
6536 Here we obtain the following coordinates for each components:
6539 @code{(0;0.11) (0.42;0.51) (1;0.95)}
6541 @code{(0;0) (0.50;0.48) (1;1)}
6543 @code{(0;0.22) (0.49;0.44) (1;0.80)}
6547 The previous example can also be achieved with the associated built-in preset:
6549 curves=preset=vintage
6559 Use a Photoshop preset and redefine the points of the green component:
6561 curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
6565 Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
6566 and @command{gnuplot}:
6568 ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
6569 gnuplot -p /tmp/curves.plt
6575 Video data analysis filter.
6577 This filter shows hexadecimal pixel values of part of video.
6579 The filter accepts the following options:
6583 Set output video size.
6586 Set x offset from where to pick pixels.
6589 Set y offset from where to pick pixels.
6592 Set scope mode, can be one of the following:
6595 Draw hexadecimal pixel values with white color on black background.
6598 Draw hexadecimal pixel values with input video pixel color on black
6602 Draw hexadecimal pixel values on color background picked from input video,
6603 the text color is picked in such way so its always visible.
6607 Draw rows and columns numbers on left and top of video.
6610 Set background opacity.
6615 Denoise frames using 2D DCT (frequency domain filtering).
6617 This filter is not designed for real time.
6619 The filter accepts the following options:
6623 Set the noise sigma constant.
6625 This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
6626 coefficient (absolute value) below this threshold with be dropped.
6628 If you need a more advanced filtering, see @option{expr}.
6630 Default is @code{0}.
6633 Set number overlapping pixels for each block. Since the filter can be slow, you
6634 may want to reduce this value, at the cost of a less effective filter and the
6635 risk of various artefacts.
6637 If the overlapping value doesn't permit processing the whole input width or
6638 height, a warning will be displayed and according borders won't be denoised.
6640 Default value is @var{blocksize}-1, which is the best possible setting.
6643 Set the coefficient factor expression.
6645 For each coefficient of a DCT block, this expression will be evaluated as a
6646 multiplier value for the coefficient.
6648 If this is option is set, the @option{sigma} option will be ignored.
6650 The absolute value of the coefficient can be accessed through the @var{c}
6654 Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
6655 @var{blocksize}, which is the width and height of the processed blocks.
6657 The default value is @var{3} (8x8) and can be raised to @var{4} for a
6658 @var{blocksize} of 16x16. Note that changing this setting has huge consequences
6659 on the speed processing. Also, a larger block size does not necessarily means a
6663 @subsection Examples
6665 Apply a denoise with a @option{sigma} of @code{4.5}:
6670 The same operation can be achieved using the expression system:
6672 dctdnoiz=e='gte(c, 4.5*3)'
6675 Violent denoise using a block size of @code{16x16}:
6682 Remove banding artifacts from input video.
6683 It works by replacing banded pixels with average value of referenced pixels.
6685 The filter accepts the following options:
6692 Set banding detection threshold for each plane. Default is 0.02.
6693 Valid range is 0.00003 to 0.5.
6694 If difference between current pixel and reference pixel is less than threshold,
6695 it will be considered as banded.
6698 Banding detection range in pixels. Default is 16. If positive, random number
6699 in range 0 to set value will be used. If negative, exact absolute value
6701 The range defines square of four pixels around current pixel.
6704 Set direction in radians from which four pixel will be compared. If positive,
6705 random direction from 0 to set direction will be picked. If negative, exact of
6706 absolute value will be picked. For example direction 0, -PI or -2*PI radians
6707 will pick only pixels on same row and -PI/2 will pick only pixels on same
6711 If enabled, current pixel is compared with average value of all four
6712 surrounding pixels. The default is enabled. If disabled current pixel is
6713 compared with all four surrounding pixels. The pixel is considered banded
6714 if only all four differences with surrounding pixels are less than threshold.
6717 If enabled, current pixel is changed if and only if all pixel components are banded,
6718 e.g. banding detection threshold is triggered for all color components.
6719 The default is disabled.
6725 Drop duplicated frames at regular intervals.
6727 The filter accepts the following options:
6731 Set the number of frames from which one will be dropped. Setting this to
6732 @var{N} means one frame in every batch of @var{N} frames will be dropped.
6733 Default is @code{5}.
6736 Set the threshold for duplicate detection. If the difference metric for a frame
6737 is less than or equal to this value, then it is declared as duplicate. Default
6741 Set scene change threshold. Default is @code{15}.
6745 Set the size of the x and y-axis blocks used during metric calculations.
6746 Larger blocks give better noise suppression, but also give worse detection of
6747 small movements. Must be a power of two. Default is @code{32}.
6750 Mark main input as a pre-processed input and activate clean source input
6751 stream. This allows the input to be pre-processed with various filters to help
6752 the metrics calculation while keeping the frame selection lossless. When set to
6753 @code{1}, the first stream is for the pre-processed input, and the second
6754 stream is the clean source from where the kept frames are chosen. Default is
6758 Set whether or not chroma is considered in the metric calculations. Default is
6764 Apply deflate effect to the video.
6766 This filter replaces the pixel by the local(3x3) average by taking into account
6767 only values lower than the pixel.
6769 It accepts the following options:
6776 Limit the maximum change for each plane, default is 65535.
6777 If 0, plane will remain unchanged.
6782 Remove temporal frame luminance variations.
6784 It accepts the following options:
6788 Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
6791 Set averaging mode to smooth temporal luminance variations.
6793 Available values are:
6818 Do not actually modify frame. Useful when one only wants metadata.
6823 Remove judder produced by partially interlaced telecined content.
6825 Judder can be introduced, for instance, by @ref{pullup} filter. If the original
6826 source was partially telecined content then the output of @code{pullup,dejudder}
6827 will have a variable frame rate. May change the recorded frame rate of the
6828 container. Aside from that change, this filter will not affect constant frame
6831 The option available in this filter is:
6835 Specify the length of the window over which the judder repeats.
6837 Accepts any integer greater than 1. Useful values are:
6841 If the original was telecined from 24 to 30 fps (Film to NTSC).
6844 If the original was telecined from 25 to 30 fps (PAL to NTSC).
6847 If a mixture of the two.
6850 The default is @samp{4}.
6855 Suppress a TV station logo by a simple interpolation of the surrounding
6856 pixels. Just set a rectangle covering the logo and watch it disappear
6857 (and sometimes something even uglier appear - your mileage may vary).
6859 It accepts the following parameters:
6864 Specify the top left corner coordinates of the logo. They must be
6869 Specify the width and height of the logo to clear. They must be
6873 Specify the thickness of the fuzzy edge of the rectangle (added to
6874 @var{w} and @var{h}). The default value is 1. This option is
6875 deprecated, setting higher values should no longer be necessary and
6879 When set to 1, a green rectangle is drawn on the screen to simplify
6880 finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
6881 The default value is 0.
6883 The rectangle is drawn on the outermost pixels which will be (partly)
6884 replaced with interpolated values. The values of the next pixels
6885 immediately outside this rectangle in each direction will be used to
6886 compute the interpolated pixel values inside the rectangle.
6890 @subsection Examples
6894 Set a rectangle covering the area with top left corner coordinates 0,0
6895 and size 100x77, and a band of size 10:
6897 delogo=x=0:y=0:w=100:h=77:band=10
6904 Attempt to fix small changes in horizontal and/or vertical shift. This
6905 filter helps remove camera shake from hand-holding a camera, bumping a
6906 tripod, moving on a vehicle, etc.
6908 The filter accepts the following options:
6916 Specify a rectangular area where to limit the search for motion
6918 If desired the search for motion vectors can be limited to a
6919 rectangular area of the frame defined by its top left corner, width
6920 and height. These parameters have the same meaning as the drawbox
6921 filter which can be used to visualise the position of the bounding
6924 This is useful when simultaneous movement of subjects within the frame
6925 might be confused for camera motion by the motion vector search.
6927 If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
6928 then the full frame is used. This allows later options to be set
6929 without specifying the bounding box for the motion vector search.
6931 Default - search the whole frame.
6935 Specify the maximum extent of movement in x and y directions in the
6936 range 0-64 pixels. Default 16.
6939 Specify how to generate pixels to fill blanks at the edge of the
6940 frame. Available values are:
6943 Fill zeroes at blank locations
6945 Original image at blank locations
6947 Extruded edge value at blank locations
6949 Mirrored edge at blank locations
6951 Default value is @samp{mirror}.
6954 Specify the blocksize to use for motion search. Range 4-128 pixels,
6958 Specify the contrast threshold for blocks. Only blocks with more than
6959 the specified contrast (difference between darkest and lightest
6960 pixels) will be considered. Range 1-255, default 125.
6963 Specify the search strategy. Available values are:
6966 Set exhaustive search
6968 Set less exhaustive search.
6970 Default value is @samp{exhaustive}.
6973 If set then a detailed log of the motion search is written to the
6980 Remove unwanted contamination of foreground colors, caused by reflected color of
6981 greenscreen or bluescreen.
6983 This filter accepts the following options:
6987 Set what type of despill to use.
6990 Set how spillmap will be generated.
6993 Set how much to get rid of still remaining spill.
6996 Controls amount of red in spill area.
6999 Controls amount of green in spill area.
7000 Should be -1 for greenscreen.
7003 Controls amount of blue in spill area.
7004 Should be -1 for bluescreen.
7007 Controls brightness of spill area, preserving colors.
7010 Modify alpha from generated spillmap.
7015 Apply an exact inverse of the telecine operation. It requires a predefined
7016 pattern specified using the pattern option which must be the same as that passed
7017 to the telecine filter.
7019 This filter accepts the following options:
7028 The default value is @code{top}.
7032 A string of numbers representing the pulldown pattern you wish to apply.
7033 The default value is @code{23}.
7036 A number representing position of the first frame with respect to the telecine
7037 pattern. This is to be used if the stream is cut. The default value is @code{0}.
7042 Apply dilation effect to the video.
7044 This filter replaces the pixel by the local(3x3) maximum.
7046 It accepts the following options:
7053 Limit the maximum change for each plane, default is 65535.
7054 If 0, plane will remain unchanged.
7057 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
7060 Flags to local 3x3 coordinates maps like this:
7069 Displace pixels as indicated by second and third input stream.
7071 It takes three input streams and outputs one stream, the first input is the
7072 source, and second and third input are displacement maps.
7074 The second input specifies how much to displace pixels along the
7075 x-axis, while the third input specifies how much to displace pixels
7077 If one of displacement map streams terminates, last frame from that
7078 displacement map will be used.
7080 Note that once generated, displacements maps can be reused over and over again.
7082 A description of the accepted options follows.
7086 Set displace behavior for pixels that are out of range.
7088 Available values are:
7091 Missing pixels are replaced by black pixels.
7094 Adjacent pixels will spread out to replace missing pixels.
7097 Out of range pixels are wrapped so they point to pixels of other side.
7100 Out of range pixels will be replaced with mirrored pixels.
7102 Default is @samp{smear}.
7106 @subsection Examples
7110 Add ripple effect to rgb input of video size hd720:
7112 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
7116 Add wave effect to rgb input of video size hd720:
7118 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
7124 Draw a colored box on the input image.
7126 It accepts the following parameters:
7131 The expressions which specify the top left corner coordinates of the box. It defaults to 0.
7135 The expressions which specify the width and height of the box; if 0 they are interpreted as
7136 the input width and height. It defaults to 0.
7139 Specify the color of the box to write. For the general syntax of this option,
7140 check the "Color" section in the ffmpeg-utils manual. If the special
7141 value @code{invert} is used, the box edge color is the same as the
7142 video with inverted luma.
7145 The expression which sets the thickness of the box edge.
7146 A value of @code{fill} will create a filled box. Default value is @code{3}.
7148 See below for the list of accepted constants.
7151 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
7152 following constants:
7156 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
7160 horizontal and vertical chroma subsample values. For example for the
7161 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
7165 The input width and height.
7168 The input sample aspect ratio.
7172 The x and y offset coordinates where the box is drawn.
7176 The width and height of the drawn box.
7179 The thickness of the drawn box.
7181 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
7182 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
7186 @subsection Examples
7190 Draw a black box around the edge of the input image:
7196 Draw a box with color red and an opacity of 50%:
7198 drawbox=10:20:200:60:red@@0.5
7201 The previous example can be specified as:
7203 drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
7207 Fill the box with pink color:
7209 drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
7213 Draw a 2-pixel red 2.40:1 mask:
7215 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
7221 Draw a grid on the input image.
7223 It accepts the following parameters:
7228 The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
7232 The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
7233 input width and height, respectively, minus @code{thickness}, so image gets
7234 framed. Default to 0.
7237 Specify the color of the grid. For the general syntax of this option,
7238 check the "Color" section in the ffmpeg-utils manual. If the special
7239 value @code{invert} is used, the grid color is the same as the
7240 video with inverted luma.
7243 The expression which sets the thickness of the grid line. Default value is @code{1}.
7245 See below for the list of accepted constants.
7248 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
7249 following constants:
7253 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
7257 horizontal and vertical chroma subsample values. For example for the
7258 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
7262 The input grid cell width and height.
7265 The input sample aspect ratio.
7269 The x and y coordinates of some point of grid intersection (meant to configure offset).
7273 The width and height of the drawn cell.
7276 The thickness of the drawn cell.
7278 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
7279 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
7283 @subsection Examples
7287 Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
7289 drawgrid=width=100:height=100:thickness=2:color=red@@0.5
7293 Draw a white 3x3 grid with an opacity of 50%:
7295 drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
7302 Draw a text string or text from a specified file on top of a video, using the
7303 libfreetype library.
7305 To enable compilation of this filter, you need to configure FFmpeg with
7306 @code{--enable-libfreetype}.
7307 To enable default font fallback and the @var{font} option you need to
7308 configure FFmpeg with @code{--enable-libfontconfig}.
7309 To enable the @var{text_shaping} option, you need to configure FFmpeg with
7310 @code{--enable-libfribidi}.
7314 It accepts the following parameters:
7319 Used to draw a box around text using the background color.
7320 The value must be either 1 (enable) or 0 (disable).
7321 The default value of @var{box} is 0.
7324 Set the width of the border to be drawn around the box using @var{boxcolor}.
7325 The default value of @var{boxborderw} is 0.
7328 The color to be used for drawing box around text. For the syntax of this
7329 option, check the "Color" section in the ffmpeg-utils manual.
7331 The default value of @var{boxcolor} is "white".
7334 Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
7335 The default value of @var{line_spacing} is 0.
7338 Set the width of the border to be drawn around the text using @var{bordercolor}.
7339 The default value of @var{borderw} is 0.
7342 Set the color to be used for drawing border around text. For the syntax of this
7343 option, check the "Color" section in the ffmpeg-utils manual.
7345 The default value of @var{bordercolor} is "black".
7348 Select how the @var{text} is expanded. Can be either @code{none},
7349 @code{strftime} (deprecated) or
7350 @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
7354 Set a start time for the count. Value is in microseconds. Only applied
7355 in the deprecated strftime expansion mode. To emulate in normal expansion
7356 mode use the @code{pts} function, supplying the start time (in seconds)
7357 as the second argument.
7360 If true, check and fix text coords to avoid clipping.
7363 The color to be used for drawing fonts. For the syntax of this option, check
7364 the "Color" section in the ffmpeg-utils manual.
7366 The default value of @var{fontcolor} is "black".
7368 @item fontcolor_expr
7369 String which is expanded the same way as @var{text} to obtain dynamic
7370 @var{fontcolor} value. By default this option has empty value and is not
7371 processed. When this option is set, it overrides @var{fontcolor} option.
7374 The font family to be used for drawing text. By default Sans.
7377 The font file to be used for drawing text. The path must be included.
7378 This parameter is mandatory if the fontconfig support is disabled.
7381 Draw the text applying alpha blending. The value can
7382 be a number between 0.0 and 1.0.
7383 The expression accepts the same variables @var{x, y} as well.
7384 The default value is 1.
7385 Please see @var{fontcolor_expr}.
7388 The font size to be used for drawing text.
7389 The default value of @var{fontsize} is 16.
7392 If set to 1, attempt to shape the text (for example, reverse the order of
7393 right-to-left text and join Arabic characters) before drawing it.
7394 Otherwise, just draw the text exactly as given.
7395 By default 1 (if supported).
7398 The flags to be used for loading the fonts.
7400 The flags map the corresponding flags supported by libfreetype, and are
7401 a combination of the following values:
7408 @item vertical_layout
7409 @item force_autohint
7412 @item ignore_global_advance_width
7414 @item ignore_transform
7420 Default value is "default".
7422 For more information consult the documentation for the FT_LOAD_*
7426 The color to be used for drawing a shadow behind the drawn text. For the
7427 syntax of this option, check the "Color" section in the ffmpeg-utils manual.
7429 The default value of @var{shadowcolor} is "black".
7433 The x and y offsets for the text shadow position with respect to the
7434 position of the text. They can be either positive or negative
7435 values. The default value for both is "0".
7438 The starting frame number for the n/frame_num variable. The default value
7442 The size in number of spaces to use for rendering the tab.
7446 Set the initial timecode representation in "hh:mm:ss[:;.]ff"
7447 format. It can be used with or without text parameter. @var{timecode_rate}
7448 option must be specified.
7450 @item timecode_rate, rate, r
7451 Set the timecode frame rate (timecode only). Value will be rounded to nearest
7452 integer. Minimum value is "1".
7453 Drop-frame timecode is supported for frame rates 30 & 60.
7456 If set to 1, the output of the timecode option will wrap around at 24 hours.
7457 Default is 0 (disabled).
7460 The text string to be drawn. The text must be a sequence of UTF-8
7462 This parameter is mandatory if no file is specified with the parameter
7466 A text file containing text to be drawn. The text must be a sequence
7467 of UTF-8 encoded characters.
7469 This parameter is mandatory if no text string is specified with the
7470 parameter @var{text}.
7472 If both @var{text} and @var{textfile} are specified, an error is thrown.
7475 If set to 1, the @var{textfile} will be reloaded before each frame.
7476 Be sure to update it atomically, or it may be read partially, or even fail.
7480 The expressions which specify the offsets where text will be drawn
7481 within the video frame. They are relative to the top/left border of the
7484 The default value of @var{x} and @var{y} is "0".
7486 See below for the list of accepted constants and functions.
7489 The parameters for @var{x} and @var{y} are expressions containing the
7490 following constants and functions:
7494 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
7498 horizontal and vertical chroma subsample values. For example for the
7499 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
7502 the height of each text line
7510 @item max_glyph_a, ascent
7511 the maximum distance from the baseline to the highest/upper grid
7512 coordinate used to place a glyph outline point, for all the rendered
7514 It is a positive value, due to the grid's orientation with the Y axis
7517 @item max_glyph_d, descent
7518 the maximum distance from the baseline to the lowest grid coordinate
7519 used to place a glyph outline point, for all the rendered glyphs.
7520 This is a negative value, due to the grid's orientation, with the Y axis
7524 maximum glyph height, that is the maximum height for all the glyphs
7525 contained in the rendered text, it is equivalent to @var{ascent} -
7529 maximum glyph width, that is the maximum width for all the glyphs
7530 contained in the rendered text
7533 the number of input frame, starting from 0
7535 @item rand(min, max)
7536 return a random number included between @var{min} and @var{max}
7539 The input sample aspect ratio.
7542 timestamp expressed in seconds, NAN if the input timestamp is unknown
7545 the height of the rendered text
7548 the width of the rendered text
7552 the x and y offset coordinates where the text is drawn.
7554 These parameters allow the @var{x} and @var{y} expressions to refer
7555 each other, so you can for example specify @code{y=x/dar}.
7558 @anchor{drawtext_expansion}
7559 @subsection Text expansion
7561 If @option{expansion} is set to @code{strftime},
7562 the filter recognizes strftime() sequences in the provided text and
7563 expands them accordingly. Check the documentation of strftime(). This
7564 feature is deprecated.
7566 If @option{expansion} is set to @code{none}, the text is printed verbatim.
7568 If @option{expansion} is set to @code{normal} (which is the default),
7569 the following expansion mechanism is used.
7571 The backslash character @samp{\}, followed by any character, always expands to
7572 the second character.
7574 Sequences of the form @code{%@{...@}} are expanded. The text between the
7575 braces is a function name, possibly followed by arguments separated by ':'.
7576 If the arguments contain special characters or delimiters (':' or '@}'),
7577 they should be escaped.
7579 Note that they probably must also be escaped as the value for the
7580 @option{text} option in the filter argument string and as the filter
7581 argument in the filtergraph description, and possibly also for the shell,
7582 that makes up to four levels of escaping; using a text file avoids these
7585 The following functions are available:
7590 The expression evaluation result.
7592 It must take one argument specifying the expression to be evaluated,
7593 which accepts the same constants and functions as the @var{x} and
7594 @var{y} values. Note that not all constants should be used, for
7595 example the text size is not known when evaluating the expression, so
7596 the constants @var{text_w} and @var{text_h} will have an undefined
7599 @item expr_int_format, eif
7600 Evaluate the expression's value and output as formatted integer.
7602 The first argument is the expression to be evaluated, just as for the @var{expr} function.
7603 The second argument specifies the output format. Allowed values are @samp{x},
7604 @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
7605 @code{printf} function.
7606 The third parameter is optional and sets the number of positions taken by the output.
7607 It can be used to add padding with zeros from the left.
7610 The time at which the filter is running, expressed in UTC.
7611 It can accept an argument: a strftime() format string.
7614 The time at which the filter is running, expressed in the local time zone.
7615 It can accept an argument: a strftime() format string.
7618 Frame metadata. Takes one or two arguments.
7620 The first argument is mandatory and specifies the metadata key.
7622 The second argument is optional and specifies a default value, used when the
7623 metadata key is not found or empty.
7626 The frame number, starting from 0.
7629 A 1 character description of the current picture type.
7632 The timestamp of the current frame.
7633 It can take up to three arguments.
7635 The first argument is the format of the timestamp; it defaults to @code{flt}
7636 for seconds as a decimal number with microsecond accuracy; @code{hms} stands
7637 for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
7638 @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
7639 @code{localtime} stands for the timestamp of the frame formatted as
7640 local time zone time.
7642 The second argument is an offset added to the timestamp.
7644 If the format is set to @code{localtime} or @code{gmtime},
7645 a third argument may be supplied: a strftime() format string.
7646 By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
7649 @subsection Examples
7653 Draw "Test Text" with font FreeSerif, using the default values for the
7654 optional parameters.
7657 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
7661 Draw 'Test Text' with font FreeSerif of size 24 at position x=100
7662 and y=50 (counting from the top-left corner of the screen), text is
7663 yellow with a red box around it. Both the text and the box have an
7667 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
7668 x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
7671 Note that the double quotes are not necessary if spaces are not used
7672 within the parameter list.
7675 Show the text at the center of the video frame:
7677 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
7681 Show the text at a random position, switching to a new position every 30 seconds:
7683 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)"
7687 Show a text line sliding from right to left in the last row of the video
7688 frame. The file @file{LONG_LINE} is assumed to contain a single line
7691 drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
7695 Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
7697 drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
7701 Draw a single green letter "g", at the center of the input video.
7702 The glyph baseline is placed at half screen height.
7704 drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
7708 Show text for 1 second every 3 seconds:
7710 drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
7714 Use fontconfig to set the font. Note that the colons need to be escaped.
7716 drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
7720 Print the date of a real-time encoding (see strftime(3)):
7722 drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
7726 Show text fading in and out (appearing/disappearing):
7729 DS=1.0 # display start
7730 DE=10.0 # display end
7731 FID=1.5 # fade in duration
7732 FOD=5 # fade out duration
7733 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 @}"
7737 Horizontally align multiple separate texts. Note that @option{max_glyph_a}
7738 and the @option{fontsize} value are included in the @option{y} offset.
7740 drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
7741 drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
7746 For more information about libfreetype, check:
7747 @url{http://www.freetype.org/}.
7749 For more information about fontconfig, check:
7750 @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
7752 For more information about libfribidi, check:
7753 @url{http://fribidi.org/}.
7757 Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
7759 The filter accepts the following options:
7764 Set low and high threshold values used by the Canny thresholding
7767 The high threshold selects the "strong" edge pixels, which are then
7768 connected through 8-connectivity with the "weak" edge pixels selected
7769 by the low threshold.
7771 @var{low} and @var{high} threshold values must be chosen in the range
7772 [0,1], and @var{low} should be lesser or equal to @var{high}.
7774 Default value for @var{low} is @code{20/255}, and default value for @var{high}
7778 Define the drawing mode.
7782 Draw white/gray wires on black background.
7785 Mix the colors to create a paint/cartoon effect.
7788 Default value is @var{wires}.
7791 @subsection Examples
7795 Standard edge detection with custom values for the hysteresis thresholding:
7797 edgedetect=low=0.1:high=0.4
7801 Painting effect without thresholding:
7803 edgedetect=mode=colormix:high=0
7808 Set brightness, contrast, saturation and approximate gamma adjustment.
7810 The filter accepts the following options:
7814 Set the contrast expression. The value must be a float value in range
7815 @code{-2.0} to @code{2.0}. The default value is "1".
7818 Set the brightness expression. The value must be a float value in
7819 range @code{-1.0} to @code{1.0}. The default value is "0".
7822 Set the saturation expression. The value must be a float in
7823 range @code{0.0} to @code{3.0}. The default value is "1".
7826 Set the gamma expression. The value must be a float in range
7827 @code{0.1} to @code{10.0}. The default value is "1".
7830 Set the gamma expression for red. The value must be a float in
7831 range @code{0.1} to @code{10.0}. The default value is "1".
7834 Set the gamma expression for green. The value must be a float in range
7835 @code{0.1} to @code{10.0}. The default value is "1".
7838 Set the gamma expression for blue. The value must be a float in range
7839 @code{0.1} to @code{10.0}. The default value is "1".
7842 Set the gamma weight expression. It can be used to reduce the effect
7843 of a high gamma value on bright image areas, e.g. keep them from
7844 getting overamplified and just plain white. The value must be a float
7845 in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
7846 gamma correction all the way down while @code{1.0} leaves it at its
7847 full strength. Default is "1".
7850 Set when the expressions for brightness, contrast, saturation and
7851 gamma expressions are evaluated.
7853 It accepts the following values:
7856 only evaluate expressions once during the filter initialization or
7857 when a command is processed
7860 evaluate expressions for each incoming frame
7863 Default value is @samp{init}.
7866 The expressions accept the following parameters:
7869 frame count of the input frame starting from 0
7872 byte position of the corresponding packet in the input file, NAN if
7876 frame rate of the input video, NAN if the input frame rate is unknown
7879 timestamp expressed in seconds, NAN if the input timestamp is unknown
7882 @subsection Commands
7883 The filter supports the following commands:
7887 Set the contrast expression.
7890 Set the brightness expression.
7893 Set the saturation expression.
7896 Set the gamma expression.
7899 Set the gamma_r expression.
7902 Set gamma_g expression.
7905 Set gamma_b expression.
7908 Set gamma_weight expression.
7910 The command accepts the same syntax of the corresponding option.
7912 If the specified expression is not valid, it is kept at its current
7919 Apply erosion effect to the video.
7921 This filter replaces the pixel by the local(3x3) minimum.
7923 It accepts the following options:
7930 Limit the maximum change for each plane, default is 65535.
7931 If 0, plane will remain unchanged.
7934 Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
7937 Flags to local 3x3 coordinates maps like this:
7944 @section extractplanes
7946 Extract color channel components from input video stream into
7947 separate grayscale video streams.
7949 The filter accepts the following option:
7953 Set plane(s) to extract.
7955 Available values for planes are:
7966 Choosing planes not available in the input will result in an error.
7967 That means you cannot select @code{r}, @code{g}, @code{b} planes
7968 with @code{y}, @code{u}, @code{v} planes at same time.
7971 @subsection Examples
7975 Extract luma, u and v color channel component from input video frame
7976 into 3 grayscale outputs:
7978 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
7984 Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
7986 For each input image, the filter will compute the optimal mapping from
7987 the input to the output given the codebook length, that is the number
7988 of distinct output colors.
7990 This filter accepts the following options.
7993 @item codebook_length, l
7994 Set codebook length. The value must be a positive integer, and
7995 represents the number of distinct output colors. Default value is 256.
7998 Set the maximum number of iterations to apply for computing the optimal
7999 mapping. The higher the value the better the result and the higher the
8000 computation time. Default value is 1.
8003 Set a random seed, must be an integer included between 0 and
8004 UINT32_MAX. If not specified, or if explicitly set to -1, the filter
8005 will try to use a good random seed on a best effort basis.
8008 Set pal8 output pixel format. This option does not work with codebook
8009 length greater than 256.
8014 Apply a fade-in/out effect to the input video.
8016 It accepts the following parameters:
8020 The effect type can be either "in" for a fade-in, or "out" for a fade-out
8022 Default is @code{in}.
8024 @item start_frame, s
8025 Specify the number of the frame to start applying the fade
8026 effect at. Default is 0.
8029 The number of frames that the fade effect lasts. At the end of the
8030 fade-in effect, the output video will have the same intensity as the input video.
8031 At the end of the fade-out transition, the output video will be filled with the
8032 selected @option{color}.
8036 If set to 1, fade only alpha channel, if one exists on the input.
8039 @item start_time, st
8040 Specify the timestamp (in seconds) of the frame to start to apply the fade
8041 effect. If both start_frame and start_time are specified, the fade will start at
8042 whichever comes last. Default is 0.
8045 The number of seconds for which the fade effect has to last. At the end of the
8046 fade-in effect the output video will have the same intensity as the input video,
8047 at the end of the fade-out transition the output video will be filled with the
8048 selected @option{color}.
8049 If both duration and nb_frames are specified, duration is used. Default is 0
8050 (nb_frames is used by default).
8053 Specify the color of the fade. Default is "black".
8056 @subsection Examples
8060 Fade in the first 30 frames of video:
8065 The command above is equivalent to:
8071 Fade out the last 45 frames of a 200-frame video:
8074 fade=type=out:start_frame=155:nb_frames=45
8078 Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
8080 fade=in:0:25, fade=out:975:25
8084 Make the first 5 frames yellow, then fade in from frame 5-24:
8086 fade=in:5:20:color=yellow
8090 Fade in alpha over first 25 frames of video:
8092 fade=in:0:25:alpha=1
8096 Make the first 5.5 seconds black, then fade in for 0.5 seconds:
8098 fade=t=in:st=5.5:d=0.5
8104 Apply arbitrary expressions to samples in frequency domain
8108 Adjust the dc value (gain) of the luma plane of the image. The filter
8109 accepts an integer value in range @code{0} to @code{1000}. The default
8110 value is set to @code{0}.
8113 Adjust the dc value (gain) of the 1st chroma plane of the image. The
8114 filter accepts an integer value in range @code{0} to @code{1000}. The
8115 default value is set to @code{0}.
8118 Adjust the dc value (gain) of the 2nd chroma plane of the image. The
8119 filter accepts an integer value in range @code{0} to @code{1000}. The
8120 default value is set to @code{0}.
8123 Set the frequency domain weight expression for the luma plane.
8126 Set the frequency domain weight expression for the 1st chroma plane.
8129 Set the frequency domain weight expression for the 2nd chroma plane.
8132 Set when the expressions are evaluated.
8134 It accepts the following values:
8137 Only evaluate expressions once during the filter initialization.
8140 Evaluate expressions for each incoming frame.
8143 Default value is @samp{init}.
8145 The filter accepts the following variables:
8148 The coordinates of the current sample.
8152 The width and height of the image.
8155 The number of input frame, starting from 0.
8158 @subsection Examples
8164 fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
8170 fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
8176 fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
8182 fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
8189 Extract a single field from an interlaced image using stride
8190 arithmetic to avoid wasting CPU time. The output frames are marked as
8193 The filter accepts the following options:
8197 Specify whether to extract the top (if the value is @code{0} or
8198 @code{top}) or the bottom field (if the value is @code{1} or
8204 Create new frames by copying the top and bottom fields from surrounding frames
8205 supplied as numbers by the hint file.
8209 Set file containing hints: absolute/relative frame numbers.
8211 There must be one line for each frame in a clip. Each line must contain two
8212 numbers separated by the comma, optionally followed by @code{-} or @code{+}.
8213 Numbers supplied on each line of file can not be out of [N-1,N+1] where N
8214 is current frame number for @code{absolute} mode or out of [-1, 1] range
8215 for @code{relative} mode. First number tells from which frame to pick up top
8216 field and second number tells from which frame to pick up bottom field.
8218 If optionally followed by @code{+} output frame will be marked as interlaced,
8219 else if followed by @code{-} output frame will be marked as progressive, else
8220 it will be marked same as input frame.
8221 If line starts with @code{#} or @code{;} that line is skipped.
8224 Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
8227 Example of first several lines of @code{hint} file for @code{relative} mode:
8230 1,0 - # second frame, use third's frame top field and second's frame bottom field
8231 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
8248 Field matching filter for inverse telecine. It is meant to reconstruct the
8249 progressive frames from a telecined stream. The filter does not drop duplicated
8250 frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
8251 followed by a decimation filter such as @ref{decimate} in the filtergraph.
8253 The separation of the field matching and the decimation is notably motivated by
8254 the possibility of inserting a de-interlacing filter fallback between the two.
8255 If the source has mixed telecined and real interlaced content,
8256 @code{fieldmatch} will not be able to match fields for the interlaced parts.
8257 But these remaining combed frames will be marked as interlaced, and thus can be
8258 de-interlaced by a later filter such as @ref{yadif} before decimation.
8260 In addition to the various configuration options, @code{fieldmatch} can take an
8261 optional second stream, activated through the @option{ppsrc} option. If
8262 enabled, the frames reconstruction will be based on the fields and frames from
8263 this second stream. This allows the first input to be pre-processed in order to
8264 help the various algorithms of the filter, while keeping the output lossless
8265 (assuming the fields are matched properly). Typically, a field-aware denoiser,
8266 or brightness/contrast adjustments can help.
8268 Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
8269 and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
8270 which @code{fieldmatch} is based on. While the semantic and usage are very
8271 close, some behaviour and options names can differ.
8273 The @ref{decimate} filter currently only works for constant frame rate input.
8274 If your input has mixed telecined (30fps) and progressive content with a lower
8275 framerate like 24fps use the following filterchain to produce the necessary cfr
8276 stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
8278 The filter accepts the following options:
8282 Specify the assumed field order of the input stream. Available values are:
8286 Auto detect parity (use FFmpeg's internal parity value).
8288 Assume bottom field first.
8290 Assume top field first.
8293 Note that it is sometimes recommended not to trust the parity announced by the
8296 Default value is @var{auto}.
8299 Set the matching mode or strategy to use. @option{pc} mode is the safest in the
8300 sense that it won't risk creating jerkiness due to duplicate frames when
8301 possible, but if there are bad edits or blended fields it will end up
8302 outputting combed frames when a good match might actually exist. On the other
8303 hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
8304 but will almost always find a good frame if there is one. The other values are
8305 all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
8306 jerkiness and creating duplicate frames versus finding good matches in sections
8307 with bad edits, orphaned fields, blended fields, etc.
8309 More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
8311 Available values are:
8315 2-way matching (p/c)
8317 2-way matching, and trying 3rd match if still combed (p/c + n)
8319 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
8321 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
8322 still combed (p/c + n + u/b)
8324 3-way matching (p/c/n)
8326 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
8327 detected as combed (p/c/n + u/b)
8330 The parenthesis at the end indicate the matches that would be used for that
8331 mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
8334 In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
8337 Default value is @var{pc_n}.
8340 Mark the main input stream as a pre-processed input, and enable the secondary
8341 input stream as the clean source to pick the fields from. See the filter
8342 introduction for more details. It is similar to the @option{clip2} feature from
8345 Default value is @code{0} (disabled).
8348 Set the field to match from. It is recommended to set this to the same value as
8349 @option{order} unless you experience matching failures with that setting. In
8350 certain circumstances changing the field that is used to match from can have a
8351 large impact on matching performance. Available values are:
8355 Automatic (same value as @option{order}).
8357 Match from the bottom field.
8359 Match from the top field.
8362 Default value is @var{auto}.
8365 Set whether or not chroma is included during the match comparisons. In most
8366 cases it is recommended to leave this enabled. You should set this to @code{0}
8367 only if your clip has bad chroma problems such as heavy rainbowing or other
8368 artifacts. Setting this to @code{0} could also be used to speed things up at
8369 the cost of some accuracy.
8371 Default value is @code{1}.
8375 These define an exclusion band which excludes the lines between @option{y0} and
8376 @option{y1} from being included in the field matching decision. An exclusion
8377 band can be used to ignore subtitles, a logo, or other things that may
8378 interfere with the matching. @option{y0} sets the starting scan line and
8379 @option{y1} sets the ending line; all lines in between @option{y0} and
8380 @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
8381 @option{y0} and @option{y1} to the same value will disable the feature.
8382 @option{y0} and @option{y1} defaults to @code{0}.
8385 Set the scene change detection threshold as a percentage of maximum change on
8386 the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
8387 detection is only relevant in case @option{combmatch}=@var{sc}. The range for
8388 @option{scthresh} is @code{[0.0, 100.0]}.
8390 Default value is @code{12.0}.
8393 When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
8394 account the combed scores of matches when deciding what match to use as the
8395 final match. Available values are:
8399 No final matching based on combed scores.
8401 Combed scores are only used when a scene change is detected.
8403 Use combed scores all the time.
8406 Default is @var{sc}.
8409 Force @code{fieldmatch} to calculate the combed metrics for certain matches and
8410 print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
8411 Available values are:
8415 No forced calculation.
8417 Force p/c/n calculations.
8419 Force p/c/n/u/b calculations.
8422 Default value is @var{none}.
8425 This is the area combing threshold used for combed frame detection. This
8426 essentially controls how "strong" or "visible" combing must be to be detected.
8427 Larger values mean combing must be more visible and smaller values mean combing
8428 can be less visible or strong and still be detected. Valid settings are from
8429 @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
8430 be detected as combed). This is basically a pixel difference value. A good
8431 range is @code{[8, 12]}.
8433 Default value is @code{9}.
8436 Sets whether or not chroma is considered in the combed frame decision. Only
8437 disable this if your source has chroma problems (rainbowing, etc.) that are
8438 causing problems for the combed frame detection with chroma enabled. Actually,
8439 using @option{chroma}=@var{0} is usually more reliable, except for the case
8440 where there is chroma only combing in the source.
8442 Default value is @code{0}.
8446 Respectively set the x-axis and y-axis size of the window used during combed
8447 frame detection. This has to do with the size of the area in which
8448 @option{combpel} pixels are required to be detected as combed for a frame to be
8449 declared combed. See the @option{combpel} parameter description for more info.
8450 Possible values are any number that is a power of 2 starting at 4 and going up
8453 Default value is @code{16}.
8456 The number of combed pixels inside any of the @option{blocky} by
8457 @option{blockx} size blocks on the frame for the frame to be detected as
8458 combed. While @option{cthresh} controls how "visible" the combing must be, this
8459 setting controls "how much" combing there must be in any localized area (a
8460 window defined by the @option{blockx} and @option{blocky} settings) on the
8461 frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
8462 which point no frames will ever be detected as combed). This setting is known
8463 as @option{MI} in TFM/VFM vocabulary.
8465 Default value is @code{80}.
8468 @anchor{p/c/n/u/b meaning}
8469 @subsection p/c/n/u/b meaning
8471 @subsubsection p/c/n
8473 We assume the following telecined stream:
8476 Top fields: 1 2 2 3 4
8477 Bottom fields: 1 2 3 4 4
8480 The numbers correspond to the progressive frame the fields relate to. Here, the
8481 first two frames are progressive, the 3rd and 4th are combed, and so on.
8483 When @code{fieldmatch} is configured to run a matching from bottom
8484 (@option{field}=@var{bottom}) this is how this input stream get transformed:
8489 B 1 2 3 4 4 <-- matching reference
8498 As a result of the field matching, we can see that some frames get duplicated.
8499 To perform a complete inverse telecine, you need to rely on a decimation filter
8500 after this operation. See for instance the @ref{decimate} filter.
8502 The same operation now matching from top fields (@option{field}=@var{top})
8507 T 1 2 2 3 4 <-- matching reference
8517 In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
8518 basically, they refer to the frame and field of the opposite parity:
8521 @item @var{p} matches the field of the opposite parity in the previous frame
8522 @item @var{c} matches the field of the opposite parity in the current frame
8523 @item @var{n} matches the field of the opposite parity in the next frame
8528 The @var{u} and @var{b} matching are a bit special in the sense that they match
8529 from the opposite parity flag. In the following examples, we assume that we are
8530 currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
8531 'x' is placed above and below each matched fields.
8533 With bottom matching (@option{field}=@var{bottom}):
8538 Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
8539 Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
8547 With top matching (@option{field}=@var{top}):
8552 Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
8553 Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
8561 @subsection Examples
8563 Simple IVTC of a top field first telecined stream:
8565 fieldmatch=order=tff:combmatch=none, decimate
8568 Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
8570 fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
8575 Transform the field order of the input video.
8577 It accepts the following parameters:
8582 The output field order. Valid values are @var{tff} for top field first or @var{bff}
8583 for bottom field first.
8586 The default value is @samp{tff}.
8588 The transformation is done by shifting the picture content up or down
8589 by one line, and filling the remaining line with appropriate picture content.
8590 This method is consistent with most broadcast field order converters.
8592 If the input video is not flagged as being interlaced, or it is already
8593 flagged as being of the required output field order, then this filter does
8594 not alter the incoming video.
8596 It is very useful when converting to or from PAL DV material,
8597 which is bottom field first.
8601 ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
8604 @section fifo, afifo
8606 Buffer input images and send them when they are requested.
8608 It is mainly useful when auto-inserted by the libavfilter
8611 It does not take parameters.
8613 @section fillborders
8615 Fill borders of the input video, without changing video stream dimensions.
8616 Sometimes video can have garbage at the four edges and you may not want to
8617 crop video input to keep size multiple of some number.
8619 This filter accepts the following options:
8623 Number of pixels to fill from left border.
8626 Number of pixels to fill from right border.
8629 Number of pixels to fill from top border.
8632 Number of pixels to fill from bottom border.
8637 It accepts the following values:
8640 fill pixels using outermost pixels
8643 fill pixels using mirroring
8646 fill pixels with constant value
8649 Default is @var{smear}.
8652 Set color for pixels in fixed mode. Default is @var{black}.
8657 Find a rectangular object
8659 It accepts the following options:
8663 Filepath of the object image, needs to be in gray8.
8666 Detection threshold, default is 0.5.
8669 Number of mipmaps, default is 3.
8671 @item xmin, ymin, xmax, ymax
8672 Specifies the rectangle in which to search.
8675 @subsection Examples
8679 Generate a representative palette of a given video using @command{ffmpeg}:
8681 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
8687 Cover a rectangular object
8689 It accepts the following options:
8693 Filepath of the optional cover image, needs to be in yuv420.
8698 It accepts the following values:
8701 cover it by the supplied image
8703 cover it by interpolating the surrounding pixels
8706 Default value is @var{blur}.
8709 @subsection Examples
8713 Generate a representative palette of a given video using @command{ffmpeg}:
8715 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
8721 Flood area with values of same pixel components with another values.
8723 It accepts the following options:
8726 Set pixel x coordinate.
8729 Set pixel y coordinate.
8732 Set source #0 component value.
8735 Set source #1 component value.
8738 Set source #2 component value.
8741 Set source #3 component value.
8744 Set destination #0 component value.
8747 Set destination #1 component value.
8750 Set destination #2 component value.
8753 Set destination #3 component value.
8759 Convert the input video to one of the specified pixel formats.
8760 Libavfilter will try to pick one that is suitable as input to
8763 It accepts the following parameters:
8767 A '|'-separated list of pixel format names, such as
8768 "pix_fmts=yuv420p|monow|rgb24".
8772 @subsection Examples
8776 Convert the input video to the @var{yuv420p} format
8778 format=pix_fmts=yuv420p
8781 Convert the input video to any of the formats in the list
8783 format=pix_fmts=yuv420p|yuv444p|yuv410p
8790 Convert the video to specified constant frame rate by duplicating or dropping
8791 frames as necessary.
8793 It accepts the following parameters:
8797 The desired output frame rate. The default is @code{25}.
8800 Assume the first PTS should be the given value, in seconds. This allows for
8801 padding/trimming at the start of stream. By default, no assumption is made
8802 about the first frame's expected PTS, so no padding or trimming is done.
8803 For example, this could be set to 0 to pad the beginning with duplicates of
8804 the first frame if a video stream starts after the audio stream or to trim any
8805 frames with a negative PTS.
8808 Timestamp (PTS) rounding method.
8810 Possible values are:
8817 round towards -infinity
8819 round towards +infinity
8823 The default is @code{near}.
8826 Action performed when reading the last frame.
8828 Possible values are:
8831 Use same timestamp rounding method as used for other frames.
8833 Pass through last frame if input duration has not been reached yet.
8835 The default is @code{round}.
8839 Alternatively, the options can be specified as a flat string:
8840 @var{fps}[:@var{start_time}[:@var{round}]].
8842 See also the @ref{setpts} filter.
8844 @subsection Examples
8848 A typical usage in order to set the fps to 25:
8854 Sets the fps to 24, using abbreviation and rounding method to round to nearest:
8856 fps=fps=film:round=near
8862 Pack two different video streams into a stereoscopic video, setting proper
8863 metadata on supported codecs. The two views should have the same size and
8864 framerate and processing will stop when the shorter video ends. Please note
8865 that you may conveniently adjust view properties with the @ref{scale} and
8868 It accepts the following parameters:
8872 The desired packing format. Supported values are:
8877 The views are next to each other (default).
8880 The views are on top of each other.
8883 The views are packed by line.
8886 The views are packed by column.
8889 The views are temporally interleaved.
8898 # Convert left and right views into a frame-sequential video
8899 ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
8901 # Convert views into a side-by-side video with the same output resolution as the input
8902 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
8907 Change the frame rate by interpolating new video output frames from the source
8910 This filter is not designed to function correctly with interlaced media. If
8911 you wish to change the frame rate of interlaced media then you are required
8912 to deinterlace before this filter and re-interlace after this filter.
8914 A description of the accepted options follows.
8918 Specify the output frames per second. This option can also be specified
8919 as a value alone. The default is @code{50}.
8922 Specify the start of a range where the output frame will be created as a
8923 linear interpolation of two frames. The range is [@code{0}-@code{255}],
8924 the default is @code{15}.
8927 Specify the end of a range where the output frame will be created as a
8928 linear interpolation of two frames. The range is [@code{0}-@code{255}],
8929 the default is @code{240}.
8932 Specify the level at which a scene change is detected as a value between
8933 0 and 100 to indicate a new scene; a low value reflects a low
8934 probability for the current frame to introduce a new scene, while a higher
8935 value means the current frame is more likely to be one.
8936 The default is @code{7}.
8939 Specify flags influencing the filter process.
8941 Available value for @var{flags} is:
8944 @item scene_change_detect, scd
8945 Enable scene change detection using the value of the option @var{scene}.
8946 This flag is enabled by default.
8952 Select one frame every N-th frame.
8954 This filter accepts the following option:
8957 Select frame after every @code{step} frames.
8958 Allowed values are positive integers higher than 0. Default value is @code{1}.
8964 Apply a frei0r effect to the input video.
8966 To enable the compilation of this filter, you need to install the frei0r
8967 header and configure FFmpeg with @code{--enable-frei0r}.
8969 It accepts the following parameters:
8974 The name of the frei0r effect to load. If the environment variable
8975 @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
8976 directories specified by the colon-separated list in @env{FREI0R_PATH}.
8977 Otherwise, the standard frei0r paths are searched, in this order:
8978 @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
8979 @file{/usr/lib/frei0r-1/}.
8982 A '|'-separated list of parameters to pass to the frei0r effect.
8986 A frei0r effect parameter can be a boolean (its value is either
8987 "y" or "n"), a double, a color (specified as
8988 @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
8989 numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
8990 section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
8991 @var{X} and @var{Y} are floating point numbers) and/or a string.
8993 The number and types of parameters depend on the loaded effect. If an
8994 effect parameter is not specified, the default value is set.
8996 @subsection Examples
9000 Apply the distort0r effect, setting the first two double parameters:
9002 frei0r=filter_name=distort0r:filter_params=0.5|0.01
9006 Apply the colordistance effect, taking a color as the first parameter:
9008 frei0r=colordistance:0.2/0.3/0.4
9009 frei0r=colordistance:violet
9010 frei0r=colordistance:0x112233
9014 Apply the perspective effect, specifying the top left and top right image
9017 frei0r=perspective:0.2/0.2|0.8/0.2
9021 For more information, see
9022 @url{http://frei0r.dyne.org}
9026 Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
9028 It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
9029 processing filter, one of them is performed once per block, not per pixel.
9030 This allows for much higher speed.
9032 The filter accepts the following options:
9036 Set quality. This option defines the number of levels for averaging. It accepts
9037 an integer in the range 4-5. Default value is @code{4}.
9040 Force a constant quantization parameter. It accepts an integer in range 0-63.
9041 If not set, the filter will use the QP from the video stream (if available).
9044 Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
9045 more details but also more artifacts, while higher values make the image smoother
9046 but also blurrier. Default value is @code{0} − PSNR optimal.
9049 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
9050 option may cause flicker since the B-Frames have often larger QP. Default is
9051 @code{0} (not enabled).
9057 Apply Gaussian blur filter.
9059 The filter accepts the following options:
9063 Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
9066 Set number of steps for Gaussian approximation. Defauls is @code{1}.
9069 Set which planes to filter. By default all planes are filtered.
9072 Set vertical sigma, if negative it will be same as @code{sigma}.
9073 Default is @code{-1}.
9078 The filter accepts the following options:
9082 Set the luminance expression.
9084 Set the chrominance blue expression.
9086 Set the chrominance red expression.
9088 Set the alpha expression.
9090 Set the red expression.
9092 Set the green expression.
9094 Set the blue expression.
9097 The colorspace is selected according to the specified options. If one
9098 of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
9099 options is specified, the filter will automatically select a YCbCr
9100 colorspace. If one of the @option{red_expr}, @option{green_expr}, or
9101 @option{blue_expr} options is specified, it will select an RGB
9104 If one of the chrominance expression is not defined, it falls back on the other
9105 one. If no alpha expression is specified it will evaluate to opaque value.
9106 If none of chrominance expressions are specified, they will evaluate
9107 to the luminance expression.
9109 The expressions can use the following variables and functions:
9113 The sequential number of the filtered frame, starting from @code{0}.
9117 The coordinates of the current sample.
9121 The width and height of the image.
9125 Width and height scale depending on the currently filtered plane. It is the
9126 ratio between the corresponding luma plane number of pixels and the current
9127 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
9128 @code{0.5,0.5} for chroma planes.
9131 Time of the current frame, expressed in seconds.
9134 Return the value of the pixel at location (@var{x},@var{y}) of the current
9138 Return the value of the pixel at location (@var{x},@var{y}) of the luminance
9142 Return the value of the pixel at location (@var{x},@var{y}) of the
9143 blue-difference chroma plane. Return 0 if there is no such plane.
9146 Return the value of the pixel at location (@var{x},@var{y}) of the
9147 red-difference chroma plane. Return 0 if there is no such plane.
9152 Return the value of the pixel at location (@var{x},@var{y}) of the
9153 red/green/blue component. Return 0 if there is no such component.
9156 Return the value of the pixel at location (@var{x},@var{y}) of the alpha
9157 plane. Return 0 if there is no such plane.
9160 For functions, if @var{x} and @var{y} are outside the area, the value will be
9161 automatically clipped to the closer edge.
9163 @subsection Examples
9167 Flip the image horizontally:
9173 Generate a bidimensional sine wave, with angle @code{PI/3} and a
9174 wavelength of 100 pixels:
9176 geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
9180 Generate a fancy enigmatic moving light:
9182 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
9186 Generate a quick emboss effect:
9188 format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
9192 Modify RGB components depending on pixel position:
9194 geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
9198 Create a radial gradient that is the same size as the input (also see
9199 the @ref{vignette} filter):
9201 geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
9207 Fix the banding artifacts that are sometimes introduced into nearly flat
9208 regions by truncation to 8-bit color depth.
9209 Interpolate the gradients that should go where the bands are, and
9212 It is designed for playback only. Do not use it prior to
9213 lossy compression, because compression tends to lose the dither and
9214 bring back the bands.
9216 It accepts the following parameters:
9221 The maximum amount by which the filter will change any one pixel. This is also
9222 the threshold for detecting nearly flat regions. Acceptable values range from
9223 .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
9227 The neighborhood to fit the gradient to. A larger radius makes for smoother
9228 gradients, but also prevents the filter from modifying the pixels near detailed
9229 regions. Acceptable values are 8-32; the default value is 16. Out-of-range
9230 values will be clipped to the valid range.
9234 Alternatively, the options can be specified as a flat string:
9235 @var{strength}[:@var{radius}]
9237 @subsection Examples
9241 Apply the filter with a @code{3.5} strength and radius of @code{8}:
9247 Specify radius, omitting the strength (which will fall-back to the default
9258 Apply a Hald CLUT to a video stream.
9260 First input is the video stream to process, and second one is the Hald CLUT.
9261 The Hald CLUT input can be a simple picture or a complete video stream.
9263 The filter accepts the following options:
9267 Force termination when the shortest input terminates. Default is @code{0}.
9269 Continue applying the last CLUT after the end of the stream. A value of
9270 @code{0} disable the filter after the last frame of the CLUT is reached.
9271 Default is @code{1}.
9274 @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
9275 filters share the same internals).
9277 More information about the Hald CLUT can be found on Eskil Steenberg's website
9278 (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
9280 @subsection Workflow examples
9282 @subsubsection Hald CLUT video stream
9284 Generate an identity Hald CLUT stream altered with various effects:
9286 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
9289 Note: make sure you use a lossless codec.
9291 Then use it with @code{haldclut} to apply it on some random stream:
9293 ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
9296 The Hald CLUT will be applied to the 10 first seconds (duration of
9297 @file{clut.nut}), then the latest picture of that CLUT stream will be applied
9298 to the remaining frames of the @code{mandelbrot} stream.
9300 @subsubsection Hald CLUT with preview
9302 A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
9303 @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
9304 biggest possible square starting at the top left of the picture. The remaining
9305 padding pixels (bottom or right) will be ignored. This area can be used to add
9306 a preview of the Hald CLUT.
9308 Typically, the following generated Hald CLUT will be supported by the
9309 @code{haldclut} filter:
9312 ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
9313 pad=iw+320 [padded_clut];
9314 smptebars=s=320x256, split [a][b];
9315 [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
9316 [main][b] overlay=W-320" -frames:v 1 clut.png
9319 It contains the original and a preview of the effect of the CLUT: SMPTE color
9320 bars are displayed on the right-top, and below the same color bars processed by
9323 Then, the effect of this Hald CLUT can be visualized with:
9325 ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
9330 Flip the input video horizontally.
9332 For example, to horizontally flip the input video with @command{ffmpeg}:
9334 ffmpeg -i in.avi -vf "hflip" out.avi
9338 This filter applies a global color histogram equalization on a
9341 It can be used to correct video that has a compressed range of pixel
9342 intensities. The filter redistributes the pixel intensities to
9343 equalize their distribution across the intensity range. It may be
9344 viewed as an "automatically adjusting contrast filter". This filter is
9345 useful only for correcting degraded or poorly captured source
9348 The filter accepts the following options:
9352 Determine the amount of equalization to be applied. As the strength
9353 is reduced, the distribution of pixel intensities more-and-more
9354 approaches that of the input frame. The value must be a float number
9355 in the range [0,1] and defaults to 0.200.
9358 Set the maximum intensity that can generated and scale the output
9359 values appropriately. The strength should be set as desired and then
9360 the intensity can be limited if needed to avoid washing-out. The value
9361 must be a float number in the range [0,1] and defaults to 0.210.
9364 Set the antibanding level. If enabled the filter will randomly vary
9365 the luminance of output pixels by a small amount to avoid banding of
9366 the histogram. Possible values are @code{none}, @code{weak} or
9367 @code{strong}. It defaults to @code{none}.
9372 Compute and draw a color distribution histogram for the input video.
9374 The computed histogram is a representation of the color component
9375 distribution in an image.
9377 Standard histogram displays the color components distribution in an image.
9378 Displays color graph for each color component. Shows distribution of
9379 the Y, U, V, A or R, G, B components, depending on input format, in the
9380 current frame. Below each graph a color component scale meter is shown.
9382 The filter accepts the following options:
9386 Set height of level. Default value is @code{200}.
9387 Allowed range is [50, 2048].
9390 Set height of color scale. Default value is @code{12}.
9391 Allowed range is [0, 40].
9395 It accepts the following values:
9398 Per color component graphs are placed below each other.
9401 Per color component graphs are placed side by side.
9404 Presents information identical to that in the @code{parade}, except
9405 that the graphs representing color components are superimposed directly
9408 Default is @code{stack}.
9411 Set mode. Can be either @code{linear}, or @code{logarithmic}.
9412 Default is @code{linear}.
9415 Set what color components to display.
9416 Default is @code{7}.
9419 Set foreground opacity. Default is @code{0.7}.
9422 Set background opacity. Default is @code{0.5}.
9425 @subsection Examples
9430 Calculate and draw histogram:
9432 ffplay -i input -vf histogram
9440 This is a high precision/quality 3d denoise filter. It aims to reduce
9441 image noise, producing smooth images and making still images really
9442 still. It should enhance compressibility.
9444 It accepts the following optional parameters:
9448 A non-negative floating point number which specifies spatial luma strength.
9451 @item chroma_spatial
9452 A non-negative floating point number which specifies spatial chroma strength.
9453 It defaults to 3.0*@var{luma_spatial}/4.0.
9456 A floating point number which specifies luma temporal strength. It defaults to
9457 6.0*@var{luma_spatial}/4.0.
9460 A floating point number which specifies chroma temporal strength. It defaults to
9461 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
9466 Download hardware frames to system memory.
9468 The input must be in hardware frames, and the output a non-hardware format.
9469 Not all formats will be supported on the output - it may be necessary to insert
9470 an additional @option{format} filter immediately following in the graph to get
9471 the output in a supported format.
9475 Map hardware frames to system memory or to another device.
9477 This filter has several different modes of operation; which one is used depends
9478 on the input and output formats:
9481 Hardware frame input, normal frame output
9483 Map the input frames to system memory and pass them to the output. If the
9484 original hardware frame is later required (for example, after overlaying
9485 something else on part of it), the @option{hwmap} filter can be used again
9486 in the next mode to retrieve it.
9488 Normal frame input, hardware frame output
9490 If the input is actually a software-mapped hardware frame, then unmap it -
9491 that is, return the original hardware frame.
9493 Otherwise, a device must be provided. Create new hardware surfaces on that
9494 device for the output, then map them back to the software format at the input
9495 and give those frames to the preceding filter. This will then act like the
9496 @option{hwupload} filter, but may be able to avoid an additional copy when
9497 the input is already in a compatible format.
9499 Hardware frame input and output
9501 A device must be supplied for the output, either directly or with the
9502 @option{derive_device} option. The input and output devices must be of
9503 different types and compatible - the exact meaning of this is
9504 system-dependent, but typically it means that they must refer to the same
9505 underlying hardware context (for example, refer to the same graphics card).
9507 If the input frames were originally created on the output device, then unmap
9508 to retrieve the original frames.
9510 Otherwise, map the frames to the output device - create new hardware frames
9511 on the output corresponding to the frames on the input.
9514 The following additional parameters are accepted:
9518 Set the frame mapping mode. Some combination of:
9521 The mapped frame should be readable.
9523 The mapped frame should be writeable.
9525 The mapping will always overwrite the entire frame.
9527 This may improve performance in some cases, as the original contents of the
9528 frame need not be loaded.
9530 The mapping must not involve any copying.
9532 Indirect mappings to copies of frames are created in some cases where either
9533 direct mapping is not possible or it would have unexpected properties.
9534 Setting this flag ensures that the mapping is direct and will fail if that is
9537 Defaults to @var{read+write} if not specified.
9539 @item derive_device @var{type}
9540 Rather than using the device supplied at initialisation, instead derive a new
9541 device of type @var{type} from the device the input frames exist on.
9544 In a hardware to hardware mapping, map in reverse - create frames in the sink
9545 and map them back to the source. This may be necessary in some cases where
9546 a mapping in one direction is required but only the opposite direction is
9547 supported by the devices being used.
9549 This option is dangerous - it may break the preceding filter in undefined
9550 ways if there are any additional constraints on that filter's output.
9551 Do not use it without fully understanding the implications of its use.
9556 Upload system memory frames to hardware surfaces.
9558 The device to upload to must be supplied when the filter is initialised. If
9559 using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
9562 @anchor{hwupload_cuda}
9563 @section hwupload_cuda
9565 Upload system memory frames to a CUDA device.
9567 It accepts the following optional parameters:
9571 The number of the CUDA device to use
9576 Apply a high-quality magnification filter designed for pixel art. This filter
9577 was originally created by Maxim Stepin.
9579 It accepts the following option:
9583 Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
9584 @code{hq3x} and @code{4} for @code{hq4x}.
9585 Default is @code{3}.
9589 Stack input videos horizontally.
9591 All streams must be of same pixel format and of same height.
9593 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
9594 to create same output.
9596 The filter accept the following option:
9600 Set number of input streams. Default is 2.
9603 If set to 1, force the output to terminate when the shortest input
9604 terminates. Default value is 0.
9609 Modify the hue and/or the saturation of the input.
9611 It accepts the following parameters:
9615 Specify the hue angle as a number of degrees. It accepts an expression,
9616 and defaults to "0".
9619 Specify the saturation in the [-10,10] range. It accepts an expression and
9623 Specify the hue angle as a number of radians. It accepts an
9624 expression, and defaults to "0".
9627 Specify the brightness in the [-10,10] range. It accepts an expression and
9631 @option{h} and @option{H} are mutually exclusive, and can't be
9632 specified at the same time.
9634 The @option{b}, @option{h}, @option{H} and @option{s} option values are
9635 expressions containing the following constants:
9639 frame count of the input frame starting from 0
9642 presentation timestamp of the input frame expressed in time base units
9645 frame rate of the input video, NAN if the input frame rate is unknown
9648 timestamp expressed in seconds, NAN if the input timestamp is unknown
9651 time base of the input video
9654 @subsection Examples
9658 Set the hue to 90 degrees and the saturation to 1.0:
9664 Same command but expressing the hue in radians:
9670 Rotate hue and make the saturation swing between 0
9671 and 2 over a period of 1 second:
9673 hue="H=2*PI*t: s=sin(2*PI*t)+1"
9677 Apply a 3 seconds saturation fade-in effect starting at 0:
9682 The general fade-in expression can be written as:
9684 hue="s=min(0\, max((t-START)/DURATION\, 1))"
9688 Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
9690 hue="s=max(0\, min(1\, (8-t)/3))"
9693 The general fade-out expression can be written as:
9695 hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
9700 @subsection Commands
9702 This filter supports the following commands:
9708 Modify the hue and/or the saturation and/or brightness of the input video.
9709 The command accepts the same syntax of the corresponding option.
9711 If the specified expression is not valid, it is kept at its current
9717 Grow first stream into second stream by connecting components.
9718 This makes it possible to build more robust edge masks.
9720 This filter accepts the following options:
9724 Set which planes will be processed as bitmap, unprocessed planes will be
9725 copied from first stream.
9726 By default value 0xf, all planes will be processed.
9729 Set threshold which is used in filtering. If pixel component value is higher than
9730 this value filter algorithm for connecting components is activated.
9731 By default value is 0.
9736 Detect video interlacing type.
9738 This filter tries to detect if the input frames are interlaced, progressive,
9739 top or bottom field first. It will also try to detect fields that are
9740 repeated between adjacent frames (a sign of telecine).
9742 Single frame detection considers only immediately adjacent frames when classifying each frame.
9743 Multiple frame detection incorporates the classification history of previous frames.
9745 The filter will log these metadata values:
9748 @item single.current_frame
9749 Detected type of current frame using single-frame detection. One of:
9750 ``tff'' (top field first), ``bff'' (bottom field first),
9751 ``progressive'', or ``undetermined''
9754 Cumulative number of frames detected as top field first using single-frame detection.
9757 Cumulative number of frames detected as top field first using multiple-frame detection.
9760 Cumulative number of frames detected as bottom field first using single-frame detection.
9762 @item multiple.current_frame
9763 Detected type of current frame using multiple-frame detection. One of:
9764 ``tff'' (top field first), ``bff'' (bottom field first),
9765 ``progressive'', or ``undetermined''
9768 Cumulative number of frames detected as bottom field first using multiple-frame detection.
9770 @item single.progressive
9771 Cumulative number of frames detected as progressive using single-frame detection.
9773 @item multiple.progressive
9774 Cumulative number of frames detected as progressive using multiple-frame detection.
9776 @item single.undetermined
9777 Cumulative number of frames that could not be classified using single-frame detection.
9779 @item multiple.undetermined
9780 Cumulative number of frames that could not be classified using multiple-frame detection.
9782 @item repeated.current_frame
9783 Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
9785 @item repeated.neither
9786 Cumulative number of frames with no repeated field.
9789 Cumulative number of frames with the top field repeated from the previous frame's top field.
9791 @item repeated.bottom
9792 Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
9795 The filter accepts the following options:
9799 Set interlacing threshold.
9801 Set progressive threshold.
9803 Threshold for repeated field detection.
9805 Number of frames after which a given frame's contribution to the
9806 statistics is halved (i.e., it contributes only 0.5 to its
9807 classification). The default of 0 means that all frames seen are given
9808 full weight of 1.0 forever.
9809 @item analyze_interlaced_flag
9810 When this is not 0 then idet will use the specified number of frames to determine
9811 if the interlaced flag is accurate, it will not count undetermined frames.
9812 If the flag is found to be accurate it will be used without any further
9813 computations, if it is found to be inaccurate it will be cleared without any
9814 further computations. This allows inserting the idet filter as a low computational
9815 method to clean up the interlaced flag
9820 Deinterleave or interleave fields.
9822 This filter allows one to process interlaced images fields without
9823 deinterlacing them. Deinterleaving splits the input frame into 2
9824 fields (so called half pictures). Odd lines are moved to the top
9825 half of the output image, even lines to the bottom half.
9826 You can process (filter) them independently and then re-interleave them.
9828 The filter accepts the following options:
9832 @item chroma_mode, c
9834 Available values for @var{luma_mode}, @var{chroma_mode} and
9835 @var{alpha_mode} are:
9841 @item deinterleave, d
9842 Deinterleave fields, placing one above the other.
9845 Interleave fields. Reverse the effect of deinterleaving.
9847 Default value is @code{none}.
9850 @item chroma_swap, cs
9851 @item alpha_swap, as
9852 Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
9857 Apply inflate effect to the video.
9859 This filter replaces the pixel by the local(3x3) average by taking into account
9860 only values higher than the pixel.
9862 It accepts the following options:
9869 Limit the maximum change for each plane, default is 65535.
9870 If 0, plane will remain unchanged.
9875 Simple interlacing filter from progressive contents. This interleaves upper (or
9876 lower) lines from odd frames with lower (or upper) lines from even frames,
9877 halving the frame rate and preserving image height.
9880 Original Original New Frame
9881 Frame 'j' Frame 'j+1' (tff)
9882 ========== =========== ==================
9883 Line 0 --------------------> Frame 'j' Line 0
9884 Line 1 Line 1 ----> Frame 'j+1' Line 1
9885 Line 2 ---------------------> Frame 'j' Line 2
9886 Line 3 Line 3 ----> Frame 'j+1' Line 3
9888 New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
9891 It accepts the following optional parameters:
9895 This determines whether the interlaced frame is taken from the even
9896 (tff - default) or odd (bff) lines of the progressive frame.
9899 Vertical lowpass filter to avoid twitter interlacing and
9900 reduce moire patterns.
9904 Disable vertical lowpass filter
9907 Enable linear filter (default)
9910 Enable complex filter. This will slightly less reduce twitter and moire
9911 but better retain detail and subjective sharpness impression.
9918 Deinterlace input video by applying Donald Graft's adaptive kernel
9919 deinterling. Work on interlaced parts of a video to produce
9922 The description of the accepted parameters follows.
9926 Set the threshold which affects the filter's tolerance when
9927 determining if a pixel line must be processed. It must be an integer
9928 in the range [0,255] and defaults to 10. A value of 0 will result in
9929 applying the process on every pixels.
9932 Paint pixels exceeding the threshold value to white if set to 1.
9936 Set the fields order. Swap fields if set to 1, leave fields alone if
9940 Enable additional sharpening if set to 1. Default is 0.
9943 Enable twoway sharpening if set to 1. Default is 0.
9946 @subsection Examples
9950 Apply default values:
9952 kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
9956 Enable additional sharpening:
9962 Paint processed pixels in white:
9968 @section lenscorrection
9970 Correct radial lens distortion
9972 This filter can be used to correct for radial distortion as can result from the use
9973 of wide angle lenses, and thereby re-rectify the image. To find the right parameters
9974 one can use tools available for example as part of opencv or simply trial-and-error.
9975 To use opencv use the calibration sample (under samples/cpp) from the opencv sources
9976 and extract the k1 and k2 coefficients from the resulting matrix.
9978 Note that effectively the same filter is available in the open-source tools Krita and
9979 Digikam from the KDE project.
9981 In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
9982 this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
9983 brightness distribution, so you may want to use both filters together in certain
9984 cases, though you will have to take care of ordering, i.e. whether vignetting should
9985 be applied before or after lens correction.
9989 The filter accepts the following options:
9993 Relative x-coordinate of the focal point of the image, and thereby the center of the
9994 distortion. This value has a range [0,1] and is expressed as fractions of the image
9997 Relative y-coordinate of the focal point of the image, and thereby the center of the
9998 distortion. This value has a range [0,1] and is expressed as fractions of the image
10001 Coefficient of the quadratic correction term. 0.5 means no correction.
10003 Coefficient of the double quadratic correction term. 0.5 means no correction.
10006 The formula that generates the correction is:
10008 @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)
10010 where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
10011 distances from the focal point in the source and target images, respectively.
10015 Obtain the VMAF (Video Multi-Method Assessment Fusion)
10016 score between two input videos.
10018 The obtained VMAF score is printed through the logging system.
10020 It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
10021 After installing the library it can be enabled using:
10022 @code{./configure --enable-libvmaf}.
10023 If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
10025 The filter has following options:
10029 Set the model path which is to be used for SVM.
10030 Default value: @code{"vmaf_v0.6.1.pkl"}
10033 Set the file path to be used to store logs.
10036 Set the format of the log file (xml or json).
10038 @item enable_transform
10039 Enables transform for computing vmaf.
10042 Invokes the phone model which will generate VMAF scores higher than in the
10043 regular model, which is more suitable for laptop, TV, etc. viewing conditions.
10046 Enables computing psnr along with vmaf.
10049 Enables computing ssim along with vmaf.
10052 Enables computing ms_ssim along with vmaf.
10055 Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
10058 This filter also supports the @ref{framesync} options.
10060 On the below examples the input file @file{main.mpg} being processed is
10061 compared with the reference file @file{ref.mpg}.
10064 ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
10067 Example with options:
10069 ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
10074 Limits the pixel components values to the specified range [min, max].
10076 The filter accepts the following options:
10080 Lower bound. Defaults to the lowest allowed value for the input.
10083 Upper bound. Defaults to the highest allowed value for the input.
10086 Specify which planes will be processed. Defaults to all available.
10093 The filter accepts the following options:
10097 Set the number of loops. Setting this value to -1 will result in infinite loops.
10101 Set maximal size in number of frames. Default is 0.
10104 Set first frame of loop. Default is 0.
10110 Apply a 3D LUT to an input video.
10112 The filter accepts the following options:
10116 Set the 3D LUT file name.
10118 Currently supported formats:
10130 Select interpolation mode.
10132 Available values are:
10136 Use values from the nearest defined point.
10138 Interpolate values using the 8 points defining a cube.
10140 Interpolate values using a tetrahedron.
10144 This filter also supports the @ref{framesync} options.
10148 Turn certain luma values into transparency.
10150 The filter accepts the following options:
10154 Set the luma which will be used as base for transparency.
10155 Default value is @code{0}.
10158 Set the range of luma values to be keyed out.
10159 Default value is @code{0}.
10162 Set the range of softness. Default value is @code{0}.
10163 Use this to control gradual transition from zero to full transparency.
10166 @section lut, lutrgb, lutyuv
10168 Compute a look-up table for binding each pixel component input value
10169 to an output value, and apply it to the input video.
10171 @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
10172 to an RGB input video.
10174 These filters accept the following parameters:
10177 set first pixel component expression
10179 set second pixel component expression
10181 set third pixel component expression
10183 set fourth pixel component expression, corresponds to the alpha component
10186 set red component expression
10188 set green component expression
10190 set blue component expression
10192 alpha component expression
10195 set Y/luminance component expression
10197 set U/Cb component expression
10199 set V/Cr component expression
10202 Each of them specifies the expression to use for computing the lookup table for
10203 the corresponding pixel component values.
10205 The exact component associated to each of the @var{c*} options depends on the
10208 The @var{lut} filter requires either YUV or RGB pixel formats in input,
10209 @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
10211 The expressions can contain the following constants and functions:
10216 The input width and height.
10219 The input value for the pixel component.
10222 The input value, clipped to the @var{minval}-@var{maxval} range.
10225 The maximum value for the pixel component.
10228 The minimum value for the pixel component.
10231 The negated value for the pixel component value, clipped to the
10232 @var{minval}-@var{maxval} range; it corresponds to the expression
10233 "maxval-clipval+minval".
10236 The computed value in @var{val}, clipped to the
10237 @var{minval}-@var{maxval} range.
10239 @item gammaval(gamma)
10240 The computed gamma correction value of the pixel component value,
10241 clipped to the @var{minval}-@var{maxval} range. It corresponds to the
10243 "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
10247 All expressions default to "val".
10249 @subsection Examples
10253 Negate input video:
10255 lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
10256 lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
10259 The above is the same as:
10261 lutrgb="r=negval:g=negval:b=negval"
10262 lutyuv="y=negval:u=negval:v=negval"
10272 Remove chroma components, turning the video into a graytone image:
10274 lutyuv="u=128:v=128"
10278 Apply a luma burning effect:
10284 Remove green and blue components:
10290 Set a constant alpha channel value on input:
10292 format=rgba,lutrgb=a="maxval-minval/2"
10296 Correct luminance gamma by a factor of 0.5:
10298 lutyuv=y=gammaval(0.5)
10302 Discard least significant bits of luma:
10304 lutyuv=y='bitand(val, 128+64+32)'
10308 Technicolor like effect:
10310 lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
10314 @section lut2, tlut2
10316 The @code{lut2} filter takes two input streams and outputs one
10319 The @code{tlut2} (time lut2) filter takes two consecutive frames
10320 from one single stream.
10322 This filter accepts the following parameters:
10325 set first pixel component expression
10327 set second pixel component expression
10329 set third pixel component expression
10331 set fourth pixel component expression, corresponds to the alpha component
10334 Each of them specifies the expression to use for computing the lookup table for
10335 the corresponding pixel component values.
10337 The exact component associated to each of the @var{c*} options depends on the
10340 The expressions can contain the following constants:
10345 The input width and height.
10348 The first input value for the pixel component.
10351 The second input value for the pixel component.
10354 The first input video bit depth.
10357 The second input video bit depth.
10360 All expressions default to "x".
10362 @subsection Examples
10366 Highlight differences between two RGB video streams:
10368 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)'
10372 Highlight differences between two YUV video streams:
10374 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)'
10378 Show max difference between two video streams:
10380 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)))'
10384 @section maskedclamp
10386 Clamp the first input stream with the second input and third input stream.
10388 Returns the value of first stream to be between second input
10389 stream - @code{undershoot} and third input stream + @code{overshoot}.
10391 This filter accepts the following options:
10394 Default value is @code{0}.
10397 Default value is @code{0}.
10400 Set which planes will be processed as bitmap, unprocessed planes will be
10401 copied from first stream.
10402 By default value 0xf, all planes will be processed.
10405 @section maskedmerge
10407 Merge the first input stream with the second input stream using per pixel
10408 weights in the third input stream.
10410 A value of 0 in the third stream pixel component means that pixel component
10411 from first stream is returned unchanged, while maximum value (eg. 255 for
10412 8-bit videos) means that pixel component from second stream is returned
10413 unchanged. Intermediate values define the amount of merging between both
10414 input stream's pixel components.
10416 This filter accepts the following options:
10419 Set which planes will be processed as bitmap, unprocessed planes will be
10420 copied from first stream.
10421 By default value 0xf, all planes will be processed.
10426 Apply motion-compensation deinterlacing.
10428 It needs one field per frame as input and must thus be used together
10429 with yadif=1/3 or equivalent.
10431 This filter accepts the following options:
10434 Set the deinterlacing mode.
10436 It accepts one of the following values:
10441 use iterative motion estimation
10443 like @samp{slow}, but use multiple reference frames.
10445 Default value is @samp{fast}.
10448 Set the picture field parity assumed for the input video. It must be
10449 one of the following values:
10453 assume top field first
10455 assume bottom field first
10458 Default value is @samp{bff}.
10461 Set per-block quantization parameter (QP) used by the internal
10464 Higher values should result in a smoother motion vector field but less
10465 optimal individual vectors. Default value is 1.
10468 @section mergeplanes
10470 Merge color channel components from several video streams.
10472 The filter accepts up to 4 input streams, and merge selected input
10473 planes to the output video.
10475 This filter accepts the following options:
10478 Set input to output plane mapping. Default is @code{0}.
10480 The mappings is specified as a bitmap. It should be specified as a
10481 hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
10482 mapping for the first plane of the output stream. 'A' sets the number of
10483 the input stream to use (from 0 to 3), and 'a' the plane number of the
10484 corresponding input to use (from 0 to 3). The rest of the mappings is
10485 similar, 'Bb' describes the mapping for the output stream second
10486 plane, 'Cc' describes the mapping for the output stream third plane and
10487 'Dd' describes the mapping for the output stream fourth plane.
10490 Set output pixel format. Default is @code{yuva444p}.
10493 @subsection Examples
10497 Merge three gray video streams of same width and height into single video stream:
10499 [a0][a1][a2]mergeplanes=0x001020:yuv444p
10503 Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
10505 [a0][a1]mergeplanes=0x00010210:yuva444p
10509 Swap Y and A plane in yuva444p stream:
10511 format=yuva444p,mergeplanes=0x03010200:yuva444p
10515 Swap U and V plane in yuv420p stream:
10517 format=yuv420p,mergeplanes=0x000201:yuv420p
10521 Cast a rgb24 clip to yuv444p:
10523 format=rgb24,mergeplanes=0x000102:yuv444p
10529 Estimate and export motion vectors using block matching algorithms.
10530 Motion vectors are stored in frame side data to be used by other filters.
10532 This filter accepts the following options:
10535 Specify the motion estimation method. Accepts one of the following values:
10539 Exhaustive search algorithm.
10541 Three step search algorithm.
10543 Two dimensional logarithmic search algorithm.
10545 New three step search algorithm.
10547 Four step search algorithm.
10549 Diamond search algorithm.
10551 Hexagon-based search algorithm.
10553 Enhanced predictive zonal search algorithm.
10555 Uneven multi-hexagon search algorithm.
10557 Default value is @samp{esa}.
10560 Macroblock size. Default @code{16}.
10563 Search parameter. Default @code{7}.
10566 @section midequalizer
10568 Apply Midway Image Equalization effect using two video streams.
10570 Midway Image Equalization adjusts a pair of images to have the same
10571 histogram, while maintaining their dynamics as much as possible. It's
10572 useful for e.g. matching exposures from a pair of stereo cameras.
10574 This filter has two inputs and one output, which must be of same pixel format, but
10575 may be of different sizes. The output of filter is first input adjusted with
10576 midway histogram of both inputs.
10578 This filter accepts the following option:
10582 Set which planes to process. Default is @code{15}, which is all available planes.
10585 @section minterpolate
10587 Convert the video to specified frame rate using motion interpolation.
10589 This filter accepts the following options:
10592 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}.
10595 Motion interpolation mode. Following values are accepted:
10598 Duplicate previous or next frame for interpolating new ones.
10600 Blend source frames. Interpolated frame is mean of previous and next frames.
10602 Motion compensated interpolation. Following options are effective when this mode is selected:
10606 Motion compensation mode. Following values are accepted:
10609 Overlapped block motion compensation.
10611 Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
10613 Default mode is @samp{obmc}.
10616 Motion estimation mode. Following values are accepted:
10619 Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
10621 Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
10623 Default mode is @samp{bilat}.
10626 The algorithm to be used for motion estimation. Following values are accepted:
10629 Exhaustive search algorithm.
10631 Three step search algorithm.
10633 Two dimensional logarithmic search algorithm.
10635 New three step search algorithm.
10637 Four step search algorithm.
10639 Diamond search algorithm.
10641 Hexagon-based search algorithm.
10643 Enhanced predictive zonal search algorithm.
10645 Uneven multi-hexagon search algorithm.
10647 Default algorithm is @samp{epzs}.
10650 Macroblock size. Default @code{16}.
10653 Motion estimation search parameter. Default @code{32}.
10656 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).
10661 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:
10664 Disable scene change detection.
10666 Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
10668 Default method is @samp{fdiff}.
10670 @item scd_threshold
10671 Scene change detection threshold. Default is @code{5.0}.
10676 Mix several video input streams into one video stream.
10678 A description of the accepted options follows.
10682 The number of inputs. If unspecified, it defaults to 2.
10685 Specify weight of each input video stream as sequence.
10686 Each weight is separated by space.
10689 Specify how end of stream is determined.
10692 The duration of the longest input. (default)
10695 The duration of the shortest input.
10698 The duration of the first input.
10702 @section mpdecimate
10704 Drop frames that do not differ greatly from the previous frame in
10705 order to reduce frame rate.
10707 The main use of this filter is for very-low-bitrate encoding
10708 (e.g. streaming over dialup modem), but it could in theory be used for
10709 fixing movies that were inverse-telecined incorrectly.
10711 A description of the accepted options follows.
10715 Set the maximum number of consecutive frames which can be dropped (if
10716 positive), or the minimum interval between dropped frames (if
10717 negative). If the value is 0, the frame is dropped disregarding the
10718 number of previous sequentially dropped frames.
10720 Default value is 0.
10725 Set the dropping threshold values.
10727 Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
10728 represent actual pixel value differences, so a threshold of 64
10729 corresponds to 1 unit of difference for each pixel, or the same spread
10730 out differently over the block.
10732 A frame is a candidate for dropping if no 8x8 blocks differ by more
10733 than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
10734 meaning the whole image) differ by more than a threshold of @option{lo}.
10736 Default value for @option{hi} is 64*12, default value for @option{lo} is
10737 64*5, and default value for @option{frac} is 0.33.
10743 Negate input video.
10745 It accepts an integer in input; if non-zero it negates the
10746 alpha component (if available). The default value in input is 0.
10750 Denoise frames using Non-Local Means algorithm.
10752 Each pixel is adjusted by looking for other pixels with similar contexts. This
10753 context similarity is defined by comparing their surrounding patches of size
10754 @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
10757 Note that the research area defines centers for patches, which means some
10758 patches will be made of pixels outside that research area.
10760 The filter accepts the following options.
10764 Set denoising strength.
10770 Same as @option{p} but for chroma planes.
10772 The default value is @var{0} and means automatic.
10778 Same as @option{r} but for chroma planes.
10780 The default value is @var{0} and means automatic.
10785 Deinterlace video using neural network edge directed interpolation.
10787 This filter accepts the following options:
10791 Mandatory option, without binary file filter can not work.
10792 Currently file can be found here:
10793 https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
10796 Set which frames to deinterlace, by default it is @code{all}.
10797 Can be @code{all} or @code{interlaced}.
10800 Set mode of operation.
10802 Can be one of the following:
10806 Use frame flags, both fields.
10808 Use frame flags, single field.
10810 Use top field only.
10812 Use bottom field only.
10814 Use both fields, top first.
10816 Use both fields, bottom first.
10820 Set which planes to process, by default filter process all frames.
10823 Set size of local neighborhood around each pixel, used by the predictor neural
10826 Can be one of the following:
10839 Set the number of neurons in predictor neural network.
10840 Can be one of the following:
10851 Controls the number of different neural network predictions that are blended
10852 together to compute the final output value. Can be @code{fast}, default or
10856 Set which set of weights to use in the predictor.
10857 Can be one of the following:
10861 weights trained to minimize absolute error
10863 weights trained to minimize squared error
10867 Controls whether or not the prescreener neural network is used to decide
10868 which pixels should be processed by the predictor neural network and which
10869 can be handled by simple cubic interpolation.
10870 The prescreener is trained to know whether cubic interpolation will be
10871 sufficient for a pixel or whether it should be predicted by the predictor nn.
10872 The computational complexity of the prescreener nn is much less than that of
10873 the predictor nn. Since most pixels can be handled by cubic interpolation,
10874 using the prescreener generally results in much faster processing.
10875 The prescreener is pretty accurate, so the difference between using it and not
10876 using it is almost always unnoticeable.
10878 Can be one of the following:
10886 Default is @code{new}.
10889 Set various debugging flags.
10894 Force libavfilter not to use any of the specified pixel formats for the
10895 input to the next filter.
10897 It accepts the following parameters:
10901 A '|'-separated list of pixel format names, such as
10902 pix_fmts=yuv420p|monow|rgb24".
10906 @subsection Examples
10910 Force libavfilter to use a format different from @var{yuv420p} for the
10911 input to the vflip filter:
10913 noformat=pix_fmts=yuv420p,vflip
10917 Convert the input video to any of the formats not contained in the list:
10919 noformat=yuv420p|yuv444p|yuv410p
10925 Add noise on video input frame.
10927 The filter accepts the following options:
10935 Set noise seed for specific pixel component or all pixel components in case
10936 of @var{all_seed}. Default value is @code{123457}.
10938 @item all_strength, alls
10939 @item c0_strength, c0s
10940 @item c1_strength, c1s
10941 @item c2_strength, c2s
10942 @item c3_strength, c3s
10943 Set noise strength for specific pixel component or all pixel components in case
10944 @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
10946 @item all_flags, allf
10947 @item c0_flags, c0f
10948 @item c1_flags, c1f
10949 @item c2_flags, c2f
10950 @item c3_flags, c3f
10951 Set pixel component flags or set flags for all components if @var{all_flags}.
10952 Available values for component flags are:
10955 averaged temporal noise (smoother)
10957 mix random noise with a (semi)regular pattern
10959 temporal noise (noise pattern changes between frames)
10961 uniform noise (gaussian otherwise)
10965 @subsection Examples
10967 Add temporal and uniform noise to input video:
10969 noise=alls=20:allf=t+u
10974 Normalize RGB video (aka histogram stretching, contrast stretching).
10975 See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
10977 For each channel of each frame, the filter computes the input range and maps
10978 it linearly to the user-specified output range. The output range defaults
10979 to the full dynamic range from pure black to pure white.
10981 Temporal smoothing can be used on the input range to reduce flickering (rapid
10982 changes in brightness) caused when small dark or bright objects enter or leave
10983 the scene. This is similar to the auto-exposure (automatic gain control) on a
10984 video camera, and, like a video camera, it may cause a period of over- or
10985 under-exposure of the video.
10987 The R,G,B channels can be normalized independently, which may cause some
10988 color shifting, or linked together as a single channel, which prevents
10989 color shifting. Linked normalization preserves hue. Independent normalization
10990 does not, so it can be used to remove some color casts. Independent and linked
10991 normalization can be combined in any ratio.
10993 The normalize filter accepts the following options:
10998 Colors which define the output range. The minimum input value is mapped to
10999 the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
11000 The defaults are black and white respectively. Specifying white for
11001 @var{blackpt} and black for @var{whitept} will give color-inverted,
11002 normalized video. Shades of grey can be used to reduce the dynamic range
11003 (contrast). Specifying saturated colors here can create some interesting
11007 The number of previous frames to use for temporal smoothing. The input range
11008 of each channel is smoothed using a rolling average over the current frame
11009 and the @var{smoothing} previous frames. The default is 0 (no temporal
11013 Controls the ratio of independent (color shifting) channel normalization to
11014 linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
11015 independent. Defaults to 1.0 (fully independent).
11018 Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
11019 expensive no-op. Defaults to 1.0 (full strength).
11023 @subsection Examples
11025 Stretch video contrast to use the full dynamic range, with no temporal
11026 smoothing; may flicker depending on the source content:
11028 normalize=blackpt=black:whitept=white:smoothing=0
11031 As above, but with 50 frames of temporal smoothing; flicker should be
11032 reduced, depending on the source content:
11034 normalize=blackpt=black:whitept=white:smoothing=50
11037 As above, but with hue-preserving linked channel normalization:
11039 normalize=blackpt=black:whitept=white:smoothing=50:independence=0
11042 As above, but with half strength:
11044 normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
11047 Map the darkest input color to red, the brightest input color to cyan:
11049 normalize=blackpt=red:whitept=cyan
11054 Pass the video source unchanged to the output.
11057 Optical Character Recognition
11059 This filter uses Tesseract for optical character recognition.
11061 It accepts the following options:
11065 Set datapath to tesseract data. Default is to use whatever was
11066 set at installation.
11069 Set language, default is "eng".
11072 Set character whitelist.
11075 Set character blacklist.
11078 The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
11082 Apply a video transform using libopencv.
11084 To enable this filter, install the libopencv library and headers and
11085 configure FFmpeg with @code{--enable-libopencv}.
11087 It accepts the following parameters:
11092 The name of the libopencv filter to apply.
11094 @item filter_params
11095 The parameters to pass to the libopencv filter. If not specified, the default
11096 values are assumed.
11100 Refer to the official libopencv documentation for more precise
11102 @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
11104 Several libopencv filters are supported; see the following subsections.
11109 Dilate an image by using a specific structuring element.
11110 It corresponds to the libopencv function @code{cvDilate}.
11112 It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
11114 @var{struct_el} represents a structuring element, and has the syntax:
11115 @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
11117 @var{cols} and @var{rows} represent the number of columns and rows of
11118 the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
11119 point, and @var{shape} the shape for the structuring element. @var{shape}
11120 must be "rect", "cross", "ellipse", or "custom".
11122 If the value for @var{shape} is "custom", it must be followed by a
11123 string of the form "=@var{filename}". The file with name
11124 @var{filename} is assumed to represent a binary image, with each
11125 printable character corresponding to a bright pixel. When a custom
11126 @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
11127 or columns and rows of the read file are assumed instead.
11129 The default value for @var{struct_el} is "3x3+0x0/rect".
11131 @var{nb_iterations} specifies the number of times the transform is
11132 applied to the image, and defaults to 1.
11136 # Use the default values
11139 # Dilate using a structuring element with a 5x5 cross, iterating two times
11140 ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
11142 # Read the shape from the file diamond.shape, iterating two times.
11143 # The file diamond.shape may contain a pattern of characters like this
11149 # The specified columns and rows are ignored
11150 # but the anchor point coordinates are not
11151 ocv=dilate:0x0+2x2/custom=diamond.shape|2
11156 Erode an image by using a specific structuring element.
11157 It corresponds to the libopencv function @code{cvErode}.
11159 It accepts the parameters: @var{struct_el}:@var{nb_iterations},
11160 with the same syntax and semantics as the @ref{dilate} filter.
11164 Smooth the input video.
11166 The filter takes the following parameters:
11167 @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
11169 @var{type} is the type of smooth filter to apply, and must be one of
11170 the following values: "blur", "blur_no_scale", "median", "gaussian",
11171 or "bilateral". The default value is "gaussian".
11173 The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
11174 depend on the smooth type. @var{param1} and
11175 @var{param2} accept integer positive values or 0. @var{param3} and
11176 @var{param4} accept floating point values.
11178 The default value for @var{param1} is 3. The default value for the
11179 other parameters is 0.
11181 These parameters correspond to the parameters assigned to the
11182 libopencv function @code{cvSmooth}.
11184 @section oscilloscope
11186 2D Video Oscilloscope.
11188 Useful to measure spatial impulse, step responses, chroma delays, etc.
11190 It accepts the following parameters:
11194 Set scope center x position.
11197 Set scope center y position.
11200 Set scope size, relative to frame diagonal.
11203 Set scope tilt/rotation.
11209 Set trace center x position.
11212 Set trace center y position.
11215 Set trace width, relative to width of frame.
11218 Set trace height, relative to height of frame.
11221 Set which components to trace. By default it traces first three components.
11224 Draw trace grid. By default is enabled.
11227 Draw some statistics. By default is enabled.
11230 Draw scope. By default is enabled.
11233 @subsection Examples
11237 Inspect full first row of video frame.
11239 oscilloscope=x=0.5:y=0:s=1
11243 Inspect full last row of video frame.
11245 oscilloscope=x=0.5:y=1:s=1
11249 Inspect full 5th line of video frame of height 1080.
11251 oscilloscope=x=0.5:y=5/1080:s=1
11255 Inspect full last column of video frame.
11257 oscilloscope=x=1:y=0.5:s=1:t=1
11265 Overlay one video on top of another.
11267 It takes two inputs and has one output. The first input is the "main"
11268 video on which the second input is overlaid.
11270 It accepts the following parameters:
11272 A description of the accepted options follows.
11277 Set the expression for the x and y coordinates of the overlaid video
11278 on the main video. Default value is "0" for both expressions. In case
11279 the expression is invalid, it is set to a huge value (meaning that the
11280 overlay will not be displayed within the output visible area).
11283 See @ref{framesync}.
11286 Set when the expressions for @option{x}, and @option{y} are evaluated.
11288 It accepts the following values:
11291 only evaluate expressions once during the filter initialization or
11292 when a command is processed
11295 evaluate expressions for each incoming frame
11298 Default value is @samp{frame}.
11301 See @ref{framesync}.
11304 Set the format for the output video.
11306 It accepts the following values:
11309 force YUV420 output
11312 force YUV422 output
11315 force YUV444 output
11318 force packed RGB output
11321 force planar RGB output
11324 automatically pick format
11327 Default value is @samp{yuv420}.
11330 See @ref{framesync}.
11333 The @option{x}, and @option{y} expressions can contain the following
11339 The main input width and height.
11343 The overlay input width and height.
11347 The computed values for @var{x} and @var{y}. They are evaluated for
11352 horizontal and vertical chroma subsample values of the output
11353 format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
11357 the number of input frame, starting from 0
11360 the position in the file of the input frame, NAN if unknown
11363 The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
11367 This filter also supports the @ref{framesync} options.
11369 Note that the @var{n}, @var{pos}, @var{t} variables are available only
11370 when evaluation is done @emph{per frame}, and will evaluate to NAN
11371 when @option{eval} is set to @samp{init}.
11373 Be aware that frames are taken from each input video in timestamp
11374 order, hence, if their initial timestamps differ, it is a good idea
11375 to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
11376 have them begin in the same zero timestamp, as the example for
11377 the @var{movie} filter does.
11379 You can chain together more overlays but you should test the
11380 efficiency of such approach.
11382 @subsection Commands
11384 This filter supports the following commands:
11388 Modify the x and y of the overlay input.
11389 The command accepts the same syntax of the corresponding option.
11391 If the specified expression is not valid, it is kept at its current
11395 @subsection Examples
11399 Draw the overlay at 10 pixels from the bottom right corner of the main
11402 overlay=main_w-overlay_w-10:main_h-overlay_h-10
11405 Using named options the example above becomes:
11407 overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
11411 Insert a transparent PNG logo in the bottom left corner of the input,
11412 using the @command{ffmpeg} tool with the @code{-filter_complex} option:
11414 ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
11418 Insert 2 different transparent PNG logos (second logo on bottom
11419 right corner) using the @command{ffmpeg} tool:
11421 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
11425 Add a transparent color layer on top of the main video; @code{WxH}
11426 must specify the size of the main input to the overlay filter:
11428 color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
11432 Play an original video and a filtered version (here with the deshake
11433 filter) side by side using the @command{ffplay} tool:
11435 ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
11438 The above command is the same as:
11440 ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
11444 Make a sliding overlay appearing from the left to the right top part of the
11445 screen starting since time 2:
11447 overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
11451 Compose output by putting two input videos side to side:
11453 ffmpeg -i left.avi -i right.avi -filter_complex "
11454 nullsrc=size=200x100 [background];
11455 [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
11456 [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
11457 [background][left] overlay=shortest=1 [background+left];
11458 [background+left][right] overlay=shortest=1:x=100 [left+right]
11463 Mask 10-20 seconds of a video by applying the delogo filter to a section
11465 ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
11466 -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]'
11471 Chain several overlays in cascade:
11473 nullsrc=s=200x200 [bg];
11474 testsrc=s=100x100, split=4 [in0][in1][in2][in3];
11475 [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
11476 [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
11477 [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
11478 [in3] null, [mid2] overlay=100:100 [out0]
11485 Apply Overcomplete Wavelet denoiser.
11487 The filter accepts the following options:
11493 Larger depth values will denoise lower frequency components more, but
11494 slow down filtering.
11496 Must be an int in the range 8-16, default is @code{8}.
11498 @item luma_strength, ls
11501 Must be a double value in the range 0-1000, default is @code{1.0}.
11503 @item chroma_strength, cs
11504 Set chroma strength.
11506 Must be a double value in the range 0-1000, default is @code{1.0}.
11512 Add paddings to the input image, and place the original input at the
11513 provided @var{x}, @var{y} coordinates.
11515 It accepts the following parameters:
11520 Specify an expression for the size of the output image with the
11521 paddings added. If the value for @var{width} or @var{height} is 0, the
11522 corresponding input size is used for the output.
11524 The @var{width} expression can reference the value set by the
11525 @var{height} expression, and vice versa.
11527 The default value of @var{width} and @var{height} is 0.
11531 Specify the offsets to place the input image at within the padded area,
11532 with respect to the top/left border of the output image.
11534 The @var{x} expression can reference the value set by the @var{y}
11535 expression, and vice versa.
11537 The default value of @var{x} and @var{y} is 0.
11539 If @var{x} or @var{y} evaluate to a negative number, they'll be changed
11540 so the input image is centered on the padded area.
11543 Specify the color of the padded area. For the syntax of this option,
11544 check the "Color" section in the ffmpeg-utils manual.
11546 The default value of @var{color} is "black".
11549 Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
11551 It accepts the following values:
11555 Only evaluate expressions once during the filter initialization or when
11556 a command is processed.
11559 Evaluate expressions for each incoming frame.
11563 Default value is @samp{init}.
11566 Pad to aspect instead to a resolution.
11570 The value for the @var{width}, @var{height}, @var{x}, and @var{y}
11571 options are expressions containing the following constants:
11576 The input video width and height.
11580 These are the same as @var{in_w} and @var{in_h}.
11584 The output width and height (the size of the padded area), as
11585 specified by the @var{width} and @var{height} expressions.
11589 These are the same as @var{out_w} and @var{out_h}.
11593 The x and y offsets as specified by the @var{x} and @var{y}
11594 expressions, or NAN if not yet specified.
11597 same as @var{iw} / @var{ih}
11600 input sample aspect ratio
11603 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
11607 The horizontal and vertical chroma subsample values. For example for the
11608 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
11611 @subsection Examples
11615 Add paddings with the color "violet" to the input video. The output video
11616 size is 640x480, and the top-left corner of the input video is placed at
11619 pad=640:480:0:40:violet
11622 The example above is equivalent to the following command:
11624 pad=width=640:height=480:x=0:y=40:color=violet
11628 Pad the input to get an output with dimensions increased by 3/2,
11629 and put the input video at the center of the padded area:
11631 pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
11635 Pad the input to get a squared output with size equal to the maximum
11636 value between the input width and height, and put the input video at
11637 the center of the padded area:
11639 pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
11643 Pad the input to get a final w/h ratio of 16:9:
11645 pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
11649 In case of anamorphic video, in order to set the output display aspect
11650 correctly, it is necessary to use @var{sar} in the expression,
11651 according to the relation:
11653 (ih * X / ih) * sar = output_dar
11654 X = output_dar / sar
11657 Thus the previous example needs to be modified to:
11659 pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
11663 Double the output size and put the input video in the bottom-right
11664 corner of the output padded area:
11666 pad="2*iw:2*ih:ow-iw:oh-ih"
11670 @anchor{palettegen}
11671 @section palettegen
11673 Generate one palette for a whole video stream.
11675 It accepts the following options:
11679 Set the maximum number of colors to quantize in the palette.
11680 Note: the palette will still contain 256 colors; the unused palette entries
11683 @item reserve_transparent
11684 Create a palette of 255 colors maximum and reserve the last one for
11685 transparency. Reserving the transparency color is useful for GIF optimization.
11686 If not set, the maximum of colors in the palette will be 256. You probably want
11687 to disable this option for a standalone image.
11690 @item transparency_color
11691 Set the color that will be used as background for transparency.
11694 Set statistics mode.
11696 It accepts the following values:
11699 Compute full frame histograms.
11701 Compute histograms only for the part that differs from previous frame. This
11702 might be relevant to give more importance to the moving part of your input if
11703 the background is static.
11705 Compute new histogram for each frame.
11708 Default value is @var{full}.
11711 The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
11712 (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
11713 color quantization of the palette. This information is also visible at
11714 @var{info} logging level.
11716 @subsection Examples
11720 Generate a representative palette of a given video using @command{ffmpeg}:
11722 ffmpeg -i input.mkv -vf palettegen palette.png
11726 @section paletteuse
11728 Use a palette to downsample an input video stream.
11730 The filter takes two inputs: one video stream and a palette. The palette must
11731 be a 256 pixels image.
11733 It accepts the following options:
11737 Select dithering mode. Available algorithms are:
11740 Ordered 8x8 bayer dithering (deterministic)
11742 Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
11743 Note: this dithering is sometimes considered "wrong" and is included as a
11745 @item floyd_steinberg
11746 Floyd and Steingberg dithering (error diffusion)
11748 Frankie Sierra dithering v2 (error diffusion)
11750 Frankie Sierra dithering v2 "Lite" (error diffusion)
11753 Default is @var{sierra2_4a}.
11756 When @var{bayer} dithering is selected, this option defines the scale of the
11757 pattern (how much the crosshatch pattern is visible). A low value means more
11758 visible pattern for less banding, and higher value means less visible pattern
11759 at the cost of more banding.
11761 The option must be an integer value in the range [0,5]. Default is @var{2}.
11764 If set, define the zone to process
11768 Only the changing rectangle will be reprocessed. This is similar to GIF
11769 cropping/offsetting compression mechanism. This option can be useful for speed
11770 if only a part of the image is changing, and has use cases such as limiting the
11771 scope of the error diffusal @option{dither} to the rectangle that bounds the
11772 moving scene (it leads to more deterministic output if the scene doesn't change
11773 much, and as a result less moving noise and better GIF compression).
11776 Default is @var{none}.
11779 Take new palette for each output frame.
11781 @item alpha_threshold
11782 Sets the alpha threshold for transparency. Alpha values above this threshold
11783 will be treated as completely opaque, and values below this threshold will be
11784 treated as completely transparent.
11786 The option must be an integer value in the range [0,255]. Default is @var{128}.
11789 @subsection Examples
11793 Use a palette (generated for example with @ref{palettegen}) to encode a GIF
11794 using @command{ffmpeg}:
11796 ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
11800 @section perspective
11802 Correct perspective of video not recorded perpendicular to the screen.
11804 A description of the accepted parameters follows.
11815 Set coordinates expression for top left, top right, bottom left and bottom right corners.
11816 Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
11817 If the @code{sense} option is set to @code{source}, then the specified points will be sent
11818 to the corners of the destination. If the @code{sense} option is set to @code{destination},
11819 then the corners of the source will be sent to the specified coordinates.
11821 The expressions can use the following variables:
11826 the width and height of video frame.
11830 Output frame count.
11833 @item interpolation
11834 Set interpolation for perspective correction.
11836 It accepts the following values:
11842 Default value is @samp{linear}.
11845 Set interpretation of coordinate options.
11847 It accepts the following values:
11851 Send point in the source specified by the given coordinates to
11852 the corners of the destination.
11854 @item 1, destination
11856 Send the corners of the source to the point in the destination specified
11857 by the given coordinates.
11859 Default value is @samp{source}.
11863 Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
11865 It accepts the following values:
11868 only evaluate expressions once during the filter initialization or
11869 when a command is processed
11872 evaluate expressions for each incoming frame
11875 Default value is @samp{init}.
11880 Delay interlaced video by one field time so that the field order changes.
11882 The intended use is to fix PAL movies that have been captured with the
11883 opposite field order to the film-to-video transfer.
11885 A description of the accepted parameters follows.
11891 It accepts the following values:
11894 Capture field order top-first, transfer bottom-first.
11895 Filter will delay the bottom field.
11898 Capture field order bottom-first, transfer top-first.
11899 Filter will delay the top field.
11902 Capture and transfer with the same field order. This mode only exists
11903 for the documentation of the other options to refer to, but if you
11904 actually select it, the filter will faithfully do nothing.
11907 Capture field order determined automatically by field flags, transfer
11909 Filter selects among @samp{t} and @samp{b} modes on a frame by frame
11910 basis using field flags. If no field information is available,
11911 then this works just like @samp{u}.
11914 Capture unknown or varying, transfer opposite.
11915 Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
11916 analyzing the images and selecting the alternative that produces best
11917 match between the fields.
11920 Capture top-first, transfer unknown or varying.
11921 Filter selects among @samp{t} and @samp{p} using image analysis.
11924 Capture bottom-first, transfer unknown or varying.
11925 Filter selects among @samp{b} and @samp{p} using image analysis.
11928 Capture determined by field flags, transfer unknown or varying.
11929 Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
11930 image analysis. If no field information is available, then this works just
11931 like @samp{U}. This is the default mode.
11934 Both capture and transfer unknown or varying.
11935 Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
11939 @section pixdesctest
11941 Pixel format descriptor test filter, mainly useful for internal
11942 testing. The output video should be equal to the input video.
11946 format=monow, pixdesctest
11949 can be used to test the monowhite pixel format descriptor definition.
11953 Display sample values of color channels. Mainly useful for checking color
11954 and levels. Minimum supported resolution is 640x480.
11956 The filters accept the following options:
11960 Set scope X position, relative offset on X axis.
11963 Set scope Y position, relative offset on Y axis.
11972 Set window opacity. This window also holds statistics about pixel area.
11975 Set window X position, relative offset on X axis.
11978 Set window Y position, relative offset on Y axis.
11983 Enable the specified chain of postprocessing subfilters using libpostproc. This
11984 library should be automatically selected with a GPL build (@code{--enable-gpl}).
11985 Subfilters must be separated by '/' and can be disabled by prepending a '-'.
11986 Each subfilter and some options have a short and a long name that can be used
11987 interchangeably, i.e. dr/dering are the same.
11989 The filters accept the following options:
11993 Set postprocessing subfilters string.
11996 All subfilters share common options to determine their scope:
12000 Honor the quality commands for this subfilter.
12003 Do chrominance filtering, too (default).
12006 Do luminance filtering only (no chrominance).
12009 Do chrominance filtering only (no luminance).
12012 These options can be appended after the subfilter name, separated by a '|'.
12014 Available subfilters are:
12017 @item hb/hdeblock[|difference[|flatness]]
12018 Horizontal deblocking filter
12021 Difference factor where higher values mean more deblocking (default: @code{32}).
12023 Flatness threshold where lower values mean more deblocking (default: @code{39}).
12026 @item vb/vdeblock[|difference[|flatness]]
12027 Vertical deblocking filter
12030 Difference factor where higher values mean more deblocking (default: @code{32}).
12032 Flatness threshold where lower values mean more deblocking (default: @code{39}).
12035 @item ha/hadeblock[|difference[|flatness]]
12036 Accurate horizontal deblocking filter
12039 Difference factor where higher values mean more deblocking (default: @code{32}).
12041 Flatness threshold where lower values mean more deblocking (default: @code{39}).
12044 @item va/vadeblock[|difference[|flatness]]
12045 Accurate vertical deblocking filter
12048 Difference factor where higher values mean more deblocking (default: @code{32}).
12050 Flatness threshold where lower values mean more deblocking (default: @code{39}).
12054 The horizontal and vertical deblocking filters share the difference and
12055 flatness values so you cannot set different horizontal and vertical
12059 @item h1/x1hdeblock
12060 Experimental horizontal deblocking filter
12062 @item v1/x1vdeblock
12063 Experimental vertical deblocking filter
12068 @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
12071 larger -> stronger filtering
12073 larger -> stronger filtering
12075 larger -> stronger filtering
12078 @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
12081 Stretch luminance to @code{0-255}.
12084 @item lb/linblenddeint
12085 Linear blend deinterlacing filter that deinterlaces the given block by
12086 filtering all lines with a @code{(1 2 1)} filter.
12088 @item li/linipoldeint
12089 Linear interpolating deinterlacing filter that deinterlaces the given block by
12090 linearly interpolating every second line.
12092 @item ci/cubicipoldeint
12093 Cubic interpolating deinterlacing filter deinterlaces the given block by
12094 cubically interpolating every second line.
12096 @item md/mediandeint
12097 Median deinterlacing filter that deinterlaces the given block by applying a
12098 median filter to every second line.
12100 @item fd/ffmpegdeint
12101 FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
12102 second line with a @code{(-1 4 2 4 -1)} filter.
12105 Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
12106 block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
12108 @item fq/forceQuant[|quantizer]
12109 Overrides the quantizer table from the input with the constant quantizer you
12117 Default pp filter combination (@code{hb|a,vb|a,dr|a})
12120 Fast pp filter combination (@code{h1|a,v1|a,dr|a})
12123 High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
12126 @subsection Examples
12130 Apply horizontal and vertical deblocking, deringing and automatic
12131 brightness/contrast:
12137 Apply default filters without brightness/contrast correction:
12143 Apply default filters and temporal denoiser:
12145 pp=default/tmpnoise|1|2|3
12149 Apply deblocking on luminance only, and switch vertical deblocking on or off
12150 automatically depending on available CPU time:
12157 Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
12158 similar to spp = 6 with 7 point DCT, where only the center sample is
12161 The filter accepts the following options:
12165 Force a constant quantization parameter. It accepts an integer in range
12166 0 to 63. If not set, the filter will use the QP from the video stream
12170 Set thresholding mode. Available modes are:
12174 Set hard thresholding.
12176 Set soft thresholding (better de-ringing effect, but likely blurrier).
12178 Set medium thresholding (good results, default).
12182 @section premultiply
12183 Apply alpha premultiply effect to input video stream using first plane
12184 of second stream as alpha.
12186 Both streams must have same dimensions and same pixel format.
12188 The filter accepts the following option:
12192 Set which planes will be processed, unprocessed planes will be copied.
12193 By default value 0xf, all planes will be processed.
12196 Do not require 2nd input for processing, instead use alpha plane from input stream.
12200 Apply prewitt operator to input video stream.
12202 The filter accepts the following option:
12206 Set which planes will be processed, unprocessed planes will be copied.
12207 By default value 0xf, all planes will be processed.
12210 Set value which will be multiplied with filtered result.
12213 Set value which will be added to filtered result.
12216 @section pseudocolor
12218 Alter frame colors in video with pseudocolors.
12220 This filter accept the following options:
12224 set pixel first component expression
12227 set pixel second component expression
12230 set pixel third component expression
12233 set pixel fourth component expression, corresponds to the alpha component
12236 set component to use as base for altering colors
12239 Each of them specifies the expression to use for computing the lookup table for
12240 the corresponding pixel component values.
12242 The expressions can contain the following constants and functions:
12247 The input width and height.
12250 The input value for the pixel component.
12252 @item ymin, umin, vmin, amin
12253 The minimum allowed component value.
12255 @item ymax, umax, vmax, amax
12256 The maximum allowed component value.
12259 All expressions default to "val".
12261 @subsection Examples
12265 Change too high luma values to gradient:
12267 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'"
12273 Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
12274 Ratio) between two input videos.
12276 This filter takes in input two input videos, the first input is
12277 considered the "main" source and is passed unchanged to the
12278 output. The second input is used as a "reference" video for computing
12281 Both video inputs must have the same resolution and pixel format for
12282 this filter to work correctly. Also it assumes that both inputs
12283 have the same number of frames, which are compared one by one.
12285 The obtained average PSNR is printed through the logging system.
12287 The filter stores the accumulated MSE (mean squared error) of each
12288 frame, and at the end of the processing it is averaged across all frames
12289 equally, and the following formula is applied to obtain the PSNR:
12292 PSNR = 10*log10(MAX^2/MSE)
12295 Where MAX is the average of the maximum values of each component of the
12298 The description of the accepted parameters follows.
12301 @item stats_file, f
12302 If specified the filter will use the named file to save the PSNR of
12303 each individual frame. When filename equals "-" the data is sent to
12306 @item stats_version
12307 Specifies which version of the stats file format to use. Details of
12308 each format are written below.
12309 Default value is 1.
12311 @item stats_add_max
12312 Determines whether the max value is output to the stats log.
12313 Default value is 0.
12314 Requires stats_version >= 2. If this is set and stats_version < 2,
12315 the filter will return an error.
12318 This filter also supports the @ref{framesync} options.
12320 The file printed if @var{stats_file} is selected, contains a sequence of
12321 key/value pairs of the form @var{key}:@var{value} for each compared
12324 If a @var{stats_version} greater than 1 is specified, a header line precedes
12325 the list of per-frame-pair stats, with key value pairs following the frame
12326 format with the following parameters:
12329 @item psnr_log_version
12330 The version of the log file format. Will match @var{stats_version}.
12333 A comma separated list of the per-frame-pair parameters included in
12337 A description of each shown per-frame-pair parameter follows:
12341 sequential number of the input frame, starting from 1
12344 Mean Square Error pixel-by-pixel average difference of the compared
12345 frames, averaged over all the image components.
12347 @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
12348 Mean Square Error pixel-by-pixel average difference of the compared
12349 frames for the component specified by the suffix.
12351 @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
12352 Peak Signal to Noise ratio of the compared frames for the component
12353 specified by the suffix.
12355 @item max_avg, max_y, max_u, max_v
12356 Maximum allowed value for each channel, and average over all
12362 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
12363 [main][ref] psnr="stats_file=stats.log" [out]
12366 On this example the input file being processed is compared with the
12367 reference file @file{ref_movie.mpg}. The PSNR of each individual frame
12368 is stored in @file{stats.log}.
12373 Pulldown reversal (inverse telecine) filter, capable of handling mixed
12374 hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
12377 The pullup filter is designed to take advantage of future context in making
12378 its decisions. This filter is stateless in the sense that it does not lock
12379 onto a pattern to follow, but it instead looks forward to the following
12380 fields in order to identify matches and rebuild progressive frames.
12382 To produce content with an even framerate, insert the fps filter after
12383 pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
12384 @code{fps=24} for 30fps and the (rare) telecined 25fps input.
12386 The filter accepts the following options:
12393 These options set the amount of "junk" to ignore at the left, right, top, and
12394 bottom of the image, respectively. Left and right are in units of 8 pixels,
12395 while top and bottom are in units of 2 lines.
12396 The default is 8 pixels on each side.
12399 Set the strict breaks. Setting this option to 1 will reduce the chances of
12400 filter generating an occasional mismatched frame, but it may also cause an
12401 excessive number of frames to be dropped during high motion sequences.
12402 Conversely, setting it to -1 will make filter match fields more easily.
12403 This may help processing of video where there is slight blurring between
12404 the fields, but may also cause there to be interlaced frames in the output.
12405 Default value is @code{0}.
12408 Set the metric plane to use. It accepts the following values:
12414 Use chroma blue plane.
12417 Use chroma red plane.
12420 This option may be set to use chroma plane instead of the default luma plane
12421 for doing filter's computations. This may improve accuracy on very clean
12422 source material, but more likely will decrease accuracy, especially if there
12423 is chroma noise (rainbow effect) or any grayscale video.
12424 The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
12425 load and make pullup usable in realtime on slow machines.
12428 For best results (without duplicated frames in the output file) it is
12429 necessary to change the output frame rate. For example, to inverse
12430 telecine NTSC input:
12432 ffmpeg -i input -vf pullup -r 24000/1001 ...
12437 Change video quantization parameters (QP).
12439 The filter accepts the following option:
12443 Set expression for quantization parameter.
12446 The expression is evaluated through the eval API and can contain, among others,
12447 the following constants:
12451 1 if index is not 129, 0 otherwise.
12454 Sequential index starting from -129 to 128.
12457 @subsection Examples
12461 Some equation like:
12469 Flush video frames from internal cache of frames into a random order.
12470 No frame is discarded.
12471 Inspired by @ref{frei0r} nervous filter.
12475 Set size in number of frames of internal cache, in range from @code{2} to
12476 @code{512}. Default is @code{30}.
12479 Set seed for random number generator, must be an integer included between
12480 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
12481 less than @code{0}, the filter will try to use a good random seed on a
12485 @section readeia608
12487 Read closed captioning (EIA-608) information from the top lines of a video frame.
12489 This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
12490 @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
12491 with EIA-608 data (starting from 0). A description of each metadata value follows:
12494 @item lavfi.readeia608.X.cc
12495 The two bytes stored as EIA-608 data (printed in hexadecimal).
12497 @item lavfi.readeia608.X.line
12498 The number of the line on which the EIA-608 data was identified and read.
12501 This filter accepts the following options:
12505 Set the line to start scanning for EIA-608 data. Default is @code{0}.
12508 Set the line to end scanning for EIA-608 data. Default is @code{29}.
12511 Set minimal acceptable amplitude change for sync codes detection.
12512 Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
12515 Set the ratio of width reserved for sync code detection.
12516 Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
12519 Set the max peaks height difference for sync code detection.
12520 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
12523 Set max peaks period difference for sync code detection.
12524 Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
12527 Set the first two max start code bits differences.
12528 Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
12531 Set the minimum ratio of bits height compared to 3rd start code bit.
12532 Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
12535 Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
12538 Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
12541 Enable checking the parity bit. In the event of a parity error, the filter will output
12542 @code{0x00} for that character. Default is false.
12545 @subsection Examples
12549 Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
12551 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
12557 Read vertical interval timecode (VITC) information from the top lines of a
12560 The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
12561 timecode value, if a valid timecode has been detected. Further metadata key
12562 @code{lavfi.readvitc.found} is set to 0/1 depending on whether
12563 timecode data has been found or not.
12565 This filter accepts the following options:
12569 Set the maximum number of lines to scan for VITC data. If the value is set to
12570 @code{-1} the full video frame is scanned. Default is @code{45}.
12573 Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
12574 default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
12577 Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
12578 default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
12581 @subsection Examples
12585 Detect and draw VITC data onto the video frame; if no valid VITC is detected,
12586 draw @code{--:--:--:--} as a placeholder:
12588 ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
12594 Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
12596 Destination pixel at position (X, Y) will be picked from source (x, y) position
12597 where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
12598 value for pixel will be used for destination pixel.
12600 Xmap and Ymap input video streams must be of same dimensions. Output video stream
12601 will have Xmap/Ymap video stream dimensions.
12602 Xmap and Ymap input video streams are 16bit depth, single channel.
12604 @section removegrain
12606 The removegrain filter is a spatial denoiser for progressive video.
12610 Set mode for the first plane.
12613 Set mode for the second plane.
12616 Set mode for the third plane.
12619 Set mode for the fourth plane.
12622 Range of mode is from 0 to 24. Description of each mode follows:
12626 Leave input plane unchanged. Default.
12629 Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
12632 Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
12635 Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
12638 Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
12639 This is equivalent to a median filter.
12642 Line-sensitive clipping giving the minimal change.
12645 Line-sensitive clipping, intermediate.
12648 Line-sensitive clipping, intermediate.
12651 Line-sensitive clipping, intermediate.
12654 Line-sensitive clipping on a line where the neighbours pixels are the closest.
12657 Replaces the target pixel with the closest neighbour.
12660 [1 2 1] horizontal and vertical kernel blur.
12666 Bob mode, interpolates top field from the line where the neighbours
12667 pixels are the closest.
12670 Bob mode, interpolates bottom field from the line where the neighbours
12671 pixels are the closest.
12674 Bob mode, interpolates top field. Same as 13 but with a more complicated
12675 interpolation formula.
12678 Bob mode, interpolates bottom field. Same as 14 but with a more complicated
12679 interpolation formula.
12682 Clips the pixel with the minimum and maximum of respectively the maximum and
12683 minimum of each pair of opposite neighbour pixels.
12686 Line-sensitive clipping using opposite neighbours whose greatest distance from
12687 the current pixel is minimal.
12690 Replaces the pixel with the average of its 8 neighbours.
12693 Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
12696 Clips pixels using the averages of opposite neighbour.
12699 Same as mode 21 but simpler and faster.
12702 Small edge and halo removal, but reputed useless.
12708 @section removelogo
12710 Suppress a TV station logo, using an image file to determine which
12711 pixels comprise the logo. It works by filling in the pixels that
12712 comprise the logo with neighboring pixels.
12714 The filter accepts the following options:
12718 Set the filter bitmap file, which can be any image format supported by
12719 libavformat. The width and height of the image file must match those of the
12720 video stream being processed.
12723 Pixels in the provided bitmap image with a value of zero are not
12724 considered part of the logo, non-zero pixels are considered part of
12725 the logo. If you use white (255) for the logo and black (0) for the
12726 rest, you will be safe. For making the filter bitmap, it is
12727 recommended to take a screen capture of a black frame with the logo
12728 visible, and then using a threshold filter followed by the erode
12729 filter once or twice.
12731 If needed, little splotches can be fixed manually. Remember that if
12732 logo pixels are not covered, the filter quality will be much
12733 reduced. Marking too many pixels as part of the logo does not hurt as
12734 much, but it will increase the amount of blurring needed to cover over
12735 the image and will destroy more information than necessary, and extra
12736 pixels will slow things down on a large logo.
12738 @section repeatfields
12740 This filter uses the repeat_field flag from the Video ES headers and hard repeats
12741 fields based on its value.
12745 Reverse a video clip.
12747 Warning: This filter requires memory to buffer the entire clip, so trimming
12750 @subsection Examples
12754 Take the first 5 seconds of a clip, and reverse it.
12761 Apply roberts cross operator to input video stream.
12763 The filter accepts the following option:
12767 Set which planes will be processed, unprocessed planes will be copied.
12768 By default value 0xf, all planes will be processed.
12771 Set value which will be multiplied with filtered result.
12774 Set value which will be added to filtered result.
12779 Rotate video by an arbitrary angle expressed in radians.
12781 The filter accepts the following options:
12783 A description of the optional parameters follows.
12786 Set an expression for the angle by which to rotate the input video
12787 clockwise, expressed as a number of radians. A negative value will
12788 result in a counter-clockwise rotation. By default it is set to "0".
12790 This expression is evaluated for each frame.
12793 Set the output width expression, default value is "iw".
12794 This expression is evaluated just once during configuration.
12797 Set the output height expression, default value is "ih".
12798 This expression is evaluated just once during configuration.
12801 Enable bilinear interpolation if set to 1, a value of 0 disables
12802 it. Default value is 1.
12805 Set the color used to fill the output area not covered by the rotated
12806 image. For the general syntax of this option, check the "Color" section in the
12807 ffmpeg-utils manual. If the special value "none" is selected then no
12808 background is printed (useful for example if the background is never shown).
12810 Default value is "black".
12813 The expressions for the angle and the output size can contain the
12814 following constants and functions:
12818 sequential number of the input frame, starting from 0. It is always NAN
12819 before the first frame is filtered.
12822 time in seconds of the input frame, it is set to 0 when the filter is
12823 configured. It is always NAN before the first frame is filtered.
12827 horizontal and vertical chroma subsample values. For example for the
12828 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
12832 the input video width and height
12836 the output width and height, that is the size of the padded area as
12837 specified by the @var{width} and @var{height} expressions
12841 the minimal width/height required for completely containing the input
12842 video rotated by @var{a} radians.
12844 These are only available when computing the @option{out_w} and
12845 @option{out_h} expressions.
12848 @subsection Examples
12852 Rotate the input by PI/6 radians clockwise:
12858 Rotate the input by PI/6 radians counter-clockwise:
12864 Rotate the input by 45 degrees clockwise:
12870 Apply a constant rotation with period T, starting from an angle of PI/3:
12872 rotate=PI/3+2*PI*t/T
12876 Make the input video rotation oscillating with a period of T
12877 seconds and an amplitude of A radians:
12879 rotate=A*sin(2*PI/T*t)
12883 Rotate the video, output size is chosen so that the whole rotating
12884 input video is always completely contained in the output:
12886 rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
12890 Rotate the video, reduce the output size so that no background is ever
12893 rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
12897 @subsection Commands
12899 The filter supports the following commands:
12903 Set the angle expression.
12904 The command accepts the same syntax of the corresponding option.
12906 If the specified expression is not valid, it is kept at its current
12912 Apply Shape Adaptive Blur.
12914 The filter accepts the following options:
12917 @item luma_radius, lr
12918 Set luma blur filter strength, must be a value in range 0.1-4.0, default
12919 value is 1.0. A greater value will result in a more blurred image, and
12920 in slower processing.
12922 @item luma_pre_filter_radius, lpfr
12923 Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
12926 @item luma_strength, ls
12927 Set luma maximum difference between pixels to still be considered, must
12928 be a value in the 0.1-100.0 range, default value is 1.0.
12930 @item chroma_radius, cr
12931 Set chroma blur filter strength, must be a value in range -0.9-4.0. A
12932 greater value will result in a more blurred image, and in slower
12935 @item chroma_pre_filter_radius, cpfr
12936 Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
12938 @item chroma_strength, cs
12939 Set chroma maximum difference between pixels to still be considered,
12940 must be a value in the -0.9-100.0 range.
12943 Each chroma option value, if not explicitly specified, is set to the
12944 corresponding luma option value.
12949 Scale (resize) the input video, using the libswscale library.
12951 The scale filter forces the output display aspect ratio to be the same
12952 of the input, by changing the output sample aspect ratio.
12954 If the input image format is different from the format requested by
12955 the next filter, the scale filter will convert the input to the
12958 @subsection Options
12959 The filter accepts the following options, or any of the options
12960 supported by the libswscale scaler.
12962 See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
12963 the complete list of scaler options.
12968 Set the output video dimension expression. Default value is the input
12971 If the @var{width} or @var{w} value is 0, the input width is used for
12972 the output. If the @var{height} or @var{h} value is 0, the input height
12973 is used for the output.
12975 If one and only one of the values is -n with n >= 1, the scale filter
12976 will use a value that maintains the aspect ratio of the input image,
12977 calculated from the other specified dimension. After that it will,
12978 however, make sure that the calculated dimension is divisible by n and
12979 adjust the value if necessary.
12981 If both values are -n with n >= 1, the behavior will be identical to
12982 both values being set to 0 as previously detailed.
12984 See below for the list of accepted constants for use in the dimension
12988 Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
12992 Only evaluate expressions once during the filter initialization or when a command is processed.
12995 Evaluate expressions for each incoming frame.
12999 Default value is @samp{init}.
13003 Set the interlacing mode. It accepts the following values:
13007 Force interlaced aware scaling.
13010 Do not apply interlaced scaling.
13013 Select interlaced aware scaling depending on whether the source frames
13014 are flagged as interlaced or not.
13017 Default value is @samp{0}.
13020 Set libswscale scaling flags. See
13021 @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
13022 complete list of values. If not explicitly specified the filter applies
13026 @item param0, param1
13027 Set libswscale input parameters for scaling algorithms that need them. See
13028 @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
13029 complete documentation. If not explicitly specified the filter applies
13035 Set the video size. For the syntax of this option, check the
13036 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
13038 @item in_color_matrix
13039 @item out_color_matrix
13040 Set in/output YCbCr color space type.
13042 This allows the autodetected value to be overridden as well as allows forcing
13043 a specific value used for the output and encoder.
13045 If not specified, the color space type depends on the pixel format.
13051 Choose automatically.
13054 Format conforming to International Telecommunication Union (ITU)
13055 Recommendation BT.709.
13058 Set color space conforming to the United States Federal Communications
13059 Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
13062 Set color space conforming to:
13066 ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
13069 ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
13072 Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
13077 Set color space conforming to SMPTE ST 240:1999.
13082 Set in/output YCbCr sample range.
13084 This allows the autodetected value to be overridden as well as allows forcing
13085 a specific value used for the output and encoder. If not specified, the
13086 range depends on the pixel format. Possible values:
13090 Choose automatically.
13093 Set full range (0-255 in case of 8-bit luma).
13095 @item mpeg/limited/tv
13096 Set "MPEG" range (16-235 in case of 8-bit luma).
13099 @item force_original_aspect_ratio
13100 Enable decreasing or increasing output video width or height if necessary to
13101 keep the original aspect ratio. Possible values:
13105 Scale the video as specified and disable this feature.
13108 The output video dimensions will automatically be decreased if needed.
13111 The output video dimensions will automatically be increased if needed.
13115 One useful instance of this option is that when you know a specific device's
13116 maximum allowed resolution, you can use this to limit the output video to
13117 that, while retaining the aspect ratio. For example, device A allows
13118 1280x720 playback, and your video is 1920x800. Using this option (set it to
13119 decrease) and specifying 1280x720 to the command line makes the output
13122 Please note that this is a different thing than specifying -1 for @option{w}
13123 or @option{h}, you still need to specify the output resolution for this option
13128 The values of the @option{w} and @option{h} options are expressions
13129 containing the following constants:
13134 The input width and height
13138 These are the same as @var{in_w} and @var{in_h}.
13142 The output (scaled) width and height
13146 These are the same as @var{out_w} and @var{out_h}
13149 The same as @var{iw} / @var{ih}
13152 input sample aspect ratio
13155 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
13159 horizontal and vertical input chroma subsample values. For example for the
13160 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
13164 horizontal and vertical output chroma subsample values. For example for the
13165 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
13168 @subsection Examples
13172 Scale the input video to a size of 200x100
13177 This is equivalent to:
13188 Specify a size abbreviation for the output size:
13193 which can also be written as:
13199 Scale the input to 2x:
13201 scale=w=2*iw:h=2*ih
13205 The above is the same as:
13207 scale=2*in_w:2*in_h
13211 Scale the input to 2x with forced interlaced scaling:
13213 scale=2*iw:2*ih:interl=1
13217 Scale the input to half size:
13219 scale=w=iw/2:h=ih/2
13223 Increase the width, and set the height to the same size:
13229 Seek Greek harmony:
13236 Increase the height, and set the width to 3/2 of the height:
13238 scale=w=3/2*oh:h=3/5*ih
13242 Increase the size, making the size a multiple of the chroma
13245 scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
13249 Increase the width to a maximum of 500 pixels,
13250 keeping the same aspect ratio as the input:
13252 scale=w='min(500\, iw*3/2):h=-1'
13256 @subsection Commands
13258 This filter supports the following commands:
13262 Set the output video dimension expression.
13263 The command accepts the same syntax of the corresponding option.
13265 If the specified expression is not valid, it is kept at its current
13271 Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
13272 format conversion on CUDA video frames. Setting the output width and height
13273 works in the same way as for the @var{scale} filter.
13275 The following additional options are accepted:
13278 The pixel format of the output CUDA frames. If set to the string "same" (the
13279 default), the input format will be kept. Note that automatic format negotiation
13280 and conversion is not yet supported for hardware frames
13283 The interpolation algorithm used for resizing. One of the following:
13290 @item cubic2p_bspline
13291 2-parameter cubic (B=1, C=0)
13293 @item cubic2p_catmullrom
13294 2-parameter cubic (B=0, C=1/2)
13296 @item cubic2p_b05c03
13297 2-parameter cubic (B=1/2, C=3/10)
13309 Scale (resize) the input video, based on a reference video.
13311 See the scale filter for available options, scale2ref supports the same but
13312 uses the reference video instead of the main input as basis. scale2ref also
13313 supports the following additional constants for the @option{w} and
13314 @option{h} options:
13319 The main input video's width and height
13322 The same as @var{main_w} / @var{main_h}
13325 The main input video's sample aspect ratio
13327 @item main_dar, mdar
13328 The main input video's display aspect ratio. Calculated from
13329 @code{(main_w / main_h) * main_sar}.
13333 The main input video's horizontal and vertical chroma subsample values.
13334 For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
13338 @subsection Examples
13342 Scale a subtitle stream (b) to match the main video (a) in size before overlaying
13344 'scale2ref[b][a];[a][b]overlay'
13348 @anchor{selectivecolor}
13349 @section selectivecolor
13351 Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
13352 as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
13353 by the "purity" of the color (that is, how saturated it already is).
13355 This filter is similar to the Adobe Photoshop Selective Color tool.
13357 The filter accepts the following options:
13360 @item correction_method
13361 Select color correction method.
13363 Available values are:
13366 Specified adjustments are applied "as-is" (added/subtracted to original pixel
13369 Specified adjustments are relative to the original component value.
13371 Default is @code{absolute}.
13373 Adjustments for red pixels (pixels where the red component is the maximum)
13375 Adjustments for yellow pixels (pixels where the blue component is the minimum)
13377 Adjustments for green pixels (pixels where the green component is the maximum)
13379 Adjustments for cyan pixels (pixels where the red component is the minimum)
13381 Adjustments for blue pixels (pixels where the blue component is the maximum)
13383 Adjustments for magenta pixels (pixels where the green component is the minimum)
13385 Adjustments for white pixels (pixels where all components are greater than 128)
13387 Adjustments for all pixels except pure black and pure white
13389 Adjustments for black pixels (pixels where all components are lesser than 128)
13391 Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
13394 All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
13395 4 space separated floating point adjustment values in the [-1,1] range,
13396 respectively to adjust the amount of cyan, magenta, yellow and black for the
13397 pixels of its range.
13399 @subsection Examples
13403 Increase cyan by 50% and reduce yellow by 33% in every green areas, and
13404 increase magenta by 27% in blue areas:
13406 selectivecolor=greens=.5 0 -.33 0:blues=0 .27
13410 Use a Photoshop selective color preset:
13412 selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
13416 @anchor{separatefields}
13417 @section separatefields
13419 The @code{separatefields} takes a frame-based video input and splits
13420 each frame into its components fields, producing a new half height clip
13421 with twice the frame rate and twice the frame count.
13423 This filter use field-dominance information in frame to decide which
13424 of each pair of fields to place first in the output.
13425 If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
13427 @section setdar, setsar
13429 The @code{setdar} filter sets the Display Aspect Ratio for the filter
13432 This is done by changing the specified Sample (aka Pixel) Aspect
13433 Ratio, according to the following equation:
13435 @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
13438 Keep in mind that the @code{setdar} filter does not modify the pixel
13439 dimensions of the video frame. Also, the display aspect ratio set by
13440 this filter may be changed by later filters in the filterchain,
13441 e.g. in case of scaling or if another "setdar" or a "setsar" filter is
13444 The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
13445 the filter output video.
13447 Note that as a consequence of the application of this filter, the
13448 output display aspect ratio will change according to the equation
13451 Keep in mind that the sample aspect ratio set by the @code{setsar}
13452 filter may be changed by later filters in the filterchain, e.g. if
13453 another "setsar" or a "setdar" filter is applied.
13455 It accepts the following parameters:
13458 @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
13459 Set the aspect ratio used by the filter.
13461 The parameter can be a floating point number string, an expression, or
13462 a string of the form @var{num}:@var{den}, where @var{num} and
13463 @var{den} are the numerator and denominator of the aspect ratio. If
13464 the parameter is not specified, it is assumed the value "0".
13465 In case the form "@var{num}:@var{den}" is used, the @code{:} character
13469 Set the maximum integer value to use for expressing numerator and
13470 denominator when reducing the expressed aspect ratio to a rational.
13471 Default value is @code{100}.
13475 The parameter @var{sar} is an expression containing
13476 the following constants:
13480 These are approximated values for the mathematical constants e
13481 (Euler's number), pi (Greek pi), and phi (the golden ratio).
13484 The input width and height.
13487 These are the same as @var{w} / @var{h}.
13490 The input sample aspect ratio.
13493 The input display aspect ratio. It is the same as
13494 (@var{w} / @var{h}) * @var{sar}.
13497 Horizontal and vertical chroma subsample values. For example, for the
13498 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
13501 @subsection Examples
13506 To change the display aspect ratio to 16:9, specify one of the following:
13513 To change the sample aspect ratio to 10:11, specify:
13519 To set a display aspect ratio of 16:9, and specify a maximum integer value of
13520 1000 in the aspect ratio reduction, use the command:
13522 setdar=ratio=16/9:max=1000
13530 Force field for the output video frame.
13532 The @code{setfield} filter marks the interlace type field for the
13533 output frames. It does not change the input frame, but only sets the
13534 corresponding property, which affects how the frame is treated by
13535 following filters (e.g. @code{fieldorder} or @code{yadif}).
13537 The filter accepts the following options:
13542 Available values are:
13546 Keep the same field property.
13549 Mark the frame as bottom-field-first.
13552 Mark the frame as top-field-first.
13555 Mark the frame as progressive.
13561 Show a line containing various information for each input video frame.
13562 The input video is not modified.
13564 The shown line contains a sequence of key/value pairs of the form
13565 @var{key}:@var{value}.
13567 The following values are shown in the output:
13571 The (sequential) number of the input frame, starting from 0.
13574 The Presentation TimeStamp of the input frame, expressed as a number of
13575 time base units. The time base unit depends on the filter input pad.
13578 The Presentation TimeStamp of the input frame, expressed as a number of
13582 The position of the frame in the input stream, or -1 if this information is
13583 unavailable and/or meaningless (for example in case of synthetic video).
13586 The pixel format name.
13589 The sample aspect ratio of the input frame, expressed in the form
13590 @var{num}/@var{den}.
13593 The size of the input frame. For the syntax of this option, check the
13594 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
13597 The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
13598 for bottom field first).
13601 This is 1 if the frame is a key frame, 0 otherwise.
13604 The picture type of the input frame ("I" for an I-frame, "P" for a
13605 P-frame, "B" for a B-frame, or "?" for an unknown type).
13606 Also refer to the documentation of the @code{AVPictureType} enum and of
13607 the @code{av_get_picture_type_char} function defined in
13608 @file{libavutil/avutil.h}.
13611 The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
13613 @item plane_checksum
13614 The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
13615 expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
13618 @section showpalette
13620 Displays the 256 colors palette of each frame. This filter is only relevant for
13621 @var{pal8} pixel format frames.
13623 It accepts the following option:
13627 Set the size of the box used to represent one palette color entry. Default is
13628 @code{30} (for a @code{30x30} pixel box).
13631 @section shuffleframes
13633 Reorder and/or duplicate and/or drop video frames.
13635 It accepts the following parameters:
13639 Set the destination indexes of input frames.
13640 This is space or '|' separated list of indexes that maps input frames to output
13641 frames. Number of indexes also sets maximal value that each index may have.
13642 '-1' index have special meaning and that is to drop frame.
13645 The first frame has the index 0. The default is to keep the input unchanged.
13647 @subsection Examples
13651 Swap second and third frame of every three frames of the input:
13653 ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
13657 Swap 10th and 1st frame of every ten frames of the input:
13659 ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
13663 @section shuffleplanes
13665 Reorder and/or duplicate video planes.
13667 It accepts the following parameters:
13672 The index of the input plane to be used as the first output plane.
13675 The index of the input plane to be used as the second output plane.
13678 The index of the input plane to be used as the third output plane.
13681 The index of the input plane to be used as the fourth output plane.
13685 The first plane has the index 0. The default is to keep the input unchanged.
13687 @subsection Examples
13691 Swap the second and third planes of the input:
13693 ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
13697 @anchor{signalstats}
13698 @section signalstats
13699 Evaluate various visual metrics that assist in determining issues associated
13700 with the digitization of analog video media.
13702 By default the filter will log these metadata values:
13706 Display the minimal Y value contained within the input frame. Expressed in
13710 Display the Y value at the 10% percentile within the input frame. Expressed in
13714 Display the average Y value within the input frame. Expressed in range of
13718 Display the Y value at the 90% percentile within the input frame. Expressed in
13722 Display the maximum Y value contained within the input frame. Expressed in
13726 Display the minimal U value contained within the input frame. Expressed in
13730 Display the U value at the 10% percentile within the input frame. Expressed in
13734 Display the average U value within the input frame. Expressed in range of
13738 Display the U value at the 90% percentile within the input frame. Expressed in
13742 Display the maximum U value contained within the input frame. Expressed in
13746 Display the minimal V value contained within the input frame. Expressed in
13750 Display the V value at the 10% percentile within the input frame. Expressed in
13754 Display the average V value within the input frame. Expressed in range of
13758 Display the V value at the 90% percentile within the input frame. Expressed in
13762 Display the maximum V value contained within the input frame. Expressed in
13766 Display the minimal saturation value contained within the input frame.
13767 Expressed in range of [0-~181.02].
13770 Display the saturation value at the 10% percentile within the input frame.
13771 Expressed in range of [0-~181.02].
13774 Display the average saturation value within the input frame. Expressed in range
13778 Display the saturation value at the 90% percentile within the input frame.
13779 Expressed in range of [0-~181.02].
13782 Display the maximum saturation value contained within the input frame.
13783 Expressed in range of [0-~181.02].
13786 Display the median value for hue within the input frame. Expressed in range of
13790 Display the average value for hue within the input frame. Expressed in range of
13794 Display the average of sample value difference between all values of the Y
13795 plane in the current frame and corresponding values of the previous input frame.
13796 Expressed in range of [0-255].
13799 Display the average of sample value difference between all values of the U
13800 plane in the current frame and corresponding values of the previous input frame.
13801 Expressed in range of [0-255].
13804 Display the average of sample value difference between all values of the V
13805 plane in the current frame and corresponding values of the previous input frame.
13806 Expressed in range of [0-255].
13809 Display bit depth of Y plane in current frame.
13810 Expressed in range of [0-16].
13813 Display bit depth of U plane in current frame.
13814 Expressed in range of [0-16].
13817 Display bit depth of V plane in current frame.
13818 Expressed in range of [0-16].
13821 The filter accepts the following options:
13827 @option{stat} specify an additional form of image analysis.
13828 @option{out} output video with the specified type of pixel highlighted.
13830 Both options accept the following values:
13834 Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
13835 unlike the neighboring pixels of the same field. Examples of temporal outliers
13836 include the results of video dropouts, head clogs, or tape tracking issues.
13839 Identify @var{vertical line repetition}. Vertical line repetition includes
13840 similar rows of pixels within a frame. In born-digital video vertical line
13841 repetition is common, but this pattern is uncommon in video digitized from an
13842 analog source. When it occurs in video that results from the digitization of an
13843 analog source it can indicate concealment from a dropout compensator.
13846 Identify pixels that fall outside of legal broadcast range.
13850 Set the highlight color for the @option{out} option. The default color is
13854 @subsection Examples
13858 Output data of various video metrics:
13860 ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
13864 Output specific data about the minimum and maximum values of the Y plane per frame:
13866 ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
13870 Playback video while highlighting pixels that are outside of broadcast range in red.
13872 ffplay example.mov -vf signalstats="out=brng:color=red"
13876 Playback video with signalstats metadata drawn over the frame.
13878 ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
13881 The contents of signalstat_drawtext.txt used in the command are:
13884 Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
13885 U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
13886 V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
13887 saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
13895 Calculates the MPEG-7 Video Signature. The filter can handle more than one
13896 input. In this case the matching between the inputs can be calculated additionally.
13897 The filter always passes through the first input. The signature of each stream can
13898 be written into a file.
13900 It accepts the following options:
13904 Enable or disable the matching process.
13906 Available values are:
13910 Disable the calculation of a matching (default).
13912 Calculate the matching for the whole video and output whether the whole video
13913 matches or only parts.
13915 Calculate only until a matching is found or the video ends. Should be faster in
13920 Set the number of inputs. The option value must be a non negative integer.
13921 Default value is 1.
13924 Set the path to which the output is written. If there is more than one input,
13925 the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
13926 integer), that will be replaced with the input number. If no filename is
13927 specified, no output will be written. This is the default.
13930 Choose the output format.
13932 Available values are:
13936 Use the specified binary representation (default).
13938 Use the specified xml representation.
13942 Set threshold to detect one word as similar. The option value must be an integer
13943 greater than zero. The default value is 9000.
13946 Set threshold to detect all words as similar. The option value must be an integer
13947 greater than zero. The default value is 60000.
13950 Set threshold to detect frames as similar. The option value must be an integer
13951 greater than zero. The default value is 116.
13954 Set the minimum length of a sequence in frames to recognize it as matching
13955 sequence. The option value must be a non negative integer value.
13956 The default value is 0.
13959 Set the minimum relation, that matching frames to all frames must have.
13960 The option value must be a double value between 0 and 1. The default value is 0.5.
13963 @subsection Examples
13967 To calculate the signature of an input video and store it in signature.bin:
13969 ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
13973 To detect whether two videos match and store the signatures in XML format in
13974 signature0.xml and signature1.xml:
13976 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 -
13984 Blur the input video without impacting the outlines.
13986 It accepts the following options:
13989 @item luma_radius, lr
13990 Set the luma radius. The option value must be a float number in
13991 the range [0.1,5.0] that specifies the variance of the gaussian filter
13992 used to blur the image (slower if larger). Default value is 1.0.
13994 @item luma_strength, ls
13995 Set the luma strength. The option value must be a float number
13996 in the range [-1.0,1.0] that configures the blurring. A value included
13997 in [0.0,1.0] will blur the image whereas a value included in
13998 [-1.0,0.0] will sharpen the image. Default value is 1.0.
14000 @item luma_threshold, lt
14001 Set the luma threshold used as a coefficient to determine
14002 whether a pixel should be blurred or not. The option value must be an
14003 integer in the range [-30,30]. A value of 0 will filter all the image,
14004 a value included in [0,30] will filter flat areas and a value included
14005 in [-30,0] will filter edges. Default value is 0.
14007 @item chroma_radius, cr
14008 Set the chroma radius. The option value must be a float number in
14009 the range [0.1,5.0] that specifies the variance of the gaussian filter
14010 used to blur the image (slower if larger). Default value is @option{luma_radius}.
14012 @item chroma_strength, cs
14013 Set the chroma strength. The option value must be a float number
14014 in the range [-1.0,1.0] that configures the blurring. A value included
14015 in [0.0,1.0] will blur the image whereas a value included in
14016 [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
14018 @item chroma_threshold, ct
14019 Set the chroma threshold used as a coefficient to determine
14020 whether a pixel should be blurred or not. The option value must be an
14021 integer in the range [-30,30]. A value of 0 will filter all the image,
14022 a value included in [0,30] will filter flat areas and a value included
14023 in [-30,0] will filter edges. Default value is @option{luma_threshold}.
14026 If a chroma option is not explicitly set, the corresponding luma value
14031 Obtain the SSIM (Structural SImilarity Metric) between two input videos.
14033 This filter takes in input two input videos, the first input is
14034 considered the "main" source and is passed unchanged to the
14035 output. The second input is used as a "reference" video for computing
14038 Both video inputs must have the same resolution and pixel format for
14039 this filter to work correctly. Also it assumes that both inputs
14040 have the same number of frames, which are compared one by one.
14042 The filter stores the calculated SSIM of each frame.
14044 The description of the accepted parameters follows.
14047 @item stats_file, f
14048 If specified the filter will use the named file to save the SSIM of
14049 each individual frame. When filename equals "-" the data is sent to
14053 The file printed if @var{stats_file} is selected, contains a sequence of
14054 key/value pairs of the form @var{key}:@var{value} for each compared
14057 A description of each shown parameter follows:
14061 sequential number of the input frame, starting from 1
14063 @item Y, U, V, R, G, B
14064 SSIM of the compared frames for the component specified by the suffix.
14067 SSIM of the compared frames for the whole frame.
14070 Same as above but in dB representation.
14073 This filter also supports the @ref{framesync} options.
14077 movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
14078 [main][ref] ssim="stats_file=stats.log" [out]
14081 On this example the input file being processed is compared with the
14082 reference file @file{ref_movie.mpg}. The SSIM of each individual frame
14083 is stored in @file{stats.log}.
14085 Another example with both psnr and ssim at same time:
14087 ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
14092 Convert between different stereoscopic image formats.
14094 The filters accept the following options:
14098 Set stereoscopic image format of input.
14100 Available values for input image formats are:
14103 side by side parallel (left eye left, right eye right)
14106 side by side crosseye (right eye left, left eye right)
14109 side by side parallel with half width resolution
14110 (left eye left, right eye right)
14113 side by side crosseye with half width resolution
14114 (right eye left, left eye right)
14117 above-below (left eye above, right eye below)
14120 above-below (right eye above, left eye below)
14123 above-below with half height resolution
14124 (left eye above, right eye below)
14127 above-below with half height resolution
14128 (right eye above, left eye below)
14131 alternating frames (left eye first, right eye second)
14134 alternating frames (right eye first, left eye second)
14137 interleaved rows (left eye has top row, right eye starts on next row)
14140 interleaved rows (right eye has top row, left eye starts on next row)
14143 interleaved columns, left eye first
14146 interleaved columns, right eye first
14148 Default value is @samp{sbsl}.
14152 Set stereoscopic image format of output.
14156 side by side parallel (left eye left, right eye right)
14159 side by side crosseye (right eye left, left eye right)
14162 side by side parallel with half width resolution
14163 (left eye left, right eye right)
14166 side by side crosseye with half width resolution
14167 (right eye left, left eye right)
14170 above-below (left eye above, right eye below)
14173 above-below (right eye above, left eye below)
14176 above-below with half height resolution
14177 (left eye above, right eye below)
14180 above-below with half height resolution
14181 (right eye above, left eye below)
14184 alternating frames (left eye first, right eye second)
14187 alternating frames (right eye first, left eye second)
14190 interleaved rows (left eye has top row, right eye starts on next row)
14193 interleaved rows (right eye has top row, left eye starts on next row)
14196 anaglyph red/blue gray
14197 (red filter on left eye, blue filter on right eye)
14200 anaglyph red/green gray
14201 (red filter on left eye, green filter on right eye)
14204 anaglyph red/cyan gray
14205 (red filter on left eye, cyan filter on right eye)
14208 anaglyph red/cyan half colored
14209 (red filter on left eye, cyan filter on right eye)
14212 anaglyph red/cyan color
14213 (red filter on left eye, cyan filter on right eye)
14216 anaglyph red/cyan color optimized with the least squares projection of dubois
14217 (red filter on left eye, cyan filter on right eye)
14220 anaglyph green/magenta gray
14221 (green filter on left eye, magenta filter on right eye)
14224 anaglyph green/magenta half colored
14225 (green filter on left eye, magenta filter on right eye)
14228 anaglyph green/magenta colored
14229 (green filter on left eye, magenta filter on right eye)
14232 anaglyph green/magenta color optimized with the least squares projection of dubois
14233 (green filter on left eye, magenta filter on right eye)
14236 anaglyph yellow/blue gray
14237 (yellow filter on left eye, blue filter on right eye)
14240 anaglyph yellow/blue half colored
14241 (yellow filter on left eye, blue filter on right eye)
14244 anaglyph yellow/blue colored
14245 (yellow filter on left eye, blue filter on right eye)
14248 anaglyph yellow/blue color optimized with the least squares projection of dubois
14249 (yellow filter on left eye, blue filter on right eye)
14252 mono output (left eye only)
14255 mono output (right eye only)
14258 checkerboard, left eye first
14261 checkerboard, right eye first
14264 interleaved columns, left eye first
14267 interleaved columns, right eye first
14273 Default value is @samp{arcd}.
14276 @subsection Examples
14280 Convert input video from side by side parallel to anaglyph yellow/blue dubois:
14286 Convert input video from above below (left eye above, right eye below) to side by side crosseye.
14292 @section streamselect, astreamselect
14293 Select video or audio streams.
14295 The filter accepts the following options:
14299 Set number of inputs. Default is 2.
14302 Set input indexes to remap to outputs.
14305 @subsection Commands
14307 The @code{streamselect} and @code{astreamselect} filter supports the following
14312 Set input indexes to remap to outputs.
14315 @subsection Examples
14319 Select first 5 seconds 1st stream and rest of time 2nd stream:
14321 sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
14325 Same as above, but for audio:
14327 asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
14332 Apply sobel operator to input video stream.
14334 The filter accepts the following option:
14338 Set which planes will be processed, unprocessed planes will be copied.
14339 By default value 0xf, all planes will be processed.
14342 Set value which will be multiplied with filtered result.
14345 Set value which will be added to filtered result.
14351 Apply a simple postprocessing filter that compresses and decompresses the image
14352 at several (or - in the case of @option{quality} level @code{6} - all) shifts
14353 and average the results.
14355 The filter accepts the following options:
14359 Set quality. This option defines the number of levels for averaging. It accepts
14360 an integer in the range 0-6. If set to @code{0}, the filter will have no
14361 effect. A value of @code{6} means the higher quality. For each increment of
14362 that value the speed drops by a factor of approximately 2. Default value is
14366 Force a constant quantization parameter. If not set, the filter will use the QP
14367 from the video stream (if available).
14370 Set thresholding mode. Available modes are:
14374 Set hard thresholding (default).
14376 Set soft thresholding (better de-ringing effect, but likely blurrier).
14379 @item use_bframe_qp
14380 Enable the use of the QP from the B-Frames if set to @code{1}. Using this
14381 option may cause flicker since the B-Frames have often larger QP. Default is
14382 @code{0} (not enabled).
14388 Draw subtitles on top of input video using the libass library.
14390 To enable compilation of this filter you need to configure FFmpeg with
14391 @code{--enable-libass}. This filter also requires a build with libavcodec and
14392 libavformat to convert the passed subtitles file to ASS (Advanced Substation
14393 Alpha) subtitles format.
14395 The filter accepts the following options:
14399 Set the filename of the subtitle file to read. It must be specified.
14401 @item original_size
14402 Specify the size of the original video, the video for which the ASS file
14403 was composed. For the syntax of this option, check the
14404 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
14405 Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
14406 correctly scale the fonts if the aspect ratio has been changed.
14409 Set a directory path containing fonts that can be used by the filter.
14410 These fonts will be used in addition to whatever the font provider uses.
14413 Process alpha channel, by default alpha channel is untouched.
14416 Set subtitles input character encoding. @code{subtitles} filter only. Only
14417 useful if not UTF-8.
14419 @item stream_index, si
14420 Set subtitles stream index. @code{subtitles} filter only.
14423 Override default style or script info parameters of the subtitles. It accepts a
14424 string containing ASS style format @code{KEY=VALUE} couples separated by ",".
14427 If the first key is not specified, it is assumed that the first value
14428 specifies the @option{filename}.
14430 For example, to render the file @file{sub.srt} on top of the input
14431 video, use the command:
14436 which is equivalent to:
14438 subtitles=filename=sub.srt
14441 To render the default subtitles stream from file @file{video.mkv}, use:
14443 subtitles=video.mkv
14446 To render the second subtitles stream from that file, use:
14448 subtitles=video.mkv:si=1
14451 To make the subtitles stream from @file{sub.srt} appear in transparent green
14452 @code{DejaVu Serif}, use:
14454 subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
14457 @section super2xsai
14459 Scale the input by 2x and smooth using the Super2xSaI (Scale and
14460 Interpolate) pixel art scaling algorithm.
14462 Useful for enlarging pixel art images without reducing sharpness.
14466 Swap two rectangular objects in video.
14468 This filter accepts the following options:
14478 Set 1st rect x coordinate.
14481 Set 1st rect y coordinate.
14484 Set 2nd rect x coordinate.
14487 Set 2nd rect y coordinate.
14489 All expressions are evaluated once for each frame.
14492 The all options are expressions containing the following constants:
14497 The input width and height.
14500 same as @var{w} / @var{h}
14503 input sample aspect ratio
14506 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
14509 The number of the input frame, starting from 0.
14512 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
14515 the position in the file of the input frame, NAN if unknown
14523 Apply telecine process to the video.
14525 This filter accepts the following options:
14534 The default value is @code{top}.
14538 A string of numbers representing the pulldown pattern you wish to apply.
14539 The default value is @code{23}.
14543 Some typical patterns:
14548 24p: 2332 (preferred)
14555 24p: 222222222223 ("Euro pulldown")
14562 Apply threshold effect to video stream.
14564 This filter needs four video streams to perform thresholding.
14565 First stream is stream we are filtering.
14566 Second stream is holding threshold values, third stream is holding min values,
14567 and last, fourth stream is holding max values.
14569 The filter accepts the following option:
14573 Set which planes will be processed, unprocessed planes will be copied.
14574 By default value 0xf, all planes will be processed.
14577 For example if first stream pixel's component value is less then threshold value
14578 of pixel component from 2nd threshold stream, third stream value will picked,
14579 otherwise fourth stream pixel component value will be picked.
14581 Using color source filter one can perform various types of thresholding:
14583 @subsection Examples
14587 Binary threshold, using gray color as threshold:
14589 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
14593 Inverted binary threshold, using gray color as threshold:
14595 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
14599 Truncate binary threshold, using gray color as threshold:
14601 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
14605 Threshold to zero, using gray color as threshold:
14607 ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
14611 Inverted threshold to zero, using gray color as threshold:
14613 ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
14618 Select the most representative frame in a given sequence of consecutive frames.
14620 The filter accepts the following options:
14624 Set the frames batch size to analyze; in a set of @var{n} frames, the filter
14625 will pick one of them, and then handle the next batch of @var{n} frames until
14626 the end. Default is @code{100}.
14629 Since the filter keeps track of the whole frames sequence, a bigger @var{n}
14630 value will result in a higher memory usage, so a high value is not recommended.
14632 @subsection Examples
14636 Extract one picture each 50 frames:
14642 Complete example of a thumbnail creation with @command{ffmpeg}:
14644 ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
14650 Tile several successive frames together.
14652 The filter accepts the following options:
14657 Set the grid size (i.e. the number of lines and columns). For the syntax of
14658 this option, check the
14659 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
14662 Set the maximum number of frames to render in the given area. It must be less
14663 than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
14664 the area will be used.
14667 Set the outer border margin in pixels.
14670 Set the inner border thickness (i.e. the number of pixels between frames). For
14671 more advanced padding options (such as having different values for the edges),
14672 refer to the pad video filter.
14675 Specify the color of the unused area. For the syntax of this option, check the
14676 "Color" section in the ffmpeg-utils manual. The default value of @var{color}
14680 Set the number of frames to overlap when tiling several successive frames together.
14681 The value must be between @code{0} and @var{nb_frames - 1}.
14684 Set the number of frames to initially be empty before displaying first output frame.
14685 This controls how soon will one get first output frame.
14686 The value must be between @code{0} and @var{nb_frames - 1}.
14689 @subsection Examples
14693 Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
14695 ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
14697 The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
14698 duplicating each output frame to accommodate the originally detected frame
14702 Display @code{5} pictures in an area of @code{3x2} frames,
14703 with @code{7} pixels between them, and @code{2} pixels of initial margin, using
14704 mixed flat and named options:
14706 tile=3x2:nb_frames=5:padding=7:margin=2
14710 @section tinterlace
14712 Perform various types of temporal field interlacing.
14714 Frames are counted starting from 1, so the first input frame is
14717 The filter accepts the following options:
14722 Specify the mode of the interlacing. This option can also be specified
14723 as a value alone. See below for a list of values for this option.
14725 Available values are:
14729 Move odd frames into the upper field, even into the lower field,
14730 generating a double height frame at half frame rate.
14734 Frame 1 Frame 2 Frame 3 Frame 4
14736 11111 22222 33333 44444
14737 11111 22222 33333 44444
14738 11111 22222 33333 44444
14739 11111 22222 33333 44444
14753 Only output odd frames, even frames are dropped, generating a frame with
14754 unchanged height at half frame rate.
14759 Frame 1 Frame 2 Frame 3 Frame 4
14761 11111 22222 33333 44444
14762 11111 22222 33333 44444
14763 11111 22222 33333 44444
14764 11111 22222 33333 44444
14774 Only output even frames, odd frames are dropped, generating a frame with
14775 unchanged height at half frame rate.
14780 Frame 1 Frame 2 Frame 3 Frame 4
14782 11111 22222 33333 44444
14783 11111 22222 33333 44444
14784 11111 22222 33333 44444
14785 11111 22222 33333 44444
14795 Expand each frame to full height, but pad alternate lines with black,
14796 generating a frame with double height at the same input frame rate.
14801 Frame 1 Frame 2 Frame 3 Frame 4
14803 11111 22222 33333 44444
14804 11111 22222 33333 44444
14805 11111 22222 33333 44444
14806 11111 22222 33333 44444
14809 11111 ..... 33333 .....
14810 ..... 22222 ..... 44444
14811 11111 ..... 33333 .....
14812 ..... 22222 ..... 44444
14813 11111 ..... 33333 .....
14814 ..... 22222 ..... 44444
14815 11111 ..... 33333 .....
14816 ..... 22222 ..... 44444
14820 @item interleave_top, 4
14821 Interleave the upper field from odd frames with the lower field from
14822 even frames, generating a frame with unchanged height at half frame rate.
14827 Frame 1 Frame 2 Frame 3 Frame 4
14829 11111<- 22222 33333<- 44444
14830 11111 22222<- 33333 44444<-
14831 11111<- 22222 33333<- 44444
14832 11111 22222<- 33333 44444<-
14842 @item interleave_bottom, 5
14843 Interleave the lower field from odd frames with the upper field from
14844 even frames, generating a frame with unchanged height at half frame rate.
14849 Frame 1 Frame 2 Frame 3 Frame 4
14851 11111 22222<- 33333 44444<-
14852 11111<- 22222 33333<- 44444
14853 11111 22222<- 33333 44444<-
14854 11111<- 22222 33333<- 44444
14864 @item interlacex2, 6
14865 Double frame rate with unchanged height. Frames are inserted each
14866 containing the second temporal field from the previous input frame and
14867 the first temporal field from the next input frame. This mode relies on
14868 the top_field_first flag. Useful for interlaced video displays with no
14869 field synchronisation.
14874 Frame 1 Frame 2 Frame 3 Frame 4
14876 11111 22222 33333 44444
14877 11111 22222 33333 44444
14878 11111 22222 33333 44444
14879 11111 22222 33333 44444
14882 11111 22222 22222 33333 33333 44444 44444
14883 11111 11111 22222 22222 33333 33333 44444
14884 11111 22222 22222 33333 33333 44444 44444
14885 11111 11111 22222 22222 33333 33333 44444
14890 Move odd frames into the upper field, even into the lower field,
14891 generating a double height frame at same frame rate.
14896 Frame 1 Frame 2 Frame 3 Frame 4
14898 11111 22222 33333 44444
14899 11111 22222 33333 44444
14900 11111 22222 33333 44444
14901 11111 22222 33333 44444
14904 11111 33333 33333 55555
14905 22222 22222 44444 44444
14906 11111 33333 33333 55555
14907 22222 22222 44444 44444
14908 11111 33333 33333 55555
14909 22222 22222 44444 44444
14910 11111 33333 33333 55555
14911 22222 22222 44444 44444
14916 Numeric values are deprecated but are accepted for backward
14917 compatibility reasons.
14919 Default mode is @code{merge}.
14922 Specify flags influencing the filter process.
14924 Available value for @var{flags} is:
14927 @item low_pass_filter, vlfp
14928 Enable linear vertical low-pass filtering in the filter.
14929 Vertical low-pass filtering is required when creating an interlaced
14930 destination from a progressive source which contains high-frequency
14931 vertical detail. Filtering will reduce interlace 'twitter' and Moire
14934 @item complex_filter, cvlfp
14935 Enable complex vertical low-pass filtering.
14936 This will slightly less reduce interlace 'twitter' and Moire
14937 patterning but better retain detail and subjective sharpness impression.
14941 Vertical low-pass filtering can only be enabled for @option{mode}
14942 @var{interleave_top} and @var{interleave_bottom}.
14947 Tone map colors from different dynamic ranges.
14949 This filter expects data in single precision floating point, as it needs to
14950 operate on (and can output) out-of-range values. Another filter, such as
14951 @ref{zscale}, is needed to convert the resulting frame to a usable format.
14953 The tonemapping algorithms implemented only work on linear light, so input
14954 data should be linearized beforehand (and possibly correctly tagged).
14957 ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
14960 @subsection Options
14961 The filter accepts the following options.
14965 Set the tone map algorithm to use.
14967 Possible values are:
14970 Do not apply any tone map, only desaturate overbright pixels.
14973 Hard-clip any out-of-range values. Use it for perfect color accuracy for
14974 in-range values, while distorting out-of-range values.
14977 Stretch the entire reference gamut to a linear multiple of the display.
14980 Fit a logarithmic transfer between the tone curves.
14983 Preserve overall image brightness with a simple curve, using nonlinear
14984 contrast, which results in flattening details and degrading color accuracy.
14987 Preserve both dark and bright details better than @var{reinhard}, at the cost
14988 of slightly darkening everything. Use it when detail preservation is more
14989 important than color and brightness accuracy.
14992 Smoothly map out-of-range values, while retaining contrast and colors for
14993 in-range material as much as possible. Use it when color accuracy is more
14994 important than detail preservation.
15000 Tune the tone mapping algorithm.
15002 This affects the following algorithms:
15008 Specifies the scale factor to use while stretching.
15012 Specifies the exponent of the function.
15016 Specify an extra linear coefficient to multiply into the signal before clipping.
15020 Specify the local contrast coefficient at the display peak.
15021 Default to 0.5, which means that in-gamut values will be about half as bright
15028 Specify the transition point from linear to mobius transform. Every value
15029 below this point is guaranteed to be mapped 1:1. The higher the value, the
15030 more accurate the result will be, at the cost of losing bright details.
15031 Default to 0.3, which due to the steep initial slope still preserves in-range
15032 colors fairly accurately.
15036 Apply desaturation for highlights that exceed this level of brightness. The
15037 higher the parameter, the more color information will be preserved. This
15038 setting helps prevent unnaturally blown-out colors for super-highlights, by
15039 (smoothly) turning into white instead. This makes images feel more natural,
15040 at the cost of reducing information about out-of-range colors.
15042 The default of 2.0 is somewhat conservative and will mostly just apply to
15043 skies or directly sunlit surfaces. A setting of 0.0 disables this option.
15045 This option works only if the input frame has a supported color tag.
15048 Override signal/nominal/reference peak with this value. Useful when the
15049 embedded peak information in display metadata is not reliable or when tone
15050 mapping from a lower range to a higher range.
15055 Transpose rows with columns in the input video and optionally flip it.
15057 It accepts the following parameters:
15062 Specify the transposition direction.
15064 Can assume the following values:
15066 @item 0, 4, cclock_flip
15067 Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
15075 Rotate by 90 degrees clockwise, that is:
15083 Rotate by 90 degrees counterclockwise, that is:
15090 @item 3, 7, clock_flip
15091 Rotate by 90 degrees clockwise and vertically flip, that is:
15099 For values between 4-7, the transposition is only done if the input
15100 video geometry is portrait and not landscape. These values are
15101 deprecated, the @code{passthrough} option should be used instead.
15103 Numerical values are deprecated, and should be dropped in favor of
15104 symbolic constants.
15107 Do not apply the transposition if the input geometry matches the one
15108 specified by the specified value. It accepts the following values:
15111 Always apply transposition.
15113 Preserve portrait geometry (when @var{height} >= @var{width}).
15115 Preserve landscape geometry (when @var{width} >= @var{height}).
15118 Default value is @code{none}.
15121 For example to rotate by 90 degrees clockwise and preserve portrait
15124 transpose=dir=1:passthrough=portrait
15127 The command above can also be specified as:
15129 transpose=1:portrait
15133 Trim the input so that the output contains one continuous subpart of the input.
15135 It accepts the following parameters:
15138 Specify the time of the start of the kept section, i.e. the frame with the
15139 timestamp @var{start} will be the first frame in the output.
15142 Specify the time of the first frame that will be dropped, i.e. the frame
15143 immediately preceding the one with the timestamp @var{end} will be the last
15144 frame in the output.
15147 This is the same as @var{start}, except this option sets the start timestamp
15148 in timebase units instead of seconds.
15151 This is the same as @var{end}, except this option sets the end timestamp
15152 in timebase units instead of seconds.
15155 The maximum duration of the output in seconds.
15158 The number of the first frame that should be passed to the output.
15161 The number of the first frame that should be dropped.
15164 @option{start}, @option{end}, and @option{duration} are expressed as time
15165 duration specifications; see
15166 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
15167 for the accepted syntax.
15169 Note that the first two sets of the start/end options and the @option{duration}
15170 option look at the frame timestamp, while the _frame variants simply count the
15171 frames that pass through the filter. Also note that this filter does not modify
15172 the timestamps. If you wish for the output timestamps to start at zero, insert a
15173 setpts filter after the trim filter.
15175 If multiple start or end options are set, this filter tries to be greedy and
15176 keep all the frames that match at least one of the specified constraints. To keep
15177 only the part that matches all the constraints at once, chain multiple trim
15180 The defaults are such that all the input is kept. So it is possible to set e.g.
15181 just the end values to keep everything before the specified time.
15186 Drop everything except the second minute of input:
15188 ffmpeg -i INPUT -vf trim=60:120
15192 Keep only the first second:
15194 ffmpeg -i INPUT -vf trim=duration=1
15199 @section unpremultiply
15200 Apply alpha unpremultiply effect to input video stream using first plane
15201 of second stream as alpha.
15203 Both streams must have same dimensions and same pixel format.
15205 The filter accepts the following option:
15209 Set which planes will be processed, unprocessed planes will be copied.
15210 By default value 0xf, all planes will be processed.
15212 If the format has 1 or 2 components, then luma is bit 0.
15213 If the format has 3 or 4 components:
15214 for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
15215 for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
15216 If present, the alpha channel is always the last bit.
15219 Do not require 2nd input for processing, instead use alpha plane from input stream.
15225 Sharpen or blur the input video.
15227 It accepts the following parameters:
15230 @item luma_msize_x, lx
15231 Set the luma matrix horizontal size. It must be an odd integer between
15232 3 and 23. The default value is 5.
15234 @item luma_msize_y, ly
15235 Set the luma matrix vertical size. It must be an odd integer between 3
15236 and 23. The default value is 5.
15238 @item luma_amount, la
15239 Set the luma effect strength. It must be a floating point number, reasonable
15240 values lay between -1.5 and 1.5.
15242 Negative values will blur the input video, while positive values will
15243 sharpen it, a value of zero will disable the effect.
15245 Default value is 1.0.
15247 @item chroma_msize_x, cx
15248 Set the chroma matrix horizontal size. It must be an odd integer
15249 between 3 and 23. The default value is 5.
15251 @item chroma_msize_y, cy
15252 Set the chroma matrix vertical size. It must be an odd integer
15253 between 3 and 23. The default value is 5.
15255 @item chroma_amount, ca
15256 Set the chroma effect strength. It must be a floating point number, reasonable
15257 values lay between -1.5 and 1.5.
15259 Negative values will blur the input video, while positive values will
15260 sharpen it, a value of zero will disable the effect.
15262 Default value is 0.0.
15266 All parameters are optional and default to the equivalent of the
15267 string '5:5:1.0:5:5:0.0'.
15269 @subsection Examples
15273 Apply strong luma sharpen effect:
15275 unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
15279 Apply a strong blur of both luma and chroma parameters:
15281 unsharp=7:7:-2:7:7:-2
15287 Apply ultra slow/simple postprocessing filter that compresses and decompresses
15288 the image at several (or - in the case of @option{quality} level @code{8} - all)
15289 shifts and average the results.
15291 The way this differs from the behavior of spp is that uspp actually encodes &
15292 decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
15293 DCT similar to MJPEG.
15295 The filter accepts the following options:
15299 Set quality. This option defines the number of levels for averaging. It accepts
15300 an integer in the range 0-8. If set to @code{0}, the filter will have no
15301 effect. A value of @code{8} means the higher quality. For each increment of
15302 that value the speed drops by a factor of approximately 2. Default value is
15306 Force a constant quantization parameter. If not set, the filter will use the QP
15307 from the video stream (if available).
15310 @section vaguedenoiser
15312 Apply a wavelet based denoiser.
15314 It transforms each frame from the video input into the wavelet domain,
15315 using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
15316 the obtained coefficients. It does an inverse wavelet transform after.
15317 Due to wavelet properties, it should give a nice smoothed result, and
15318 reduced noise, without blurring picture features.
15320 This filter accepts the following options:
15324 The filtering strength. The higher, the more filtered the video will be.
15325 Hard thresholding can use a higher threshold than soft thresholding
15326 before the video looks overfiltered. Default value is 2.
15329 The filtering method the filter will use.
15331 It accepts the following values:
15334 All values under the threshold will be zeroed.
15337 All values under the threshold will be zeroed. All values above will be
15338 reduced by the threshold.
15341 Scales or nullifies coefficients - intermediary between (more) soft and
15342 (less) hard thresholding.
15345 Default is garrote.
15348 Number of times, the wavelet will decompose the picture. Picture can't
15349 be decomposed beyond a particular point (typically, 8 for a 640x480
15350 frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
15353 Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
15356 A list of the planes to process. By default all planes are processed.
15359 @section vectorscope
15361 Display 2 color component values in the two dimensional graph (which is called
15364 This filter accepts the following options:
15368 Set vectorscope mode.
15370 It accepts the following values:
15373 Gray values are displayed on graph, higher brightness means more pixels have
15374 same component color value on location in graph. This is the default mode.
15377 Gray values are displayed on graph. Surrounding pixels values which are not
15378 present in video frame are drawn in gradient of 2 color components which are
15379 set by option @code{x} and @code{y}. The 3rd color component is static.
15382 Actual color components values present in video frame are displayed on graph.
15385 Similar as color2 but higher frequency of same values @code{x} and @code{y}
15386 on graph increases value of another color component, which is luminance by
15387 default values of @code{x} and @code{y}.
15390 Actual colors present in video frame are displayed on graph. If two different
15391 colors map to same position on graph then color with higher value of component
15392 not present in graph is picked.
15395 Gray values are displayed on graph. Similar to @code{color} but with 3rd color
15396 component picked from radial gradient.
15400 Set which color component will be represented on X-axis. Default is @code{1}.
15403 Set which color component will be represented on Y-axis. Default is @code{2}.
15406 Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
15407 of color component which represents frequency of (X, Y) location in graph.
15412 No envelope, this is default.
15415 Instant envelope, even darkest single pixel will be clearly highlighted.
15418 Hold maximum and minimum values presented in graph over time. This way you
15419 can still spot out of range values without constantly looking at vectorscope.
15422 Peak and instant envelope combined together.
15426 Set what kind of graticule to draw.
15434 Set graticule opacity.
15437 Set graticule flags.
15441 Draw graticule for white point.
15444 Draw graticule for black point.
15447 Draw color points short names.
15451 Set background opacity.
15453 @item lthreshold, l
15454 Set low threshold for color component not represented on X or Y axis.
15455 Values lower than this value will be ignored. Default is 0.
15456 Note this value is multiplied with actual max possible value one pixel component
15457 can have. So for 8-bit input and low threshold value of 0.1 actual threshold
15460 @item hthreshold, h
15461 Set high threshold for color component not represented on X or Y axis.
15462 Values higher than this value will be ignored. Default is 1.
15463 Note this value is multiplied with actual max possible value one pixel component
15464 can have. So for 8-bit input and high threshold value of 0.9 actual threshold
15465 is 0.9 * 255 = 230.
15467 @item colorspace, c
15468 Set what kind of colorspace to use when drawing graticule.
15477 @anchor{vidstabdetect}
15478 @section vidstabdetect
15480 Analyze video stabilization/deshaking. Perform pass 1 of 2, see
15481 @ref{vidstabtransform} for pass 2.
15483 This filter generates a file with relative translation and rotation
15484 transform information about subsequent frames, which is then used by
15485 the @ref{vidstabtransform} filter.
15487 To enable compilation of this filter you need to configure FFmpeg with
15488 @code{--enable-libvidstab}.
15490 This filter accepts the following options:
15494 Set the path to the file used to write the transforms information.
15495 Default value is @file{transforms.trf}.
15498 Set how shaky the video is and how quick the camera is. It accepts an
15499 integer in the range 1-10, a value of 1 means little shakiness, a
15500 value of 10 means strong shakiness. Default value is 5.
15503 Set the accuracy of the detection process. It must be a value in the
15504 range 1-15. A value of 1 means low accuracy, a value of 15 means high
15505 accuracy. Default value is 15.
15508 Set stepsize of the search process. The region around minimum is
15509 scanned with 1 pixel resolution. Default value is 6.
15512 Set minimum contrast. Below this value a local measurement field is
15513 discarded. Must be a floating point value in the range 0-1. Default
15517 Set reference frame number for tripod mode.
15519 If enabled, the motion of the frames is compared to a reference frame
15520 in the filtered stream, identified by the specified number. The idea
15521 is to compensate all movements in a more-or-less static scene and keep
15522 the camera view absolutely still.
15524 If set to 0, it is disabled. The frames are counted starting from 1.
15527 Show fields and transforms in the resulting frames. It accepts an
15528 integer in the range 0-2. Default value is 0, which disables any
15532 @subsection Examples
15536 Use default values:
15542 Analyze strongly shaky movie and put the results in file
15543 @file{mytransforms.trf}:
15545 vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
15549 Visualize the result of internal transformations in the resulting
15552 vidstabdetect=show=1
15556 Analyze a video with medium shakiness using @command{ffmpeg}:
15558 ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
15562 @anchor{vidstabtransform}
15563 @section vidstabtransform
15565 Video stabilization/deshaking: pass 2 of 2,
15566 see @ref{vidstabdetect} for pass 1.
15568 Read a file with transform information for each frame and
15569 apply/compensate them. Together with the @ref{vidstabdetect}
15570 filter this can be used to deshake videos. See also
15571 @url{http://public.hronopik.de/vid.stab}. It is important to also use
15572 the @ref{unsharp} filter, see below.
15574 To enable compilation of this filter you need to configure FFmpeg with
15575 @code{--enable-libvidstab}.
15577 @subsection Options
15581 Set path to the file used to read the transforms. Default value is
15582 @file{transforms.trf}.
15585 Set the number of frames (value*2 + 1) used for lowpass filtering the
15586 camera movements. Default value is 10.
15588 For example a number of 10 means that 21 frames are used (10 in the
15589 past and 10 in the future) to smoothen the motion in the video. A
15590 larger value leads to a smoother video, but limits the acceleration of
15591 the camera (pan/tilt movements). 0 is a special case where a static
15592 camera is simulated.
15595 Set the camera path optimization algorithm.
15597 Accepted values are:
15600 gaussian kernel low-pass filter on camera motion (default)
15602 averaging on transformations
15606 Set maximal number of pixels to translate frames. Default value is -1,
15610 Set maximal angle in radians (degree*PI/180) to rotate frames. Default
15611 value is -1, meaning no limit.
15614 Specify how to deal with borders that may be visible due to movement
15617 Available values are:
15620 keep image information from previous frame (default)
15622 fill the border black
15626 Invert transforms if set to 1. Default value is 0.
15629 Consider transforms as relative to previous frame if set to 1,
15630 absolute if set to 0. Default value is 0.
15633 Set percentage to zoom. A positive value will result in a zoom-in
15634 effect, a negative value in a zoom-out effect. Default value is 0 (no
15638 Set optimal zooming to avoid borders.
15640 Accepted values are:
15645 optimal static zoom value is determined (only very strong movements
15646 will lead to visible borders) (default)
15648 optimal adaptive zoom value is determined (no borders will be
15649 visible), see @option{zoomspeed}
15652 Note that the value given at zoom is added to the one calculated here.
15655 Set percent to zoom maximally each frame (enabled when
15656 @option{optzoom} is set to 2). Range is from 0 to 5, default value is
15660 Specify type of interpolation.
15662 Available values are:
15667 linear only horizontal
15669 linear in both directions (default)
15671 cubic in both directions (slow)
15675 Enable virtual tripod mode if set to 1, which is equivalent to
15676 @code{relative=0:smoothing=0}. Default value is 0.
15678 Use also @code{tripod} option of @ref{vidstabdetect}.
15681 Increase log verbosity if set to 1. Also the detected global motions
15682 are written to the temporary file @file{global_motions.trf}. Default
15686 @subsection Examples
15690 Use @command{ffmpeg} for a typical stabilization with default values:
15692 ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
15695 Note the use of the @ref{unsharp} filter which is always recommended.
15698 Zoom in a bit more and load transform data from a given file:
15700 vidstabtransform=zoom=5:input="mytransforms.trf"
15704 Smoothen the video even more:
15706 vidstabtransform=smoothing=30
15712 Flip the input video vertically.
15714 For example, to vertically flip a video with @command{ffmpeg}:
15716 ffmpeg -i in.avi -vf "vflip" out.avi
15722 Make or reverse a natural vignetting effect.
15724 The filter accepts the following options:
15728 Set lens angle expression as a number of radians.
15730 The value is clipped in the @code{[0,PI/2]} range.
15732 Default value: @code{"PI/5"}
15736 Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
15740 Set forward/backward mode.
15742 Available modes are:
15745 The larger the distance from the central point, the darker the image becomes.
15748 The larger the distance from the central point, the brighter the image becomes.
15749 This can be used to reverse a vignette effect, though there is no automatic
15750 detection to extract the lens @option{angle} and other settings (yet). It can
15751 also be used to create a burning effect.
15754 Default value is @samp{forward}.
15757 Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
15759 It accepts the following values:
15762 Evaluate expressions only once during the filter initialization.
15765 Evaluate expressions for each incoming frame. This is way slower than the
15766 @samp{init} mode since it requires all the scalers to be re-computed, but it
15767 allows advanced dynamic expressions.
15770 Default value is @samp{init}.
15773 Set dithering to reduce the circular banding effects. Default is @code{1}
15777 Set vignette aspect. This setting allows one to adjust the shape of the vignette.
15778 Setting this value to the SAR of the input will make a rectangular vignetting
15779 following the dimensions of the video.
15781 Default is @code{1/1}.
15784 @subsection Expressions
15786 The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
15787 following parameters.
15792 input width and height
15795 the number of input frame, starting from 0
15798 the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
15799 @var{TB} units, NAN if undefined
15802 frame rate of the input video, NAN if the input frame rate is unknown
15805 the PTS (Presentation TimeStamp) of the filtered video frame,
15806 expressed in seconds, NAN if undefined
15809 time base of the input video
15813 @subsection Examples
15817 Apply simple strong vignetting effect:
15823 Make a flickering vignetting:
15825 vignette='PI/4+random(1)*PI/50':eval=frame
15830 @section vmafmotion
15832 Obtain the average vmaf motion score of a video.
15833 It is one of the component filters of VMAF.
15835 The obtained average motion score is printed through the logging system.
15837 In the below example the input file @file{ref.mpg} is being processed and score
15841 ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
15845 Stack input videos vertically.
15847 All streams must be of same pixel format and of same width.
15849 Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
15850 to create same output.
15852 The filter accept the following option:
15856 Set number of input streams. Default is 2.
15859 If set to 1, force the output to terminate when the shortest input
15860 terminates. Default value is 0.
15865 Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
15866 Deinterlacing Filter").
15868 Based on the process described by Martin Weston for BBC R&D, and
15869 implemented based on the de-interlace algorithm written by Jim
15870 Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
15871 uses filter coefficients calculated by BBC R&D.
15873 There are two sets of filter coefficients, so called "simple":
15874 and "complex". Which set of filter coefficients is used can
15875 be set by passing an optional parameter:
15879 Set the interlacing filter coefficients. Accepts one of the following values:
15883 Simple filter coefficient set.
15885 More-complex filter coefficient set.
15887 Default value is @samp{complex}.
15890 Specify which frames to deinterlace. Accept one of the following values:
15894 Deinterlace all frames,
15896 Only deinterlace frames marked as interlaced.
15899 Default value is @samp{all}.
15903 Video waveform monitor.
15905 The waveform monitor plots color component intensity. By default luminance
15906 only. Each column of the waveform corresponds to a column of pixels in the
15909 It accepts the following options:
15913 Can be either @code{row}, or @code{column}. Default is @code{column}.
15914 In row mode, the graph on the left side represents color component value 0 and
15915 the right side represents value = 255. In column mode, the top side represents
15916 color component value = 0 and bottom side represents value = 255.
15919 Set intensity. Smaller values are useful to find out how many values of the same
15920 luminance are distributed across input rows/columns.
15921 Default value is @code{0.04}. Allowed range is [0, 1].
15924 Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
15925 In mirrored mode, higher values will be represented on the left
15926 side for @code{row} mode and at the top for @code{column} mode. Default is
15927 @code{1} (mirrored).
15931 It accepts the following values:
15934 Presents information identical to that in the @code{parade}, except
15935 that the graphs representing color components are superimposed directly
15938 This display mode makes it easier to spot relative differences or similarities
15939 in overlapping areas of the color components that are supposed to be identical,
15940 such as neutral whites, grays, or blacks.
15943 Display separate graph for the color components side by side in
15944 @code{row} mode or one below the other in @code{column} mode.
15947 Display separate graph for the color components side by side in
15948 @code{column} mode or one below the other in @code{row} mode.
15950 Using this display mode makes it easy to spot color casts in the highlights
15951 and shadows of an image, by comparing the contours of the top and the bottom
15952 graphs of each waveform. Since whites, grays, and blacks are characterized
15953 by exactly equal amounts of red, green, and blue, neutral areas of the picture
15954 should display three waveforms of roughly equal width/height. If not, the
15955 correction is easy to perform by making level adjustments the three waveforms.
15957 Default is @code{stack}.
15959 @item components, c
15960 Set which color components to display. Default is 1, which means only luminance
15961 or red color component if input is in RGB colorspace. If is set for example to
15962 7 it will display all 3 (if) available color components.
15967 No envelope, this is default.
15970 Instant envelope, minimum and maximum values presented in graph will be easily
15971 visible even with small @code{step} value.
15974 Hold minimum and maximum values presented in graph across time. This way you
15975 can still spot out of range values without constantly looking at waveforms.
15978 Peak and instant envelope combined together.
15984 No filtering, this is default.
15987 Luma and chroma combined together.
15990 Similar as above, but shows difference between blue and red chroma.
15993 Displays only chroma.
15996 Displays actual color value on waveform.
15999 Similar as above, but with luma showing frequency of chroma values.
16003 Set which graticule to display.
16007 Do not display graticule.
16010 Display green graticule showing legal broadcast ranges.
16014 Set graticule opacity.
16017 Set graticule flags.
16021 Draw numbers above lines. By default enabled.
16024 Draw dots instead of lines.
16028 Set scale used for displaying graticule.
16035 Default is digital.
16038 Set background opacity.
16041 @section weave, doubleweave
16043 The @code{weave} takes a field-based video input and join
16044 each two sequential fields into single frame, producing a new double
16045 height clip with half the frame rate and half the frame count.
16047 The @code{doubleweave} works same as @code{weave} but without
16048 halving frame rate and frame count.
16050 It accepts the following option:
16054 Set first field. Available values are:
16058 Set the frame as top-field-first.
16061 Set the frame as bottom-field-first.
16065 @subsection Examples
16069 Interlace video using @ref{select} and @ref{separatefields} filter:
16071 separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
16076 Apply the xBR high-quality magnification filter which is designed for pixel
16077 art. It follows a set of edge-detection rules, see
16078 @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
16080 It accepts the following option:
16084 Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
16085 @code{3xBR} and @code{4} for @code{4xBR}.
16086 Default is @code{3}.
16092 Deinterlace the input video ("yadif" means "yet another deinterlacing
16095 It accepts the following parameters:
16101 The interlacing mode to adopt. It accepts one of the following values:
16104 @item 0, send_frame
16105 Output one frame for each frame.
16106 @item 1, send_field
16107 Output one frame for each field.
16108 @item 2, send_frame_nospatial
16109 Like @code{send_frame}, but it skips the spatial interlacing check.
16110 @item 3, send_field_nospatial
16111 Like @code{send_field}, but it skips the spatial interlacing check.
16114 The default value is @code{send_frame}.
16117 The picture field parity assumed for the input interlaced video. It accepts one
16118 of the following values:
16122 Assume the top field is first.
16124 Assume the bottom field is first.
16126 Enable automatic detection of field parity.
16129 The default value is @code{auto}.
16130 If the interlacing is unknown or the decoder does not export this information,
16131 top field first will be assumed.
16134 Specify which frames to deinterlace. Accept one of the following
16139 Deinterlace all frames.
16140 @item 1, interlaced
16141 Only deinterlace frames marked as interlaced.
16144 The default value is @code{all}.
16149 Apply Zoom & Pan effect.
16151 This filter accepts the following options:
16155 Set the zoom expression. Default is 1.
16159 Set the x and y expression. Default is 0.
16162 Set the duration expression in number of frames.
16163 This sets for how many number of frames effect will last for
16164 single input image.
16167 Set the output image size, default is 'hd720'.
16170 Set the output frame rate, default is '25'.
16173 Each expression can contain the following constants:
16192 Output frame count.
16196 Last calculated 'x' and 'y' position from 'x' and 'y' expression
16197 for current input frame.
16201 'x' and 'y' of last output frame of previous input frame or 0 when there was
16202 not yet such frame (first input frame).
16205 Last calculated zoom from 'z' expression for current input frame.
16208 Last calculated zoom of last output frame of previous input frame.
16211 Number of output frames for current input frame. Calculated from 'd' expression
16212 for each input frame.
16215 number of output frames created for previous input frame
16218 Rational number: input width / input height
16221 sample aspect ratio
16224 display aspect ratio
16228 @subsection Examples
16232 Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
16234 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
16238 Zoom-in up to 1.5 and pan always at center of picture:
16240 zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
16244 Same as above but without pausing:
16246 zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
16252 Scale (resize) the input video, using the z.lib library:
16253 https://github.com/sekrit-twc/zimg.
16255 The zscale filter forces the output display aspect ratio to be the same
16256 as the input, by changing the output sample aspect ratio.
16258 If the input image format is different from the format requested by
16259 the next filter, the zscale filter will convert the input to the
16262 @subsection Options
16263 The filter accepts the following options.
16268 Set the output video dimension expression. Default value is the input
16271 If the @var{width} or @var{w} value is 0, the input width is used for
16272 the output. If the @var{height} or @var{h} value is 0, the input height
16273 is used for the output.
16275 If one and only one of the values is -n with n >= 1, the zscale filter
16276 will use a value that maintains the aspect ratio of the input image,
16277 calculated from the other specified dimension. After that it will,
16278 however, make sure that the calculated dimension is divisible by n and
16279 adjust the value if necessary.
16281 If both values are -n with n >= 1, the behavior will be identical to
16282 both values being set to 0 as previously detailed.
16284 See below for the list of accepted constants for use in the dimension
16288 Set the video size. For the syntax of this option, check the
16289 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16292 Set the dither type.
16294 Possible values are:
16299 @item error_diffusion
16305 Set the resize filter type.
16307 Possible values are:
16317 Default is bilinear.
16320 Set the color range.
16322 Possible values are:
16329 Default is same as input.
16332 Set the color primaries.
16334 Possible values are:
16344 Default is same as input.
16347 Set the transfer characteristics.
16349 Possible values are:
16363 Default is same as input.
16366 Set the colorspace matrix.
16368 Possible value are:
16379 Default is same as input.
16382 Set the input color range.
16384 Possible values are:
16391 Default is same as input.
16393 @item primariesin, pin
16394 Set the input color primaries.
16396 Possible values are:
16406 Default is same as input.
16408 @item transferin, tin
16409 Set the input transfer characteristics.
16411 Possible values are:
16422 Default is same as input.
16424 @item matrixin, min
16425 Set the input colorspace matrix.
16427 Possible value are:
16439 Set the output chroma location.
16441 Possible values are:
16452 @item chromalin, cin
16453 Set the input chroma location.
16455 Possible values are:
16467 Set the nominal peak luminance.
16470 The values of the @option{w} and @option{h} options are expressions
16471 containing the following constants:
16476 The input width and height
16480 These are the same as @var{in_w} and @var{in_h}.
16484 The output (scaled) width and height
16488 These are the same as @var{out_w} and @var{out_h}
16491 The same as @var{iw} / @var{ih}
16494 input sample aspect ratio
16497 The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
16501 horizontal and vertical input chroma subsample values. For example for the
16502 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
16506 horizontal and vertical output chroma subsample values. For example for the
16507 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
16513 @c man end VIDEO FILTERS
16515 @chapter Video Sources
16516 @c man begin VIDEO SOURCES
16518 Below is a description of the currently available video sources.
16522 Buffer video frames, and make them available to the filter chain.
16524 This source is mainly intended for a programmatic use, in particular
16525 through the interface defined in @file{libavfilter/vsrc_buffer.h}.
16527 It accepts the following parameters:
16532 Specify the size (width and height) of the buffered video frames. For the
16533 syntax of this option, check the
16534 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16537 The input video width.
16540 The input video height.
16543 A string representing the pixel format of the buffered video frames.
16544 It may be a number corresponding to a pixel format, or a pixel format
16548 Specify the timebase assumed by the timestamps of the buffered frames.
16551 Specify the frame rate expected for the video stream.
16553 @item pixel_aspect, sar
16554 The sample (pixel) aspect ratio of the input video.
16557 Specify the optional parameters to be used for the scale filter which
16558 is automatically inserted when an input change is detected in the
16559 input size or format.
16561 @item hw_frames_ctx
16562 When using a hardware pixel format, this should be a reference to an
16563 AVHWFramesContext describing input frames.
16568 buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
16571 will instruct the source to accept video frames with size 320x240 and
16572 with format "yuv410p", assuming 1/24 as the timestamps timebase and
16573 square pixels (1:1 sample aspect ratio).
16574 Since the pixel format with name "yuv410p" corresponds to the number 6
16575 (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
16576 this example corresponds to:
16578 buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
16581 Alternatively, the options can be specified as a flat string, but this
16582 syntax is deprecated:
16584 @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}]
16588 Create a pattern generated by an elementary cellular automaton.
16590 The initial state of the cellular automaton can be defined through the
16591 @option{filename} and @option{pattern} options. If such options are
16592 not specified an initial state is created randomly.
16594 At each new frame a new row in the video is filled with the result of
16595 the cellular automaton next generation. The behavior when the whole
16596 frame is filled is defined by the @option{scroll} option.
16598 This source accepts the following options:
16602 Read the initial cellular automaton state, i.e. the starting row, from
16603 the specified file.
16604 In the file, each non-whitespace character is considered an alive
16605 cell, a newline will terminate the row, and further characters in the
16606 file will be ignored.
16609 Read the initial cellular automaton state, i.e. the starting row, from
16610 the specified string.
16612 Each non-whitespace character in the string is considered an alive
16613 cell, a newline will terminate the row, and further characters in the
16614 string will be ignored.
16617 Set the video rate, that is the number of frames generated per second.
16620 @item random_fill_ratio, ratio
16621 Set the random fill ratio for the initial cellular automaton row. It
16622 is a floating point number value ranging from 0 to 1, defaults to
16625 This option is ignored when a file or a pattern is specified.
16627 @item random_seed, seed
16628 Set the seed for filling randomly the initial row, must be an integer
16629 included between 0 and UINT32_MAX. If not specified, or if explicitly
16630 set to -1, the filter will try to use a good random seed on a best
16634 Set the cellular automaton rule, it is a number ranging from 0 to 255.
16635 Default value is 110.
16638 Set the size of the output video. For the syntax of this option, check the
16639 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16641 If @option{filename} or @option{pattern} is specified, the size is set
16642 by default to the width of the specified initial state row, and the
16643 height is set to @var{width} * PHI.
16645 If @option{size} is set, it must contain the width of the specified
16646 pattern string, and the specified pattern will be centered in the
16649 If a filename or a pattern string is not specified, the size value
16650 defaults to "320x518" (used for a randomly generated initial state).
16653 If set to 1, scroll the output upward when all the rows in the output
16654 have been already filled. If set to 0, the new generated row will be
16655 written over the top row just after the bottom row is filled.
16658 @item start_full, full
16659 If set to 1, completely fill the output with generated rows before
16660 outputting the first frame.
16661 This is the default behavior, for disabling set the value to 0.
16664 If set to 1, stitch the left and right row edges together.
16665 This is the default behavior, for disabling set the value to 0.
16668 @subsection Examples
16672 Read the initial state from @file{pattern}, and specify an output of
16675 cellauto=f=pattern:s=200x400
16679 Generate a random initial row with a width of 200 cells, with a fill
16682 cellauto=ratio=2/3:s=200x200
16686 Create a pattern generated by rule 18 starting by a single alive cell
16687 centered on an initial row with width 100:
16689 cellauto=p=@@:s=100x400:full=0:rule=18
16693 Specify a more elaborated initial pattern:
16695 cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
16700 @anchor{coreimagesrc}
16701 @section coreimagesrc
16702 Video source generated on GPU using Apple's CoreImage API on OSX.
16704 This video source is a specialized version of the @ref{coreimage} video filter.
16705 Use a core image generator at the beginning of the applied filterchain to
16706 generate the content.
16708 The coreimagesrc video source accepts the following options:
16710 @item list_generators
16711 List all available generators along with all their respective options as well as
16712 possible minimum and maximum values along with the default values.
16714 list_generators=true
16718 Specify the size of the sourced video. For the syntax of this option, check the
16719 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16720 The default value is @code{320x240}.
16723 Specify the frame rate of the sourced video, as the number of frames
16724 generated per second. It has to be a string in the format
16725 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
16726 number or a valid video frame rate abbreviation. The default value is
16730 Set the sample aspect ratio of the sourced video.
16733 Set the duration of the sourced video. See
16734 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
16735 for the accepted syntax.
16737 If not specified, or the expressed duration is negative, the video is
16738 supposed to be generated forever.
16741 Additionally, all options of the @ref{coreimage} video filter are accepted.
16742 A complete filterchain can be used for further processing of the
16743 generated input without CPU-HOST transfer. See @ref{coreimage} documentation
16744 and examples for details.
16746 @subsection Examples
16751 Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
16752 given as complete and escaped command-line for Apple's standard bash shell:
16754 ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
16756 This example is equivalent to the QRCode example of @ref{coreimage} without the
16757 need for a nullsrc video source.
16761 @section mandelbrot
16763 Generate a Mandelbrot set fractal, and progressively zoom towards the
16764 point specified with @var{start_x} and @var{start_y}.
16766 This source accepts the following options:
16771 Set the terminal pts value. Default value is 400.
16774 Set the terminal scale value.
16775 Must be a floating point value. Default value is 0.3.
16778 Set the inner coloring mode, that is the algorithm used to draw the
16779 Mandelbrot fractal internal region.
16781 It shall assume one of the following values:
16786 Show time until convergence.
16788 Set color based on point closest to the origin of the iterations.
16793 Default value is @var{mincol}.
16796 Set the bailout value. Default value is 10.0.
16799 Set the maximum of iterations performed by the rendering
16800 algorithm. Default value is 7189.
16803 Set outer coloring mode.
16804 It shall assume one of following values:
16806 @item iteration_count
16807 Set iteration cound mode.
16808 @item normalized_iteration_count
16809 set normalized iteration count mode.
16811 Default value is @var{normalized_iteration_count}.
16814 Set frame rate, expressed as number of frames per second. Default
16818 Set frame size. For the syntax of this option, check the "Video
16819 size" section in the ffmpeg-utils manual. Default value is "640x480".
16822 Set the initial scale value. Default value is 3.0.
16825 Set the initial x position. Must be a floating point value between
16826 -100 and 100. Default value is -0.743643887037158704752191506114774.
16829 Set the initial y position. Must be a floating point value between
16830 -100 and 100. Default value is -0.131825904205311970493132056385139.
16835 Generate various test patterns, as generated by the MPlayer test filter.
16837 The size of the generated video is fixed, and is 256x256.
16838 This source is useful in particular for testing encoding features.
16840 This source accepts the following options:
16845 Specify the frame rate of the sourced video, as the number of frames
16846 generated per second. It has to be a string in the format
16847 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
16848 number or a valid video frame rate abbreviation. The default value is
16852 Set the duration of the sourced video. See
16853 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
16854 for the accepted syntax.
16856 If not specified, or the expressed duration is negative, the video is
16857 supposed to be generated forever.
16861 Set the number or the name of the test to perform. Supported tests are:
16877 Default value is "all", which will cycle through the list of all tests.
16882 mptestsrc=t=dc_luma
16885 will generate a "dc_luma" test pattern.
16887 @section frei0r_src
16889 Provide a frei0r source.
16891 To enable compilation of this filter you need to install the frei0r
16892 header and configure FFmpeg with @code{--enable-frei0r}.
16894 This source accepts the following parameters:
16899 The size of the video to generate. For the syntax of this option, check the
16900 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16903 The framerate of the generated video. It may be a string of the form
16904 @var{num}/@var{den} or a frame rate abbreviation.
16907 The name to the frei0r source to load. For more information regarding frei0r and
16908 how to set the parameters, read the @ref{frei0r} section in the video filters
16911 @item filter_params
16912 A '|'-separated list of parameters to pass to the frei0r source.
16916 For example, to generate a frei0r partik0l source with size 200x200
16917 and frame rate 10 which is overlaid on the overlay filter main input:
16919 frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
16924 Generate a life pattern.
16926 This source is based on a generalization of John Conway's life game.
16928 The sourced input represents a life grid, each pixel represents a cell
16929 which can be in one of two possible states, alive or dead. Every cell
16930 interacts with its eight neighbours, which are the cells that are
16931 horizontally, vertically, or diagonally adjacent.
16933 At each interaction the grid evolves according to the adopted rule,
16934 which specifies the number of neighbor alive cells which will make a
16935 cell stay alive or born. The @option{rule} option allows one to specify
16938 This source accepts the following options:
16942 Set the file from which to read the initial grid state. In the file,
16943 each non-whitespace character is considered an alive cell, and newline
16944 is used to delimit the end of each row.
16946 If this option is not specified, the initial grid is generated
16950 Set the video rate, that is the number of frames generated per second.
16953 @item random_fill_ratio, ratio
16954 Set the random fill ratio for the initial random grid. It is a
16955 floating point number value ranging from 0 to 1, defaults to 1/PHI.
16956 It is ignored when a file is specified.
16958 @item random_seed, seed
16959 Set the seed for filling the initial random grid, must be an integer
16960 included between 0 and UINT32_MAX. If not specified, or if explicitly
16961 set to -1, the filter will try to use a good random seed on a best
16967 A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
16968 where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
16969 @var{NS} specifies the number of alive neighbor cells which make a
16970 live cell stay alive, and @var{NB} the number of alive neighbor cells
16971 which make a dead cell to become alive (i.e. to "born").
16972 "s" and "b" can be used in place of "S" and "B", respectively.
16974 Alternatively a rule can be specified by an 18-bits integer. The 9
16975 high order bits are used to encode the next cell state if it is alive
16976 for each number of neighbor alive cells, the low order bits specify
16977 the rule for "borning" new cells. Higher order bits encode for an
16978 higher number of neighbor cells.
16979 For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
16980 rule of 12 and a born rule of 9, which corresponds to "S23/B03".
16982 Default value is "S23/B3", which is the original Conway's game of life
16983 rule, and will keep a cell alive if it has 2 or 3 neighbor alive
16984 cells, and will born a new cell if there are three alive cells around
16988 Set the size of the output video. For the syntax of this option, check the
16989 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
16991 If @option{filename} is specified, the size is set by default to the
16992 same size of the input file. If @option{size} is set, it must contain
16993 the size specified in the input file, and the initial grid defined in
16994 that file is centered in the larger resulting area.
16996 If a filename is not specified, the size value defaults to "320x240"
16997 (used for a randomly generated initial grid).
17000 If set to 1, stitch the left and right grid edges together, and the
17001 top and bottom edges also. Defaults to 1.
17004 Set cell mold speed. If set, a dead cell will go from @option{death_color} to
17005 @option{mold_color} with a step of @option{mold}. @option{mold} can have a
17006 value from 0 to 255.
17009 Set the color of living (or new born) cells.
17012 Set the color of dead cells. If @option{mold} is set, this is the first color
17013 used to represent a dead cell.
17016 Set mold color, for definitely dead and moldy cells.
17018 For the syntax of these 3 color options, check the "Color" section in the
17019 ffmpeg-utils manual.
17022 @subsection Examples
17026 Read a grid from @file{pattern}, and center it on a grid of size
17029 life=f=pattern:s=300x300
17033 Generate a random grid of size 200x200, with a fill ratio of 2/3:
17035 life=ratio=2/3:s=200x200
17039 Specify a custom rule for evolving a randomly generated grid:
17045 Full example with slow death effect (mold) using @command{ffplay}:
17047 ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
17054 @anchor{haldclutsrc}
17056 @anchor{rgbtestsrc}
17058 @anchor{smptehdbars}
17061 @anchor{yuvtestsrc}
17062 @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
17064 The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
17066 The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
17068 The @code{color} source provides an uniformly colored input.
17070 The @code{haldclutsrc} source provides an identity Hald CLUT. See also
17071 @ref{haldclut} filter.
17073 The @code{nullsrc} source returns unprocessed video frames. It is
17074 mainly useful to be employed in analysis / debugging tools, or as the
17075 source for filters which ignore the input data.
17077 The @code{rgbtestsrc} source generates an RGB test pattern useful for
17078 detecting RGB vs BGR issues. You should see a red, green and blue
17079 stripe from top to bottom.
17081 The @code{smptebars} source generates a color bars pattern, based on
17082 the SMPTE Engineering Guideline EG 1-1990.
17084 The @code{smptehdbars} source generates a color bars pattern, based on
17085 the SMPTE RP 219-2002.
17087 The @code{testsrc} source generates a test video pattern, showing a
17088 color pattern, a scrolling gradient and a timestamp. This is mainly
17089 intended for testing purposes.
17091 The @code{testsrc2} source is similar to testsrc, but supports more
17092 pixel formats instead of just @code{rgb24}. This allows using it as an
17093 input for other tests without requiring a format conversion.
17095 The @code{yuvtestsrc} source generates an YUV test pattern. You should
17096 see a y, cb and cr stripe from top to bottom.
17098 The sources accept the following parameters:
17103 Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
17104 source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
17105 pixels to be used as identity matrix for 3D lookup tables. Each component is
17106 coded on a @code{1/(N*N)} scale.
17109 Specify the color of the source, only available in the @code{color}
17110 source. For the syntax of this option, check the "Color" section in the
17111 ffmpeg-utils manual.
17114 Specify the size of the sourced video. For the syntax of this option, check the
17115 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17116 The default value is @code{320x240}.
17118 This option is not available with the @code{allrgb}, @code{allyuv}, and
17119 @code{haldclutsrc} filters.
17122 Specify the frame rate of the sourced video, as the number of frames
17123 generated per second. It has to be a string in the format
17124 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
17125 number or a valid video frame rate abbreviation. The default value is
17129 Set the duration of the sourced video. See
17130 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
17131 for the accepted syntax.
17133 If not specified, or the expressed duration is negative, the video is
17134 supposed to be generated forever.
17137 Set the sample aspect ratio of the sourced video.
17140 Specify the alpha (opacity) of the background, only available in the
17141 @code{testsrc2} source. The value must be between 0 (fully transparent) and
17142 255 (fully opaque, the default).
17145 Set the number of decimals to show in the timestamp, only available in the
17146 @code{testsrc} source.
17148 The displayed timestamp value will correspond to the original
17149 timestamp value multiplied by the power of 10 of the specified
17150 value. Default value is 0.
17153 @subsection Examples
17157 Generate a video with a duration of 5.3 seconds, with size
17158 176x144 and a frame rate of 10 frames per second:
17160 testsrc=duration=5.3:size=qcif:rate=10
17164 The following graph description will generate a red source
17165 with an opacity of 0.2, with size "qcif" and a frame rate of 10
17168 color=c=red@@0.2:s=qcif:r=10
17172 If the input content is to be ignored, @code{nullsrc} can be used. The
17173 following command generates noise in the luminance plane by employing
17174 the @code{geq} filter:
17176 nullsrc=s=256x256, geq=random(1)*255:128:128
17180 @subsection Commands
17182 The @code{color} source supports the following commands:
17186 Set the color of the created image. Accepts the same syntax of the
17187 corresponding @option{color} option.
17190 @c man end VIDEO SOURCES
17192 @chapter Video Sinks
17193 @c man begin VIDEO SINKS
17195 Below is a description of the currently available video sinks.
17197 @section buffersink
17199 Buffer video frames, and make them available to the end of the filter
17202 This sink is mainly intended for programmatic use, in particular
17203 through the interface defined in @file{libavfilter/buffersink.h}
17204 or the options system.
17206 It accepts a pointer to an AVBufferSinkContext structure, which
17207 defines the incoming buffers' formats, to be passed as the opaque
17208 parameter to @code{avfilter_init_filter} for initialization.
17212 Null video sink: do absolutely nothing with the input video. It is
17213 mainly useful as a template and for use in analysis / debugging
17216 @c man end VIDEO SINKS
17218 @chapter Multimedia Filters
17219 @c man begin MULTIMEDIA FILTERS
17221 Below is a description of the currently available multimedia filters.
17225 Convert input audio to a video output, displaying the audio bit scope.
17227 The filter accepts the following options:
17231 Set frame rate, expressed as number of frames per second. Default
17235 Specify the video size for the output. For the syntax of this option, check the
17236 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17237 Default value is @code{1024x256}.
17240 Specify list of colors separated by space or by '|' which will be used to
17241 draw channels. Unrecognized or missing colors will be replaced
17245 @section ahistogram
17247 Convert input audio to a video output, displaying the volume histogram.
17249 The filter accepts the following options:
17253 Specify how histogram is calculated.
17255 It accepts the following values:
17258 Use single histogram for all channels.
17260 Use separate histogram for each channel.
17262 Default is @code{single}.
17265 Set frame rate, expressed as number of frames per second. Default
17269 Specify the video size for the output. For the syntax of this option, check the
17270 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17271 Default value is @code{hd720}.
17276 It accepts the following values:
17287 reverse logarithmic
17289 Default is @code{log}.
17292 Set amplitude scale.
17294 It accepts the following values:
17301 Default is @code{log}.
17304 Set how much frames to accumulate in histogram.
17305 Defauls is 1. Setting this to -1 accumulates all frames.
17308 Set histogram ratio of window height.
17311 Set sonogram sliding.
17313 It accepts the following values:
17316 replace old rows with new ones.
17318 scroll from top to bottom.
17320 Default is @code{replace}.
17323 @section aphasemeter
17325 Convert input audio to a video output, displaying the audio phase.
17327 The filter accepts the following options:
17331 Set the output frame rate. Default value is @code{25}.
17334 Set the video size for the output. For the syntax of this option, check the
17335 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17336 Default value is @code{800x400}.
17341 Specify the red, green, blue contrast. Default values are @code{2},
17342 @code{7} and @code{1}.
17343 Allowed range is @code{[0, 255]}.
17346 Set color which will be used for drawing median phase. If color is
17347 @code{none} which is default, no median phase value will be drawn.
17350 Enable video output. Default is enabled.
17353 The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
17354 represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
17355 The @code{-1} means left and right channels are completely out of phase and
17356 @code{1} means channels are in phase.
17358 @section avectorscope
17360 Convert input audio to a video output, representing the audio vector
17363 The filter is used to measure the difference between channels of stereo
17364 audio stream. A monoaural signal, consisting of identical left and right
17365 signal, results in straight vertical line. Any stereo separation is visible
17366 as a deviation from this line, creating a Lissajous figure.
17367 If the straight (or deviation from it) but horizontal line appears this
17368 indicates that the left and right channels are out of phase.
17370 The filter accepts the following options:
17374 Set the vectorscope mode.
17376 Available values are:
17379 Lissajous rotated by 45 degrees.
17382 Same as above but not rotated.
17385 Shape resembling half of circle.
17388 Default value is @samp{lissajous}.
17391 Set the video size for the output. For the syntax of this option, check the
17392 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17393 Default value is @code{400x400}.
17396 Set the output frame rate. Default value is @code{25}.
17402 Specify the red, green, blue and alpha contrast. Default values are @code{40},
17403 @code{160}, @code{80} and @code{255}.
17404 Allowed range is @code{[0, 255]}.
17410 Specify the red, green, blue and alpha fade. Default values are @code{15},
17411 @code{10}, @code{5} and @code{5}.
17412 Allowed range is @code{[0, 255]}.
17415 Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
17416 Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
17419 Set the vectorscope drawing mode.
17421 Available values are:
17424 Draw dot for each sample.
17427 Draw line between previous and current sample.
17430 Default value is @samp{dot}.
17433 Specify amplitude scale of audio samples.
17435 Available values are:
17451 Swap left channel axis with right channel axis.
17461 Mirror only x axis.
17464 Mirror only y axis.
17472 @subsection Examples
17476 Complete example using @command{ffplay}:
17478 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
17479 [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
17483 @section bench, abench
17485 Benchmark part of a filtergraph.
17487 The filter accepts the following options:
17491 Start or stop a timer.
17493 Available values are:
17496 Get the current time, set it as frame metadata (using the key
17497 @code{lavfi.bench.start_time}), and forward the frame to the next filter.
17500 Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
17501 the input frame metadata to get the time difference. Time difference, average,
17502 maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
17503 @code{min}) are then printed. The timestamps are expressed in seconds.
17507 @subsection Examples
17511 Benchmark @ref{selectivecolor} filter:
17513 bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
17519 Concatenate audio and video streams, joining them together one after the
17522 The filter works on segments of synchronized video and audio streams. All
17523 segments must have the same number of streams of each type, and that will
17524 also be the number of streams at output.
17526 The filter accepts the following options:
17531 Set the number of segments. Default is 2.
17534 Set the number of output video streams, that is also the number of video
17535 streams in each segment. Default is 1.
17538 Set the number of output audio streams, that is also the number of audio
17539 streams in each segment. Default is 0.
17542 Activate unsafe mode: do not fail if segments have a different format.
17546 The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
17547 @var{a} audio outputs.
17549 There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
17550 segment, in the same order as the outputs, then the inputs for the second
17553 Related streams do not always have exactly the same duration, for various
17554 reasons including codec frame size or sloppy authoring. For that reason,
17555 related synchronized streams (e.g. a video and its audio track) should be
17556 concatenated at once. The concat filter will use the duration of the longest
17557 stream in each segment (except the last one), and if necessary pad shorter
17558 audio streams with silence.
17560 For this filter to work correctly, all segments must start at timestamp 0.
17562 All corresponding streams must have the same parameters in all segments; the
17563 filtering system will automatically select a common pixel format for video
17564 streams, and a common sample format, sample rate and channel layout for
17565 audio streams, but other settings, such as resolution, must be converted
17566 explicitly by the user.
17568 Different frame rates are acceptable but will result in variable frame rate
17569 at output; be sure to configure the output file to handle it.
17571 @subsection Examples
17575 Concatenate an opening, an episode and an ending, all in bilingual version
17576 (video in stream 0, audio in streams 1 and 2):
17578 ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
17579 '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
17580 concat=n=3:v=1:a=2 [v] [a1] [a2]' \
17581 -map '[v]' -map '[a1]' -map '[a2]' output.mkv
17585 Concatenate two parts, handling audio and video separately, using the
17586 (a)movie sources, and adjusting the resolution:
17588 movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
17589 movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
17590 [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
17592 Note that a desync will happen at the stitch if the audio and video streams
17593 do not have exactly the same duration in the first file.
17597 @section drawgraph, adrawgraph
17599 Draw a graph using input video or audio metadata.
17601 It accepts the following parameters:
17605 Set 1st frame metadata key from which metadata values will be used to draw a graph.
17608 Set 1st foreground color expression.
17611 Set 2nd frame metadata key from which metadata values will be used to draw a graph.
17614 Set 2nd foreground color expression.
17617 Set 3rd frame metadata key from which metadata values will be used to draw a graph.
17620 Set 3rd foreground color expression.
17623 Set 4th frame metadata key from which metadata values will be used to draw a graph.
17626 Set 4th foreground color expression.
17629 Set minimal value of metadata value.
17632 Set maximal value of metadata value.
17635 Set graph background color. Default is white.
17640 Available values for mode is:
17647 Default is @code{line}.
17652 Available values for slide is:
17655 Draw new frame when right border is reached.
17658 Replace old columns with new ones.
17661 Scroll from right to left.
17664 Scroll from left to right.
17667 Draw single picture.
17670 Default is @code{frame}.
17673 Set size of graph video. For the syntax of this option, check the
17674 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17675 The default value is @code{900x256}.
17677 The foreground color expressions can use the following variables:
17680 Minimal value of metadata value.
17683 Maximal value of metadata value.
17686 Current metadata key value.
17689 The color is defined as 0xAABBGGRR.
17692 Example using metadata from @ref{signalstats} filter:
17694 signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
17697 Example using metadata from @ref{ebur128} filter:
17699 ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
17705 EBU R128 scanner filter. This filter takes an audio stream as input and outputs
17706 it unchanged. By default, it logs a message at a frequency of 10Hz with the
17707 Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
17708 Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
17710 The filter also has a video output (see the @var{video} option) with a real
17711 time graph to observe the loudness evolution. The graphic contains the logged
17712 message mentioned above, so it is not printed anymore when this option is set,
17713 unless the verbose logging is set. The main graphing area contains the
17714 short-term loudness (3 seconds of analysis), and the gauge on the right is for
17715 the momentary loudness (400 milliseconds).
17717 More information about the Loudness Recommendation EBU R128 on
17718 @url{http://tech.ebu.ch/loudness}.
17720 The filter accepts the following options:
17725 Activate the video output. The audio stream is passed unchanged whether this
17726 option is set or no. The video stream will be the first output stream if
17727 activated. Default is @code{0}.
17730 Set the video size. This option is for video only. For the syntax of this
17732 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
17733 Default and minimum resolution is @code{640x480}.
17736 Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
17737 @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
17738 other integer value between this range is allowed.
17741 Set metadata injection. If set to @code{1}, the audio input will be segmented
17742 into 100ms output frames, each of them containing various loudness information
17743 in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
17745 Default is @code{0}.
17748 Force the frame logging level.
17750 Available values are:
17753 information logging level
17755 verbose logging level
17758 By default, the logging level is set to @var{info}. If the @option{video} or
17759 the @option{metadata} options are set, it switches to @var{verbose}.
17764 Available modes can be cumulated (the option is a @code{flag} type). Possible
17768 Disable any peak mode (default).
17770 Enable sample-peak mode.
17772 Simple peak mode looking for the higher sample value. It logs a message
17773 for sample-peak (identified by @code{SPK}).
17775 Enable true-peak mode.
17777 If enabled, the peak lookup is done on an over-sampled version of the input
17778 stream for better peak accuracy. It logs a message for true-peak.
17779 (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
17780 This mode requires a build with @code{libswresample}.
17784 Treat mono input files as "dual mono". If a mono file is intended for playback
17785 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
17786 If set to @code{true}, this option will compensate for this effect.
17787 Multi-channel input files are not affected by this option.
17790 Set a specific pan law to be used for the measurement of dual mono files.
17791 This parameter is optional, and has a default value of -3.01dB.
17794 @subsection Examples
17798 Real-time graph using @command{ffplay}, with a EBU scale meter +18:
17800 ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
17804 Run an analysis with @command{ffmpeg}:
17806 ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
17810 @section interleave, ainterleave
17812 Temporally interleave frames from several inputs.
17814 @code{interleave} works with video inputs, @code{ainterleave} with audio.
17816 These filters read frames from several inputs and send the oldest
17817 queued frame to the output.
17819 Input streams must have well defined, monotonically increasing frame
17822 In order to submit one frame to output, these filters need to enqueue
17823 at least one frame for each input, so they cannot work in case one
17824 input is not yet terminated and will not receive incoming frames.
17826 For example consider the case when one input is a @code{select} filter
17827 which always drops input frames. The @code{interleave} filter will keep
17828 reading from that input, but it will never be able to send new frames
17829 to output until the input sends an end-of-stream signal.
17831 Also, depending on inputs synchronization, the filters will drop
17832 frames in case one input receives more frames than the other ones, and
17833 the queue is already filled.
17835 These filters accept the following options:
17839 Set the number of different inputs, it is 2 by default.
17842 @subsection Examples
17846 Interleave frames belonging to different streams using @command{ffmpeg}:
17848 ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
17852 Add flickering blur effect:
17854 select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
17858 @section metadata, ametadata
17860 Manipulate frame metadata.
17862 This filter accepts the following options:
17866 Set mode of operation of the filter.
17868 Can be one of the following:
17872 If both @code{value} and @code{key} is set, select frames
17873 which have such metadata. If only @code{key} is set, select
17874 every frame that has such key in metadata.
17877 Add new metadata @code{key} and @code{value}. If key is already available
17881 Modify value of already present key.
17884 If @code{value} is set, delete only keys that have such value.
17885 Otherwise, delete key. If @code{key} is not set, delete all metadata values in
17889 Print key and its value if metadata was found. If @code{key} is not set print all
17890 metadata values available in frame.
17894 Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
17897 Set metadata value which will be used. This option is mandatory for
17898 @code{modify} and @code{add} mode.
17901 Which function to use when comparing metadata value and @code{value}.
17903 Can be one of following:
17907 Values are interpreted as strings, returns true if metadata value is same as @code{value}.
17910 Values are interpreted as strings, returns true if metadata value starts with
17911 the @code{value} option string.
17914 Values are interpreted as floats, returns true if metadata value is less than @code{value}.
17917 Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
17920 Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
17923 Values are interpreted as floats, returns true if expression from option @code{expr}
17928 Set expression which is used when @code{function} is set to @code{expr}.
17929 The expression is evaluated through the eval API and can contain the following
17934 Float representation of @code{value} from metadata key.
17937 Float representation of @code{value} as supplied by user in @code{value} option.
17941 If specified in @code{print} mode, output is written to the named file. Instead of
17942 plain filename any writable url can be specified. Filename ``-'' is a shorthand
17943 for standard output. If @code{file} option is not set, output is written to the log
17944 with AV_LOG_INFO loglevel.
17948 @subsection Examples
17952 Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
17955 signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
17958 Print silencedetect output to file @file{metadata.txt}.
17960 silencedetect,ametadata=mode=print:file=metadata.txt
17963 Direct all metadata to a pipe with file descriptor 4.
17965 metadata=mode=print:file='pipe\:4'
17969 @section perms, aperms
17971 Set read/write permissions for the output frames.
17973 These filters are mainly aimed at developers to test direct path in the
17974 following filter in the filtergraph.
17976 The filters accept the following options:
17980 Select the permissions mode.
17982 It accepts the following values:
17985 Do nothing. This is the default.
17987 Set all the output frames read-only.
17989 Set all the output frames directly writable.
17991 Make the frame read-only if writable, and writable if read-only.
17993 Set each output frame read-only or writable randomly.
17997 Set the seed for the @var{random} mode, must be an integer included between
17998 @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
17999 @code{-1}, the filter will try to use a good random seed on a best effort
18003 Note: in case of auto-inserted filter between the permission filter and the
18004 following one, the permission might not be received as expected in that
18005 following filter. Inserting a @ref{format} or @ref{aformat} filter before the
18006 perms/aperms filter can avoid this problem.
18008 @section realtime, arealtime
18010 Slow down filtering to match real time approximately.
18012 These filters will pause the filtering for a variable amount of time to
18013 match the output rate with the input timestamps.
18014 They are similar to the @option{re} option to @code{ffmpeg}.
18016 They accept the following options:
18020 Time limit for the pauses. Any pause longer than that will be considered
18021 a timestamp discontinuity and reset the timer. Default is 2 seconds.
18025 @section select, aselect
18027 Select frames to pass in output.
18029 This filter accepts the following options:
18034 Set expression, which is evaluated for each input frame.
18036 If the expression is evaluated to zero, the frame is discarded.
18038 If the evaluation result is negative or NaN, the frame is sent to the
18039 first output; otherwise it is sent to the output with index
18040 @code{ceil(val)-1}, assuming that the input index starts from 0.
18042 For example a value of @code{1.2} corresponds to the output with index
18043 @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
18046 Set the number of outputs. The output to which to send the selected
18047 frame is based on the result of the evaluation. Default value is 1.
18050 The expression can contain the following constants:
18054 The (sequential) number of the filtered frame, starting from 0.
18057 The (sequential) number of the selected frame, starting from 0.
18059 @item prev_selected_n
18060 The sequential number of the last selected frame. It's NAN if undefined.
18063 The timebase of the input timestamps.
18066 The PTS (Presentation TimeStamp) of the filtered video frame,
18067 expressed in @var{TB} units. It's NAN if undefined.
18070 The PTS of the filtered video frame,
18071 expressed in seconds. It's NAN if undefined.
18074 The PTS of the previously filtered video frame. It's NAN if undefined.
18076 @item prev_selected_pts
18077 The PTS of the last previously filtered video frame. It's NAN if undefined.
18079 @item prev_selected_t
18080 The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
18083 The PTS of the first video frame in the video. It's NAN if undefined.
18086 The time of the first video frame in the video. It's NAN if undefined.
18088 @item pict_type @emph{(video only)}
18089 The type of the filtered frame. It can assume one of the following
18101 @item interlace_type @emph{(video only)}
18102 The frame interlace type. It can assume one of the following values:
18105 The frame is progressive (not interlaced).
18107 The frame is top-field-first.
18109 The frame is bottom-field-first.
18112 @item consumed_sample_n @emph{(audio only)}
18113 the number of selected samples before the current frame
18115 @item samples_n @emph{(audio only)}
18116 the number of samples in the current frame
18118 @item sample_rate @emph{(audio only)}
18119 the input sample rate
18122 This is 1 if the filtered frame is a key-frame, 0 otherwise.
18125 the position in the file of the filtered frame, -1 if the information
18126 is not available (e.g. for synthetic video)
18128 @item scene @emph{(video only)}
18129 value between 0 and 1 to indicate a new scene; a low value reflects a low
18130 probability for the current frame to introduce a new scene, while a higher
18131 value means the current frame is more likely to be one (see the example below)
18133 @item concatdec_select
18134 The concat demuxer can select only part of a concat input file by setting an
18135 inpoint and an outpoint, but the output packets may not be entirely contained
18136 in the selected interval. By using this variable, it is possible to skip frames
18137 generated by the concat demuxer which are not exactly contained in the selected
18140 This works by comparing the frame pts against the @var{lavf.concat.start_time}
18141 and the @var{lavf.concat.duration} packet metadata values which are also
18142 present in the decoded frames.
18144 The @var{concatdec_select} variable is -1 if the frame pts is at least
18145 start_time and either the duration metadata is missing or the frame pts is less
18146 than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
18149 That basically means that an input frame is selected if its pts is within the
18150 interval set by the concat demuxer.
18154 The default value of the select expression is "1".
18156 @subsection Examples
18160 Select all frames in input:
18165 The example above is the same as:
18177 Select only I-frames:
18179 select='eq(pict_type\,I)'
18183 Select one frame every 100:
18185 select='not(mod(n\,100))'
18189 Select only frames contained in the 10-20 time interval:
18191 select=between(t\,10\,20)
18195 Select only I-frames contained in the 10-20 time interval:
18197 select=between(t\,10\,20)*eq(pict_type\,I)
18201 Select frames with a minimum distance of 10 seconds:
18203 select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
18207 Use aselect to select only audio frames with samples number > 100:
18209 aselect='gt(samples_n\,100)'
18213 Create a mosaic of the first scenes:
18215 ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
18218 Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
18222 Send even and odd frames to separate outputs, and compose them:
18224 select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
18228 Select useful frames from an ffconcat file which is using inpoints and
18229 outpoints but where the source files are not intra frame only.
18231 ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
18235 @section sendcmd, asendcmd
18237 Send commands to filters in the filtergraph.
18239 These filters read commands to be sent to other filters in the
18242 @code{sendcmd} must be inserted between two video filters,
18243 @code{asendcmd} must be inserted between two audio filters, but apart
18244 from that they act the same way.
18246 The specification of commands can be provided in the filter arguments
18247 with the @var{commands} option, or in a file specified by the
18248 @var{filename} option.
18250 These filters accept the following options:
18253 Set the commands to be read and sent to the other filters.
18255 Set the filename of the commands to be read and sent to the other
18259 @subsection Commands syntax
18261 A commands description consists of a sequence of interval
18262 specifications, comprising a list of commands to be executed when a
18263 particular event related to that interval occurs. The occurring event
18264 is typically the current frame time entering or leaving a given time
18267 An interval is specified by the following syntax:
18269 @var{START}[-@var{END}] @var{COMMANDS};
18272 The time interval is specified by the @var{START} and @var{END} times.
18273 @var{END} is optional and defaults to the maximum time.
18275 The current frame time is considered within the specified interval if
18276 it is included in the interval [@var{START}, @var{END}), that is when
18277 the time is greater or equal to @var{START} and is lesser than
18280 @var{COMMANDS} consists of a sequence of one or more command
18281 specifications, separated by ",", relating to that interval. The
18282 syntax of a command specification is given by:
18284 [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
18287 @var{FLAGS} is optional and specifies the type of events relating to
18288 the time interval which enable sending the specified command, and must
18289 be a non-null sequence of identifier flags separated by "+" or "|" and
18290 enclosed between "[" and "]".
18292 The following flags are recognized:
18295 The command is sent when the current frame timestamp enters the
18296 specified interval. In other words, the command is sent when the
18297 previous frame timestamp was not in the given interval, and the
18301 The command is sent when the current frame timestamp leaves the
18302 specified interval. In other words, the command is sent when the
18303 previous frame timestamp was in the given interval, and the
18307 If @var{FLAGS} is not specified, a default value of @code{[enter]} is
18310 @var{TARGET} specifies the target of the command, usually the name of
18311 the filter class or a specific filter instance name.
18313 @var{COMMAND} specifies the name of the command for the target filter.
18315 @var{ARG} is optional and specifies the optional list of argument for
18316 the given @var{COMMAND}.
18318 Between one interval specification and another, whitespaces, or
18319 sequences of characters starting with @code{#} until the end of line,
18320 are ignored and can be used to annotate comments.
18322 A simplified BNF description of the commands specification syntax
18325 @var{COMMAND_FLAG} ::= "enter" | "leave"
18326 @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
18327 @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
18328 @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
18329 @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
18330 @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
18333 @subsection Examples
18337 Specify audio tempo change at second 4:
18339 asendcmd=c='4.0 atempo tempo 1.5',atempo
18343 Target a specific filter instance:
18345 asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
18349 Specify a list of drawtext and hue commands in a file.
18351 # show text in the interval 5-10
18352 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
18353 [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
18355 # desaturate the image in the interval 15-20
18356 15.0-20.0 [enter] hue s 0,
18357 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
18359 [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
18361 # apply an exponential saturation fade-out effect, starting from time 25
18362 25 [enter] hue s exp(25-t)
18365 A filtergraph allowing to read and process the above command list
18366 stored in a file @file{test.cmd}, can be specified with:
18368 sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
18373 @section setpts, asetpts
18375 Change the PTS (presentation timestamp) of the input frames.
18377 @code{setpts} works on video frames, @code{asetpts} on audio frames.
18379 This filter accepts the following options:
18384 The expression which is evaluated for each frame to construct its timestamp.
18388 The expression is evaluated through the eval API and can contain the following
18393 frame rate, only defined for constant frame-rate video
18396 The presentation timestamp in input
18399 The count of the input frame for video or the number of consumed samples,
18400 not including the current frame for audio, starting from 0.
18402 @item NB_CONSUMED_SAMPLES
18403 The number of consumed samples, not including the current frame (only
18406 @item NB_SAMPLES, S
18407 The number of samples in the current frame (only audio)
18409 @item SAMPLE_RATE, SR
18410 The audio sample rate.
18413 The PTS of the first frame.
18416 the time in seconds of the first frame
18419 State whether the current frame is interlaced.
18422 the time in seconds of the current frame
18425 original position in the file of the frame, or undefined if undefined
18426 for the current frame
18429 The previous input PTS.
18432 previous input time in seconds
18435 The previous output PTS.
18438 previous output time in seconds
18441 The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
18445 The wallclock (RTC) time at the start of the movie in microseconds.
18448 The timebase of the input timestamps.
18452 @subsection Examples
18456 Start counting PTS from zero
18458 setpts=PTS-STARTPTS
18462 Apply fast motion effect:
18468 Apply slow motion effect:
18474 Set fixed rate of 25 frames per second:
18480 Set fixed rate 25 fps with some jitter:
18482 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
18486 Apply an offset of 10 seconds to the input PTS:
18492 Generate timestamps from a "live source" and rebase onto the current timebase:
18494 setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
18498 Generate timestamps by counting samples:
18507 Force color range for the output video frame.
18509 The @code{setrange} filter marks the color range property for the
18510 output frames. It does not change the input frame, but only sets the
18511 corresponding property, which affects how the frame is treated by
18514 The filter accepts the following options:
18519 Available values are:
18523 Keep the same color range property.
18525 @item unspecified, unknown
18526 Set the color range as unspecified.
18528 @item limited, tv, mpeg
18529 Set the color range as limited.
18531 @item full, pc, jpeg
18532 Set the color range as full.
18536 @section settb, asettb
18538 Set the timebase to use for the output frames timestamps.
18539 It is mainly useful for testing timebase configuration.
18541 It accepts the following parameters:
18546 The expression which is evaluated into the output timebase.
18550 The value for @option{tb} is an arithmetic expression representing a
18551 rational. The expression can contain the constants "AVTB" (the default
18552 timebase), "intb" (the input timebase) and "sr" (the sample rate,
18553 audio only). Default value is "intb".
18555 @subsection Examples
18559 Set the timebase to 1/25:
18565 Set the timebase to 1/10:
18571 Set the timebase to 1001/1000:
18577 Set the timebase to 2*intb:
18583 Set the default timebase value:
18590 Convert input audio to a video output representing frequency spectrum
18591 logarithmically using Brown-Puckette constant Q transform algorithm with
18592 direct frequency domain coefficient calculation (but the transform itself
18593 is not really constant Q, instead the Q factor is actually variable/clamped),
18594 with musical tone scale, from E0 to D#10.
18596 The filter accepts the following options:
18600 Specify the video size for the output. It must be even. For the syntax of this option,
18601 check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18602 Default value is @code{1920x1080}.
18605 Set the output frame rate. Default value is @code{25}.
18608 Set the bargraph height. It must be even. Default value is @code{-1} which
18609 computes the bargraph height automatically.
18612 Set the axis height. It must be even. Default value is @code{-1} which computes
18613 the axis height automatically.
18616 Set the sonogram height. It must be even. Default value is @code{-1} which
18617 computes the sonogram height automatically.
18620 Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
18621 instead. Default value is @code{1}.
18623 @item sono_v, volume
18624 Specify the sonogram volume expression. It can contain variables:
18627 the @var{bar_v} evaluated expression
18628 @item frequency, freq, f
18629 the frequency where it is evaluated
18630 @item timeclamp, tc
18631 the value of @var{timeclamp} option
18635 @item a_weighting(f)
18636 A-weighting of equal loudness
18637 @item b_weighting(f)
18638 B-weighting of equal loudness
18639 @item c_weighting(f)
18640 C-weighting of equal loudness.
18642 Default value is @code{16}.
18644 @item bar_v, volume2
18645 Specify the bargraph volume expression. It can contain variables:
18648 the @var{sono_v} evaluated expression
18649 @item frequency, freq, f
18650 the frequency where it is evaluated
18651 @item timeclamp, tc
18652 the value of @var{timeclamp} option
18656 @item a_weighting(f)
18657 A-weighting of equal loudness
18658 @item b_weighting(f)
18659 B-weighting of equal loudness
18660 @item c_weighting(f)
18661 C-weighting of equal loudness.
18663 Default value is @code{sono_v}.
18665 @item sono_g, gamma
18666 Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
18667 higher gamma makes the spectrum having more range. Default value is @code{3}.
18668 Acceptable range is @code{[1, 7]}.
18670 @item bar_g, gamma2
18671 Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
18675 Specify the bargraph transparency level. Lower value makes the bargraph sharper.
18676 Default value is @code{1}. Acceptable range is @code{[0, 1]}.
18678 @item timeclamp, tc
18679 Specify the transform timeclamp. At low frequency, there is trade-off between
18680 accuracy in time domain and frequency domain. If timeclamp is lower,
18681 event in time domain is represented more accurately (such as fast bass drum),
18682 otherwise event in frequency domain is represented more accurately
18683 (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
18686 Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
18687 limits future samples by applying asymmetric windowing in time domain, useful
18688 when low latency is required. Accepted range is @code{[0, 1]}.
18691 Specify the transform base frequency. Default value is @code{20.01523126408007475},
18692 which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
18695 Specify the transform end frequency. Default value is @code{20495.59681441799654},
18696 which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
18699 This option is deprecated and ignored.
18702 Specify the transform length in time domain. Use this option to control accuracy
18703 trade-off between time domain and frequency domain at every frequency sample.
18704 It can contain variables:
18706 @item frequency, freq, f
18707 the frequency where it is evaluated
18708 @item timeclamp, tc
18709 the value of @var{timeclamp} option.
18711 Default value is @code{384*tc/(384+tc*f)}.
18714 Specify the transform count for every video frame. Default value is @code{6}.
18715 Acceptable range is @code{[1, 30]}.
18718 Specify the transform count for every single pixel. Default value is @code{0},
18719 which makes it computed automatically. Acceptable range is @code{[0, 10]}.
18722 Specify font file for use with freetype to draw the axis. If not specified,
18723 use embedded font. Note that drawing with font file or embedded font is not
18724 implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
18728 Specify fontconfig pattern. This has lower priority than @var{fontfile}.
18729 The : in the pattern may be replaced by | to avoid unnecessary escaping.
18732 Specify font color expression. This is arithmetic expression that should return
18733 integer value 0xRRGGBB. It can contain variables:
18735 @item frequency, freq, f
18736 the frequency where it is evaluated
18737 @item timeclamp, tc
18738 the value of @var{timeclamp} option
18743 midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
18744 @item r(x), g(x), b(x)
18745 red, green, and blue value of intensity x.
18747 Default value is @code{st(0, (midi(f)-59.5)/12);
18748 st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
18749 r(1-ld(1)) + b(ld(1))}.
18752 Specify image file to draw the axis. This option override @var{fontfile} and
18753 @var{fontcolor} option.
18756 Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
18757 the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
18758 Default value is @code{1}.
18761 Set colorspace. The accepted values are:
18764 Unspecified (default)
18773 BT.470BG or BT.601-6 625
18776 SMPTE-170M or BT.601-6 525
18782 BT.2020 with non-constant luminance
18787 Set spectrogram color scheme. This is list of floating point values with format
18788 @code{left_r|left_g|left_b|right_r|right_g|right_b}.
18789 The default is @code{1|0.5|0|0|0.5|1}.
18793 @subsection Examples
18797 Playing audio while showing the spectrum:
18799 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
18803 Same as above, but with frame rate 30 fps:
18805 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
18809 Playing at 1280x720:
18811 ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
18815 Disable sonogram display:
18821 A1 and its harmonics: A1, A2, (near)E3, A3:
18823 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),
18824 asplit[a][out1]; [a] showcqt [out0]'
18828 Same as above, but with more accuracy in frequency domain:
18830 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),
18831 asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
18837 bar_v=10:sono_v=bar_v*a_weighting(f)
18841 Custom gamma, now spectrum is linear to the amplitude.
18847 Custom tlength equation:
18849 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)))'
18853 Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
18855 fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
18859 Custom font using fontconfig:
18861 font='Courier New,Monospace,mono|bold'
18865 Custom frequency range with custom axis using image file:
18867 axisfile=myaxis.png:basefreq=40:endfreq=10000
18873 Convert input audio to video output representing the audio power spectrum.
18874 Audio amplitude is on Y-axis while frequency is on X-axis.
18876 The filter accepts the following options:
18880 Specify size of video. For the syntax of this option, check the
18881 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
18882 Default is @code{1024x512}.
18886 This set how each frequency bin will be represented.
18888 It accepts the following values:
18894 Default is @code{bar}.
18897 Set amplitude scale.
18899 It accepts the following values:
18913 Default is @code{log}.
18916 Set frequency scale.
18918 It accepts the following values:
18927 Reverse logarithmic scale.
18929 Default is @code{lin}.
18934 It accepts the following values:
18950 Default is @code{w2048}
18953 Set windowing function.
18955 It accepts the following values:
18977 Default is @code{hanning}.
18980 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
18981 which means optimal overlap for selected window function will be picked.
18984 Set time averaging. Setting this to 0 will display current maximal peaks.
18985 Default is @code{1}, which means time averaging is disabled.
18988 Specify list of colors separated by space or by '|' which will be used to
18989 draw channel frequencies. Unrecognized or missing colors will be replaced
18993 Set channel display mode.
18995 It accepts the following values:
19000 Default is @code{combined}.
19003 Set minimum amplitude used in @code{log} amplitude scaler.
19007 @anchor{showspectrum}
19008 @section showspectrum
19010 Convert input audio to a video output, representing the audio frequency
19013 The filter accepts the following options:
19017 Specify the video size for the output. For the syntax of this option, check the
19018 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19019 Default value is @code{640x512}.
19022 Specify how the spectrum should slide along the window.
19024 It accepts the following values:
19027 the samples start again on the left when they reach the right
19029 the samples scroll from right to left
19031 frames are only produced when the samples reach the right
19033 the samples scroll from left to right
19036 Default value is @code{replace}.
19039 Specify display mode.
19041 It accepts the following values:
19044 all channels are displayed in the same row
19046 all channels are displayed in separate rows
19049 Default value is @samp{combined}.
19052 Specify display color mode.
19054 It accepts the following values:
19057 each channel is displayed in a separate color
19059 each channel is displayed using the same color scheme
19061 each channel is displayed using the rainbow color scheme
19063 each channel is displayed using the moreland color scheme
19065 each channel is displayed using the nebulae color scheme
19067 each channel is displayed using the fire color scheme
19069 each channel is displayed using the fiery color scheme
19071 each channel is displayed using the fruit color scheme
19073 each channel is displayed using the cool color scheme
19076 Default value is @samp{channel}.
19079 Specify scale used for calculating intensity color values.
19081 It accepts the following values:
19086 square root, default
19097 Default value is @samp{sqrt}.
19100 Set saturation modifier for displayed colors. Negative values provide
19101 alternative color scheme. @code{0} is no saturation at all.
19102 Saturation must be in [-10.0, 10.0] range.
19103 Default value is @code{1}.
19106 Set window function.
19108 It accepts the following values:
19132 Default value is @code{hann}.
19135 Set orientation of time vs frequency axis. Can be @code{vertical} or
19136 @code{horizontal}. Default is @code{vertical}.
19139 Set ratio of overlap window. Default value is @code{0}.
19140 When value is @code{1} overlap is set to recommended size for specific
19141 window function currently used.
19144 Set scale gain for calculating intensity color values.
19145 Default value is @code{1}.
19148 Set which data to display. Can be @code{magnitude}, default or @code{phase}.
19151 Set color rotation, must be in [-1.0, 1.0] range.
19152 Default value is @code{0}.
19155 The usage is very similar to the showwaves filter; see the examples in that
19158 @subsection Examples
19162 Large window with logarithmic color scaling:
19164 showspectrum=s=1280x480:scale=log
19168 Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
19170 ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
19171 [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
19175 @section showspectrumpic
19177 Convert input audio to a single video frame, representing the audio frequency
19180 The filter accepts the following options:
19184 Specify the video size for the output. For the syntax of this option, check the
19185 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19186 Default value is @code{4096x2048}.
19189 Specify display mode.
19191 It accepts the following values:
19194 all channels are displayed in the same row
19196 all channels are displayed in separate rows
19198 Default value is @samp{combined}.
19201 Specify display color mode.
19203 It accepts the following values:
19206 each channel is displayed in a separate color
19208 each channel is displayed using the same color scheme
19210 each channel is displayed using the rainbow color scheme
19212 each channel is displayed using the moreland color scheme
19214 each channel is displayed using the nebulae color scheme
19216 each channel is displayed using the fire color scheme
19218 each channel is displayed using the fiery color scheme
19220 each channel is displayed using the fruit color scheme
19222 each channel is displayed using the cool color scheme
19224 Default value is @samp{intensity}.
19227 Specify scale used for calculating intensity color values.
19229 It accepts the following values:
19234 square root, default
19244 Default value is @samp{log}.
19247 Set saturation modifier for displayed colors. Negative values provide
19248 alternative color scheme. @code{0} is no saturation at all.
19249 Saturation must be in [-10.0, 10.0] range.
19250 Default value is @code{1}.
19253 Set window function.
19255 It accepts the following values:
19278 Default value is @code{hann}.
19281 Set orientation of time vs frequency axis. Can be @code{vertical} or
19282 @code{horizontal}. Default is @code{vertical}.
19285 Set scale gain for calculating intensity color values.
19286 Default value is @code{1}.
19289 Draw time and frequency axes and legends. Default is enabled.
19292 Set color rotation, must be in [-1.0, 1.0] range.
19293 Default value is @code{0}.
19296 @subsection Examples
19300 Extract an audio spectrogram of a whole audio track
19301 in a 1024x1024 picture using @command{ffmpeg}:
19303 ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
19307 @section showvolume
19309 Convert input audio volume to a video output.
19311 The filter accepts the following options:
19318 Set border width, allowed range is [0, 5]. Default is 1.
19321 Set channel width, allowed range is [80, 8192]. Default is 400.
19324 Set channel height, allowed range is [1, 900]. Default is 20.
19327 Set fade, allowed range is [0.001, 1]. Default is 0.95.
19330 Set volume color expression.
19332 The expression can use the following variables:
19336 Current max volume of channel in dB.
19342 Current channel number, starting from 0.
19346 If set, displays channel names. Default is enabled.
19349 If set, displays volume values. Default is enabled.
19352 Set orientation, can be @code{horizontal} or @code{vertical},
19353 default is @code{horizontal}.
19356 Set step size, allowed range s [0, 5]. Default is 0, which means
19362 Convert input audio to a video output, representing the samples waves.
19364 The filter accepts the following options:
19368 Specify the video size for the output. For the syntax of this option, check the
19369 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19370 Default value is @code{600x240}.
19375 Available values are:
19378 Draw a point for each sample.
19381 Draw a vertical line for each sample.
19384 Draw a point for each sample and a line between them.
19387 Draw a centered vertical line for each sample.
19390 Default value is @code{point}.
19393 Set the number of samples which are printed on the same column. A
19394 larger value will decrease the frame rate. Must be a positive
19395 integer. This option can be set only if the value for @var{rate}
19396 is not explicitly specified.
19399 Set the (approximate) output frame rate. This is done by setting the
19400 option @var{n}. Default value is "25".
19402 @item split_channels
19403 Set if channels should be drawn separately or overlap. Default value is 0.
19406 Set colors separated by '|' which are going to be used for drawing of each channel.
19409 Set amplitude scale.
19411 Available values are:
19429 @subsection Examples
19433 Output the input file audio and the corresponding video representation
19436 amovie=a.mp3,asplit[out0],showwaves[out1]
19440 Create a synthetic signal and show it with showwaves, forcing a
19441 frame rate of 30 frames per second:
19443 aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
19447 @section showwavespic
19449 Convert input audio to a single video frame, representing the samples waves.
19451 The filter accepts the following options:
19455 Specify the video size for the output. For the syntax of this option, check the
19456 @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
19457 Default value is @code{600x240}.
19459 @item split_channels
19460 Set if channels should be drawn separately or overlap. Default value is 0.
19463 Set colors separated by '|' which are going to be used for drawing of each channel.
19466 Set amplitude scale.
19468 Available values are:
19486 @subsection Examples
19490 Extract a channel split representation of the wave form of a whole audio track
19491 in a 1024x800 picture using @command{ffmpeg}:
19493 ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
19497 @section sidedata, asidedata
19499 Delete frame side data, or select frames based on it.
19501 This filter accepts the following options:
19505 Set mode of operation of the filter.
19507 Can be one of the following:
19511 Select every frame with side data of @code{type}.
19514 Delete side data of @code{type}. If @code{type} is not set, delete all side
19520 Set side data type used with all modes. Must be set for @code{select} mode. For
19521 the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
19522 in @file{libavutil/frame.h}. For example, to choose
19523 @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
19527 @section spectrumsynth
19529 Sythesize audio from 2 input video spectrums, first input stream represents
19530 magnitude across time and second represents phase across time.
19531 The filter will transform from frequency domain as displayed in videos back
19532 to time domain as presented in audio output.
19534 This filter is primarily created for reversing processed @ref{showspectrum}
19535 filter outputs, but can synthesize sound from other spectrograms too.
19536 But in such case results are going to be poor if the phase data is not
19537 available, because in such cases phase data need to be recreated, usually
19538 its just recreated from random noise.
19539 For best results use gray only output (@code{channel} color mode in
19540 @ref{showspectrum} filter) and @code{log} scale for magnitude video and
19541 @code{lin} scale for phase video. To produce phase, for 2nd video, use
19542 @code{data} option. Inputs videos should generally use @code{fullframe}
19543 slide mode as that saves resources needed for decoding video.
19545 The filter accepts the following options:
19549 Specify sample rate of output audio, the sample rate of audio from which
19550 spectrum was generated may differ.
19553 Set number of channels represented in input video spectrums.
19556 Set scale which was used when generating magnitude input spectrum.
19557 Can be @code{lin} or @code{log}. Default is @code{log}.
19560 Set slide which was used when generating inputs spectrums.
19561 Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
19562 Default is @code{fullframe}.
19565 Set window function used for resynthesis.
19568 Set window overlap. In range @code{[0, 1]}. Default is @code{1},
19569 which means optimal overlap for selected window function will be picked.
19572 Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
19573 Default is @code{vertical}.
19576 @subsection Examples
19580 First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
19581 then resynthesize videos back to audio with spectrumsynth:
19583 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
19584 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
19585 ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
19589 @section split, asplit
19591 Split input into several identical outputs.
19593 @code{asplit} works with audio input, @code{split} with video.
19595 The filter accepts a single parameter which specifies the number of outputs. If
19596 unspecified, it defaults to 2.
19598 @subsection Examples
19602 Create two separate outputs from the same input:
19604 [in] split [out0][out1]
19608 To create 3 or more outputs, you need to specify the number of
19611 [in] asplit=3 [out0][out1][out2]
19615 Create two separate outputs from the same input, one cropped and
19618 [in] split [splitout1][splitout2];
19619 [splitout1] crop=100:100:0:0 [cropout];
19620 [splitout2] pad=200:200:100:100 [padout];
19624 Create 5 copies of the input audio with @command{ffmpeg}:
19626 ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
19632 Receive commands sent through a libzmq client, and forward them to
19633 filters in the filtergraph.
19635 @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
19636 must be inserted between two video filters, @code{azmq} between two
19639 To enable these filters you need to install the libzmq library and
19640 headers and configure FFmpeg with @code{--enable-libzmq}.
19642 For more information about libzmq see:
19643 @url{http://www.zeromq.org/}
19645 The @code{zmq} and @code{azmq} filters work as a libzmq server, which
19646 receives messages sent through a network interface defined by the
19647 @option{bind_address} option.
19649 The received message must be in the form:
19651 @var{TARGET} @var{COMMAND} [@var{ARG}]
19654 @var{TARGET} specifies the target of the command, usually the name of
19655 the filter class or a specific filter instance name.
19657 @var{COMMAND} specifies the name of the command for the target filter.
19659 @var{ARG} is optional and specifies the optional argument list for the
19660 given @var{COMMAND}.
19662 Upon reception, the message is processed and the corresponding command
19663 is injected into the filtergraph. Depending on the result, the filter
19664 will send a reply to the client, adopting the format:
19666 @var{ERROR_CODE} @var{ERROR_REASON}
19670 @var{MESSAGE} is optional.
19672 @subsection Examples
19674 Look at @file{tools/zmqsend} for an example of a zmq client which can
19675 be used to send commands processed by these filters.
19677 Consider the following filtergraph generated by @command{ffplay}
19679 ffplay -dumpgraph 1 -f lavfi "
19680 color=s=100x100:c=red [l];
19681 color=s=100x100:c=blue [r];
19682 nullsrc=s=200x100, zmq [bg];
19683 [bg][l] overlay [bg+l];
19684 [bg+l][r] overlay=x=100 "
19687 To change the color of the left side of the video, the following
19688 command can be used:
19690 echo Parsed_color_0 c yellow | tools/zmqsend
19693 To change the right side:
19695 echo Parsed_color_1 c pink | tools/zmqsend
19698 @c man end MULTIMEDIA FILTERS
19700 @chapter Multimedia Sources
19701 @c man begin MULTIMEDIA SOURCES
19703 Below is a description of the currently available multimedia sources.
19707 This is the same as @ref{movie} source, except it selects an audio
19713 Read audio and/or video stream(s) from a movie container.
19715 It accepts the following parameters:
19719 The name of the resource to read (not necessarily a file; it can also be a
19720 device or a stream accessed through some protocol).
19722 @item format_name, f
19723 Specifies the format assumed for the movie to read, and can be either
19724 the name of a container or an input device. If not specified, the
19725 format is guessed from @var{movie_name} or by probing.
19727 @item seek_point, sp
19728 Specifies the seek point in seconds. The frames will be output
19729 starting from this seek point. The parameter is evaluated with
19730 @code{av_strtod}, so the numerical value may be suffixed by an IS
19731 postfix. The default value is "0".
19734 Specifies the streams to read. Several streams can be specified,
19735 separated by "+". The source will then have as many outputs, in the
19736 same order. The syntax is explained in the ``Stream specifiers''
19737 section in the ffmpeg manual. Two special names, "dv" and "da" specify
19738 respectively the default (best suited) video and audio stream. Default
19739 is "dv", or "da" if the filter is called as "amovie".
19741 @item stream_index, si
19742 Specifies the index of the video stream to read. If the value is -1,
19743 the most suitable video stream will be automatically selected. The default
19744 value is "-1". Deprecated. If the filter is called "amovie", it will select
19745 audio instead of video.
19748 Specifies how many times to read the stream in sequence.
19749 If the value is 0, the stream will be looped infinitely.
19750 Default value is "1".
19752 Note that when the movie is looped the source timestamps are not
19753 changed, so it will generate non monotonically increasing timestamps.
19755 @item discontinuity
19756 Specifies the time difference between frames above which the point is
19757 considered a timestamp discontinuity which is removed by adjusting the later
19761 It allows overlaying a second video on top of the main input of
19762 a filtergraph, as shown in this graph:
19764 input -----------> deltapts0 --> overlay --> output
19767 movie --> scale--> deltapts1 -------+
19769 @subsection Examples
19773 Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
19774 on top of the input labelled "in":
19776 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
19777 [in] setpts=PTS-STARTPTS [main];
19778 [main][over] overlay=16:16 [out]
19782 Read from a video4linux2 device, and overlay it on top of the input
19785 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
19786 [in] setpts=PTS-STARTPTS [main];
19787 [main][over] overlay=16:16 [out]
19791 Read the first video stream and the audio stream with id 0x81 from
19792 dvd.vob; the video is connected to the pad named "video" and the audio is
19793 connected to the pad named "audio":
19795 movie=dvd.vob:s=v:0+#0x81 [video] [audio]
19799 @subsection Commands
19801 Both movie and amovie support the following commands:
19804 Perform seek using "av_seek_frame".
19805 The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
19808 @var{stream_index}: If stream_index is -1, a default
19809 stream is selected, and @var{timestamp} is automatically converted
19810 from AV_TIME_BASE units to the stream specific time_base.
19812 @var{timestamp}: Timestamp in AVStream.time_base units
19813 or, if no stream is specified, in AV_TIME_BASE units.
19815 @var{flags}: Flags which select direction and seeking mode.
19819 Get movie duration in AV_TIME_BASE units.
19823 @c man end MULTIMEDIA SOURCES