Join Mp3 From The Command Line
Lots of tools- like the previously reviewed Mp3 Merge -Â can join multiple mp3 files into a single mp3 file that contains all audio of all files joined in the process.
Mp3 files but also files with the ogg extension can be concatenated easily because of the way the data is structured. The following command line argument will not work with many other file types like those created by Microsoft Office, but they work fine for mp3 and ogg files.
Best of all, it is part of all versions of Windows which means that you don't need to download and run an extra program for that anymore provided you don't mind working on the command line.
Only one line of code is needed to join multiple mp3 files: copy /b *.mp3 c:\new.mp3
. That's all there is needed. The /b parameter ensures that the files are copied in binary format. *.mp3 defines the source directory of the files.
You can easily add a drive and folder structure in front. The wildcard * defines that all mp3 will be joined alphanumerically by the command. It is possible to limit the files by adding letters or numbers to the command, e.g. m*.mp3 to join all mp3 starting with the letter m.
The last part c:\mp3 defines the target directory for the newly created file as well as its name. A possibility to join files with different file names is also available. Simply use the command copy /b file1.mp3 + aaa.mp3 + r3f.mp3 c:\new.mp3 for this. You may use wildcards as well for the process.
Several applications like Audacity can also be used to merge music files. Mp3 Direct Cut is another one for the purpose.
While it may take longer to use the command line for the purpose of merging mp3 files, it is something that is always available if you are working on a Windows PC. All the other tools require you to run software to merge the files, and that option may not always be available.
thankyou for the tip ;)
Thanks for the tip! I would not have imagined that it would be so easy to join mp3 files; make sense for text or other simple formats, but I didn’t think of trying it since I assumed an mp3 was comprised of the header with metadata followed by the audio stream. One would guess that the metadata would make noise, but apparently the format (as in ignores) accommodates it.
Great tip!
This is definitely the easiest way, but as Dan explains it doesn’t produce a “clean” file because it joins all the ID3 tags together inside the MP3 data. It makes files that will have the wrong song length in iTunes and iPod, and seeking to a different point in the song won’t work. Plus, your file will have the ID3v1 tag of the last file you join but the ID3v2 tag of the first file you join! (because ID3v1 tags go at the end of files)
Here’s a better explanation, that also goes over a better method:
http://lyncd.com/2011/03/lossless-combine-mp3s/
Something else to check out is Merge MP3, which is a Windows GUI to do the same thing.
Excellent – thanks for the tip, works perfectly
http://www.shuangsoft.com/Shuangs_Audio_Joiner.asp
Great recommendation simo. Shuangs Audio Joiner worked perfectly!
> simo says:
> December 6, 2008 at 10:12 pm
> http://www.shuangsoft.com/Shuangs_Audio_Joiner.asp
I’d also mention that using “copy /b” isn’t a good practice as it merges the ID3 information along with the rest of the MP3 audio data. This means the MP3 player has bad (non-audio) data included in the audio stream. Depending on the software/firmware reading the file this may or may not be a problem during playback.
Unfortunately this is also the fastest way I know to merge mp3 files.
A good practice is to make a copy of the MP3s you want to merge in a separate folder then use ID3remover to strip the ID3 information.
Another trick which is especially handy with multi-CD audiobooks is to put the MP3’s for each disk into subfolders of an otherwise empty folder (i.e., Windows InternalsWindows Internals CD1, Windows InternalsWindows Internals CD2). The files should have the track number listed first so they sort in the order they should be played. At that point execute the following command within the root folder:
for /f “delims==” %A in (‘dir /ad /b’) do copy /b “%A*.mp3” “%A.mp3”
Presto, one MP3 file per folder.
I use a dos mp3 splitter for audio books… (use soundtaxi on audible to strip DRM leaving you with one large file) I use this for my mp3 cd player in the car
http://mp3splt.sourceforge.net/mp3splt_page/home.php
Here is a batch file to split an audio book from one large file to cd size chunks, and then dechunk those to individual chapters (detects blank sound and splits)
mp3splt.exe “%1” -t 78.0 -d “%1_” -o “[email protected]”
cd “%1_”
for %%a in (*.mp3) do mp3splt.exe “%%a” -s -p min=2.5 -d “%%a_” -o “[email protected]”
del *.mp3
thanks to the tip!
@JKT, There is no way to get this work with doc. because doc isn’t a stream (like mp3). doc is an format with header and ending, so you can’t combine the raw files.
Any tips on getting this to work with .doc files? I’m no command line pro, so I need someone to spell it out. All that seems to happen is that the first file in the series gets copied to the new location. Files are not joined.
This method won’t work on an ipod without first stripping the mp3 files of all mp3 id3 tags. Look at http://eyed3.nicfit.net/ to remove the id3 tags before performing this command.
Also, make sure that all mp3s were encoded with the same bit-rate settings. You can see this with the eyeD3 tool as well.
linux
cat *.mp3 > newfile.mp3
darn, late again
Linux & Mac:
cat track1.mp3 track2.mp3 > compilation.mp3