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