[FFmpeg-cvslog] avfilter/af_silenceremove: add commands support
Paul B Mahol
git at videolan.org
Sat May 27 12:19:07 EEST 2023
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat May 27 10:12:37 2023 +0200| [7927a96e2b8b9063592d7c609af5b7d544a9c475] | committer: Paul B Mahol
avfilter/af_silenceremove: add commands support
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7927a96e2b8b9063592d7c609af5b7d544a9c475
---
doc/filters.texi | 4 ++++
libavfilter/af_silenceremove.c | 14 ++++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index ea42c127da..975a506352 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6497,6 +6497,10 @@ silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=
@end example
@end itemize
+ at subsection Commands
+
+This filter supports some above options as @ref{commands}.
+
@section sofalizer
SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c
index fa182fc9f3..755ed10bd0 100644
--- a/libavfilter/af_silenceremove.c
+++ b/libavfilter/af_silenceremove.c
@@ -115,20 +115,21 @@ typedef struct SilenceRemoveContext {
#define OFFSET(x) offsetof(SilenceRemoveContext, x)
#define AF AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
+#define AFR AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
static const AVOption silenceremove_options[] = {
{ "start_periods", "set periods of silence parts to skip from start", OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, 9000, AF },
{ "start_duration", "set start duration of non-silence part", OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF },
- { "start_threshold", "set threshold for start silence detection", OFFSET(start_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF },
+ { "start_threshold", "set threshold for start silence detection", OFFSET(start_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AFR },
{ "start_silence", "set start duration of silence part to keep", OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF },
- { "start_mode", "set which channel will trigger trimming from start", OFFSET(start_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" },
- { "any", 0, 0, AV_OPT_TYPE_CONST, {.i64=T_ANY}, 0, 0, AF, "mode" },
- { "all", 0, 0, AV_OPT_TYPE_CONST, {.i64=T_ALL}, 0, 0, AF, "mode" },
+ { "start_mode", "set which channel will trigger trimming from start", OFFSET(start_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AFR, "mode" },
+ { "any", 0, 0, AV_OPT_TYPE_CONST, {.i64=T_ANY}, 0, 0, AFR, "mode" },
+ { "all", 0, 0, AV_OPT_TYPE_CONST, {.i64=T_ALL}, 0, 0, AFR, "mode" },
{ "stop_periods", "set periods of silence parts to skip from end", OFFSET(stop_periods), AV_OPT_TYPE_INT, {.i64=0}, -9000, 9000, AF },
{ "stop_duration", "set stop duration of silence part", OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF },
- { "stop_threshold", "set threshold for stop silence detection", OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF },
+ { "stop_threshold", "set threshold for stop silence detection", OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AFR },
{ "stop_silence", "set stop duration of silence part to keep", OFFSET(stop_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF },
- { "stop_mode", "set which channel will trigger trimming from end", OFFSET(stop_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" },
+ { "stop_mode", "set which channel will trigger trimming from end", OFFSET(stop_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AFR, "mode" },
{ "detection", "set how silence is detected", OFFSET(detection), AV_OPT_TYPE_INT, {.i64=D_RMS}, 0, D_NB-1, AF, "detection" },
{ "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" },
@@ -440,4 +441,5 @@ const AVFilter ff_af_silenceremove = {
FILTER_OUTPUTS(silenceremove_outputs),
FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_DBL),
+ .process_command = ff_filter_process_command,
};
More information about the ffmpeg-cvslog
mailing list