History

avfilter/af_silenceremove: fix the any/all confusion and change default

'any' stop mode is now correctly implemented for end trimming and is of limited usage. Extend examples and other documentation of this filter.

Paul B Mahol committed 3 years ago

Commit e8e48631 parent 8d662ad3 files · +50 −18Browse files

Showing the changes to libavfilter (2 of 3 files). Show all

Unified · Split

2 files
  1. libavfilter/af_silenceremove.c +1 −1
  2. libavfilter/silenceremove_template.c +1 −3
libavfilter/af_silenceremove.c+1−1
@@ -129,7 +129,7 @@ static const AVOption silenceremove_options[] = { · 128 unmodified lines
129129 { "stop_duration", "set stop duration of silence part", OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF },
130130 { "stop_threshold", "set threshold for stop silence detection", OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AFR },
131131 { "stop_silence", "set stop duration of silence part to keep", OFFSET(stop_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF },
132− { "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" },
132+ { "stop_mode", "set which channel will trigger trimming from end", OFFSET(stop_mode), AV_OPT_TYPE_INT, {.i64=T_ALL}, T_ANY, T_ALL, AFR, "mode" },
133133 { "detection", "set how silence is detected", OFFSET(detection), AV_OPT_TYPE_INT, {.i64=D_RMS}, 0, D_NB-1, AF, "detection" },
134134 { "avg", "use mean absolute values of samples", 0, AV_OPT_TYPE_CONST, {.i64=D_AVG}, 0, 0, AF, "detection" },
135135 { "rms", "use root mean squared values of samples", 0, AV_OPT_TYPE_CONST, {.i64=D_RMS}, 0, 0, AF, "detection" },
libavfilter/silenceremove_template.c+1−3
@@ -403,10 +403,8 @@ static void fn(filter_stop)(AVFilterContext *ctx, · 402 unmodified lines
403403 s->stop_found_periods = 0;
404404
405405 if (s->stop_found_periods >= 0 || ctx->is_disabled) {
406− if (s->found_nonsilence) {
406+ if (s->found_nonsilence)
407407 s->stop_sample_count += stop_thres;
408− s->stop_sample_count *= stop_thres;
409− }
410408 } else if (s->stop_silence_count > 0) {
411409 const int dst_pos = out_nb_samples * nb_channels;
412410 for (int ch = 0; ch < nb_channels; ch++)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t