Convert M4A to MP3 on Linux

Linux is arguably the best desktop for audio conversion: the tools are free, scriptable and already in your package manager. The only snag is that some distributions ship without the patent-encumbered codecs out of the box, so the first conversion can fail with a confusing error. This guide covers installing the right packages on the major distributions, then four ways to convert — from a one-line terminal command to a graphical app — plus scripts for whole music folders.

Step 1: make sure your system can decode AAC and encode MP3

MP3 patents expired in 2017 and AAC decoding is widely available, but distributions still differ:

Ubuntu, Debian, Linux Mint, Pop!_OS:

sudo apt update
sudo apt install ffmpeg

Ubuntu’s ffmpeg includes LAME (MP3) and AAC. For GStreamer-based apps such as SoundConverter, also install gstreamer1.0-plugins-ugly gstreamer1.0-libav (or ubuntu-restricted-extras).

Fedora: the default ffmpeg-free lacks some codecs. Enable RPM Fusion, then:

sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf swap ffmpeg-free ffmpeg --allowerasing

Arch, Manjaro, EndeavourOS:

sudo pacman -S ffmpeg

openSUSE: add the Packman repository and install ffmpeg from it, as the main repository build is reduced.

Confirm with ffmpeg -hide_banner -encoders | grep mp3 — you should see libmp3lame.

Method 1: ffmpeg (one line)

ffmpeg -i song.m4a -c:a libmp3lame -q:a 2 song.mp3

That produces a high-quality variable-bitrate MP3 averaging around 190 kbps. For a specific constant bitrate use -b:a 192k instead of -q:a 2. For voice recordings add -ac 1 -b:a 64k to create a compact mono file. Every option is explained in our ffmpeg M4A to MP3 guide.

Method 2: batch convert a folder or a whole library

All .m4a files in the current folder:

for f in *.m4a; do ffmpeg -n -loglevel error -i "$f" -c:a libmp3lame -q:a 2 "${f%.m4a}.mp3"; done

Recursively, mirroring the folder structure into ~/mp3:

cd ~/Music
find . -type f -iname '*.m4a' -print0 | while IFS= read -r -d '' f; do
  out=~/mp3/"${f%.*}.mp3"
  mkdir -p "$(dirname "$out")"
  ffmpeg -n -loglevel error -i "$f" -map 0:a -map 0:v? -c:a libmp3lame -q:a 2 -c:v copy -id3v2_version 3 "$out" < /dev/null
done

The < /dev/null stops ffmpeg from swallowing the rest of the file list from standard input — a classic bug in loops like this. The extra -map options keep the album art. Need it faster? parallel runs one job per CPU core:

find . -iname '*.m4a' | parallel ffmpeg -n -loglevel error -i {} -q:a 2 {.}.mp3

More options, including Windows and macOS equivalents, are in the batch conversion guide.

Method 3: a graphical converter

SoundConverter (GNOME, available as a Flatpak and in most repositories) is the simplest GUI:

  1. Install it: sudo apt install soundconverter or flatpak install flathub org.soundconverter.SoundConverter.
  2. Open Preferences, choose MP3 as the format and set the quality (e.g. “High, 192 kbps” or a VBR setting).
  3. Choose whether to save next to the originals or in a separate folder, and the naming pattern.
  4. Click Add File or Add Folder, then Convert.

It uses GStreamer, so it needs the GStreamer “ugly” and “libav” plug-ins mentioned above.

fre:ac is a cross-platform alternative with CD ripping and a good tag editor. KDE users can use Kid3 for tags and k3b for CD ripping, though for conversion SoundConverter or ffmpeg are more direct.

Audacity is the right choice when you need to edit — trim, normalise, denoise — before exporting. See converting with Audacity.

Method 4: in the browser

If you are on a locked-down machine, a live USB, or simply do not want to install anything, the online M4A to MP3 converter runs entirely in Firefox or Chromium using WebAssembly. Files stay on your computer. It is a good fallback on immutable distributions like Fedora Silverblue where layering packages is a hassle.

Add a right-click “Convert to MP3” action

GNOME Files (Nautilus): create ~/.local/share/nautilus/scripts/Convert to MP3 with:

#!/bin/bash
for f in "$@"; do
  ffmpeg -n -loglevel error -i "$f" -c:a libmp3lame -q:a 2 "${f%.*}.mp3"
done
notify-send "MP3 conversion finished"

Make it executable with chmod +x. Right-click any M4A and choose Scripts › Convert to MP3.

Dolphin (KDE): create a service menu file in ~/.local/share/kio/servicemenus/ with MimeType=audio/mp4;audio/x-m4a; and an Exec= line calling the same ffmpeg command, then make it executable.

Nemo (Cinnamon): use a .nemo_action file in ~/.local/share/nemo/actions/ with Extensions=m4a; and the same command.

Troubleshooting

“Unknown encoder ‘libmp3lame’”

Your ffmpeg is a reduced build. On Fedora swap to the RPM Fusion package; on openSUSE use Packman. Flatpak and Snap apps bundle their own codecs, so they may work even when the system ffmpeg does not.

SoundConverter shows “missing plug-in”

Install the GStreamer ugly and libav plug-ins for your distribution, then restart the app.

Tags missing in some players

Add -id3v2_version 3 to write ID3v2.3, which far more players read than the default v2.4. Our metadata guide has a full checklist.

File names with spaces break the loop

Always quote variables ("$f") and use -print0 with read -d '' as in the recursive example.

Permission denied when writing

You are probably in a folder owned by another user or on a read-only mount. Write to a folder under your home directory instead.

Which method should you use?

NeedBest tool
One quick fileBrowser converter or ffmpeg one-liner
A whole libraryffmpeg with find or parallel
Point-and-click batchesSoundConverter
Editing before exportAudacity
Right-click convenienceFile manager script

Converting on a headless server or Raspberry Pi

ffmpeg works the same over SSH on a home server, NAS or Raspberry Pi, which is handy for converting a library where it’s stored instead of copying gigabytes back and forth. A few tips:

  • Run long jobs in tmux or screen so they survive a dropped SSH connection, or use nohup … &.
  • Lower the priority so the server stays responsive: prefix the command with nice -n 19 ionice -c3.
  • Limit parallel jobs on a Raspberry Pi to the number of cores (four on a Pi 4 or 5) and keep an eye on temperature — sustained encoding can throttle a Pi without a heatsink.
  • Log failures by appending 2>> ~/convert-errors.log to each ffmpeg command, then review the file afterwards for damaged inputs.

A Raspberry Pi 4 encodes MP3 at roughly 15–30× real time per core, so a typical album takes under a minute with four parallel jobs.

Desktop audio players that convert

Some Linux music players can convert straight from your library:

  • Strawberry and Clementine have a Transcode music option in the Tools menu that converts selected tracks to MP3 with presets and naming patterns.
  • Rhythmbox can transcode while syncing to a portable player, using GStreamer profiles.
  • DeaDBeeF includes a converter plug-in with full control over the encoder command.

These are convenient when you’re already browsing your library and want a quick batch for a USB stick or phone.

Checking your results

After a batch, ffprobe -v error -show_entries format=duration,bit_rate -of csv=p=0 file.mp3 prints the duration and bitrate of any output so you can compare it with the source. A duration that is much shorter than the original points to a damaged input file worth converting again or repairing.

Summary

Install the full ffmpeg for your distribution, then ffmpeg -i in.m4a -c:a libmp3lame -q:a 2 out.mp3 handles almost every case. Use the find loop or GNU parallel for large libraries, SoundConverter if you prefer a GUI, Audacity for editing, and a browser converter when you cannot install software.

Frequently asked questions

What is the best way to convert M4A to MP3 on Linux?

For most users, ffmpeg from the distribution repositories: ffmpeg -i in.m4a -c:a libmp3lame -q:a 2 out.mp3. If you prefer a graphical tool, SoundConverter (GNOME) or a browser-based converter are the easiest.

Why does Fedora's ffmpeg not have MP3 or AAC support?

Fedora's default ffmpeg-free package omits some codecs. Enable RPM Fusion and swap to the full package with: sudo dnf swap ffmpeg-free ffmpeg --allowerasing.

How do I convert all M4A files in subfolders?

Use find with ffmpeg, for example: find . -name '*.m4a' -exec sh -c 'ffmpeg -n -i "$1" -q:a 2 "${1%.m4a}.mp3"' _ {} \;

Is there a right-click option to convert audio in the file manager?

Not by default. Nautilus scripts, Dolphin service menus or Nemo actions can add one that calls ffmpeg on the selected files.

Can I convert without installing anything?

Yes. A browser converter that runs locally works in Firefox or Chromium on any distribution.

Related converters

Need to convert a file right now? Our free M4A to MP3 converter runs entirely in your browser — also try WAV to MP3, FLAC to MP3 and MP4 to MP3. Nothing is uploaded.

← Back to all articles