Content moved to tucuche-consulting.com as of April 2019
Thursday, April 30, 2015
Merging multiple files using the cat command
Nothing major today, this is a straightforward case that I was surprised would work with the Linux cat command.
I had a folder with several mp3's that were part of one long mixtape but were split into dozens of files, when they should have really been one big file.
I could have used a tool to fix this, but it can be accomplished natively using a Linux or Mac terminal.
First navigate to the folder where the files are located. If they are in numerical order, that's short and easy.
cat *.mp3 > ../mylongsong.mp3
This combines all the files into one and dumps in one directory above to avoid an endless loop, depending on the shell you're using.
If the files have arbitrary names, but you can figure out the order, you can use a slightly longer command:
cat 1.mp3 2.mp3 a.mp3 myfav.mp3 wow.mp3 > ../mylongsong2.mp3
The caveat is that all the files need to be encoded the same way and be of the same filetype. It will not merge mp3 with wma, it will not merge a 320kbps mp3 with a 128kbps version.
Subscribe to:
Posts (Atom)