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
47aaebd6
Commit
47aaebd6
authored
9 years ago
by
Paul B Mahol
Browse files
Options
Downloads
Patches
Plain Diff
avfilter/af_silenceremove: make size of window user configurable
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
b841fe00
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/filters.texi
+4
-0
4 additions, 0 deletions
doc/filters.texi
libavfilter/af_silenceremove.c
+3
-1
3 additions, 1 deletion
libavfilter/af_silenceremove.c
with
7 additions
and
1 deletion
doc/filters.texi
+
4
−
0
View file @
47aaebd6
...
...
@@ -2973,6 +2973,10 @@ to remove the pauses completely. Default value is @code{0}.
Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
and works better with digital silence which is exactly 0.
Default value is @code{rms}.
@item window
Set ratio used to calculate size of window for detecting silence.
Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
@end table
@subsection Examples
...
...
This diff is collapsed.
Click to expand it.
libavfilter/af_silenceremove.c
+
3
−
1
View file @
47aaebd6
...
...
@@ -61,6 +61,7 @@ typedef struct SilenceRemoveContext {
size_t
stop_holdoff_end
;
int
stop_found_periods
;
double
window_ratio
;
double
*
window
;
double
*
window_current
;
double
*
window_end
;
...
...
@@ -89,6 +90,7 @@ static const AVOption silenceremove_options[] = {
{
"detection"
,
NULL
,
OFFSET
(
detection
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
1
,
FLAGS
,
"detection"
},
{
"peak"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
FLAGS
,
"detection"
},
{
"rms"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"detection"
},
{
"window"
,
NULL
,
OFFSET
(
window_ratio
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
0
.
02
},
0
,
10
,
FLAGS
},
{
NULL
}
};
...
...
@@ -175,7 +177,7 @@ static int config_input(AVFilterLink *inlink)
AVFilterContext
*
ctx
=
inlink
->
dst
;
SilenceRemoveContext
*
s
=
ctx
->
priv
;
s
->
window_size
=
(
inlink
->
sample_rate
/
50
)
*
inlink
->
channels
;
s
->
window_size
=
FFMAX
(
(
inlink
->
sample_rate
*
s
->
window_ratio
),
1
)
*
inlink
->
channels
;
s
->
window
=
av_malloc_array
(
s
->
window_size
,
sizeof
(
*
s
->
window
));
if
(
!
s
->
window
)
return
AVERROR
(
ENOMEM
);
...
...
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