The FFmpeg resampler provides an high-level interface to the libswresample library audio resampling utilities. In particular it allows to perform audio resampling, audio channel layout rematrixing, and convert audio format and packing layout.
The audio resampler supports the following named options.
Options may be set by specifying -option value in the
FFmpeg tools, option=value for the aresample filter,
by setting the value explicitly in the
SwrContext
options or using the ‘libavutil/opt.h’ API for
programmatic use.
Set the number of input channels. Default value is 0. Setting this value is not mandatory if the corresponding channel layout ‘in_channel_layout’ is set.
Set the number of output channels. Default value is 0. Setting this value is not mandatory if the corresponding channel layout ‘out_channel_layout’ is set.
Set the number of used channels. Default value is 0. This option is only used for special remapping.
Set the input sample rate. Default value is 0.
Set the output sample rate. Default value is 0.
Specify the input sample format. It is set by default to none
.
Specify the output sample format. It is set by default to none
.
Set the internal sample format. Default value is none
.
Set the input channel layout.
Set the output channel layout.
Set center mix level. It is a value expressed in deciBel, and must be inclusively included between -32 and +32.
Set surround mix level. It is a value expressed in deciBel, and must be inclusively included between -32 and +32.
Set LFE mix level.
Set rematrix volume. Default value is 1.0.
Set flags used by the converter. Default value is 0.
It supports the following individual flags:
force resampling
Set the dither scale. Default value is 1.
Set dither method. Default value is 0.
Supported values:
select rectangular dither
select triangular dither
select triangular dither with high pass
Set resampling engine. Default value is swr.
Supported values:
select the native SW Resampler; filter options precision and cheby are not applicable in this case.
select the SoX Resampler (where available); compensation, and filter options filter_size, phase_shift, filter_type & kaiser_beta, are not applicable in this case.
For swr only, set resampling filter size, default value is 32.
For swr only, set resampling phase shift, default value is 10, must be included between 0 and 30.
Use Linear Interpolation if set to 1, default value is 0.
Set cutoff frequency (swr: 6dB point; soxr: 0dB point) ratio; must be a float value between 0 and 1. Default value is 0.97 with swr, and 0.91 with soxr (which, with a sample-rate of 44100, preserves the entire audio band to 20kHz).
For soxr only, the precision in bits to which the resampled signal will be calculated. The default value of 20 (which, with suitable dithering, is appropriate for a destination bit-depth of 16) gives SoX’s ’High Quality’; a value of 28 gives SoX’s ’Very High Quality’.
For soxr only, selects passband rolloff none (Chebyshev) & higher-precision approximation for ’irrational’ ratios. Default value is 0.
For swr only, simple 1 parameter audio sync to timestamps using stretching, squeezing, filling and trimming. Setting this to 1 will enable filling and trimming, larger values represent the maximum amount in samples that the data may be stretched or squeezed for each second. Default value is 0, thus no compensation is applied to make the samples match the audio timestamps.
For swr only, set the minimum difference between timestamps and audio data (in
seconds) to trigger stretching/squeezing/filling or trimming of the
data to make it match the timestamps. The default is that
stretching/squeezing/filling and trimming is disabled
(‘min_comp’ = FLT_MAX
).
For swr only, set the minimum difference between timestamps and audio data (in seconds) to trigger adding/dropping samples to make it match the timestamps. This option effectively is a threshold to select between hard (trim/fill) and soft (squeeze/stretch) compensation. Note that all compensation is by default disabled through ‘min_comp’. The default is 0.1.
For swr only, set duration (in seconds) over which data is stretched/squeezed to make it match the timestamps. Must be a non-negative double float value, default value is 1.0.
For swr only, set maximum factor by which data is stretched/squeezed to make it match the timestamps. Must be a non-negative double float value, default value is 0.
Select matrixed stereo encoding.
It accepts the following values:
select none
select Dolby
select Dolby Pro Logic II
Default value is none
.
For swr only, select resampling filter type. This only affects resampling operations.
It accepts the following values:
select cubic
select Blackman Nuttall Windowed Sinc
select Kaiser Windowed Sinc
For swr only, set Kaiser Window Beta value. Must be an integer included between 2 and 16, default value is 9.
ffmpeg, ffplay, ffprobe, ffserver, libswresample
The FFmpeg developers.
For details about the authorship, see the Git history of the project
(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
git log
in the FFmpeg source directory, or browsing the
online repository at http://source.ffmpeg.org.
Maintainers for the specific components are listed in the file ‘MAINTAINERS’ in the source code tree.