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