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

realies ffmpeg at reali.es
Thu Apr 29 04:49:39 EEST 2021


>From 8a4fe250e508932d8018adbb1af95d7c4a599a58 Mon Sep 17 00:00:00 2001
From: realies <ffmpeg at 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


More information about the ffmpeg-devel mailing list