[FFmpeg-devel] acrossfade filter crossfading before first input is exhausted

Mark Niebur mniebur at thuuz.com
Wed Oct 30 23:58:17 EET 2019


Hello,
I have been trying to use acrossfade but have been experiencing that the audio in the resulting output is totally jumbled.  From stepping through the code, it appears that acrossfade is starting the crossfade before the first input is exhausted.  I'm not sure why this happens from ffmpeg's point of view; I'm guessing it's from poor disk performance in docker.  I have found that the following patch fixes this issue:

diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
index 23608fb..91a454b 100644
--- a/libavfilter/af_afade.c
+++ b/libavfilter/af_afade.c
@@ -485,7 +485,8 @@ static int activate(AVFilterContext *ctx)
             (AVRational){ 1, outlink->sample_rate }, outlink->time_base);
         return ff_filter_frame(outlink, in);
     } else if (ff_inlink_queued_samples(ctx->inputs[0]) >= s->nb_samples &&
-               ff_inlink_queued_samples(ctx->inputs[1]) >= s->nb_samples) {
+               ff_inlink_queued_samples(ctx->inputs[1]) >= s->nb_samples &&
+               s->cf0_eof) {
         if (s->overlap) {
             out = ff_get_audio_buffer(outlink, s->nb_samples);
             if (!out)

Could you please merge this patch or merge a similar fix?

Thanks,
Mark Niebur


More information about the ffmpeg-devel mailing list