How to join/merge many mp3 files?

This will concatenate two mp3 files, and the resulting metadata will be that of the first file:

ffmpeg -i "concat:file1.mp3|file2.mp3" -acodec copy output.mp3

This is because, for ffmpeg, the whole "concat:" part is a single "input file", and its metadata will be of the first concatenated file. If you want to use metadata from the second file instead, you have to add it as a dummy input file and map its metadata to that of the output:

ffmpeg -i "concat:file1.mp3|file2.mp3" -i file2.mp3 -acodec copy test.mp3 -map_metadata 0:1

If you want to construct your metadata from the two metadatas, you'll have to do it by hand. You can dump a file's metadata with

ffmpeg -i file1.mp3 -f ffmetadata file1.metadata

After dumping both metadatas and constructing new metadata, you can add it to the output file with -metadata, and you can disable metadata copying by setting a -map_metadata mapping from a negative input file number. This sets a name value and no other metadata:

ffmpeg -i "concat:file1.mp3|file2.mp3" -acodec copy -metadata "title=Some Song" test.mp3 -map_metadata 0:-1

This will concatenate a folder full of MP3 into a single MP3 file:

1) Save a list of the MP3 files to concatenate, e.g.,

$ cat mylist.txt
file '/tmp/01.mp3'
file '/tmp/02.mp3'
file '/tmp/03.mp3'
file '/tmp/04.mp3'
file '/tmp/05.mp3'
file '/tmp/06.mp3'
file '/tmp/07.mp3'

2) Run the following command (-safe 0 is not required if mylist.txt uses relative paths instead):

$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp3

Mp3Wrap - Command-line utility that wraps multiple MP3 files into a single, playable MP3, without losing filenames or ID3 information, and without reencoding. Also supports archiving non-audio data such as playlists, info files, and cover images inside the MP3. These files can be unpacked later (using mp3splt, e.g.); ordinary MP3 decoders can play the entire audio stream as one long track.

Tags:

Linux

Bash