blob: 89244dc543c11042774bab399bac40928a2714c4 [file] [log] [blame]
@chapter Filtering Introduction
@c man begin FILTERING INTRODUCTION
Filtering in FFmpeg is enabled through the libavfilter library.
In libavfilter, a filter can have multiple inputs and multiple
outputs.
To illustrate the sorts of things that are possible, we consider the
following filtergraph.
@verbatim
[main]
input --> split ---------------------> overlay --> output
| ^
|[tmp] [flip]|
+-----> crop --> vflip -------+
@end verbatim
This filtergraph splits the input stream in two streams, then sends one
stream through the crop filter and the vflip filter, before merging it
back with the other stream by overlaying it on top. You can use the
following command to achieve this:
@example
ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
@end example
The result will be that the top half of the video is mirrored
onto the bottom half of the output video.
Filters in the same linear chain are separated by commas, and distinct
linear chains of filters are separated by semicolons. In our example,
@var{crop,vflip} are in one linear chain, @var{split} and
@var{overlay} are separately in another. The points where the linear
chains join are labelled by names enclosed in square brackets. In the
example, the split filter generates two outputs that are associated to
the labels @var{[main]} and @var{[tmp]}.
The stream sent to the second output of @var{split}, labelled as
@var{[tmp]}, is processed through the @var{crop} filter, which crops
away the lower half part of the video, and then vertically flipped. The
@var{overlay} filter takes in input the first unchanged output of the
split filter (which was labelled as @var{[main]}), and overlay on its
lower half the output generated by the @var{crop,vflip} filterchain.
Some filters take in input a list of parameters: they are specified
after the filter name and an equal sign, and are separated from each other
by a colon.
There exist so-called @var{source filters} that do not have an
audio/video input, and @var{sink filters} that will not have audio/video
output.
@c man end FILTERING INTRODUCTION
@chapter graph2dot
@c man begin GRAPH2DOT
The @file{graph2dot} program included in the FFmpeg @file{tools}
directory can be used to parse a filtergraph description and issue a
corresponding textual representation in the dot language.
Invoke the command:
@example
graph2dot -h
@end example
to see how to use @file{graph2dot}.
You can then pass the dot description to the @file{dot} program (from
the graphviz suite of programs) and obtain a graphical representation
of the filtergraph.
For example the sequence of commands:
@example
echo @var{GRAPH_DESCRIPTION} | \
tools/graph2dot -o graph.tmp && \
dot -Tpng graph.tmp -o graph.png && \
display graph.png
@end example
can be used to create and display an image representing the graph
described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
a complete self-contained graph, with its inputs and outputs explicitly defined.
For example if your command line is of the form:
@example
ffmpeg -i infile -vf scale=640:360 outfile
@end example
your @var{GRAPH_DESCRIPTION} string will need to be of the form:
@example
nullsrc,scale=640:360,nullsink
@end example
you may also need to set the @var{nullsrc} parameters and add a @var{format}
filter in order to simulate a specific input file.
@c man end GRAPH2DOT
@chapter Filtergraph description
@c man begin FILTERGRAPH DESCRIPTION
A filtergraph is a directed graph of connected filters. It can contain
cycles, and there can be multiple links between a pair of
filters. Each link has one input pad on one side connecting it to one
filter from which it takes its input, and one output pad on the other
side connecting it to one filter accepting its output.
Each filter in a filtergraph is an instance of a filter class
registered in the application, which defines the features and the
number of input and output pads of the filter.
A filter with no input pads is called a "source", and a filter with no
output pads is called a "sink".
@anchor{Filtergraph syntax}
@section Filtergraph syntax
A filtergraph has a textual representation, which is recognized by the
@option{-filter}/@option{-vf}/@option{-af} and
@option{-filter_complex} options in @command{ffmpeg} and
@option{-vf}/@option{-af} in @command{ffplay}, and by the
@code{avfilter_graph_parse_ptr()} function defined in
@file{libavfilter/avfilter.h}.
A filterchain consists of a sequence of connected filters, each one
connected to the previous one in the sequence. A filterchain is
represented by a list of ","-separated filter descriptions.
A filtergraph consists of a sequence of filterchains. A sequence of
filterchains is represented by a list of ";"-separated filterchain
descriptions.
A filter is represented by a string of the form:
[@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
@var{filter_name} is the name of the filter class of which the
described filter is an instance of, and has to be the name of one of
the filter classes registered in the program optionally followed by "@@@var{id}".
The name of the filter class is optionally followed by a string
"=@var{arguments}".
@var{arguments} is a string which contains the parameters used to
initialize the filter instance. It may have one of two forms:
@itemize
@item
A ':'-separated list of @var{key=value} pairs.
@item
A ':'-separated list of @var{value}. In this case, the keys are assumed to be
the option names in the order they are declared. E.g. the @code{fade} filter
declares three options in this order -- @option{type}, @option{start_frame} and
@option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
@var{in} is assigned to the option @option{type}, @var{0} to
@option{start_frame} and @var{30} to @option{nb_frames}.
@item
A ':'-separated list of mixed direct @var{value} and long @var{key=value}
pairs. The direct @var{value} must precede the @var{key=value} pairs, and
follow the same constraints order of the previous point. The following
@var{key=value} pairs can be set in any preferred order.
@end itemize
If the option value itself is a list of items (e.g. the @code{format} filter
takes a list of pixel formats), the items in the list are usually separated by
@samp{|}.
The list of arguments can be quoted using the character @samp{'} as initial
and ending mark, and the character @samp{\} for escaping the characters
within the quoted text; otherwise the argument string is considered
terminated when the next special character (belonging to the set
@samp{[]=;,}) is encountered.
The name and arguments of the filter are optionally preceded and
followed by a list of link labels.
A link label allows one to name a link and associate it to a filter output
or input pad. The preceding labels @var{in_link_1}
... @var{in_link_N}, are associated to the filter input pads,
the following labels @var{out_link_1} ... @var{out_link_M}, are
associated to the output pads.
When two link labels with the same name are found in the
filtergraph, a link between the corresponding input and output pad is
created.
If an output pad is not labelled, it is linked by default to the first
unlabelled input pad of the next filter in the filterchain.
For example in the filterchain
@example
nullsrc, split[L1], [L2]overlay, nullsink
@end example
the split filter instance has two output pads, and the overlay filter
instance two input pads. The first output pad of split is labelled
"L1", the first input pad of overlay is labelled "L2", and the second
output pad of split is linked to the second input pad of overlay,
which are both unlabelled.
In a filter description, if the input label of the first filter is not
specified, "in" is assumed; if the output label of the last filter is not
specified, "out" is assumed.
In a complete filterchain all the unlabelled filter input and output
pads must be connected. A filtergraph is considered valid if all the
filter input and output pads of all the filterchains are connected.
Libavfilter will automatically insert @ref{scale} filters where format
conversion is required. It is possible to specify swscale flags
for those automatically inserted scalers by prepending
@code{sws_flags=@var{flags};}
to the filtergraph description.
Here is a BNF description of the filtergraph syntax:
@example
@var{NAME} ::= sequence of alphanumeric characters and '_'
@var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
@var{LINKLABEL} ::= "[" @var{NAME} "]"
@var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
@var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
@var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
@var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
@var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
@end example
@anchor{filtergraph escaping}
@section Notes on filtergraph escaping
Filtergraph description composition entails several levels of
escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
information about the employed escaping procedure.
A first level escaping affects the content of each filter option
value, which may contain the special character @code{:} used to
separate values, or one of the escaping characters @code{\'}.
A second level escaping affects the whole filter description, which
may contain the escaping characters @code{\'} or the special
characters @code{[],;} used by the filtergraph description.
Finally, when you specify a filtergraph on a shell commandline, you
need to perform a third level escaping for the shell special
characters contained within it.
For example, consider the following string to be embedded in
the @ref{drawtext} filter description @option{text} value:
@example
this is a 'string': may contain one, or more, special characters
@end example
This string contains the @code{'} special escaping character, and the
@code{:} special character, so it needs to be escaped in this way:
@example
text=this is a \'string\'\: may contain one, or more, special characters
@end example
A second level of escaping is required when embedding the filter
description in a filtergraph description, in order to escape all the
filtergraph special characters. Thus the example above becomes:
@example
drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
@end example
(note that in addition to the @code{\'} escaping special characters,
also @code{,} needs to be escaped).
Finally an additional level of escaping is needed when writing the
filtergraph description in a shell command, which depends on the
escaping rules of the adopted shell. For example, assuming that
@code{\} is special and needs to be escaped with another @code{\}, the
previous string will finally result in:
@example
-vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
@end example
@chapter Timeline editing
Some filters support a generic @option{enable} option. For the filters
supporting timeline editing, this option can be set to an expression which is
evaluated before sending a frame to the filter. If the evaluation is non-zero,
the filter will be enabled, otherwise the frame will be sent unchanged to the
next filter in the filtergraph.
The expression accepts the following values:
@table @samp
@item t
timestamp expressed in seconds, NAN if the input timestamp is unknown
@item n
sequential number of the input frame, starting from 0
@item pos
the position in the file of the input frame, NAN if unknown
@item w
@item h
width and height of the input frame if video
@end table
Additionally, these filters support an @option{enable} command that can be used
to re-define the expression.
Like any other filtering option, the @option{enable} option follows the same
rules.
For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
minutes, and a @ref{curves} filter starting at 3 seconds:
@example
smartblur = enable='between(t,10,3*60)',
curves = enable='gte(t,3)' : preset=cross_process
@end example
See @code{ffmpeg -filters} to view which filters have timeline support.
@c man end FILTERGRAPH DESCRIPTION
@anchor{commands}
@chapter Changing options at runtime with a command
Some options can be changed during the operation of the filter using
a command. These options are marked 'T' on the output of
@command{ffmpeg} @option{-h filter=<name of filter>}.
The name of the command is the name of the option and the argument is
the new value.
@anchor{framesync}
@chapter Options for filters with several inputs (framesync)
@c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
Some filters with several inputs support a common set of options.
These options can only be set by name, not with the short notation.
@table @option
@item eof_action
The action to take when EOF is encountered on the secondary input; it accepts
one of the following values:
@table @option
@item repeat
Repeat the last frame (the default).
@item endall
End both streams.
@item pass
Pass the main input through.
@end table
@item shortest
If set to 1, force the output to terminate when the shortest input
terminates. Default value is 0.
@item repeatlast
If set to 1, force the filter to extend the last frame of secondary streams
until the end of the primary stream. A value of 0 disables this behavior.
Default value is 1.
@end table
@c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
@chapter Audio Filters
@c man begin AUDIO FILTERS
When you configure your FFmpeg build, you can disable any of the
existing filters using @code{--disable-filters}.
The configure output will show the audio filters included in your
build.
Below is a description of the currently available audio filters.
@section acompressor
A compressor is mainly used to reduce the dynamic range of a signal.
Especially modern music is mostly compressed at a high ratio to
improve the overall loudness. It's done to get the highest attention
of a listener, "fatten" the sound and bring more "power" to the track.
If a signal is compressed too much it may sound dull or "dead"
afterwards or it may start to "pump" (which could be a powerful effect
but can also destroy a track completely).
The right compression is the key to reach a professional sound and is
the high art of mixing and mastering. Because of its complex settings
it may take a long time to get the right feeling for this kind of effect.
Compression is done by detecting the volume above a chosen level
@code{threshold} and dividing it by the factor set with @code{ratio}.
So if you set the threshold to -12dB and your signal reaches -6dB a ratio
of 2:1 will result in a signal at -9dB. Because an exact manipulation of
the signal would cause distortion of the waveform the reduction can be
levelled over the time. This is done by setting "Attack" and "Release".
@code{attack} determines how long the signal has to rise above the threshold
before any reduction will occur and @code{release} sets the time the signal
has to fall below the threshold to reduce the reduction again. Shorter signals
than the chosen attack time will be left untouched.
The overall reduction of the signal can be made up afterwards with the
@code{makeup} setting. So compressing the peaks of a signal about 6dB and
raising the makeup to this level results in a signal twice as loud than the
source. To gain a softer entry in the compression the @code{knee} flattens the
hard edge at the threshold in the range of the chosen decibels.
The filter accepts the following options:
@table @option
@item level_in
Set input gain. Default is 1. Range is between 0.015625 and 64.
@item mode
Set mode of compressor operation. Can be @code{upward} or @code{downward}.
Default is @code{downward}.
@item threshold
If a signal of stream rises above this level it will affect the gain
reduction.
By default it is 0.125. Range is between 0.00097563 and 1.
@item ratio
Set a ratio by which the signal is reduced. 1:2 means that if the level
rose 4dB above the threshold, it will be only 2dB above after the reduction.
Default is 2. Range is between 1 and 20.
@item attack
Amount of milliseconds the signal has to rise above the threshold before gain
reduction starts. Default is 20. Range is between 0.01 and 2000.
@item release
Amount of milliseconds the signal has to fall below the threshold before
reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
@item makeup
Set the amount by how much signal will be amplified after processing.
Default is 1. Range is from 1 to 64.
@item knee
Curve the sharp knee around the threshold to enter gain reduction more softly.
Default is 2.82843. Range is between 1 and 8.
@item link
Choose if the @code{average} level between all channels of input stream
or the louder(@code{maximum}) channel of input stream affects the
reduction. Default is @code{average}.
@item detection
Should the exact signal be taken in case of @code{peak} or an RMS one in case
of @code{rms}. Default is @code{rms} which is mostly smoother.
@item mix
How much to use compressed signal in output. Default is 1.
Range is between 0 and 1.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section acontrast
Simple audio dynamic range compression/expansion filter.
The filter accepts the following options:
@table @option
@item contrast
Set contrast. Default is 33. Allowed range is between 0 and 100.
@end table
@section acopy
Copy the input audio source unchanged to the output. This is mainly useful for
testing purposes.
@section acrossfade
Apply cross fade from one input audio stream to another input audio stream.
The cross fade is applied for specified duration near the end of first stream.
The filter accepts the following options:
@table @option
@item nb_samples, ns
Specify the number of samples for which the cross fade effect has to last.
At the end of the cross fade effect the first input audio will be completely
silent. Default is 44100.
@item duration, d
Specify the duration of the cross fade effect. See
@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
for the accepted syntax.
By default the duration is determined by @var{nb_samples}.
If set this option is used instead of @var{nb_samples}.
@item overlap, o
Should first stream end overlap with second stream start. Default is enabled.
@item curve1
Set curve for cross fade transition for first stream.
@item curve2
Set curve for cross fade transition for second stream.
For description of available curve types see @ref{afade} filter description.
@end table
@subsection Examples
@itemize
@item
Cross fade from one input to another:
@example
ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
@end example
@item
Cross fade from one input to another but without overlapping:
@example
ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
@end example
@end itemize
@section acrossover
Split audio stream into several bands.
This filter splits audio stream into two or more frequency ranges.
Summing all streams back will give flat output.
The filter accepts the following options:
@table @option
@item split
Set split frequencies. Those must be positive and increasing.
@item order
Set filter order for each band split. This controls filter roll-off or steepness
of filter transfer function.
Available values are:
@table @samp
@item 2nd
12 dB per octave.
@item 4th
24 dB per octave.
@item 6th
36 dB per octave.
@item 8th
48 dB per octave.
@item 10th
60 dB per octave.
@item 12th
72 dB per octave.
@item 14th
84 dB per octave.
@item 16th
96 dB per octave.
@item 18th
108 dB per octave.
@item 20th
120 dB per octave.
@end table
Default is @var{4th}.
@item level
Set input gain level. Allowed range is from 0 to 1. Default value is 1.
@item gains
Set output gain for each band. Default value is 1 for all bands.
@end table
@subsection Examples
@itemize
@item
Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
each band will be in separate stream:
@example
ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
@end example
@item
Same as above, but with higher filter order:
@example
ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
@end example
@item
Same as above, but also with additional middle band (frequencies between 1500 and 8000):
@example
ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
@end example
@end itemize
@section acrusher
Reduce audio bit resolution.
This filter is bit crusher with enhanced functionality. A bit crusher
is used to audibly reduce number of bits an audio signal is sampled
with. This doesn't change the bit depth at all, it just produces the
effect. Material reduced in bit depth sounds more harsh and "digital".
This filter is able to even round to continuous values instead of discrete
bit depths.
Additionally it has a D/C offset which results in different crushing of
the lower and the upper half of the signal.
An Anti-Aliasing setting is able to produce "softer" crushing sounds.
Another feature of this filter is the logarithmic mode.
This setting switches from linear distances between bits to logarithmic ones.
The result is a much more "natural" sounding crusher which doesn't gate low
signals for example. The human ear has a logarithmic perception,
so this kind of crushing is much more pleasant.
Logarithmic crushing is also able to get anti-aliased.
The filter accepts the following options:
@table @option
@item level_in
Set level in.
@item level_out
Set level out.
@item bits
Set bit reduction.
@item mix
Set mixing amount.
@item mode
Can be linear: @code{lin} or logarithmic: @code{log}.
@item dc
Set DC.
@item aa
Set anti-aliasing.
@item samples
Set sample reduction.
@item lfo
Enable LFO. By default disabled.
@item lforange
Set LFO range.
@item lforate
Set LFO rate.
@end table
@section acue
Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
filter.
@section adeclick
Remove impulsive noise from input audio.
Samples detected as impulsive noise are replaced by interpolated samples using
autoregressive modelling.
@table @option
@item w
Set window size, in milliseconds. Allowed range is from @code{10} to
@code{100}. Default value is @code{55} milliseconds.
This sets size of window which will be processed at once.
@item o
Set window overlap, in percentage of window size. Allowed range is from
@code{50} to @code{95}. Default value is @code{75} percent.
Setting this to a very high value increases impulsive noise removal but makes
whole process much slower.
@item a
Set autoregression order, in percentage of window size. Allowed range is from
@code{0} to @code{25}. Default value is @code{2} percent. This option also
controls quality of interpolated samples using neighbour good samples.
@item t
Set threshold value. Allowed range is from @code{1} to @code{100}.
Default value is @code{2}.
This controls the strength of impulsive noise which is going to be removed.
The lower value, the more samples will be detected as impulsive noise.
@item b
Set burst fusion, in percentage of window size. Allowed range is @code{0} to
@code{10}. Default value is @code{2}.
If any two samples detected as noise are spaced less than this value then any
sample between those two samples will be also detected as noise.
@item m
Set overlap method.
It accepts the following values:
@table @option
@item a
Select overlap-add method. Even not interpolated samples are slightly
changed with this method.
@item s
Select overlap-save method. Not interpolated samples remain unchanged.
@end table
Default value is @code{a}.
@end table
@section adeclip
Remove clipped samples from input audio.
Samples detected as clipped are replaced by interpolated samples using
autoregressive modelling.
@table @option
@item w
Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
Default value is @code{55} milliseconds.
This sets size of window which will be processed at once.
@item o
Set window overlap, in percentage of window size. Allowed range is from @code{50}
to @code{95}. Default value is @code{75} percent.
@item a
Set autoregression order, in percentage of window size. Allowed range is from
@code{0} to @code{25}. Default value is @code{8} percent. This option also controls
quality of interpolated samples using neighbour good samples.
@item t
Set threshold value. Allowed range is from @code{1} to @code{100}.
Default value is @code{10}. Higher values make clip detection less aggressive.
@item n
Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
Default value is @code{1000}. Higher values make clip detection less aggressive.
@item m
Set overlap method.
It accepts the following values:
@table @option
@item a
Select overlap-add method. Even not interpolated samples are slightly changed
with this method.
@item s
Select overlap-save method. Not interpolated samples remain unchanged.
@end table
Default value is @code{a}.
@end table
@section adelay
Delay one or more audio channels.
Samples in delayed channel are filled with silence.
The filter accepts the following option:
@table @option
@item delays
Set list of delays in milliseconds for each channel separated by '|'.
Unused delays will be silently ignored. If number of given delays is
smaller than number of channels all remaining channels will not be delayed.
If you want to delay exact number of samples, append 'S' to number.
If you want instead to delay in seconds, append 's' to number.
@item all
Use last set delay for all remaining channels. By default is disabled.
This option if enabled changes how option @code{delays} is interpreted.
@end table
@subsection Examples
@itemize
@item
Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
the second channel (and any other channels that may be present) unchanged.
@example
adelay=1500|0|500
@end example
@item
Delay second channel by 500 samples, the third channel by 700 samples and leave
the first channel (and any other channels that may be present) unchanged.
@example
adelay=0|500S|700S
@end example
@item
Delay all channels by same number of samples:
@example
adelay=delays=64S:all=1
@end example
@end itemize
@section adenorm
Remedy denormals in audio by adding extremely low-level noise.
This filter shall be placed before any filter that can produce denormals.
A description of the accepted parameters follows.
@table @option
@item level
Set level of added noise in dB. Default is @code{-351}.
Allowed range is from -451 to -90.
@item type
Set type of added noise.
@table @option
@item dc
Add DC signal.
@item ac
Add AC signal.
@item square
Add square signal.
@item pulse
Add pulse signal.
@end table
Default is @code{dc}.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section aderivative, aintegral
Compute derivative/integral of audio stream.
Applying both filters one after another produces original audio.
@section aecho
Apply echoing to the input audio.
Echoes are reflected sound and can occur naturally amongst mountains
(and sometimes large buildings) when talking or shouting; digital echo
effects emulate this behaviour and are often used to help fill out the
sound of a single instrument or vocal. The time difference between the
original signal and the reflection is the @code{delay}, and the
loudness of the reflected signal is the @code{decay}.
Multiple echoes can have different delays and decays.
A description of the accepted parameters follows.
@table @option
@item in_gain
Set input gain of reflected signal. Default is @code{0.6}.
@item out_gain
Set output gain of reflected signal. Default is @code{0.3}.
@item delays
Set list of time intervals in milliseconds between original signal and reflections
separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
Default is @code{1000}.
@item decays
Set list of loudness of reflected signals separated by '|'.
Allowed range for each @code{decay} is @code{(0 - 1.0]}.
Default is @code{0.5}.
@end table
@subsection Examples
@itemize
@item
Make it sound as if there are twice as many instruments as are actually playing:
@example
aecho=0.8:0.88:60:0.4
@end example
@item
If delay is very short, then it sounds like a (metallic) robot playing music:
@example
aecho=0.8:0.88:6:0.4
@end example
@item
A longer delay will sound like an open air concert in the mountains:
@example
aecho=0.8:0.9:1000:0.3
@end example
@item
Same as above but with one more mountain:
@example
aecho=0.8:0.9:1000|1800:0.3|0.25
@end example
@end itemize
@section aemphasis
Audio emphasis filter creates or restores material directly taken from LPs or
emphased CDs with different filter curves. E.g. to store music on vinyl the
signal has to be altered by a filter first to even out the disadvantages of
this recording medium.
Once the material is played back the inverse filter has to be applied to
restore the distortion of the frequency response.
The filter accepts the following options:
@table @option
@item level_in
Set input gain.
@item level_out
Set output gain.
@item mode
Set filter mode. For restoring material use @code{reproduction} mode, otherwise
use @code{production} mode. Default is @code{reproduction} mode.
@item type
Set filter type. Selects medium. Can be one of the following:
@table @option
@item col
select Columbia.
@item emi
select EMI.
@item bsi
select BSI (78RPM).
@item riaa
select RIAA.
@item cd
select Compact Disc (CD).
@item 50fm
select 50µs (FM).
@item 75fm
select 75µs (FM).
@item 50kf
select 50µs (FM-KF).
@item 75kf
select 75µs (FM-KF).
@end table
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section aeval
Modify an audio signal according to the specified expressions.
This filter accepts one or more expressions (one for each channel),
which are evaluated and used to modify a corresponding audio signal.
It accepts the following parameters:
@table @option
@item exprs
Set the '|'-separated expressions list for each separate channel. If
the number of input channels is greater than the number of
expressions, the last specified expression is used for the remaining
output channels.
@item channel_layout, c
Set output channel layout. If not specified, the channel layout is
specified by the number of expressions. If set to @samp{same}, it will
use by default the same input channel layout.
@end table
Each expression in @var{exprs} can contain the following constants and functions:
@table @option
@item ch
channel number of the current expression
@item n
number of the evaluated sample, starting from 0
@item s
sample rate
@item t
time of the evaluated sample expressed in seconds
@item nb_in_channels
@item nb_out_channels
input and output number of channels
@item val(CH)
the value of input channel with number @var{CH}
@end table
Note: this filter is slow. For faster processing you should use a
dedicated filter.
@subsection Examples
@itemize
@item
Half volume:
@example
aeval=val(ch)/2:c=same
@end example
@item
Invert phase of the second channel:
@example
aeval=val(0)|-val(1)
@end example
@end itemize
@anchor{afade}
@section afade
Apply fade-in/out effect to input audio.
A description of the accepted parameters follows.
@table @option
@item type, t
Specify the effect type, can be either @code{in} for fade-in, or
@code{out} for a fade-out effect. Default is @code{in}.
@item start_sample, ss
Specify the number of the start sample for starting to apply the fade
effect. Default is 0.
@item nb_samples, ns
Specify the number of samples for which the fade effect has to last. At
the end of the fade-in effect the output audio will have the same
volume as the input audio, at the end of the fade-out transition
the output audio will be silence. Default is 44100.
@item start_time, st
Specify the start time of the fade effect. Default is 0.
The value must be specified as a time duration; see
@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
for the accepted syntax.
If set this option is used instead of @var{start_sample}.
@item duration, d
Specify the duration of the fade effect. See
@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
for the accepted syntax.
At the end of the fade-in effect the output audio will have the same
volume as the input audio, at the end of the fade-out transition
the output audio will be silence.
By default the duration is determined by @var{nb_samples}.
If set this option is used instead of @var{nb_samples}.
@item curve
Set curve for fade transition.
It accepts the following values:
@table @option
@item tri
select triangular, linear slope (default)
@item qsin
select quarter of sine wave
@item hsin
select half of sine wave
@item esin
select exponential sine wave
@item log
select logarithmic
@item ipar
select inverted parabola
@item qua
select quadratic
@item cub
select cubic
@item squ
select square root
@item cbr
select cubic root
@item par
select parabola
@item exp
select exponential
@item iqsin
select inverted quarter of sine wave
@item ihsin
select inverted half of sine wave
@item dese
select double-exponential seat
@item desi
select double-exponential sigmoid
@item losi
select logistic sigmoid
@item sinc
select sine cardinal function
@item isinc
select inverted sine cardinal function
@item nofade
no fade applied
@end table
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@subsection Examples
@itemize
@item
Fade in first 15 seconds of audio:
@example
afade=t=in:ss=0:d=15
@end example
@item
Fade out last 25 seconds of a 900 seconds audio:
@example
afade=t=out:st=875:d=25
@end example
@end itemize
@section afftdn
Denoise audio samples with FFT.
A description of the accepted parameters follows.
@table @option
@item nr
Set the noise reduction in dB, allowed range is 0.01 to 97.
Default value is 12 dB.
@item nf
Set the noise floor in dB, allowed range is -80 to -20.
Default value is -50 dB.
@item nt
Set the noise type.
It accepts the following values:
@table @option
@item w
Select white noise.
@item v
Select vinyl noise.
@item s
Select shellac noise.
@item c
Select custom noise, defined in @code{bn} option.
Default value is white noise.
@end table
@item bn
Set custom band noise for every one of 15 bands.
Bands are separated by ' ' or '|'.
@item rf
Set the residual floor in dB, allowed range is -80 to -20.
Default value is -38 dB.
@item tn
Enable noise tracking. By default is disabled.
With this enabled, noise floor is automatically adjusted.
@item tr
Enable residual tracking. By default is disabled.
@item om
Set the output mode.
It accepts the following values:
@table @option
@item i
Pass input unchanged.
@item o
Pass noise filtered out.
@item n
Pass only noise.
Default value is @var{o}.
@end table
@end table
@subsection Commands
This filter supports the following commands:
@table @option
@item sample_noise, sn
Start or stop measuring noise profile.
Syntax for the command is : "start" or "stop" string.
After measuring noise profile is stopped it will be
automatically applied in filtering.
@item noise_reduction, nr
Change noise reduction. Argument is single float number.
Syntax for the command is : "@var{noise_reduction}"
@item noise_floor, nf
Change noise floor. Argument is single float number.
Syntax for the command is : "@var{noise_floor}"
@item output_mode, om
Change output mode operation.
Syntax for the command is : "i", "o" or "n" string.
@end table
@section afftfilt
Apply arbitrary expressions to samples in frequency domain.
@table @option
@item real
Set frequency domain real expression for each separate channel separated
by '|'. Default is "re".
If the number of input channels is greater than the number of
expressions, the last specified expression is used for the remaining
output channels.
@item imag
Set frequency domain imaginary expression for each separate channel
separated by '|'. Default is "im".
Each expression in @var{real} and @var{imag} can contain the following
constants and functions:
@table @option
@item sr
sample rate
@item b
current frequency bin number
@item nb
number of available bins
@item ch
channel number of the current expression
@item chs
number of channels
@item pts
current frame pts
@item re
current real part of frequency bin of current channel
@item im
current imaginary part of frequency bin of current channel
@item real(b, ch)
Return the value of real part of frequency bin at location (@var{bin},@var{channel})
@item imag(b, ch)
Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
@end table
@item win_size
Set window size. Allowed range is from 16 to 131072.
Default is @code{4096}
@item win_func
Set window function. Default is @code{hann}.
@item overlap
Set window overlap. If set to 1, the recommended overlap for selected
window function will be picked. Default is @code{0.75}.
@end table
@subsection Examples
@itemize
@item
Leave almost only low frequencies in audio:
@example
afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
@end example
@item
Apply robotize effect:
@example
afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
@end example
@item
Apply whisper effect:
@example
afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
@end example
@end itemize
@anchor{afir}
@section afir
Apply an arbitrary Finite Impulse Response filter.
This filter is designed for applying long FIR filters,
up to 60 seconds long.
It can be used as component for digital crossover filters,
room equalization, cross talk cancellation, wavefield synthesis,
auralization, ambiophonics, ambisonics and spatialization.
This filter uses the streams higher than first one as FIR coefficients.
If the non-first stream holds a single channel, it will be used
for all input channels in the first stream, otherwise
the number of channels in the non-first stream must be same as
the number of channels in the first stream.
It accepts the following parameters:
@table @option
@item dry
Set dry gain. This sets input gain.
@item wet
Set wet gain. This sets final output gain.
@item length
Set Impulse Response filter length. Default is 1, which means whole IR is processed.
@item gtype
Enable applying gain measured from power of IR.
Set which approach to use for auto gain measurement.
@table @option
@item none
Do not apply any gain.
@item peak
select peak gain, very conservative approach. This is default value.
@item dc
select DC gain, limited application.
@item gn
select gain to noise approach, this is most popular one.
@end table
@item irgain
Set gain to be applied to IR coefficients before filtering.
Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
@item irfmt
Set format of IR stream. Can be @code{mono} or @code{input}.
Default is @code{input}.
@item maxir
Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
Allowed range is 0.1 to 60 seconds.
@item response
Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
By default it is disabled.
@item channel
Set for which IR channel to display frequency response. By default is first channel
displayed. This option is used only when @var{response} is enabled.
@item size
Set video stream size. This option is used only when @var{response} is enabled.
@item rate
Set video stream frame rate. This option is used only when @var{response} is enabled.
@item minp
Set minimal partition size used for convolution. Default is @var{8192}.
Allowed range is from @var{1} to @var{32768}.
Lower values decreases latency at cost of higher CPU usage.
@item maxp
Set maximal partition size used for convolution. Default is @var{8192}.
Allowed range is from @var{8} to @var{32768}.
Lower values may increase CPU usage.
@item nbirs
Set number of input impulse responses streams which will be switchable at runtime.
Allowed range is from @var{1} to @var{32}. Default is @var{1}.
@item ir
Set IR stream which will be used for convolution, starting from @var{0}, should always be
lower than supplied value by @code{nbirs} option. Default is @var{0}.
This option can be changed at runtime via @ref{commands}.
@end table
@subsection Examples
@itemize
@item
Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
@example
ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
@end example
@end itemize
@anchor{aformat}
@section aformat
Set output format constraints for the input audio. The framework will
negotiate the most appropriate format to minimize conversions.
It accepts the following parameters:
@table @option
@item sample_fmts, f
A '|'-separated list of requested sample formats.
@item sample_rates, r
A '|'-separated list of requested sample rates.
@item channel_layouts, cl
A '|'-separated list of requested channel layouts.
See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
for the required syntax.
@end table
If a parameter is omitted, all values are allowed.
Force the output to either unsigned 8-bit or signed 16-bit stereo
@example
aformat=sample_fmts=u8|s16:channel_layouts=stereo
@end example
@section afreqshift
Apply frequency shift to input audio samples.
The filter accepts the following options:
@table @option
@item shift
Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
Default value is 0.0.
@item level
Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
Default value is 1.0.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section agate
A gate is mainly used to reduce lower parts of a signal. This kind of signal
processing reduces disturbing noise between useful signals.
Gating is done by detecting the volume below a chosen level @var{threshold}
and dividing it by the factor set with @var{ratio}. The bottom of the noise
floor is set via @var{range}. Because an exact manipulation of the signal
would cause distortion of the waveform the reduction can be levelled over
time. This is done by setting @var{attack} and @var{release}.
@var{attack} determines how long the signal has to fall below the threshold
before any reduction will occur and @var{release} sets the time the signal
has to rise above the threshold to reduce the reduction again.
Shorter signals than the chosen attack time will be left untouched.
@table @option
@item level_in
Set input level before filtering.
Default is 1. Allowed range is from 0.015625 to 64.
@item mode
Set the mode of operation. Can be @code{upward} or @code{downward}.
Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
will be amplified, expanding dynamic range in upward direction.
Otherwise, in case of @code{downward} lower parts of signal will be reduced.
@item range
Set the level of gain reduction when the signal is below the threshold.
Default is 0.06125. Allowed range is from 0 to 1.
Setting this to 0 disables reduction and then filter behaves like expander.
@item threshold
If a signal rises above this level the gain reduction is released.
Default is 0.125. Allowed range is from 0 to 1.
@item ratio
Set a ratio by which the signal is reduced.
Default is 2. Allowed range is from 1 to 9000.
@item attack
Amount of milliseconds the signal has to rise above the threshold before gain
reduction stops.
Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
@item release
Amount of milliseconds the signal has to fall below the threshold before the
reduction is increased again. Default is 250 milliseconds.
Allowed range is from 0.01 to 9000.
@item makeup
Set amount of amplification of signal after processing.
Default is 1. Allowed range is from 1 to 64.
@item knee
Curve the sharp knee around the threshold to enter gain reduction more softly.
Default is 2.828427125. Allowed range is from 1 to 8.
@item detection
Choose if exact signal should be taken for detection or an RMS like one.
Default is @code{rms}. Can be @code{peak} or @code{rms}.
@item link
Choose if the average level between all channels or the louder channel affects
the reduction.
Default is @code{average}. Can be @code{average} or @code{maximum}.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section aiir
Apply an arbitrary Infinite Impulse Response filter.
It accepts the following parameters:
@table @option
@item zeros, z
Set B/numerator/zeros/reflection coefficients.
@item poles, p
Set A/denominator/poles/ladder coefficients.
@item gains, k
Set channels gains.
@item dry_gain
Set input gain.
@item wet_gain
Set output gain.
@item format, f
Set coefficients format.
@table @samp
@item ll
lattice-ladder function
@item sf
analog transfer function
@item tf
digital transfer function
@item zp
Z-plane zeros/poles, cartesian (default)
@item pr
Z-plane zeros/poles, polar radians
@item pd
Z-plane zeros/poles, polar degrees
@item sp
S-plane zeros/poles
@end table
@item process, r
Set type of processing.
@table @samp
@item d
direct processing
@item s
serial processing
@item p
parallel processing
@end table
@item precision, e
Set filtering precision.
@table @samp
@item dbl
double-precision floating-point (default)
@item flt
single-precision floating-point
@item i32
32-bit integers
@item i16
16-bit integers
@end table
@item normalize, n
Normalize filter coefficients, by default is enabled.
Enabling it will normalize magnitude response at DC to 0dB.
@item mix
How much to use filtered signal in output. Default is 1.
Range is between 0 and 1.
@item response
Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
By default it is disabled.
@item channel
Set for which IR channel to display frequency response. By default is first channel
displayed. This option is used only when @var{response} is enabled.
@item size
Set video stream size. This option is used only when @var{response} is enabled.
@end table
Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
order.
Coefficients in @code{zp} format are separated by spaces and order of coefficients
doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
imaginary unit.
Different coefficients and gains can be provided for every channel, in such case
use '|' to separate coefficients or gains. Last provided coefficients will be
used for all remaining channels.
@subsection Examples
@itemize
@item
Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
@example
aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
@end example
@item
Same as above but in @code{zp} format:
@example
aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
@end example
@item
Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
@example
aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
@end example
@end itemize
@section alimiter
The limiter prevents an input signal from rising over a desired threshold.
This limiter uses lookahead technology to prevent your signal from distorting.
It means that there is a small delay after the signal is processed. Keep in mind
that the delay it produces is the attack time you set.
The filter accepts the following options:
@table @option
@item level_in
Set input gain. Default is 1.
@item level_out
Set output gain. Default is 1.
@item limit
Don't let signals above this level pass the limiter. Default is 1.
@item attack
The limiter will reach its attenuation level in this amount of time in
milliseconds. Default is 5 milliseconds.
@item release
Come back from limiting to attenuation 1.0 in this amount of milliseconds.
Default is 50 milliseconds.
@item asc
When gain reduction is always needed ASC takes care of releasing to an
average reduction level rather than reaching a reduction of 0 in the release
time.
@item asc_level
Select how much the release time is affected by ASC, 0 means nearly no changes
in release time while 1 produces higher release times.
@item level
Auto level output signal. Default is enabled.
This normalizes audio back to 0dB if enabled.
@end table
Depending on picked setting it is recommended to upsample input 2x or 4x times
with @ref{aresample} before applying this filter.
@section allpass
Apply a two-pole all-pass filter with central frequency (in Hz)
@var{frequency}, and filter-width @var{width}.
An all-pass filter changes the audio's frequency to phase relationship
without changing its frequency to amplitude relationship.
The filter accepts the following options:
@table @option
@item frequency, f
Set frequency in Hz.
@item width_type, t
Set method to specify band-width of filter.
@table @option
@item h
Hz
@item q
Q-Factor
@item o
octave
@item s
slope
@item k
kHz
@end table
@item width, w
Specify the band-width of a filter in width_type units.
@item mix, m
How much to use filtered signal in output. Default is 1.
Range is between 0 and 1.
@item channels, c
Specify which channels to filter, by default all available are filtered.
@item normalize, n
Normalize biquad coefficients, by default is disabled.
Enabling it will normalize magnitude response at DC to 0dB.
@item order, o
Set the filter order, can be 1 or 2. Default is 2.
@item transform, a
Set transform type of IIR filter.
@table @option
@item di
@item dii
@item tdii
@item latt
@end table
@item precision, r
Set precison of filtering.
@table @option
@item auto
Pick automatic sample format depending on surround filters.
@item s16
Always use signed 16-bit.
@item s32
Always use signed 32-bit.
@item f32
Always use float 32-bit.
@item f64
Always use float 64-bit.
@end table
@end table
@subsection Commands
This filter supports the following commands:
@table @option
@item frequency, f
Change allpass frequency.
Syntax for the command is : "@var{frequency}"
@item width_type, t
Change allpass width_type.
Syntax for the command is : "@var{width_type}"
@item width, w
Change allpass width.
Syntax for the command is : "@var{width}"
@item mix, m
Change allpass mix.
Syntax for the command is : "@var{mix}"
@end table
@section aloop
Loop audio samples.
The filter accepts the following options:
@table @option
@item loop
Set the number of loops. Setting this value to -1 will result in infinite loops.
Default is 0.
@item size
Set maximal number of samples. Default is 0.
@item start
Set first sample of loop. Default is 0.
@end table
@anchor{amerge}
@section amerge
Merge two or more audio streams into a single multi-channel stream.
The filter accepts the following options:
@table @option
@item inputs
Set the number of inputs. Default is 2.
@end table
If the channel layouts of the inputs are disjoint, and therefore compatible,
the channel layout of the output will be set accordingly and the channels
will be reordered as necessary. If the channel layouts of the inputs are not
disjoint, the output will have all the channels of the first input then all
the channels of the second input, in that order, and the channel layout of
the output will be the default value corresponding to the total number of
channels.
For example, if the first input is in 2.1 (FL+FR+LF) and the second input
is FC+BL+BR, then the output will be in 5.1, with the channels in the
following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
first input, b1 is the first channel of the second input).
On the other hand, if both input are in stereo, the output channels will be
in the default order: a1, a2, b1, b2, and the channel layout will be
arbitrarily set to 4.0, which may or may not be the expected value.
All inputs must have the same sample rate, and format.
If inputs do not have the same duration, the output will stop with the
shortest.
@subsection Examples
@itemize
@item
Merge two mono files into a stereo stream:
@example
amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
@end example
@item
Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
@example
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
@end example
@end itemize
@section amix
Mixes multiple audio inputs into a single output.
Note that this filter only supports float samples (the @var{amerge}
and @var{pan} audio filters support many formats). If the @var{amix}
input has integer samples then @ref{aresample} will be automatically
inserted to perform the conversion to float samples.
For example
@example
ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
@end example
will mix 3 input audio streams to a single output with the same duration as the
first input and a dropout transition time of 3 seconds.
It accepts the following parameters:
@table @option
@item inputs
The number of inputs. If unspecified, it defaults to 2.
@item duration
How to determine the end-of-stream.
@table @option
@item longest
The duration of the longest input. (default)
@item shortest
The duration of the shortest input.
@item first
The duration of the first input.
@end table
@item dropout_transition
The transition time, in seconds, for volume renormalization when an input
stream ends. The default value is 2 seconds.
@item weights
Specify weight of each input audio stream as sequence.
Each weight is separated by space. By default all inputs have same weight.
@end table
@subsection Commands
This filter supports the following commands:
@table @option
@item weights
Syntax is same as option with same name.
@end table
@section amultiply
Multiply first audio stream with second audio stream and store result
in output audio stream. Multiplication is done by multiplying each
sample from first stream with sample at same position from second stream.
With this element-wise multiplication one can create amplitude fades and
amplitude modulations.
@section anequalizer
High-order parametric multiband equalizer for each channel.
It accepts the following parameters:
@table @option
@item params
This option string is in format:
"c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
Each equalizer band is separated by '|'.
@table @option
@item chn
Set channel number to which equalization will be applied.
If input doesn't have that channel the entry is ignored.
@item f
Set central frequency for band.
If input doesn't have that frequency the entry is ignored.
@item w
Set band width in Hertz.
@item g
Set band gain in dB.
@item t
Set filter type for band, optional, can be:
@table @samp
@item 0
Butterworth, this is default.
@item 1
Chebyshev type 1.
@item 2
Chebyshev type 2.
@end table
@end table
@item curves
With this option activated frequency response of anequalizer is displayed
in video stream.
@item size
Set video stream size. Only useful if curves option is activated.
@item mgain
Set max gain that will be displayed. Only useful if curves option is activated.
Setting this to a reasonable value makes it possible to display gain which is derived from
neighbour bands which are too close to each other and thus produce higher gain
when both are activated.
@item fscale
Set frequency scale used to draw frequency response in video output.
Can be linear or logarithmic. Default is logarithmic.
@item colors
Set color for each channel curve which is going to be displayed in video stream.
This is list of color names separated by space or by '|'.
Unrecognised or missing colors will be replaced by white color.
@end table
@subsection Examples
@itemize
@item
Lower gain by 10 of central frequency 200Hz and width 100 Hz
for first 2 channels using Chebyshev type 1 filter:
@example
anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
@end example
@end itemize
@subsection Commands
This filter supports the following commands:
@table @option
@item change
Alter existing filter parameters.
Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
@var{fN} is existing filter number, starting from 0, if no such filter is available
error is returned.
@var{freq} set new frequency parameter.
@var{width} set new width parameter in Hertz.
@var{gain} set new gain parameter in dB.
Full filter invocation with asendcmd may look like this:
asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
@end table
@section anlmdn
Reduce broadband noise in audio samples using Non-Local Means algorithm.
Each sample is adjusted by looking for other samples with similar contexts. This
context similarity is defined by comparing their surrounding patches of size
@option{p}. Patches are searched in an area of @option{r} around the sample.
The filter accepts the following options:
@table @option
@item s
Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
@item p
Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
Default value is 2 milliseconds.
@item r
Set research radius duration. Allowed range is from 2 to 300 milliseconds.
Default value is 6 milliseconds.
@item o
Set the output mode.
It accepts the following values:
@table @option
@item i
Pass input unchanged.
@item o
Pass noise filtered out.
@item n
Pass only noise.
Default value is @var{o}.
@end table
@item m
Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section anlms
Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
relate to producing the least mean square of the error signal (difference between the desired,
2nd input audio stream and the actual signal, the 1st input audio stream).
A description of the accepted options follows.
@table @option
@item order
Set filter order.
@item mu
Set filter mu.
@item eps
Set the filter eps.
@item leakage
Set the filter leakage.
@item out_mode
It accepts the following values:
@table @option
@item i
Pass the 1st input.
@item d
Pass the 2nd input.
@item o
Pass filtered samples.
@item n
Pass difference between desired and filtered samples.
Default value is @var{o}.
@end table
@end table
@subsection Examples
@itemize
@item
One of many usages of this filter is noise reduction, input audio is filtered
with same samples that are delayed by fixed amount, one such example for stereo audio is:
@example
asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
@end example
@end itemize
@subsection Commands
This filter supports the same commands as options, excluding option @code{order}.
@section anull
Pass the audio source unchanged to the output.
@section apad
Pad the end of an audio stream with silence.
This can be used together with @command{ffmpeg} @option{-shortest} to
extend audio streams to the same length as the video stream.
A description of the accepted options follows.
@table @option
@item packet_size
Set silence packet size. Default value is 4096.
@item pad_len
Set the number of samples of silence to add to the end. After the
value is reached, the stream is terminated. This option is mutually
exclusive with @option{whole_len}.
@item whole_len
Set the minimum total number of samples in the output audio stream. If
the value is longer than the input audio length, silence is added to
the end, until the value is reached. This option is mutually exclusive
with @option{pad_len}.
@item pad_dur
Specify the duration of samples of silence to add. See
@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
for the accepted syntax. Used only if set to non-zero value.
@item whole_dur
Specify the minimum total duration in the output audio stream. See
@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
for the accepted syntax. Used only if set to non-zero value. If the value is longer than
the input audio length, silence is added to the end, until the value is reached.
This option is mutually exclusive with @option{pad_dur}
@end table
If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
nor @option{whole_dur} option is set, the filter will add silence to the end of
the input stream indefinitely.
@subsection Examples
@itemize
@item
Add 1024 samples of silence to the end of the input:
@example
apad=pad_len=1024
@end example
@item
Make sure the audio output will contain at least 10000 samples, pad
the input with silence if required:
@example
apad=whole_len=10000
@end example
@item
Use @command{ffmpeg} to pad the audio input with silence, so that the
video stream will always result the shortest and will be converted
until the end in the output file when using the @option{shortest}
option:
@example
ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
@end example
@end itemize
@section aphaser
Add a phasing effect to the input audio.
A phaser filter creates series of peaks and troughs in the frequency spectrum.
The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
A description of the accepted parameters follows.
@table @option
@item in_gain
Set input gain. Default is 0.4.
@item out_gain
Set output gain. Default is 0.74
@item delay
Set delay in milliseconds. Default is 3.0.
@item decay
Set decay. Default is 0.4.
@item speed
Set modulation speed in Hz. Default is 0.5.
@item type
Set modulation type. Default is triangular.
It accepts the following values:
@table @samp
@item triangular, t
@item sinusoidal, s
@end table
@end table
@section aphaseshift
Apply phase shift to input audio samples.
The filter accepts the following options:
@table @option
@item shift
Specify phase shift. Allowed range is from -1.0 to 1.0.
Default value is 0.0.
@item level
Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
Default value is 1.0.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section apulsator
Audio pulsator is something between an autopanner and a tremolo.
But it can produce funny stereo effects as well. Pulsator changes the volume
of the left and right channel based on a LFO (low frequency oscillator) with
different waveforms and shifted phases.
This filter have the ability to define an offset between left and right
channel. An offset of 0 means that both LFO shapes match each other.
The left and right channel are altered equally - a conventional tremolo.
An offset of 50% means that the shape of the right channel is exactly shifted
in phase (or moved backwards about half of the frequency) - pulsator acts as
an autopanner. At 1 both curves match again. Every setting in between moves the
phase shift gapless between all stages and produces some "bypassing" sounds with
sine and triangle waveforms. The more you set the offset near 1 (starting from
the 0.5) the faster the signal passes from the left to the right speaker.
The filter accepts the following options:
@table @option
@item level_in
Set input gain. By default it is 1. Range is [0.015625 - 64].
@item level_out
Set output gain. By default it is 1. Range is [0.015625 - 64].
@item mode
Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
sawup or sawdown. Default is sine.
@item amount
Set modulation. Define how much of original signal is affected by the LFO.
@item offset_l
Set left channel offset. Default is 0. Allowed range is [0 - 1].
@item offset_r
Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
@item width
Set pulse width. Default is 1. Allowed range is [0 - 2].
@item timing
Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
@item bpm
Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
is set to bpm.
@item ms
Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
is set to ms.
@item hz
Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
if timing is set to hz.
@end table
@anchor{aresample}
@section aresample
Resample the input audio to the specified parameters, using the
libswresample library. If none are specified then the filter will
automatically convert between its input and output.
This filter is also able to stretch/squeeze the audio data to make it match
the timestamps or to inject silence / cut out audio to make it match the
timestamps, do a combination of both or do neither.
The filter accepts the syntax
[@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
expresses a sample rate and @var{resampler_options} is a list of
@var{key}=@var{value} pairs, separated by ":". See the
@ref{Resampler Options,,"Resampler Options" section in the
ffmpeg-resampler(1) manual,ffmpeg-resampler}
for the complete list of supported options.
@subsection Examples
@itemize
@item
Resample the input audio to 44100Hz:
@example
aresample=44100
@end example
@item
Stretch/squeeze samples to the given timestamps, with a maximum of 1000
samples per second compensation:
@example
aresample=async=1000
@end example
@end itemize
@section areverse
Reverse an audio clip.
Warning: This filter requires memory to buffer the entire clip, so trimming
is suggested.
@subsection Examples
@itemize
@item
Take the first 5 seconds of a clip, and reverse it.
@example
atrim=end=5,areverse
@end example
@end itemize
@section arnndn
Reduce noise from speech using Recurrent Neural Networks.
This filter accepts the following options:
@table @option
@item model, m
Set train model file to load. This option is always required.
@item mix
Set how much to mix filtered samples into final output.
Allowed range is from -1 to 1. Default value is 1.
Negative values are special, they set how much to keep filtered noise
in the final filter output. Set this option to -1 to hear actual
noise removed from input signal.
@end table
@section asetnsamples
Set the number of samples per each output audio frame.
The last output packet may contain a different number of samples, as
the filter will flush all the remaining samples when the input audio
signals its end.
The filter accepts the following options:
@table @option
@item nb_out_samples, n
Set the number of frames per each output audio frame. The number is
intended as the number of samples @emph{per each channel}.
Default value is 1024.
@item pad, p
If set to 1, the filter will pad the last audio frame with zeroes, so
that the last frame will contain the same number of samples as the
previous ones. Default value is 1.
@end table
For example, to set the number of per-frame samples to 1234 and
disable padding for the last frame, use:
@example
asetnsamples=n=1234:p=0
@end example
@section asetrate
Set the sample rate without altering the PCM data.
This will result in a change of speed and pitch.
The filter accepts the following options:
@table @option
@item sample_rate, r
Set the output sample rate. Default is 44100 Hz.
@end table
@section ashowinfo
Show a line containing various information for each input audio frame.
The input audio is not modified.
The shown line contains a sequence of key/value pairs of the form
@var{key}:@var{value}.
The following values are shown in the output:
@table @option
@item n
The (sequential) number of the input frame, starting from 0.
@item pts
The presentation timestamp of the input frame, in time base units; the time base
depends on the filter input pad, and is usually 1/@var{sample_rate}.
@item pts_time
The presentation timestamp of the input frame in seconds.
@item pos
position of the frame in the input stream, -1 if this information in
unavailable and/or meaningless (for example in case of synthetic audio)
@item fmt
The sample format.
@item chlayout
The channel layout.
@item rate
The sample rate for the audio frame.
@item nb_samples
The number of samples (per channel) in the frame.
@item checksum
The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
audio, the data is treated as if all the planes were concatenated.
@item plane_checksums
A list of Adler-32 checksums for each data plane.
@end table
@section asoftclip
Apply audio soft clipping.
Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
along a smooth curve, rather than the abrupt shape of hard-clipping.
This filter accepts the following options:
@table @option
@item type
Set type of soft-clipping.
It accepts the following values:
@table @option
@item hard
@item tanh
@item atan
@item cubic
@item exp
@item alg
@item quintic
@item sin
@item erf
@end table
@item param
Set additional parameter which controls sigmoid function.
@item oversample
Set oversampling factor.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section asr
Automatic Speech Recognition
This filter uses PocketSphinx for speech recognition. To enable
compilation of this filter, you need to configure FFmpeg with
@code{--enable-pocketsphinx}.
It accepts the following options:
@table @option
@item rate
Set sampling rate of input audio. Defaults is @code{16000}.
This need to match speech models, otherwise one will get poor results.
@item hmm
Set dictionary containing acoustic model files.
@item dict
Set pronunciation dictionary.
@item lm
Set language model file.
@item lmctl
Set language model set.
@item lmname
Set which language model to use.
@item logfn
Set output for log messages.
@end table
The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
@anchor{astats}
@section astats
Display time domain statistical information about the audio channels.
Statistics are calculated and displayed for each audio channel and,
where applicable, an overall figure is also given.
It accepts the following option:
@table @option
@item length
Short window length in seconds, used for peak and trough RMS measurement.
Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
@item metadata
Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
disabled.
Available keys for each channel are:
DC_offset
Min_level
Max_level
Min_difference
Max_difference
Mean_difference
RMS_difference
Peak_level
RMS_peak
RMS_trough
Crest_factor
Flat_factor
Peak_count
Noise_floor
Noise_floor_count
Bit_depth
Dynamic_range
Zero_crossings
Zero_crossings_rate
Number_of_NaNs
Number_of_Infs
Number_of_denormals
and for Overall:
DC_offset
Min_level
Max_level
Min_difference
Max_difference
Mean_difference
RMS_difference
Peak_level
RMS_level
RMS_peak
RMS_trough
Flat_factor
Peak_count
Noise_floor
Noise_floor_count
Bit_depth
Number_of_samples
Number_of_NaNs
Number_of_Infs
Number_of_denormals
For example full key look like this @code{lavfi.astats.1.DC_offset} or
this @code{lavfi.astats.Overall.Peak_count}.
For description what each key means read below.
@item reset
Set number of frame after which stats are going to be recalculated.
Default is disabled.
@item measure_perchannel
Select the entries which need to be measured per channel. The metadata keys can
be used as flags, default is @option{all} which measures everything.
@option{none} disables all per channel measurement.
@item measure_overall
Select the entries which need to be measured overall. The metadata keys can
be used as flags, default is @option{all} which measures everything.
@option{none} disables all overall measurement.
@end table
A description of each shown parameter follows:
@table @option
@item DC offset
Mean amplitude displacement from zero.
@item Min level
Minimal sample level.
@item Max level
Maximal sample level.
@item Min difference
Minimal difference between two consecutive samples.
@item Max difference
Maximal difference between two consecutive samples.
@item Mean difference
Mean difference between two consecutive samples.
The average of each difference between two consecutive samples.
@item RMS difference
Root Mean Square difference between two consecutive samples.
@item Peak level dB
@item RMS level dB
Standard peak and RMS level measured in dBFS.
@item RMS peak dB
@item RMS trough dB
Peak and trough values for RMS level measured over a short window.
@item Crest factor
Standard ratio of peak to RMS level (note: not in dB).
@item Flat factor
Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
(i.e. either @var{Min level} or @var{Max level}).
@item Peak count
Number of occasions (not the number of samples) that the signal attained either
@var{Min level} or @var{Max level}.
@item Noise floor dB
Minimum local peak measured in dBFS over a short window.
@item Noise floor count
Number of occasions (not the number of samples) that the signal attained
@var{Noise floor}.
@item Bit depth
Overall bit depth of audio. Number of bits used for each sample.
@item Dynamic range
Measured dynamic range of audio in dB.
@item Zero crossings
Number of points where the waveform crosses the zero level axis.
@item Zero crossings rate
Rate of Zero crossings and number of audio samples.
@end table
@section asubboost
Boost subwoofer frequencies.
The filter accepts the following options:
@table @option
@item dry
Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
Default value is 0.7.
@item wet
Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
Default value is 0.7.
@item decay
Set delay line decay gain value. Allowed range is from 0 to 1.
Default value is 0.7.
@item feedback
Set delay line feedback gain value. Allowed range is from 0 to 1.
Default value is 0.9.
@item cutoff
Set cutoff frequency in Hertz. Allowed range is 50 to 900.
Default value is 100.
@item slope
Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
Default value is 0.5.
@item delay
Set delay. Allowed range is from 1 to 100.
Default value is 20.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section asubcut
Cut subwoofer frequencies.
This filter allows to set custom, steeper
roll off than highpass filter, and thus is able to more attenuate
frequency content in stop-band.
The filter accepts the following options:
@table @option
@item cutoff
Set cutoff frequency in Hertz. Allowed range is 2 to 200.
Default value is 20.
@item order
Set filter order. Available values are from 3 to 20.
Default value is 10.
@item level
Set input gain level. Allowed range is from 0 to 1. Default value is 1.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section asupercut
Cut super frequencies.
The filter accepts the following options:
@table @option
@item cutoff
Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
Default value is 20000.
@item order
Set filter order. Available values are from 3 to 20.
Default value is 10.
@item level
Set input gain level. Allowed range is from 0 to 1. Default value is 1.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section asuperpass
Apply high order Butterworth band-pass filter.
The filter accepts the following options:
@table @option
@item centerf
Set center frequency in Hertz. Allowed range is 2 to 999999.
Default value is 1000.
@item order
Set filter order. Available values are from 4 to 20.
Default value is 4.
@item qfactor
Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
@item level
Set input gain level. Allowed range is from 0 to 2. Default value is 1.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section asuperstop
Apply high order Butterworth band-stop filter.
The filter accepts the following options:
@table @option
@item centerf
Set center frequency in Hertz. Allowed range is 2 to 999999.
Default value is 1000.
@item order
Set filter order. Available values are from 4 to 20.
Default value is 4.
@item qfactor
Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
@item level
Set input gain level. Allowed range is from 0 to 2. Default value is 1.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section atempo
Adjust audio tempo.
The filter accepts exactly one parameter, the audio tempo. If not
specified then the filter will assume nominal 1.0 tempo. Tempo must
be in the [0.5, 100.0] range.
Note that tempo greater than 2 will skip some samples rather than
blend them in. If for any reason this is a concern it is always
possible to daisy-chain several instances of atempo to achieve the
desired product tempo.
@subsection Examples
@itemize
@item
Slow down audio to 80% tempo:
@example
atempo=0.8
@end example
@item
To speed up audio to 300% tempo:
@example
atempo=3
@end example
@item
To speed up audio to 300% tempo by daisy-chaining two atempo instances:
@example
atempo=sqrt(3),atempo=sqrt(3)
@end example
@end itemize
@subsection Commands
This filter supports the following commands:
@table @option
@item tempo
Change filter tempo scale factor.
Syntax for the command is : "@var{tempo}"
@end table
@section atrim
Trim the input so that the output contains one continuous subpart of the input.
It accepts the following parameters:
@table @option
@item start
Timestamp (in seconds) of the start of the section to keep. I.e. the audio
sample with the timestamp @var{start} will be the first sample in the output.
@item end
Specify time of the first audio sample that will be dropped, i.e. the
audio sample immediately preceding the one with the timestamp @var{end} will be
the last sample in the output.
@item start_pts
Same as @var{start}, except this option sets the start timestamp in samples
instead of seconds.
@item end_pts
Same as @var{end}, except this option sets the end timestamp in samples instead
of seconds.
@item duration
The maximum duration of the output in seconds.
@item start_sample
The number of the first sample that should be output.
@item end_sample
The number of the first sample that should be dropped.
@end table
@option{start}, @option{end}, and @option{duration} are expressed as time
duration specifications; see
@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
Note that the first two sets of the start/end options and the @option{duration}
option look at the frame timestamp, while the _sample options simply count the
samples that pass through the filter. So start/end_pts and start/end_sample will
give different results when the timestamps are wrong, inexact or do not start at
zero. Also note that this filter does not modify the timestamps. If you wish
to have the output timestamps start at zero, insert the asetpts filter after the
atrim filter.
If multiple start or end options are set, this filter tries to be greedy and
keep all samples that match at least one of the specified constraints. To keep
only the part that matches all the constraints at once, chain multiple atrim
filters.
The defaults are such that all the input is kept. So it is possible to set e.g.
just the end values to keep everything before the specified time.
Examples:
@itemize
@item
Drop everything except the second minute of input:
@example
ffmpeg -i INPUT -af atrim=60:120
@end example
@item
Keep only the first 1000 samples:
@example
ffmpeg -i INPUT -af atrim=end_sample=1000
@end example
@end itemize
@section axcorrelate
Calculate normalized cross-correlation between two input audio streams.
Resulted samples are always between -1 and 1 inclusive.
If result is 1 it means two input samples are highly correlated in that selected segment.
Result 0 means they are not correlated at all.
If result is -1 it means two input samples are out of phase, which means they cancel each
other.
The filter accepts the following options:
@table @option
@item size
Set size of segment over which cross-correlation is calculated.
Default is 256. Allowed range is from 2 to 131072.
@item algo
Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
Default is @code{slow}. Fast algorithm assumes mean values over any given segment
are always zero and thus need much less calculations to make.
This is generally not true, but is valid for typical audio streams.
@end table
@subsection Examples
@itemize
@item
Calculate correlation between channels in stereo audio stream:
@example
ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
@end example
@end itemize
@section bandpass
Apply a two-pole Butterworth band-pass filter with central
frequency @var{frequency}, and (3dB-point) band-width width.
The @var{csg} option selects a constant skirt gain (peak gain = Q)
instead of the default: constant 0dB peak gain.
The filter roll off at 6dB per octave (20dB per decade).
The filter accepts the following options:
@table @option
@item frequency, f
Set the filter's central frequency. Default is @code{3000}.
@item csg
Constant skirt gain if set to 1. Defaults to 0.
@item width_type, t
Set method to specify band-width of filter.
@table @option
@item h
Hz
@item q
Q-Factor
@item o
octave
@item s
slope
@item k
kHz
@end table
@item width, w
Specify the band-width of a filter in width_type units.
@item mix, m
How much to use filtered signal in output. Default is 1.
Range is between 0 and 1.
@item channels, c
Specify which channels to filter, by default all available are filtered.
@item normalize, n
Normalize biquad coefficients, by default is disabled.
Enabling it will normalize magnitude response at DC to 0dB.
@item transform, a
Set transform type of IIR filter.
@table @option
@item di
@item dii
@item tdii
@item latt
@end table
@item precision, r
Set precison of filtering.
@table @option
@item auto
Pick automatic sample format depending on surround filters.
@item s16
Always use signed 16-bit.
@item s32
Always use signed 32-bit.
@item f32
Always use float 32-bit.
@item f64
Always use float 64-bit.
@end table
@end table
@subsection Commands
This filter supports the following commands:
@table @option
@item frequency, f
Change bandpass frequency.
Syntax for the command is : "@var{frequency}"
@item width_type, t
Change bandpass width_type.
Syntax for the command is : "@var{width_type}"
@item width, w
Change bandpass width.
Syntax for the command is : "@var{width}"
@item mix, m
Change bandpass mix.
Syntax for the command is : "@var{mix}"
@end table
@section bandreject
Apply a two-pole Butterworth band-reject filter with central
frequency @var{frequency}, and (3dB-point) band-width @var{width}.
The filter roll off at 6dB per octave (20dB per decade).
The filter accepts the following options:
@table @option
@item frequency, f
Set the filter's central frequency. Default is @code{3000}.
@item width_type, t
Set method to specify band-width of filter.
@table @option
@item h
Hz
@item q
Q-Factor
@item o
octave
@item s
slope
@item k
kHz
@end table
@item width, w
Specify the band-width of a filter in width_type units.
@item mix, m
How much to use filtered signal in output. Default is 1.
Range is between 0 and 1.
@item channels, c
Specify which channels to filter, by default all available are filtered.
@item normalize, n
Normalize biquad coefficients, by default is disabled.
Enabling it will normalize magnitude response at DC to 0dB.
@item transform, a
Set transform type of IIR filter.
@table @option
@item di
@item dii
@item tdii
@item latt
@end table
@item precision, r
Set precison of filtering.
@table @option
@item auto
Pick automatic sample format depending on surround filters.
@item s16
Always use signed 16-bit.
@item s32
Always use signed 32-bit.
@item f32
Always use float 32-bit.
@item f64
Always use float 64-bit.
@end table
@end table
@subsection Commands
This filter supports the following commands:
@table @option
@item frequency, f
Change bandreject frequency.
Syntax for the command is : "@var{frequency}"
@item width_type, t
Change bandreject width_type.
Syntax for the command is : "@var{width_type}"
@item width, w
Change bandreject width.
Syntax for the command is : "@var{width}"
@item mix, m
Change bandreject mix.
Syntax for the command is : "@var{mix}"
@end table
@section bass, lowshelf
Boost or cut the bass (lower) frequencies of the audio using a two-pole
shelving filter with a response similar to that of a standard
hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
The filter accepts the following options:
@table @option
@item gain, g
Give the gain at 0 Hz. Its useful range is about -20
(for a large cut) to +20 (for a large boost).
Beware of clipping when using a positive gain.
@item frequency, f
Set the filter's central frequency and so can be used
to extend or reduce the frequency range to be boosted or cut.
The default value is @code{100} Hz.
@item width_type, t
Set method to specify band-width of filter.
@table @option
@item h
Hz
@item q
Q-Factor
@item o
octave
@item s
slope
@item k
kHz
@end table
@item width, w
Determine how steep is the filter's shelf transition.
@item mix, m
How much to use filtered signal in output. Default is 1.
Range is between 0 and 1.
@item channels, c
Specify which channels to filter, by default all available are filtered.
@item normalize, n
Normalize biquad coefficients, by default is disabled.
Enabling it will normalize magnitude response at DC to 0dB.
@item transform, a
Set transform type of IIR filter.
@table @option
@item di
@item dii
@item tdii
@item latt
@end table
@item precision, r
Set precison of filtering.
@table @option
@item auto
Pick automatic sample format depending on surround filters.
@item s16
Always use signed 16-bit.
@item s32
Always use signed 32-bit.
@item f32
Always use float 32-bit.
@item f64
Always use float 64-bit.
@end table
@end table
@subsection Commands
This filter supports the following commands:
@table @option
@item frequency, f
Change bass frequency.
Syntax for the command is : "@var{frequency}"
@item width_type, t
Change bass width_type.
Syntax for the command is : "@var{width_type}"
@item width, w
Change bass width.
Syntax for the command is : "@var{width}"
@item gain, g
Change bass gain.
Syntax for the command is : "@var{gain}"
@item mix, m
Change bass mix.
Syntax for the command is : "@var{mix}"
@end table
@section biquad
Apply a biquad IIR filter with the given coefficients.
Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
are the numerator and denominator coefficients respectively.
and @var{channels}, @var{c} specify which channels to filter, by default all
available are filtered.
@subsection Commands
This filter supports the following commands:
@table @option
@item a0
@item a1
@item a2
@item b0
@item b1
@item b2
Change biquad parameter.
Syntax for the command is : "@var{value}"
@item mix, m
How much to use filtered signal in output. Default is 1.
Range is between 0 and 1.
@item channels, c
Specify which channels to filter, by default all available are filtered.
@item normalize, n
Normalize biquad coefficients, by default is disabled.
Enabling it will normalize magnitude response at DC to 0dB.
@item transform, a
Set transform type of IIR filter.
@table @option
@item di
@item dii
@item tdii
@item latt
@end table
@item precision, r
Set precison of filtering.
@table @option
@item auto
Pick automatic sample format depending on surround filters.
@item s16
Always use signed 16-bit.
@item s32
Always use signed 32-bit.
@item f32
Always use float 32-bit.
@item f64
Always use float 64-bit.
@end table
@end table
@section bs2b
Bauer stereo to binaural transformation, which improves headphone listening of
stereo audio records.
To enable compilation of this filter you need to configure FFmpeg with
@code{--enable-libbs2b}.
It accepts the following parameters:
@table @option
@item profile
Pre-defined crossfeed level.
@table @option
@item default
Default level (fcut=700, feed=50).
@item cmoy
Chu Moy circuit (fcut=700, feed=60).
@item jmeier
Jan Meier circuit (fcut=650, feed=95).
@end table
@item fcut
Cut frequency (in Hz).
@item feed
Feed level (in Hz).
@end table
@section channelmap
Remap input channels to new locations.
It accepts the following parameters:
@table @option
@item map
Map channels from input to output. The argument is a '|'-separated list of
mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
@var{in_channel} form. @var{in_channel} can be either the name of the input
channel (e.g. FL for front left) or its index in the input channel layout.
@var{out_channel} is the name of the output channel or its index in the output
channel layout. If @var{out_channel} is not given then it is implicitly an
index, starting with zero and increasing by one for each mapping.
@item channel_layout
The channel layout of the output stream.
@end table
If no mapping is present, the filter will implicitly map input channels to
output channels, preserving indices.
@subsection Examples
@itemize
@item
For example, assuming a 5.1+downmix input MOV file,
@example
ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
@end example
will create an output WAV file tagged as stereo from the downmix channels of
the input.
@item
To fix a 5.1 WAV improperly encoded in AAC's native channel order
@example
ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
@end example
@end itemize
@section channelsplit
Split each channel from an input audio stream into a separate output stream.
It accepts the following parameters:
@table @option
@item channel_layout
The channel layout of the input stream. The default is "stereo".
@item channels
A channel layout describing the channels to be extracted as separate output streams
or "all" to extract each input channel as a separate stream. The default is "all".
Choosing channels not present in channel layout in the input will result in an error.
@end table
@subsection Examples
@itemize
@item
For example, assuming a stereo input MP3 file,
@example
ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
@end example
will create an output Matroska file with two audio streams, one containing only
the left channel and the other the right channel.
@item
Split a 5.1 WAV file into per-channel files:
@example
ffmpeg -i in.wav -filter_complex
'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
-map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
side_right.wav
@end example
@item
Extract only LFE from a 5.1 WAV file:
@example
ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
-map '[LFE]' lfe.wav
@end example
@end itemize
@section chorus
Add a chorus effect to the audio.
Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
constant, with chorus, it is varied using using sinusoidal or triangular modulation.
The modulation depth defines the range the modulated delay is played before or after
the delay. Hence the delayed sound will sound slower or faster, that is the delayed
sound tuned around the original one, like in a chorus where some vocals are slightly
off key.
It accepts the following parameters:
@table @option
@item in_gain
Set input gain. Default is 0.4.
@item out_gain
Set output gain. Default is 0.4.
@item delays
Set delays. A typical delay is around 40ms to 60ms.
@item decays
Set decays.
@item speeds
Set speeds.
@item depths
Set depths.
@end table
@subsection Examples
@itemize
@item
A single delay:
@example
chorus=0.7:0.9:55:0.4:0.25:2
@end example
@item
Two delays:
@example
chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
@end example
@item
Fuller sounding chorus with three delays:
@example
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
@end example
@end itemize
@section compand
Compress or expand the audio's dynamic range.
It accepts the following parameters:
@table @option
@item attacks
@item decays
A list of times in seconds for each channel over which the instantaneous level
of the input signal is averaged to determine its volume. @var{attacks} refers to
increase of volume and @var{decays} refers to decrease of volume. For most
situations, the attack time (response to the audio getting louder) should be
shorter than the decay time, because the human ear is more sensitive to sudden
loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
a typical value for decay is 0.8 seconds.
If specified number of attacks & decays is lower than number of channels, the last
set attack/decay will be used for all remaining channels.
@item points
A list of points for the transfer function, specified in dB relative to the
maximum possible signal amplitude. Each key points list must be defined using
the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
@code{x0/y0 x1/y1 x2/y2 ....}
The input values must be in strictly increasing order but the transfer function
does not have to be monotonically rising. The point @code{0/0} is assumed but
may be overridden (by @code{0/out-dBn}). Typical values for the transfer
function are @code{-70/-70|-60/-20|1/0}.
@item soft-knee
Set the curve radius in dB for all joints. It defaults to 0.01.
@item gain
Set the additional gain in dB to be applied at all points on the transfer
function. This allows for easy adjustment of the overall gain.
It defaults to 0.
@item volume
Set an initial volume, in dB, to be assumed for each channel when filtering
starts. This permits the user to supply a nominal level initially, so that, for
example, a very large gain is not applied to initial signal levels before the
companding has begun to operate. A typical value for audio which is initially
quiet is -90 dB. It defaults to 0.
@item delay
Set a delay, in seconds. The input audio is analyzed immediately, but audio is
delayed before being fed to the volume adjuster. Specifying a delay
approximately equal to the attack/decay times allows the filter to effectively
operate in predictive rather than reactive mode. It defaults to 0.
@end table
@subsection Examples
@itemize
@item
Make music with both quiet and loud passages suitable for listening to in a
noisy environment:
@example
compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
@end example
Another example for audio with whisper and explosion parts:
@example
compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
@end example
@item
A noise gate for when the noise is at a lower level than the signal:
@example
compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
@end example
@item
Here is another noise gate, this time for when the noise is at a higher level
than the signal (making it, in some ways, similar to squelch):
@example
compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
@end example
@item
2:1 compression starting at -6dB:
@example
compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
@end example
@item
2:1 compression starting at -9dB:
@example
compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
@end example
@item
2:1 compression starting at -12dB:
@example
compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
@end example
@item
2:1 compression starting at -18dB:
@example
compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
@end example
@item
3:1 compression starting at -15dB:
@example
compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
@end example
@item
Compressor/Gate:
@example
compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
@end example
@item
Expander:
@example
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
@end example
@item
Hard limiter at -6dB:
@example
compand=attacks=0:points=-80/-80|-6/-6|20/-6
@end example
@item
Hard limiter at -12dB:
@example
compand=attacks=0:points=-80/-80|-12/-12|20/-12
@end example
@item
Hard noise gate at -35 dB:
@example
compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
@end example
@item
Soft limiter:
@example
compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
@end example
@end itemize
@section compensationdelay
Compensation Delay Line is a metric based delay to compensate differing
positions of microphones or speakers.
For example, you have recorded guitar with two microphones placed in
different locations. Because the front of sound wave has fixed speed in
normal conditions, the phasing of microphones can vary and depends on
their location and interposition. The best sound mix can be achieved when
these microphones are in phase (synchronized). Note that a distance of
~30 cm between microphones makes one microphone capture the signal in
antiphase to the other microphone. That makes the final mix sound moody.
This filter helps to solve phasing problems by adding different delays
to each microphone track and make them synchronized.
The best result can be reached when you take one track as base and
synchronize other tracks one by one with it.
Remember that synchronization/delay tolerance depends on sample rate, too.
Higher sample rates will give more tolerance.
The filter accepts the following parameters:
@table @option
@item mm
Set millimeters distance. This is compensation distance for fine tuning.
Default is 0.
@item cm
Set cm distance. This is compensation distance for tightening distance setup.
Default is 0.
@item m
Set meters distance. This is compensation distance for hard distance setup.
Default is 0.
@item dry
Set dry amount. Amount of unprocessed (dry) signal.
Default is 0.
@item wet
Set wet amount. Amount of processed (wet) signal.
Default is 1.
@item temp
Set temperature in degrees Celsius. This is the temperature of the environment.
Default is 20.
@end table
@section crossfeed
Apply headphone crossfeed filter.
Crossfeed is the process of blending the left and right channels of stereo
audio recording.
It is mainly used to reduce extreme stereo separation of low frequencies.
The intent is to produce more speaker like sound to the listener.
The filter accepts the following options:
@table @option
@item strength
Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
This sets gain of low shelf filter for side part of stereo image.
Default is -6dB. Max allowed is -30db when strength is set to 1.
@item range
Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
This sets cut off frequency of low shelf filter. Default is cut off near
1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
@item slope
Set curve slope of low shelf filter. Default is 0.5.
Allowed range is from 0.01 to 1.
@item level_in
Set input gain. Default is 0.9.
@item level_out
Set output gain. Default is 1.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section crystalizer
Simple algorithm to expand audio dynamic range.
The filter accepts the following options:
@table @option
@item i
Sets the intensity of effect (default: 2.0). Must be in range between 0.0
(unchanged sound) to 10.0 (maximum effect).
@item c
Enable clipping. By default is enabled.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section dcshift
Apply a DC shift to the audio.
This can be useful to remove a DC offset (caused perhaps by a hardware problem
in the recording chain) from the audio. The effect of a DC offset is reduced
headroom and hence volume. The @ref{astats} filter can be used to determine if
a signal has a DC offset.
@table @option
@item shift
Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
the audio.
@item limitergain
Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
used to prevent clipping.
@end table
@section deesser
Apply de-essing to the audio samples.
@table @option
@item i
Set intensity for triggering de-essing. Allowed range is from 0 to 1.
Default is 0.
@item m
Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
Default is 0.5.
@item f
How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
Default is 0.5.
@item s
Set the output mode.
It accepts the following values:
@table @option
@item i
Pass input unchanged.
@item o
Pass ess filtered out.
@item e
Pass only ess.
Default value is @var{o}.
@end table
@end table
@section drmeter
Measure audio dynamic range.
DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
is found in transition material. And anything less that 8 have very poor dynamics
and is very compressed.
The filter accepts the following options:
@table @option
@item length
Set window length in seconds used to split audio into segments of equal length.
Default is 3 seconds.
@end table
@section dynaudnorm
Dynamic Audio Normalizer.
This filter applies a certain amount of gain to the input audio in order
to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
contrast to more "simple" normalization algorithms, the Dynamic Audio
Normalizer *dynamically* re-adjusts the gain factor to the input audio.
This allows for applying extra gain to the "quiet" sections of the audio
while avoiding distortions or clipping the "loud" sections. In other words:
The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
sections, in the sense that the volume of each section is brought to the
same target level. Note, however, that the Dynamic Audio Normalizer achieves
this goal *without* applying "dynamic range compressing". It will retain 100%
of the dynamic range *within* each section of the audio file.
@table @option
@item framelen, f
Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
Default is 500 milliseconds.
The Dynamic Audio Normalizer processes the input audio in small chunks,
referred to as frames. This is required, because a peak magnitude has no
meaning for just a single sample value. Instead, we need to determine the
peak magnitude for a contiguous sequence of sample values. While a "standard"
normalizer would simply use the peak magnitude of the complete file, the
Dynamic Audio Normalizer determines the peak magnitude individually for each
frame. The length of a frame is specified in milliseconds. By default, the
Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
been found to give good results with most files.
Note that the exact frame length, in number of samples, will be determined
automatically, based on the sampling rate of the individual input audio file.
@item gausssize, g
Set the Gaussian filter window size. In range from 3 to 301, must be odd
number. Default is 31.
Probably the most important parameter of the Dynamic Audio Normalizer is the
@code{window size} of the Gaussian smoothing filter. The filter's window size
is specified in frames, centered around the current frame. For the sake of
simplicity, this must be an odd number. Consequently, the default value of 31
takes into account the current frame, as well as the 15 preceding frames and
the 15 subsequent frames. Using a larger window results in a stronger
smoothing effect and thus in less gain variation, i.e. slower gain
adaptation. Conversely, using a smaller window results in a weaker smoothing
effect and thus in more gain variation, i.e. faster gain adaptation.
In other words, the more you increase this value, the more the Dynamic Audio
Normalizer will behave like a "traditional" normalization filter. On the
contrary, the more you decrease this value, the more the Dynamic Audio
Normalizer will behave like a dynamic range compressor.
@item peak, p
Set the target peak value. This specifies the highest permissible magnitude
level for the normalized audio input. This filter will try to approach the
target peak magnitude as closely as possible, but at the same time it also
makes sure that the normalized signal will never exceed the peak magnitude.
A frame's maximum local gain factor is imposed directly by the target peak
magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
It is not recommended to go above this value.
@item maxgain, m
Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
The Dynamic Audio Normalizer determines the maximum possible (local) gain
factor for each input frame, i.e. the maximum gain factor that does not
result in clipping or distortion. The maximum gain factor is determined by
the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
additionally bounds the frame's maximum gain factor by a predetermined
(global) maximum gain factor. This is done in order to avoid excessive gain
factors in "silent" or almost silent frames. By default, the maximum gain
factor is 10.0, For most inputs the default value should be sufficient and
it usually is not recommended to increase this value. Though, for input
with an extremely low overall volume level, it may be necessary to allow even
higher gain factors. Note, however, that the Dynamic Audio Normalizer does
not simply apply a "hard" threshold (i.e. cut off values above the threshold).
Instead, a "sigmoid" threshold function will be applied. This way, the
gain factors will smoothly approach the threshold value, but never exceed that
value.
@item targetrms, r
Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
By default, the Dynamic Audio Normalizer performs "peak" normalization.
This means that the maximum local gain factor for each frame is defined
(only) by the frame's highest magnitude sample. This way, the samples can
be amplified as much as possible without exceeding the maximum signal
level, i.e. without clipping. Optionally, however, the Dynamic Audio
Normalizer can also take into account the frame's root mean square,
abbreviated RMS. In electrical engineering, the RMS is commonly used to
determine the power of a time-varying signal. It is therefore considered
that the RMS is a better approximation of the "perceived loudness" than
just looking at the signal's peak magnitude. Consequently, by adjusting all
frames to a constant RMS value, a uniform "perceived loudness" can be
established. If a target RMS value has been specified, a frame's local gain
factor is defined as the factor that would result in exactly that RMS value.
Note, however, that the maximum local gain factor is still restricted by the
frame's highest magnitude sample, in order to prevent clipping.
@item coupling, n
Enable channels coupling. By default is enabled.
By default, the Dynamic Audio Normalizer will amplify all channels by the same
amount. This means the same gain factor will be applied to all channels, i.e.
the maximum possible gain factor is determined by the "loudest" channel.
However, in some recordings, it may happen that the volume of the different
channels is uneven, e.g. one channel may be "quieter" than the other one(s).
In this case, this option can be used to disable the channel coupling. This way,
the gain factor will be determined independently for each channel, depending
only on the individual channel's highest magnitude sample. This allows for
harmonizing the volume of the different channels.
@item correctdc, c
Enable DC bias correction. By default is disabled.
An audio signal (in the time domain) is a sequence of sample values.
In the Dynamic Audio Normalizer these sample values are represented in the
-1.0 to 1.0 range, regardless of the original input format. Normally, the
audio signal, or "waveform", should be centered around the zero point.
That means if we calculate the mean value of all samples in a file, or in a
single frame, then the result should be 0.0 or at least very close to that
value. If, however, there is a significant deviation of the mean value from
0.0, in either positive or negative direction, this is referred to as a
DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
Audio Normalizer provides optional DC bias correction.
With DC bias correction enabled, the Dynamic Audio Normalizer will determine
the mean value, or "DC correction" offset, of each input frame and subtract
that value from all of the frame's sample values which ensures those samples
are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
boundaries, the DC correction offset values will be interpolated smoothly
between neighbouring frames.
@item altboundary, b
Enable alternative boundary mode. By default is disabled.
The Dynamic Audio Normalizer takes into account a certain neighbourhood
around each frame. This includes the preceding frames as well as the
subsequent frames. However, for the "boundary" frames, located at the very
beginning and at the very end of the audio file, not all neighbouring
frames are available. In particular, for the first few frames in the audio
file, the preceding frames are not known. And, similarly, for the last few
frames in the audio file, the subsequent frames are not known. Thus, the
question arises which gain factors should be assumed for the missing frames
in the "boundary" region. The Dynamic Audio Normalizer implements two modes
to deal with this situation. The default boundary mode assumes a gain factor
of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
"fade out" at the beginning and at the end of the input, respectively.
@item compress, s
Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
By default, the Dynamic Audio Normalizer does not apply "traditional"
compression. This means that signal peaks will not be pruned and thus the
full dynamic range will be retained within each local neighbourhood. However,
in some cases it may be desirable to combine the Dynamic Audio Normalizer's
normalization algorithm with a more "traditional" compression.
For this purpose, the Dynamic Audio Normalizer provides an optional compression
(thresholding) function. If (and only if) the compression feature is enabled,
all input frames will be processed by a soft knee thresholding function prior
to the actual normalization process. Put simply, the thresholding function is
going to prune all samples whose magnitude exceeds a certain threshold value.
However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
value. Instead, the threshold value will be adjusted for each individual
frame.
In general, smaller parameters result in stronger compression, and vice versa.
Values below 3.0 are not recommended, because audible distortion may appear.
@item threshold, t
Set the target threshold value. This specifies the lowest permissible
magnitude level for the audio input which will be normalized.
If input frame volume is above this value frame will be normalized.
Otherwise frame may not be normalized at all. The default value is set
to 0, which means all input frames will be normalized.
This option is mostly useful if digital noise is not wanted to be amplified.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section earwax
Make audio easier to listen to on headphones.
This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
so that when listened to on headphones the stereo image is moved from
inside your head (standard for headphones) to outside and in front of
the listener (standard for speakers).
Ported from SoX.
@section equalizer
Apply a two-pole peaking equalisation (EQ) filter. With this
filter, the signal-level at and around a selected frequency can
be increased or decreased, whilst (unlike bandpass and bandreject
filters) that at all other frequencies is unchanged.
In order to produce complex equalisation curves, this filter can
be given several times, each with a different central frequency.
The filter accepts the following options:
@table @option
@item frequency, f
Set the filter's central frequency in Hz.
@item width_type, t
Set method to specify band-width of filter.
@table @option
@item h
Hz
@item q
Q-Factor
@item o
octave
@item s
slope
@item k
kHz
@end table
@item width, w
Specify the band-width of a filter in width_type units.
@item gain, g
Set the required gain or attenuation in dB.
Beware of clipping when using a positive gain.
@item mix, m
How much to use filtered signal in output. Default is 1.
Range is between 0 and 1.
@item channels, c
Specify which channels to filter, by default all available are filtered.
@item normalize, n
Normalize biquad coefficients, by default is disabled.
Enabling it will normalize magnitude response at DC to 0dB.
@item transform, a
Set transform type of IIR filter.
@table @option
@item di
@item dii
@item tdii
@item latt
@end table
@item precision, r
Set precison of filtering.
@table @option
@item auto
Pick automatic sample format depending on surround filters.
@item s16
Always use signed 16-bit.
@item s32
Always use signed 32-bit.
@item f32
Always use float 32-bit.
@item f64
Always use float 64-bit.
@end table
@end table
@subsection Examples
@itemize
@item
Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
@example
equalizer=f=1000:t=h:width=200:g=-10
@end example
@item
Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
@example
equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
@end example
@end itemize
@subsection Commands
This filter supports the following commands:
@table @option
@item frequency, f
Change equalizer frequency.
Syntax for the command is : "@var{frequency}"
@item width_type, t
Change equalizer width_type.
Syntax for the command is : "@var{width_type}"
@item width, w
Change equalizer width.
Syntax for the command is : "@var{width}"
@item gain, g
Change equalizer gain.
Syntax for the command is : "@var{gain}"
@item mix, m
Change equalizer mix.
Syntax for the command is : "@var{mix}"
@end table
@section extrastereo
Linearly increases the difference between left and right channels which
adds some sort of "live" effect to playback.
The filter accepts the following options:
@table @option
@item m
Sets the difference coefficient (default: 2.5). 0.0 means mono sound
(average of both channels), with 1.0 sound will be unchanged, with
-1.0 left and right channels will be swapped.
@item c
Enable clipping. By default is enabled.
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@section firequalizer
Apply FIR Equalization using arbitrary frequency response.
The filter accepts the following option:
@table @option
@item gain
Set gain curve equation (in dB). The expression can contain variables:
@table @option
@item f
the evaluated frequency
@item sr
sample rate
@item ch
channel number, set to 0 when multichannels evaluation is disabled
@item chid
channel id, see libavutil/channel_layout.h, set to the first channel id when
multichannels evaluation is disabled
@item chs
number of channels
@item chlayout
channel_layout, see libavutil/channel_layout.h
@end table
and functions:
@table @option
@item gain_interpolate(f)
interpolate gain on frequency f based on gain_entry
@item cubic_interpolate(f)
same as gain_interpolate, but smoother
@end table
This option is also available as command. Default is @code{gain_interpolate(f)}.
@item gain_entry
Set gain entry for gain_interpolate function. The expression can
contain functions:
@table @option
@item entry(f, g)
store gain entry at frequency f with value g
@end table
This option is also available as command.
@item delay
Set filter delay in seconds. Higher value means more accurate.
Default is @code{0.01}.
@item accuracy
Set filter accuracy in Hz. Lower value means more accurate.
Default is @code{5}.
@item wfunc
Set window function. Acceptable values are:
@table @option
@item rectangular
rectangular window, useful when gain curve is already smooth
@item hann
hann window (default)
@item hamming
hamming window
@item blackman
blackman window
@item nuttall3
3-terms continuous 1st derivative nuttall window
@item mnuttall3
minimum 3-terms discontinuous nuttall window
@item nuttall
4-terms continuous 1st derivative nuttall window
@item bnuttall
minimum 4-terms discontinuous nuttall (blackman-nuttall) window
@item bharris
blackman-harris window
@item tukey
tukey window
@end table
@item fixed
If enabled, use fixed number of audio samples. This improves speed when
filtering with large delay. Default is disabled.
@item multi
Enable multichannels evaluation on gain. Default is disabled.
@item zero_phase
Enable zero phase mode by subtracting timestamp to compensate delay.
Default is disabled.
@item scale
Set scale used by gain. Acceptable values are:
@table @option
@item linlin
linear frequency, linear gain
@item linlog
linear frequency, logarithmic (in dB) gain (default)
@item loglin
logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
@item loglog
logarithmic frequency, logarithmic gain
@end table
@item dumpfile
Set file for dumping, suitable for gnuplot.
@item dumpscale
Set scale for dumpfile. Acceptable values are same with scale option.
Default is linlog.
@item fft2
Enable 2-channel convolution using complex FFT. This improves speed significantly.
Default is disabled.
@item min_phase
Enable minimum phase impulse response. Default is disabled.
@end table
@subsection Examples
@itemize
@item
lowpass at 1000 Hz:
@example
firequalizer=gain='if(lt(f,1000), 0, -INF)'
@end example
@item
lowpass at 1000 Hz with gain_entry:
@example
firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
@end example
@item
custom equalization:
@example
firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
@end example
@item
higher delay with zero phase to compensate delay:
@example
firequalizer=delay=0.1:fixed=on:zero_phase=on
@end example
@item
lowpass on left channel, highpass on right channel:
@example
firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
:gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
@end example
@end itemize
@section flanger
Apply a flanging effect to the audio.
The filter accepts the following options:
@table @option
@item delay
Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
@item depth
Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
@item regen
Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
Default value is 0.
@item width
Set percentage of delayed signal mixed with original. Range from 0 to 100.
Default value is 71.
@item speed
Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
@item shape
Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
Default value is @var{sinusoidal}.
@item phase
Set swept wave percentage-shift for multi channel. Range from 0 to 100.
Default value is 25.
@item interp
Set delay-line interpolation, @var{linear} or @var{quadratic}.
Default is @var{linear}.
@end table
@section haas
Apply Haas effect to audio.
Note that this makes most sense to apply on mono signals.
With this filter applied to mono signals it give some directionality and
stretches its stereo image.
The filter accepts the following options:
@table @option
@item level_in
Set input level. By default is @var{1}, or 0dB
@item level_out
Set output level. By default is @var{1}, or 0dB.
@item side_gain
Set gain applied to side part of signal. By default is @var{1}.
@item middle_source
Set kind of middle source. Can be one of the following:
@table @samp
@item left
Pick left channel.
@item right
Pick right channel.
@item mid
Pick middle part signal of stereo image.
@item side
Pick side part signal of stereo image.
@end table
@item middle_phase
Change middle phase. By default is disabled.
@item left_delay
Set left channel delay. By default is @var{2.05} milliseconds.
@item left_balance
Set left channel balance. By default is @var{-1}.
@item left_gain
Set left channel gain. By default is @var{1}.
@item left_phase
Change left phase. By default is disabled.
@item right_delay
Set right channel delay. By defaults is @var{2.12} milliseconds.
@item right_balance
Set right channel balance. By default is @var{1}.
@item right_gain
Set right channel gain. By default is @var{1}.
@item right_phase
Change right phase. By default is enabled.
@end table
@section hdcd
Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
embedded HDCD codes is expanded into a 20-bit PCM stream.
The filter supports the Peak Extend and Low-level Gain Adjustment features
of HDCD, and detects the Transient Filter flag.
@example
ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
@end example
When using the filter with wav, note the default encoding for wav is 16-bit,
so the resulting 20-bit stream will be truncated back to 16-bit. Use something
like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
@example
ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
@end example
The filter accepts the following options:
@table @option
@item disable_autoconvert
Disable any automatic format conversion or resampling in the filter graph.
@item process_stereo
Process the stereo channels together. If target_gain does not match between
channels, consider it invalid and use the last valid target_gain.
@item cdt_ms
Set the code detect timer period in ms.
@item force_pe
Always extend peaks above -3dBFS even if PE isn't signaled.
@item analyze_mode
Replace audio with a solid tone and adjust the amplitude to signal some
specific aspect of the decoding process. The output file can be loaded in
an audio editor alongside the original to aid analysis.
@code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
Modes are:
@table @samp
@item 0, off
Disabled
@item 1, lle
Gain adjustment level at each sample
@item 2, pe
Samples where peak extend occurs
@item 3, cdt
Samples where the code detect timer is active
@item 4, tgm
Samples where the target gain does not match between channels
@end table
@end table
@section headphone
Apply head-related transfer functions (HRTFs) to create virtual
loudspeakers around the user for binaural listening via headphones.
The HRIRs are provided via additional streams, for each channel
one stereo input stream is needed.
The filter accepts the following options:
@table @option
@item map
Set mapping of input streams for convolution.
The argument is a '|'-separated list of channel names in order as they
are given as additional stream inputs for filter.
This also specify number of input streams. Number of input streams
must be not less than number of channels in first stream plus one.
@item gain
Set gain applied to audio. Value is in dB. Default is 0.
@item type
Set processing type. Can be @var{time} or @var{freq}. @var{time} is
processing audio in time domain which is slow.
@var{freq} is processing audio in frequency domain which is fast.
Default is @var{freq}.
@item lfe
Set custom gain for LFE channels. Value is in dB. Default is 0.
@item size
Set size of frame in number of samples which will be processed at once.
Default value is @var{1024}. Allowed range is from 1024 to 96000.
@item hrir
Set format of hrir stream.
Default value is @var{stereo}. Alternative value is @var{multich}.
If value is set to @var{stereo}, number of additional streams should
be greater or equal to number of input channels in first input stream.
Also each additional stream should have stereo number of channels.
If value is set to @var{multich}, number of additional streams should
be exactly one. Also number of input channels of additional stream
should be equal or greater than twice number of channels of first input
stream.
@end table
@subsection Examples
@itemize
@item
Full example using wav files as coefficients with amovie filters for 7.1 downmix,
each amovie filter use stereo file with IR coefficients as input.
The files give coefficients for each position of virtual loudspeaker:
@example
ffmpeg -i input.wav
-filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
output.wav
@end example
@item
Full example using wav files as coefficients with amovie filters for 7.1 downmix,
but now in @var{multich} @var{hrir} format.