From 29cddc99cd8302e462bbae572e885e88f63d6dc3 Mon Sep 17 00:00:00 2001 From: Pavel Koshevoy Date: Thu, 14 Jun 2018 19:19:17 -0600 Subject: [PATCH] lavfi/atempo: raise max tempo limit (v2) --- doc/filters.texi | 17 ++++++++++++++--- libavfilter/af_atempo.c | 6 +++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index de4b61cb40..fb5f3eef4b 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1986,7 +1986,12 @@ Adjust audio tempo. The filter accepts exactly one parameter, the audio tempo. If not specified then the filter will assume nominal 1.0 tempo. Tempo must -be in the [0.5, 2.0] range. +be in the [0.5, 100.0] range. + +Note that tempo greater than 2 will skip some samples rather than +blend them in. If for any reason this is a concern it is always +possible to daisy-chain several instances of atempo to achieve the +desired product tempo. @subsection Examples @@ -1998,9 +2003,15 @@ atempo=0.8 @end example @item -To speed up audio to 125% tempo: +To speed up audio to 300% tempo: @example -atempo=1.25 +atempo=3 +@end example + +@item +To speed up audio to 300% tempo by daisy-chaining two atempo instances: +@example +atempo=sqrt(3),atempo=sqrt(3) @end example @end itemize diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c index 8b214bccd7..52f15f2769 100644 --- a/libavfilter/af_atempo.c +++ b/libavfilter/af_atempo.c @@ -153,7 +153,7 @@ typedef struct ATempoContext { static const AVOption atempo_options[] = { { "tempo", "set tempo scale factor", - OFFSET(tempo), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 0.5, 2.0, + OFFSET(tempo), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 0.5, 100.0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM }, { NULL } }; @@ -439,8 +439,8 @@ static int yae_load_data(ATempoContext *atempo, return 0; } - // samples are not expected to be skipped: - av_assert0(read_size <= atempo->ring); + // samples are not expected to be skipped, unless tempo is greater than 2: + av_assert0(read_size <= atempo->ring || atempo->tempo > 2.0); while (atempo->position[0] < stop_here && src < src_end) { int src_samples = (src_end - src) / atempo->stride;