You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

372 lines
13 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>FFmpeg documentation</title>
<link rel="stylesheet" href="bootstrap.min.css" />
<link rel="stylesheet" href="style.min.css" />
<meta name="description" content="FFmpeg Resampler Documentation: ">
<meta name="keywords" content="FFmpeg documentation : FFmpeg Resampler ">
<meta name="Generator" content="texi2html 5.0">
<!-- Created on July 3, 2018 by texi2html 5.0 -->
<!--
texi2html was written by:
Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="container">
<h1 class="titlefont">FFmpeg Resampler Documentation</h1>
<hr>
<a name="SEC_Top"></a>
<a name="SEC_Contents"></a>
<h1>Table of Contents</h1>
<div class="contents">
<ul class="no-bullet">
<li><a name="toc-Description" href="#Description">1 Description</a></li>
<li><a name="toc-Resampler-Options" href="#Resampler-Options">2 Resampler Options</a></li>
<li><a name="toc-See-Also" href="#See-Also">3 See Also</a></li>
<li><a name="toc-Authors" href="#Authors">4 Authors</a></li>
</ul>
</div>
<hr size="6">
<a name="Description"></a>
<h1 class="chapter"><a href="ffmpeg-resampler.html#toc-Description">1 Description</a></h1>
<p>The FFmpeg resampler provides a high-level interface to the
libswresample library audio resampling utilities. In particular it
allows one to perform audio resampling, audio channel layout rematrixing,
and convert audio format and packing layout.
</p>
<a name="Resampler-Options"></a>
<h1 class="chapter"><a href="ffmpeg-resampler.html#toc-Resampler-Options">2 Resampler Options</a></h1>
<p>The audio resampler supports the following named options.
</p>
<p>Options may be set by specifying -<var>option</var> <var>value</var> in the
FFmpeg tools, <var>option</var>=<var>value</var> for the aresample filter,
by setting the value explicitly in the
<code>SwrContext</code> options or using the &lsquo;<tt>libavutil/opt.h</tt>&rsquo; API for
programmatic use.
</p>
<dl compact="compact">
<dt>&lsquo;<samp>ich, in_channel_count</samp>&rsquo;</dt>
<dd><p>Set the number of input channels. Default value is 0. Setting this
value is not mandatory if the corresponding channel layout
&lsquo;<samp>in_channel_layout</samp>&rsquo; is set.
</p>
</dd>
<dt>&lsquo;<samp>och, out_channel_count</samp>&rsquo;</dt>
<dd><p>Set the number of output channels. Default value is 0. Setting this
value is not mandatory if the corresponding channel layout
&lsquo;<samp>out_channel_layout</samp>&rsquo; is set.
</p>
</dd>
<dt>&lsquo;<samp>uch, used_channel_count</samp>&rsquo;</dt>
<dd><p>Set the number of used input channels. Default value is 0. This option is
only used for special remapping.
</p>
</dd>
<dt>&lsquo;<samp>isr, in_sample_rate</samp>&rsquo;</dt>
<dd><p>Set the input sample rate. Default value is 0.
</p>
</dd>
<dt>&lsquo;<samp>osr, out_sample_rate</samp>&rsquo;</dt>
<dd><p>Set the output sample rate. Default value is 0.
</p>
</dd>
<dt>&lsquo;<samp>isf, in_sample_fmt</samp>&rsquo;</dt>
<dd><p>Specify the input sample format. It is set by default to <code>none</code>.
</p>
</dd>
<dt>&lsquo;<samp>osf, out_sample_fmt</samp>&rsquo;</dt>
<dd><p>Specify the output sample format. It is set by default to <code>none</code>.
</p>
</dd>
<dt>&lsquo;<samp>tsf, internal_sample_fmt</samp>&rsquo;</dt>
<dd><p>Set the internal sample format. Default value is <code>none</code>.
This will automatically be chosen when it is not explicitly set.
</p>
</dd>
<dt>&lsquo;<samp>icl, in_channel_layout</samp>&rsquo;</dt>
<dt>&lsquo;<samp>ocl, out_channel_layout</samp>&rsquo;</dt>
<dd><p>Set the input/output channel layout.
</p>
<p>See <a href="ffmpeg-utils.html#channel-layout-syntax">(ffmpeg-utils)the Channel Layout section in the ffmpeg-utils(1) manual</a>
for the required syntax.
</p>
</dd>
<dt>&lsquo;<samp>clev, center_mix_level</samp>&rsquo;</dt>
<dd><p>Set the center mix level. It is a value expressed in deciBel, and must be
in the interval [-32,32].
</p>
</dd>
<dt>&lsquo;<samp>slev, surround_mix_level</samp>&rsquo;</dt>
<dd><p>Set the surround mix level. It is a value expressed in deciBel, and must
be in the interval [-32,32].
</p>
</dd>
<dt>&lsquo;<samp>lfe_mix_level</samp>&rsquo;</dt>
<dd><p>Set LFE mix into non LFE level. It is used when there is a LFE input but no
LFE output. It is a value expressed in deciBel, and must
be in the interval [-32,32].
</p>
</dd>
<dt>&lsquo;<samp>rmvol, rematrix_volume</samp>&rsquo;</dt>
<dd><p>Set rematrix volume. Default value is 1.0.
</p>
</dd>
<dt>&lsquo;<samp>rematrix_maxval</samp>&rsquo;</dt>
<dd><p>Set maximum output value for rematrixing.
This can be used to prevent clipping vs. preventing volume reduction.
A value of 1.0 prevents clipping.
</p>
</dd>
<dt>&lsquo;<samp>flags, swr_flags</samp>&rsquo;</dt>
<dd><p>Set flags used by the converter. Default value is 0.
</p>
<p>It supports the following individual flags:
</p><dl compact="compact">
<dt>&lsquo;<samp>res</samp>&rsquo;</dt>
<dd><p>force resampling, this flag forces resampling to be used even when the
input and output sample rates match.
</p></dd>
</dl>
</dd>
<dt>&lsquo;<samp>dither_scale</samp>&rsquo;</dt>
<dd><p>Set the dither scale. Default value is 1.
</p>
</dd>
<dt>&lsquo;<samp>dither_method</samp>&rsquo;</dt>
<dd><p>Set dither method. Default value is 0.
</p>
<p>Supported values:
</p><dl compact="compact">
<dt>&lsquo;<samp>rectangular</samp>&rsquo;</dt>
<dd><p>select rectangular dither
</p></dd>
<dt>&lsquo;<samp>triangular</samp>&rsquo;</dt>
<dd><p>select triangular dither
</p></dd>
<dt>&lsquo;<samp>triangular_hp</samp>&rsquo;</dt>
<dd><p>select triangular dither with high pass
</p></dd>
<dt>&lsquo;<samp>lipshitz</samp>&rsquo;</dt>
<dd><p>select Lipshitz noise shaping dither.
</p></dd>
<dt>&lsquo;<samp>shibata</samp>&rsquo;</dt>
<dd><p>select Shibata noise shaping dither.
</p></dd>
<dt>&lsquo;<samp>low_shibata</samp>&rsquo;</dt>
<dd><p>select low Shibata noise shaping dither.
</p></dd>
<dt>&lsquo;<samp>high_shibata</samp>&rsquo;</dt>
<dd><p>select high Shibata noise shaping dither.
</p></dd>
<dt>&lsquo;<samp>f_weighted</samp>&rsquo;</dt>
<dd><p>select f-weighted noise shaping dither
</p></dd>
<dt>&lsquo;<samp>modified_e_weighted</samp>&rsquo;</dt>
<dd><p>select modified-e-weighted noise shaping dither
</p></dd>
<dt>&lsquo;<samp>improved_e_weighted</samp>&rsquo;</dt>
<dd><p>select improved-e-weighted noise shaping dither
</p>
</dd>
</dl>
</dd>
<dt>&lsquo;<samp>resampler</samp>&rsquo;</dt>
<dd><p>Set resampling engine. Default value is swr.
</p>
<p>Supported values:
</p><dl compact="compact">
<dt>&lsquo;<samp>swr</samp>&rsquo;</dt>
<dd><p>select the native SW Resampler; filter options precision and cheby are not
applicable in this case.
</p></dd>
<dt>&lsquo;<samp>soxr</samp>&rsquo;</dt>
<dd><p>select the SoX Resampler (where available); compensation, and filter options
filter_size, phase_shift, exact_rational, filter_type &amp; kaiser_beta, are not
applicable in this case.
</p></dd>
</dl>
</dd>
<dt>&lsquo;<samp>filter_size</samp>&rsquo;</dt>
<dd><p>For swr only, set resampling filter size, default value is 32.
</p>
</dd>
<dt>&lsquo;<samp>phase_shift</samp>&rsquo;</dt>
<dd><p>For swr only, set resampling phase shift, default value is 10, and must be in
the interval [0,30].
</p>
</dd>
<dt>&lsquo;<samp>linear_interp</samp>&rsquo;</dt>
<dd><p>Use linear interpolation when enabled (the default). Disable it if you want
to preserve speed instead of quality when exact_rational fails.
</p>
</dd>
<dt>&lsquo;<samp>exact_rational</samp>&rsquo;</dt>
<dd><p>For swr only, when enabled, try to use exact phase_count based on input and
output sample rate. However, if it is larger than <code>1 &lt;&lt; phase_shift</code>,
the phase_count will be <code>1 &lt;&lt; phase_shift</code> as fallback. Default is enabled.
</p>
</dd>
<dt>&lsquo;<samp>cutoff</samp>&rsquo;</dt>
<dd><p>Set cutoff frequency (swr: 6dB point; soxr: 0dB point) ratio; must be a float
value between 0 and 1. Default value is 0.97 with swr, and 0.91 with soxr
(which, with a sample-rate of 44100, preserves the entire audio band to 20kHz).
</p>
</dd>
<dt>&lsquo;<samp>precision</samp>&rsquo;</dt>
<dd><p>For soxr only, the precision in bits to which the resampled signal will be
calculated. The default value of 20 (which, with suitable dithering, is
appropriate for a destination bit-depth of 16) gives SoX&rsquo;s &rsquo;High Quality&rsquo;; a
value of 28 gives SoX&rsquo;s &rsquo;Very High Quality&rsquo;.
</p>
</dd>
<dt>&lsquo;<samp>cheby</samp>&rsquo;</dt>
<dd><p>For soxr only, selects passband rolloff none (Chebyshev) &amp; higher-precision
approximation for &rsquo;irrational&rsquo; ratios. Default value is 0.
</p>
</dd>
<dt>&lsquo;<samp>async</samp>&rsquo;</dt>
<dd><p>For swr only, simple 1 parameter audio sync to timestamps using stretching,
squeezing, filling and trimming. Setting this to 1 will enable filling and
trimming, larger values represent the maximum amount in samples that the data
may be stretched or squeezed for each second.
Default value is 0, thus no compensation is applied to make the samples match
the audio timestamps.
</p>
</dd>
<dt>&lsquo;<samp>first_pts</samp>&rsquo;</dt>
<dd><p>For swr only, assume the first pts should be this value. The time unit is 1 / sample rate.
This allows for padding/trimming at the start of stream. By default, no
assumption is made about the first frame&rsquo;s expected pts, so no padding or
trimming is done. For example, this could be set to 0 to pad the beginning with
silence if an audio stream starts after the video stream or to trim any samples
with a negative pts due to encoder delay.
</p>
</dd>
<dt>&lsquo;<samp>min_comp</samp>&rsquo;</dt>
<dd><p>For swr only, set the minimum difference between timestamps and audio data (in
seconds) to trigger stretching/squeezing/filling or trimming of the
data to make it match the timestamps. The default is that
stretching/squeezing/filling and trimming is disabled
(&lsquo;<samp>min_comp</samp>&rsquo; = <code>FLT_MAX</code>).
</p>
</dd>
<dt>&lsquo;<samp>min_hard_comp</samp>&rsquo;</dt>
<dd><p>For swr only, set the minimum difference between timestamps and audio data (in
seconds) to trigger adding/dropping samples to make it match the
timestamps. This option effectively is a threshold to select between
hard (trim/fill) and soft (squeeze/stretch) compensation. Note that
all compensation is by default disabled through &lsquo;<samp>min_comp</samp>&rsquo;.
The default is 0.1.
</p>
</dd>
<dt>&lsquo;<samp>comp_duration</samp>&rsquo;</dt>
<dd><p>For swr only, set duration (in seconds) over which data is stretched/squeezed
to make it match the timestamps. Must be a non-negative double float value,
default value is 1.0.
</p>
</dd>
<dt>&lsquo;<samp>max_soft_comp</samp>&rsquo;</dt>
<dd><p>For swr only, set maximum factor by which data is stretched/squeezed to make it
match the timestamps. Must be a non-negative double float value, default value
is 0.
</p>
</dd>
<dt>&lsquo;<samp>matrix_encoding</samp>&rsquo;</dt>
<dd><p>Select matrixed stereo encoding.
</p>
<p>It accepts the following values:
</p><dl compact="compact">
<dt>&lsquo;<samp>none</samp>&rsquo;</dt>
<dd><p>select none
</p></dd>
<dt>&lsquo;<samp>dolby</samp>&rsquo;</dt>
<dd><p>select Dolby
</p></dd>
<dt>&lsquo;<samp>dplii</samp>&rsquo;</dt>
<dd><p>select Dolby Pro Logic II
</p></dd>
</dl>
<p>Default value is <code>none</code>.
</p>
</dd>
<dt>&lsquo;<samp>filter_type</samp>&rsquo;</dt>
<dd><p>For swr only, select resampling filter type. This only affects resampling
operations.
</p>
<p>It accepts the following values:
</p><dl compact="compact">
<dt>&lsquo;<samp>cubic</samp>&rsquo;</dt>
<dd><p>select cubic
</p></dd>
<dt>&lsquo;<samp>blackman_nuttall</samp>&rsquo;</dt>
<dd><p>select Blackman Nuttall windowed sinc
</p></dd>
<dt>&lsquo;<samp>kaiser</samp>&rsquo;</dt>
<dd><p>select Kaiser windowed sinc
</p></dd>
</dl>
</dd>
<dt>&lsquo;<samp>kaiser_beta</samp>&rsquo;</dt>
<dd><p>For swr only, set Kaiser window beta value. Must be a double float value in the
interval [2,16], default value is 9.
</p>
</dd>
<dt>&lsquo;<samp>output_sample_bits</samp>&rsquo;</dt>
<dd><p>For swr only, set number of used output sample bits for dithering. Must be an integer in the
interval [0,64], default value is 0, which means it&rsquo;s not used.
</p>
</dd>
</dl>
<a name="See-Also"></a>
<h1 class="chapter"><a href="ffmpeg-resampler.html#toc-See-Also">3 See Also</a></h1>
<p><a href="ffmpeg.html">ffmpeg</a>, <a href="ffplay.html">ffplay</a>, <a href="ffprobe.html">ffprobe</a>,
<a href="libswresample.html">libswresample</a>
</p>
<a name="Authors"></a>
<h1 class="chapter"><a href="ffmpeg-resampler.html#toc-Authors">4 Authors</a></h1>
<p>The FFmpeg developers.
</p>
<p>For details about the authorship, see the Git history of the project
(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
<code>git log</code> in the FFmpeg source directory, or browsing the
online repository at <a href="http://source.ffmpeg.org">http://source.ffmpeg.org</a>.
</p>
<p>Maintainers for the specific components are listed in the file
&lsquo;<tt>MAINTAINERS</tt>&rsquo; in the source code tree.
</p>
</div>
</body>
</html>