MAN page from Fedora 28 ffmpeg-doc-4.1.1-1.fc28.i686.rpm
FFMPEG-FILTERS
Section: (1)
Updated:
Index NAME
ffmpeg-filters - FFmpeg filters
DESCRIPTION
This document describes filters, sources, and sinks provided by thelibavfilter library.
FILTERING INTRODUCTION
Filtering in FFmpeg is enabled through the libavfilter library.
In libavfilter, a filter can have multiple inputs and multipleoutputs.To illustrate the sorts of things that are possible, we consider thefollowing filtergraph.
[main] input --> split ---------------------> overlay --> output | ^ |[tmp] [flip]| +-----> crop --> vflip -------+
This filtergraph splits the input stream in two streams, then sends onestream through the crop filter and the vflip filter, before merging itback with the other stream by overlaying it on top. You can use thefollowing command to achieve this:
ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
The result will be that the top half of the video is mirroredonto the bottom half of the output video.
Filters in the same linear chain are separated by commas, and distinctlinear chains of filters are separated by semicolons. In our example,crop,vflip are in one linear chain, split andoverlay are separately in another. The points where the linearchains join are labelled by names enclosed in square brackets. In theexample, the split filter generates two outputs that are associated tothe labels [main] and [tmp].
The stream sent to the second output of split, labelled as[tmp], is processed through the crop filter, which cropsaway the lower half part of the video, and then vertically flipped. Theoverlay filter takes in input the first unchanged output of thesplit filter (which was labelled as [main]), and overlay on itslower half the output generated by the crop,vflip filterchain.
Some filters take in input a list of parameters: they are specifiedafter the filter name and an equal sign, and are separated from each otherby a colon.
There exist so-called source filters that do not have anaudio/video input, and sink filters that will not have audio/videooutput.
GRAPH
The
graph2dot program included in the FFmpeg
toolsdirectory can be used to parse a filtergraph description and issue acorresponding textual representation in the dot language.
Invoke the command:
graph2dot -h
to see how to use graph2dot.
You can then pass the dot description to the dot program (fromthe graphviz suite of programs) and obtain a graphical representationof the filtergraph.
For example the sequence of commands:
echo <GRAPH_DESCRIPTION> | \ tools/graph2dot -o graph.tmp && \ dot -Tpng graph.tmp -o graph.png && \ display graph.png
can be used to create and display an image representing the graphdescribed by the GRAPH_DESCRIPTION string. Note that this string must bea complete self-contained graph, with its inputs and outputs explicitly defined.For example if your command line is of the form:
ffmpeg -i infile -vf scale=640:360 outfile
your GRAPH_DESCRIPTION string will need to be of the form:
nullsrc,scale=640:360,nullsink
you may also need to set the nullsrc parameters and add a formatfilter in order to simulate a specific input file.
FILTERGRAPH DESCRIPTION
A filtergraph is a directed graph of connected filters. It can containcycles, and there can be multiple links between a pair offilters. Each link has one input pad on one side connecting it to onefilter from which it takes its input, and one output pad on the otherside connecting it to one filter accepting its output.
Each filter in a filtergraph is an instance of a filter classregistered in the application, which defines the features and thenumber of input and output pads of the filter.
A filter with no input pads is called a ``source'', and a filter with nooutput pads is called a ``sink''.
Filtergraph syntax
A filtergraph has a textual representation, which is recognized by the
-filter/
-vf/
-af and
-filter_complex options in
ffmpeg and
-vf/
-af in
ffplay, and by the
"avfilter_graph_parse_ptr()" function defined in
libavfilter/avfilter.h.
A filterchain consists of a sequence of connected filters, each oneconnected to the previous one in the sequence. A filterchain isrepresented by a list of ``,''-separated filter descriptions.
A filtergraph consists of a sequence of filterchains. A sequence offilterchains is represented by a list of ``;''-separated filterchaindescriptions.
A filter is represented by a string of the form:[in_link_1]...[in_link_N]filter_name@id=arguments[out_link_1]...[out_link_M]
filter_name is the name of the filter class of which thedescribed filter is an instance of, and has to be the name of one ofthe filter classes registered in the program optionally followed by "@id``.The name of the filter class is optionally followed by a string''=arguments".
arguments is a string which contains the parameters used toinitialize the filter instance. It may have one of two forms:
- *
- A ':'-separated list of key=value pairs.
- *
- A ':'-separated list of value. In this case, the keys are assumed to bethe option names in the order they are declared. E.g. the "fade" filterdeclares three options in this order --- type, start_frame andnb_frames. Then the parameter list in:0:30 means that the valuein is assigned to the option type, 0 tostart_frame and 30 to nb_frames.
- *
- A ':'-separated list of mixed direct value and long key=valuepairs. The direct value must precede the key=value pairs, andfollow the same constraints order of the previous point. The followingkey=value pairs can be set in any preferred order.
If the option value itself is a list of items (e.g. the "format" filtertakes a list of pixel formats), the items in the list are usually separated by|.
The list of arguments can be quoted using the character ' as initialand ending mark, and the character \ for escaping the characterswithin the quoted text; otherwise the argument string is consideredterminated when the next special character (belonging to the set[]=;,) is encountered.
The name and arguments of the filter are optionally preceded andfollowed by a list of link labels.A link label allows one to name a link and associate it to a filter outputor input pad. The preceding labels in_link_1... in_link_N, are associated to the filter input pads,the following labels out_link_1 ... out_link_M, areassociated to the output pads.
When two link labels with the same name are found in thefiltergraph, a link between the corresponding input and output pad iscreated.
If an output pad is not labelled, it is linked by default to the firstunlabelled input pad of the next filter in the filterchain.For example in the filterchain
nullsrc, split[L1], [L2]overlay, nullsink
the split filter instance has two output pads, and the overlay filterinstance two input pads. The first output pad of split is labelled``L1'', the first input pad of overlay is labelled ``L2'', and the secondoutput 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 notspecified, ``in'' is assumed; if the output label of the last filter is notspecified, ``out'' is assumed.
In a complete filterchain all the unlabelled filter input and outputpads must be connected. A filtergraph is considered valid if all thefilter input and output pads of all the filterchains are connected.
Libavfilter will automatically insert scale filters where formatconversion is required. It is possible to specify swscale flagsfor those automatically inserted scalers by prepending"sws_flags=flags;"to the filtergraph description.
Here is a BNF description of the filtergraph syntax:
<NAME> ::= sequence of alphanumeric characters and '_' <FILTER_NAME> ::= <NAME>["@"<NAME>] <LINKLABEL> ::= "[" <NAME> "]" <LINKLABELS> ::= <LINKLABEL> [<LINKLABELS>] <FILTER_ARGUMENTS> ::= sequence of chars (possibly quoted) <FILTER> ::= [<LINKLABELS>] <FILTER_NAME> ["=" <FILTER_ARGUMENTS>] [<LINKLABELS>] <FILTERCHAIN> ::= <FILTER> [,<FILTERCHAIN>] <FILTERGRAPH> ::= [sws_flags=<flags>;] <FILTERCHAIN> [;<FILTERGRAPH>]
Notes on filtergraph escaping
Filtergraph description composition entails several levels ofescaping. See
the ``Quoting and escaping''section in the ffmpeg-utils(1) manual for moreinformation about the employed escaping procedure.
A first level escaping affects the content of each filter optionvalue, which may contain the special character ":" used toseparate values, or one of the escaping characters "\'".
A second level escaping affects the whole filter description, whichmay contain the escaping characters "\'" or the specialcharacters "[],;" used by the filtergraph description.
Finally, when you specify a filtergraph on a shell commandline, youneed to perform a third level escaping for the shell specialcharacters contained within it.
For example, consider the following string to be embedded inthe drawtext filter description text value:
this is a 'string': may contain one, or more, special characters
This string contains the "'" special escaping character, and the":" special character, so it needs to be escaped in this way:
text=this is a \'string\'\: may contain one, or more, special characters
A second level of escaping is required when embedding the filterdescription in a filtergraph description, in order to escape all thefiltergraph special characters. Thus the example above becomes:
drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
(note that in addition to the "\'" escaping special characters,also "," needs to be escaped).
Finally an additional level of escaping is needed when writing thefiltergraph description in a shell command, which depends on theescaping rules of the adopted shell. For example, assuming that"\" is special and needs to be escaped with another "\", theprevious string will finally result in:
-vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
TIMELINE EDITING
Some filters support a generic
enable option. For the filterssupporting timeline editing, this option can be set to an expression which isevaluated 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 thenext filter in the filtergraph.
The expression accepts the following values:
- t
- timestamp expressed in seconds, NAN if the input timestamp is unknown
- n
- sequential number of the input frame, starting from 0
- pos
- the position in the file of the input frame, NAN if unknown
- w
- h
- width and height of the input frame if video
Additionally, these filters support an enable command that can be usedto re-define the expression.
Like any other filtering option, the enable option follows the samerules.
For example, to enable a blur filter (smartblur) from 10 seconds to 3minutes, and a curves filter starting at 3 seconds:
smartblur = enable='between(t,10,3*60)', curves = enable='gte(t,3)' : preset=cross_process
See "ffmpeg -filters" to view which filters have timeline support.
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.
- eof_action
- The action to take when EOF is encountered on the secondary input; it acceptsone of the following values:
- repeat
- Repeat the last frame (the default).
- endall
- End both streams.
- pass
- Pass the main input through.
- shortest
- If set to 1, force the output to terminate when the shortest inputterminates. Default value is 0.
- repeatlast
- If set to 1, force the filter to extend the last frame of secondary streamsuntil the end of the primary stream. A value of 0 disables this behavior.Default value is 1.
AUDIO FILTERS
When you configure your FFmpeg build, you can disable any of theexisting filters using
"--disable-filters".The configure output will show the audio filters included in yourbuild.
Below is a description of the currently available audio filters.
acompressor
A compressor is mainly used to reduce the dynamic range of a signal.Especially modern music is mostly compressed at a high ratio toimprove the overall loudness. It's done to get the highest attentionof 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 effectbut can also destroy a track completely).The right compression is the key to reach a professional sound and isthe high art of mixing and mastering. Because of its complex settingsit 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"threshold" and dividing it by the factor set with "ratio".So if you set the threshold to -12dB and your signal reaches -6dB a ratioof 2:1 will result in a signal at -9dB. Because an exact manipulation ofthe signal would cause distortion of the waveform the reduction can belevelled over the time. This is done by setting ``Attack'' and ``Release''."attack" determines how long the signal has to rise above the thresholdbefore any reduction will occur and "release" sets the time the signalhas to fall below the threshold to reduce the reduction again. Shorter signalsthan the chosen attack time will be left untouched.The overall reduction of the signal can be made up afterwards with the"makeup" setting. So compressing the peaks of a signal about 6dB andraising the makeup to this level results in a signal twice as loud than thesource. To gain a softer entry in the compression the "knee" flattens thehard edge at the threshold in the range of the chosen decibels.
The filter accepts the following options:
- level_in
- Set input gain. Default is 1. Range is between 0.015625 and 64.
- threshold
- If a signal of stream rises above this level it will affect the gainreduction.By default it is 0.125. Range is between 0.00097563 and 1.
- ratio
- Set a ratio by which the signal is reduced. 1:2 means that if the levelrose 4dB above the threshold, it will be only 2dB above after the reduction.Default is 2. Range is between 1 and 20.
- attack
- Amount of milliseconds the signal has to rise above the threshold before gainreduction starts. Default is 20. Range is between 0.01 and 2000.
- release
- Amount of milliseconds the signal has to fall below the threshold beforereduction is decreased again. Default is 250. Range is between 0.01 and 9000.
- makeup
- Set the amount by how much signal will be amplified after processing.Default is 1. Range is from 1 to 64.
- knee
- Curve the sharp knee around the threshold to enter gain reduction more softly.Default is 2.82843. Range is between 1 and 8.
- link
- Choose if the "average" level between all channels of input streamor the louder("maximum") channel of input stream affects thereduction. Default is "average".
- detection
- Should the exact signal be taken in case of "peak" or an RMS one in caseof "rms". Default is "rms" which is mostly smoother.
- mix
- How much to use compressed signal in output. Default is 1.Range is between 0 and 1.
acontrast
Simple audio dynamic range commpression/expansion filter.
The filter accepts the following options:
- contrast
- Set contrast. Default is 33. Allowed range is between 0 and 100.
acopy
Copy the input audio source unchanged to the output. This is mainly useful fortesting purposes.
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:
- 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 completelysilent. Default is 44100.
- duration, d
- Specify the duration of the cross fade effect. Seethe Time duration section in the ffmpeg-utils(1) manualfor the accepted syntax.By default the duration is determined by nb_samples.If set this option is used instead of nb_samples.
- overlap, o
- Should first stream end overlap with second stream start. Default is enabled.
- curve1
- Set curve for cross fade transition for first stream.
- curve2
- Set curve for cross fade transition for second stream.
For description of available curve types see afade filter description.
Examples
- *
- Cross fade from one input to another:
ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
- *
- Cross fade from one input to another but without overlapping:
ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
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:
- split
- Set split frequencies. Those must be positive and increasing.
- order
- Set filter order, can be 2nd, 4th or 8th.Default is 4th.
acrusher
Reduce audio bit resolution.
This filter is bit crusher with enhanced functionality. A bit crusheris used to audibly reduce number of bits an audio signal is sampledwith. This doesn't change the bit depth at all, it just produces theeffect. Material reduced in bit depth sounds more harsh and ``digital''.This filter is able to even round to continuous values instead of discretebit depths.Additionally it has a D/C offset which results in different crushing ofthe 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 lowsignals 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:
- level_in
- Set level in.
- level_out
- Set level out.
- bits
- Set bit reduction.
- mix
- Set mixing amount.
- mode
- Can be linear: "lin" or logarithmic: "log".
- dc
- Set DC.
- aa
- Set anti-aliasing.
- samples
- Set sample reduction.
- lfo
- Enable LFO. By default disabled.
- lforange
- Set LFO range.
- lforate
- Set LFO rate.
acue
Delay audio filtering until a given wallclock timestamp. See the
cuefilter.
adeclick
Remove impulsive noise from input audio.
Samples detected as impulsive noise are replaced by interpolated samples usingautoregressive modelling.
- w
- Set window size, in milliseconds. Allowed range is from 10 to100. Default value is 55 milliseconds.This sets size of window which will be processed at once.
- o
- Set window overlap, in percentage of window size. Allowed range is from50 to 95. Default value is 75 percent.Setting this to a very high value increases impulsive noise removal but makeswhole process much slower.
- a
- Set autoregression order, in percentage of window size. Allowed range is from0 to 25. Default value is 2 percent. This option alsocontrols quality of interpolated samples using neighbour good samples.
- t
- Set threshold value. Allowed range is from 1 to 100.Default value is 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.
- b
- Set burst fusion, in percentage of window size. Allowed range is 0 to10. Default value is 2.If any two samples deteced as noise are spaced less than this value then anysample inbetween those two samples will be also detected as noise.
- m
- Set overlap method.
It accepts the following values:
- a
- Select overlap-add method. Even not interpolated samples are slightlychanged with this method.
- s
- Select overlap-save method. Not interpolated samples remain unchanged.
Default value is "a".
adeclip
Remove clipped samples from input audio.
Samples detected as clipped are replaced by interpolated samples usingautoregressive modelling.
- w
- Set window size, in milliseconds. Allowed range is from 10 to 100.Default value is 55 milliseconds.This sets size of window which will be processed at once.
- o
- Set window overlap, in percentage of window size. Allowed range is from 50to 95. Default value is 75 percent.
- a
- Set autoregression order, in percentage of window size. Allowed range is from0 to 25. Default value is 8 percent. This option also controlsquality of interpolated samples using neighbour good samples.
- t
- Set threshold value. Allowed range is from 1 to 100.Default value is 10. Higher values make clip detection less aggressive.
- n
- Set size of histogram used to detect clips. Allowed range is from 100 to 9999.Default value is 1000. Higher values make clip detection less aggressive.
- m
- Set overlap method.
It accepts the following values:
- a
- Select overlap-add method. Even not interpolated samples are slightly changedwith this method.
- s
- Select overlap-save method. Not interpolated samples remain unchanged.
Default value is "a".
adelay
Delay one or more audio channels.
Samples in delayed channel are filled with silence.
The filter accepts the following option:
- delays
- Set list of delays in milliseconds for each channel separated by '|'.Unused delays will be silently ignored. If number of given delays issmaller than number of channels all remaining channels will not be delayed.If you want to delay exact number of samples, append 'S' to number.
Examples
- *
- Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leavethe second channel (and any other channels that may be present) unchanged.
adelay=1500|0|500
- *
- Delay second channel by 500 samples, the third channel by 700 samples and leavethe first channel (and any other channels that may be present) unchanged.
adelay=0|500S|700S
aderivative, aintegral
Compute derivative/integral of audio stream.
Applying both filters one after another produces original audio.
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 echoeffects emulate this behaviour and are often used to help fill out thesound of a single instrument or vocal. The time difference between theoriginal signal and the reflection is the "delay", and theloudness of the reflected signal is the "decay".Multiple echoes can have different delays and decays.
A description of the accepted parameters follows.
- in_gain
- Set input gain of reflected signal. Default is 0.6.
- out_gain
- Set output gain of reflected signal. Default is 0.3.
- delays
- Set list of time intervals in milliseconds between original signal and reflectionsseparated by '|'. Allowed range for each "delay" is "(0 - 90000.0]".Default is 1000.
- decays
- Set list of loudness of reflected signals separated by '|'.Allowed range for each "decay" is "(0 - 1.0]".Default is 0.5.
Examples
- *
- Make it sound as if there are twice as many instruments as are actually playing:
aecho=0.8:0.88:60:0.4
- *
- If delay is very short, then it sound like a (metallic) robot playing music:
aecho=0.8:0.88:6:0.4
- *
- A longer delay will sound like an open air concert in the mountains:
aecho=0.8:0.9:1000:0.3
- *
- Same as above but with one more mountain:
aecho=0.8:0.9:1000|1800:0.3|0.25
aemphasis
Audio emphasis filter creates or restores material directly taken from LPs oremphased CDs with different filter curves. E.g. to store music on vinyl thesignal has to be altered by a filter first to even out the disadvantages ofthis recording medium.Once the material is played back the inverse filter has to be applied torestore the distortion of the frequency response.
The filter accepts the following options:
- level_in
- Set input gain.
- level_out
- Set output gain.
- mode
- Set filter mode. For restoring material use "reproduction" mode, otherwiseuse "production" mode. Default is "reproduction" mode.
- type
- Set filter type. Selects medium. Can be one of the following:
- col
- select Columbia.
- emi
- select EMI.
- bsi
- select BSI (78RPM).
- riaa
- select RIAA.
- cd
- select Compact Disc (CD).
- 50fm
- select 50Xs (FM).
- 75fm
- select 75Xs (FM).
- 50kf
- select 50Xs (FM-KF).
- 75kf
- select 75Xs (FM-KF).
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:
- exprs
- Set the '|'-separated expressions list for each separate channel. Ifthe number of input channels is greater than the number ofexpressions, the last specified expression is used for the remainingoutput channels.
- channel_layout, c
- Set output channel layout. If not specified, the channel layout isspecified by the number of expressions. If set to same, it willuse by default the same input channel layout.
Each expression in exprs can contain the following constants and functions:
- ch
- channel number of the current expression
- n
- number of the evaluated sample, starting from 0
- s
- sample rate
- t
- time of the evaluated sample expressed in seconds
- nb_in_channels
- nb_out_channels
- input and output number of channels
- val(CH)
- the value of input channel with number CH
Note: this filter is slow. For faster processing you should use adedicated filter.
Examples
- *
- Half volume:
aeval=val(ch)/2:c=same
- *
- Invert phase of the second channel:
aeval=val(0)|-val(1)
afade
Apply fade-in/out effect to input audio.
A description of the accepted parameters follows.
- type, t
- Specify the effect type, can be either "in" for fade-in, or"out" for a fade-out effect. Default is "in".
- start_sample, ss
- Specify the number of the start sample for starting to apply the fadeeffect. Default is 0.
- nb_samples, ns
- Specify the number of samples for which the fade effect has to last. Atthe end of the fade-in effect the output audio will have the samevolume as the input audio, at the end of the fade-out transitionthe output audio will be silence. Default is 44100.
- start_time, st
- Specify the start time of the fade effect. Default is 0.The value must be specified as a time duration; seethe Time duration section in the ffmpeg-utils(1) manualfor the accepted syntax.If set this option is used instead of start_sample.
- duration, d
- Specify the duration of the fade effect. Seethe Time duration section in the ffmpeg-utils(1) manualfor the accepted syntax.At the end of the fade-in effect the output audio will have the samevolume as the input audio, at the end of the fade-out transitionthe output audio will be silence.By default the duration is determined by nb_samples.If set this option is used instead of nb_samples.
- curve
- Set curve for fade transition.
It accepts the following values:
- tri
- select triangular, linear slope (default)
- qsin
- select quarter of sine wave
- hsin
- select half of sine wave
- esin
- select exponential sine wave
- log
- select logarithmic
- ipar
- select inverted parabola
- qua
- select quadratic
- cub
- select cubic
- squ
- select square root
- cbr
- select cubic root
- par
- select parabola
- exp
- select exponential
- iqsin
- select inverted quarter of sine wave
- ihsin
- select inverted half of sine wave
- dese
- select double-exponential seat
- desi
- select double-exponential sigmoid
- losi
- select logistic sigmoid
Examples
- *
- Fade in first 15 seconds of audio:
afade=t=in:ss=0:d=15
- *
- Fade out last 25 seconds of a 900 seconds audio:
afade=t=out:st=875:d=25
afftdn
Denoise audio samples with
FFT.A description of the accepted parameters follows.
- nr
- Set the noise reduction in dB, allowed range is 0.01 to 97.Default value is 12 dB.
- nf
- Set the noise floor in dB, allowed range is -80 to -20.Default value is -50 dB.
- nt
- Set the noise type.
It accepts the following values:
- w
- Select white noise.
- v
- Select vinyl noise.
- s
- Select shellac noise.
- c
- Select custom noise, defined in "bn" option.
Default value is white noise.
- bn
- Set custom band noise for every one of 15 bands.Bands are separated by ' ' or '|'.
- rf
- Set the residual floor in dB, allowed range is -80 to -20.Default value is -38 dB.
- tn
- Enable noise tracking. By default is disabled.With this enabled, noise floor is automatically adjusted.
- tr
- Enable residual tracking. By default is disabled.
- om
- Set the output mode.
It accepts the following values:
- i
- Pass input unchanged.
- o
- Pass noise filtered out.
- n
- Pass only noise.
Default value is o.
Commands
This filter supports the following commands:
- 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 beautomatically applied in filtering.
- noise_reduction, nr
- Change noise reduction. Argument is single float number.Syntax for the command is : "noise_reduction"
- noise_floor, nf
- Change noise floor. Argument is single float number.Syntax for the command is : "noise_floor"
- output_mode, om
- Change output mode operation.Syntax for the command is : ``i'', ``o'' or ``n'' string.
afftfilt
Apply arbitrary expressions to samples in frequency domain.
- real
- Set frequency domain real expression for each separate channel separatedby '|'. Default is ``1''.If the number of input channels is greater than the number ofexpressions, the last specified expression is used for the remainingoutput channels.
- imag
- Set frequency domain imaginary expression for each separate channelseparated by '|'. If not set, real option is used.
Each expression in real and imag can contain the followingconstants:
- sr
- sample rate
- b
- current frequency bin number
- nb
- number of available bins
- ch
- channel number of the current expression
- chs
- number of channels
- pts
- current frame pts
- win_size
- Set window size.
It accepts the following values:
- w16
- w32
- w64
- w128
- w256
- w512
- w1024
- w2048
- w4096
- w8192
- w16384
- w32768
- w65536
Default is "w4096"
- win_func
- Set window function. Default is "hann".
- overlap
- Set window overlap. If set to 1, the recommended overlap for selectedwindow function will be picked. Default is 0.75.
Examples
- *
- Leave almost only low frequencies in audio:
afftfilt="1-clip((b/nb)*b,0,1)"
afir
Apply an arbitrary Frequency 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 and ambisonics.
This filter uses second stream as FIR coefficients.If second stream holds single channel, it will be usedfor all input channels in first stream, otherwisenumber of channels in second stream must be same asnumber of channels in first stream.
It accepts the following parameters:
- dry
- Set dry gain. This sets input gain.
- wet
- Set wet gain. This sets final output gain.
- length
- Set Impulse Response filter length. Default is 1, which means whole IR is processed.
- gtype
- Enable applying gain measured from power of IR.
Set which approach to use for auto gain measurement.
- none
- Do not apply any gain.
- peak
- select peak gain, very conservative approach. This is default value.
- dc
- select DC gain, limited application.
- gn
- select gain to noise approach, this is most popular one.
- 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 gtype option.
- irfmt
- Set format of IR stream. Can be "mono" or "input".Default is "input".
- maxir
- Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.Allowed range is 0.1 to 60 seconds.
- response
- Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.By default it is disabled.
- channel
- Set for which IR channel to display frequency response. By default is first channeldisplayed. This option is used only when response is enabled.
- size
- Set video stream size. This option is used only when response is enabled.
Examples
- *
- Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
aformat
Set output format constraints for the input audio. The framework willnegotiate the most appropriate format to minimize conversions.
It accepts the following parameters:
- sample_fmts
- A '|'-separated list of requested sample formats.
- sample_rates
- A '|'-separated list of requested sample rates.
- channel_layouts
- A '|'-separated list of requested channel layouts.
See the Channel Layout section in the ffmpeg-utils(1) manualfor the required syntax.
If a parameter is omitted, all values are allowed.
Force the output to either unsigned 8-bit or signed 16-bit stereo
aformat=sample_fmts=u8|s16:channel_layouts=stereo
agate
A gate is mainly used to reduce lower parts of a signal. This kind of signalprocessing reduces disturbing noise between useful signals.
Gating is done by detecting the volume below a chosen level thresholdand dividing it by the factor set with ratio. The bottom of the noisefloor is set via range. Because an exact manipulation of the signalwould cause distortion of the waveform the reduction can be levelled overtime. This is done by setting attack and release.
attack determines how long the signal has to fall below the thresholdbefore any reduction will occur and release sets the time the signalhas to rise above the threshold to reduce the reduction again.Shorter signals than the chosen attack time will be left untouched.
- level_in
- Set input level before filtering.Default is 1. Allowed range is from 0.015625 to 64.
- 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.
- threshold
- If a signal rises above this level the gain reduction is released.Default is 0.125. Allowed range is from 0 to 1.
- ratio
- Set a ratio by which the signal is reduced.Default is 2. Allowed range is from 1 to 9000.
- attack
- Amount of milliseconds the signal has to rise above the threshold before gainreduction stops.Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
- release
- Amount of milliseconds the signal has to fall below the threshold before thereduction is increased again. Default is 250 milliseconds.Allowed range is from 0.01 to 9000.
- makeup
- Set amount of amplification of signal after processing.Default is 1. Allowed range is from 1 to 64.
- 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.
- detection
- Choose if exact signal should be taken for detection or an RMS like one.Default is "rms". Can be "peak" or "rms".
- link
- Choose if the average level between all channels or the louder channel affectsthe reduction.Default is "average". Can be "average" or "maximum".
aiir
Apply an arbitrary Infinite Impulse Response filter.
It accepts the following parameters:
- z
- Set numerator/zeros coefficients.
- p
- Set denominator/poles coefficients.
- k
- Set channels gains.
- dry_gain
- Set input gain.
- wet_gain
- Set output gain.
- f
- Set coefficients format.
- tf
- transfer function
- zp
- Z-plane zeros/poles, cartesian (default)
- pr
- Z-plane zeros/poles, polar radians
- pd
- Z-plane zeros/poles, polar degrees
- r
- Set kind of processing.Can be "d" - direct or "s" - serial cascading. Defauls is "s".
- e
- Set filtering precision.
- dbl
- double-precision floating-point (default)
- flt
- single-precision floating-point
- i32
- 32-bit integers
- i16
- 16-bit integers
- response
- Show IR frequency reponse, magnitude and phase in additional video stream.By default it is disabled.
- channel
- Set for which IR channel to display frequency response. By default is first channeldisplayed. This option is used only when response is enabled.
- size
- Set video stream size. This option is used only when response is enabled.
Coefficients in "tf" format are separated by spaces and are in ascendingorder.
Coefficients in "zp" format are separated by spaces and order of coefficientsdoesn't matter. Coefficients in "zp" format are complex numbers with iimaginary unit.
Different coefficients and gains can be provided for every channel, in such caseuse '|' to separate coefficients or gains. Last provided coefficients will beused for all remaining channels.
Examples
- *
- Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
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
- *
- Same as above but in "zp" format:
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
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 mindthat the delay it produces is the attack time you set.
The filter accepts the following options:
- level_in
- Set input gain. Default is 1.
- level_out
- Set output gain. Default is 1.
- limit
- Don't let signals above this level pass the limiter. Default is 1.
- attack
- The limiter will reach its attenuation level in this amount of time inmilliseconds. Default is 5 milliseconds.
- release
- Come back from limiting to attenuation 1.0 in this amount of milliseconds.Default is 50 milliseconds.
- asc
- When gain reduction is always needed ASC takes care of releasing to anaverage reduction level rather than reaching a reduction of 0 in the releasetime.
- asc_level
- Select how much the release time is affected by ASC, 0 means nearly no changesin release time while 1 produces higher release times.
- level
- Auto level output signal. Default is enabled.This normalizes audio back to 0dB if enabled.
Depending on picked setting it is recommended to upsample input 2x or 4x timeswith aresample before applying this filter.
allpass
Apply a two-pole all-pass filter with central frequency (in Hz)
frequency, and filter-width
width.An all-pass filter changes the audio's frequency to phase relationshipwithout changing its frequency to amplitude relationship.
The filter accepts the following options:
- frequency, f
- Set frequency in Hz.
- width_type, t
- Set method to specify band-width of filter.
- h
- Hz
- q
- Q-Factor
- o
- octave
- s
- slope
- k
- kHz
- width, w
- Specify the band-width of a filter in width_type units.
- channels, c
- Specify which channels to filter, by default all available are filtered.
Commands
This filter supports the following commands:
- frequency, f
- Change allpass frequency.Syntax for the command is : "frequency"
- width_type, t
- Change allpass width_type.Syntax for the command is : "width_type"
- width, w
- Change allpass width.Syntax for the command is : "width"
aloop
Loop audio samples.
The filter accepts the following options:
- loop
- Set the number of loops. Setting this value to -1 will result in infinite loops.Default is 0.
- size
- Set maximal number of samples. Default is 0.
- start
- Set first sample of loop. Default is 0.
amerge
Merge two or more audio streams into a single multi-channel stream.
The filter accepts the following options:
- inputs
- Set the number of inputs. Default is 2.
If the channel layouts of the inputs are disjoint, and therefore compatible,the channel layout of the output will be set accordingly and the channelswill be reordered as necessary. If the channel layouts of the inputs are notdisjoint, the output will have all the channels of the first input then allthe channels of the second input, in that order, and the channel layout ofthe output will be the default value corresponding to the total number ofchannels.
For example, if the first input is in 2.1 (FL+FR+LF) and the second inputis FC+BL+BR, then the output will be in 5.1, with the channels in thefollowing order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of thefirst input, b1 is the first channel of the second input).
On the other hand, if both input are in stereo, the output channels will bein the default order: a1, a2, b1, b2, and the channel layout will bearbitrarily 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 theshortest.
Examples
- *
- Merge two mono files into a stereo stream:
amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
- *
- Multiple merges assuming 1 video stream and 6 audio streams in input.mkv:
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
amix
Mixes multiple audio inputs into a single output.
Note that this filter only supports float samples (the amergeand pan audio filters support many formats). If the amixinput has integer samples then aresample will be automaticallyinserted to perform the conversion to float samples.
For example
ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
will mix 3 input audio streams to a single output with the same duration as thefirst input and a dropout transition time of 3 seconds.
It accepts the following parameters:
- inputs
- The number of inputs. If unspecified, it defaults to 2.
- duration
- How to determine the end-of-stream.
- longest
- The duration of the longest input. (default)
- shortest
- The duration of the shortest input.
- first
- The duration of the first input.
- dropout_transition
- The transition time, in seconds, for volume renormalization when an inputstream ends. The default value is 2 seconds.
- weights
- Specify weight of each input audio stream as sequence.Each weight is separated by space. By default all inputs have same weight.
amultiply
Multiply first audio stream with second audio stream and store resultin output audio stream. Multiplication is done by multiplying eachsample from first stream with sample at same position from second stream.
With this element-wise multiplication one can create amplitude fades andamplitude modulations.
anequalizer
High-order parametric multiband equalizer for each channel.
It accepts the following parameters:
- params
- This option string is in format:"cchn f=cf w=w g=g t=f | ..."Each equalizer band is separated by '|'.
- chn
- Set channel number to which equalization will be applied.If input doesn't have that channel the entry is ignored.
- f
- Set central frequency for band.If input doesn't have that frequency the entry is ignored.
- w
- Set band width in hertz.
- g
- Set band gain in dB.
- t
- Set filter type for band, optional, can be:
- 0
- Butterworth, this is default.
- 1
- Chebyshev type 1.
- 2
- Chebyshev type 2.
- curves
- With this option activated frequency response of anequalizer is displayedin video stream.
- size
- Set video stream size. Only useful if curves option is activated.
- 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 fromneighbour bands which are too close to each other and thus produce higher gainwhen both are activated.
- fscale
- Set frequency scale used to draw frequency response in video output.Can be linear or logarithmic. Default is logarithmic.
- 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.
Examples
- *
- Lower gain by 10 of central frequency 200Hz and width 100 Hzfor first 2 channels using Chebyshev type 1 filter:
anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
Commands
This filter supports the following commands:
- change
- Alter existing filter parameters.Syntax for the commands is : "fN|f=freq|w=width|g=gain"
fN is existing filter number, starting from 0, if no such filter is availableerror is returned.freq set new frequency parameter.width set new width parameter in herz.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=...
anull
Pass the audio source unchanged to the output.
apad
Pad the end of an audio stream with silence.
This can be used together with ffmpeg -shortest toextend audio streams to the same length as the video stream.
A description of the accepted options follows.
- packet_size
- Set silence packet size. Default value is 4096.
- pad_len
- Set the number of samples of silence to add to the end. After thevalue is reached, the stream is terminated. This option is mutuallyexclusive with whole_len.
- whole_len
- Set the minimum total number of samples in the output audio stream. Ifthe value is longer than the input audio length, silence is added tothe end, until the value is reached. This option is mutually exclusivewith pad_len.
If neither the pad_len nor the whole_len option isset, the filter will add silence to the end of the input streamindefinitely.
Examples
- *
- Add 1024 samples of silence to the end of the input:
apad=pad_len=1024
- *
- Make sure the audio output will contain at least 10000 samples, padthe input with silence if required:
apad=whole_len=10000
- *
- Use ffmpeg to pad the audio input with silence, so that thevideo stream will always result the shortest and will be converteduntil the end in the output file when using the shortestoption:
ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
aphaser
Add a phasing effect to the input audio.
A phaser filter creates series of peaks and troughs in the frequency spectrum.