resampler.texi 7.3 KB

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