diff --git a/doc/filters.texi b/doc/filters.texi index 17c54c5e6c..af9dfcd0bf 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -347,158 +347,133 @@ aconvert=u8:auto @end example @end itemize -@section allpass - -Apply a two-pole all-pass filter with central frequency (in Hz) -@var{frequency}, and filter-width @var{width}. -An all-pass filter changes the audio's frequency to phase relationship -without changing its frequency to amplitude relationship. +@section afade -The filter accepts the following options: +Apply fade-in/out effect to input audio. -@table @option -@item frequency, f -Set frequency in Hz. +A description of the accepted parameters follows. -@item width_type -Set method to specify band-width of filter. @table @option -@item h -Hz -@item q -Q-Factor -@item o -octave -@item s -slope -@end table - -@item width, w -Specify the band-width of a filter in width_type units. -@end table +@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}. -@section highpass +@item start_sample, ss +Specify the number of the start sample for starting to apply the fade +effect. Default is 0. -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). +@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. -The filter accepts the following options: +@item start_time, st +Specify time for starting to apply the fade effect. Default is 0. +The accepted syntax is: +@example +[-]HH[:MM[:SS[.m...]]] +[-]S+[.m...] +@end example +See also the function @code{av_parse_time()}. +If set this option is used instead of @var{start_sample} one. -@table @option -@item frequency, f -Set frequency in Hz. Default is 3000. +@item duration, d +Specify the duration for which the fade effect has to last. Default is 0. +The accepted syntax is: +@example +[-]HH[:MM[:SS[.m...]]] +[-]S+[.m...] +@end example +See also the function @code{av_parse_time()}. +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. +If set this option is used instead of @var{nb_samples} one. -@item poles, p -Set number of poles. Default is 2. +@item curve +Set curve for fade transition. -@item width_type -Set method to specify band-width of filter. +It accepts the following values: @table @option -@item h -Hz -@item q -Q-Factor -@item o -octave -@item s -slope +@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 par +select inverted parabola +@item qua +select quadratic +@item cub +select cubic +@item squ +select square root +@item cbr +select cubic root @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. @end table -@section lowpass +@subsection Examples -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). +@itemize +@item +Fade in first 15 seconds of audio: +@example +afade=t=in:ss=0:d=15 +@end example -The filter accepts the following options: +@item +Fade out last 25 seconds of a 900 seconds audio: +@example +afade=t=out:st=875:d=25 +@end example +@end itemize -@table @option -@item frequency, f -Set frequency in Hz. Default is 500. +@anchor{aformat} +@section aformat -@item poles, p -Set number of poles. Default is 2. +Set output format constraints for the input audio. The framework will +negotiate the most appropriate format to minimize conversions. -@item width_type -Set method to specify band-width of filter. +The filter accepts the following named parameters: @table @option -@item h -Hz -@item q -Q-Factor -@item o -octave -@item s -slope -@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. -@end table - -@section bass - -Boost or cut the bass (lower) frequencies of the audio using a two-pole -shelving filter with a response similar to that of a standard -hi-fi's tone-controls. This is also known as shelving equalisation (EQ). -The filter accepts the following options: +@item sample_fmts +A '|'-separated list of requested sample formats. -@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 sample_rates +A '|'-separated list of requested sample rates. -@item frequency, f -Set the filter's central frequency and so can be used -to extend or reduce the frequency range to be boosted or cut. -The default value is @code{100} Hz. +@item channel_layouts +A '|'-separated list of requested channel layouts. -@item width_type -Set method to specify band-width of filter. -@table @option -@item h -Hz -@item q -Q-Factor -@item o -octave -@item s -slope @end table -@item width, w -Determine how steep is the filter's shelf transition. -@end table +If a parameter is omitted, all values are allowed. -@section treble +For example to force the output to either unsigned 8-bit or signed 16-bit stereo: +@example +aformat=sample_fmts=u8|s16:channel_layouts=stereo +@end example -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). +@section allpass + +Apply a two-pole all-pass filter with central frequency (in Hz) +@var{frequency}, and filter-width @var{width}. +An all-pass filter changes the audio's frequency to phase relationship +without changing its frequency to amplitude relationship. The filter accepts the following options: @table @option -@item 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. +Set frequency in Hz. @item width_type Set method to specify band-width of filter. @@ -514,255 +489,34 @@ slope @end table @item width, w -Determine how steep is the filter's shelf transition. +Specify the band-width of a filter in width_type units. @end table -@section bandpass +@section amerge -Apply a two-pole Butterworth band-pass filter with central -frequency @var{frequency}, and (3dB-point) band-width width. -The @var{csg} option selects a constant skirt gain (peak gain = Q) -instead of the default: constant 0dB peak gain. -The filter roll off at 6dB per octave (20dB per decade). +Merge two or more audio streams into a single multi-channel stream. The filter accepts the following options: @table @option -@item frequency, f -Set the filter's central frequency. Default is @code{3000}. -@item csg -Constant skirt gain if set to 1. Defaults to 0. +@item inputs +Set the number of inputs. Default is 2. -@item width_type -Set method to specify band-width of filter. -@table @option -@item h -Hz -@item q -Q-Factor -@item o -octave -@item s -slope @end table -@item width, w -Specify the band-width of a filter in width_type units. -@end table +If the channel layouts of the inputs are disjoint, and therefore compatible, +the channel layout of the output will be set accordingly and the channels +will be reordered as necessary. If the channel layouts of the inputs are not +disjoint, the output will have all the channels of the first input then all +the channels of the second input, in that order, and the channel layout of +the output will be the default value corresponding to the total number of +channels. -@section bandreject - -Apply a two-pole Butterworth band-reject filter with central -frequency @var{frequency}, and (3dB-point) band-width @var{width}. -The filter roll off at 6dB per octave (20dB per decade). - -The filter accepts the following options: - -@table @option -@item frequency, f -Set the filter's central frequency. Default is @code{3000}. - -@item width_type -Set method to specify band-width of filter. -@table @option -@item h -Hz -@item q -Q-Factor -@item o -octave -@item s -slope -@end table - -@item width, w -Specify the band-width of a filter in width_type units. -@end table - -@section biquad - -Apply a biquad IIR filter with the given coefficients. -Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2} -are the numerator and denominator coefficients respectively. - -@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 -Set method to specify band-width of filter. -@table @option -@item h -Hz -@item q -Q-Factor -@item o -octave -@item s -slope -@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. -@end table - -@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 time for starting to apply the fade effect. Default is 0. -The accepted syntax is: -@example -[-]HH[:MM[:SS[.m...]]] -[-]S+[.m...] -@end example -See also the function @code{av_parse_time()}. -If set this option is used instead of @var{start_sample} one. - -@item duration, d -Specify the duration for which the fade effect has to last. Default is 0. -The accepted syntax is: -@example -[-]HH[:MM[:SS[.m...]]] -[-]S+[.m...] -@end example -See also the function @code{av_parse_time()}. -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. -If set this option is used instead of @var{nb_samples} one. - -@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 par -select inverted parabola -@item qua -select quadratic -@item cub -select cubic -@item squ -select square root -@item cbr -select cubic root -@end table -@end table - -@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 - -@anchor{aformat} -@section aformat - -Set output format constraints for the input audio. The framework will -negotiate the most appropriate format to minimize conversions. - -The filter accepts the following named parameters: -@table @option - -@item sample_fmts -A '|'-separated list of requested sample formats. - -@item sample_rates -A '|'-separated list of requested sample rates. - -@item channel_layouts -A '|'-separated list of requested channel layouts. - -@end table - -If a parameter is omitted, all values are allowed. - -For example to force the output to either unsigned 8-bit or signed 16-bit stereo: -@example -aformat=sample_fmts=u8|s16:channel_layouts=stereo -@end example - -@section amerge - -Merge two or more audio streams into a single multi-channel stream. - -The filter accepts the following options: - -@table @option - -@item inputs -Set the number of inputs. Default is 2. - -@end table - -If the channel layouts of the inputs are disjoint, and therefore compatible, -the channel layout of the output will be set accordingly and the channels -will be reordered as necessary. If the channel layouts of the inputs are not -disjoint, the output will have all the channels of the first input then all -the channels of the second input, in that order, and the channel layout of -the output will be the default value corresponding to the total number of -channels. - -For example, if the first input is in 2.1 (FL+FR+LF) and the second input -is FC+BL+BR, then the output will be in 5.1, with the channels in the -following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the -first input, b1 is the first channel of the second input). +For example, if the first input is in 2.1 (FL+FR+LF) and the second input +is FC+BL+BR, then the output will be in 5.1, with the channels in the +following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the +first input, b1 is the first channel of the second input). On the other hand, if both input are in stereo, the output channels will be in the default order: a1, a2, b1, b2, and the channel layout will be @@ -1071,6 +825,39 @@ amovie=file.ogg [a] ; amovie=file.mp3 [b] ; [a2] [b2] amerge @end example +@section asyncts + +Synchronize audio data with timestamps by squeezing/stretching it and/or +dropping samples/adding silence when needed. + +This filter is not built by default, please use @ref{aresample} to do squeezing/stretching. + +The filter accepts the following named parameters: +@table @option + +@item compensate +Enable stretching/squeezing the data to make it match the timestamps. Disabled +by default. When disabled, time gaps are covered with silence. + +@item min_delta +Minimum difference between timestamps and audio data (in seconds) to trigger +adding/dropping samples. Default value is 0.1. If you get non-perfect sync with +this filter, try setting this parameter to 0. + +@item max_comp +Maximum compensation in samples per second. Relevant only with compensate=1. +Default value 500. + +@item first_pts +Assume the first pts should be this value. The time base is 1 / sample rate. +This allows for padding/trimming at the start of stream. By default, no +assumption is made about the first frame's expected pts, so no padding or +trimming is done. For example, this could be set to 0 to pad the beginning with +silence if an audio stream starts after the video stream or to trim any samples +with a negative pts due to encoder delay. + +@end table + @section atempo Adjust audio tempo. @@ -1091,20 +878,393 @@ atempo=0.8 @item To speed up audio to 125% tempo: @example -atempo=1.25 +atempo=1.25 +@end example +@end itemize + +@section atrim + +Trim the input so that the output contains one continuous subpart of the input. + +This filter accepts the following options: +@table @option +@item start +Timestamp (in seconds) of the start of the kept section. I.e. the audio sample +with the timestamp @var{start} will be the first sample in the output. + +@item end +Timestamp (in seconds) of the first audio sample that will be dropped. I.e. the +audio sample immediately preceding the one with the timestamp @var{end} will be +the last sample in the output. + +@item start_pts +Same as @var{start}, except this option sets the start timestamp in samples +instead of seconds. + +@item end_pts +Same as @var{end}, except this option sets the end timestamp in samples instead +of seconds. + +@item duration +Maximum duration of the output in seconds. + +@item start_sample +Number of the first sample that should be passed to output. + +@item end_sample +Number of the first sample that should be dropped. +@end table + +Note that the first two sets of the start/end options and the @option{duration} +option look at the frame timestamp, while the _sample options simply count the +samples that pass through the filter. So start/end_pts and start/end_sample will +give different results when the timestamps are wrong, inexact or do not start at +zero. Also note that this filter does not modify the timestamps. If you wish +that the output timestamps start at zero, insert the asetpts filter after the +atrim filter. + +If multiple start or end options are set, this filter tries to be greedy and +keep all samples that match at least one of the specified constraints. To keep +only the part that matches all the constraints at once, chain multiple atrim +filters. + +The defaults are such that all the input is kept. So it is possible to set e.g. +just the end values to keep everything before the specified time. + +Examples: +@itemize +@item +drop everything except the second minute of input +@example +ffmpeg -i INPUT -af atrim=60:120 +@end example + +@item +keep only the first 1000 samples +@example +ffmpeg -i INPUT -af atrim=end_sample=1000 +@end example + +@end itemize + +@section bandpass + +Apply a two-pole Butterworth band-pass filter with central +frequency @var{frequency}, and (3dB-point) band-width width. +The @var{csg} option selects a constant skirt gain (peak gain = Q) +instead of the default: constant 0dB peak gain. +The filter roll off at 6dB per octave (20dB per decade). + +The filter accepts the following options: + +@table @option +@item frequency, f +Set the filter's central frequency. Default is @code{3000}. + +@item csg +Constant skirt gain if set to 1. Defaults to 0. + +@item width_type +Set method to specify band-width of filter. +@table @option +@item h +Hz +@item q +Q-Factor +@item o +octave +@item s +slope +@end table + +@item width, w +Specify the band-width of a filter in width_type units. +@end table + +@section bandreject + +Apply a two-pole Butterworth band-reject filter with central +frequency @var{frequency}, and (3dB-point) band-width @var{width}. +The filter roll off at 6dB per octave (20dB per decade). + +The filter accepts the following options: + +@table @option +@item frequency, f +Set the filter's central frequency. Default is @code{3000}. + +@item width_type +Set method to specify band-width of filter. +@table @option +@item h +Hz +@item q +Q-Factor +@item o +octave +@item s +slope +@end table + +@item width, w +Specify the band-width of a filter in width_type units. +@end table + +@section bass + +Boost or cut the bass (lower) frequencies of the audio using a two-pole +shelving filter with a response similar to that of a standard +hi-fi's tone-controls. This is also known as shelving equalisation (EQ). + +The filter accepts the following options: + +@table @option +@item gain, g +Give the gain at 0 Hz. Its useful range is about -20 +(for a large cut) to +20 (for a large boost). +Beware of clipping when using a positive gain. + +@item frequency, f +Set the filter's central frequency and so can be used +to extend or reduce the frequency range to be boosted or cut. +The default value is @code{100} Hz. + +@item width_type +Set method to specify band-width of filter. +@table @option +@item h +Hz +@item q +Q-Factor +@item o +octave +@item s +slope +@end table + +@item width, w +Determine how steep is the filter's shelf transition. +@end table + +@section biquad + +Apply a biquad IIR filter with the given coefficients. +Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2} +are the numerator and denominator coefficients respectively. + +@section channelmap + +Remap input channels to new locations. + +This filter accepts the following named parameters: +@table @option +@item channel_layout +Channel layout of the output stream. + +@item map +Map channels from input to output. The argument is a '|'-separated list of +mappings, each in the @code{@var{in_channel}-@var{out_channel}} or +@var{in_channel} form. @var{in_channel} can be either the name of the input +channel (e.g. FL for front left) or its index in the input channel layout. +@var{out_channel} is the name of the output channel or its index in the output +channel layout. If @var{out_channel} is not given then it is implicitly an +index, starting with zero and increasing by one for each mapping. +@end table + +If no mapping is present, the filter will implicitly map input channels to +output channels preserving index. + +For example, assuming a 5.1+downmix input MOV file +@example +ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav +@end example +will create an output WAV file tagged as stereo from the downmix channels of +the input. + +To fix a 5.1 WAV improperly encoded in AAC's native channel order +@example +ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:channel_layout=5.1' out.wav +@end example + +@section channelsplit + +Split each channel in input audio stream into a separate output stream. + +This filter accepts the following named parameters: +@table @option +@item channel_layout +Channel layout of the input stream. Default is "stereo". +@end table + +For example, assuming a stereo input MP3 file +@example +ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv +@end example +will create an output Matroska file with two audio streams, one containing only +the left channel and the other the right channel. + +To split a 5.1 WAV file into per-channel files +@example +ffmpeg -i in.wav -filter_complex +'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]' +-map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]' +front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]' +side_right.wav +@end example + +@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 +Set method to specify band-width of filter. +@table @option +@item h +Hz +@item q +Q-Factor +@item o +octave +@item s +slope +@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. +@end table + +@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 +Set method to specify band-width of filter. +@table @option +@item h +Hz +@item q +Q-Factor +@item o +octave +@item s +slope +@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. +@end table + +@section join + +Join multiple input streams into one multi-channel stream. + +The filter accepts the following named parameters: +@table @option + +@item inputs +Number of input streams. Defaults to 2. + +@item channel_layout +Desired output channel layout. 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 those 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. + +E.g. to join 3 inputs (with properly set channel layouts) +@example +ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT +@end example + +To 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 -@end itemize -@section earwax +@section lowpass -Make audio easier to listen to on headphones. +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). -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). +The filter accepts the following options: -Ported from SoX. +@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 +Set method to specify band-width of filter. +@table @option +@item h +Hz +@item q +Q-Factor +@item o +octave +@item s +slope +@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. +@end table @section pan @@ -1196,6 +1356,11 @@ front left and right: pan="stereo: c0=FR : c1=FR" @end example +@section resample + +Convert the audio sample format, sample rate and channel layout. This filter is +not meant to be used directly. + @section silencedetect Detect silence in an audio stream. @@ -1234,201 +1399,42 @@ ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null - @end example @end itemize -@section asyncts -Synchronize audio data with timestamps by squeezing/stretching it and/or -dropping samples/adding silence when needed. - -This filter is not built by default, please use @ref{aresample} to do squeezing/stretching. - -The filter accepts the following named parameters: -@table @option - -@item compensate -Enable stretching/squeezing the data to make it match the timestamps. Disabled -by default. When disabled, time gaps are covered with silence. - -@item min_delta -Minimum difference between timestamps and audio data (in seconds) to trigger -adding/dropping samples. Default value is 0.1. If you get non-perfect sync with -this filter, try setting this parameter to 0. - -@item max_comp -Maximum compensation in samples per second. Relevant only with compensate=1. -Default value 500. - -@item first_pts -Assume the first pts should be this value. The time base is 1 / sample rate. -This allows for padding/trimming at the start of stream. By default, no -assumption is made about the first frame's expected pts, so no padding or -trimming is done. For example, this could be set to 0 to pad the beginning with -silence if an audio stream starts after the video stream or to trim any samples -with a negative pts due to encoder delay. - -@end table - -@section atrim -Trim the input so that the output contains one continuous subpart of the input. - -This filter accepts the following options: -@table @option -@item start -Timestamp (in seconds) of the start of the kept section. I.e. the audio sample -with the timestamp @var{start} will be the first sample in the output. - -@item end -Timestamp (in seconds) of the first audio sample that will be dropped. I.e. the -audio sample immediately preceding the one with the timestamp @var{end} will be -the last sample in the output. - -@item start_pts -Same as @var{start}, except this option sets the start timestamp in samples -instead of seconds. - -@item end_pts -Same as @var{end}, except this option sets the end timestamp in samples instead -of seconds. - -@item duration -Maximum duration of the output in seconds. - -@item start_sample -Number of the first sample that should be passed to output. - -@item end_sample -Number of the first sample that should be dropped. -@end table - -Note that the first two sets of the start/end options and the @option{duration} -option look at the frame timestamp, while the _sample options simply count the -samples that pass through the filter. So start/end_pts and start/end_sample will -give different results when the timestamps are wrong, inexact or do not start at -zero. Also note that this filter does not modify the timestamps. If you wish -that the output timestamps start at zero, insert the asetpts filter after the -atrim filter. - -If multiple start or end options are set, this filter tries to be greedy and -keep all samples that match at least one of the specified constraints. To keep -only the part that matches all the constraints at once, chain multiple atrim -filters. - -The defaults are such that all the input is kept. So it is possible to set e.g. -just the end values to keep everything before the specified time. - -Examples: -@itemize -@item -drop everything except the second minute of input -@example -ffmpeg -i INPUT -af atrim=60:120 -@end example - -@item -keep only the first 1000 samples -@example -ffmpeg -i INPUT -af atrim=end_sample=1000 -@end example +@section treble -@end itemize +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). -@section channelsplit -Split each channel in input audio stream into a separate output stream. +The filter accepts the following options: -This filter accepts the following named parameters: @table @option -@item channel_layout -Channel layout of the input stream. Default is "stereo". -@end table - -For example, assuming a stereo input MP3 file -@example -ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv -@end example -will create an output Matroska file with two audio streams, one containing only -the left channel and the other the right channel. - -To split a 5.1 WAV file into per-channel files -@example -ffmpeg -i in.wav -filter_complex -'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]' --map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]' -front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]' -side_right.wav -@end example +@item 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. -@section channelmap -Remap input channels to new locations. +@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. -This filter accepts the following named parameters: +@item width_type +Set method to specify band-width of filter. @table @option -@item channel_layout -Channel layout of the output stream. - -@item map -Map channels from input to output. The argument is a '|'-separated list of -mappings, each in the @code{@var{in_channel}-@var{out_channel}} or -@var{in_channel} form. @var{in_channel} can be either the name of the input -channel (e.g. FL for front left) or its index in the input channel layout. -@var{out_channel} is the name of the output channel or its index in the output -channel layout. If @var{out_channel} is not given then it is implicitly an -index, starting with zero and increasing by one for each mapping. +@item h +Hz +@item q +Q-Factor +@item o +octave +@item s +slope @end table -If no mapping is present, the filter will implicitly map input channels to -output channels preserving index. - -For example, assuming a 5.1+downmix input MOV file -@example -ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav -@end example -will create an output WAV file tagged as stereo from the downmix channels of -the input. - -To fix a 5.1 WAV improperly encoded in AAC's native channel order -@example -ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:channel_layout=5.1' out.wav -@end example - -@section join -Join multiple input streams into one multi-channel stream. - -The filter accepts the following named parameters: -@table @option - -@item inputs -Number of input streams. Defaults to 2. - -@item channel_layout -Desired output channel layout. 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. +@item width, w +Determine how steep is the filter's shelf transition. @end table -The filter will attempt to guess the mappings when those 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. - -E.g. to join 3 inputs (with properly set channel layouts) -@example -ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT -@end example - -To 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 resample -Convert the audio sample format, sample rate and channel layout. This filter is -not meant to be used directly. - @section volume Adjust the input audio volume.