Ubuntu – How to convert .m4a audio files to .mp3 use command line

audio recordingcodecsffmpegm4amp3

How to convert .m4a audio files to .mp3 command line? (with no deterioration in quality, if possible). Ubuntu 16.04LTS
media info:

General
Complete name                            : show.m4a
Format                                   : MPEG-4
Format profile                           : Apple audio with iTunes info
Codec ID                                 : M4A  (M4A /mp42/isom)
File size                                : 55.5 MiB
Duration                                 : 1h 48mn
Overall bit rate mode                    : Variable
Overall bit rate                         : 71.7 Kbps

Audio
ID                                       : 1
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : HE-AAC / LC
Codec ID                                 : 40
Duration                                 : 1h 48mn
Bit rate mode                            : Variable
Bit rate                                 : 72.0 Kbps
Maximum bit rate                         : 93.8 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 KHz / 22.05 KHz
Frame rate                               : 21.533 fps (1024 spf)
Compression mode                         : Lossy
Stream size                              : 54.9 MiB (99%)
Writing library                          : Nero AAC codec 1.5.4.0
Encoding settings                        : -q 0.25

Best Answer

I note that your input file is actually a Variable Bitrate (VBR) AAC file with an overall bitrate of 71.7 Kbps and a maximum bitrate of 93.8 Kbps. So you actually have two reasonable choices: encode to a Variable Bitrate MP3 file or simply decide on a suitable bitrate for Constant Bitrate (CBR) MP3 encoding. And FFmpeg is certainly the best tool for both of these!

1. Variable Bitrate (VBR) Encoding

This would be my own choice if only for the reason that the original AAC file is also a VBR file. Encoding to MP3 with a variable bitrate of 70-105 Kbps can be mapped to FFmpeg with the -q:a 8 option as below:

ffmpeg -i show.m4a -c:a libmp3lame -q:a 8 output.mp3

And I suspect that this is your best option with your input file.

2. Constant Bitrate (CBR) Encoding

Constant Bitrate (CBR) Encoding is a little over-used IMHO but if this suits your playback equipment best then it is a valid choice. Since your input file has an overall bitrate of 71.7 Kbps and a maximum bitrate of 93.8 Kbps we could perhaps fudge the numbers a little and use the following:

ffmpeg -i show.m4a -c:a libmp3lame -b:a 96k output.mp3

Some experimentation might be in order with good choices for the bitrate being taken from the following LAME 'allowable' standards: 64k, 80k, 96k, 112k. Whatever sounds best on your playback hardware...

References:

  • FFmpeg MP3 Encoding Guide: FFmpeg Trac's great guide to encoding to mp3. Especially note the VBR mapping table marked 'LAME Bitrate Overview'.