Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merging Multiple .mp3 files

Tags:

macos

audio

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?

like image 399
Pyrons Avatar asked Feb 06 '15 10:02

Pyrons


3 Answers

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.

like image 50
jaket Avatar answered Nov 14 '22 13:11

jaket


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 http://mulholland.xyz/dev/mp3cat/.

like image 1
Cheney YAN Avatar answered Nov 14 '22 12:11

Cheney YAN


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

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

like image 1
J Aamish Avatar answered Nov 14 '22 12:11

J Aamish