Re: [FFmpeg-devel] [PATCH] lavfi/atempo: raise max tempo limit (v2)
On 06/13/2018 07:39 AM, Pavel Koshevoy wrote: On Thu, Jun 7, 2018 at 8:16 PM Pavel Koshevoy wrote: --- 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 256ab42b00..6b98b04774 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=3 +@end example + +@item +To speed up audio to 300% tempo by daisy-chaining two atempo instances: @example -atempo=1.25 +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; -- 2.16.4 Any objections if I apply this? Pavel. Applied, pushed Pavel. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavfi/atempo: raise max tempo limit (v2)
On Thu, Jun 7, 2018 at 8:16 PM Pavel Koshevoy wrote: > > --- > 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 256ab42b00..6b98b04774 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=3 > +@end example > + > +@item > +To speed up audio to 300% tempo by daisy-chaining two atempo instances: > @example > -atempo=1.25 > +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; > -- > 2.16.4 > Any objections if I apply this? Pavel. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [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 256ab42b00..6b98b04774 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=3 +@end example + +@item +To speed up audio to 300% tempo by daisy-chaining two atempo instances: @example -atempo=1.25 +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; -- 2.16.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavfi/atempo: raise max tempo limit
On Tue, Jun 05, 2018 at 20:59:16 -0600, Pavel Koshevoy wrote: > --- > libavfilter/af_atempo.c | 5 + > 1 file changed, 1 insertion(+), 4 deletions(-) Please have a look at doc/filters.texi and adapt the atempo section in the same commit. Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavfi/atempo: raise max tempo limit
On Tue, Jun 5, 2018 at 8:59 PM, Pavel Koshevoy wrote: > --- > libavfilter/af_atempo.c | 5 + > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c > index 8b214bccd7..daf4693321 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,9 +439,6 @@ static int yae_load_data(ATempoContext *atempo, > return 0; > } > > -// samples are not expected to be skipped: > -av_assert0(read_size <= atempo->ring); > - > while (atempo->position[0] < stop_here && src < src_end) { > int src_samples = (src_end - src) / atempo->stride; > > -- > 2.16.3 > I've tested with atempo=3, 4, 5, 6, 7, 30, 100... It sounds reasonable. I've compared atempo=3 vs 'atempo=sqrt(3.0),atempo=sqrt(3.0)' and did not hear any difference. I've removed the assertion because at tempo >= 7 the assertion fails, but I'm not concerned about it -- some samples will simply be dropped rather than being blended in. At that high tempo I don't think including all samples in output is a foremost consideration. If someone is concerned about samples being dropped from output stream they can still fall back to the technique of daisy-chaining several atempo instances at lower tempo setting. If the patch looks good to someone with commit rights -- please apply. Thank you, Pavel. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavfi/atempo: raise max tempo limit
--- libavfilter/af_atempo.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c index 8b214bccd7..daf4693321 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,9 +439,6 @@ static int yae_load_data(ATempoContext *atempo, return 0; } -// samples are not expected to be skipped: -av_assert0(read_size <= atempo->ring); - while (atempo->position[0] < stop_here && src < src_end) { int src_samples = (src_end - src) / atempo->stride; -- 2.16.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel