I’ll put the straight answer first:
Use SoundConverter (GUI, Flatpak). The easiest “good” setting is Variable Bit Rate (VBR) at High quality. Not much point going higher than that for normal listening conditions.
Alternatively use ffmpeg (CLI) if you want finer control over the encoding settings, or want to script/automate the process.
Are you sure you want MP3?
Note that “M4A” is ambiguous—your files with the
.m4a extension could either be AAC which is lossy like MP3 (smaller files, but lower quality), or ALAC which is lossless like WAV or FLAC (much larger files, but “perfect” quality).
Converting from one lossy format to another (AAC to MP3) doesn’t make sense; you lose further quality in exchange for negligible size savings (or size increases, if you use the wrong settings). Converting from ALAC to MP3 makes sense, but there are better options.
If your goal is to simply listen to your music, don’t re-encode it. AAC and ALAC are open formats; there is no risk of them becoming unreadable. Most media player software can handle AAC and ALAC (via common libraries like ffmpeg and gstreamer).
If your goal is to reduce the storage size, MP3 is severely outdated and outclassed by newer, better codecs like Opus. Opus at 96kbps sounds “better” than MP3 at 128kbps (or higher, in my experience). Opus at 128kbps is transparent, meaning it is indistinguishable from lossless to the human ear.
I keep lossless (FLAC/ALAC) sources for music I’ve bought or ripped from CDs, then encode a copy in 128kbps Opus for transferring to laptops or phones with smaller storage. I don’t re-encode lossy files like MP3 or AAC to Opus; I just use them as is.
The drawback of Opus is it’s not quite universal like MP3, although it does play on every modern device I own. But if you have one of those little Sandisk players or a car audio system that plays files from a thumb drive (not via your smart phone) then it may only support MP3 (or sometimes AAC).