How to merge MP3 files Linux

The purpose of this tutorial is to show how to merge multiple MP3 tracks into a single file. This can be done through a few different methods via the command line on a Linux system.

Depending on the scenario, sometimes it is easier to manage a single MP3 file, rather than having tracks split across multiple files. Combining audio files also works well when you have a track that has been split into multiple files and need to splice it back together.

If the tracks are from multiple sources, it is also important that you normalize the audio first, otherwise every track may have a different peak volume and it will make for a less than ideal listening experience later on. After the tracks are combined, you can also burn the MP3 file to audio CD if you prefer. In this tutorial, you will see how to combine multiple MP3 files and normalize their volume peaks in Linux.

In this tutorial you will learn:

  • How to install mp3wrap, ffmpeg, and normalize-audio on Linux
  • How to combine multiple MP3 files with mp3wrap and ffmpeg
  • How to normalize the volume on multiple MP3 tracks
How to merge MP3 files Linux
How to merge MP3 files Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux system
Software mp3wrap, ffmpeg, normalize-audio
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install mp3wrap, ffmpeg, and normalize-audio




The recommended tool that you should use to combine multiple MP3 files on Linux is mp3wrap. It is also possible to use ffmpeg, but this is a pretty bulky package to install for just this simple task. If you already have ffmpeg installed, feel free to use it to combime MP3 files, otherwise just install mp3wrap.

The other tool, which is totally optional, is normalize-audio, which is only recommended if your tracks come from multiple albums or other sources. This will simply make all your music (or podcasts, or whatever you are listening to) sound equal in volume.

You can use the appropriate command below to install mp3wrap, ffmpeg, and normalize-audio with your system’s package manager.

To install mp3wrap, ffmpeg, and normalize-audio on Ubuntu, Debian, and Linux Mint:

$ sudo apt update
$ sudo apt install mp3wrap ffmpeg normalize-audio

To install mp3wrap, ffmpeg, and normalize-audio on Arch Linux and Manjaro:

$ sudo pacman -S mp3wrap ffmpeg
$ yay -S normalize

Once the appropriate tools are installed, you can proceed with following the commands in the section below.

DID YOU KNOW?
Linux users may be wondering why they can’t simply use the cat command to combine multiple MP3 files. This command is used to concatenate files, after all. The problem with using cat on MP3 files is that the music files contain metadata and other content at the beginning and end of each track. It may work fine to use cat in some situations, but tools like mp3wrap and ffmpeg will strip the extra data before combining music files, which is much more ideal.

How to normalize MP3 tracks with normalize-audio

Before proceeding to combining the MP3 files, consider using the normalize-audio command to equalize the volume on all of your MP3 files. Here is the command syntax.

$ normalize-audio -m *.mp3

Your tracks should now have their volumes normalized, and we can move on to merging the tracks.

How to combine multiple MP3 files with mp3wrap

Now, let’s see how to use the mp3wrap command on Linux. As an example, we will combine three MP3 files into a single track named combined.mp3.

$ mp3wrap combined.mp3 track1.mp3 track2.mp3 track3.mp3

That’s all there is to it. Now the three tracks we specified in the command above will be joined into the single combined.mp3 file. Keep in mind that order matters here. Since we wanted the tracks in sequential order, we specified track 1, 2, 3. But you can use any order you want.

If you have a lot of tracks, you can use a wildcard rather than typing out each track individually to save time.

$ mp3wrap combined.mp3 *.mp3


NOTE
The tags and metadata of each track will be lost in this process. In other words, information like the artist, song name, track number, etc, will be stripped from each file before everything is combined into one final MP3 file.

How to combine multiple MP3 files with ffmpeg

The ffmpeg command can also be used to merge multiple MP3 files together. As an example, we will combine three MP3 files into a single track named combined.mp3.

$ ffmpeg -i "concat:track1.mp3|track2.mp3|track3.mp3" -acodec copy combined.mp3

All done.

Closing Thoughts

In this tutorial, we saw how to merge multiple MP3 tracks into a single file via the command line in Linux. We also learned how to normalize the volume on our tracks before combining them, so the single file has uniform volume peaks throughout. The mp3wrap is a very handy and lightweight tool that makes this job rather easy, although other tools like ffmpeg are also perfectly capable of the job.



Comments and Discussions
Linux Forum