resampler.texi 7.7 KB

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