Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

FFMPEG can help you with this. Chekc out their How To Contatenate media files article.

Are you trying to have the audio playback one after another, or playback on top of one another at the same time?

Either way FFmpeg can do the trick. The way I read your question, you want them playing back at the same time... If that's the case, try:

ffmpeg -i [input1] -i [input2] -filter_complex "[0:a][1:a]amerge=inputs=2[a]" -map [a] -c:a libfdk_aac out.m4a

Note: this is going to compress the audio to AAC. It is one of the best audio encoders, so you won't really notice a difference, but if you need to maintain quality, you can always go uncompressed with pcm_s16le. However, I think you would then be better off going out to a .wav file.

github.com/mifi/lossless-cut is for audio/video editing using ffmpeg. Works fine for merging mp3/mp4/m4a with drag and drop.

sudo snap install losslesscut

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top