1. Overview

M4A (MPEG-4 Audio) is a container format for storing audio data. Usually, the audio is AAC, known for its high audio quality and efficient file size compression. In contrast, MP3 uses MPEG-1 Audio Layer III codec, which is older and less efficient than AAC.

However, MP3 is one of the most widely supported audio formats, which is the primary reason it’s still a universal choice for audio distribution.

In this tutorial, we’ll learn how to convert an M4A audio format to MP3. For that purpose, we’ll use FFmpegLibav, faad2, and lame. Alternatively, we’ll also explore GUI tools like SoundConverter and WinFF.

2. FFmpeg

FFmpeg is a powerful CLI tool for handling and manipulating media files.

On most Linux distros, it’s not installed by default. However, we can install it from the official package repositories with a package manager using its canonical name, ffmpeg:

$ sudo apt install -y ffmpeg

Let’s verify it:

$ ffmpeg -version | sed 1q
ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers

Now, for our example, we’ll convert an M4A sample audio file with the given metadata:

$ mediainfo sample.m4a
General
Complete name                            : sample.m4a
Format                                   : MPEG-4
Format profile                           : Apple audio with iTunes info
Codec ID                                 : M4A  (isom/iso2)
File size                                : 1.94 MiB
Duration                                 : 2 min 2 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 133 kb/s
Writing application                      : Lavf57.83.100

Let’s convert this to MP3 with default options:

$ ffmpeg -i sample.m4a sample.mp3

Once converted, we print out its metadata:

$ mediainfo sample.mp3
General
Complete name                            : sample.mp3
Format                                   : MPEG Audio
File size                                : 1.86 MiB
Duration                                 : 2 min 2 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 128 kb/s
Writing library                          : Lavf60.3.100

In addition, we can also specify custom parameters:

$ ffmpeg -i sample.m4a -b:a 64k -ac 1 -compression_level 10 -q:a 0 sample.mp3

Let’s break this down:

  • -i sets the input file to sample.m4a
  • -b:a specifies the audio bitrate, which is 64k
  • -ac sets the audio channels to 1 — making it a monaural audio
  • -compression_level specifies the compression level, which we set higher (10)
  • -q:a sets the quality factor for audio to 0 to achieve higher compression

Next, let’s compare the file sizes:

$ diff <(du -h sample.m4a) <(du -h sample.mp3)
1c1
< 2.0M	sample.m4a ---
> 1.5M	sample.mp3

Notably, the sample.mp3 is now 25% smaller.

3. Libav

Libav is a set of multimedia utilities based on the Libav libraries. Remarkably, it was originally a fork of FFmpeg, but now it has developed its own multimedia framework.

We can install it from the official package repositories using its canonical name, libav-tools:

$ sudo apt install -y libav-tools

Now, we’ll convert M4A to MP3:

$ avconv -i sample.m4a sample.mp3

Like FFmpeg, we can also specify the additional parameters when required:

$ avconv -i sample.m4a -a:b 64k -a:c 1 sample.mp3

Notably, the options are essentially the same as FFmpeg.

It’s worth noting that the Libav project has been abandoned. Therefore, we should prefer FFmpeg over Libav unless we have existing scripts and workflows that heavily depend on Libav.

4. faad2 and lame

faad2 is a tool that can decode AAC audio files. So, in essence, it’s an AAC decoder. lame, on the other hand, is an efficient MP3 encoder.

So, we can decode the given M4A file to stdout:

$ faad sample.m4a -w

This prints out the raw audio contents to the standard output. Therefore, we can encode that raw audio into an MP3 file using lame:

$ faad sample.m4a -w | lame - sample.mp3

Let’s verify it:

$ mediainfo sample.mp3
Complete name                            : sample.mp3
Format                                   : MPEG Audio
File size                                : 1.86 MiB
Duration                                 : 2 min 2 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 128 kb/s
Writing library                          : LAME3.100

This approach gives us more flexibility and control. In addition, it can be useful in scripting scenarios where we need to break down the decoding and encoding processes into distinct steps.

Moreover, lame supports other formats as well, such as WAV, M4A, FLAC, and OGG. Therefore, we can use lame to convert M4A files to MP3 directly:

$ lame --preset standard sample.m4a sample.mp3

Similarly, we can also specify the bitrate with -b:

$ lame -b 64 sample.m4a sample.mp3

5. GUI: SoundConverter

SoundConverter is a GTK-based audio converter that is based on the GStreamer libraries.

We can install it from the official package repositories using its canonical name, soundconverter:

$ sudo apt install -y soundconverter

Once installed, we can launch it from the application menu. Then, we can add the required files to the list:

SoundConverter

Once the file(s) are added, we can set their output options by selecting the “cog” icon on the right side of the title bar:

SoundConverter: Preferences

In this panel, we can set all the given options. We must make sure to select “MP3 (.mp3)” from the Format drop-down. Once set, we can close the panel and press the Convert button to start the conversion process:

SoundConverter: Convert

6. GUI: WinFF

WinFF is a GUI front-end to FFmpeg. It comes in two flavors: Qt and GTK. However, we’ll stick to GTK in this tutorial.

It’s available in the official package repositories under the names winff-gtk2 and winff-qt:

$ sudo apt install -y winff-gtk

Once installed, we launch it from the application menu and add the files by pressing the “Add” button:

WinFF

Once the files are added, we set the output details. For our use case, we select Convert to → Audio and Preset → MP3. For the output folder, we can either use the source folder or select one from the file picker:

WinFF: Preferences

Once set, we can press the Convert button to start the process.

7. Conclusion

In this article, we saw how to quickly convert M4A audio files to MP3. We discussed various utilities for the job, including FFmpeg, avconv, and lame. Besides, we also looked at a couple of GUI alternatives.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.