Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
8d9a5033
Commit
8d9a5033
authored
12 years ago
by
Rob Sykes
Committed by
Michael Niedermayer
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
docs: add soxr documentation
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
03d38ee2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/ffmpeg-resampler.texi
+40
-15
40 additions, 15 deletions
doc/ffmpeg-resampler.texi
libswresample/swresample.c
+8
-6
8 additions, 6 deletions
libswresample/swresample.c
libswresample/swresample_internal.h
+11
-11
11 additions, 11 deletions
libswresample/swresample_internal.h
with
59 additions
and
32 deletions
doc/ffmpeg-resampler.texi
+
40
−
15
View file @
8d9a5033
...
...
@@ -106,29 +106,54 @@ select triangular dither
select triangular dither with high pass
@end table
@item resampler
Set resampling engine. Default value is swr.
Supported values:
@table @samp
@item swr
select the native SW Resampler; filter options precision and cheby are not
applicable in this case.
@item soxr
select the SoX Resampler (where available); compensation, and filter options
filter
_
size, phase
_
shift, filter
_
type
&
kaiser
_
beta, are not applicable in this
case.
@end table
@item filter
_
size
S
et resampling filter size, default value is 16.
For swr only, s
et resampling filter size, default value is 16.
@item phase
_
shift
S
et resampling phase shift, default value is 10, must be included
For swr only, s
et resampling phase shift, default value is 10, must be included
between 0 and 30.
@item linear
_
interp
Use Linear Interpolation if set to 1, default value is 0.
@item cutoff
Set cutoff frequency ratio. Must be a float value between 0 and 1,
default value is 0.8.
Set cutoff frequency (swr: 6dB point; soxr: 0dB point) ratio; must be a float
value between 0 and 1. Default value is 0.8 with swr, and 0.91 with soxr
(which, with a sample-rate of 44100, preserves the entire audio band to 20kHz).
@item precision
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's 'High Quality'; a
value of 28 gives SoX's 'Very High Quality'.
@item cheby
For soxr only, selects passband rolloff none (Chebyshev)
&
higher-precision
approximation for 'irrational' ratios. Default value is 0.
@item min
_
comp
S
et the minimum difference between timestamps and audio data (in
For swr only, s
et 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
(@option
{
min
_
comp
}
= @code
{
FLT
_
MAX
}
).
@item min
_
hard
_
comp
S
et the minimum difference between timestamps and audio data (in
For swr only, s
et 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
...
...
@@ -136,14 +161,14 @@ all compensation is by default disabled through @option{min_comp}.
The default is 0.1.
@item comp
_
duration
S
et 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.
For swr only, s
et 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.
@item max
_
soft
_
comp
S
et 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.
For swr only, s
et 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.
@item matrix
_
encoding
Select matrixed stereo encoding.
...
...
@@ -161,7 +186,7 @@ select Dolby Pro Logic II
Default value is @code
{
none
}
.
@item filter
_
type
S
elect resampling filter type. This only affects resampling
For swr only, s
elect resampling filter type. This only affects resampling
operations.
It accepts the following values:
...
...
@@ -175,8 +200,8 @@ select Kaiser Windowed Sinc
@end table
@item kaiser
_
beta
S
et Kaiser Window Beta value. Must be an integer included between
2
and 16, default value is 9.
For swr only, s
et Kaiser Window Beta value. Must be an integer included between
2
and 16, default value is 9.
@end table
...
...
This diff is collapsed.
Click to expand it.
libswresample/swresample.c
+
8
−
6
View file @
8d9a5033
...
...
@@ -80,15 +80,17 @@ static const AVOption options[]={
{
"triangular"
,
"select triangular dither"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SWR_DITHER_TRIANGULAR
},
INT_MIN
,
INT_MAX
,
PARAM
,
"dither_method"
},
{
"triangular_hp"
,
"select triangular dither with high pass"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SWR_DITHER_TRIANGULAR_HIGHPASS
},
INT_MIN
,
INT_MAX
,
PARAM
,
"dither_method"
},
{
"filter_size"
,
"set resampling filter size"
,
OFFSET
(
filter_size
)
,
AV_OPT_TYPE_INT
,
{.
i64
=
16
},
0
,
INT_MAX
,
PARAM
},
{
"phase_shift"
,
"set resampling phase shift"
,
OFFSET
(
phase_shift
)
,
AV_OPT_TYPE_INT
,
{.
i64
=
10
},
0
,
30
,
PARAM
},
{
"filter_size"
,
"set
swr
resampling filter size"
,
OFFSET
(
filter_size
)
,
AV_OPT_TYPE_INT
,
{.
i64
=
16
},
0
,
INT_MAX
,
PARAM
},
{
"phase_shift"
,
"set
swr
resampling phase shift"
,
OFFSET
(
phase_shift
)
,
AV_OPT_TYPE_INT
,
{.
i64
=
10
},
0
,
30
,
PARAM
},
{
"linear_interp"
,
"enable linear interpolation"
,
OFFSET
(
linear_interp
)
,
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
PARAM
},
{
"cutoff"
,
"set cutoff frequency ratio"
,
OFFSET
(
cutoff
)
,
AV_OPT_TYPE_DOUBLE
,{.
dbl
=
0
.
},
0
,
1
,
PARAM
},
{
"resampler"
,
"set resampling Engine"
,
OFFSET
(
engine
)
,
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
SWR_ENGINE_NB
-
1
,
PARAM
,
"resampler"
},
{
"swr"
,
"select SW Resampler"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SWR_ENGINE_SWR
},
INT_MIN
,
INT_MAX
,
PARAM
,
"resampler"
},
{
"soxr"
,
"select SoX Resampler"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SWR_ENGINE_SOXR
},
INT_MIN
,
INT_MAX
,
PARAM
,
"resampler"
},
{
"precision"
,
"set resampling precision"
,
OFFSET
(
precision
)
,
AV_OPT_TYPE_DOUBLE
,{.
dbl
=
20
.
0
},
15
.
0
,
33
.
0
,
PARAM
},
{
"cheby"
,
"enable Chebyshev passband"
,
OFFSET
(
cheby
)
,
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
PARAM
},
{
"precision"
,
"set soxr resampling precision (in bits)"
,
OFFSET
(
precision
)
,
AV_OPT_TYPE_DOUBLE
,{.
dbl
=
20
.
0
},
15
.
0
,
33
.
0
,
PARAM
},
{
"cheby"
,
"enable soxr Chebyshev passband & higher-precision irrational ratio approximation"
,
OFFSET
(
cheby
)
,
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
PARAM
},
{
"min_comp"
,
"set minimum difference between timestamps and audio data (in seconds) below which no timestamp compensation of either kind is applied"
,
OFFSET
(
min_compensation
),
AV_OPT_TYPE_FLOAT
,{.
dbl
=
FLT_MAX
},
0
,
FLT_MAX
,
PARAM
},
{
"min_hard_comp"
,
"set minimum difference between timestamps and audio data (in seconds) to trigger padding/trimming the data."
...
...
@@ -105,12 +107,12 @@ static const AVOption options[]={
{
"dolby"
,
"select Dolby"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
AV_MATRIX_ENCODING_DOLBY
},
INT_MIN
,
INT_MAX
,
PARAM
,
"matrix_encoding"
},
{
"dplii"
,
"select Dolby Pro Logic II"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
AV_MATRIX_ENCODING_DPLII
},
INT_MIN
,
INT_MAX
,
PARAM
,
"matrix_encoding"
},
{
"filter_type"
,
"select filter type"
,
OFFSET
(
filter_type
)
,
AV_OPT_TYPE_INT
,
{
.
i64
=
SWR_FILTER_TYPE_KAISER
},
SWR_FILTER_TYPE_CUBIC
,
SWR_FILTER_TYPE_KAISER
,
PARAM
,
"filter_type"
},
{
"filter_type"
,
"select
swr
filter type"
,
OFFSET
(
filter_type
)
,
AV_OPT_TYPE_INT
,
{
.
i64
=
SWR_FILTER_TYPE_KAISER
},
SWR_FILTER_TYPE_CUBIC
,
SWR_FILTER_TYPE_KAISER
,
PARAM
,
"filter_type"
},
{
"cubic"
,
"select cubic"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
SWR_FILTER_TYPE_CUBIC
},
INT_MIN
,
INT_MAX
,
PARAM
,
"filter_type"
},
{
"blackman_nuttall"
,
"select Blackman Nuttall Windowed Sinc"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
SWR_FILTER_TYPE_BLACKMAN_NUTTALL
},
INT_MIN
,
INT_MAX
,
PARAM
,
"filter_type"
},
{
"kaiser"
,
"select Kaiser Windowed Sinc"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
SWR_FILTER_TYPE_KAISER
},
INT_MIN
,
INT_MAX
,
PARAM
,
"filter_type"
},
{
"kaiser_beta"
,
"set Kaiser Window Beta"
,
OFFSET
(
kaiser_beta
)
,
AV_OPT_TYPE_INT
,
{.
i64
=
9
},
2
,
16
,
PARAM
},
{
"kaiser_beta"
,
"set
swr
Kaiser Window Beta"
,
OFFSET
(
kaiser_beta
)
,
AV_OPT_TYPE_INT
,
{.
i64
=
9
},
2
,
16
,
PARAM
},
{
0
}
};
...
...
This diff is collapsed.
Click to expand it.
libswresample/swresample_internal.h
+
11
−
11
View file @
8d9a5033
...
...
@@ -74,17 +74,17 @@ struct SwrContext {
int
filter_size
;
/**< length of each FIR filter in the resampling filterbank relative to the cutoff frequency */
int
phase_shift
;
/**< log2 of the number of entries in the resampling polyphase filterbank */
int
linear_interp
;
/**< if 1 then the resampling FIR filter will be linearly interpolated */
double
cutoff
;
/**< resampling cutoff frequency. 1.0 corresponds to half the output sample rate */
enum
SwrFilterType
filter_type
;
/**< resampling filter type */
int
kaiser_beta
;
/**< beta value for Kaiser window (only applicable if filter_type == AV_FILTER_TYPE_KAISER) */
double
precision
;
/**< resampling precision (in bits) */
int
cheby
;
/**< if 1 then
the resampling FIR filter
will be
c
on
figured for maximal passband flatness
*/
float
min_compensation
;
///< minimum below which no compensation will happen
float
min_hard_compensation
;
///< minimum below which no silence inject / sample drop will happen
float
soft_compensation_duration
;
///< duration over which soft compensation is applied
float
max_soft_compensation
;
///< maximum soft compensation in seconds over soft_compensation_duration
float
async
;
///< simple 1 parameter async, similar to ffmpegs -async
double
cutoff
;
/**< resampling cutoff frequency
(swr: 6dB point; soxr: 0dB point)
. 1.0 corresponds to half the output sample rate */
enum
SwrFilterType
filter_type
;
/**<
swr
resampling filter type */
int
kaiser_beta
;
/**<
swr
beta value for Kaiser window (only applicable if filter_type == AV_FILTER_TYPE_KAISER) */
double
precision
;
/**<
soxr
resampling precision (in bits) */
int
cheby
;
/**<
soxr:
if 1 then
passband rolloff
will be
n
on
e (Chebyshev) & irrational ratio approximation precision will be higher
*/
float
min_compensation
;
///<
swr
minimum below which no compensation will happen
float
min_hard_compensation
;
///<
swr
minimum below which no silence inject / sample drop will happen
float
soft_compensation_duration
;
///<
swr
duration over which soft compensation is applied
float
max_soft_compensation
;
///<
swr
maximum soft compensation in seconds over soft_compensation_duration
float
async
;
///<
swr
simple 1 parameter async, similar to ffmpegs -async
int
resample_first
;
///< 1 if resampling must come first, 0 if rematrixing
int
rematrix
;
///< flag to indicate if rematrixing is needed (basically if input and output layouts mismatch)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment