Pyrons
Pyrons

Reputation: 345

Merging Multiple .mp3 files

On mac/linux there is a command to merge mp3 files together which is

cat file1.mp3 file2.mp3 > newfile.mp3

I was wondering if there is a simpler way or command to select multiple mp3's in a folder and output it as a single file?

Upvotes: 7

Views: 6764

Answers (3)

Cheney YAN
Cheney YAN

Reputation: 21

simply linking files together won't work. Don't forget modern Mp3 files have metadata in the head. Even if you don't care about the player name, album name etc, you should at least make the "end of file" mark correct.

Better use some tools like https://github.com/dmulholland/mp3cat/.

Upvotes: 2

J Aamish
J Aamish

Reputation: 532

You can use mp3cat by Darren Mulholland available at https://darrenmulholland.com/dev/mp3cat.html

Source is available at https://github.com/dmulholland/mp3cat

Upvotes: 1

jaket
jaket

Reputation: 9341

The find command would work. In this example I produce a sorted list of *.mp3 files in the current directory, cat the file and append it to the output file called out

find . -maxdepth 1 -type f -name '*.mp3' -print0 |
  sort -z |
  xargs -0 cat -- >>out

I should warn you though. If your mp3 files have id3 headers in them then simply appending the files is not a good way to go because the headers are going to wind up littered in the file. There are some tools that manage this much better. http://mp3wrap.sourceforge.net/ for example.

Upvotes: 3

Related Questions