ghacks Technology News

Join Mp3 From The Command Line


Lots of tools can join multiple mp3 files into one mp3 file that contains all the bits of the original files. 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.

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 filenames 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.




Tags: , , , , , ,
Categories: Knowledge, Windows



Related posts:

Make Screenshots Of The Command Line
Command Line Directory Switcher
Copy Command Line Outputs Directly To The Clipboard
Nirsoft Command Line Tool
Join multiple video files into one
Burn CDs From Command Line
How to join, split and create mp4, mov and 3gp files
Windows Xp Command Line List

17 Responses to “Join Mp3 From The Command Line”

  1. Anon says:

    Linux & Mac:

    cat track1.mp3 track2.mp3 > compilation.mp3

  2. smerball says:

    linux
    cat *.mp3 > newfile.mp3

    darn, late again

  3. Rob Blake says:

    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.

  4. JKT says:

    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.

  5. alex says:

    @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.

  6. bretagne says:

    thanks to the tip!

  7. john says:

    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 “cd@n.mp3″

    cd “%1_”
    for %%a in (*.mp3) do mp3splt.exe “%%a” -s -p min=2.5 -d “%%a_” -o “trk@n.mp3″
    del *.mp3

  8. Dan Philpott says:

    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 Internals\Windows Internals CD1, Windows Internals\Windows 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.

  9. YouCanDoIT says:

    Excellent – thanks for the tip, works perfectly

Trackbacks/Pingbacks

  1. [...] of us who remember the 80s. Any readers out there know a similar trick for Macintosh or Linux? Join Mp3 From The Command Line [...]

  2. [...] reports on a post by gHacks that says all you have to do is put the mp3s you want to combine into a file folder, then run the [...]

  3. [...] poderoso y sencillo truco el que me encuentro en gHacks, muy útil para unir varias canciones y crear un mix sin necesidad de usar mas aplicaciones, [...]

  4. [...] I couldn’t figure out how to put a bunch of individual songs into a mix without recording or using overly-powerful sound editing applications. I found this quick-and-convenient method over at gHacks. [...]

Leave a Reply   Follow Ghacks   Subscribe To Comment Rss

© 2005-2009 Ghacks.net. All Rights Reserved. Privacy Policy - About Us