Merge M4A files in Terminal

Hahnemann picture Hahnemann · Aug 26, 2013 · Viewed 10.4k times · Source

I have a couple of M4A (sound) files on a Mac that I want to combine into a single sound file. Can this be done with a Terminal command? Is there such a thing?

Answer

Kafaraqgatri picture Kafaraqgatri · Jun 24, 2015

Yeah, ffmpeg doesn't work, contrary to what the internet echo chamber will tell you. At least not that way. It's incredible how many have to drool their wisdumb and waste everyone's time.

Here. Prove me wrong with a link, but this is what you want and this is the only place you'll see it. Tres simple.

ffmpeg -i file1.m4a -acodec copy file1.aac

ffmpeg -i file2.m4a -acodec copy file2.aac

cat file1.aac file2.aac >>filenew.aac

ffmpeg -i filenew.aac -acodec copy -bsf:a aac_adtstoasc filenew.m4a

I compiled my own ffmpeg for the extra libs, so I hope that that is one of the default ones. If not, it's definitely worth the hassle. I haven't been able to validate the above on a second system, but on my old Hardy Heron Ubuntu grunt system the joined file has all the right m4a meta data and tags and there is no change in audio quality.