0

I'm trying to concat multiple (Proof of concept: 2) mp3 files using ffmpeg and the concat filter with the following command:

ffmpeg -i "file1.mp3" -i "file2.mp3" -filter_complex [0:a:0][1:a:0]concat=n=2:a=1[outa] -map [outa] out.mp3

ffmpeg reads both inputs successfully, I guess:

Input #0, mp3 [...]
Metadata: [...]
Duration: 00:00:13.40, start: 0.000000, bitrate: 423 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 192 kb/s
    Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 650x677 [SAR 72:72 DAR 650:677], 90k tbr, 90k tbn, 90k tbc
Metadata:
      comment         : Other
[mp3 @ 0x7fadbc81a000] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, [...]
Metadata: [...]
Duration: 00:06:58.64, start: 0.000000, bitrate: 199 kb/s
    Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 192 kb/s
    Stream #1:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 650x677 [SAR 72:72 DAR 650:677], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Other

But then fails with:

Stream specifier ':a:0' in filtergraph description [0:a:0][1:a:0]concat=n=2:a=1[outa] matches no streams.

Any ideas? Ffmpeg seems to read both streams, so I don't know what's wrong. I also tried [0:0][1:0] instead of [0:a:0][1:a:0], giving the same error message.

1

The concat filter needs to set three variables, n, v and a. Default value of v is 1 but you need to set it to 0. So, concat=n=2:v=0:a=1

  • You beat me to it. This is the relevant link to support your answer: ffmpeg.org/ffmpeg-filters.html#concat – Kamil Maciorowski Jan 29 at 15:15
  • Ahh, thanks a lot so far. Yes, I've read that page beforehand, but didn't know about default values. I'll check that as soon as I find the time! – LukeLR Feb 2 at 11:25

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.