summaryrefslogtreecommitdiff
path: root/libavfilter/af_silenceremove.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavfilter/af_silenceremove.c')
-rw-r--r--libavfilter/af_silenceremove.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c
index dc3f4ff91d..f156d1883d 100644
--- a/libavfilter/af_silenceremove.c
+++ b/libavfilter/af_silenceremove.c
@@ -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);