Search code examples
ffmpegm4a

ffmpeg cannot concatenate m4a files with -c copy parameter


While using ffmpeg to concatenate similar m4a files:

ffmpeg -f concat -safe 0 -i <(for f in ./*.m4a; do echo "file '$PWD/$f'"; done) -c copy output.m4a

ffmpeg reports an error:

[ipod @ 0x7f8db8014a00] Could not find tag for codec mjpeg in stream #0, codec not currently supported in container

Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

The files used are: chapter1.m4a, chapter2.m4a. Their ffprobe have no differences other than the duration. Possible related output is:

Duration: 00:13:16.72, start: 0.000000, bitrate: 48 kb/s
Stream #0:0(eng): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 46 kb/s (default)
Metadata:
  handler_name    : SoundHandler
Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 640x360 [SAR 100:100 DAR 16:9], 90k tbr, 90k tbn, 90k tbc

Solution

  • I just found out the error was due to the Stream #0, which is the cover art, and covers the actual audio track.

    After removing the cover artworks in all files, I was able to concatenate them. And the speed is quite fast : speed=1.92e+03x.