I have a bunch of MP3 files and I have their paths grouped in a text file. Is it possible to join the relevant MP3 files based on the paths in the text file?
3 Answers
One possible approach would be to use cat
:
$ cat example1 example 2 > output
or
$ cat example* > output
This will join any two files together - not sure what it will do to the ID3 metadata though.
-
This produces non standard MP3 files, i.e. the ID3 tags are getting ruined. How do I correct the tags after using this method? Oct 24, 2010 at 14:11
-
-
There are at least a couple of tool: mpgtx
and quelcom
.
You can see their descriptions through any package manager, for example:
apt-cache show mpgtx quelcom
-
I can't seem to figure out how to use these. I have tried man, but there is not example usage section. Oct 24, 2010 at 10:22
-
qmp3join: manpages.ubuntu.com/manpages/lucid/man1/qmp3join.1.html Basic usage is: qmp3join -o output.mp3 file1 file2... It should be possible to automate the list of files based on the text file.– JonathonOct 24, 2010 at 11:33
-
@Jonathon:
(IFS=$'\n'; qmp3join -o output.mp3 $(cat list.txt))
will pass each line of list.txt as a parameter. ($''
is bash syntax, but you can do the same in other shells.) The IFS change is necessary for any filenames that might contain spaces (which is common for music), otherwise it's not needed.– Roger PateOct 24, 2010 at 22:20 -
@Roger Pate:
$()
, without double quotes, already removes newlines, andcat
is not needed:qmp3join -o output.mp3 $(< list.txt)
– enzotibOct 25, 2010 at 5:43 -
@enzotib: As I said, the change in IFS is necessary with a list.txt that contains one filename per line and where the filenames contain spaces. Using cat or < is just personal preference here.– Roger PateOct 25, 2010 at 6:33
I personally liked mp3wrap
because it is more powerful and the size of the final file is three times less then the file merged with cat
command.