diff mbox series

[FFmpeg-devel] avfilter/af_afade: remove fade duration limit

Message ID CAC+4MDWLhapmrHvxetY1BcWeN1voUiMyycHO_11DzBwwRH+rWA@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel] avfilter/af_afade: remove fade duration limit
Related show

Checks

Context Check Description
andriy/configure warning Failed to apply patch
andriy/configure warning Failed to apply patch

Commit Message

realies April 29, 2021, 1:49 a.m. UTC
From 8a4fe250e508932d8018adbb1af95d7c4a599a58 Mon Sep 17 00:00:00 2001
From: realies <ffmpeg@reali.es>
Date: Fri, 9 Apr 2021 21:57:47 +0100
Subject: [PATCH] avfilter/af_afade: remove fade duration limit

Removes arbitrary filter duration to allow fades up to the limit
of available memory. A docs warning has been added noting memory
use & potential delay with large fade durations on some muxer
configurations.
---
 doc/filters.texi       | 3 +++
 libavfilter/af_afade.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

60000000, FLAGS },
-    { "d",            "set cross fade duration",
 OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0,
60000000, FLAGS },
+    { "duration",     "set cross fade duration",
 OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0, INT_MAX,
FLAGS },
+    { "d",            "set cross fade duration",
 OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0, INT_MAX,
FLAGS },
     { "overlap",      "overlap 1st stream end with 2nd stream start",
 OFFSET(overlap),      AV_OPT_TYPE_BOOL,   {.i64 = 1    }, 0,  1,
FLAGS },
     { "o",            "overlap 1st stream end with 2nd stream start",
 OFFSET(overlap),      AV_OPT_TYPE_BOOL,   {.i64 = 1    }, 0,  1,
FLAGS },
     { "curve1",       "set fade curve type for 1st stream",
 OFFSET(curve),        AV_OPT_TYPE_INT,    {.i64 = TRI  }, NONE,
NB_CURVES - 1, FLAGS, "curve" },

Comments

realies April 30, 2021, 3:36 a.m. UTC | #1
On Thu, Apr 29, 2021 at 2:49 AM realies <ffmpeg@reali.es> wrote:
>
> From 8a4fe250e508932d8018adbb1af95d7c4a599a58 Mon Sep 17 00:00:00 2001
> From: realies <ffmpeg@reali.es>
> Date: Fri, 9 Apr 2021 21:57:47 +0100
> Subject: [PATCH] avfilter/af_afade: remove fade duration limit
>
> Removes arbitrary filter duration to allow fades up to the limit
> of available memory. A docs warning has been added noting memory
> use & potential delay with large fade durations on some muxer
> configurations.
> ---
>  doc/filters.texi       | 3 +++
>  libavfilter/af_afade.c | 4 ++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 5e35fa6467..05ac14f30c 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -1146,6 +1146,9 @@ no fade applied
>  @end table
>  @end table
>
> +Warning: This filter requires memory to buffer the fade duration. Some
> +muxer configurations can cause delays with large fade durations.
> +
>  @subsection Commands
>
>  This filter supports the all above options as @ref{commands}.
> diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
> index 976b6752cd..23ece37774 100644
> --- a/libavfilter/af_afade.c
> +++ b/libavfilter/af_afade.c
> @@ -385,8 +385,8 @@ AVFilter ff_af_afade = {
>  static const AVOption acrossfade_options[] = {
>      { "nb_samples",   "set number of samples for cross fade
> duration", OFFSET(nb_samples),   AV_OPT_TYPE_INT,    {.i64 = 44100},
> 1, INT32_MAX/10, FLAGS },
>      { "ns",           "set number of samples for cross fade
> duration", OFFSET(nb_samples),   AV_OPT_TYPE_INT,    {.i64 = 44100},
> 1, INT32_MAX/10, FLAGS },
> -    { "duration",     "set cross fade duration",
>  OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0,
> 60000000, FLAGS },
> -    { "d",            "set cross fade duration",
>  OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0,
> 60000000, FLAGS },
> +    { "duration",     "set cross fade duration",
>  OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0, INT_MAX,
> FLAGS },
> +    { "d",            "set cross fade duration",
>  OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0, INT_MAX,
> FLAGS },
>      { "overlap",      "overlap 1st stream end with 2nd stream start",
>  OFFSET(overlap),      AV_OPT_TYPE_BOOL,   {.i64 = 1    }, 0,  1,
> FLAGS },
>      { "o",            "overlap 1st stream end with 2nd stream start",
>  OFFSET(overlap),      AV_OPT_TYPE_BOOL,   {.i64 = 1    }, 0,  1,
> FLAGS },
>      { "curve1",       "set fade curve type for 1st stream",
>  OFFSET(curve),        AV_OPT_TYPE_INT,    {.i64 = TRI  }, NONE,
> NB_CURVES - 1, FLAGS, "curve" },
> --
> 2.25.1
realies May 7, 2021, 7:48 p.m. UTC | #2
Can you please review this? Patchwork has failed to apply it as the
attachment has a mime type of application/octet-stream.

On Fri, Apr 30, 2021 at 4:36 AM realies <ffmpeg@reali.es> wrote:
>
> On Thu, Apr 29, 2021 at 2:49 AM realies <ffmpeg@reali.es> wrote:
> >
> > From 8a4fe250e508932d8018adbb1af95d7c4a599a58 Mon Sep 17 00:00:00 2001
> > From: realies <ffmpeg@reali.es>
> > Date: Fri, 9 Apr 2021 21:57:47 +0100
> > Subject: [PATCH] avfilter/af_afade: remove fade duration limit
> >
> > Removes arbitrary filter duration to allow fades up to the limit
> > of available memory. A docs warning has been added noting memory
> > use & potential delay with large fade durations on some muxer
> > configurations.
> > ---
> >  doc/filters.texi       | 3 +++
> >  libavfilter/af_afade.c | 4 ++--
> >  2 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index 5e35fa6467..05ac14f30c 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -1146,6 +1146,9 @@ no fade applied
> >  @end table
> >  @end table
> >
> > +Warning: This filter requires memory to buffer the fade duration. Some
> > +muxer configurations can cause delays with large fade durations.
> > +
> >  @subsection Commands
> >
> >  This filter supports the all above options as @ref{commands}.
> > diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
> > index 976b6752cd..23ece37774 100644
> > --- a/libavfilter/af_afade.c
> > +++ b/libavfilter/af_afade.c
> > @@ -385,8 +385,8 @@ AVFilter ff_af_afade = {
> >  static const AVOption acrossfade_options[] = {
> >      { "nb_samples",   "set number of samples for cross fade
> > duration", OFFSET(nb_samples),   AV_OPT_TYPE_INT,    {.i64 = 44100},
> > 1, INT32_MAX/10, FLAGS },
> >      { "ns",           "set number of samples for cross fade
> > duration", OFFSET(nb_samples),   AV_OPT_TYPE_INT,    {.i64 = 44100},
> > 1, INT32_MAX/10, FLAGS },
> > -    { "duration",     "set cross fade duration",
> >  OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0,
> > 60000000, FLAGS },
> > -    { "d",            "set cross fade duration",
> >  OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0,
> > 60000000, FLAGS },
> > +    { "duration",     "set cross fade duration",
> >  OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0, INT_MAX,
> > FLAGS },
> > +    { "d",            "set cross fade duration",
> >  OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0, INT_MAX,
> > FLAGS },
> >      { "overlap",      "overlap 1st stream end with 2nd stream start",
> >  OFFSET(overlap),      AV_OPT_TYPE_BOOL,   {.i64 = 1    }, 0,  1,
> > FLAGS },
> >      { "o",            "overlap 1st stream end with 2nd stream start",
> >  OFFSET(overlap),      AV_OPT_TYPE_BOOL,   {.i64 = 1    }, 0,  1,
> > FLAGS },
> >      { "curve1",       "set fade curve type for 1st stream",
> >  OFFSET(curve),        AV_OPT_TYPE_INT,    {.i64 = TRI  }, NONE,
> > NB_CURVES - 1, FLAGS, "curve" },
> > --
> > 2.25.1
diff mbox series

Patch

diff --git a/doc/filters.texi b/doc/filters.texi
index 5e35fa6467..05ac14f30c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1146,6 +1146,9 @@  no fade applied
 @end table
 @end table

+Warning: This filter requires memory to buffer the fade duration. Some
+muxer configurations can cause delays with large fade durations.
+
 @subsection Commands

 This filter supports the all above options as @ref{commands}.
diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
index 976b6752cd..23ece37774 100644
--- a/libavfilter/af_afade.c
+++ b/libavfilter/af_afade.c
@@ -385,8 +385,8 @@  AVFilter ff_af_afade = {
 static const AVOption acrossfade_options[] = {
     { "nb_samples",   "set number of samples for cross fade
duration", OFFSET(nb_samples),   AV_OPT_TYPE_INT,    {.i64 = 44100},
1, INT32_MAX/10, FLAGS },
     { "ns",           "set number of samples for cross fade
duration", OFFSET(nb_samples),   AV_OPT_TYPE_INT,    {.i64 = 44100},
1, INT32_MAX/10, FLAGS },
-    { "duration",     "set cross fade duration",
 OFFSET(duration),     AV_OPT_TYPE_DURATION, {.i64 = 0 },  0,