I had an audio in Apple .ape format, that I wanted to convert to MP3 format for easier listening on all my devices.
Linux has free audio and video converters. I’ll be using ffmpeg.
Installing ffmpeg
Your Linux computer probably already has ffmpeg installed. (If not, sudo apt update then sudo apt install ffmpeg .)
To export MP3 files, you probably need to install additional codecs.
In Ubuntu 18.10 and 19.04 the Libav codec library (additional codecs) package has been updated to libavcodec-extra58. Check what version to use for your system, if this doesn’t work.
sudo apt-get install libavcodec-extra58
cd to the folder with the original file. For this example, cd /media/george/Seagate700GB/Nathan Milstein – The Last Recital/ and in that folder the music file is CDImage.ape
MP3 320kbps Constant Bit Rate
ffmpeg -i ‘CDImage.ape’ -acodec libmp3lame -id3v2_version 3 -b 320 -metadata Year=’1995′ -metadata Comment=” -metadata Title=’Nathan Milstein – The Last Recital’ ‘Nathan Milstein – The Last Recital.mp3’
-b is setting the output to 320kbps
-metadata Year sets the Year field
-metadata Comment (note: repeat -metadata for each field) I wanted to removed the comment the “extract from CD” software left
-metadata Title always enclose in quotes
Then the output file must be at the end.
MP3 Variable Bit Rate, best quality 0
ffmpeg -i ‘CDImage.ape’ -acodec libmp3lame -id3v2_version 3 -qscale:a 0 -metadata Genre=’Classical’ -metadata Artist=’Nathan Milstein violin, Georges Pludermacher piano’ -metadata Year=’1995′ -metadata Comment=” -metadata Title=’Nathan Milstein – The Last Recital’ ‘Nathan Milstein – The Last Recital.mp3’
“-qscale:a 0” is setting the output to variable bit rate with the highest quality
I added the Artist and Genre fields
Then the output file is at the end.
For more details about the settings, see: ffmpeg.org Encode MP3 but
-b 320 gives CBR (constant bit rate 320kbps, better quality than most people can distinguish, and the best this library will output)
-qscale:a 0 means VBR (variable bit rate) usually between 220-260 kbps
Output
In VLC Media Player, says in the Codec tab of the Info, that it is “32 kb/s” but ignore that for VBR. Look in Statistics tab of VLC, see the “Input bitrate” varying.
$ ffmpeg -i ‘CDImage.ape’ -acodec libmp3lame -id3v2_version 3 -qscale:a 0 -metadata Genre=’Classical’ -metadata Artist=’Nathan Milstein violin, Georges Pludermacher piano’ -metadata Year=’1995′ -metadata Comment=” -metadata Title=’Nathan Milstein – The Last Recital’ ‘Nathan Milstein – The Last Recital.mp3’
Then after a long list of what is enabled in ffmpeg:
Input #0, ape, from ‘CDImage.ape’:
Metadata:
Artist : –
Album : –
Title : –
Genre : Undefined
etc.
<< Track : – Duration: 01:09:00.47, start: 0.000000, bitrate: 613 kb/s Stream #0:0: Audio: ape (APE / 0x20455041), 44100 Hz, stereo, s16p
Stream mapping: Stream #0:0 -> #0:0 (ape (native) -> mp3 (libmp3lame))
Output #0, mp3, to ‘Nathan Milstein – The Last Recital.mp3’:
Metadata:
TCON : Classical
TALB : –
Year : 1995
TRCK : –
TPE1 : Nathan Milstein violin, Georges Pludermacher piano
TIT2 : Nathan Milstein – The Last Recital
TSSE : Lavf58.76.100
Those will show up in your audio player, e.g. VLC Media Player, as the genre, album, year, track, artist, title and encoder.
For a full list of the media tags available, see https://wiki.multimedia.cx/index.php/FFmpeg_Metadata