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