1FFMPEG-RESAMPLER(1) FFMPEG-RESAMPLER(1)
2
3
4
6 ffmpeg-resampler - FFmpeg Resampler
7
9 The FFmpeg resampler provides a high-level interface to the
10 libswresample library audio resampling utilities. In particular it
11 allows one to perform audio resampling, audio channel layout
12 rematrixing, and convert audio format and packing layout.
13
15 The audio resampler supports the following named options.
16
17 Options may be set by specifying -option value in the FFmpeg tools,
18 option=value for the aresample filter, by setting the value explicitly
19 in the "SwrContext" options or using the libavutil/opt.h API for
20 programmatic use.
21
22 uchl, used_chlayout
23 Set used input channel layout. Default is unset. This option is
24 only used for special remapping.
25
26 isr, in_sample_rate
27 Set the input sample rate. Default value is 0.
28
29 osr, out_sample_rate
30 Set the output sample rate. Default value is 0.
31
32 isf, in_sample_fmt
33 Specify the input sample format. It is set by default to "none".
34
35 osf, out_sample_fmt
36 Specify the output sample format. It is set by default to "none".
37
38 tsf, internal_sample_fmt
39 Set the internal sample format. Default value is "none". This will
40 automatically be chosen when it is not explicitly set.
41
42 ichl, in_chlayout
43 ochl, out_chlayout
44 Set the input/output channel layout.
45
46 See the Channel Layout section in the ffmpeg-utils(1) manual for
47 the required syntax.
48
49 clev, center_mix_level
50 Set the center mix level. It is a value expressed in deciBel, and
51 must be in the interval [-32,32].
52
53 slev, surround_mix_level
54 Set the surround mix level. It is a value expressed in deciBel, and
55 must be in the interval [-32,32].
56
57 lfe_mix_level
58 Set LFE mix into non LFE level. It is used when there is a LFE
59 input but no LFE output. It is a value expressed in deciBel, and
60 must be in the interval [-32,32].
61
62 rmvol, rematrix_volume
63 Set rematrix volume. Default value is 1.0.
64
65 rematrix_maxval
66 Set maximum output value for rematrixing. This can be used to
67 prevent clipping vs. preventing volume reduction. A value of 1.0
68 prevents clipping.
69
70 flags, swr_flags
71 Set flags used by the converter. Default value is 0.
72
73 It supports the following individual flags:
74
75 res force resampling, this flag forces resampling to be used even
76 when the input and output sample rates match.
77
78 dither_scale
79 Set the dither scale. Default value is 1.
80
81 dither_method
82 Set dither method. Default value is 0.
83
84 Supported values:
85
86 rectangular
87 select rectangular dither
88
89 triangular
90 select triangular dither
91
92 triangular_hp
93 select triangular dither with high pass
94
95 lipshitz
96 select Lipshitz noise shaping dither.
97
98 shibata
99 select Shibata noise shaping dither.
100
101 low_shibata
102 select low Shibata noise shaping dither.
103
104 high_shibata
105 select high Shibata noise shaping dither.
106
107 f_weighted
108 select f-weighted noise shaping dither
109
110 modified_e_weighted
111 select modified-e-weighted noise shaping dither
112
113 improved_e_weighted
114 select improved-e-weighted noise shaping dither
115
116 resampler
117 Set resampling engine. Default value is swr.
118
119 Supported values:
120
121 swr select the native SW Resampler; filter options precision and
122 cheby are not applicable in this case.
123
124 soxr
125 select the SoX Resampler (where available); compensation, and
126 filter options filter_size, phase_shift, exact_rational,
127 filter_type & kaiser_beta, are not applicable in this case.
128
129 filter_size
130 For swr only, set resampling filter size, default value is 32.
131
132 phase_shift
133 For swr only, set resampling phase shift, default value is 10, and
134 must be in the interval [0,30].
135
136 linear_interp
137 Use linear interpolation when enabled (the default). Disable it if
138 you want to preserve speed instead of quality when exact_rational
139 fails.
140
141 exact_rational
142 For swr only, when enabled, try to use exact phase_count based on
143 input and output sample rate. However, if it is larger than "1 <<
144 phase_shift", the phase_count will be "1 << phase_shift" as
145 fallback. Default is enabled.
146
147 cutoff
148 Set cutoff frequency (swr: 6dB point; soxr: 0dB point) ratio; must
149 be a float value between 0 and 1. Default value is 0.97 with swr,
150 and 0.91 with soxr (which, with a sample-rate of 44100, preserves
151 the entire audio band to 20kHz).
152
153 precision
154 For soxr only, the precision in bits to which the resampled signal
155 will be calculated. The default value of 20 (which, with suitable
156 dithering, is appropriate for a destination bit-depth of 16) gives
157 SoX's 'High Quality'; a value of 28 gives SoX's 'Very High
158 Quality'.
159
160 cheby
161 For soxr only, selects passband rolloff none (Chebyshev) & higher-
162 precision approximation for 'irrational' ratios. Default value is
163 0.
164
165 async
166 For swr only, simple 1 parameter audio sync to timestamps using
167 stretching, squeezing, filling and trimming. Setting this to 1 will
168 enable filling and trimming, larger values represent the maximum
169 amount in samples that the data may be stretched or squeezed for
170 each second. Default value is 0, thus no compensation is applied
171 to make the samples match the audio timestamps.
172
173 first_pts
174 For swr only, assume the first pts should be this value. The time
175 unit is 1 / sample rate. This allows for padding/trimming at the
176 start of stream. By default, no assumption is made about the first
177 frame's expected pts, so no padding or trimming is done. For
178 example, this could be set to 0 to pad the beginning with silence
179 if an audio stream starts after the video stream or to trim any
180 samples with a negative pts due to encoder delay.
181
182 min_comp
183 For swr only, set the minimum difference between timestamps and
184 audio data (in seconds) to trigger stretching/squeezing/filling or
185 trimming of the data to make it match the timestamps. The default
186 is that stretching/squeezing/filling and trimming is disabled
187 (min_comp = "FLT_MAX").
188
189 min_hard_comp
190 For swr only, set the minimum difference between timestamps and
191 audio data (in seconds) to trigger adding/dropping samples to make
192 it match the timestamps. This option effectively is a threshold to
193 select between hard (trim/fill) and soft (squeeze/stretch)
194 compensation. Note that all compensation is by default disabled
195 through min_comp. The default is 0.1.
196
197 comp_duration
198 For swr only, set duration (in seconds) over which data is
199 stretched/squeezed to make it match the timestamps. Must be a non-
200 negative double float value, default value is 1.0.
201
202 max_soft_comp
203 For swr only, set maximum factor by which data is
204 stretched/squeezed to make it match the timestamps. Must be a non-
205 negative double float value, default value is 0.
206
207 matrix_encoding
208 Select matrixed stereo encoding.
209
210 It accepts the following values:
211
212 none
213 select none
214
215 dolby
216 select Dolby
217
218 dplii
219 select Dolby Pro Logic II
220
221 Default value is "none".
222
223 filter_type
224 For swr only, select resampling filter type. This only affects
225 resampling operations.
226
227 It accepts the following values:
228
229 cubic
230 select cubic
231
232 blackman_nuttall
233 select Blackman Nuttall windowed sinc
234
235 kaiser
236 select Kaiser windowed sinc
237
238 kaiser_beta
239 For swr only, set Kaiser window beta value. Must be a double float
240 value in the interval [2,16], default value is 9.
241
242 output_sample_bits
243 For swr only, set number of used output sample bits for dithering.
244 Must be an integer in the interval [0,64], default value is 0,
245 which means it's not used.
246
248 ffmpeg(1), ffplay(1), ffprobe(1), libswresample(3)
249
251 The FFmpeg developers.
252
253 For details about the authorship, see the Git history of the project
254 (https://git.ffmpeg.org/ffmpeg), e.g. by typing the command git log in
255 the FFmpeg source directory, or browsing the online repository at
256 <https://git.ffmpeg.org/ffmpeg>.
257
258 Maintainers for the specific components are listed in the file
259 MAINTAINERS in the source code tree.
260
261
262
263 FFMPEG-RESAMPLER(1)