ffmpeg with delayed inputs put an extra audio output at 0 seconds

Can someone explain why the input files are played 4 times in total, at 0, 1, 2, 3 seconds.

  1. The ffmpeg processes three input files (mp3).
  2. The complex filter delays the inputs by 1, 2, 3 seconds input-wise.
  3. amix mixes the delayed outputs together.
  4. And finally, a coded transforms it into an output mp3.
ffmpeg -i in0.mp3 -i in1.mp3 -i in2.mp3 -filter_complex "[0]adelay=1000[delayed1];[1]adelay=2000[delayed2];[2]adelay=3000[delayed3];[delayed1][delayed2][delayed3]amix=inputs=3:duration=longest" -codec:a libmp3lame -q:a 4 output.mp3

short version: 2 delayed beeps, an finally there come 3 beeps out (@ 0, 1, 2 seconds):

ffmpeg -i beep.mp3 -filter_complex "[0]adelay=1000[delayed1];[0]adelay=2000[delayed2];[delayed1][delayed2]amix=inputs=2:duration=longest" -codec:a libmp3lame -q:a 4 output.mp3

ffmpeg version N-110011-gf456c192d9-tessus on a Mac M1.

I added also a silent input file from 0 to 1 seconds without any alteration of the outcome.
I added a silent stream as input as well without improvement. E.g.:

... -filter_complex "aevalsrc=0:d=4[silence];...

concat solves the issue. But I want to have a flexible solution with possibly overlapping audio streams.

Thanks for giving a hint!

Read more here: Source link