I want to merge two audio files with defined overlapping time, and the command is by help of this answer:

ffmpeg -i 1.mp3 -i 2.mp3 -filter_complex "[1]adelay=Ns|Ns[a1];[0:a][a1]amix=inputs=2[a]" -map "[a]" output.mp3

The issues are

  1. the output file size is only ~1/2 original size (quality lost)
  2. the audio volume before adepaly timestamp is reduced a lot. Not sure why.

I perceive that it needs decoding when using -filter_complex, but I'm not sure if it is possible to achieve overlapping without decoding

  • Add volume=2 after the amix.
    – Gyan
    Dec 14 '19 at 8:46
  • ehh.. why volume=2? And how about the decoding part? @Gyan
    – Xi Xiao
    Dec 14 '19 at 14:28
  • amix downscales volume as per number of inputs, so add volume filter to restore it. Filters only work on decoded data, no way around that.
    – Gyan
    Dec 14 '19 at 14:43
  • Thanks for the volume part! Do you mean there is no way in ffmpeg to overlap two inputs while keeping the quality? Are there other command-line tools that can achieve it? @Gyan
    – Xi Xiao
    Dec 14 '19 at 16:57
  • Save to a lossless format. ffmpeg uses LAME for MP3 encoding; so will most other tools. If you want to maintain original file size, add a bitrate arg which matches the original e.g. : -b:a 256k.
    – Gyan
    Dec 14 '19 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.