@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=}. 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. @item ts_sync_mode How strictly to sync streams based on secondary input timestamps; it accepts one of the following values: @table @option @item default Frame from secondary input with the nearest lower or equal timestamp to the primary input frame. @item nearest Frame from secondary input with the absolute nearest timestamp to the primary input frame. @end table @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. @item precision Set which precision to use when processing samples. @table @option @item auto Auto pick internal sample format depending on other filters. @item float Always use single-floating point precision sample format. @item double Always use double-floating point precision sample format. @end table Default value is @code{auto}. @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 @subsection Commands This filter supports the all above options as @ref{commands}. @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 window, 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 overlap, 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 arorder, 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 threshold, 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 burst, 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 method, m Set overlap method. It accepts the following values: @table @option @item add, a Select overlap-add method. Even not interpolated samples are slightly changed with this method. @item save, 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 window, 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 overlap, 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 arorder, 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 threshold, 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 hsize, 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 method, m Set overlap method. It accepts the following values: @table @option @item add, a Select overlap-add method. Even not interpolated samples are slightly changed with this method. @item save, s Select overlap-save method. Not interpolated samples remain unchanged. @end table Default value is @code{a}. @end table @section adecorrelate Apply decorrelation to input audio stream. The filter accepts the following options: @table @option @item stages Set decorrelation stages of filtering. Allowed range is from 1 to 16. Default value is 6. @item seed Set random seed used for setting delay in samples across channels. @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 adrc Apply spectral dynamic range controller filter to input audio stream. A description of the accepted options follows. @table @option @item transfer Set the transfer expression. The expression can contain the following constants: @table @option @item ch current channel number @item sn current sample number @item nb_channels number of channels @item t timestamp expressed in seconds @item sr sample rate @item p current frequency power value, in dB @item f current frequency in Hz @end table Default value is @code{p}. @item attack Set the attack in milliseconds. Default is @code{50} milliseconds. Allowed range is from 1 to 1000 milliseconds. @item release Set the release in milliseconds. Default is @code{100} milliseconds. Allowed range is from 5 to 2000 milliseconds. @item channels Set which channels to filter, by default @code{all} channels in audio stream are filtered. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @subsection Examples @itemize @item Apply spectral compression to all frequencies with threshold of -50 dB and 1:6 ratio: @example adrc=transfer='if(gt(p,-50),-50+(p-(-50))/6,p)':attack=50:release=100 @end example @item Similar to above but with 1:2 ratio and filtering only front center channel: @example adrc=transfer='if(gt(p,-50),-50+(p-(-50))/2,p)':attack=50:release=100:channels=FC @end example @item Apply spectral noise gate to all frequencies with threshold of -85 dB and with short attack time and short release time: @example adrc=transfer='if(lte(p,-85),p-800,p)':attack=1:release=5 @end example @item Apply spectral expansion to all frequencies with threshold of -10 dB and 1:2 ratio: @example adrc=transfer='if(lt(p,-10),-10+(p-(-10))*2,p)':attack=50:release=100 @end example @item Apply limiter to max -60 dB to all frequencies, with attack of 2 ms and release of 10 ms: @example adrc=transfer='min(p,-60)':attack=2:release=10 @end example @end itemize @section adynamicequalizer Apply dynamic equalization to input audio stream. A description of the accepted options follows. @table @option @item threshold Set the detection threshold used to trigger equalization. Threshold detection is using bandpass filter. Default value is 0. Allowed range is from 0 to 100. @item dfrequency Set the detection frequency in Hz used for bandpass filter used to trigger equalization. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz. @item dqfactor Set the detection resonance factor for bandpass filter used to trigger equalization. Default value is 1. Allowed range is from 0.001 to 1000. @item tfrequency Set the target frequency of equalization filter. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz. @item tqfactor Set the target resonance factor for target equalization filter. Default value is 1. Allowed range is from 0.001 to 1000. @item attack Set the amount of milliseconds the signal from detection has to rise above the detection threshold before equalization starts. Default is 20. Allowed range is between 1 and 2000. @item release Set the amount of milliseconds the signal from detection has to fall below the detection threshold before equalization ends. Default is 200. Allowed range is between 1 and 2000. @item ratio Set the ratio by which the equalization gain is raised. Default is 1. Allowed range is between 0 and 30. @item makeup Set the makeup offset by which the equalization gain is raised. Default is 0. Allowed range is between 0 and 100. @item range Set the max allowed cut/boost amount. Default is 50. Allowed range is from 1 to 200. @item mode Set the mode of filter operation, can be one of the following: @table @samp @item listen Output only isolated bandpass signal. @item cut Cut frequencies above detection threshold. @item boost Boost frequencies bellow detection threshold. @end table Default mode is @samp{cut}. @item tftype Set the type of target filter, can be one of the following: @table @samp @item bell @item lowshelf @item highshelf @end table Default type is @samp{bell}. @item direction Set processing direction relative to threshold. @table @samp @item downward Boost or cut if threshhold is higher than detected volume. @item upward Boost or cut if threshhold is lower than detected volume. @end table Default direction is @samp{downward}. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @section adynamicsmooth Apply dynamic smoothing to input audio stream. A description of the accepted options follows. @table @option @item sensitivity Set an amount of sensitivity to frequency fluctations. Default is 2. Allowed range is from 0 to 1e+06. @item basefreq Set a base frequency for smoothing. Default value is 22050. Allowed range is from 2 to 1e+06. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @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 @section aexciter An exciter is used to produce high sound that is not present in the original signal. This is done by creating harmonic distortions of the signal which are restricted in range and added to the original signal. An Exciter raises the upper end of an audio signal without simply raising the higher frequencies like an equalizer would do to create a more "crisp" or "brilliant" sound. The filter accepts the following options: @table @option @item level_in Set input level prior processing of signal. Allowed range is from 0 to 64. Default value is 1. @item level_out Set output level after processing of signal. Allowed range is from 0 to 64. Default value is 1. @item amount Set the amount of harmonics added to original signal. Allowed range is from 0 to 64. Default value is 1. @item drive Set the amount of newly created harmonics. Allowed range is from 0.1 to 10. Default value is 8.5. @item blend Set the octave of newly created harmonics. Allowed range is from -10 to 10. Default value is 0. @item freq Set the lower frequency limit of producing harmonics in Hz. Allowed range is from 2000 to 12000 Hz. Default is 7500 Hz. @item ceil Set the upper frequency limit of producing harmonics. Allowed range is from 9999 to 20000 Hz. If value is lower than 10000 Hz no limit is applied. @item listen Mute the original signal and output only added harmonics. By default is disabled. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @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 @item silence Set the initial gain for fade-in or final gain for fade-out. Default value is @code{0.0}. @item unity Set the initial gain for fade-out or final gain for fade-in. Default value is @code{1.0}. @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 noise_reduction, nr Set the noise reduction in dB, allowed range is 0.01 to 97. Default value is 12 dB. @item noise_floor, nf Set the noise floor in dB, allowed range is -80 to -20. Default value is -50 dB. @item noise_type, nt Set the noise type. It accepts the following values: @table @option @item white, w Select white noise. @item vinyl, v Select vinyl noise. @item shellac, s Select shellac noise. @item custom, c Select custom noise, defined in @code{bn} option. Default value is white noise. @end table @item band_noise, bn Set custom band noise profile for every one of 15 bands. Bands are separated by ' ' or '|'. @item residual_floor, rf Set the residual floor in dB, allowed range is -80 to -20. Default value is -38 dB. @item track_noise, tn Enable noise floor tracking. By default is disabled. With this enabled, noise floor is automatically adjusted. @item track_residual, tr Enable residual tracking. By default is disabled. @item output_mode, om Set the output mode. It accepts the following values: @table @option @item input, i Pass input unchanged. @item output, o Pass noise filtered out. @item noise, n Pass only noise. Default value is @var{output}. @end table @item adaptivity, ad Set the adaptivity factor, used how fast to adapt gains adjustments per each frequency bin. Value @var{0} enables instant adaptation, while higher values react much slower. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}. @item floor_offset, fo Set the noise floor offset factor. This option is used to adjust offset applied to measured noise floor. It is only effective when noise floor tracking is enabled. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}. @item noise_link, nl Set the noise link used for multichannel audio. It accepts the following values: @table @option @item none Use unchanged channel's noise floor. @item min Use measured min noise floor of all channels. @item max Use measured max noise floor of all channels. @item average Use measured average noise floor of all channels. Default value is @var{min}. @end table @item band_multiplier, bm Set the band multiplier factor, used how much to spread bands across frequency bins. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}. @item sample_noise, sn Toggle capturing and measurement of noise profile from input audio. It accepts the following values: @table @option @item start, begin Start sample noise capture. @item stop, end Stop sample noise capture and measure new noise band profile. Default value is @code{none}. @end table @item gain_smooth, gs Set gain smooth spatial radius, used to smooth gains applied to each frequency bin. Useful to reduce random music noise artefacts. Higher values increases smoothing of gains. Allowed range is from @code{0} to @code{50}. Default value is @code{0}. @end table @subsection Commands This filter supports the some above mentioned options as @ref{commands}. @subsection Examples @itemize @item Reduce white noise by 10dB, and use previously measured noise floor of -40dB: @example afftdn=nr=10:nf=-40 @end example @item Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic tracking of noise floor so noise floor will gradually change during processing: @example afftdn=nr=10:nf=-80:tn=1 @end example @item Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile of first 0.4 seconds of input audio: @example asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40 @end example @end itemize @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. It accepts the following values: @table @samp @item rect @item bartlett @item hann, hanning @item hamming @item blackman @item welch @item flattop @item bharris @item bnuttall @item bhann @item sine @item nuttall @item lanczos @item gauss @item tukey @item dolph @item cauchy @item parzen @item poisson @item bohman @item kaiser @end table 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 @item Apply phase shift: @example afftfilt="real=re*cos(1)-im*sin(1):imag=re*sin(1)+im*cos(1)" @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. @item ac select AC gain. @item rms select RMS gain. @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{65536}. 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{65536}. 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}. @item precision Set which precision to use when processing samples. @table @option @item auto Auto pick internal sample format depending on other filters. @item float Always use single-floating point precision sample format. @item double Always use double-floating point precision sample format. @end table Default value is auto. @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 @item Apply true stereo processing given input stereo stream, and two stereo impulse responses for left and right channel, the impulse response files are files with names l_ir.wav and r_ir.wav: @example "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:gtype=gn:irgain=-5dB,pan=stereo|FL0 and <1 values will make less conservative gain adjustments, like when framelen option is set to smaller value, if framelen option value is compensated for non-zero overlap then gain adjustments will be smoother across time compared to zero overlap case. @item curve, v Specify the peak mapping curve expression which is going to be used when calculating gain applied to frames. The max output frame gain will still be limited by other options mentioned previously for this filter. The expression can contain the following constants: @table @option @item ch current channel number @item sn current sample number @item nb_channels number of channels @item t timestamp expressed in seconds @item sr sample rate @item p current frame peak value @end table @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 tdi @item tdii @item latt @item svf @item zdf @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 @item block_size, b Set block size used for reverse IIR processing. If this value is set to high enough value (higher than impulse response length truncated when reaches near zero values) filtering will become linear phase otherwise if not big enough it will just produce nasty artifacts. Note that filter delay will be exactly this many samples when set to non-zero value. @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. @example ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich" output.wav @end example @end itemize @section highpass Apply a high-pass filter with 3dB point frequency. The filter can be either single-pole, or double-pole (the default). The filter roll off at 6dB per pole per octave (20dB per pole per decade). The filter accepts the following options: @table @option @item frequency, f Set frequency in Hz. Default is 3000. @item poles, p Set number of poles. Default is 2. @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. Applies only to double-pole filter. The default is 0.707q and gives a Butterworth response. @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 tdi @item tdii @item latt @item svf @item zdf @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 @item block_size, b Set block size used for reverse IIR processing. If this value is set to high enough value (higher than impulse response length truncated when reaches near zero values) filtering will become linear phase otherwise if not big enough it will just produce nasty artifacts. Note that filter delay will be exactly this many samples when set to non-zero value. @end table @subsection Commands This filter supports the following commands: @table @option @item frequency, f Change highpass frequency. Syntax for the command is : "@var{frequency}" @item width_type, t Change highpass width_type. Syntax for the command is : "@var{width_type}" @item width, w Change highpass width. Syntax for the command is : "@var{width}" @item mix, m Change highpass mix. Syntax for the command is : "@var{mix}" @end table @section join Join multiple input streams into one multi-channel stream. It accepts the following parameters: @table @option @item inputs The number of input streams. It defaults to 2. @item channel_layout The desired output channel layout. It defaults to stereo. @item map Map channels from inputs to output. The argument is a '|'-separated list of mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}} form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel} can be either the name of the input channel (e.g. FL for front left) or its index in the specified input stream. @var{out_channel} is the name of the output channel. @end table The filter will attempt to guess the mappings when they are not specified explicitly. It does so by first trying to find an unused matching input channel and if that fails it picks the first unused input channel. Join 3 inputs (with properly set channel layouts): @example ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT @end example Build a 5.1 output from 6 single-channel streams: @example ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE' out @end example @section ladspa Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin. To enable compilation of this filter you need to configure FFmpeg with @code{--enable-ladspa}. @table @option @item file, f Specifies the name of LADSPA plugin library to load. If the environment variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in each one of the directories specified by the colon separated list in @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/}, @file{/usr/lib/ladspa/}. @item plugin, p Specifies the plugin within the library. Some libraries contain only one plugin, but others contain many of them. If this is not set filter will list all available plugins within the specified library. @item controls, c Set the '|' separated list of controls which are zero or more floating point values that determine the behavior of the loaded plugin (for example delay, threshold or gain). Controls need to be defined using the following syntax: c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where @var{valuei} is the value set on the @var{i}-th control. Alternatively they can be also defined using the following syntax: @var{value0}|@var{value1}|@var{value2}|..., where @var{valuei} is the value set on the @var{i}-th control. If @option{controls} is set to @code{help}, all available controls and their valid ranges are printed. @item sample_rate, s Specify the sample rate, default to 44100. Only used if plugin have zero inputs. @item nb_samples, n Set the number of samples per channel per each output frame, default is 1024. Only used if plugin have zero inputs. @item duration, d Set the minimum duration of the sourced audio. See @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils} for the accepted syntax. Note that the resulting duration may be greater than the specified duration, as the generated audio is always cut at the end of a complete frame. If not specified, or the expressed duration is negative, the audio is supposed to be generated forever. Only used if plugin have zero inputs. @item latency, l Enable latency compensation, by default is disabled. Only used if plugin have inputs. @end table @subsection Examples @itemize @item List all available plugins within amp (LADSPA example plugin) library: @example ladspa=file=amp @end example @item List all available controls and their valid ranges for @code{vcf_notch} plugin from @code{VCF} library: @example ladspa=f=vcf:p=vcf_notch:c=help @end example @item Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT) plugin library: @example ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12 @end example @item Add reverberation to the audio using TAP-plugins (Tom's Audio Processing plugins): @example ladspa=file=tap_reverb:tap_reverb @end example @item Generate white noise, with 0.2 amplitude: @example ladspa=file=cmt:noise_source_white:c=c0=.2 @end example @item Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the @code{C* Audio Plugin Suite} (CAPS) library: @example ladspa=file=caps:Click:c=c1=20' @end example @item Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect: @example ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2 @end example @item Increase volume by 20dB using fast lookahead limiter from Steve Harris @code{SWH Plugins} collection: @example ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2 @end example @item Attenuate low frequencies using Multiband EQ from Steve Harris @code{SWH Plugins} collection: @example ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0 @end example @item Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite} (CAPS) library: @example ladspa=caps:Narrower @end example @item Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library: @example ladspa=caps:White:.2 @end example @item Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library: @example ladspa=caps:Fractal:c=c1=1 @end example @item Dynamic volume normalization using @code{VLevel} plugin: @example ladspa=vlevel-ladspa:vlevel_mono @end example @end itemize @subsection Commands This filter supports the following commands: @table @option @item cN Modify the @var{N}-th control value. If the specified value is not valid, it is ignored and prior one is kept. @end table @section loudnorm EBU R128 loudness normalization. Includes both dynamic and linear normalization modes. Support for both single pass (livestreams, files) and double pass (files) modes. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately detect true peaks, the audio stream will be upsampled to 192 kHz. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate. The filter accepts the following options: @table @option @item I, i Set integrated loudness target. Range is -70.0 - -5.0. Default value is -24.0. @item LRA, lra Set loudness range target. Range is 1.0 - 50.0. Default value is 7.0. @item TP, tp Set maximum true peak. Range is -9.0 - +0.0. Default value is -2.0. @item measured_I, measured_i Measured IL of input file. Range is -99.0 - +0.0. @item measured_LRA, measured_lra Measured LRA of input file. Range is 0.0 - 99.0. @item measured_TP, measured_tp Measured true peak of input file. Range is -99.0 - +99.0. @item measured_thresh Measured threshold of input file. Range is -99.0 - +0.0. @item offset Set offset gain. Gain is applied before the true-peak limiter. Range is -99.0 - +99.0. Default is +0.0. @item linear Normalize by linearly scaling the source audio. @code{measured_I}, @code{measured_LRA}, @code{measured_TP}, and @code{measured_thresh} must all be specified. Target LRA shouldn't be lower than source LRA and the change in integrated loudness shouldn't result in a true peak which exceeds the target TP. If any of these conditions aren't met, normalization mode will revert to @var{dynamic}. Options are @code{true} or @code{false}. Default is @code{true}. @item dual_mono Treat mono input files as "dual-mono". If a mono file is intended for playback on a stereo system, its EBU R128 measurement will be perceptually incorrect. If set to @code{true}, this option will compensate for this effect. Multi-channel input files are not affected by this option. Options are true or false. Default is false. @item print_format Set print format for stats. Options are summary, json, or none. Default value is none. @end table @section lowpass Apply a low-pass filter with 3dB point frequency. The filter can be either single-pole or double-pole (the default). The filter roll off at 6dB per pole per octave (20dB per pole per decade). The filter accepts the following options: @table @option @item frequency, f Set frequency in Hz. Default is 500. @item poles, p Set number of poles. Default is 2. @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. Applies only to double-pole filter. The default is 0.707q and gives a Butterworth response. @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 tdi @item tdii @item latt @item svf @item zdf @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 @item block_size, b Set block size used for reverse IIR processing. If this value is set to high enough value (higher than impulse response length truncated when reaches near zero values) filtering will become linear phase otherwise if not big enough it will just produce nasty artifacts. Note that filter delay will be exactly this many samples when set to non-zero value. @end table @subsection Examples @itemize @item Lowpass only LFE channel, it LFE is not present it does nothing: @example lowpass=c=LFE @end example @end itemize @subsection Commands This filter supports the following commands: @table @option @item frequency, f Change lowpass frequency. Syntax for the command is : "@var{frequency}" @item width_type, t Change lowpass width_type. Syntax for the command is : "@var{width_type}" @item width, w Change lowpass width. Syntax for the command is : "@var{width}" @item mix, m Change lowpass mix. Syntax for the command is : "@var{mix}" @end table @section lv2 Load a LV2 (LADSPA Version 2) plugin. To enable compilation of this filter you need to configure FFmpeg with @code{--enable-lv2}. @table @option @item plugin, p Specifies the plugin URI. You may need to escape ':'. @item controls, c Set the '|' separated list of controls which are zero or more floating point values that determine the behavior of the loaded plugin (for example delay, threshold or gain). If @option{controls} is set to @code{help}, all available controls and their valid ranges are printed. @item sample_rate, s Specify the sample rate, default to 44100. Only used if plugin have zero inputs. @item nb_samples, n Set the number of samples per channel per each output frame, default is 1024. Only used if plugin have zero inputs. @item duration, d Set the minimum duration of the sourced audio. See @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils} for the accepted syntax. Note that the resulting duration may be greater than the specified duration, as the generated audio is always cut at the end of a complete frame. If not specified, or the expressed duration is negative, the audio is supposed to be generated forever. Only used if plugin have zero inputs. @end table @subsection Examples @itemize @item Apply bass enhancer plugin from Calf: @example lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2 @end example @item Apply vinyl plugin from Calf: @example lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5 @end example @item Apply bit crusher plugin from ArtyFX: @example lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3 @end example @end itemize @subsection Commands This filter supports all options that are exported by plugin as commands. @section mcompand Multiband Compress or expand the audio's dynamic range. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs. This is akin to the crossover of a loudspeaker, and results in flat frequency response when absent compander action. It accepts the following parameters: @table @option @item args This option syntax is: attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ... For explanation of each item refer to compand filter documentation. @end table @anchor{pan} @section pan Mix channels with specific gain levels. The filter accepts the output channel layout followed by a set of channels definitions. This filter is also designed to efficiently remap the channels of an audio stream. The filter accepts parameters of the form: "@var{l}|@var{outdef}|@var{outdef}|..." @table @option @item l output channel layout or number of channels @item outdef output channel specification, of the form: "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]" @item out_name output channel to define, either a channel name (FL, FR, etc.) or a channel number (c0, c1, etc.) @item gain multiplicative coefficient for the channel, 1 leaving the volume unchanged @item in_name input channel to use, see out_name for details; it is not possible to mix named and numbered input channels @end table If the `=' in a channel specification is replaced by `<', then the gains for that specification will be renormalized so that the total is 1, thus avoiding clipping noise. @subsection Mixing examples For example, if you want to down-mix from stereo to mono, but with a bigger factor for the left channel: @example pan=1c|c0=0.9*c0+0.1*c1 @end example A customized down-mix to stereo that works automatically for 3-, 4-, 5- and 7-channels surround: @example pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR @end example Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system that should be preferred (see "-ac" option) unless you have very specific needs. @subsection Remapping examples The channel remapping will be effective if, and only if: @itemize @item gain coefficients are zeroes or ones, @item only one input per channel output, @end itemize If all these conditions are satisfied, the filter will notify the user ("Pure channel mapping detected"), and use an optimized and lossless method to do the remapping. For example, if you have a 5.1 source and want a stereo audio stream by dropping the extra channels: @example pan="stereo| c0=FL | c1=FR" @end example Given the same source, you can also switch front left and front right channels and keep the input channel layout: @example pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5" @end example If the input is a stereo audio stream, you can mute the front left channel (and still keep the stereo channel layout) with: @example pan="stereo|c1=c1" @end example Still with a stereo audio stream input, you can copy the right channel in both front left and right: @example pan="stereo| c0=FR | c1=FR" @end example @section replaygain ReplayGain scanner filter. This filter takes an audio stream as an input and outputs it unchanged. At end of filtering it displays @code{track_gain} and @code{track_peak}. @section resample Convert the audio sample format, sample rate and channel layout. It is not meant to be used directly. @section rubberband Apply time-stretching and pitch-shifting with librubberband. To enable compilation of this filter, you need to configure FFmpeg with @code{--enable-librubberband}. The filter accepts the following options: @table @option @item tempo Set tempo scale factor. @item pitch Set pitch scale factor. @item transients Set transients detector. Possible values are: @table @var @item crisp @item mixed @item smooth @end table @item detector Set detector. Possible values are: @table @var @item compound @item percussive @item soft @end table @item phase Set phase. Possible values are: @table @var @item laminar @item independent @end table @item window Set processing window size. Possible values are: @table @var @item standard @item short @item long @end table @item smoothing Set smoothing. Possible values are: @table @var @item off @item on @end table @item formant Enable formant preservation when shift pitching. Possible values are: @table @var @item shifted @item preserved @end table @item pitchq Set pitch quality. Possible values are: @table @var @item quality @item speed @item consistency @end table @item channels Set channels. Possible values are: @table @var @item apart @item together @end table @end table @subsection Commands This filter supports the following commands: @table @option @item tempo Change filter tempo scale factor. Syntax for the command is : "@var{tempo}" @item pitch Change filter pitch scale factor. Syntax for the command is : "@var{pitch}" @end table @section sidechaincompress This filter acts like normal compressor but has the ability to compress detected signal using second input signal. It needs two input streams and returns one output stream. First input stream will be processed depending on second stream signal. The filtered signal then can be filtered with other filters in later stages of processing. See @ref{pan} and @ref{amerge} filter. 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 second stream raises above this level it will affect the gain reduction of first stream. By default is 0.125. Range is between 0.00097563 and 1. @item ratio Set a ratio about which the signal is reduced. 1:2 means that if the level raised 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 side-chain stream or the louder(@code{maximum}) channel of side-chain 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 mainly smoother. @item level_sc Set sidechain gain. Default is 1. Range is between 0.015625 and 64. @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}. @subsection Examples @itemize @item Full ffmpeg example taking 2 audio inputs, 1st input to be compressed depending on the signal of 2nd input and later compressed signal to be merged with 2nd input: @example ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge" @end example @end itemize @section sidechaingate A sidechain gate acts like a normal (wideband) gate but has the ability to filter the detected signal before sending it to the gain reduction stage. Normally a gate uses the full range signal to detect a level above the threshold. For example: If you cut all lower frequencies from your sidechain signal the gate will decrease the volume of your track only if not enough highs appear. With this technique you are able to reduce the resonation of a natural drum or remove "rumbling" of muted strokes from a heavily distorted guitar. It needs two input streams and returns one output stream. First input stream will be processed depending on second stream signal. The filter accepts the following options: @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 about 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 rms. Can be peak or rms. @item link Choose if the average level between all channels or the louder channel affects the reduction. Default is average. Can be average or maximum. @item level_sc Set sidechain gain. Default is 1. Range is from 0.015625 to 64. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @section silencedetect Detect silence in an audio stream. This filter logs a message when it detects that the input audio volume is less or equal to a noise tolerance value for a duration greater or equal to the minimum detected noise duration. The printed times and duration are expressed in seconds. The @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key is set on the first frame whose timestamp equals or exceeds the detection duration and it contains the timestamp of the first frame of the silence. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X} and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata keys are set on the first frame after the silence. If @option{mono} is enabled, and each channel is evaluated separately, the @code{.X} suffixed keys are used, and @code{X} corresponds to the channel number. The filter accepts the following options: @table @option @item noise, n Set noise tolerance. Can be specified in dB (in case "dB" is appended to the specified value) or amplitude ratio. Default is -60dB, or 0.001. @item duration, d Set silence duration until notification (default is 2 seconds). See @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils} for the accepted syntax. @item mono, m Process each channel separately, instead of combined. By default is disabled. @end table @subsection Examples @itemize @item Detect 5 seconds of silence with -50dB noise tolerance: @example silencedetect=n=-50dB:d=5 @end example @item Complete example with @command{ffmpeg} to detect silence with 0.0001 noise tolerance in @file{silence.mp3}: @example ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null - @end example @end itemize @section silenceremove Remove silence from the beginning, middle or end of the audio. The filter accepts the following options: @table @option @item start_periods This value is used to indicate if audio should be trimmed at beginning of the audio. A value of zero indicates no silence should be trimmed from the beginning. When specifying a non-zero value, it trims audio up until it finds non-silence. Normally, when trimming silence from beginning of audio the @var{start_periods} will be @code{1} but it can be increased to higher values to trim all audio up to specific count of non-silence periods. Default value is @code{0}. @item start_duration Specify the amount of time that non-silence must be detected before it stops trimming audio. By increasing the duration, bursts of noises can be treated as silence and trimmed off. Default value is @code{0}. @item start_threshold This indicates what sample value should be treated as silence. For digital audio, a value of @code{0} may be fine but for audio recorded from analog, you may wish to increase the value to account for background noise. Can be specified in dB (in case "dB" is appended to the specified value) or amplitude ratio. Default value is @code{0}. @item start_silence Specify max duration of silence at beginning that will be kept after trimming. Default is 0, which is equal to trimming all samples detected as silence. @item start_mode Specify mode of detection of silence end in start of multi-channel audio. Can be @var{any} or @var{all}. Default is @var{any}. With @var{any}, any sample that is detected as non-silence will cause stopped trimming of silence. With @var{all}, only if all channels are detected as non-silence will cause stopped trimming of silence. @item stop_periods Set the count for trimming silence from the end of audio. To remove silence from the middle of a file, specify a @var{stop_periods} that is negative. This value is then treated as a positive value and is used to indicate the effect should restart processing as specified by @var{start_periods}, making it suitable for removing periods of silence in the middle of the audio. Default value is @code{0}. @item stop_duration Specify a duration of silence that must exist before audio is not copied any more. By specifying a higher duration, silence that is wanted can be left in the audio. Default value is @code{0}. @item stop_threshold This is the same as @option{start_threshold} but for trimming silence from the end of audio. Can be specified in dB (in case "dB" is appended to the specified value) or amplitude ratio. Default value is @code{0}. @item stop_silence Specify max duration of silence at end that will be kept after trimming. Default is 0, which is equal to trimming all samples detected as silence. @item stop_mode Specify mode of detection of silence start in end of multi-channel audio. Can be @var{any} or @var{all}. Default is @var{any}. With @var{any}, any sample that is detected as non-silence will cause stopped trimming of silence. With @var{all}, only if all channels are detected as non-silence will cause stopped trimming of silence. @item detection Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster and works better with digital silence which is exactly 0. Default value is @code{rms}. @item window Set duration in number of seconds used to calculate size of window in number of samples for detecting silence. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}. @end table @subsection Examples @itemize @item The following example shows how this filter can be used to start a recording that does not contain the delay at the start which usually occurs between pressing the record button and the start of the performance: @example silenceremove=start_periods=1:start_duration=5:start_threshold=0.02 @end example @item Trim all silence encountered from beginning to end where there is more than 1 second of silence in audio: @example silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB @end example @item Trim all digital silence samples, using peak detection, from beginning to end where there is more than 0 samples of digital silence in audio and digital silence is detected in all channels at same positions in stream: @example silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0 @end example @end itemize @section sofalizer SOFAlizer uses head-related transfer functions (HRTFs) to create virtual loudspeakers around the user for binaural listening via headphones (audio formats up to 9 channels supported). The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database). SOFAlizer is developed at the Acoustics Research Institute (ARI) of the Austrian Academy of Sciences. To enable compilation of this filter you need to configure FFmpeg with @code{--enable-libmysofa}. The filter accepts the following options: @table @option @item sofa Set the SOFA file used for rendering. @item gain Set gain applied to audio. Value is in dB. Default is 0. @item rotation Set rotation of virtual loudspeakers in deg. Default is 0. @item elevation Set elevation of virtual speakers in deg. Default is 0. @item radius Set distance in meters between loudspeakers and the listener with near-field HRTFs. Default is 1. @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 speakers Set custom positions of virtual loudspeakers. Syntax for this option is: [| |...]. Each virtual loudspeaker is described with short channel name following with azimuth and elevation in degrees. Each virtual loudspeaker description is separated by '|'. For example to override front left and front right channel positions use: 'speakers=FL 45 15|FR 345 15'. Descriptions with unrecognised channel names are ignored. @item lfegain Set custom gain for LFE channels. Value is in dB. Default is 0. @item framesize Set custom frame size in number of samples. Default is 1024. Allowed range is from 1024 to 96000. Only used if option @samp{type} is set to @var{freq}. @item normalize Should all IRs be normalized upon importing SOFA file. By default is enabled. @item interpolate Should nearest IRs be interpolated with neighbor IRs if exact position does not match. By default is disabled. @item minphase Minphase all IRs upon loading of SOFA file. By default is disabled. @item anglestep Set neighbor search angle step. Only used if option @var{interpolate} is enabled. @item radstep Set neighbor search radius step. Only used if option @var{interpolate} is enabled. @end table @subsection Examples @itemize @item Using ClubFritz6 sofa file: @example sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1 @end example @item Using ClubFritz12 sofa file and bigger radius with small rotation: @example sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5 @end example @item Similar as above but with custom speaker positions for front left, front right, back left and back right and also with custom gain: @example "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28" @end example @end itemize @section speechnorm Speech Normalizer. This filter expands or compresses each half-cycle of audio samples (local set of samples all above or all below zero and between two nearest zero crossings) depending on threshold value, so audio reaches target peak value under conditions controlled by below options. The filter accepts the following options: @table @option @item peak, p Set the expansion target peak value. This specifies the highest allowed absolute amplitude level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0. @item expansion, e Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0. This option controls maximum local half-cycle of samples expansion. The maximum expansion would be such that local peak value reaches target peak value but never to surpass it and that ratio between new and previous peak value does not surpass this option value. @item compression, c Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0. This option controls maximum local half-cycle of samples compression. This option is used only if @option{threshold} option is set to value greater than 0.0, then in such cases when local peak is lower or same as value set by @option{threshold} all samples belonging to that peak's half-cycle will be compressed by current compression factor. @item threshold, t Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0. This option specifies which half-cycles of samples will be compressed and which will be expanded. Any half-cycle samples with their local peak value below or same as this option value will be compressed by current compression factor, otherwise, if greater than threshold value they will be expanded with expansion factor so that it could reach peak target value but never surpass it. @item raise, r Set the expansion raising amount per each half-cycle of samples. Default value is 0.001. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per each new half-cycle until it reaches @option{expansion} value. Setting this options too high may lead to distortions. @item fall, f Set the compression raising amount per each half-cycle of samples. Default value is 0.001. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per each new half-cycle until it reaches @option{compression} value. @item channels, h Specify which channels to filter, by default all available channels are filtered. @item invert, i Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold} option. When enabled any half-cycle of samples with their local peak value below or same as @option{threshold} option will be expanded otherwise it will be compressed. @item link, l Link channels when calculating gain applied to each filtered channel sample, by default is disabled. When disabled each filtered channel gain calculation is independent, otherwise when this option is enabled the minimum of all possible gains for each filtered channel is used. @item rms, m Set the expansion target RMS value. This specifies the highest allowed RMS level for the normalized audio input. Default value is 0.0, thus disabled. Allowed range is from 0.0 to 1.0. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @subsection Examples @itemize @item Weak and slow amplification: @example speechnorm=e=3:r=0.00001:l=1 @end example @item Moderate and slow amplification: @example speechnorm=e=6.25:r=0.00001:l=1 @end example @item Strong and fast amplification: @example speechnorm=e=12.5:r=0.0001:l=1 @end example @item Very strong and fast amplification: @example speechnorm=e=25:r=0.0001:l=1 @end example @item Extreme and fast amplification: @example speechnorm=e=50:r=0.0001:l=1 @end example @end itemize @section stereotools This filter has some handy utilities to manage stereo signals, for converting M/S stereo recordings to L/R signal while having control over the parameters or spreading the stereo image of master track. The filter accepts the following options: @table @option @item level_in Set input level before filtering for both channels. Defaults is 1. Allowed range is from 0.015625 to 64. @item level_out Set output level after filtering for both channels. Defaults is 1. Allowed range is from 0.015625 to 64. @item balance_in Set input balance between both channels. Default is 0. Allowed range is from -1 to 1. @item balance_out Set output balance between both channels. Default is 0. Allowed range is from -1 to 1. @item softclip Enable softclipping. Results in analog distortion instead of harsh digital 0dB clipping. Disabled by default. @item mutel Mute the left channel. Disabled by default. @item muter Mute the right channel. Disabled by default. @item phasel Change the phase of the left channel. Disabled by default. @item phaser Change the phase of the right channel. Disabled by default. @item mode Set stereo mode. Available values are: @table @samp @item lr>lr Left/Right to Left/Right, this is default. @item lr>ms Left/Right to Mid/Side. @item ms>lr Mid/Side to Left/Right. @item lr>ll Left/Right to Left/Left. @item lr>rr Left/Right to Right/Right. @item lr>l+r Left/Right to Left + Right. @item lr>rl Left/Right to Right/Left. @item ms>ll Mid/Side to Left/Left. @item ms>rr Mid/Side to Right/Right. @item ms>rl Mid/Side to Right/Left. @item lr>l-r Left/Right to Left - Right. @end table @item slev Set level of side signal. Default is 1. Allowed range is from 0.015625 to 64. @item sbal Set balance of side signal. Default is 0. Allowed range is from -1 to 1. @item mlev Set level of the middle signal. Default is 1. Allowed range is from 0.015625 to 64. @item mpan Set middle signal pan. Default is 0. Allowed range is from -1 to 1. @item base Set stereo base between mono and inversed channels. Default is 0. Allowed range is from -1 to 1. @item delay Set delay in milliseconds how much to delay left from right channel and vice versa. Default is 0. Allowed range is from -20 to 20. @item sclevel Set S/C level. Default is 1. Allowed range is from 1 to 100. @item phase Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360. @item bmode_in, bmode_out Set balance mode for balance_in/balance_out option. Can be one of the following: @table @samp @item balance Classic balance mode. Attenuate one channel at time. Gain is raised up to 1. @item amplitude Similar as classic mode above but gain is raised up to 2. @item power Equal power distribution, from -6dB to +6dB range. @end table @end table @subsection Commands This filter supports the all above options as @ref{commands}. @subsection Examples @itemize @item Apply karaoke like effect: @example stereotools=mlev=0.015625 @end example @item Convert M/S signal to L/R: @example "stereotools=mode=ms>lr" @end example @end itemize @section stereowiden This filter enhance the stereo effect by suppressing signal common to both channels and by delaying the signal of left into right and vice versa, thereby widening the stereo effect. The filter accepts the following options: @table @option @item delay Time in milliseconds of the delay of left signal into right and vice versa. Default is 20 milliseconds. @item feedback Amount of gain in delayed signal into right and vice versa. Gives a delay effect of left signal in right output and vice versa which gives widening effect. Default is 0.3. @item crossfeed Cross feed of left into right with inverted phase. This helps in suppressing the mono. If the value is 1 it will cancel all the signal common to both channels. Default is 0.3. @item drymix Set level of input signal of original channel. Default is 0.8. @end table @subsection Commands This filter supports the all above options except @code{delay} as @ref{commands}. @section superequalizer Apply 18 band equalizer. The filter accepts the following options: @table @option @item 1b Set 65Hz band gain. @item 2b Set 92Hz band gain. @item 3b Set 131Hz band gain. @item 4b Set 185Hz band gain. @item 5b Set 262Hz band gain. @item 6b Set 370Hz band gain. @item 7b Set 523Hz band gain. @item 8b Set 740Hz band gain. @item 9b Set 1047Hz band gain. @item 10b Set 1480Hz band gain. @item 11b Set 2093Hz band gain. @item 12b Set 2960Hz band gain. @item 13b Set 4186Hz band gain. @item 14b Set 5920Hz band gain. @item 15b Set 8372Hz band gain. @item 16b Set 11840Hz band gain. @item 17b Set 16744Hz band gain. @item 18b Set 20000Hz band gain. @end table @section surround Apply audio surround upmix filter. This filter allows to produce multichannel output from audio stream. The filter accepts the following options: @table @option @item chl_out Set output channel layout. By default, this is @var{5.1}. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils} for the required syntax. @item chl_in Set input channel layout. By default, this is @var{stereo}. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils} for the required syntax. @item level_in Set input volume level. By default, this is @var{1}. @item level_out Set output volume level. By default, this is @var{1}. @item lfe Enable LFE channel output if output channel layout has it. By default, this is enabled. @item lfe_low Set LFE low cut off frequency. By default, this is @var{128} Hz. @item lfe_high Set LFE high cut off frequency. By default, this is @var{256} Hz. @item lfe_mode Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}. In @var{add} mode, LFE channel is created from input audio and added to output. In @var{sub} mode, LFE channel is created from input audio and added to output but also all non-LFE output channels are subtracted with output LFE channel. @item smooth Set temporal smoothness strength, used to gradually change factors when transforming stereo sound in time. Allowed range is from @var{0.0} to @var{1.0}. Useful to improve output quality with @var{focus} option values greater than @var{0.0}. Default is @var{0.0}. Only values inside this range and without edges are effective. @item angle Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}. Default is @var{90}. @item focus Set focus of stereo surround transform, Allowed range is from @var{-1} to @var{1}. Default is @var{0}. @item fc_in Set front center input volume. By default, this is @var{1}. @item fc_out Set front center output volume. By default, this is @var{1}. @item fl_in Set front left input volume. By default, this is @var{1}. @item fl_out Set front left output volume. By default, this is @var{1}. @item fr_in Set front right input volume. By default, this is @var{1}. @item fr_out Set front right output volume. By default, this is @var{1}. @item sl_in Set side left input volume. By default, this is @var{1}. @item sl_out Set side left output volume. By default, this is @var{1}. @item sr_in Set side right input volume. By default, this is @var{1}. @item sr_out Set side right output volume. By default, this is @var{1}. @item bl_in Set back left input volume. By default, this is @var{1}. @item bl_out Set back left output volume. By default, this is @var{1}. @item br_in Set back right input volume. By default, this is @var{1}. @item br_out Set back right output volume. By default, this is @var{1}. @item bc_in Set back center input volume. By default, this is @var{1}. @item bc_out Set back center output volume. By default, this is @var{1}. @item lfe_in Set LFE input volume. By default, this is @var{1}. @item lfe_out Set LFE output volume. By default, this is @var{1}. @item allx Set spread usage of stereo image across X axis for all channels. Allowed range is from @var{-1} to @var{15}. By default this value is negative @var{-1}, and thus unused. @item ally Set spread usage of stereo image across Y axis for all channels. Allowed range is from @var{-1} to @var{15}. By default this value is negative @var{-1}, and thus unused. @item fcx, flx, frx, blx, brx, slx, srx, bcx Set spread usage of stereo image across X axis for each channel. Allowed range is from @var{0.06} to @var{15}. By default this value is @var{0.5}. @item fcy, fly, fry, bly, bry, sly, sry, bcy Set spread usage of stereo image across Y axis for each channel. Allowed range is from @var{0.06} to @var{15}. By default this value is @var{0.5}. @item win_size Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}. @item win_func Set window function. It accepts the following values: @table @samp @item rect @item bartlett @item hann, hanning @item hamming @item blackman @item welch @item flattop @item bharris @item bnuttall @item bhann @item sine @item nuttall @item lanczos @item gauss @item tukey @item dolph @item cauchy @item parzen @item poisson @item bohman @item kaiser @end table 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.5}. @end table @section tiltshelf Boost or cut the lower frequencies and cut or boost higher 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{3000} 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 poles, p Set number of poles. Default is 2. @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 tdi @item tdii @item latt @item svf @item zdf @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 @item block_size, b Set block size used for reverse IIR processing. If this value is set to high enough value (higher than impulse response length truncated when reaches near zero values) filtering will become linear phase otherwise if not big enough it will just produce nasty artifacts. Note that filter delay will be exactly this many samples when set to non-zero value. @end table @subsection Commands This filter supports some options as @ref{commands}. @section treble, highshelf Boost or cut treble (upper) 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 whichever is the lower of ~22 kHz and the Nyquist frequency. 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{3000} 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 poles, p Set number of poles. Default is 2. @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 tdi @item tdii @item latt @item svf @item zdf @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 @item block_size, b Set block size used for reverse IIR processing. If this value is set to high enough value (higher than impulse response length truncated when reaches near zero values) filtering will become linear phase otherwise if not big enough it will just produce nasty artifacts. Note that filter delay will be exactly this many samples when set to non-zero value. @end table @subsection Commands This filter supports the following commands: @table @option @item frequency, f Change treble frequency. Syntax for the command is : "@var{frequency}" @item width_type, t Change treble width_type. Syntax for the command is : "@var{width_type}" @item width, w Change treble width. Syntax for the command is : "@var{width}" @item gain, g Change treble gain. Syntax for the command is : "@var{gain}" @item mix, m Change treble mix. Syntax for the command is : "@var{mix}" @end table @section tremolo Sinusoidal amplitude modulation. The filter accepts the following options: @table @option @item f Modulation frequency in Hertz. Modulation frequencies in the subharmonic range (20 Hz or lower) will result in a tremolo effect. This filter may also be used as a ring modulator by specifying a modulation frequency higher than 20 Hz. Range is 0.1 - 20000.0. Default value is 5.0 Hz. @item d Depth of modulation as a percentage. Range is 0.0 - 1.0. Default value is 0.5. @end table @section vibrato Sinusoidal phase modulation. The filter accepts the following options: @table @option @item f Modulation frequency in Hertz. Range is 0.1 - 20000.0. Default value is 5.0 Hz. @item d Depth of modulation as a percentage. Range is 0.0 - 1.0. Default value is 0.5. @end table @section virtualbass Apply audio Virtual Bass filter. This filter accepts stereo input and produce stereo with LFE (2.1) channels output. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels. This filter outputs front left and front right channels unchanged as available in stereo input. The filter accepts the following options: @table @option @item cutoff Set the virtual bass cutoff frequency. Default value is 250 Hz. Allowed range is from 100 to 500 Hz. @item strength Set the virtual bass strength. Allowed range is from 0.5 to 3. Default value is 3. @end table @section volume Adjust the input audio volume. It accepts the following parameters: @table @option @item volume Set audio volume expression. Output values are clipped to the maximum value. The output audio volume is given by the relation: @example @var{output_volume} = @var{volume} * @var{input_volume} @end example The default value for @var{volume} is "1.0". @item precision This parameter represents the mathematical precision. It determines which input sample formats will be allowed, which affects the precision of the volume scaling. @table @option @item fixed 8-bit fixed-point; this limits input sample format to U8, S16, and S32. @item float 32-bit floating-point; this limits input sample format to FLT. (default) @item double 64-bit floating-point; this limits input sample format to DBL. @end table @item replaygain Choose the behaviour on encountering ReplayGain side data in input frames. @table @option @item drop Remove ReplayGain side data, ignoring its contents (the default). @item ignore Ignore ReplayGain side data, but leave it in the frame. @item track Prefer the track gain, if present. @item album Prefer the album gain, if present. @end table @item replaygain_preamp Pre-amplification gain in dB to apply to the selected replaygain gain. Default value for @var{replaygain_preamp} is 0.0. @item replaygain_noclip Prevent clipping by limiting the gain applied. Default value for @var{replaygain_noclip} is 1. @item eval Set when the volume expression is evaluated. It accepts the following values: @table @samp @item once only evaluate expression once during the filter initialization, or when the @samp{volume} command is sent @item frame evaluate expression for each incoming frame @end table Default value is @samp{once}. @end table The volume expression can contain the following parameters. @table @option @item n frame number (starting at zero) @item nb_channels number of channels @item nb_consumed_samples number of samples consumed by the filter @item nb_samples number of samples in the current frame @item pos original frame position in the file @item pts frame PTS @item sample_rate sample rate @item startpts PTS at start of stream @item startt time at start of stream @item t frame time @item tb timestamp timebase @item volume last set volume value @end table Note that when @option{eval} is set to @samp{once} only the @var{sample_rate} and @var{tb} variables are available, all other variables will evaluate to NAN. @subsection Commands This filter supports the following commands: @table @option @item volume Modify the volume expression. The command accepts the same syntax of the corresponding option. If the specified expression is not valid, it is kept at its current value. @end table @subsection Examples @itemize @item Halve the input audio volume: @example volume=volume=0.5 volume=volume=1/2 volume=volume=-6.0206dB @end example In all the above example the named key for @option{volume} can be omitted, for example like in: @example volume=0.5 @end example @item Increase input audio power by 6 decibels using fixed-point precision: @example volume=volume=6dB:precision=fixed @end example @item Fade volume after time 10 with an annihilation period of 5 seconds: @example volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame @end example @end itemize @section volumedetect Detect the volume of the input video. The filter has no parameters. It supports only 16-bit signed integer samples, so the input will be converted when needed. Statistics about the volume will be printed in the log when the input stream end is reached. In particular it will show the mean volume (root mean square), maximum volume (on a per-sample basis), and the beginning of a histogram of the registered volume values (from the maximum value to a cumulated 1/1000 of the samples). All volumes are in decibels relative to the maximum PCM value. @subsection Examples Here is an excerpt of the output: @example [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6 [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62 [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286 [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042 [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551 [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609 [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409 @end example It means that: @itemize @item The mean square energy is approximately -27 dB, or 10^-2.7. @item The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB. @item There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc. @end itemize In other words, raising the volume by +4 dB does not cause any clipping, raising it by +5 dB causes clipping for 6 samples, etc. @c man end AUDIO FILTERS @chapter Audio Sources @c man begin AUDIO SOURCES Below is a description of the currently available audio sources. @section abuffer Buffer audio frames, and make them available to the filter chain. This source is mainly intended for a programmatic use, in particular through the interface defined in @file{libavfilter/buffersrc.h}. It accepts the following parameters: @table @option @item time_base The timebase which will be used for timestamps of submitted frames. It must be either a floating-point number or in @var{numerator}/@var{denominator} form. @item sample_rate The sample rate of the incoming audio buffers. @item sample_fmt The sample format of the incoming audio buffers. Either a sample format name or its corresponding integer representation from the enum AVSampleFormat in @file{libavutil/samplefmt.h} @item channel_layout The channel layout of the incoming audio buffers. Either a channel layout name from channel_layout_map in @file{libavutil/channel_layout.c} or its corresponding integer representation from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h} @item channels The number of channels of the incoming audio buffers. If both @var{channels} and @var{channel_layout} are specified, then they must be consistent. @end table @subsection Examples @example abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo @end example will instruct the source to accept planar 16bit signed stereo at 44100Hz. Since the sample format with name "s16p" corresponds to the number 6 and the "stereo" channel layout corresponds to the value 0x3, this is equivalent to: @example abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3 @end example @section aevalsrc Generate an audio signal specified by an expression. This source accepts in input one or more expressions (one for each channel), which are evaluated and used to generate a corresponding audio signal. This source accepts the following options: @table @option @item exprs Set the '|'-separated expressions list for each separate channel. In case the @option{channel_layout} option is not specified, the selected channel layout depends on the number of provided expressions. Otherwise the last specified expression is applied to the remaining output channels. @item channel_layout, c Set the channel layout. The number of channels in the specified layout must be equal to the number of specified expressions. @item duration, d Set the minimum duration of the sourced audio. See @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils} for the accepted syntax. Note that the resulting duration may be greater than the specified duration, as the generated audio is always cut at the end of a complete frame. If not specified, or the expressed duration is negative, the audio is supposed to be generated forever. @item nb_samples, n Set the number of samples per channel per each output frame, default to 1024. @item sample_rate, s Specify the sample rate, default to 44100. @end table Each expression in @var{exprs} can contain the following constants: @table @option @item n number of the evaluated sample, starting from 0 @item t time of the evaluated sample expressed in seconds, starting from 0 @item s sample rate @end table @subsection Examples @itemize @item Generate silence: @example aevalsrc=0 @end example @item Generate a sin signal with frequency of 440 Hz, set sample rate to 8000 Hz: @example aevalsrc="sin(440*2*PI*t):s=8000" @end example @item Generate a two channels signal, specify the channel layout (Front Center + Back Center) explicitly: @example aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC" @end example @item Generate white noise: @example aevalsrc="-2+random(0)" @end example @item Generate an amplitude modulated signal: @example aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)" @end example @item Generate 2.5 Hz binaural beats on a 360 Hz carrier: @example aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)" @end example @end itemize @section afirsrc Generate a FIR coefficients using frequency sampling method. The resulting stream can be used with @ref{afir} filter for filtering the audio signal. The filter accepts the following options: @table @option @item taps, t Set number of filter coefficents in output audio stream. Default value is 1025. @item frequency, f Set frequency points from where magnitude and phase are set. This must be in non decreasing order, and first element must be 0, while last element must be 1. Elements are separated by white spaces. @item magnitude, m Set magnitude value for every frequency point set by @option{frequency}. Number of values must be same as number of frequency points. Values are separated by white spaces. @item phase, p Set phase value for every frequency point set by @option{frequency}. Number of values must be same as number of frequency points. Values are separated by white spaces. @item sample_rate, r Set sample rate, default is 44100. @item nb_samples, n Set number of samples per each frame. Default is 1024. @item win_func, w Set window function. Default is blackman. @end table @section anullsrc The null audio source, return unprocessed audio frames. It is mainly useful as a template and to be employed in analysis / debugging tools, or as the source for filters which ignore the input data (for example the sox synth filter). This source accepts the following options: @table @option @item channel_layout, cl Specifies the channel layout, and can be either an integer or a string representing a channel layout. The default value of @var{channel_layout} is "stereo". Check the channel_layout_map definition in @file{libavutil/channel_layout.c} for the mapping between strings and channel layout values. @item sample_rate, r Specifies the sample rate, and defaults to 44100. @item nb_samples, n Set the number of samples per requested frames. @item duration, d Set the duration of the sourced audio. See @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils} for the accepted syntax. If not specified, or the expressed duration is negative, the audio is supposed to be generated forever. @end table @subsection Examples @itemize @item Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO. @example anullsrc=r=48000:cl=4 @end example @item Do the same operation with a more obvious syntax: @example anullsrc=r=48000:cl=mono @end example @end itemize All the parameters need to be explicitly defined. @section flite Synthesize a voice utterance using the libflite library. To enable compilation of this filter you need to configure FFmpeg with @code{--enable-libflite}. Note that versions of the flite library prior to 2.0 are not thread-safe. The filter accepts the following options: @table @option @item list_voices If set to 1, list the names of the available voices and exit immediately. Default value is 0. @item nb_samples, n Set the maximum number of samples per frame. Default value is 512. @item textfile Set the filename containing the text to speak. @item text Set the text to speak. @item voice, v Set the voice to use for the speech synthesis. Default value is @code{kal}. See also the @var{list_voices} option. @end table @subsection Examples @itemize @item Read from file @file{speech.txt}, and synthesize the text using the standard flite voice: @example flite=textfile=speech.txt @end example @item Read the specified text selecting the @code{slt} voice: @example flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt @end example @item Input text to ffmpeg: @example ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt @end example @item Make @file{ffplay} speak the specified text, using @code{flite} and the @code{lavfi} device: @example ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.' @end example @end itemize For more information about libflite, check: @url{http://www.festvox.org/flite/} @section anoisesrc Generate a noise audio signal. The filter accepts the following options: @table @option @item sample_rate, r Specify the sample rate. Default value is 48000 Hz. @item amplitude, a Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value is 1.0. @item duration, d Specify the duration of the generated audio stream. Not specifying this option results in noise with an infinite length. @item color, colour, c Specify the color of noise. Available noise colors are white, pink, brown, blue, violet and velvet. Default color is white. @item seed, s Specify a value used to seed the PRNG. @item nb_samples, n Set the number of samples per each output frame, default is 1024. @end table @subsection Examples @itemize @item Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5: @example anoisesrc=d=60:c=pink:r=44100:a=0.5 @end example @end itemize @section hilbert Generate odd-tap Hilbert transform FIR coefficients. The resulting stream can be used with @ref{afir} filter for phase-shifting the signal by 90 degrees. This is used in many matrix coding schemes and for analytic signal generation. The process is often written as a multiplication by i (or j), the imaginary unit. The filter accepts the following options: @table @option @item sample_rate, s Set sample rate, default is 44100. @item taps, t Set length of FIR filter, default is 22051. @item nb_samples, n Set number of samples per each frame. @item win_func, w Set window function to be used when generating FIR coefficients. @end table @section sinc Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients. The resulting stream can be used with @ref{afir} filter for filtering the audio signal. The filter accepts the following options: @table @option @item sample_rate, r Set sample rate, default is 44100. @item nb_samples, n Set number of samples per each frame. Default is 1024. @item hp Set high-pass frequency. Default is 0. @item lp Set low-pass frequency. Default is 0. If high-pass frequency is lower than low-pass frequency and low-pass frequency is higher than 0 then filter will create band-pass filter coefficients, otherwise band-reject filter coefficients. @item phase Set filter phase response. Default is 50. Allowed range is from 0 to 100. @item beta Set Kaiser window beta. @item att Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB. @item round Enable rounding, by default is disabled. @item hptaps Set number of taps for high-pass filter. @item lptaps Set number of taps for low-pass filter. @end table @section sine Generate an audio signal made of a sine wave with amplitude 1/8. The audio signal is bit-exact. The filter accepts the following options: @table @option @item frequency, f Set the carrier frequency. Default is 440 Hz. @item beep_factor, b Enable a periodic beep every second with frequency @var{beep_factor} times the carrier frequency. Default is 0, meaning the beep is disabled. @item sample_rate, r Specify the sample rate, default is 44100. @item duration, d Specify the duration of the generated audio stream. @item samples_per_frame Set the number of samples per output frame. The expression can contain the following constants: @table @option @item n The (sequential) number of the output audio frame, starting from 0. @item pts The PTS (Presentation TimeStamp) of the output audio frame, expressed in @var{TB} units. @item t The PTS of the output audio frame, expressed in seconds. @item TB The timebase of the output audio frames. @end table Default is @code{1024}. @end table @subsection Examples @itemize @item Generate a simple 440 Hz sine wave: @example sine @end example @item Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds: @example sine=220:4:d=5 sine=f=220:b=4:d=5 sine=frequency=220:beep_factor=4:duration=5 @end example @item Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC pattern: @example sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))' @end example @end itemize @c man end AUDIO SOURCES @chapter Audio Sinks @c man begin AUDIO SINKS Below is a description of the currently available audio sinks. @section abuffersink Buffer audio frames, and make them available to the end of filter chain. This sink is mainly intended for programmatic use, in particular through the interface defined in @file{libavfilter/buffersink.h} or the options system. It accepts a pointer to an AVABufferSinkContext structure, which defines the incoming buffers' formats, to be passed as the opaque parameter to @code{avfilter_init_filter} for initialization. @section anullsink Null audio sink; do absolutely nothing with the input audio. It is mainly useful as a template and for use in analysis / debugging tools. @c man end AUDIO SINKS @chapter Video Filters @c man begin VIDEO 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 video filters included in your build. Below is a description of the currently available video filters. @section addroi Mark a region of interest in a video frame. The frame data is passed through unchanged, but metadata is attached to the frame indicating regions of interest which can affect the behaviour of later encoding. Multiple regions can be marked by applying the filter multiple times. @table @option @item x Region distance in pixels from the left edge of the frame. @item y Region distance in pixels from the top edge of the frame. @item w Region width in pixels. @item h Region height in pixels. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions, and may contain the following variables: @table @option @item iw Width of the input frame. @item ih Height of the input frame. @end table @item qoffset Quantisation offset to apply within the region. This must be a real value in the range -1 to +1. A value of zero indicates no quality change. A negative value asks for better quality (less quantisation), while a positive value asks for worse quality (greater quantisation). The range is calibrated so that the extreme values indicate the largest possible offset - if the rest of the frame is encoded with the worst possible quality, an offset of -1 indicates that this region should be encoded with the best possible quality anyway. Intermediate values are then interpolated in some codec-dependent way. For example, in 10-bit H.264 the quantisation parameter varies between -12 and 51. A typical qoffset value of -1/10 therefore indicates that this region should be encoded with a QP around one-tenth of the full range better than the rest of the frame. So, if most of the frame were to be encoded with a QP of around 30, this region would get a QP of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3). An extreme value of -1 would indicate that this region should be encoded with the best possible quality regardless of the treatment of the rest of the frame - that is, should be encoded at a QP of -12. @item clear If set to true, remove any existing regions of interest marked on the frame before adding the new one. @end table @subsection Examples @itemize @item Mark the centre quarter of the frame as interesting. @example addroi=iw/4:ih/4:iw/2:ih/2:-1/10 @end example @item Mark the 100-pixel-wide region on the left edge of the frame as very uninteresting (to be encoded at much lower quality than the rest of the frame). @example addroi=0:0:100:ih:+1/5 @end example @end itemize @section alphaextract Extract the alpha component from the input as a grayscale video. This is especially useful with the @var{alphamerge} filter. @section alphamerge Add or replace the alpha component of the primary input with the grayscale value of a second input. This is intended for use with @var{alphaextract} to allow the transmission or storage of frame sequences that have alpha in a format that doesn't support an alpha channel. For example, to reconstruct full frames from a normal YUV-encoded video and a separate video created with @var{alphaextract}, you might use: @example movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out] @end example @section amplify Amplify differences between current pixel and pixels of adjacent frames in same pixel location. This filter accepts the following options: @table @option @item radius Set frame radius. Default is 2. Allowed range is from 1 to 63. For example radius of 3 will instruct filter to calculate average of 7 frames. @item factor Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535. @item threshold Set threshold for difference amplification. Any difference greater or equal to this value will not alter source pixel. Default is 10. Allowed range is from 0 to 65535. @item tolerance Set tolerance for difference amplification. Any difference lower to this value will not alter source pixel. Default is 0. Allowed range is from 0 to 65535. @item low Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535. This option controls maximum possible value that will decrease source pixel value. @item high Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535. This option controls maximum possible value that will increase source pixel value. @item planes Set which planes to filter. Default is all. Allowed range is from 0 to 15. @end table @subsection Commands This filter supports the following @ref{commands} that corresponds to option of same name: @table @option @item factor @item threshold @item tolerance @item low @item high @item planes @end table @section ass Same as the @ref{subtitles} filter, except that it doesn't require libavcodec and libavformat to work. On the other hand, it is limited to ASS (Advanced Substation Alpha) subtitles files. This filter accepts the following option in addition to the common options from the @ref{subtitles} filter: @table @option @item shaping Set the shaping engine Available values are: @table @samp @item auto The default libass shaping engine, which is the best available. @item simple Fast, font-agnostic shaper that can do only substitutions @item complex Slower shaper using OpenType for substitutions and positioning @end table The default is @code{auto}. @end table @section atadenoise Apply an Adaptive Temporal Averaging Denoiser to the video input. The filter accepts the following options: @table @option @item 0a Set threshold A for 1st plane. Default is 0.02. Valid range is 0 to 0.3. @item 0b Set threshold B for 1st plane. Default is 0.04. Valid range is 0 to 5. @item 1a Set threshold A for 2nd plane. Default is 0.02. Valid range is 0 to 0.3. @item 1b Set threshold B for 2nd plane. Default is 0.04. Valid range is 0 to 5. @item 2a Set threshold A for 3rd plane. Default is 0.02. Valid range is 0 to 0.3. @item 2b Set threshold B for 3rd plane. Default is 0.04. Valid range is 0 to 5. Threshold A is designed to react on abrupt changes in the input signal and threshold B is designed to react on continuous changes in the input signal. @item s Set number of frames filter will use for averaging. Default is 9. Must be odd number in range [5, 129]. @item p Set what planes of frame filter will use for averaging. Default is all. @item a Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel. Alternatively can be set to @code{s} serial. Parallel can be faster then serial, while other way around is never true. Parallel will abort early on first change being greater then thresholds, while serial will continue processing other side of frames if they are equal or below thresholds. @item 0s @item 1s @item 2s Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767. Valid range is from 0 to 32767. This options controls weight for each pixel in radius defined by size. Default value means every pixel have same weight. Setting this option to 0 effectively disables filtering. @end table @subsection Commands This filter supports same @ref{commands} as options except option @code{s}. The command accepts the same syntax of the corresponding option. @section avgblur Apply average blur filter. The filter accepts the following options: @table @option @item sizeX Set horizontal radius size. @item planes Set which planes to filter. By default all planes are filtered. @item sizeY Set vertical radius size, if zero it will be same as @code{sizeX}. Default is @code{0}. @end table @subsection Commands This filter supports same commands as options. The command accepts the same syntax of the corresponding option. If the specified expression is not valid, it is kept at its current value. @section backgroundkey Turns a static background into transparency. The filter accepts the following option: @table @option @item threshold Threshold for scene change detection. @item similarity Similarity percentage with the background. @item blend Set the blend amount for pixels that are not similar. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @section bbox Compute the bounding box for the non-black pixels in the input frame luminance plane. This filter computes the bounding box containing all the pixels with a luminance value greater than the minimum allowed value. The parameters describing the bounding box are printed on the filter log. The filter accepts the following option: @table @option @item min_val Set the minimal luminance value. Default is @code{16}. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @section bilateral Apply bilateral filter, spatial smoothing while preserving edges. The filter accepts the following options: @table @option @item sigmaS Set sigma of gaussian function to calculate spatial weight. Allowed range is 0 to 512. Default is 0.1. @item sigmaR Set sigma of gaussian function to calculate range weight. Allowed range is 0 to 1. Default is 0.1. @item planes Set planes to filter. Default is first only. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @section bilateral_cuda CUDA accelerated bilateral filter, an edge preserving filter. This filter is mathematically accurate thanks to the use of GPU acceleration. For best output quality, use one to one chroma subsampling, i.e. yuv444p format. The filter accepts the following options: @table @option @item sigmaS Set sigma of gaussian function to calculate spatial weight, also called sigma space. Allowed range is 0.1 to 512. Default is 0.1. @item sigmaR Set sigma of gaussian function to calculate color range weight, also called sigma color. Allowed range is 0.1 to 512. Default is 0.1. @item window_size Set window size of the bilateral function to determine the number of neighbours to loop on. If the number entered is even, one will be added automatically. Allowed range is 1 to 255. Default is 1. @end table @subsection Examples @itemize @item Apply the bilateral filter on a video. @example ./ffmpeg -v verbose \ -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \ -init_hw_device cuda \ -filter_complex \ " \ [0:v]scale_cuda=format=yuv444p[scaled_video]; [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \ -an -sn -c:v h264_nvenc -cq 20 out.mp4 @end example @end itemize @section bitplanenoise Show and measure bit plane noise. The filter accepts the following options: @table @option @item bitplane Set which plane to analyze. Default is @code{1}. @item filter Filter out noisy pixels from @code{bitplane} set above. Default is disabled. @end table @section blackdetect Detect video intervals that are (almost) completely black. Can be useful to detect chapter transitions, commercials, or invalid recordings. The filter outputs its detection analysis to both the log as well as frame metadata. If a black segment of at least the specified minimum duration is found, a line with the start and end timestamps as well as duration is printed to the log with level @code{info}. In addition, a log line with level @code{debug} is printed per frame showing the black amount detected for that frame. The filter also attaches metadata to the first frame of a black segment with key @code{lavfi.black_start} and to the first frame after the black segment ends with key @code{lavfi.black_end}. The value is the frame's timestamp. This metadata is added regardless of the minimum duration specified. The filter accepts the following options: @table @option @item black_min_duration, d Set the minimum detected black duration expressed in seconds. It must be a non-negative floating point number. Default value is 2.0. @item picture_black_ratio_th, pic_th Set the threshold for considering a picture "black". Express the minimum value for the ratio: @example @var{nb_black_pixels} / @var{nb_pixels} @end example for which a picture is considered black. Default value is 0.98. @item pixel_black_th, pix_th Set the threshold for considering a pixel "black". The threshold expresses the maximum pixel luminance value for which a pixel is considered "black". The provided value is scaled according to the following equation: @example @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size} @end example @var{luminance_range_size} and @var{luminance_minimum_value} depend on the input video format, the range is [0-255] for YUV full-range formats and [16-235] for YUV non full-range formats. Default value is 0.10. @end table The following example sets the maximum pixel threshold to the minimum value, and detects only black intervals of 2 or more seconds: @example blackdetect=d=2:pix_th=0.00 @end example @section blackframe Detect frames that are (almost) completely black. Can be useful to detect chapter transitions or commercials. Output lines consist of the frame number of the detected frame, the percentage of blackness, the position in the file if known or -1 and the timestamp in seconds. In order to display the output lines, you need to set the loglevel at least to the AV_LOG_INFO value. This filter exports frame metadata @code{lavfi.blackframe.pblack}. The value represents the percentage of pixels in the picture that are below the threshold value. It accepts the following parameters: @table @option @item amount The percentage of the pixels that have to be below the threshold; it defaults to @code{98}. @item threshold, thresh The threshold below which a pixel value is considered black; it defaults to @code{32}. @end table @anchor{blend} @section blend Blend two video frames into each other. The @code{blend} filter takes two input streams and outputs one stream, the first input is the "top" layer and second input is "bottom" layer. By default, the output terminates when the longest input terminates. The @code{tblend} (time blend) filter takes two consecutive frames from one single stream, and outputs the result obtained by blending the new frame on top of the old frame. A description of the accepted options follows. @table @option @item c0_mode @item c1_mode @item c2_mode @item c3_mode @item all_mode Set blend mode for specific pixel component or all pixel components in case of @var{all_mode}. Default value is @code{normal}. Available values for component modes are: @table @samp @item addition @item and @item average @item bleach @item burn @item darken @item difference @item divide @item dodge @item exclusion @item extremity @item freeze @item geometric @item glow @item grainextract @item grainmerge @item hardlight @item hardmix @item hardoverlay @item harmonic @item heat @item interpolate @item lighten @item linearlight @item multiply @item multiply128 @item negation @item normal @item or @item overlay @item phoenix @item pinlight @item reflect @item screen @item softdifference @item softlight @item stain @item subtract @item vividlight @item xor @end table @item c0_opacity @item c1_opacity @item c2_opacity @item c3_opacity @item all_opacity Set blend opacity for specific pixel component or all pixel components in case of @var{all_opacity}. Only used in combination with pixel component blend modes. @item c0_expr @item c1_expr @item c2_expr @item c3_expr @item all_expr Set blend expression for specific pixel component or all pixel components in case of @var{all_expr}. Note that related mode options will be ignored if those are set. The expressions can use the following variables: @table @option @item N The sequential number of the filtered frame, starting from @code{0}. @item X @item Y the coordinates of the current sample @item W @item H the width and height of currently filtered plane @item SW @item SH Width and height scale for the plane being filtered. It is the ratio between the dimensions of the current plane to the luma plane, e.g. for a @code{yuv420p} frame, the values are @code{1,1} for the luma plane and @code{0.5,0.5} for the chroma planes. @item T Time of the current frame, expressed in seconds. @item TOP, A Value of pixel component at current location for first video frame (top layer). @item BOTTOM, B Value of pixel component at current location for second video frame (bottom layer). @end table @end table The @code{blend} filter also supports the @ref{framesync} options. @subsection Examples @itemize @item Apply transition from bottom layer to top layer in first 10 seconds: @example blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))' @end example @item Apply linear horizontal transition from top layer to bottom layer: @example blend=all_expr='A*(X/W)+B*(1-X/W)' @end example @item Apply 1x1 checkerboard effect: @example blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)' @end example @item Apply uncover left effect: @example blend=all_expr='if(gte(N*SW+X,W),A,B)' @end example @item Apply uncover down effect: @example blend=all_expr='if(gte(Y-N*SH,0),A,B)' @end example @item Apply uncover up-left effect: @example blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)' @end example @item Split diagonally video and shows top and bottom layer on each side: @example blend=all_expr='if(gt(X,Y*(W/H)),A,B)' @end example @item Display differences between the current and the previous frame: @example tblend=all_mode=grainextract @end example @end itemize @subsection Commands This filter supports same @ref{commands} as options. @anchor{blockdetect} @section blockdetect Determines blockiness of frames without altering the input frames. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference. The filter accepts the following options: @table @option @item period_min @item period_max Set minimum and maximum values for determining pixel grids (periods). Default values are [3,24]. @item planes Set planes to filter. Default is first only. @end table @subsection Examples @itemize @item Determine blockiness for the first plane and search for periods within [8,32]: @example blockdetect=period_min=8:period_max=32:planes=1 @end example @end itemize @anchor{blurdetect} @section blurdetect Determines blurriness of frames without altering the input frames. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric." Allows for a block-based abbreviation. The filter accepts the following options: @table @option @item low @item high Set low and high threshold values used by the Canny thresholding algorithm. The high threshold selects the "strong" edge pixels, which are then connected through 8-connectivity with the "weak" edge pixels selected by the low threshold. @var{low} and @var{high} threshold values must be chosen in the range [0,1], and @var{low} should be lesser or equal to @var{high}. Default value for @var{low} is @code{20/255}, and default value for @var{high} is @code{50/255}. @item radius Define the radius to search around an edge pixel for local maxima. @item block_pct Determine blurriness only for the most significant blocks, given in percentage. @item block_width Determine blurriness for blocks of width @var{block_width}. If set to any value smaller 1, no blocks are used and the whole image is processed as one no matter of @var{block_height}. @item block_height Determine blurriness for blocks of height @var{block_height}. If set to any value smaller 1, no blocks are used and the whole image is processed as one no matter of @var{block_width}. @item planes Set planes to filter. Default is first only. @end table @subsection Examples @itemize @item Determine blur for 80% of most significant 32x32 blocks: @example blurdetect=block_width=32:block_height=32:block_pct=80 @end example @end itemize @section bm3d Denoise frames using Block-Matching 3D algorithm. The filter accepts the following options. @table @option @item sigma Set denoising strength. Default value is 1. Allowed range is from 0 to 999.9. The denoising algorithm is very sensitive to sigma, so adjust it according to the source. @item block Set local patch size. This sets dimensions in 2D. @item bstep Set sliding step for processing blocks. Default value is 4. Allowed range is from 1 to 64. Smaller values allows processing more reference blocks and is slower. @item group Set maximal number of similar blocks for 3rd dimension. Default value is 1. When set to 1, no block matching is done. Larger values allows more blocks in single group. Allowed range is from 1 to 256. @item range Set radius for search block matching. Default is 9. Allowed range is from 1 to INT32_MAX. @item mstep Set step between two search locations for block matching. Default is 1. Allowed range is from 1 to 64. Smaller is slower. @item thmse Set threshold of mean square error for block matching. Valid range is 0 to INT32_MAX. @item hdthr Set thresholding parameter for hard thresholding in 3D transformed domain. Larger values results in stronger hard-thresholding filtering in frequency domain. @item estim Set filtering estimation mode. Can be @code{basic} or @code{final}. Default is @code{basic}. @item ref If enabled, filter will use 2nd stream for block matching. Default is disabled for @code{basic} value of @var{estim} option, and always enabled if value of @var{estim} is @code{final}. @item planes Set planes to filter. Default is all available except alpha. @end table @subsection Examples @itemize @item Basic filtering with bm3d: @example bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic @end example @item Same as above, but filtering only luma: @example bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1 @end example @item Same as above, but with both estimation modes: @example split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1 @end example @item Same as above, but prefilter with @ref{nlmeans} filter instead: @example split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1 @end example @end itemize @section boxblur Apply a boxblur algorithm to the input video. It accepts the following parameters: @table @option @item luma_radius, lr @item luma_power, lp @item chroma_radius, cr @item chroma_power, cp @item alpha_radius, ar @item alpha_power, ap @end table A description of the accepted options follows. @table @option @item luma_radius, lr @item chroma_radius, cr @item alpha_radius, ar Set an expression for the box radius in pixels used for blurring the corresponding input plane. The radius value must be a non-negative number, and must not be greater than the value of the expression @code{min(w,h)/2} for the luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma planes. Default value for @option{luma_radius} is "2". If not specified, @option{chroma_radius} and @option{alpha_radius} default to the corresponding value set for @option{luma_radius}. The expressions can contain the following constants: @table @option @item w @item h The input width and height in pixels. @item cw @item ch The input chroma image width and height in pixels. @item hsub @item vsub The horizontal and vertical chroma subsample values. For example, for the pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1. @end table @item luma_power, lp @item chroma_power, cp @item alpha_power, ap Specify how many times the boxblur filter is applied to the corresponding plane. Default value for @option{luma_power} is 2. If not specified, @option{chroma_power} and @option{alpha_power} default to the corresponding value set for @option{luma_power}. A value of 0 will disable the effect. @end table @subsection Examples @itemize @item Apply a boxblur filter with the luma, chroma, and alpha radii set to 2: @example boxblur=luma_radius=2:luma_power=1 boxblur=2:1 @end example @item Set the luma radius to 2, and alpha and chroma radius to 0: @example boxblur=2:1:cr=0:ar=0 @end example @item Set the luma and chroma radii to a fraction of the video dimension: @example boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1 @end example @end itemize @section bwdif Deinterlace the input video ("bwdif" stands for "Bob Weaver Deinterlacing Filter"). Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic interpolation algorithms. It accepts the following parameters: @table @option @item mode The interlacing mode to adopt. It accepts one of the following values: @table @option @item 0, send_frame Output one frame for each frame. @item 1, send_field Output one frame for each field. @end table The default value is @code{send_field}. @item parity The picture field parity assumed for the input interlaced video. It accepts one of the following values: @table @option @item 0, tff Assume the top field is first. @item 1, bff Assume the bottom field is first. @item -1, auto Enable automatic detection of field parity. @end table The default value is @code{auto}. If the interlacing is unknown or the decoder does not export this information, top field first will be assumed. @item deint Specify which frames to deinterlace. Accepts one of the following values: @table @option @item 0, all Deinterlace all frames. @item 1, interlaced Only deinterlace frames marked as interlaced. @end table The default value is @code{all}. @end table @section cas Apply Contrast Adaptive Sharpen filter to video stream. The filter accepts the following options: @table @option @item strength Set the sharpening strength. Default value is 0. @item planes Set planes to filter. Default value is to filter all planes except alpha plane. @end table @subsection Commands This filter supports same @ref{commands} as options. @section chromahold Remove all color information for all colors except for certain one. The filter accepts the following options: @table @option @item color The color which will not be replaced with neutral chroma. @item similarity Similarity percentage with the above color. 0.01 matches only the exact key color, while 1.0 matches everything. @item blend Blend percentage. 0.0 makes pixels either fully gray, or not gray at all. Higher values result in more preserved color. @item yuv Signals that the color passed is already in YUV instead of RGB. Literal colors like "green" or "red" don't make sense with this enabled anymore. This can be used to pass exact YUV values as hexadecimal numbers. @end table @subsection Commands This filter supports same @ref{commands} as options. The command accepts the same syntax of the corresponding option. If the specified expression is not valid, it is kept at its current value. @anchor{chromakey} @section chromakey YUV colorspace color/chroma keying. The filter accepts the following options: @table @option @item color The color which will be replaced with transparency. @item similarity Similarity percentage with the key color. 0.01 matches only the exact key color, while 1.0 matches everything. @item blend Blend percentage. 0.0 makes pixels either fully transparent, or not transparent at all. Higher values result in semi-transparent pixels, with a higher transparency the more similar the pixels color is to the key color. @item yuv Signals that the color passed is already in YUV instead of RGB. Literal colors like "green" or "red" don't make sense with this enabled anymore. This can be used to pass exact YUV values as hexadecimal numbers. @end table @subsection Commands This filter supports same @ref{commands} as options. The command accepts the same syntax of the corresponding option. If the specified expression is not valid, it is kept at its current value. @subsection Examples @itemize @item Make every green pixel in the input image transparent: @example ffmpeg -i input.png -vf chromakey=green out.png @end example @item Overlay a greenscreen-video on top of a static black background. @example ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv @end example @end itemize @section chromakey_cuda CUDA accelerated YUV colorspace color/chroma keying. This filter works like normal chromakey filter but operates on CUDA frames. for more details and parameters see @ref{chromakey}. @subsection Examples @itemize @item Make all the green pixels in the input video transparent and use it as an overlay for another video: @example ./ffmpeg \ -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \ -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \ -init_hw_device cuda \ -filter_complex \ " \ [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \ [1:v]scale_cuda=format=yuv420p[base]; \ [base][overlay_video]overlay_cuda" \ -an -sn -c:v h264_nvenc -cq 20 output.mp4 @end example @item Process two software sources, explicitly uploading the frames: @example ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \ -f lavfi -i color=size=800x600:color=white,format=yuv420p \ -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \ -filter_complex \ " \ [0]hwupload[under]; \ [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \ [under][over]overlay_cuda" \ -c:v hevc_nvenc -cq 18 -preset slow output.mp4 @end example @end itemize @section chromanr Reduce chrominance noise. The filter accepts the following options: @table @option @item thres Set threshold for averaging chrominance values. Sum of absolute difference of Y, U and V pixel components of current pixel and neighbour pixels lower than this threshold will be used in averaging. Luma component is left unchanged and is copied to output. Default value is 30. Allowed range is from 1 to 200. @item sizew Set horizontal radius of rectangle used for averaging. Allowed range is from 1 to 100. Default value is 5. @item sizeh Set vertical radius of rectangle used for averaging. Allowed range is from 1 to 100. Default value is 5. @item stepw Set horizontal step when averaging. Default value is 1. Allowed range is from 1 to 50. Mostly useful to speed-up filtering. @item steph Set vertical step when averaging. Default value is 1. Allowed range is from 1 to 50. Mostly useful to speed-up filtering. @item threy Set Y threshold for averaging chrominance values. Set finer control for max allowed difference between Y components of current pixel and neigbour pixels. Default value is 200. Allowed range is from 1 to 200. @item threu Set U threshold for averaging chrominance values. Set finer control for max allowed difference between U components of current pixel and neigbour pixels. Default value is 200. Allowed range is from 1 to 200. @item threv Set V threshold for averaging chrominance values. Set finer control for max allowed difference between V components of current pixel and neigbour pixels. Default value is 200. Allowed range is from 1 to 200. @item distance Set distance type used in calculations. @table @samp @item manhattan Absolute difference. @item euclidean Difference squared. @end table Default distance type is manhattan. @end table @subsection Commands This filter supports same @ref{commands} as options. The command accepts the same syntax of the corresponding option. @section chromashift Shift chroma pixels horizontally and/or vertically. The filter accepts the following options: @table @option @item cbh Set amount to shift chroma-blue horizontally. @item cbv Set amount to shift chroma-blue vertically. @item crh Set amount to shift chroma-red horizontally. @item crv Set amount to shift chroma-red vertically. @item edge Set edge mode, can be @var{smear}, default, or @var{warp}. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @section ciescope Display CIE color diagram with pixels overlaid onto it. The filter accepts the following options: @table @option @item system Set color system. @table @samp @item ntsc, 470m @item ebu, 470bg @item smpte @item 240m @item apple @item widergb @item cie1931 @item rec709, hdtv @item uhdtv, rec2020 @item dcip3 @end table @item cie Set CIE system. @table @samp @item xyy @item ucs @item luv @end table @item gamuts Set what gamuts to draw. See @code{system} option for available values. @item size, s Set ciescope size, by default set to 512. @item intensity, i Set intensity used to map input pixel values to CIE diagram. @item contrast Set contrast used to draw tongue colors that are out of active color system gamut. @item corrgamma Correct gamma displayed on scope, by default enabled. @item showwhite Show white point on CIE diagram, by default disabled. @item gamma Set input gamma. Used only with XYZ input color space. @item fill Fill with CIE colors. By default is enabled. @end table @section codecview Visualize information exported by some codecs. Some codecs can export information through frames using side-data or other means. For example, some MPEG based codecs export motion vectors through the @var{export_mvs} flag in the codec @option{flags2} option. The filter accepts the following option: @table @option @item block Display block partition structure using the luma plane. @item mv Set motion vectors to visualize. Available flags for @var{mv} are: @table @samp @item pf forward predicted MVs of P-frames @item bf forward predicted MVs of B-frames @item bb backward predicted MVs of B-frames @end table @item qp Display quantization parameters using the chroma planes. @item mv_type, mvt Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option. Available flags for @var{mv_type} are: @table @samp @item fp forward predicted MVs @item bp backward predicted MVs @end table @item frame_type, ft Set frame type to visualize motion vectors of. Available flags for @var{frame_type} are: @table @samp @item if intra-coded frames (I-frames) @item pf predicted frames (P-frames) @item bf bi-directionally predicted frames (B-frames) @end table @end table @subsection Examples @itemize @item Visualize forward predicted MVs of all frames using @command{ffplay}: @example ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp @end example @item Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}: @example ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb @end example @end itemize @section colorbalance Modify intensity of primary colors (red, green and blue) of input frames. The filter allows an input frame to be adjusted in the shadows, midtones or highlights regions for the red-cyan, green-magenta or blue-yellow balance. A positive adjustment value shifts the balance towards the primary color, a negative value towards the complementary color. The filter accepts the following options: @table @option @item rs @item gs @item bs Adjust red, green and blue shadows (darkest pixels). @item rm @item gm @item bm Adjust red, green and blue midtones (medium pixels). @item rh @item gh @item bh Adjust red, green and blue highlights (brightest pixels). Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}. @item pl Preserve lightness when changing color balance. Default is disabled. @end table @subsection Examples @itemize @item Add red color cast to shadows: @example colorbalance=rs=.3 @end example @end itemize @subsection Commands This filter supports the all above options as @ref{commands}. @section colorcontrast Adjust color contrast between RGB components. The filter accepts the following options: @table @option @item rc Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0. @item gm Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0. @item by Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0. @item rcw @item gmw @item byw Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled. @item pl Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @section colorcorrect Adjust color white balance selectively for blacks and whites. This filter operates in YUV colorspace. The filter accepts the following options: @table @option @item rl Set the red shadow spot. Allowed range is from -1.0 to 1.0. Default value is 0. @item bl Set the blue shadow spot. Allowed range is from -1.0 to 1.0. Default value is 0. @item rh Set the red highlight spot. Allowed range is from -1.0 to 1.0. Default value is 0. @item bh Set the red highlight spot. Allowed range is from -1.0 to 1.0. Default value is 0. @item saturation Set the amount of saturation. Allowed range is from -3.0 to 3.0. Default value is 1. @item analyze If set to anything other than @code{manual} it will analyze every frame and use derived parameters for filtering output frame. Possible values are: @table @samp @item manual @item average @item minmax @item median @end table Default value is @code{manual}. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @section colorchannelmixer Adjust video input frames by re-mixing color channels. This filter modifies a color channel by adding the values associated to the other channels of the same pixels. For example if the value to modify is red, the output value will be: @example @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra} @end example The filter accepts the following options: @table @option @item rr @item rg @item rb @item ra Adjust contribution of input red, green, blue and alpha channels for output red channel. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}. @item gr @item gg @item gb @item ga Adjust contribution of input red, green, blue and alpha channels for output green channel. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}. @item br @item bg @item bb @item ba Adjust contribution of input red, green, blue and alpha channels for output blue channel. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}. @item ar @item ag @item ab @item aa Adjust contribution of input red, green, blue and alpha channels for output alpha channel. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}. Allowed ranges for options are @code{[-2.0, 2.0]}. @item pc Set preserve color mode. The accepted values are: @table @samp @item none Disable color preserving, this is default. @item lum Preserve luminance. @item max Preserve max value of RGB triplet. @item avg Preserve average value of RGB triplet. @item sum Preserve sum value of RGB triplet. @item nrm Preserve normalized value of RGB triplet. @item pwr Preserve power value of RGB triplet. @end table @item pa Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}. Default is @code{0.0}, thus disabled. @end table @subsection Examples @itemize @item Convert source to grayscale: @example colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3 @end example @item Simulate sepia tones: @example colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131 @end example @end itemize @subsection Commands This filter supports the all above options as @ref{commands}. @section colorize Overlay a solid color on the video stream. The filter accepts the following options: @table @option @item hue Set the color hue. Allowed range is from 0 to 360. Default value is 0. @item saturation Set the color saturation. Allowed range is from 0 to 1. Default value is 0.5. @item lightness Set the color lightness. Allowed range is from 0 to 1. Default value is 0.5. @item mix Set the mix of source lightness. By default is set to 1.0. Allowed range is from 0.0 to 1.0. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @section colorkey RGB colorspace color keying. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel which falls within the similarity radius of the key color to 0. The alpha value for pixels outside the similarity radius depends on the value of the blend option. The filter accepts the following options: @table @option @item color Set the color for which alpha will be set to 0 (full transparency). See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. Default is @code{black}. @item similarity Set the radius from the key color within which other colors also have full transparency. The computed distance is related to the unit fractional distance in 3D space between the RGB values of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius around the exact key color, while 1.0 matches everything. Default is @code{0.01}. @item blend Set how the alpha value for pixels that fall outside the similarity radius is computed. 0.0 makes pixels either fully transparent or fully opaque. Higher values result in semi-transparent pixels, with greater transparency the more similar the pixel color is to the key color. Range is 0.0 to 1.0. Default is @code{0.0}. @end table @subsection Examples @itemize @item Make every green pixel in the input image transparent: @example ffmpeg -i input.png -vf colorkey=green out.png @end example @item Overlay a greenscreen-video on top of a static background image. @example ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv @end example @end itemize @subsection Commands This filter supports same @ref{commands} as options. The command accepts the same syntax of the corresponding option. If the specified expression is not valid, it is kept at its current value. @section colorhold Remove all color information for all RGB colors except for certain one. The filter accepts the following options: @table @option @item color The color which will not be replaced with neutral gray. @item similarity Similarity percentage with the above color. 0.01 matches only the exact key color, while 1.0 matches everything. @item blend Blend percentage. 0.0 makes pixels fully gray. Higher values result in more preserved color. @end table @subsection Commands This filter supports same @ref{commands} as options. The command accepts the same syntax of the corresponding option. If the specified expression is not valid, it is kept at its current value. @section colorlevels Adjust video input frames using levels. The filter accepts the following options: @table @option @item rimin @item gimin @item bimin @item aimin Adjust red, green, blue and alpha input black point. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}. @item rimax @item gimax @item bimax @item aimax Adjust red, green, blue and alpha input white point. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}. Input levels are used to lighten highlights (bright tones), darken shadows (dark tones), change the balance of bright and dark tones. @item romin @item gomin @item bomin @item aomin Adjust red, green, blue and alpha output black point. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}. @item romax @item gomax @item bomax @item aomax Adjust red, green, blue and alpha output white point. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}. Output levels allows manual selection of a constrained output level range. @item preserve Set preserve color mode. The accepted values are: @table @samp @item none Disable color preserving, this is default. @item lum Preserve luminance. @item max Preserve max value of RGB triplet. @item avg Preserve average value of RGB triplet. @item sum Preserve sum value of RGB triplet. @item nrm Preserve normalized value of RGB triplet. @item pwr Preserve power value of RGB triplet. @end table @end table @subsection Examples @itemize @item Make video output darker: @example colorlevels=rimin=0.058:gimin=0.058:bimin=0.058 @end example @item Increase contrast: @example colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96 @end example @item Make video output lighter: @example colorlevels=rimax=0.902:gimax=0.902:bimax=0.902 @end example @item Increase brightness: @example colorlevels=romin=0.5:gomin=0.5:bomin=0.5 @end example @end itemize @subsection Commands This filter supports the all above options as @ref{commands}. @section colormap Apply custom color maps to video stream. This filter needs three input video streams. First stream is video stream that is going to be filtered out. Second and third video stream specify color patches for source color to target color mapping. The filter accepts the following options: @table @option @item patch_size Set the source and target video stream patch size in pixels. @item nb_patches Set the max number of used patches from source and target video stream. Default value is number of patches available in additional video streams. Max allowed number of patches is @code{64}. @item type Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}. Defaults is @code{absolute}. @item kernel Set the kernel used to measure color differences between mapped colors. The accepted values are: @table @samp @item euclidean @item weuclidean @end table Default is @code{euclidean}. @end table @section colormatrix Convert color matrix. The filter accepts the following options: @table @option @item src @item dst Specify the source and destination color matrix. Both values must be specified. The accepted values are: @table @samp @item bt709 BT.709 @item fcc FCC @item bt601 BT.601 @item bt470 BT.470 @item bt470bg BT.470BG @item smpte170m SMPTE-170M @item smpte240m SMPTE-240M @item bt2020 BT.2020 @end table @end table For example to convert from BT.601 to SMPTE-240M, use the command: @example colormatrix=bt601:smpte240m @end example @section colorspace Convert colorspace, transfer characteristics or color primaries. Input video needs to have an even size. The filter accepts the following options: @table @option @anchor{all} @item all Specify all color properties at once. The accepted values are: @table @samp @item bt470m BT.470M @item bt470bg BT.470BG @item bt601-6-525 BT.601-6 525 @item bt601-6-625 BT.601-6 625 @item bt709 BT.709 @item smpte170m SMPTE-170M @item smpte240m SMPTE-240M @item bt2020 BT.2020 @end table @anchor{space} @item space Specify output colorspace. The accepted values are: @table @samp @item bt709 BT.709 @item fcc FCC @item bt470bg BT.470BG or BT.601-6 625 @item smpte170m SMPTE-170M or BT.601-6 525 @item smpte240m SMPTE-240M @item ycgco YCgCo @item bt2020ncl BT.2020 with non-constant luminance @end table @anchor{trc} @item trc Specify output transfer characteristics. The accepted values are: @table @samp @item bt709 BT.709 @item bt470m BT.470M @item bt470bg BT.470BG @item gamma22 Constant gamma of 2.2 @item gamma28 Constant gamma of 2.8 @item smpte170m SMPTE-170M, BT.601-6 625 or BT.601-6 525 @item smpte240m SMPTE-240M @item srgb SRGB @item iec61966-2-1 iec61966-2-1 @item iec61966-2-4 iec61966-2-4 @item xvycc xvycc @item bt2020-10 BT.2020 for 10-bits content @item bt2020-12 BT.2020 for 12-bits content @end table @anchor{primaries} @item primaries Specify output color primaries. The accepted values are: @table @samp @item bt709 BT.709 @item bt470m BT.470M @item bt470bg BT.470BG or BT.601-6 625 @item smpte170m SMPTE-170M or BT.601-6 525 @item smpte240m SMPTE-240M @item film film @item smpte431 SMPTE-431 @item smpte432 SMPTE-432 @item bt2020 BT.2020 @item jedec-p22 JEDEC P22 phosphors @end table @anchor{range} @item range Specify output color range. The accepted values are: @table @samp @item tv TV (restricted) range @item mpeg MPEG (restricted) range @item pc PC (full) range @item jpeg JPEG (full) range @end table @item format Specify output color format. The accepted values are: @table @samp @item yuv420p YUV 4:2:0 planar 8-bits @item yuv420p10 YUV 4:2:0 planar 10-bits @item yuv420p12 YUV 4:2:0 planar 12-bits @item yuv422p YUV 4:2:2 planar 8-bits @item yuv422p10 YUV 4:2:2 planar 10-bits @item yuv422p12 YUV 4:2:2 planar 12-bits @item yuv444p YUV 4:4:4 planar 8-bits @item yuv444p10 YUV 4:4:4 planar 10-bits @item yuv444p12 YUV 4:4:4 planar 12-bits @end table @item fast Do a fast conversion, which skips gamma/primary correction. This will take significantly less CPU, but will be mathematically incorrect. To get output compatible with that produced by the colormatrix filter, use fast=1. @item dither Specify dithering mode. The accepted values are: @table @samp @item none No dithering @item fsb Floyd-Steinberg dithering @end table @item wpadapt Whitepoint adaptation mode. The accepted values are: @table @samp @item bradford Bradford whitepoint adaptation @item vonkries von Kries whitepoint adaptation @item identity identity whitepoint adaptation (i.e. no whitepoint adaptation) @end table @item iall Override all input properties at once. Same accepted values as @ref{all}. @item ispace Override input colorspace. Same accepted values as @ref{space}. @item iprimaries Override input color primaries. Same accepted values as @ref{primaries}. @item itrc Override input transfer characteristics. Same accepted values as @ref{trc}. @item irange Override input color range. Same accepted values as @ref{range}. @end table The filter converts the transfer characteristics, color space and color primaries to the specified user values. The output value, if not specified, is set to a default value based on the "all" property. If that property is also not specified, the filter will log an error. The output color range and format default to the same value as the input color range and format. The input transfer characteristics, color space, color primaries and color range should be set on the input data. If any of these are missing, the filter will log an error and no conversion will take place. For example to convert the input to SMPTE-240M, use the command: @example colorspace=smpte240m @end example @section colorspace_cuda CUDA accelerated implementation of the colorspace filter. It is by no means feature complete compared to the software colorspace filter, and at the current time only supports color range conversion between jpeg/full and mpeg/limited range. The filter accepts the following options: @table @option @item range Specify output color range. The accepted values are: @table @samp @item tv TV (restricted) range @item mpeg MPEG (restricted) range @item pc PC (full) range @item jpeg JPEG (full) range @end table @end table @section colortemperature Adjust color temperature in video to simulate variations in ambient color temperature. The filter accepts the following options: @table @option @item temperature Set the temperature in Kelvin. Allowed range is from 1000 to 40000. Default value is 6500 K. @item mix Set mixing with filtered output. Allowed range is from 0 to 1. Default value is 1. @item pl Set the amount of preserving lightness. Allowed range is from 0 to 1. Default value is 0. @end table @subsection Commands This filter supports same @ref{commands} as options. @section convolution Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements. The filter accepts the following options: @table @option @item 0m @item 1m @item 2m @item 3m Set matrix for each plane. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode, and from 1 to 49 odd number of signed integers in @var{row} mode. @item 0rdiv @item 1rdiv @item 2rdiv @item 3rdiv Set multiplier for calculated value for each plane. If unset or 0, it will be sum of all matrix elements. @item 0bias @item 1bias @item 2bias @item 3bias Set bias for each plane. This value is added to the result of the multiplication. Useful for making the overall image brighter or darker. Default is 0.0. @item 0mode @item 1mode @item 2mode @item 3mode Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}. Default is @var{square}. @end table @subsection Commands This filter supports the all above options as @ref{commands}. @subsection Examples @itemize @item Apply sharpen: @example convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0" @end example @item Apply blur: @example convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9" @end example @item Apply edge enhance: @example convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128" @end example @item Apply edge detect: @example convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128" @end example @item Apply laplacian edge detector which includes diagonals: @example convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0" @end example @item Apply emboss: @example convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2" @end example @end itemize @section convolve Apply 2D convolution of video stream in frequency domain using second stream as impulse. The filter accepts the following options: @table @option @item planes Set which planes to process. @item impulse Set which impulse video frames will be processed, can be @var{first} or @var{all}. Default is @var{all}. @end table The @code{convolve} filter also supports the @ref{framesync} options. @section copy Copy the input video source unchanged to the output. This is mainly useful for testing purposes. @anchor{coreimage} @section coreimage Video filtering on GPU using Apple's CoreImage API on OSX. Hardware acceleration is based on an OpenGL context. Usually, this means it is processed by video hardware. However, software-based OpenGL implementations exist which means there is no guarantee for hardware processing. It depends on the respective OSX. There are many filters and image generators provided by Apple that come with a large variety of options. The filter has to be referenced by its name along with its options. The coreimage filter accepts the following options: @table @option @item list_filters List all available filters and generators along with all their respective options as well as possible minimum and maximum values along with the default values. @example list_filters=true @end example @item filter Specify all filters by their respective name and options. Use @var{list_filters} to determine all valid filter names and options. Numerical options are specified by a float value and are automatically clamped to their respective value range. Vector and color options have to be specified by a list of space separated float values. Character escaping has to be done. A special option name @code{default} is available to use default options for a filter. It is required to specify either @code{default} or at least one of the filter options. All omitted options are used with their default values. The syntax of the filter string is as follows: @example filter=@@