aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_silenceremove.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-05-26 14:10:38 +0200
committerPaul B Mahol <onemda@gmail.com>2023-05-27 00:34:37 +0200
commit5a13b133f8effe2a2bac07b17f591d8ca7f6c1de (patch)
tree4566d6141fadb23db355c99de8d1786b3d73aa8f /libavfilter/af_silenceremove.c
parent68d0b881dea35960275fb168030ae1f19dcf1a0f (diff)
downloadffmpeg-5a13b133f8effe2a2bac07b17f591d8ca7f6c1de.tar.gz
avfilter/af_silenceremove: add median silence detector
Diffstat (limited to 'libavfilter/af_silenceremove.c')
-rw-r--r--libavfilter/af_silenceremove.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c
index a3ad0eea13..fa182fc9f3 100644
--- a/libavfilter/af_silenceremove.c
+++ b/libavfilter/af_silenceremove.c
@@ -36,6 +36,7 @@ enum SilenceDetect {
D_AVG,
D_RMS,
D_PEAK,
+ D_MEDIAN,
D_NB
};
@@ -132,6 +133,7 @@ static const AVOption silenceremove_options[] = {
{ "avg", "use mean absolute values of samples", 0, AV_OPT_TYPE_CONST, {.i64=D_AVG}, 0, 0, AF, "detection" },
{ "rms", "use root mean squared values of samples", 0, AV_OPT_TYPE_CONST, {.i64=D_RMS}, 0, 0, AF, "detection" },
{ "peak", "use max absolute values of samples", 0, AV_OPT_TYPE_CONST, {.i64=D_PEAK},0, 0, AF, "detection" },
+ { "median", "use median of absolute values of samples", 0, AV_OPT_TYPE_CONST, {.i64=D_MEDIAN},0, 0, AF, "detection" },
{ "window", "set duration of window for silence detection", OFFSET(window_duration_opt), AV_OPT_TYPE_DURATION, {.i64=20000}, 0, 100000000, AF },
{ NULL }
};
@@ -234,6 +236,10 @@ static int config_output(AVFilterLink *outlink)
s->compute_flt = compute_avg_flt;
s->compute_dbl = compute_avg_dbl;
break;
+ case D_MEDIAN:
+ s->compute_flt = compute_median_flt;
+ s->compute_dbl = compute_median_dbl;
+ break;
case D_PEAK:
s->compute_flt = compute_peak_flt;
s->compute_dbl = compute_peak_dbl;