Merge mp3 files in terminal

I am sure that a year ago I was able to do this using something like:

cat file1.mp3 file2.mp3 file3.mp3 > newfile.mp3


Now it does not work.


Could someone say whether this is still possible, or has the OS changed so that it is no longer possible.


TIA


pqb



MacBook Pro 13″, macOS 14.6

Posted on Sep 12, 2024 1:43 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 12, 2024 5:22 AM

Each segment would have its own file headers and meta data, with info about the segment, including codec details, duration, tags. Concatenating would keep all these headers and meta data in invalid ways for the resulting output file. Non-matching codec details would produce an invalid mp3 file, even with the superfluous file headers stripped.

It has to be handled a bit more smart and a bit more sensitively, possibly requiring re-encoding if the codec details don’t match.


Apps that support playlists may help out for this without changing the source files. That would be my preferred solution. (E.g. audio books.)


If you like Terminal as a tool, then consider ffmpeg. E.g. osxexperts.net has pre-compiled binaries for users that don’t want to build their own.

ffmpeg -i "concat:file1.mp3|file2.mp3" -acodec copy output.mp3

Works if the codes details match, i.e. mp3s created with the exact same settings.

4 replies
Question marked as Top-ranking reply

Sep 12, 2024 5:22 AM in response to Peter Blackburn

Each segment would have its own file headers and meta data, with info about the segment, including codec details, duration, tags. Concatenating would keep all these headers and meta data in invalid ways for the resulting output file. Non-matching codec details would produce an invalid mp3 file, even with the superfluous file headers stripped.

It has to be handled a bit more smart and a bit more sensitively, possibly requiring re-encoding if the codec details don’t match.


Apps that support playlists may help out for this without changing the source files. That would be my preferred solution. (E.g. audio books.)


If you like Terminal as a tool, then consider ffmpeg. E.g. osxexperts.net has pre-compiled binaries for users that don’t want to build their own.

ffmpeg -i "concat:file1.mp3|file2.mp3" -acodec copy output.mp3

Works if the codes details match, i.e. mp3s created with the exact same settings.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Merge mp3 files in terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.