codekingpro/portable-devtools
114k
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">2<html>3<!-- Created by , GNU Texinfo 7.1.1 -->4 <head>5 <meta charset="utf-8">6 <title>7 FFmpeg Resampler Documentation8 </title>9 <meta name="viewport" content="width=device-width,initial-scale=1.0">10 <link rel="stylesheet" type="text/css" href="bootstrap.min.css">11 <link rel="stylesheet" type="text/css" href="style.min.css">12 </head>13 <body>14 <div class="container">15 <h1>16 FFmpeg Resampler Documentation17 </h1>18 19 20<a name="SEC_Top"></a>21 22<div class="element-contents" id="SEC_Contents">23<h2 class="contents-heading">Table of Contents</h2>24 25<div class="contents">26 27<ul class="toc-numbered-mark">28 <li><a id="toc-Description" href="#Description">1 Description</a></li>29 <li><a id="toc-Resampler-Options" href="#Resampler-Options">2 Resampler Options</a></li>30 <li><a id="toc-See-Also" href="#See-Also">3 See Also</a></li>31 <li><a id="toc-Authors" href="#Authors">4 Authors</a></li>32</ul>33</div>34</div>35 36<a name="Description"></a>37<h2 class="chapter">1 Description<span class="pull-right"><a class="anchor hidden-xs" href="#Description" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Description" aria-hidden="true">TOC</a></span></h2>38 39<p>The FFmpeg resampler provides a high-level interface to the40libswresample library audio resampling utilities. In particular it41allows one to perform audio resampling, audio channel layout rematrixing,42and convert audio format and packing layout.43</p>44 45<a name="Resampler-Options"></a>46<h2 class="chapter">2 Resampler Options<span class="pull-right"><a class="anchor hidden-xs" href="#Resampler-Options" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Resampler-Options" aria-hidden="true">TOC</a></span></h2>47 48<p>The audio resampler supports the following named options.49</p>50<p>Options may be set by specifying -<var class="var">option</var> <var class="var">value</var> in the51FFmpeg tools, <var class="var">option</var>=<var class="var">value</var> for the aresample filter,52by setting the value explicitly in the53<code class="code">SwrContext</code> options or using the <samp class="file">libavutil/opt.h</samp> API for54programmatic use.55</p>56<dl class="table">57<dt><samp class="option">uchl, used_chlayout</samp></dt>58<dd><p>Set used input channel layout. Default is unset. This option is59only used for special remapping.60</p>61</dd>62<dt><samp class="option">isr, in_sample_rate</samp></dt>63<dd><p>Set the input sample rate. Default value is 0.64</p>65</dd>66<dt><samp class="option">osr, out_sample_rate</samp></dt>67<dd><p>Set the output sample rate. Default value is 0.68</p>69</dd>70<dt><samp class="option">isf, in_sample_fmt</samp></dt>71<dd><p>Specify the input sample format. It is set by default to <code class="code">none</code>.72</p>73</dd>74<dt><samp class="option">osf, out_sample_fmt</samp></dt>75<dd><p>Specify the output sample format. It is set by default to <code class="code">none</code>.76</p>77</dd>78<dt><samp class="option">tsf, internal_sample_fmt</samp></dt>79<dd><p>Set the internal sample format. Default value is <code class="code">none</code>.80This will automatically be chosen when it is not explicitly set.81</p>82</dd>83<dt><samp class="option">ichl, in_chlayout</samp></dt>84<dt><samp class="option">ochl, out_chlayout</samp></dt>85<dd><p>Set the input/output channel layout.86</p>87<p>See <a data-manual="ffmpeg-utils" href="ffmpeg-utils.html#channel-layout-syntax">the Channel Layout section in the ffmpeg-utils(1) manual</a>88for the required syntax.89</p>90</dd>91<dt><samp class="option">clev, center_mix_level</samp></dt>92<dd><p>Set the center mix level. It is a value expressed in deciBel, and must be93in the interval [-32,32].94</p>95</dd>96<dt><samp class="option">slev, surround_mix_level</samp></dt>97<dd><p>Set the surround mix level. It is a value expressed in deciBel, and must98be in the interval [-32,32].99</p>100</dd>101<dt><samp class="option">lfe_mix_level</samp></dt>102<dd><p>Set LFE mix into non LFE level. It is used when there is a LFE input but no103LFE output. It is a value expressed in deciBel, and must104be in the interval [-32,32].105</p>106</dd>107<dt><samp class="option">rmvol, rematrix_volume</samp></dt>108<dd><p>Set rematrix volume. Default value is 1.0.109</p>110</dd>111<dt><samp class="option">rematrix_maxval</samp></dt>112<dd><p>Set maximum output value for rematrixing.113This can be used to prevent clipping vs. preventing volume reduction.114A value of 1.0 prevents clipping.115</p>116</dd>117<dt><samp class="option">flags, swr_flags</samp></dt>118<dd><p>Set flags used by the converter. Default value is 0.119</p>120<p>It supports the following individual flags:121</p><dl class="table">122<dt><samp class="option">res</samp></dt>123<dd><p>force resampling, this flag forces resampling to be used even when the124input and output sample rates match.125</p></dd>126</dl>127 128</dd>129<dt><samp class="option">dither_scale</samp></dt>130<dd><p>Set the dither scale. Default value is 1.131</p>132</dd>133<dt><samp class="option">dither_method</samp></dt>134<dd><p>Set dither method. Default value is 0.135</p>136<p>Supported values:137</p><dl class="table">138<dt>‘<samp class="samp">rectangular</samp>’</dt>139<dd><p>select rectangular dither140</p></dd>141<dt>‘<samp class="samp">triangular</samp>’</dt>142<dd><p>select triangular dither143</p></dd>144<dt>‘<samp class="samp">triangular_hp</samp>’</dt>145<dd><p>select triangular dither with high pass146</p></dd>147<dt>‘<samp class="samp">lipshitz</samp>’</dt>148<dd><p>select Lipshitz noise shaping dither.149</p></dd>150<dt>‘<samp class="samp">shibata</samp>’</dt>151<dd><p>select Shibata noise shaping dither.152</p></dd>153<dt>‘<samp class="samp">low_shibata</samp>’</dt>154<dd><p>select low Shibata noise shaping dither.155</p></dd>156<dt>‘<samp class="samp">high_shibata</samp>’</dt>157<dd><p>select high Shibata noise shaping dither.158</p></dd>159<dt>‘<samp class="samp">f_weighted</samp>’</dt>160<dd><p>select f-weighted noise shaping dither161</p></dd>162<dt>‘<samp class="samp">modified_e_weighted</samp>’</dt>163<dd><p>select modified-e-weighted noise shaping dither164</p></dd>165<dt>‘<samp class="samp">improved_e_weighted</samp>’</dt>166<dd><p>select improved-e-weighted noise shaping dither167</p>168</dd>169</dl>170 171</dd>172<dt><samp class="option">resampler</samp></dt>173<dd><p>Set resampling engine. Default value is swr.174</p>175<p>Supported values:176</p><dl class="table">177<dt>‘<samp class="samp">swr</samp>’</dt>178<dd><p>select the native SW Resampler; filter options precision and cheby are not179applicable in this case.180</p></dd>181<dt>‘<samp class="samp">soxr</samp>’</dt>182<dd><p>select the SoX Resampler (where available); compensation, and filter options183filter_size, phase_shift, exact_rational, filter_type & kaiser_beta, are not184applicable in this case.185</p></dd>186</dl>187 188</dd>189<dt><samp class="option">filter_size</samp></dt>190<dd><p>For swr only, set resampling filter size, default value is 32.191</p>192</dd>193<dt><samp class="option">phase_shift</samp></dt>194<dd><p>For swr only, set resampling phase shift, default value is 10, and must be in195the interval [0,30].196</p>197</dd>198<dt><samp class="option">linear_interp</samp></dt>199<dd><p>Use linear interpolation when enabled (the default). Disable it if you want200to preserve speed instead of quality when exact_rational fails.201</p>202</dd>203<dt><samp class="option">exact_rational</samp></dt>204<dd><p>For swr only, when enabled, try to use exact phase_count based on input and205output sample rate. However, if it is larger than <code class="code">1 << phase_shift</code>,206the phase_count will be <code class="code">1 << phase_shift</code> as fallback. Default is enabled.207</p>208</dd>209<dt><samp class="option">cutoff</samp></dt>210<dd><p>Set cutoff frequency (swr: 6dB point; soxr: 0dB point) ratio; must be a float211value between 0 and 1. Default value is 0.97 with swr, and 0.91 with soxr212(which, with a sample-rate of 44100, preserves the entire audio band to 20kHz).213</p>214</dd>215<dt><samp class="option">precision</samp></dt>216<dd><p>For soxr only, the precision in bits to which the resampled signal will be217calculated. The default value of 20 (which, with suitable dithering, is218appropriate for a destination bit-depth of 16) gives SoX’s ’High Quality’; a219value of 28 gives SoX’s ’Very High Quality’.220</p>221</dd>222<dt><samp class="option">cheby</samp></dt>223<dd><p>For soxr only, selects passband rolloff none (Chebyshev) & higher-precision224approximation for ’irrational’ ratios. Default value is 0.225</p>226</dd>227<dt><samp class="option">async</samp></dt>228<dd><p>For swr only, simple 1 parameter audio sync to timestamps using stretching,229squeezing, filling and trimming. Setting this to 1 will enable filling and230trimming, larger values represent the maximum amount in samples that the data231may be stretched or squeezed for each second.232Default value is 0, thus no compensation is applied to make the samples match233the audio timestamps.234</p>235</dd>236<dt><samp class="option">first_pts</samp></dt>237<dd><p>For swr only, assume the first pts should be this value. The time unit is 1 / sample rate.238This allows for padding/trimming at the start of stream. By default, no239assumption is made about the first frame’s expected pts, so no padding or240trimming is done. For example, this could be set to 0 to pad the beginning with241silence if an audio stream starts after the video stream or to trim any samples242with a negative pts due to encoder delay.243</p>244</dd>245<dt><samp class="option">min_comp</samp></dt>246<dd><p>For swr only, set the minimum difference between timestamps and audio data (in247seconds) to trigger stretching/squeezing/filling or trimming of the248data to make it match the timestamps. The default is that249stretching/squeezing/filling and trimming is disabled250(<samp class="option">min_comp</samp> = <code class="code">FLT_MAX</code>).251</p>252</dd>253<dt><samp class="option">min_hard_comp</samp></dt>254<dd><p>For swr only, set the minimum difference between timestamps and audio data (in255seconds) to trigger adding/dropping samples to make it match the256timestamps. This option effectively is a threshold to select between257hard (trim/fill) and soft (squeeze/stretch) compensation. Note that258all compensation is by default disabled through <samp class="option">min_comp</samp>.259The default is 0.1.260</p>261</dd>262<dt><samp class="option">comp_duration</samp></dt>263<dd><p>For swr only, set duration (in seconds) over which data is stretched/squeezed264to make it match the timestamps. Must be a non-negative double float value,265default value is 1.0.266</p>267</dd>268<dt><samp class="option">max_soft_comp</samp></dt>269<dd><p>For swr only, set maximum factor by which data is stretched/squeezed to make it270match the timestamps. Must be a non-negative double float value, default value271is 0.272</p>273</dd>274<dt><samp class="option">matrix_encoding</samp></dt>275<dd><p>Select matrixed stereo encoding.276</p>277<p>It accepts the following values:278</p><dl class="table">279<dt>‘<samp class="samp">none</samp>’</dt>280<dd><p>select none281</p></dd>282<dt>‘<samp class="samp">dolby</samp>’</dt>283<dd><p>select Dolby284</p></dd>285<dt>‘<samp class="samp">dplii</samp>’</dt>286<dd><p>select Dolby Pro Logic II287</p></dd>288</dl>289 290<p>Default value is <code class="code">none</code>.291</p>292</dd>293<dt><samp class="option">filter_type</samp></dt>294<dd><p>For swr only, select resampling filter type. This only affects resampling295operations.296</p>297<p>It accepts the following values:298</p><dl class="table">299<dt>‘<samp class="samp">cubic</samp>’</dt>300<dd><p>select cubic301</p></dd>302<dt>‘<samp class="samp">blackman_nuttall</samp>’</dt>303<dd><p>select Blackman Nuttall windowed sinc304</p></dd>305<dt>‘<samp class="samp">kaiser</samp>’</dt>306<dd><p>select Kaiser windowed sinc307</p></dd>308</dl>309 310</dd>311<dt><samp class="option">kaiser_beta</samp></dt>312<dd><p>For swr only, set Kaiser window beta value. Must be a double float value in the313interval [2,16], default value is 9.314</p>315</dd>316<dt><samp class="option">output_sample_bits</samp></dt>317<dd><p>For swr only, set number of used output sample bits for dithering. Must be an integer in the318interval [0,64], default value is 0, which means it’s not used.319</p>320</dd>321</dl>322 323 324<a name="See-Also"></a>325<h2 class="chapter">3 See Also<span class="pull-right"><a class="anchor hidden-xs" href="#See-Also" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-See-Also" aria-hidden="true">TOC</a></span></h2>326 327<p><a class="url" href="ffmpeg.html">ffmpeg</a>, <a class="url" href="ffplay.html">ffplay</a>, <a class="url" href="ffprobe.html">ffprobe</a>,328<a class="url" href="libswresample.html">libswresample</a>329</p>330 331<a name="Authors"></a>332<h2 class="chapter">4 Authors<span class="pull-right"><a class="anchor hidden-xs" href="#Authors" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Authors" aria-hidden="true">TOC</a></span></h2>333 334<p>The FFmpeg developers.335</p>336<p>For details about the authorship, see the Git history of the project337(https://git.ffmpeg.org/ffmpeg), e.g. by typing the command338<code class="command">git log</code> in the FFmpeg source directory, or browsing the339online repository at <a class="url" href="https://git.ffmpeg.org/ffmpeg">https://git.ffmpeg.org/ffmpeg</a>.340</p>341<p>Maintainers for the specific components are listed in the file342<samp class="file">MAINTAINERS</samp> in the source code tree.343</p>344 345 <p style="font-size: small;">346 This document was generated using <a class="uref" href="https://www.gnu.org/software/texinfo/"><em class="emph">makeinfo</em></a>.347 </p>348 </div>349 </body>350</html>351 