FFMPEG-RESAMPLER(1)
πΈ FFMPEG-RESAMPLER(1) β the resampler page, but make it make sense πΈ
okay bestie, welcome to the ffmpeg-resampler(1) manual page π«Ά this is the one that covers the FFmpeg Resampler, and trust me, it's lowkey iconic once you know what everything does.
β¨ DESCRIPTION β¨
So. The FFmpeg resampler is basically a high-level glow-up wrapper around the audio resampling utilities in libswresample. It's giving "let me handle the messy parts for you" π
Specifically, it lets you:
- do audio resampling
- do audio channel layout rematrixing
- convert audio format and packing layout
That's the whole vibe. Three things. Slay.
π RESAMPLER OPTIONS π
The audio resampler supports these named options. Not a subset, not "the important ones" β all of them. Periodt.
Quick note on how you set them (this part matters, ngl): you can set options by specifying -option value in the FFmpeg tools, or option=value for the aresample filter, or by setting the value explicitly in the SwrContext options, or by using the libavutil/opt.h API if you're doing it programmatically. Four whole ways. Choose your fighter π¦
uchl,used_chlayoutβ sets the used input channel layout. Default is unset. Heads up: this one is only used for special remapping, so don't come for it if it does nothing in your normal everyday situation πisr,in_sample_rateβ sets the input sample rate. Default value is0.osr,out_sample_rateβ sets the output sample rate. Default value is0.isf,in_sample_fmtβ specifies the input sample format. It's set by default tonone.osf,out_sample_fmtβ specifies the output sample format. It's set by default tonone.tsf,internal_sample_fmtβ sets the internal sample format. Default value isnone. The cute part: this gets automatically chosen when it's not explicitly set β¨ichl,in_chlayoutandochl,out_chlayoutβ set the input/output channel layout. For the required syntax, see the Channel Layout section in theffmpeg-utils(1)manual. iykyk, go read that one too πclev,center_mix_levelβ sets the center mix level. It's a value expressed in deciBel, and it must be in the interval[-32,32].slev,surround_mix_levelβ sets the surround mix level. Also expressed in deciBel, also must be in the interval[-32,32].lfe_mix_levelβ sets the LFE mix into non-LFE level. It's used when there's an LFE input but no LFE output. Expressed in deciBel, must be in the interval[-32,32]. (Yes, same interval. No, that's not a typo. Three for three π)rmvol,rematrix_volumeβ sets the rematrix volume. Default value is1.0.rematrix_maxvalβ sets the maximum output value for rematrixing. This is the classic tradeoff: use it to prevent clipping vs. prevent volume reduction. A value of1.0prevents clipping.flags,swr_flagsβ sets the flags used by the converter. Default value is0. It supports this individual flag:resβ force resampling. This flag forces resampling to be used even when the input and output sample rates match. Iconic stubbornness, honestly.
dither_scaleβ sets the dither scale. Default value is1.dither_methodβ sets the dither method. Default value is0. Supported values are:rectangularβ select rectangular dithertriangularβ select triangular dithertriangular_hpβ select triangular dither with high passlipshitzβ select Lipshitz noise shaping dither.shibataβ select Shibata noise shaping dither.low_shibataβ select low Shibata noise shaping dither.high_shibataβ select high Shibata noise shaping dither.f_weightedβ select f-weighted noise shaping dithermodified_e_weightedβ select modified-e-weighted noise shaping ditherimproved_e_weightedβ select improved-e-weighted noise shaping dither
resamplerβ sets the resampling engine. Default value isswr. Supported values:swrβ select the native SW Resampler. In this case, the filter optionsprecisionandchebyare not applicable.soxrβ select the SoX Resampler (where available). In this case,compensation, and the filter optionsfilter_size,phase_shift,exact_rational,filter_type&kaiser_beta, are not applicable.
filter_sizeβ forswronly. Sets the resampling filter size. Default value is32.phase_shiftβ forswronly. Sets the resampling phase shift. Default value is10, and it must be in the interval[0,30].linear_interpβ uses linear interpolation when enabled (and it is enabled by default). Disable it if you want to preserve speed instead of quality whenexact_rationalfails. Pick your priorities bestie π₯exact_rationalβ forswronly. When enabled, it tries to use exactphase_countbased on input and output sample rate. However β and this is the important bit β if that ends up larger than1 << phase_shift, thephase_countwill be1 << phase_shiftas a fallback. Default is enabled.cutoffβ sets the cutoff frequency ratio (swr: 6dB point;soxr: 0dB point). Must be a float value between0and1. Default value is0.97withswr, and0.91withsoxr(which, with a sample-rate of44100, preserves the entire audio band to20kHz). Very demure, very mindful πprecisionβ forsoxronly. The precision in bits to which the resampled signal will be calculated. The default value of20(which, with suitable dithering, is appropriate for a destination bit-depth of16) gives SoX's 'High Quality'; a value of28gives SoX's 'Very High Quality'.chebyβ forsoxronly. Selects passband rolloff none (Chebyshev) & higher-precision approximation for 'irrational' ratios. Default value is0.asyncβ forswronly. Simple 1 parameter audio sync to timestamps using stretching, squeezing, filling and trimming. Setting this to1will 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 is0, so no compensation is applied to make the samples match the audio timestamps.first_ptsβ forswronly. Assume the first pts should be this value. The time unit is1 / sample rate. This allows for padding/trimming at the start of the stream. By default, no assumption is made about the first frame's expected pts, so no padding or trimming is done. Example time: this could be set to0to 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. Both valid, both useful π«Άmin_compβ forswronly. Sets 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).min_hard_compβ forswronly. Sets the minimum difference between timestamps and audio data (in seconds) to trigger adding/dropping samples to make it match the timestamps. This option is effectively a threshold to select between hard (trim/fill) and soft (squeeze/stretch) compensation. Note that all compensation is by default disabled throughmin_comp. The default here is0.1.comp_durationβ forswronly. Sets the 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 is1.0.max_soft_compβ forswronly. Sets the maximum factor by which data is stretched/squeezed to make it match the timestamps. Must be a non-negative double float value, default value is0.matrix_encodingβ selects matrixed stereo encoding. It accepts the following values:noneβ select nonedolbyβ select Dolbydpliiβ select Dolby Pro Logic II
Default value is none.
filter_typeβ forswronly. Selects the resampling filter type. This only affects resampling operations. It accepts the following values:cubicβ select cubicblackman_nuttallβ select Blackman Nuttall windowed sinckaiserβ select Kaiser windowed sinc
kaiser_betaβ forswronly. Sets the Kaiser window beta value. Must be a double float value in the interval[2,16], default value is9.output_sample_bitsβ forswronly. Sets the number of used output sample bits for dithering. Must be an integer in the interval[0,64], default value is0, which means it's not used.
fr fr, theswr-only andsoxr-only labels are not decoration β they tell you which engine actually reads that option. Don't setprecisiononswrand then wonder why nothing happened π
π¦ SEE ALSO π¦
Go read them, bestie, they're all connected. It's a whole ecosystem π
π AUTHORS π
The FFmpeg developers.
For details about the authorship, see the Git history of the project (https://git.ffmpeg.org/ffmpeg), e.g. by typing the command git log in the FFmpeg source directory, or browsing the online repository at https://git.ffmpeg.org/ffmpeg.
Maintainers for the specific components are listed in the file MAINTAINERS in the source code tree.
and that's the whole page, bestie β¨ we started with the header FFMPEG-RESAMPLER(1) and we're ending right back on it β that's the footer, same name, no cap. main character energy from top to bottom π π
π¦ where this page comes from
- alpine 3.24: ffmpeg-doc 8.1.3-r0 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- alpine 3.24: ffmpeg6-doc 6.1.6-r0 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- alpine 3.24: ffmpeg7-doc 7.1.5-r0 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- nixos 26.05: ffmpeg 8.1.3
- nixos 26.05: ffmpeg-full 8.1.3
- nixos 26.05: ffmpeg-headless 8.1.3
- nixos 26.05: jellyfin-ffmpeg 7.1.4-3
- nixpkgs unstable: ffmpeg 9.0.2
- nixpkgs unstable: ffmpeg-full 9.0.2
- nixpkgs unstable: ffmpeg-headless 9.0.2
- nixpkgs unstable: ffmpeg-livepeer 7.0.1-unstable-2024-07-10
- nixpkgs unstable: jellyfin-ffmpeg 8.1.3-1
- opensuse-leap 16.0: ffmpeg-7 7.1.5-160000.1.1 Β· GPL-3.0-or-later
- opensuse-leap 16.0: ffmpeg-7 7.1.5-160000.1.1 Β· GPL-3.0-or-later
- opensuse-leap 16.0: ffmpeg-7 7.1.5-160000.1.1 Β· GPL-3.0-or-later
- opensuse-leap 16.0: ffmpeg-7 7.1.5-160000.1.1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms