'any' stop mode is now correctly implemented for end trimming and is of limited usage. Extend examples and other documentation of this filter.
Showing the changes to libavfilter (2 of 3 files). Show all
Unified · Split
| @@ -129,7 +129,7 @@ static const AVOption silenceremove_options[] = { · 128 unmodified lines | ||
| 129 | 129 | { "stop_duration", "set stop duration of silence part", OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, |
| 130 | 130 | { "stop_threshold", "set threshold for stop silence detection", OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AFR }, |
| 131 | 131 | { "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" }, | |
| 133 | 133 | { "detection", "set how silence is detected", OFFSET(detection), AV_OPT_TYPE_INT, {.i64=D_RMS}, 0, D_NB-1, AF, "detection" }, |
| 134 | 134 | { "avg", "use mean absolute values of samples", 0, AV_OPT_TYPE_CONST, {.i64=D_AVG}, 0, 0, AF, "detection" }, |
| 135 | 135 | { "rms", "use root mean squared values of samples", 0, AV_OPT_TYPE_CONST, {.i64=D_RMS}, 0, 0, AF, "detection" }, |
| @@ -403,10 +403,8 @@ static void fn(filter_stop)(AVFilterContext *ctx, · 402 unmodified lines | ||
| 403 | 403 | s->stop_found_periods = 0; |
| 404 | 404 | |
| 405 | 405 | if (s->stop_found_periods >= 0 || ctx->is_disabled) { |
| 406 | − if (s->found_nonsilence) { | |
| 406 | + if (s->found_nonsilence) | |
| 407 | 407 | s->stop_sample_count += stop_thres; |
| 408 | − s->stop_sample_count *= stop_thres; | |
| 409 | − } | |
| 410 | 408 | } else if (s->stop_silence_count > 0) { |
| 411 | 409 | const int dst_pos = out_nb_samples * nb_channels; |
| 412 | 410 | for (int ch = 0; ch < nb_channels; ch++) |