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{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.
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{LINKLABEL} ::= "[" @var{NAME} "]"
216 @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
217 @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
218 @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
219 @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
220 @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
223 @section Notes on filtergraph escaping
225 Filtergraph description composition entails several levels of
226 escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
227 section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
228 information about the employed escaping procedure.
230 A first level escaping affects the content of each filter option
231 value, which may contain the special character @code{:} used to
232 separate values, or one of the escaping characters @code{\'}.
234 A second level escaping affects the whole filter description, which
235 may contain the escaping characters @code{\'} or the special
236 characters @code{[],;} used by the filtergraph description.
238 Finally, when you specify a filtergraph on a shell commandline, you
239 need to perform a third level escaping for the shell special
240 characters contained within it.
242 For example, consider the following string to be embedded in
243 the @ref{drawtext} filter description @option{text} value:
245 this is a 'string': may contain one, or more, special characters
248 This string contains the @code{'} special escaping character, and the
249 @code{:} special character, so it needs to be escaped in this way:
251 text=this is a \'string\'\: may contain one, or more, special characters
254 A second level of escaping is required when embedding the filter
255 description in a filtergraph description, in order to escape all the
256 filtergraph special characters. Thus the example above becomes:
258 drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
260 (note that in addition to the @code{\'} escaping special characters,
261 also @code{,} needs to be escaped).
263 Finally an additional level of escaping is needed when writing the
264 filtergraph description in a shell command, which depends on the
265 escaping rules of the adopted shell. For example, assuming that
266 @code{\} is special and needs to be escaped with another @code{\}, the
267 previous string will finally result in:
269 -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
272 @chapter Timeline editing
274 Some filters support a generic @option{enable} option. For the filters
275 supporting timeline editing, this option can be set to an expression which is
276 evaluated before sending a frame to the filter. If the evaluation is non-zero,
277 the filter will be enabled, otherwise the frame will be sent unchanged to the
278 next filter in the filtergraph.
280 The expression accepts the following values:
283 timestamp expressed in seconds, NAN if the input timestamp is unknown
286 sequential number of the input frame, starting from 0
289 the position in the file of the input frame, NAN if unknown
293 width and height of the input frame if video
296 Additionally, these filters support an @option{enable} command that can be used
297 to re-define the expression.
299 Like any other filtering option, the @option{enable} option follows the same
302 For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
303 minutes, and a @ref{curves} filter starting at 3 seconds:
305 smartblur = enable='between(t,10,3*60)',
306 curves = enable='gte(t,3)' : preset=cross_process
309 @c man end FILTERGRAPH DESCRIPTION
311 @chapter Audio Filters
312 @c man begin AUDIO FILTERS
314 When you configure your FFmpeg build, you can disable any of the
315 existing filters using @code{--disable-filters}.
316 The configure output will show the audio filters included in your
319 Below is a description of the currently available audio filters.
323 A compressor is mainly used to reduce the dynamic range of a signal.
324 Especially modern music is mostly compressed at a high ratio to
325 improve the overall loudness. It's done to get the highest attention
326 of a listener, "fatten" the sound and bring more "power" to the track.
327 If a signal is compressed too much it may sound dull or "dead"
328 afterwards or it may start to "pump" (which could be a powerful effect
329 but can also destroy a track completely).
330 The right compression is the key to reach a professional sound and is
331 the high art of mixing and mastering. Because of its complex settings
332 it may take a long time to get the right feeling for this kind of effect.
334 Compression is done by detecting the volume above a chosen level
335 @code{threshold} and dividing it by the factor set with @code{ratio}.
336 So if you set the threshold to -12dB and your signal reaches -6dB a ratio
337 of 2:1 will result in a signal at -9dB. Because an exact manipulation of
338 the signal would cause distortion of the waveform the reduction can be
339 levelled over the time. This is done by setting "Attack" and "Release".
340 @code{attack} determines how long the signal has to rise above the threshold
341 before any reduction will occur and @code{release} sets the time the signal
342 has to fall below the threshold to reduce the reduction again. Shorter signals
343 than the chosen attack time will be left untouched.
344 The overall reduction of the signal can be made up afterwards with the
345 @code{makeup} setting. So compressing the peaks of a signal about 6dB and
346 raising the makeup to this level results in a signal twice as loud than the
347 source. To gain a softer entry in the compression the @code{knee} flattens the
348 hard edge at the threshold in the range of the chosen decibels.
350 The filter accepts the following options:
354 Set input gain. Default is 1. Range is between 0.015625 and 64.
357 If a signal of second stream rises above this level it will affect the gain
358 reduction of the first stream.
359 By default it is 0.125. Range is between 0.00097563 and 1.
362 Set a ratio by which the signal is reduced. 1:2 means that if the level
363 rose 4dB above the threshold, it will be only 2dB above after the reduction.
364 Default is 2. Range is between 1 and 20.
367 Amount of milliseconds the signal has to rise above the threshold before gain
368 reduction starts. Default is 20. Range is between 0.01 and 2000.
371 Amount of milliseconds the signal has to fall below the threshold before
372 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
375 Set the amount by how much signal will be amplified after processing.
376 Default is 2. Range is from 1 and 64.
379 Curve the sharp knee around the threshold to enter gain reduction more softly.
380 Default is 2.82843. Range is between 1 and 8.
383 Choose if the @code{average} level between all channels of input stream
384 or the louder(@code{maximum}) channel of input stream affects the
385 reduction. Default is @code{average}.
388 Should the exact signal be taken in case of @code{peak} or an RMS one in case
389 of @code{rms}. Default is @code{rms} which is mostly smoother.
392 How much to use compressed signal in output. Default is 1.
393 Range is between 0 and 1.
398 Apply cross fade from one input audio stream to another input audio stream.
399 The cross fade is applied for specified duration near the end of first stream.
401 The filter accepts the following options:
405 Specify the number of samples for which the cross fade effect has to last.
406 At the end of the cross fade effect the first input audio will be completely
407 silent. Default is 44100.
410 Specify the duration of the cross fade effect. See
411 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
412 for the accepted syntax.
413 By default the duration is determined by @var{nb_samples}.
414 If set this option is used instead of @var{nb_samples}.
417 Should first stream end overlap with second stream start. Default is enabled.
420 Set curve for cross fade transition for first stream.
423 Set curve for cross fade transition for second stream.
425 For description of available curve types see @ref{afade} filter description.
432 Cross fade from one input to another:
434 ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
438 Cross fade from one input to another but without overlapping:
440 ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
446 Delay one or more audio channels.
448 Samples in delayed channel are filled with silence.
450 The filter accepts the following option:
454 Set list of delays in milliseconds for each channel separated by '|'.
455 At least one delay greater than 0 should be provided.
456 Unused delays will be silently ignored. If number of given delays is
457 smaller than number of channels all remaining channels will not be delayed.
464 Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
465 the second channel (and any other channels that may be present) unchanged.
473 Apply echoing to the input audio.
475 Echoes are reflected sound and can occur naturally amongst mountains
476 (and sometimes large buildings) when talking or shouting; digital echo
477 effects emulate this behaviour and are often used to help fill out the
478 sound of a single instrument or vocal. The time difference between the
479 original signal and the reflection is the @code{delay}, and the
480 loudness of the reflected signal is the @code{decay}.
481 Multiple echoes can have different delays and decays.
483 A description of the accepted parameters follows.
487 Set input gain of reflected signal. Default is @code{0.6}.
490 Set output gain of reflected signal. Default is @code{0.3}.
493 Set list of time intervals in milliseconds between original signal and reflections
494 separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
495 Default is @code{1000}.
498 Set list of loudnesses of reflected signals separated by '|'.
499 Allowed range for each @code{decay} is @code{(0 - 1.0]}.
500 Default is @code{0.5}.
507 Make it sound as if there are twice as many instruments as are actually playing:
509 aecho=0.8:0.88:60:0.4
513 If delay is very short, then it sound like a (metallic) robot playing music:
519 A longer delay will sound like an open air concert in the mountains:
521 aecho=0.8:0.9:1000:0.3
525 Same as above but with one more mountain:
527 aecho=0.8:0.9:1000|1800:0.3|0.25
532 Audio emphasis filter creates or restores material directly taken from LPs or
533 emphased CDs with different filter curves. E.g. to store music on vinyl the
534 signal has to be altered by a filter first to even out the disadvantages of
535 this recording medium.
536 Once the material is played back the inverse filter has to be applied to
537 restore the distortion of the frequency response.
539 The filter accepts the following options:
549 Set filter mode. For restoring material use @code{reproduction} mode, otherwise
550 use @code{production} mode. Default is @code{reproduction} mode.
553 Set filter type. Selects medium. Can be one of the following:
565 select Compact Disc (CD).
571 select 50µs (FM-KF).
573 select 75µs (FM-KF).
579 Modify an audio signal according to the specified expressions.
581 This filter accepts one or more expressions (one for each channel),
582 which are evaluated and used to modify a corresponding audio signal.
584 It accepts the following parameters:
588 Set the '|'-separated expressions list for each separate channel. If
589 the number of input channels is greater than the number of
590 expressions, the last specified expression is used for the remaining
593 @item channel_layout, c
594 Set output channel layout. If not specified, the channel layout is
595 specified by the number of expressions. If set to @samp{same}, it will
596 use by default the same input channel layout.
599 Each expression in @var{exprs} can contain the following constants and functions:
603 channel number of the current expression
606 number of the evaluated sample, starting from 0
612 time of the evaluated sample expressed in seconds
615 @item nb_out_channels
616 input and output number of channels
619 the value of input channel with number @var{CH}
622 Note: this filter is slow. For faster processing you should use a
631 aeval=val(ch)/2:c=same
635 Invert phase of the second channel:
644 Apply fade-in/out effect to input audio.
646 A description of the accepted parameters follows.
650 Specify the effect type, can be either @code{in} for fade-in, or
651 @code{out} for a fade-out effect. Default is @code{in}.
653 @item start_sample, ss
654 Specify the number of the start sample for starting to apply the fade
655 effect. Default is 0.
658 Specify the number of samples for which the fade effect has to last. At
659 the end of the fade-in effect the output audio will have the same
660 volume as the input audio, at the end of the fade-out transition
661 the output audio will be silence. Default is 44100.
664 Specify the start time of the fade effect. Default is 0.
665 The value must be specified as a time duration; see
666 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
667 for the accepted syntax.
668 If set this option is used instead of @var{start_sample}.
671 Specify the duration of the fade effect. See
672 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
673 for the accepted syntax.
674 At the end of the fade-in effect the output audio will have the same
675 volume as the input audio, at the end of the fade-out transition
676 the output audio will be silence.
677 By default the duration is determined by @var{nb_samples}.
678 If set this option is used instead of @var{nb_samples}.
681 Set curve for fade transition.
683 It accepts the following values:
686 select triangular, linear slope (default)
688 select quarter of sine wave
690 select half of sine wave
692 select exponential sine wave
696 select inverted parabola
710 select inverted quarter of sine wave
712 select inverted half of sine wave
714 select double-exponential seat
716 select double-exponential sigmoid
724 Fade in first 15 seconds of audio:
730 Fade out last 25 seconds of a 900 seconds audio:
732 afade=t=out:st=875:d=25
737 Apply arbitrary expressions to samples in frequency domain.
741 Set frequency domain real expression for each separate channel separated
742 by '|'. Default is "1".
743 If the number of input channels is greater than the number of
744 expressions, the last specified expression is used for the remaining
748 Set frequency domain imaginary expression for each separate channel
749 separated by '|'. If not set, @var{real} option is used.
751 Each expression in @var{real} and @var{imag} can contain the following
759 current frequency bin number
762 number of available bins
765 channel number of the current expression
777 It accepts the following values:
793 Default is @code{w4096}
796 Set window function. Default is @code{hann}.
799 Set window overlap. If set to 1, the recommended overlap for selected
800 window function will be picked. Default is @code{0.75}.
807 Leave almost only low frequencies in audio:
809 afftfilt="1-clip((b/nb)*b,0,1)"
816 Set output format constraints for the input audio. The framework will
817 negotiate the most appropriate format to minimize conversions.
819 It accepts the following parameters:
823 A '|'-separated list of requested sample formats.
826 A '|'-separated list of requested sample rates.
828 @item channel_layouts
829 A '|'-separated list of requested channel layouts.
831 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
832 for the required syntax.
835 If a parameter is omitted, all values are allowed.
837 Force the output to either unsigned 8-bit or signed 16-bit stereo
839 aformat=sample_fmts=u8|s16:channel_layouts=stereo
844 A gate is mainly used to reduce lower parts of a signal. This kind of signal
845 processing reduces disturbing noise between useful signals.
847 Gating is done by detecting the volume below a chosen level @var{threshold}
848 and divide it by the factor set with @var{ratio}. The bottom of the noise
849 floor is set via @var{range}. Because an exact manipulation of the signal
850 would cause distortion of the waveform the reduction can be levelled over
851 time. This is done by setting @var{attack} and @var{release}.
853 @var{attack} determines how long the signal has to fall below the threshold
854 before any reduction will occur and @var{release} sets the time the signal
855 has to raise above the threshold to reduce the reduction again.
856 Shorter signals than the chosen attack time will be left untouched.
860 Set input level before filtering.
861 Default is 1. Allowed range is from 0.015625 to 64.
864 Set the level of gain reduction when the signal is below the threshold.
865 Default is 0.06125. Allowed range is from 0 to 1.
868 If a signal rises above this level the gain reduction is released.
869 Default is 0.125. Allowed range is from 0 to 1.
872 Set a ratio about which the signal is reduced.
873 Default is 2. Allowed range is from 1 to 9000.
876 Amount of milliseconds the signal has to rise above the threshold before gain
878 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
881 Amount of milliseconds the signal has to fall below the threshold before the
882 reduction is increased again. Default is 250 milliseconds.
883 Allowed range is from 0.01 to 9000.
886 Set amount of amplification of signal after processing.
887 Default is 1. Allowed range is from 1 to 64.
890 Curve the sharp knee around the threshold to enter gain reduction more softly.
891 Default is 2.828427125. Allowed range is from 1 to 8.
894 Choose if exact signal should be taken for detection or an RMS like one.
895 Default is rms. Can be peak or rms.
898 Choose if the average level between all channels or the louder channel affects
900 Default is average. Can be average or maximum.
905 The limiter prevents input signal from raising over a desired threshold.
906 This limiter uses lookahead technology to prevent your signal from distorting.
907 It means that there is a small delay after signal is processed. Keep in mind
908 that the delay it produces is the attack time you set.
910 The filter accepts the following options:
914 Set input gain. Default is 1.
917 Set output gain. Default is 1.
920 Don't let signals above this level pass the limiter. Default is 1.
923 The limiter will reach its attenuation level in this amount of time in
924 milliseconds. Default is 5 milliseconds.
927 Come back from limiting to attenuation 1.0 in this amount of milliseconds.
928 Default is 50 milliseconds.
931 When gain reduction is always needed ASC takes care of releasing to an
932 average reduction level rather than reaching a reduction of 0 in the release
936 Select how much the release time is affected by ASC, 0 means nearly no changes
937 in release time while 1 produces higher release times.
940 Auto level output signal. Default is enabled.
941 This normalizes audio back to 0dB if enabled.
944 Depending on picked setting it is recommended to upsample input 2x or 4x times
945 with @ref{aresample} before applying this filter.
949 Apply a two-pole all-pass filter with central frequency (in Hz)
950 @var{frequency}, and filter-width @var{width}.
951 An all-pass filter changes the audio's frequency to phase relationship
952 without changing its frequency to amplitude relationship.
954 The filter accepts the following options:
961 Set method to specify band-width of filter.
974 Specify the band-width of a filter in width_type units.
980 Merge two or more audio streams into a single multi-channel stream.
982 The filter accepts the following options:
987 Set the number of inputs. Default is 2.
991 If the channel layouts of the inputs are disjoint, and therefore compatible,
992 the channel layout of the output will be set accordingly and the channels
993 will be reordered as necessary. If the channel layouts of the inputs are not
994 disjoint, the output will have all the channels of the first input then all
995 the channels of the second input, in that order, and the channel layout of
996 the output will be the default value corresponding to the total number of
999 For example, if the first input is in 2.1 (FL+FR+LF) and the second input
1000 is FC+BL+BR, then the output will be in 5.1, with the channels in the
1001 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
1002 first input, b1 is the first channel of the second input).
1004 On the other hand, if both input are in stereo, the output channels will be
1005 in the default order: a1, a2, b1, b2, and the channel layout will be
1006 arbitrarily set to 4.0, which may or may not be the expected value.
1008 All inputs must have the same sample rate, and format.
1010 If inputs do not have the same duration, the output will stop with the
1013 @subsection Examples
1017 Merge two mono files into a stereo stream:
1019 amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
1023 Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
1025 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
1031 Mixes multiple audio inputs into a single output.
1033 Note that this filter only supports float samples (the @var{amerge}
1034 and @var{pan} audio filters support many formats). If the @var{amix}
1035 input has integer samples then @ref{aresample} will be automatically
1036 inserted to perform the conversion to float samples.
1040 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
1042 will mix 3 input audio streams to a single output with the same duration as the
1043 first input and a dropout transition time of 3 seconds.
1045 It accepts the following parameters:
1049 The number of inputs. If unspecified, it defaults to 2.
1052 How to determine the end-of-stream.
1056 The duration of the longest input. (default)
1059 The duration of the shortest input.
1062 The duration of the first input.
1066 @item dropout_transition
1067 The transition time, in seconds, for volume renormalization when an input
1068 stream ends. The default value is 2 seconds.
1072 @section anequalizer
1074 High-order parametric multiband equalizer for each channel.
1076 It accepts the following parameters:
1080 This option string is in format:
1081 "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
1082 Each equalizer band is separated by '|'.
1086 Set channel number to which equalization will be applied.
1087 If input doesn't have that channel the entry is ignored.
1090 Set central frequency for band.
1091 If input doesn't have that frequency the entry is ignored.
1094 Set band width in hertz.
1097 Set band gain in dB.
1100 Set filter type for band, optional, can be:
1104 Butterworth, this is default.
1115 With this option activated frequency response of anequalizer is displayed
1119 Set video stream size. Only useful if curves option is activated.
1122 Set max gain that will be displayed. Only useful if curves option is activated.
1123 Setting this to reasonable value allows to display gain which is derived from
1124 neighbour bands which are too close to each other and thus produce higher gain
1125 when both are activated.
1128 Set frequency scale used to draw frequency response in video output.
1129 Can be linear or logarithmic. Default is logarithmic.
1132 Set color for each channel curve which is going to be displayed in video stream.
1133 This is list of color names separated by space or by '|'.
1134 Unrecognised or missing colors will be replaced by white color.
1137 @subsection Examples
1141 Lower gain by 10 of central frequency 200Hz and width 100 Hz
1142 for first 2 channels using Chebyshev type 1 filter:
1144 anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
1148 @subsection Commands
1150 This filter supports the following commands:
1153 Alter existing filter parameters.
1154 Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
1156 @var{fN} is existing filter number, starting from 0, if no such filter is available
1158 @var{freq} set new frequency parameter.
1159 @var{width} set new width parameter in herz.
1160 @var{gain} set new gain parameter in dB.
1162 Full filter invocation with asendcmd may look like this:
1163 asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
1168 Pass the audio source unchanged to the output.
1172 Pad the end of an audio stream with silence.
1174 This can be used together with @command{ffmpeg} @option{-shortest} to
1175 extend audio streams to the same length as the video stream.
1177 A description of the accepted options follows.
1181 Set silence packet size. Default value is 4096.
1184 Set the number of samples of silence to add to the end. After the
1185 value is reached, the stream is terminated. This option is mutually
1186 exclusive with @option{whole_len}.
1189 Set the minimum total number of samples in the output audio stream. If
1190 the value is longer than the input audio length, silence is added to
1191 the end, until the value is reached. This option is mutually exclusive
1192 with @option{pad_len}.
1195 If neither the @option{pad_len} nor the @option{whole_len} option is
1196 set, the filter will add silence to the end of the input stream
1199 @subsection Examples
1203 Add 1024 samples of silence to the end of the input:
1209 Make sure the audio output will contain at least 10000 samples, pad
1210 the input with silence if required:
1212 apad=whole_len=10000
1216 Use @command{ffmpeg} to pad the audio input with silence, so that the
1217 video stream will always result the shortest and will be converted
1218 until the end in the output file when using the @option{shortest}
1221 ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
1226 Add a phasing effect to the input audio.
1228 A phaser filter creates series of peaks and troughs in the frequency spectrum.
1229 The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
1231 A description of the accepted parameters follows.
1235 Set input gain. Default is 0.4.
1238 Set output gain. Default is 0.74
1241 Set delay in milliseconds. Default is 3.0.
1244 Set decay. Default is 0.4.
1247 Set modulation speed in Hz. Default is 0.5.
1250 Set modulation type. Default is triangular.
1252 It accepts the following values:
1261 Audio pulsator is something between an autopanner and a tremolo.
1262 But it can produce funny stereo effects as well. Pulsator changes the volume
1263 of the left and right channel based on a LFO (low frequency oscillator) with
1264 different waveforms and shifted phases.
1265 This filter have the ability to define an offset between left and right
1266 channel. An offset of 0 means that both LFO shapes match each other.
1267 The left and right channel are altered equally - a conventional tremolo.
1268 An offset of 50% means that the shape of the right channel is exactly shifted
1269 in phase (or moved backwards about half of the frequency) - pulsator acts as
1270 an autopanner. At 1 both curves match again. Every setting in between moves the
1271 phase shift gapless between all stages and produces some "bypassing" sounds with
1272 sine and triangle waveforms. The more you set the offset near 1 (starting from
1273 the 0.5) the faster the signal passes from the left to the right speaker.
1275 The filter accepts the following options:
1279 Set input gain. By default it is 1. Range is [0.015625 - 64].
1282 Set output gain. By default it is 1. Range is [0.015625 - 64].
1285 Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
1286 sawup or sawdown. Default is sine.
1289 Set modulation. Define how much of original signal is affected by the LFO.
1292 Set left channel offset. Default is 0. Allowed range is [0 - 1].
1295 Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
1298 Set pulse width. Default is 1. Allowed range is [0 - 2].
1301 Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
1304 Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
1308 Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
1312 Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
1313 if timing is set to hz.
1319 Resample the input audio to the specified parameters, using the
1320 libswresample library. If none are specified then the filter will
1321 automatically convert between its input and output.
1323 This filter is also able to stretch/squeeze the audio data to make it match
1324 the timestamps or to inject silence / cut out audio to make it match the
1325 timestamps, do a combination of both or do neither.
1327 The filter accepts the syntax
1328 [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
1329 expresses a sample rate and @var{resampler_options} is a list of
1330 @var{key}=@var{value} pairs, separated by ":". See the
1331 ffmpeg-resampler manual for the complete list of supported options.
1333 @subsection Examples
1337 Resample the input audio to 44100Hz:
1343 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
1344 samples per second compensation:
1346 aresample=async=1000
1350 @section asetnsamples
1352 Set the number of samples per each output audio frame.
1354 The last output packet may contain a different number of samples, as
1355 the filter will flush all the remaining samples when the input audio
1358 The filter accepts the following options:
1362 @item nb_out_samples, n
1363 Set the number of frames per each output audio frame. The number is
1364 intended as the number of samples @emph{per each channel}.
1365 Default value is 1024.
1368 If set to 1, the filter will pad the last audio frame with zeroes, so
1369 that the last frame will contain the same number of samples as the
1370 previous ones. Default value is 1.
1373 For example, to set the number of per-frame samples to 1234 and
1374 disable padding for the last frame, use:
1376 asetnsamples=n=1234:p=0
1381 Set the sample rate without altering the PCM data.
1382 This will result in a change of speed and pitch.
1384 The filter accepts the following options:
1387 @item sample_rate, r
1388 Set the output sample rate. Default is 44100 Hz.
1393 Show a line containing various information for each input audio frame.
1394 The input audio is not modified.
1396 The shown line contains a sequence of key/value pairs of the form
1397 @var{key}:@var{value}.
1399 The following values are shown in the output:
1403 The (sequential) number of the input frame, starting from 0.
1406 The presentation timestamp of the input frame, in time base units; the time base
1407 depends on the filter input pad, and is usually 1/@var{sample_rate}.
1410 The presentation timestamp of the input frame in seconds.
1413 position of the frame in the input stream, -1 if this information in
1414 unavailable and/or meaningless (for example in case of synthetic audio)
1423 The sample rate for the audio frame.
1426 The number of samples (per channel) in the frame.
1429 The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
1430 audio, the data is treated as if all the planes were concatenated.
1432 @item plane_checksums
1433 A list of Adler-32 checksums for each data plane.
1439 Display time domain statistical information about the audio channels.
1440 Statistics are calculated and displayed for each audio channel and,
1441 where applicable, an overall figure is also given.
1443 It accepts the following option:
1446 Short window length in seconds, used for peak and trough RMS measurement.
1447 Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
1451 Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
1452 where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
1455 Available keys for each channel are:
1486 For example full key look like this @code{lavfi.astats.1.DC_offset} or
1487 this @code{lavfi.astats.Overall.Peak_count}.
1489 For description what each key means read below.
1492 Set number of frame after which stats are going to be recalculated.
1493 Default is disabled.
1496 A description of each shown parameter follows:
1500 Mean amplitude displacement from zero.
1503 Minimal sample level.
1506 Maximal sample level.
1508 @item Min difference
1509 Minimal difference between two consecutive samples.
1511 @item Max difference
1512 Maximal difference between two consecutive samples.
1514 @item Mean difference
1515 Mean difference between two consecutive samples.
1516 The average of each difference between two consecutive samples.
1520 Standard peak and RMS level measured in dBFS.
1524 Peak and trough values for RMS level measured over a short window.
1527 Standard ratio of peak to RMS level (note: not in dB).
1530 Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
1531 (i.e. either @var{Min level} or @var{Max level}).
1534 Number of occasions (not the number of samples) that the signal attained either
1535 @var{Min level} or @var{Max level}.
1538 Overall bit depth of audio. Number of bits used for each sample.
1543 Synchronize audio data with timestamps by squeezing/stretching it and/or
1544 dropping samples/adding silence when needed.
1546 This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
1548 It accepts the following parameters:
1552 Enable stretching/squeezing the data to make it match the timestamps. Disabled
1553 by default. When disabled, time gaps are covered with silence.
1556 The minimum difference between timestamps and audio data (in seconds) to trigger
1557 adding/dropping samples. The default value is 0.1. If you get an imperfect
1558 sync with this filter, try setting this parameter to 0.
1561 The maximum compensation in samples per second. Only relevant with compensate=1.
1562 The default value is 500.
1565 Assume that the first PTS should be this value. The time base is 1 / sample
1566 rate. This allows for padding/trimming at the start of the stream. By default,
1567 no assumption is made about the first frame's expected PTS, so no padding or
1568 trimming is done. For example, this could be set to 0 to pad the beginning with
1569 silence if an audio stream starts after the video stream or to trim any samples
1570 with a negative PTS due to encoder delay.
1578 The filter accepts exactly one parameter, the audio tempo. If not
1579 specified then the filter will assume nominal 1.0 tempo. Tempo must
1580 be in the [0.5, 2.0] range.
1582 @subsection Examples
1586 Slow down audio to 80% tempo:
1592 To speed up audio to 125% tempo:
1600 Trim the input so that the output contains one continuous subpart of the input.
1602 It accepts the following parameters:
1605 Timestamp (in seconds) of the start of the section to keep. I.e. the audio
1606 sample with the timestamp @var{start} will be the first sample in the output.
1609 Specify time of the first audio sample that will be dropped, i.e. the
1610 audio sample immediately preceding the one with the timestamp @var{end} will be
1611 the last sample in the output.
1614 Same as @var{start}, except this option sets the start timestamp in samples
1618 Same as @var{end}, except this option sets the end timestamp in samples instead
1622 The maximum duration of the output in seconds.
1625 The number of the first sample that should be output.
1628 The number of the first sample that should be dropped.
1631 @option{start}, @option{end}, and @option{duration} are expressed as time
1632 duration specifications; see
1633 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
1635 Note that the first two sets of the start/end options and the @option{duration}
1636 option look at the frame timestamp, while the _sample options simply count the
1637 samples that pass through the filter. So start/end_pts and start/end_sample will
1638 give different results when the timestamps are wrong, inexact or do not start at
1639 zero. Also note that this filter does not modify the timestamps. If you wish
1640 to have the output timestamps start at zero, insert the asetpts filter after the
1643 If multiple start or end options are set, this filter tries to be greedy and
1644 keep all samples that match at least one of the specified constraints. To keep
1645 only the part that matches all the constraints at once, chain multiple atrim
1648 The defaults are such that all the input is kept. So it is possible to set e.g.
1649 just the end values to keep everything before the specified time.
1654 Drop everything except the second minute of input:
1656 ffmpeg -i INPUT -af atrim=60:120
1660 Keep only the first 1000 samples:
1662 ffmpeg -i INPUT -af atrim=end_sample=1000
1669 Apply a two-pole Butterworth band-pass filter with central
1670 frequency @var{frequency}, and (3dB-point) band-width width.
1671 The @var{csg} option selects a constant skirt gain (peak gain = Q)
1672 instead of the default: constant 0dB peak gain.
1673 The filter roll off at 6dB per octave (20dB per decade).
1675 The filter accepts the following options:
1679 Set the filter's central frequency. Default is @code{3000}.
1682 Constant skirt gain if set to 1. Defaults to 0.
1685 Set method to specify band-width of filter.
1698 Specify the band-width of a filter in width_type units.
1703 Apply a two-pole Butterworth band-reject filter with central
1704 frequency @var{frequency}, and (3dB-point) band-width @var{width}.
1705 The filter roll off at 6dB per octave (20dB per decade).
1707 The filter accepts the following options:
1711 Set the filter's central frequency. Default is @code{3000}.
1714 Set method to specify band-width of filter.
1727 Specify the band-width of a filter in width_type units.
1732 Boost or cut the bass (lower) frequencies of the audio using a two-pole
1733 shelving filter with a response similar to that of a standard
1734 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
1736 The filter accepts the following options:
1740 Give the gain at 0 Hz. Its useful range is about -20
1741 (for a large cut) to +20 (for a large boost).
1742 Beware of clipping when using a positive gain.
1745 Set the filter's central frequency and so can be used
1746 to extend or reduce the frequency range to be boosted or cut.
1747 The default value is @code{100} Hz.
1750 Set method to specify band-width of filter.
1763 Determine how steep is the filter's shelf transition.
1768 Apply a biquad IIR filter with the given coefficients.
1769 Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
1770 are the numerator and denominator coefficients respectively.
1773 Bauer stereo to binaural transformation, which improves headphone listening of
1774 stereo audio records.
1776 It accepts the following parameters:
1780 Pre-defined crossfeed level.
1784 Default level (fcut=700, feed=50).
1787 Chu Moy circuit (fcut=700, feed=60).
1790 Jan Meier circuit (fcut=650, feed=95).
1795 Cut frequency (in Hz).
1804 Remap input channels to new locations.
1806 It accepts the following parameters:
1808 @item channel_layout
1809 The channel layout of the output stream.
1812 Map channels from input to output. The argument is a '|'-separated list of
1813 mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
1814 @var{in_channel} form. @var{in_channel} can be either the name of the input
1815 channel (e.g. FL for front left) or its index in the input channel layout.
1816 @var{out_channel} is the name of the output channel or its index in the output
1817 channel layout. If @var{out_channel} is not given then it is implicitly an
1818 index, starting with zero and increasing by one for each mapping.
1821 If no mapping is present, the filter will implicitly map input channels to
1822 output channels, preserving indices.
1824 For example, assuming a 5.1+downmix input MOV file,
1826 ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
1828 will create an output WAV file tagged as stereo from the downmix channels of
1831 To fix a 5.1 WAV improperly encoded in AAC's native channel order
1833 ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
1836 @section channelsplit
1838 Split each channel from an input audio stream into a separate output stream.
1840 It accepts the following parameters:
1842 @item channel_layout
1843 The channel layout of the input stream. The default is "stereo".
1846 For example, assuming a stereo input MP3 file,
1848 ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
1850 will create an output Matroska file with two audio streams, one containing only
1851 the left channel and the other the right channel.
1853 Split a 5.1 WAV file into per-channel files:
1855 ffmpeg -i in.wav -filter_complex
1856 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
1857 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
1858 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
1863 Add a chorus effect to the audio.
1865 Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
1867 Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
1868 constant, with chorus, it is varied using using sinusoidal or triangular modulation.
1869 The modulation depth defines the range the modulated delay is played before or after
1870 the delay. Hence the delayed sound will sound slower or faster, that is the delayed
1871 sound tuned around the original one, like in a chorus where some vocals are slightly
1874 It accepts the following parameters:
1877 Set input gain. Default is 0.4.
1880 Set output gain. Default is 0.4.
1883 Set delays. A typical delay is around 40ms to 60ms.
1895 @subsection Examples
1901 chorus=0.7:0.9:55:0.4:0.25:2
1907 chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
1911 Fuller sounding chorus with three delays:
1913 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
1918 Compress or expand the audio's dynamic range.
1920 It accepts the following parameters:
1926 A list of times in seconds for each channel over which the instantaneous level
1927 of the input signal is averaged to determine its volume. @var{attacks} refers to
1928 increase of volume and @var{decays} refers to decrease of volume. For most
1929 situations, the attack time (response to the audio getting louder) should be
1930 shorter than the decay time, because the human ear is more sensitive to sudden
1931 loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
1932 a typical value for decay is 0.8 seconds.
1933 If specified number of attacks & decays is lower than number of channels, the last
1934 set attack/decay will be used for all remaining channels.
1937 A list of points for the transfer function, specified in dB relative to the
1938 maximum possible signal amplitude. Each key points list must be defined using
1939 the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
1940 @code{x0/y0 x1/y1 x2/y2 ....}
1942 The input values must be in strictly increasing order but the transfer function
1943 does not have to be monotonically rising. The point @code{0/0} is assumed but
1944 may be overridden (by @code{0/out-dBn}). Typical values for the transfer
1945 function are @code{-70/-70|-60/-20}.
1948 Set the curve radius in dB for all joints. It defaults to 0.01.
1951 Set the additional gain in dB to be applied at all points on the transfer
1952 function. This allows for easy adjustment of the overall gain.
1956 Set an initial volume, in dB, to be assumed for each channel when filtering
1957 starts. This permits the user to supply a nominal level initially, so that, for
1958 example, a very large gain is not applied to initial signal levels before the
1959 companding has begun to operate. A typical value for audio which is initially
1960 quiet is -90 dB. It defaults to 0.
1963 Set a delay, in seconds. The input audio is analyzed immediately, but audio is
1964 delayed before being fed to the volume adjuster. Specifying a delay
1965 approximately equal to the attack/decay times allows the filter to effectively
1966 operate in predictive rather than reactive mode. It defaults to 0.
1970 @subsection Examples
1974 Make music with both quiet and loud passages suitable for listening to in a
1977 compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
1980 Another example for audio with whisper and explosion parts:
1982 compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
1986 A noise gate for when the noise is at a lower level than the signal:
1988 compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
1992 Here is another noise gate, this time for when the noise is at a higher level
1993 than the signal (making it, in some ways, similar to squelch):
1995 compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
1999 2:1 compression starting at -6dB:
2001 compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
2005 2:1 compression starting at -9dB:
2007 compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
2011 2:1 compression starting at -12dB:
2013 compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
2017 2:1 compression starting at -18dB:
2019 compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
2023 3:1 compression starting at -15dB:
2025 compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
2031 compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
2037 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
2041 Hard limiter at -6dB:
2043 compand=attacks=0:points=-80/-80|-6/-6|20/-6
2047 Hard limiter at -12dB:
2049 compand=attacks=0:points=-80/-80|-12/-12|20/-12
2053 Hard noise gate at -35 dB:
2055 compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
2061 compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
2065 @section compensationdelay
2067 Compensation Delay Line is a metric based delay to compensate differing
2068 positions of microphones or speakers.
2070 For example, you have recorded guitar with two microphones placed in
2071 different location. Because the front of sound wave has fixed speed in
2072 normal conditions, the phasing of microphones can vary and depends on
2073 their location and interposition. The best sound mix can be achieved when
2074 these microphones are in phase (synchronized). Note that distance of
2075 ~30 cm between microphones makes one microphone to capture signal in
2076 antiphase to another microphone. That makes the final mix sounding moody.
2077 This filter helps to solve phasing problems by adding different delays
2078 to each microphone track and make them synchronized.
2080 The best result can be reached when you take one track as base and
2081 synchronize other tracks one by one with it.
2082 Remember that synchronization/delay tolerance depends on sample rate, too.
2083 Higher sample rates will give more tolerance.
2085 It accepts the following parameters:
2089 Set millimeters distance. This is compensation distance for fine tuning.
2093 Set cm distance. This is compensation distance for tightening distance setup.
2097 Set meters distance. This is compensation distance for hard distance setup.
2101 Set dry amount. Amount of unprocessed (dry) signal.
2105 Set wet amount. Amount of processed (wet) signal.
2109 Set temperature degree in Celsius. This is the temperature of the environment.
2114 Apply a DC shift to the audio.
2116 This can be useful to remove a DC offset (caused perhaps by a hardware problem
2117 in the recording chain) from the audio. The effect of a DC offset is reduced
2118 headroom and hence volume. The @ref{astats} filter can be used to determine if
2119 a signal has a DC offset.
2123 Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
2127 Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
2128 used to prevent clipping.
2132 Dynamic Audio Normalizer.
2134 This filter applies a certain amount of gain to the input audio in order
2135 to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
2136 contrast to more "simple" normalization algorithms, the Dynamic Audio
2137 Normalizer *dynamically* re-adjusts the gain factor to the input audio.
2138 This allows for applying extra gain to the "quiet" sections of the audio
2139 while avoiding distortions or clipping the "loud" sections. In other words:
2140 The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
2141 sections, in the sense that the volume of each section is brought to the
2142 same target level. Note, however, that the Dynamic Audio Normalizer achieves
2143 this goal *without* applying "dynamic range compressing". It will retain 100%
2144 of the dynamic range *within* each section of the audio file.
2148 Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
2149 Default is 500 milliseconds.
2150 The Dynamic Audio Normalizer processes the input audio in small chunks,
2151 referred to as frames. This is required, because a peak magnitude has no
2152 meaning for just a single sample value. Instead, we need to determine the
2153 peak magnitude for a contiguous sequence of sample values. While a "standard"
2154 normalizer would simply use the peak magnitude of the complete file, the
2155 Dynamic Audio Normalizer determines the peak magnitude individually for each
2156 frame. The length of a frame is specified in milliseconds. By default, the
2157 Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
2158 been found to give good results with most files.
2159 Note that the exact frame length, in number of samples, will be determined
2160 automatically, based on the sampling rate of the individual input audio file.
2163 Set the Gaussian filter window size. In range from 3 to 301, must be odd
2164 number. Default is 31.
2165 Probably the most important parameter of the Dynamic Audio Normalizer is the
2166 @code{window size} of the Gaussian smoothing filter. The filter's window size
2167 is specified in frames, centered around the current frame. For the sake of
2168 simplicity, this must be an odd number. Consequently, the default value of 31
2169 takes into account the current frame, as well as the 15 preceding frames and
2170 the 15 subsequent frames. Using a larger window results in a stronger
2171 smoothing effect and thus in less gain variation, i.e. slower gain
2172 adaptation. Conversely, using a smaller window results in a weaker smoothing
2173 effect and thus in more gain variation, i.e. faster gain adaptation.
2174 In other words, the more you increase this value, the more the Dynamic Audio
2175 Normalizer will behave like a "traditional" normalization filter. On the
2176 contrary, the more you decrease this value, the more the Dynamic Audio
2177 Normalizer will behave like a dynamic range compressor.
2180 Set the target peak value. This specifies the highest permissible magnitude
2181 level for the normalized audio input. This filter will try to approach the
2182 target peak magnitude as closely as possible, but at the same time it also
2183 makes sure that the normalized signal will never exceed the peak magnitude.
2184 A frame's maximum local gain factor is imposed directly by the target peak
2185 magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
2186 It is not recommended to go above this value.
2189 Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
2190 The Dynamic Audio Normalizer determines the maximum possible (local) gain
2191 factor for each input frame, i.e. the maximum gain factor that does not
2192 result in clipping or distortion. The maximum gain factor is determined by
2193 the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
2194 additionally bounds the frame's maximum gain factor by a predetermined
2195 (global) maximum gain factor. This is done in order to avoid excessive gain
2196 factors in "silent" or almost silent frames. By default, the maximum gain
2197 factor is 10.0, For most inputs the default value should be sufficient and
2198 it usually is not recommended to increase this value. Though, for input
2199 with an extremely low overall volume level, it may be necessary to allow even
2200 higher gain factors. Note, however, that the Dynamic Audio Normalizer does
2201 not simply apply a "hard" threshold (i.e. cut off values above the threshold).
2202 Instead, a "sigmoid" threshold function will be applied. This way, the
2203 gain factors will smoothly approach the threshold value, but never exceed that
2207 Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
2208 By default, the Dynamic Audio Normalizer performs "peak" normalization.
2209 This means that the maximum local gain factor for each frame is defined
2210 (only) by the frame's highest magnitude sample. This way, the samples can
2211 be amplified as much as possible without exceeding the maximum signal
2212 level, i.e. without clipping. Optionally, however, the Dynamic Audio
2213 Normalizer can also take into account the frame's root mean square,
2214 abbreviated RMS. In electrical engineering, the RMS is commonly used to
2215 determine the power of a time-varying signal. It is therefore considered
2216 that the RMS is a better approximation of the "perceived loudness" than
2217 just looking at the signal's peak magnitude. Consequently, by adjusting all
2218 frames to a constant RMS value, a uniform "perceived loudness" can be
2219 established. If a target RMS value has been specified, a frame's local gain
2220 factor is defined as the factor that would result in exactly that RMS value.
2221 Note, however, that the maximum local gain factor is still restricted by the
2222 frame's highest magnitude sample, in order to prevent clipping.
2225 Enable channels coupling. By default is enabled.
2226 By default, the Dynamic Audio Normalizer will amplify all channels by the same
2227 amount. This means the same gain factor will be applied to all channels, i.e.
2228 the maximum possible gain factor is determined by the "loudest" channel.
2229 However, in some recordings, it may happen that the volume of the different
2230 channels is uneven, e.g. one channel may be "quieter" than the other one(s).
2231 In this case, this option can be used to disable the channel coupling. This way,
2232 the gain factor will be determined independently for each channel, depending
2233 only on the individual channel's highest magnitude sample. This allows for
2234 harmonizing the volume of the different channels.
2237 Enable DC bias correction. By default is disabled.
2238 An audio signal (in the time domain) is a sequence of sample values.
2239 In the Dynamic Audio Normalizer these sample values are represented in the
2240 -1.0 to 1.0 range, regardless of the original input format. Normally, the
2241 audio signal, or "waveform", should be centered around the zero point.
2242 That means if we calculate the mean value of all samples in a file, or in a
2243 single frame, then the result should be 0.0 or at least very close to that
2244 value. If, however, there is a significant deviation of the mean value from
2245 0.0, in either positive or negative direction, this is referred to as a
2246 DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
2247 Audio Normalizer provides optional DC bias correction.
2248 With DC bias correction enabled, the Dynamic Audio Normalizer will determine
2249 the mean value, or "DC correction" offset, of each input frame and subtract
2250 that value from all of the frame's sample values which ensures those samples
2251 are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
2252 boundaries, the DC correction offset values will be interpolated smoothly
2253 between neighbouring frames.
2256 Enable alternative boundary mode. By default is disabled.
2257 The Dynamic Audio Normalizer takes into account a certain neighbourhood
2258 around each frame. This includes the preceding frames as well as the
2259 subsequent frames. However, for the "boundary" frames, located at the very
2260 beginning and at the very end of the audio file, not all neighbouring
2261 frames are available. In particular, for the first few frames in the audio
2262 file, the preceding frames are not known. And, similarly, for the last few
2263 frames in the audio file, the subsequent frames are not known. Thus, the
2264 question arises which gain factors should be assumed for the missing frames
2265 in the "boundary" region. The Dynamic Audio Normalizer implements two modes
2266 to deal with this situation. The default boundary mode assumes a gain factor
2267 of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
2268 "fade out" at the beginning and at the end of the input, respectively.
2271 Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
2272 By default, the Dynamic Audio Normalizer does not apply "traditional"
2273 compression. This means that signal peaks will not be pruned and thus the
2274 full dynamic range will be retained within each local neighbourhood. However,
2275 in some cases it may be desirable to combine the Dynamic Audio Normalizer's
2276 normalization algorithm with a more "traditional" compression.
2277 For this purpose, the Dynamic Audio Normalizer provides an optional compression
2278 (thresholding) function. If (and only if) the compression feature is enabled,
2279 all input frames will be processed by a soft knee thresholding function prior
2280 to the actual normalization process. Put simply, the thresholding function is
2281 going to prune all samples whose magnitude exceeds a certain threshold value.
2282 However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
2283 value. Instead, the threshold value will be adjusted for each individual
2285 In general, smaller parameters result in stronger compression, and vice versa.
2286 Values below 3.0 are not recommended, because audible distortion may appear.
2291 Make audio easier to listen to on headphones.
2293 This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
2294 so that when listened to on headphones the stereo image is moved from
2295 inside your head (standard for headphones) to outside and in front of
2296 the listener (standard for speakers).
2302 Apply a two-pole peaking equalisation (EQ) filter. With this
2303 filter, the signal-level at and around a selected frequency can
2304 be increased or decreased, whilst (unlike bandpass and bandreject
2305 filters) that at all other frequencies is unchanged.
2307 In order to produce complex equalisation curves, this filter can
2308 be given several times, each with a different central frequency.
2310 The filter accepts the following options:
2314 Set the filter's central frequency in Hz.
2317 Set method to specify band-width of filter.
2330 Specify the band-width of a filter in width_type units.
2333 Set the required gain or attenuation in dB.
2334 Beware of clipping when using a positive gain.
2337 @subsection Examples
2340 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
2342 equalizer=f=1000:width_type=h:width=200:g=-10
2346 Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
2348 equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
2352 @section extrastereo
2354 Linearly increases the difference between left and right channels which
2355 adds some sort of "live" effect to playback.
2357 The filter accepts the following option:
2361 Sets the difference coefficient (default: 2.5). 0.0 means mono sound
2362 (average of both channels), with 1.0 sound will be unchanged, with
2363 -1.0 left and right channels will be swapped.
2366 Enable clipping. By default is enabled.
2369 @section firequalizer
2370 Apply FIR Equalization using arbitrary frequency response.
2372 The filter accepts the following option:
2376 Set gain curve equation (in dB). The expression can contain variables:
2379 the evaluated frequency
2383 channel number, set to 0 when multichannels evaluation is disabled
2385 channel id, see libavutil/channel_layout.h, set to the first channel id when
2386 multichannels evaluation is disabled
2390 channel_layout, see libavutil/channel_layout.h
2395 @item gain_interpolate(f)
2396 interpolate gain on frequency f based on gain_entry
2398 This option is also available as command. Default is @code{gain_interpolate(f)}.
2401 Set gain entry for gain_interpolate function. The expression can
2405 store gain entry at frequency f with value g
2407 This option is also available as command.
2410 Set filter delay in seconds. Higher value means more accurate.
2411 Default is @code{0.01}.
2414 Set filter accuracy in Hz. Lower value means more accurate.
2415 Default is @code{5}.
2418 Set window function. Acceptable values are:
2421 rectangular window, useful when gain curve is already smooth
2423 hann window (default)
2429 3-terms continuous 1st derivative nuttall window
2431 minimum 3-terms discontinuous nuttall window
2433 4-terms continuous 1st derivative nuttall window
2435 minimum 4-terms discontinuous nuttall (blackman-nuttall) window
2437 blackman-harris window
2441 If enabled, use fixed number of audio samples. This improves speed when
2442 filtering with large delay. Default is disabled.
2445 Enable multichannels evaluation on gain. Default is disabled.
2448 Enable zero phase mode by substracting timestamp to compensate delay.
2449 Default is disabled.
2452 @subsection Examples
2457 firequalizer=gain='if(lt(f,1000), 0, -INF)'
2460 lowpass at 1000 Hz with gain_entry:
2462 firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
2465 custom equalization:
2467 firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
2470 higher delay with zero phase to compensate delay:
2472 firequalizer=delay=0.1:fixed=on:zero_phase=on
2475 lowpass on left channel, highpass on right channel:
2477 firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
2478 :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
2483 Apply a flanging effect to the audio.
2485 The filter accepts the following options:
2489 Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
2492 Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
2495 Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
2499 Set percentage of delayed signal mixed with original. Range from 0 to 100.
2500 Default value is 71.
2503 Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
2506 Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
2507 Default value is @var{sinusoidal}.
2510 Set swept wave percentage-shift for multi channel. Range from 0 to 100.
2511 Default value is 25.
2514 Set delay-line interpolation, @var{linear} or @var{quadratic}.
2515 Default is @var{linear}.
2520 Apply a high-pass filter with 3dB point frequency.
2521 The filter can be either single-pole, or double-pole (the default).
2522 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
2524 The filter accepts the following options:
2528 Set frequency in Hz. Default is 3000.
2531 Set number of poles. Default is 2.
2534 Set method to specify band-width of filter.
2547 Specify the band-width of a filter in width_type units.
2548 Applies only to double-pole filter.
2549 The default is 0.707q and gives a Butterworth response.
2554 Join multiple input streams into one multi-channel stream.
2556 It accepts the following parameters:
2560 The number of input streams. It defaults to 2.
2562 @item channel_layout
2563 The desired output channel layout. It defaults to stereo.
2566 Map channels from inputs to output. The argument is a '|'-separated list of
2567 mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
2568 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
2569 can be either the name of the input channel (e.g. FL for front left) or its
2570 index in the specified input stream. @var{out_channel} is the name of the output
2574 The filter will attempt to guess the mappings when they are not specified
2575 explicitly. It does so by first trying to find an unused matching input channel
2576 and if that fails it picks the first unused input channel.
2578 Join 3 inputs (with properly set channel layouts):
2580 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
2583 Build a 5.1 output from 6 single-channel streams:
2585 ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
2586 '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'
2592 Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
2594 To enable compilation of this filter you need to configure FFmpeg with
2595 @code{--enable-ladspa}.
2599 Specifies the name of LADSPA plugin library to load. If the environment
2600 variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
2601 each one of the directories specified by the colon separated list in
2602 @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
2603 this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
2604 @file{/usr/lib/ladspa/}.
2607 Specifies the plugin within the library. Some libraries contain only
2608 one plugin, but others contain many of them. If this is not set filter
2609 will list all available plugins within the specified library.
2612 Set the '|' separated list of controls which are zero or more floating point
2613 values that determine the behavior of the loaded plugin (for example delay,
2615 Controls need to be defined using the following syntax:
2616 c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
2617 @var{valuei} is the value set on the @var{i}-th control.
2618 Alternatively they can be also defined using the following syntax:
2619 @var{value0}|@var{value1}|@var{value2}|..., where
2620 @var{valuei} is the value set on the @var{i}-th control.
2621 If @option{controls} is set to @code{help}, all available controls and
2622 their valid ranges are printed.
2624 @item sample_rate, s
2625 Specify the sample rate, default to 44100. Only used if plugin have
2629 Set the number of samples per channel per each output frame, default
2630 is 1024. Only used if plugin have zero inputs.
2633 Set the minimum duration of the sourced audio. See
2634 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
2635 for the accepted syntax.
2636 Note that the resulting duration may be greater than the specified duration,
2637 as the generated audio is always cut at the end of a complete frame.
2638 If not specified, or the expressed duration is negative, the audio is
2639 supposed to be generated forever.
2640 Only used if plugin have zero inputs.
2644 @subsection Examples
2648 List all available plugins within amp (LADSPA example plugin) library:
2654 List all available controls and their valid ranges for @code{vcf_notch}
2655 plugin from @code{VCF} library:
2657 ladspa=f=vcf:p=vcf_notch:c=help
2661 Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
2664 ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
2668 Add reverberation to the audio using TAP-plugins
2669 (Tom's Audio Processing plugins):
2671 ladspa=file=tap_reverb:tap_reverb
2675 Generate white noise, with 0.2 amplitude:
2677 ladspa=file=cmt:noise_source_white:c=c0=.2
2681 Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
2682 @code{C* Audio Plugin Suite} (CAPS) library:
2684 ladspa=file=caps:Click:c=c1=20'
2688 Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
2690 ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
2694 Increase volume by 20dB using fast lookahead limiter from Steve Harris
2695 @code{SWH Plugins} collection:
2697 ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
2701 Attenuate low frequencies using Multiband EQ from Steve Harris
2702 @code{SWH Plugins} collection:
2704 ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
2708 @subsection Commands
2710 This filter supports the following commands:
2713 Modify the @var{N}-th control value.
2715 If the specified value is not valid, it is ignored and prior one is kept.
2720 EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
2721 Support for both single pass (livestreams, files) and double pass (files) modes.
2722 This algorithm can target IL, LRA, and maximum true peak.
2724 To enable compilation of this filter you need to configure FFmpeg with
2725 @code{--enable-libebur128}.
2727 The filter accepts the following options:
2731 Set integrated loudness target.
2732 Range is -70.0 - -5.0. Default value is -24.0.
2735 Set loudness range target.
2736 Range is 1.0 - 20.0. Default value is 7.0.
2739 Set maximum true peak.
2740 Range is -9.0 - +0.0. Default value is -2.0.
2742 @item measured_I, measured_i
2743 Measured IL of input file.
2744 Range is -99.0 - +0.0.
2746 @item measured_LRA, measured_lra
2747 Measured LRA of input file.
2748 Range is 0.0 - 99.0.
2750 @item measured_TP, measured_tp
2751 Measured true peak of input file.
2752 Range is -99.0 - +99.0.
2754 @item measured_thresh
2755 Measured threshold of input file.
2756 Range is -99.0 - +0.0.
2759 Set offset gain. Gain is applied before the true-peak limiter.
2760 Range is -99.0 - +99.0. Default is +0.0.
2763 Normalize linearly if possible.
2764 measured_I, measured_LRA, measured_TP, and measured_thresh must also
2765 to be specified in order to use this mode.
2766 Options are true or false. Default is true.
2769 Treat mono input files as "dual-mono". If a mono file is intended for playback
2770 on a stereo system, its EBU R128 measurement will be perceptually incorrect.
2771 If set to @code{true}, this option will compensate for this effect.
2772 Multi-channel input files are not affected by this option.
2773 Options are true or false. Default is false.
2776 Set print format for stats. Options are summary, json, or none.
2777 Default value is none.
2782 Apply a low-pass filter with 3dB point frequency.
2783 The filter can be either single-pole or double-pole (the default).
2784 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
2786 The filter accepts the following options:
2790 Set frequency in Hz. Default is 500.
2793 Set number of poles. Default is 2.
2796 Set method to specify band-width of filter.
2809 Specify the band-width of a filter in width_type units.
2810 Applies only to double-pole filter.
2811 The default is 0.707q and gives a Butterworth response.
2817 Mix channels with specific gain levels. The filter accepts the output
2818 channel layout followed by a set of channels definitions.
2820 This filter is also designed to efficiently remap the channels of an audio
2823 The filter accepts parameters of the form:
2824 "@var{l}|@var{outdef}|@var{outdef}|..."
2828 output channel layout or number of channels
2831 output channel specification, of the form:
2832 "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
2835 output channel to define, either a channel name (FL, FR, etc.) or a channel
2836 number (c0, c1, etc.)
2839 multiplicative coefficient for the channel, 1 leaving the volume unchanged
2842 input channel to use, see out_name for details; it is not possible to mix
2843 named and numbered input channels
2846 If the `=' in a channel specification is replaced by `<', then the gains for
2847 that specification will be renormalized so that the total is 1, thus
2848 avoiding clipping noise.
2850 @subsection Mixing examples
2852 For example, if you want to down-mix from stereo to mono, but with a bigger
2853 factor for the left channel:
2855 pan=1c|c0=0.9*c0+0.1*c1
2858 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
2859 7-channels surround:
2861 pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
2864 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
2865 that should be preferred (see "-ac" option) unless you have very specific
2868 @subsection Remapping examples
2870 The channel remapping will be effective if, and only if:
2873 @item gain coefficients are zeroes or ones,
2874 @item only one input per channel output,
2877 If all these conditions are satisfied, the filter will notify the user ("Pure
2878 channel mapping detected"), and use an optimized and lossless method to do the
2881 For example, if you have a 5.1 source and want a stereo audio stream by
2882 dropping the extra channels:
2884 pan="stereo| c0=FL | c1=FR"
2887 Given the same source, you can also switch front left and front right channels
2888 and keep the input channel layout:
2890 pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
2893 If the input is a stereo audio stream, you can mute the front left channel (and
2894 still keep the stereo channel layout) with:
2899 Still with a stereo audio stream input, you can copy the right channel in both
2900 front left and right:
2902 pan="stereo| c0=FR | c1=FR"
2907 ReplayGain scanner filter. This filter takes an audio stream as an input and
2908 outputs it unchanged.
2909 At end of filtering it displays @code{track_gain} and @code{track_peak}.
2913 Convert the audio sample format, sample rate and channel layout. It is
2914 not meant to be used directly.
2917 Apply time-stretching and pitch-shifting with librubberband.
2919 The filter accepts the following options:
2923 Set tempo scale factor.
2926 Set pitch scale factor.
2929 Set transients detector.
2930 Possible values are:
2939 Possible values are:
2948 Possible values are:
2955 Set processing window size.
2956 Possible values are:
2965 Possible values are:
2972 Enable formant preservation when shift pitching.
2973 Possible values are:
2981 Possible values are:
2990 Possible values are:
2997 @section sidechaincompress
2999 This filter acts like normal compressor but has the ability to compress
3000 detected signal using second input signal.
3001 It needs two input streams and returns one output stream.
3002 First input stream will be processed depending on second stream signal.
3003 The filtered signal then can be filtered with other filters in later stages of
3004 processing. See @ref{pan} and @ref{amerge} filter.
3006 The filter accepts the following options:
3010 Set input gain. Default is 1. Range is between 0.015625 and 64.
3013 If a signal of second stream raises above this level it will affect the gain
3014 reduction of first stream.
3015 By default is 0.125. Range is between 0.00097563 and 1.
3018 Set a ratio about which the signal is reduced. 1:2 means that if the level
3019 raised 4dB above the threshold, it will be only 2dB above after the reduction.
3020 Default is 2. Range is between 1 and 20.
3023 Amount of milliseconds the signal has to rise above the threshold before gain
3024 reduction starts. Default is 20. Range is between 0.01 and 2000.
3027 Amount of milliseconds the signal has to fall below the threshold before
3028 reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
3031 Set the amount by how much signal will be amplified after processing.
3032 Default is 2. Range is from 1 and 64.
3035 Curve the sharp knee around the threshold to enter gain reduction more softly.
3036 Default is 2.82843. Range is between 1 and 8.
3039 Choose if the @code{average} level between all channels of side-chain stream
3040 or the louder(@code{maximum}) channel of side-chain stream affects the
3041 reduction. Default is @code{average}.
3044 Should the exact signal be taken in case of @code{peak} or an RMS one in case
3045 of @code{rms}. Default is @code{rms} which is mainly smoother.
3048 Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
3051 How much to use compressed signal in output. Default is 1.
3052 Range is between 0 and 1.
3055 @subsection Examples
3059 Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
3060 depending on the signal of 2nd input and later compressed signal to be
3061 merged with 2nd input:
3063 ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
3067 @section sidechaingate
3069 A sidechain gate acts like a normal (wideband) gate but has the ability to
3070 filter the detected signal before sending it to the gain reduction stage.
3071 Normally a gate uses the full range signal to detect a level above the
3073 For example: If you cut all lower frequencies from your sidechain signal
3074 the gate will decrease the volume of your track only if not enough highs
3075 appear. With this technique you are able to reduce the resonation of a
3076 natural drum or remove "rumbling" of muted strokes from a heavily distorted
3078 It needs two input streams and returns one output stream.
3079 First input stream will be processed depending on second stream signal.
3081 The filter accepts the following options:
3085 Set input level before filtering.
3086 Default is 1. Allowed range is from 0.015625 to 64.
3089 Set the level of gain reduction when the signal is below the threshold.
3090 Default is 0.06125. Allowed range is from 0 to 1.
3093 If a signal rises above this level the gain reduction is released.
3094 Default is 0.125. Allowed range is from 0 to 1.
3097 Set a ratio about which the signal is reduced.
3098 Default is 2. Allowed range is from 1 to 9000.
3101 Amount of milliseconds the signal has to rise above the threshold before gain
3103 Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
3106 Amount of milliseconds the signal has to fall below the threshold before the
3107 reduction is increased again. Default is 250 milliseconds.
3108 Allowed range is from 0.01 to 9000.
3111 Set amount of amplification of signal after processing.
3112 Default is 1. Allowed range is from 1 to 64.
3115 Curve the sharp knee around the threshold to enter gain reduction more softly.
3116 Default is 2.828427125. Allowed range is from 1 to 8.
3119 Choose if exact signal should be taken for detection or an RMS like one.
3120 Default is rms. Can be peak or rms.
3123 Choose if the average level between all channels or the louder channel affects
3125 Default is average. Can be average or maximum.
3128 Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
3131 @section silencedetect
3133 Detect silence in an audio stream.
3135 This filter logs a message when it detects that the input audio volume is less
3136 or equal to a noise tolerance value for a duration greater or equal to the
3137 minimum detected noise duration.
3139 The printed times and duration are expressed in seconds.
3141 The filter accepts the following options:
3145 Set silence duration until notification (default is 2 seconds).
3148 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
3149 specified value) or amplitude ratio. Default is -60dB, or 0.001.
3152 @subsection Examples
3156 Detect 5 seconds of silence with -50dB noise tolerance:
3158 silencedetect=n=-50dB:d=5
3162 Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
3163 tolerance in @file{silence.mp3}:
3165 ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
3169 @section silenceremove
3171 Remove silence from the beginning, middle or end of the audio.
3173 The filter accepts the following options:
3177 This value is used to indicate if audio should be trimmed at beginning of
3178 the audio. A value of zero indicates no silence should be trimmed from the
3179 beginning. When specifying a non-zero value, it trims audio up until it
3180 finds non-silence. Normally, when trimming silence from beginning of audio
3181 the @var{start_periods} will be @code{1} but it can be increased to higher
3182 values to trim all audio up to specific count of non-silence periods.
3183 Default value is @code{0}.
3185 @item start_duration
3186 Specify the amount of time that non-silence must be detected before it stops
3187 trimming audio. By increasing the duration, bursts of noises can be treated
3188 as silence and trimmed off. Default value is @code{0}.
3190 @item start_threshold
3191 This indicates what sample value should be treated as silence. For digital
3192 audio, a value of @code{0} may be fine but for audio recorded from analog,
3193 you may wish to increase the value to account for background noise.
3194 Can be specified in dB (in case "dB" is appended to the specified value)
3195 or amplitude ratio. Default value is @code{0}.
3198 Set the count for trimming silence from the end of audio.
3199 To remove silence from the middle of a file, specify a @var{stop_periods}
3200 that is negative. This value is then treated as a positive value and is
3201 used to indicate the effect should restart processing as specified by
3202 @var{start_periods}, making it suitable for removing periods of silence
3203 in the middle of the audio.
3204 Default value is @code{0}.
3207 Specify a duration of silence that must exist before audio is not copied any
3208 more. By specifying a higher duration, silence that is wanted can be left in
3210 Default value is @code{0}.
3212 @item stop_threshold
3213 This is the same as @option{start_threshold} but for trimming silence from
3215 Can be specified in dB (in case "dB" is appended to the specified value)
3216 or amplitude ratio. Default value is @code{0}.
3219 This indicate that @var{stop_duration} length of audio should be left intact
3220 at the beginning of each period of silence.
3221 For example, if you want to remove long pauses between words but do not want
3222 to remove the pauses completely. Default value is @code{0}.
3225 Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
3226 and works better with digital silence which is exactly 0.
3227 Default value is @code{rms}.
3230 Set ratio used to calculate size of window for detecting silence.
3231 Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
3234 @subsection Examples
3238 The following example shows how this filter can be used to start a recording
3239 that does not contain the delay at the start which usually occurs between
3240 pressing the record button and the start of the performance:
3242 silenceremove=1:5:0.02
3246 Trim all silence encountered from begining to end where there is more than 1
3247 second of silence in audio:
3249 silenceremove=0:0:0:-1:1:-90dB
3255 SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
3256 loudspeakers around the user for binaural listening via headphones (audio
3257 formats up to 9 channels supported).
3258 The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
3259 SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
3260 Austrian Academy of Sciences.
3262 To enable compilation of this filter you need to configure FFmpeg with
3263 @code{--enable-netcdf}.
3265 The filter accepts the following options:
3269 Set the SOFA file used for rendering.
3272 Set gain applied to audio. Value is in dB. Default is 0.
3275 Set rotation of virtual loudspeakers in deg. Default is 0.
3278 Set elevation of virtual speakers in deg. Default is 0.
3281 Set distance in meters between loudspeakers and the listener with near-field
3282 HRTFs. Default is 1.
3285 Set processing type. Can be @var{time} or @var{freq}. @var{time} is
3286 processing audio in time domain which is slow.
3287 @var{freq} is processing audio in frequency domain which is fast.
3288 Default is @var{freq}.
3291 Set custom positions of virtual loudspeakers. Syntax for this option is:
3292 <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
3293 Each virtual loudspeaker is described with short channel name following with
3294 azimuth and elevation in degreees.
3295 Each virtual loudspeaker description is separated by '|'.
3296 For example to override front left and front right channel positions use:
3297 'speakers=FL 45 15|FR 345 15'.
3298 Descriptions with unrecognised channel names are ignored.
3301 @subsection Examples
3305 Using ClubFritz6 sofa file:
3307 sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
3311 Using ClubFritz12 sofa file and bigger radius with small rotation:
3313 sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
3317 Similar as above but with custom speaker positions for front left, front right, rear left and rear right
3318 and also with custom gain:
3320 "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
3324 @section stereotools
3326 This filter has some handy utilities to manage stereo signals, for converting
3327 M/S stereo recordings to L/R signal while having control over the parameters
3328 or spreading the stereo image of master track.
3330 The filter accepts the following options:
3334 Set input level before filtering for both channels. Defaults is 1.
3335 Allowed range is from 0.015625 to 64.
3338 Set output level after filtering for both channels. Defaults is 1.
3339 Allowed range is from 0.015625 to 64.
3342 Set input balance between both channels. Default is 0.
3343 Allowed range is from -1 to 1.
3346 Set output balance between both channels. Default is 0.
3347 Allowed range is from -1 to 1.
3350 Enable softclipping. Results in analog distortion instead of harsh digital 0dB
3351 clipping. Disabled by default.
3354 Mute the left channel. Disabled by default.
3357 Mute the right channel. Disabled by default.
3360 Change the phase of the left channel. Disabled by default.
3363 Change the phase of the right channel. Disabled by default.
3366 Set stereo mode. Available values are:
3370 Left/Right to Left/Right, this is default.
3373 Left/Right to Mid/Side.
3376 Mid/Side to Left/Right.
3379 Left/Right to Left/Left.
3382 Left/Right to Right/Right.
3385 Left/Right to Left + Right.
3388 Left/Right to Right/Left.
3392 Set level of side signal. Default is 1.
3393 Allowed range is from 0.015625 to 64.
3396 Set balance of side signal. Default is 0.
3397 Allowed range is from -1 to 1.
3400 Set level of the middle signal. Default is 1.
3401 Allowed range is from 0.015625 to 64.
3404 Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
3407 Set stereo base between mono and inversed channels. Default is 0.
3408 Allowed range is from -1 to 1.
3411 Set delay in milliseconds how much to delay left from right channel and
3412 vice versa. Default is 0. Allowed range is from -20 to 20.
3415 Set S/C level. Default is 1. Allowed range is from 1 to 100.
3418 Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
3421 @subsection Examples
3425 Apply karaoke like effect:
3427 stereotools=mlev=0.015625
3431 Convert M/S signal to L/R:
3433 "stereotools=mode=ms>lr"
3437 @section stereowiden
3439 This filter enhance the stereo effect by suppressing signal common to both
3440 channels and by delaying the signal of left into right and vice versa,
3441 thereby widening the stereo effect.
3443 The filter accepts the following options:
3447 Time in milliseconds of the delay of left signal into right and vice versa.
3448 Default is 20 milliseconds.
3451 Amount of gain in delayed signal into right and vice versa. Gives a delay
3452 effect of left signal in right output and vice versa which gives widening
3453 effect. Default is 0.3.
3456 Cross feed of left into right with inverted phase. This helps in suppressing
3457 the mono. If the value is 1 it will cancel all the signal common to both
3458 channels. Default is 0.3.
3461 Set level of input signal of original channel. Default is 0.8.
3466 Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
3467 format conversion on CUDA video frames. Setting the output width and height
3468 works in the same way as for the @var{scale} filter.
3470 The following additional options are accepted:
3473 The pixel format of the output CUDA frames. If set to the string "same" (the
3474 default), the input format will be kept. Note that automatic format negotiation
3475 and conversion is not yet supported for hardware frames
3478 The interpolation algorithm used for resizing. One of the following:
3485 @item cubic2p_bspline
3486 2-parameter cubic (B=1, C=0)
3488 @item cubic2p_catmullrom
3489 2-parameter cubic (B=0, C=1/2)
3491 @item cubic2p_b05c03
3492 2-parameter cubic (B=1/2, C=3/10)
3503 Select frames to pass in output.
3507 Boost or cut treble (upper) frequencies of the audio using a two-pole
3508 shelving filter with a response similar to that of a standard
3509 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
3511 The filter accepts the following options:
3515 Give the gain at whichever is the lower of ~22 kHz and the
3516 Nyquist frequency. Its useful range is about -20 (for a large cut)
3517 to +20 (for a large boost). Beware of clipping when using a positive gain.
3520 Set the filter's central frequency and so can be used
3521 to extend or reduce the frequency range to be boosted or cut.
3522 The default value is @code{3000} Hz.
3525 Set method to specify band-width of filter.
3538 Determine how steep is the filter's shelf transition.
3543 Sinusoidal amplitude modulation.
3545 The filter accepts the following options:
3549 Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
3550 (20 Hz or lower) will result in a tremolo effect.
3551 This filter may also be used as a ring modulator by specifying
3552 a modulation frequency higher than 20 Hz.
3553 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
3556 Depth of modulation as a percentage. Range is 0.0 - 1.0.
3557 Default value is 0.5.
3562 Sinusoidal phase modulation.
3564 The filter accepts the following options:
3568 Modulation frequency in Hertz.
3569 Range is 0.1 - 20000.0. Default value is 5.0 Hz.
3572 Depth of modulation as a percentage. Range is 0.0 - 1.0.
3573 Default value is 0.5.
3578 Adjust the input audio volume.
3580 It accepts the following parameters:
3584 Set audio volume expression.
3586 Output values are clipped to the maximum value.
3588 The output audio volume is given by the relation:
3590 @var{output_volume} = @var{volume} * @var{input_volume}
3593 The default value for @var{volume} is "1.0".
3596 This parameter represents the mathematical precision.
3598 It determines which input sample formats will be allowed, which affects the
3599 precision of the volume scaling.
3603 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
3605 32-bit floating-point; this limits input sample format to FLT. (default)
3607 64-bit floating-point; this limits input sample format to DBL.
3611 Choose the behaviour on encountering ReplayGain side data in input frames.
3615 Remove ReplayGain side data, ignoring its contents (the default).
3618 Ignore ReplayGain side data, but leave it in the frame.
3621 Prefer the track gain, if present.
3624 Prefer the album gain, if present.
3627 @item replaygain_preamp
3628 Pre-amplification gain in dB to apply to the selected replaygain gain.
3630 Default value for @var{replaygain_preamp} is 0.0.
3633 Set when the volume expression is evaluated.
3635 It accepts the following values:
3638 only evaluate expression once during the filter initialization, or
3639 when the @samp{volume} command is sent
3642 evaluate expression for each incoming frame
3645 Default value is @samp{once}.
3648 The volume expression can contain the following parameters.
3652 frame number (starting at zero)
3655 @item nb_consumed_samples
3656 number of samples consumed by the filter
3658 number of samples in the current frame
3660 original frame position in the file
3666 PTS at start of stream
3668 time at start of stream
3674 last set volume value
3677 Note that when @option{eval} is set to @samp{once} only the
3678 @var{sample_rate} and @var{tb} variables are available, all other
3679 variables will evaluate to NAN.
3681 @subsection Commands
3683 This filter supports the following commands:
3686 Modify the volume expression.
3687 The command accepts the same syntax of the corresponding option.
3689 If the specified expression is not valid, it is kept at its current
3691 @item replaygain_noclip
3692 Prevent clipping by limiting the gain applied.
3694 Default value for @var{replaygain_noclip} is 1.
3698 @subsection Examples
3702 Halve the input audio volume:
3706 volume=volume=-6.0206dB
3709 In all the above example the named key for @option{volume} can be
3710 omitted, for example like in:
3716 Increase input audio power by 6 decibels using fixed-point precision:
3718 volume=volume=6dB:precision=fixed
3722 Fade volume after time 10 with an annihilation period of 5 seconds:
3724 volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
3728 @section volumedetect
3730 Detect the volume of the input video.
3732 The filter has no parameters. The input is not modified. Statistics about
3733 the volume will be printed in the log when the input stream end is reached.
3735 In particular it will show the mean volume (root mean square), maximum
3736 volume (on a per-sample basis), and the beginning of a histogram of the
3737 registered volume values (from the maximum value to a cumulated 1/1000 of
3740 All volumes are in decibels relative to the maximum PCM value.
3742 @subsection Examples
3744 Here is an excerpt of the output:
3746 [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
3747 [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
3748 [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
3749 [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
3750 [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
3751 [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
3752 [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
3753 [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
3754 [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
3760 The mean square energy is approximately -27 dB, or 10^-2.7.
3762 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
3764 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
3767 In other words, raising the volume by +4 dB does not cause any clipping,
3768 raising it by +5 dB causes clipping for 6 samples, etc.
3770 @c man end AUDIO FILTERS
3772 @chapter Audio Sources
3773 @c man begin AUDIO SOURCES
3775 Below is a description of the currently available audio sources.
3779 Buffer audio frames, and make them available to the filter chain.
3781 This source is mainly intended for a programmatic use, in particular
3782 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
3784 It accepts the following parameters:
3788 The timebase which will be used for timestamps of submitted frames. It must be
3789 either a floating-point number or in @var{numerator}/@var{denominator} form.
3792 The sample rate of the incoming audio buffers.
3795 The sample format of the incoming audio buffers.
3796 Either a sample format name or its corresponding integer representation from
3797 the enum AVSampleFormat in @file{libavutil/samplefmt.h}
3799 @item channel_layout
3800 The channel layout of the incoming audio buffers.
3801 Either a channel layout name from channel_layout_map in
3802 @file{libavutil/channel_layout.c} or its corresponding integer representation
3803 from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
3806 The number of channels of the incoming audio buffers.
3807 If both @var{channels} and @var{channel_layout} are specified, then they
3812 @subsection Examples
3815 abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
3818 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
3819 Since the sample format with name "s16p" corresponds to the number
3820 6 and the "stereo" channel layout corresponds to the value 0x3, this is
3823 abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
3828 Generate an audio signal specified by an expression.
3830 This source accepts in input one or more expressions (one for each
3831 channel), which are evaluated and used to generate a corresponding
3834 This source accepts the following options:
3838 Set the '|'-separated expressions list for each separate channel. In case the
3839 @option{channel_layout} option is not specified, the selected channel layout
3840 depends on the number of provided expressions. Otherwise the last
3841 specified expression is applied to the remaining output channels.
3843 @item channel_layout, c
3844 Set the channel layout. The number of channels in the specified layout
3845 must be equal to the number of specified expressions.
3848 Set the minimum duration of the sourced audio. See
3849 @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
3850 for the accepted syntax.
3851 Note that the resulting duration may be greater than the specified
3852 duration, as the generated audio is always cut at the end of a
3855 If not specified, or the expressed duration is negative, the audio is
3856 supposed to be generated forever.
3859 Set the number of samples per channel per each output frame,
3862 @item sample_rate, s
3863 Specify the sample rate, default to 44100.
3866 Each expression in @var{exprs} can contain the following constants:
3870 number of the evaluated sample, starting from 0
3873 time of the evaluated sample expressed in seconds, starting from 0
3880 @subsection Examples
3890 Generate a sin signal with frequency of 440 Hz, set sample rate to
3893 aevalsrc="sin(440*2*PI*t):s=8000"
3897 Generate a two channels signal, specify the channel layout (Front
3898 Center + Back Center) explicitly:
3900 aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
3904 Generate white noise:
3906 aevalsrc="-2+random(0)"
3910 Generate an amplitude modulated signal:
3912 aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
3916 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
3918 aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
3925 The null audio source, return unprocessed audio frames. It is mainly useful
3926 as a template and to be employed in analysis / debugging tools, or as
3927 the source for filters which ignore the input data (for example the sox
3930 This source accepts the following options:
3934 @item channel_layout, cl
3936 Specifies the channel layout, and can be either an integer or a string
3937 representing a channel layout. The default value of @var{channel_layout}
3940 Check the channel_layout_map definition in
3941 @file{libavutil/channel_layout.c} for the mapping between strings and
3942 channel layout values.
3944 @item sample_rate, r
3945 Specifies the sample rate, and defaults to 44100.
3948 Set the number of samples per requested frames.
3952 @subsection Examples
3956 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
3958 anullsrc=r=48000:cl=4
3962 Do the same operation with a more obvious syntax:
3964 anullsrc=r=48000:cl=mono
3968 All the parameters need to be explicitly defined.
3972 Synthesize a voice utterance using the libflite library.
3974 To enable compilation of this filter you need to configure FFmpeg with
3975 @code{--enable-libflite}.
3977 Note that the flite library is not thread-safe.
3979 The filter accepts the following options:
3984 If set to 1, list the names of the available voices and exit
3985 immediately. Default value is 0.
3988 Set the maximum number of samples per frame. Default value is 512.
3991 Set the filename containing the text to speak.
3994 Set the text to speak.
3997 Set the voice to use for the speech synthesis. Default value is
3998 @code{kal}. See also the @var{list_voices} option.
4001 @subsection Examples
4005 Read from file @file{speech.txt}, and synthesize the text using the
4006 standard flite voice:
4008 flite=textfile=speech.txt
4012 Read the specified text selecting the @code{slt} voice:
4014 flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
4018 Input text to ffmpeg:
4020 ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
4024 Make @file{ffplay} speak the specified text, using @code{flite} and
4025 the @code{lavfi} device:
4027 ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
4031 For more information about libflite, check:
4032 @url{http://www.speech.cs.cmu.edu/flite/}
4036 Generate a noise audio signal.
4038 The filter accepts the following options:
4041 @item sample_rate, r
4042 Specify the sample rate. Default value is 48000 Hz.
4045 Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
4049 Specify the duration of the generated audio stream. Not specifying this option
4050 results in noise with an infinite length.
4052 @item color, colour, c
4053 Specify the color of noise. Available noise colors are white, pink, and brown.
4054 Default color is white.
4057 Specify a value used to seed the PRNG.
4060 Set the number of samples per each output frame, default is 1024.
4063 @subsection Examples
4068 Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
4070 anoisesrc=d=60:c=pink:r=44100:a=0.5
4076 Generate an audio signal made of a sine wave with amplitude 1/8.
4078 The audio signal is bit-exact.
4080 The filter accepts the following options:
4085 Set the carrier frequency. Default is 440 Hz.
4087 @item beep_factor, b
4088 Enable a periodic beep every second with frequency @var{beep_factor} times
4089 the carrier frequency. Default is 0, meaning the beep is disabled.
4091 @item sample_rate, r
4092 Specify the sample rate, default is 44100.
4095 Specify the duration of the generated audio stream.
4097 @item samples_per_frame
4098 Set the number of samples per output frame.
4100 The expression can contain the following constants:
4104 The (sequential) number of the output audio frame, starting from 0.
4107 The PTS (Presentation TimeStamp) of the output audio frame,
4108 expressed in @var{TB} units.
4111 The PTS of the output audio frame, expressed in seconds.
4114 The timebase of the output audio frames.
4117 Default is @code{1024}.
4120 @subsection Examples
4125 Generate a simple 440 Hz sine wave:
4131 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
4135 sine=frequency=220:beep_factor=4:duration=5
4139 Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
4142 sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
4146 @c man end AUDIO SOURCES
4148 @chapter Audio Sinks
4149 @c man begin AUDIO SINKS
4151 Below is a description of the currently available audio sinks.
4153 @section abuffersink
4155 Buffer audio frames, and make them available to the end of filter chain.
4157 This sink is mainly intended for programmatic use, in particular
4158 through the interface defined in @file{libavfilter/buffersink.h}
4159 or the options system.
4161 It accepts a pointer to an AVABufferSinkContext structure, which
4162 defines the incoming buffers' formats, to be passed as the opaque
4163 parameter to @code{avfilter_init_filter} for initialization.
4166 Null audio sink; do absolutely nothing with the input audio. It is
4167 mainly useful as a template and for use in analysis / debugging
4170 @c man end AUDIO SINKS
4172 @chapter Video Filters
4173 @c man begin VIDEO FILTERS
4175 When you configure your FFmpeg build, you can disable any of the
4176 existing filters using @code{--disable-filters}.
4177 The configure output will show the video filters included in your
4180 Below is a description of the currently available video filters.
4182 @section alphaextract
4184 Extract the alpha component from the input as a grayscale video. This
4185 is especially useful with the @var{alphamerge} filter.
4189 Add or replace the alpha component of the primary input with the
4190 grayscale value of a second input. This is intended for use with
4191 @var{alphaextract} to allow the transmission or storage of frame
4192 sequences that have alpha in a format that doesn't support an alpha
4195 For example, to reconstruct full frames from a normal YUV-encoded video
4196 and a separate video created with @var{alphaextract}, you might use:
4198 movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
4201 Since this filter is designed for reconstruction, it operates on frame
4202 sequences without considering timestamps, and terminates when either
4203 input reaches end of stream. This will cause problems if your encoding
4204 pipeline drops frames. If you're trying to apply an image as an
4205 overlay to a video stream, consider the @var{overlay} filter instead.
4209 Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
4210 and libavformat to work. On the other hand, it is limited to ASS (Advanced
4211 Substation Alpha) subtitles files.
4213 This filter accepts the following option in addition to the common options from
4214 the @ref{subtitles} filter:
4218 Set the shaping engine
4220 Available values are:
4223 The default libass shaping engine, which is the best available.
4225 Fast, font-agnostic shaper that can do only substitutions
4227 Slower shaper using OpenType for substitutions and positioning
4230 The default is @code{auto}.
4234 Apply an Adaptive Temporal Averaging Denoiser to the video input.
4236 The filter accepts the following options:
4240 Set threshold A for 1st plane. Default is 0.02.
4241 Valid range is 0 to 0.3.
4244 Set threshold B for 1st plane. Default is 0.04.
4245 Valid range is 0 to 5.
4248 Set threshold A for 2nd plane. Default is 0.02.
4249 Valid range is 0 to 0.3.
4252 Set threshold B for 2nd plane. Default is 0.04.
4253 Valid range is 0 to 5.
4256 Set threshold A for 3rd plane. Default is 0.02.
4257 Valid range is 0 to 0.3.
4260 Set threshold B for 3rd plane. Default is 0.04.
4261 Valid range is 0 to 5.
4263 Threshold A is designed to react on abrupt changes in the input signal and
4264 threshold B is designed to react on continuous changes in the input signal.
4267 Set number of frames filter will use for averaging. Default is 33. Must be odd
4268 number in range [5, 129].
4273 Compute the bounding box for the non-black pixels in the input frame
4276 This filter computes the bounding box containing all the pixels with a
4277 luminance value greater than the minimum allowed value.
4278 The parameters describing the bounding box are printed on the filter
4281 The filter accepts the following option:
4285 Set the minimal luminance value. Default is @code{16}.
4288 @section blackdetect
4290 Detect video intervals that are (almost) completely black. Can be
4291 useful to detect chapter transitions, commercials, or invalid
4292 recordings. Output lines contains the time for the start, end and
4293 duration of the detected black interval expressed in seconds.
4295 In order to display the output lines, you need to set the loglevel at
4296 least to the AV_LOG_INFO value.
4298 The filter accepts the following options:
4301 @item black_min_duration, d
4302 Set the minimum detected black duration expressed in seconds. It must
4303 be a non-negative floating point number.
4305 Default value is 2.0.
4307 @item picture_black_ratio_th, pic_th
4308 Set the threshold for considering a picture "black".
4309 Express the minimum value for the ratio:
4311 @var{nb_black_pixels} / @var{nb_pixels}
4314 for which a picture is considered black.
4315 Default value is 0.98.
4317 @item pixel_black_th, pix_th
4318 Set the threshold for considering a pixel "black".
4320 The threshold expresses the maximum pixel luminance value for which a
4321 pixel is considered "black". The provided value is scaled according to
4322 the following equation:
4324 @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
4327 @var{luminance_range_size} and @var{luminance_minimum_value} depend on
4328 the input video format, the range is [0-255] for YUV full-range
4329 formats and [16-235] for YUV non full-range formats.
4331 Default value is 0.10.
4334 The following example sets the maximum pixel threshold to the minimum
4335 value, and detects only black intervals of 2 or more seconds:
4337 blackdetect=d=2:pix_th=0.00
4342 Detect frames that are (almost) completely black. Can be useful to
4343 detect chapter transitions or commercials. Output lines consist of
4344 the frame number of the detected frame, the percentage of blackness,
4345 the position in the file if known or -1 and the timestamp in seconds.
4347 In order to display the output lines, you need to set the loglevel at
4348 least to the AV_LOG_INFO value.
4350 It accepts the following parameters:
4355 The percentage of the pixels that have to be below the threshold; it defaults to
4358 @item threshold, thresh
4359 The threshold below which a pixel value is considered black; it defaults to
4364 @section blend, tblend
4366 Blend two video frames into each other.
4368 The @code{blend} filter takes two input streams and outputs one
4369 stream, the first input is the "top" layer and second input is
4370 "bottom" layer. Output terminates when shortest input terminates.
4372 The @code{tblend} (time blend) filter takes two consecutive frames
4373 from one single stream, and outputs the result obtained by blending
4374 the new frame on top of the old frame.
4376 A description of the accepted options follows.
4384 Set blend mode for specific pixel component or all pixel components in case
4385 of @var{all_mode}. Default value is @code{normal}.
4387 Available values for component modes are:
4428 Set blend opacity for specific pixel component or all pixel components in case
4429 of @var{all_opacity}. Only used in combination with pixel component blend modes.
4436 Set blend expression for specific pixel component or all pixel components in case
4437 of @var{all_expr}. Note that related mode options will be ignored if those are set.
4439 The expressions can use the following variables:
4443 The sequential number of the filtered frame, starting from @code{0}.
4447 the coordinates of the current sample
4451 the width and height of currently filtered plane
4455 Width and height scale depending on the currently filtered plane. It is the
4456 ratio between the corresponding luma plane number of pixels and the current
4457 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
4458 @code{0.5,0.5} for chroma planes.
4461 Time of the current frame, expressed in seconds.
4464 Value of pixel component at current location for first video frame (top layer).
4467 Value of pixel component at current location for second video frame (bottom layer).
4471 Force termination when the shortest input terminates. Default is
4472 @code{0}. This option is only defined for the @code{blend} filter.
4475 Continue applying the last bottom frame after the end of the stream. A value of
4476 @code{0} disable the filter after the last frame of the bottom layer is reached.
4477 Default is @code{1}. This option is only defined for the @code{blend} filter.
4480 @subsection Examples
4484 Apply transition from bottom layer to top layer in first 10 seconds:
4486 blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
4490 Apply 1x1 checkerboard effect:
4492 blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
4496 Apply uncover left effect:
4498 blend=all_expr='if(gte(N*SW+X,W),A,B)'
4502 Apply uncover down effect:
4504 blend=all_expr='if(gte(Y-N*SH,0),A,B)'
4508 Apply uncover up-left effect:
4510 blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
4514 Split diagonally video and shows top and bottom layer on each side:
4516 blend=all_expr=if(gt(X,Y*(W/H)),A,B)
4520 Display differences between the current and the previous frame:
4522 tblend=all_mode=difference128
4528 Apply a boxblur algorithm to the input video.
4530 It accepts the following parameters:
4534 @item luma_radius, lr
4535 @item luma_power, lp
4536 @item chroma_radius, cr
4537 @item chroma_power, cp
4538 @item alpha_radius, ar
4539 @item alpha_power, ap
4543 A description of the accepted options follows.
4546 @item luma_radius, lr
4547 @item chroma_radius, cr
4548 @item alpha_radius, ar
4549 Set an expression for the box radius in pixels used for blurring the
4550 corresponding input plane.
4552 The radius value must be a non-negative number, and must not be
4553 greater than the value of the expression @code{min(w,h)/2} for the
4554 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
4557 Default value for @option{luma_radius} is "2". If not specified,
4558 @option{chroma_radius} and @option{alpha_radius} default to the
4559 corresponding value set for @option{luma_radius}.
4561 The expressions can contain the following constants:
4565 The input width and height in pixels.
4569 The input chroma image width and height in pixels.
4573 The horizontal and vertical chroma subsample values. For example, for the
4574 pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
4577 @item luma_power, lp
4578 @item chroma_power, cp
4579 @item alpha_power, ap
4580 Specify how many times the boxblur filter is applied to the
4581 corresponding plane.
4583 Default value for @option{luma_power} is 2. If not specified,
4584 @option{chroma_power} and @option{alpha_power} default to the
4585 corresponding value set for @option{luma_power}.
4587 A value of 0 will disable the effect.
4590 @subsection Examples
4594 Apply a boxblur filter with the luma, chroma, and alpha radii
4597 boxblur=luma_radius=2:luma_power=1
4602 Set the luma radius to 2, and alpha and chroma radius to 0:
4604 boxblur=2:1:cr=0:ar=0
4608 Set the luma and chroma radii to a fraction of the video dimension:
4610 boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
4616 Deinterlace the input video ("bwdif" stands for "Bob Weaver
4617 Deinterlacing Filter").
4619 Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
4620 interpolation algorithms.
4621 It accepts the following parameters:
4625 The interlacing mode to adopt. It accepts one of the following values:
4629 Output one frame for each frame.
4631 Output one frame for each field.
4634 The default value is @code{send_field}.
4637 The picture field parity assumed for the input interlaced video. It accepts one
4638 of the following values:
4642 Assume the top field is first.
4644 Assume the bottom field is first.
4646 Enable automatic detection of field parity.
4649 The default value is @code{auto}.
4650 If the interlacing is unknown or the decoder does not export this information,
4651 top field first will be assumed.
4654 Specify which frames to deinterlace. Accept one of the following
4659 Deinterlace all frames.
4661 Only deinterlace frames marked as interlaced.
4664 The default value is @code{all}.
4668 YUV colorspace color/chroma keying.
4670 The filter accepts the following options:
4674 The color which will be replaced with transparency.
4677 Similarity percentage with the key color.
4679 0.01 matches only the exact key color, while 1.0 matches everything.
4684 0.0 makes pixels either fully transparent, or not transparent at all.
4686 Higher values result in semi-transparent pixels, with a higher transparency
4687 the more similar the pixels color is to the key color.
4690 Signals that the color passed is already in YUV instead of RGB.
4692 Litteral colors like "green" or "red" don't make sense with this enabled anymore.
4693 This can be used to pass exact YUV values as hexadecimal numbers.
4696 @subsection Examples
4700 Make every green pixel in the input image transparent:
4702 ffmpeg -i input.png -vf chromakey=green out.png
4706 Overlay a greenscreen-video on top of a static black background.
4708 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
4714 Display CIE color diagram with pixels overlaid onto it.
4716 The filter acccepts the following options:
4731 @item uhdtv, rec2020
4744 Set what gamuts to draw.
4746 See @code{system} option for avaiable values.
4749 Set ciescope size, by default set to 512.
4752 Set intensity used to map input pixel values to CIE diagram.
4755 Set contrast used to draw tongue colors that are out of active color system gamut.
4758 Correct gamma displayed on scope, by default enabled.
4761 Show white point on CIE diagram, by default disabled.
4764 Set input gamma. Used only with XYZ input color space.
4769 Visualize information exported by some codecs.
4771 Some codecs can export information through frames using side-data or other
4772 means. For example, some MPEG based codecs export motion vectors through the
4773 @var{export_mvs} flag in the codec @option{flags2} option.
4775 The filter accepts the following option:
4779 Set motion vectors to visualize.
4781 Available flags for @var{mv} are:
4785 forward predicted MVs of P-frames
4787 forward predicted MVs of B-frames
4789 backward predicted MVs of B-frames
4793 Display quantization parameters using the chroma planes.
4796 Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
4798 Available flags for @var{mv_type} are:
4802 forward predicted MVs
4804 backward predicted MVs
4807 @item frame_type, ft
4808 Set frame type to visualize motion vectors of.
4810 Available flags for @var{frame_type} are:
4814 intra-coded frames (I-frames)
4816 predicted frames (P-frames)
4818 bi-directionally predicted frames (B-frames)
4822 @subsection Examples
4826 Visualize forward predicted MVs of all frames using @command{ffplay}:
4828 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
4832 Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
4834 ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
4838 @section colorbalance
4839 Modify intensity of primary colors (red, green and blue) of input frames.
4841 The filter allows an input frame to be adjusted in the shadows, midtones or highlights
4842 regions for the red-cyan, green-magenta or blue-yellow balance.
4844 A positive adjustment value shifts the balance towards the primary color, a negative
4845 value towards the complementary color.
4847 The filter accepts the following options:
4853 Adjust red, green and blue shadows (darkest pixels).
4858 Adjust red, green and blue midtones (medium pixels).
4863 Adjust red, green and blue highlights (brightest pixels).
4865 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
4868 @subsection Examples
4872 Add red color cast to shadows:
4879 RGB colorspace color keying.
4881 The filter accepts the following options:
4885 The color which will be replaced with transparency.
4888 Similarity percentage with the key color.
4890 0.01 matches only the exact key color, while 1.0 matches everything.
4895 0.0 makes pixels either fully transparent, or not transparent at all.
4897 Higher values result in semi-transparent pixels, with a higher transparency
4898 the more similar the pixels color is to the key color.
4901 @subsection Examples
4905 Make every green pixel in the input image transparent:
4907 ffmpeg -i input.png -vf colorkey=green out.png
4911 Overlay a greenscreen-video on top of a static background image.
4913 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
4917 @section colorlevels
4919 Adjust video input frames using levels.
4921 The filter accepts the following options:
4928 Adjust red, green, blue and alpha input black point.
4929 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
4935 Adjust red, green, blue and alpha input white point.
4936 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
4938 Input levels are used to lighten highlights (bright tones), darken shadows
4939 (dark tones), change the balance of bright and dark tones.
4945 Adjust red, green, blue and alpha output black point.
4946 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
4952 Adjust red, green, blue and alpha output white point.
4953 Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
4955 Output levels allows manual selection of a constrained output level range.
4958 @subsection Examples
4962 Make video output darker:
4964 colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
4970 colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
4974 Make video output lighter:
4976 colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
4980 Increase brightness:
4982 colorlevels=romin=0.5:gomin=0.5:bomin=0.5
4986 @section colorchannelmixer
4988 Adjust video input frames by re-mixing color channels.
4990 This filter modifies a color channel by adding the values associated to
4991 the other channels of the same pixels. For example if the value to
4992 modify is red, the output value will be:
4994 @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
4997 The filter accepts the following options:
5004 Adjust contribution of input red, green, blue and alpha channels for output red channel.
5005 Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
5011 Adjust contribution of input red, green, blue and alpha channels for output green channel.
5012 Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
5018 Adjust contribution of input red, green, blue and alpha channels for output blue channel.
5019 Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
5025 Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
5026 Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
5028 Allowed ranges for options are @code{[-2.0, 2.0]}.
5031 @subsection Examples
5035 Convert source to grayscale:
5037 colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
5040 Simulate sepia tones:
5042 colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
5046 @section colormatrix
5048 Convert color matrix.
5050 The filter accepts the following options:
5055 Specify the source and destination color matrix. Both values must be
5058 The accepted values are:
5077 For example to convert from BT.601 to SMPTE-240M, use the command:
5079 colormatrix=bt601:smpte240m
5084 Convert colorspace, transfer characteristics or color primaries.
5086 The filter accepts the following options:
5090 Specify all color properties at once.
5092 The accepted values are:
5121 Specify output colorspace.
5123 The accepted values are:
5132 BT.470BG or BT.601-6 625