I figured out how I can concatenate multiple audio files with complex filter, but struggling with offsetting audio in result file. Say, I want to add a gap of 1 seconds silence between each concatenate file. Is it possible to do with FFmpeg?


Generate a null audio stream and insert that with a trim.

Let's say you have three audio files and you want gaps of 1 and 3 seconds between them respectively, then you would use

ffmpeg -i 1.mp3 -i 2.mp3 -i 3.mp3 -f lavfi -i anullsrc -filter_complex \
        [0][g1][1][g2][2]concat=n=5:v=0:a=1"  out.mp3

If you need to trim the inputs as well,

ffmpeg -i 1.mp3 -i 2.mp3 -i 3.mp3 -f lavfi -i anullsrc -filter_complex \
        [t0][g1][t1][g2][t2]concat=n=5:v=0:a=1"  out.mp3
  • What if i want to ceil duration of inputs before concat and trim? – layabout Sep 2 '16 at 7:37
  • See new command. – Gyan Sep 2 '16 at 8:03
  • Thank you for help! Could you please point me where can i read about input labels? I am not quite understand the meaning of all values in brackets. Also why n=5? 3 input files and anullsrc but from where 5th came? – layabout Sep 2 '16 at 8:20
  • 1
    5 refers to total number of input pads. The anullsrc is fed twice. – Gyan Sep 2 '16 at 8:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.