tags:

views:

4361

answers:

10

I've got many, many mp3 files that I would like to merge into a single file. I've used the command line method

copy /b 1.mp3+2.mp3 3.mp3

but it's a pain when there's a lot of them and their namings are inconsistent. The time never seems to come out right either.

+4  A: 

The time problem has to do with the ID3 headers of the MP3 files, which is something your method isn't taking into account as the entire file is copied.

Do you have a language of choice that you want to use or doesn't it matter? That will affect what libraries are available that support the operations you want.

Thomas Owens
This is just a personal project so I don't care about the language. Simple is best, my biggest problem is that it seems like something I shouldn't need to spend too much time on, but have.In answer to your question VB.NET.Thanks
Dan Williams
A: 

Personally I would use something like mplayer with the audio pass though option eg -oac copy

+9  A: 

As Thomas Owens pointed out, simply concatenating the files will leave multiple ID3 headers scattered throughout the resulting concatenated file - so the time/bitrate info will be wildly wrong.

You're going to need to use a tool which can combine the audio data for you.

mp3wrap would be ideal for this - it's designed to join together MP3 files, without needing to decode + re-encode the data (which would result in a loss of audio quality) and will also deal with the ID3 tags intelligently.

The resulting file can also be split back into its component parts using the mp3splt tool - mp3wrap adds information to the IDv3 comment to allow this.

David Precious
What I really wanted was a GUI to reorder them and output them as one file with the correct headers.I ended up renaming the files to get them in the correct order and used mp3wrap FullDisk.mp3 *.mp3
Dan Williams
+1  A: 

MP3 files have headers you need to respect.

You could ether use a library like Open Source Audio Library Project and write a tool around it. Or you can use a tool that understands mp3 files like Audacity.

Chris M.
+1  A: 

I would use Winamp to do this. Create a playlist of files you want to merge into one, select Disk Writer output plugin, choose filename and you're done. The file you will get will be correct MP3 file and you can set bitrate etc.

szeryf
When a put a file name in, it simply overwrites the file. Am I missing something?
Dan Williams
The file name you enter should be that of the file you want the merged output to be saved to. However, this solution involves recoding the audio (de-coding then re-encoding), which will result in a loss of audio quality (as MP3 is a lossy format). I think it'll also take a rather long time :)
David Precious
+1  A: 

As David says, mp3wrap is the way to go. However, I found that it didn't fix the audio length header, so iTunes refused to play the whole file even though all the data was there. (I merged three 7-minute files, but it only saw up to the first 7 minutes.)

I dug up this blog post, which explains how to fix this and also how to copy the ID3 tags over from the original files (on its own, mp3wrap deletes your ID3 tags). Or to just copy the tags (using id3cp from id3lib), do:

id3cp original.mp3 new.mp3
joelhardi
+1  A: 

I'd not heard of mp3wrap before. Looks great. I'm guessing someone's made it into a gui as well somewhere. But, just to respond to the original post, I've written a gui that does the COPY /b method. So, under the covers, nothing new under the sun, but the program is all about making the process less painful if you have a lot of files to merge...AND you don't want to re-encode AND each set of files to merge are the same bitrate. If you have that (and you're on Windows), check out Mp3Merge at: http://www.leighweb.com/david/mp3merge and see if that's what you're looking for.

This worked fine for me!
Samuel
+3  A: 

Use ffmpeg or a similar tool to convert all of your MP3s into a consistent format, e.g.

ffmpeg -i originalA.mp3 -f mp3 -ab 128kb -ar 44100 -ac 2 intermediateA.mp3  
ffmpeg -i originalB.mp3 -f mp3 -ab 128kb -ar 44100 -ac 2 intermediateB.mp3

Then, at runtime, concat your files together:

cat intermediateA.mp3 intermediateB.mp3 > output.mp3

Finally, run them through the tool MP3Val to fix any stream errors without forcing a full re-encode:

mp3val output.mp3 -f -nb
Dalroth
A: 

Instead of using the command line to do

copy /b 1.mp3+2.mp3 3.mp3

you could instead use "The Rename" to rename all the MP3 fragments into a series of names that are in order based on some kind of counter. Then you could just use the same command line format but change it a little to:

copy /b *.mp3 output_name.mp3

That is assuming you ripped all of these fragment MP3's at the same time and they have the same audio settings. Worked great for me when I was converting an Audio book I had in .aa to a single .mp3. I had to burn all the .aa files to 9 CD's then rip all 9 CD's and then I was left with about 90 mp3's. Really a pain in the a55.

Daave311
A: 

I use a imoviesoft audio converter which can not only convert between almost any audio files, but also can help you merge several audio files into one output audio file, you can have a try to use it, good luck!