1. Linux Explorations... »
  2. abcde: Command Line Music CD Ripping for Linux:

abcde: Ripping to MP3...

The mp3 codec is a very popular choice for those ripping their Audio CDs and encoding to a format suitable for playback on computer, smart phone, iPod or other such device. And indeed when abcde was first created mp3 encoding was one of the very early additions using a commercial application called l3enc. This page on configuration files not only has a conf file for lame, the most popular mp3 encoder for Linux in the modern age, but also instructions for using some of the very oldest mp3 encoders, all of which still work perfectly with abcde.

Menus for abcde...

To use these menus simply create a file called ~/.abcde.conf and paste the contents of these offerings into the file, start up abcde and all will be well!

  1. ~/.abcde.conf for MP3: lame: The only mp3 encoder that a sensible, modern Linux audiophile should be using!
  2. ~/.abcde.conf for MP3: l3enc: The first publicly available mp3 encoder complete with instructions to get it running on a modern Linux system.
  3. ~/.abcde.conf for MP3: mp3enc: The successor to l3enc, instructions for running mp3enc on a modern Linux system included as well.
  4. ~/.abcde.conf for MP3: bladeenc: The last of the old mp3 encoders on this page complete with a download link for the often difficult to find source.

If you would like to add either automated or semi-automated album art downloading into your conf file have a look here abcde: Downloading Album Art... for all of the details. This is highly recommended and works beautifully on my system!

~/.abcde.conf for MP3: lame

The only encoder for serious mp3 use in 2016 is lame and it is pretty straightforward to install on any Linux distro. Below is the configuration file I use myself when mp3 encoding is required. Note that although lame does a decent job tagging files as well we will be using eyeD3 to tag the encoded files.

# -----------------$HOME/.abcde.conf----------------- #
# 
# A sample configuration file to convert music cds to 
#  MP3 format using lame, eyeD3 and abcde version 2.7.2 
# 
#   http://andrews-corner.org/linux/abcde/index.html
# -------------------------------------------------- #

# Encode tracks immediately after reading. Saves disk space, gives
# better reading of 'scratchy' disks and better troubleshooting of
# encoding process but slows the operation of abcde quite a bit:
LOWDISK=y

# Specify the method to use to retrieve the track information,
# the alternative is to specify 'musicbrainz':
CDDBMETHOD=cddb

# Make a local cache of cddb entries and then volunteer to use 
# these entries when and if they match the cd:
CDDBCOPYLOCAL="y"
CDDBLOCALDIR="$HOME/.cddb"
CDDBLOCALRECURSIVE="y"
CDDBUSELOCAL="y"

# Specify the encoder to use for MP3. In this case 'lame':
MP3ENCODERSYNTAX=lame 

# Specify the path to the selected encoder. In most cases the encoder
# should be in your $PATH as I illustrate below, otherwise you will 
# need to specify the full path. For example: /usr/bin/lame
LAME=lame

# Specify your required encoding options here. Multiple options can
# be selected as '--preset standard --another-option' etc.
# The '-V 2' option gives VBR encoding between 170-210 kbits/s.
LAMEOPTS='-V 2' 

# Output type for MP3.
OUTPUTTYPE="mp3"

# The cd ripping program to use. There are a few choices here: cdda2wav,
# dagrab, cddafs (Mac OS X only) and flac. New to abcde 2.7 is 'libcdio'.
CDROMREADERSYNTAX=cdparanoia            
                                     
# Give the location of the ripping program and pass any extra options,
# if using libcdio set 'CD_PARANOIA=cd-paranoia'.
CDPARANOIA=cdparanoia  
CDPARANOIAOPTS="--never-skip=40"

# Give the location of the CD identification program:       
CDDISCID=cd-discid            
                               
# Give the base location here for the encoded music files.
OUTPUTDIR="$HOME/Music"               

# The default actions that abcde will take.
ACTIONS=cddb,playlist,read,encode,tag,move,clean
              
# Decide here how you want the tracks labelled for a standard 'single-artist',
# multi-track encode and also for a multi-track, 'various-artist' encode:
OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'

# Decide here how you want the tracks labelled for a standard 'single-artist',
# single-track encode and also for a single-track 'various-artist' encode.
# (Create a single-track encode with 'abcde -1' from the commandline.)
ONETRACKOUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}'
VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}'

# Create playlists for single and various-artist encodes. I would suggest
# commenting these out for single-track encoding.
PLAYLISTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}.m3u'
VAPLAYLISTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}.m3u'

# This function takes out dots preceding the album name, and removes a grab
# bag of illegal characters. It allows spaces, if you do not wish spaces add
# in -e 's/ /_/g' after the first sed command.
mungefilename ()
{
  echo "$@" | sed -e 's/^\.*//' | tr -d ":><|*/\"'?[:cntrl:]"
}

# What extra options?
MAXPROCS=2                              # Run a few encoders simultaneously
PADTRACKS=y                             # Makes tracks 01 02 not 1 2
EXTRAVERBOSE=2                          # Useful for debugging
COMMENT='abcde version 2.7.2'           # Place a comment...
EJECTCD=y                               # Please eject cd when finished :-)

For a great look at some other encoding options have a look at this definitive HydrogenAudio page...

~/.abcde.conf for MP3: l3enc

It all started for mp3 encoding for the home user with l3enc back in 1995. l3enc was a closed source application and here in 2016 it still works with abcde! Some work is required to get l3enc working on a modern system but I have managed to do this and there is no reason why you cannot also do this. A few steps are required:

  1. Download the most recent source and extract the executable l3enc to somewhere in your $PATH, I have used ~/bin and you should as well. For convenience I have placed the most recent archive here...
  2. Grab the older libraries required by l3enc from an old Slackware 4.0 repository and place them in a subdirectory of ~/bin:
    wget http://slackware.cs.utah.edu/pub/slackware/slackware-4.0/slakware/d1/libc.tgz && \
    tar -xvf libc.tgz --strip=1 -C ~/bin/oldlibs lib/{libc.so.5.4.46.newlib,libm.so.5.0.9.newlib}
    
    wget http://slackware.cs.utah.edu/pub/slackware/slackware-4.0/slakware/a7/ldso.tgz && \
    tar -xvf ldso.tgz --strip=1 -C ~/bin/oldlibs lib/ld-linux.so.1.9.9
    
  3. Make some system symbolic links for l3enc to follow:
    sudo ln -sv ~/bin/oldlibs/libc.so.5.4.46.newlib /usr/lib/libc.so.5 && \
    sudo ln -sv ~/bin/oldlibs/libm.so.5.0.9.newlib /usr/lib/libm.so.5 && \
    sudo ln -sv ~/bin/oldlibs/ld-linux.so.1.9.9 /lib/ld-linux.so.1
    
  4. Either chase Fraunhofer for a serial number, I met only puzzled emails when I tried this, or use the serial number 1234107D90ABCC which is widely available online.

And this should set you up for running l3enc from the command line or even better using the conf file below to encode an audio CD using the great grandfather of mp3 encoding! Here is the required conf file:

# -----------------$HOME/.abcde.conf----------------- #
# 
# A sample configuration file to convert music cds to 
#  MP3 format using l3enc, eyeD3 and abcde version 2.7.2 
# 
#   http://andrews-corner.org/linux/abcde/index.html
# -------------------------------------------------- #

# Encode tracks immediately after reading. Saves disk space, gives
# better reading of 'scratchy' disks and better troubleshooting of
# encoding process but slows the operation of abcde quite a bit:
LOWDISK=y

# Specify the method to use to retrieve the track information,
# I give the default below but consider setting 'musicbrainz'
# instead, which is my own preferred option:
CDDBMETHOD=cddb

# Make a local cache of cddb entries and then volunteer to use 
# these entries when and if they match the cd:
CDDBCOPYLOCAL="y"
CDDBLOCALDIR="$HOME/.cddb"
CDDBLOCALRECURSIVE="y"
CDDBUSELOCAL="y"

MP3ENCODERSYNTAX=l3enc           # Specify encoder for MP3
L3ENC=l3enc                      # Path to the mp3 encoder
L3ENCOPTS='-br 128000 -hq -crc'  # Options for l3enc

OUTPUTTYPE="mp3" 

CDROMREADERSYNTAX=cdparanoia            
CDPARANOIA=cdparanoia  
CDPARANOIAOPTS="--never-skip=40"

# Give the location of the CD identification program:       
CDDISCID=cd-discid           
                               
OUTPUTDIR="$HOME/Music"               
ACTIONS=cddb,read,encode,tag,move,playlist,clean

OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
ONETRACKOUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}'
VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}'

# Create playlists for single and various-artist encodes. I would suggest
# commenting these out for single-track encoding.
PLAYLISTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}.m3u'
VAPLAYLISTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}.m3u'

mungefilename ()
{
  echo "$@" | sed s,:,-,g | tr / _ | tr -d \'\"\?\[:cntrl:\]
}

PADTRACKS=y                          # Makes tracks 01 02 not 1 2
EXTRAVERBOSE=2                       # Useful for debugging
COMMENT='Encoded with l3enc!!!'      # Place a comment...
EJECTCD=y                            # Please eject cd when finished :-)

The first thing that you will notice is that l3enc is very, very slow!! Note that l3enc is not capable of tagging mp3 files so for this purpose we will use eyeD3.

~/.abcde.conf for MP3: mp3enc

The successor to l3enc was mp3enc and this encoder arrived in 1997, support was added to abcde in version 1.0.2, this version released in January 2000. There are a few steps to follow before running mp3enc successfully with abcde on a modern Linux system:

  1. Download the source and extract the file mp3encdemo31 to ~/bin, renaming it to mp3enc. To make life a little easier I have placed the most recent source archive here...
  2. It is no longer possible to register mp3enc and believe me I tried through Fraunhofer! There is a hack to bypass the limitations of the demo version however:
    cd ~/bin
    gdb
    set write on
    file mp3enc
    print {unsigned long}0x80972c4 = 1
    quit
    
  3. Bypass a memory access issue, be aware that this is a newer security measure. You can either bypass the issue temporarily by running:
    echo 1 > /proc/sys/kernel/randomize_va_space
    or create the file /etc/sysctl.d/01-disable-aslr.conf containing the line:
    kernel.randomize_va_space = 1
    More information can be found here... on this technique.

And now you are ready to run mp3enc from the command line or even better use the conf file below to rip an entire audio CD and encode to mp3:

# -----------------$HOME/.abcde.conf----------------- #
# 
# A sample configuration file to convert music cds to the
#  MP3 format using mp3enc, eyeD3 and abcde version 2.7.2 
# 
#   http://andrews-corner.org/linux/abcde/index.html
# -------------------------------------------------- #

# Encode tracks immediately after reading. Saves disk space, gives
# better reading of 'scratchy' disks and better troubleshooting of
# encoding process but slows the operation of abcde quite a bit:
# LOWDISK=y

# Specify the method to use to retrieve the track information,
# I give the default below but consider setting 'musicbrainz'
# instead, which is my own preferred option:
CDDBMETHOD=cddb

# Make a local cache of cddb entries and then volunteer to use 
# these entries when and if they match the cd:
CDDBCOPYLOCAL="y"
CDDBLOCALDIR="$HOME/.cddb"
CDDBLOCALRECURSIVE="y"
CDDBUSELOCAL="y"

MP3ENCODERSYNTAX=mp3enc          # Specify encoder for MP3
MP3ENC=mp3enc                    # Path to the mp3 encoder
# Options for mp3enc
MP3ENCOPTS='-v -br 192000 -qual 6 -no-is -bw 16500'  

OUTPUTTYPE="mp3" 

CDROMREADERSYNTAX=cdparanoia
# CDPARANOIA=cdparanoia  
# CDPARANOIAOPTS="--never-skip=40"

# Give the location of the CD identification program:       
CDDISCID=cd-discid           
                               
OUTPUTDIR="$HOME/Music"               
ACTIONS=cddb,read,encode,tag,move,playlist,clean

OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
ONETRACKOUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}'
VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}'

# Create playlists for single and various-artist encodes. I would suggest
# commenting these out for single-track encoding.
PLAYLISTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}.m3u'
VAPLAYLISTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}.m3u'

mungefilename ()
{
  echo "$@" | sed s,:,-,g | tr / _ | tr -d \'\"\?\[:cntrl:\]
}

PADTRACKS=y                          # Makes tracks 01 02 not 1 2
EXTRAVERBOSE=2                       # Useful for debugging
COMMENT='Encoded with mp3enc!!!'     # Place a comment...
EJECTCD=y                            # Please eject cd when finished :-

Bear in mind that mp3enc is not capable of tagging the generated files so for this abcde will use eyeD3.

~/.abcde.conf for MP3: bladeenc

Bladeenc appeared in 1999 and I see the first entry in the abcde changelog for cdgrab 0.6 in March 28th 1999. It is perhaps the easiest of the old mp3 encoders to kick back into life although it is a tussle to track down the source these days! To make life a little easier for keen mp3 experimenters I have placed the last release of bladeenc that I could find on my website here... It compiles easily enough and the resulting executable simply needs to be placed somewhere in your $PATH, on my own system I have used ~/bin.

# -----------------$HOME/.abcde.conf----------------- #
# 
# A sample configuration file to convert music cds to MP3
#  format using bladeenc, eyeD3 and abcde version 2.7.2 
# 
#   http://andrews-corner.org/linux/abcde/index.html
# -------------------------------------------------- #

# Encode tracks immediately after reading. Saves disk space, gives
# better reading of 'scratchy' disks and better troubleshooting of
# encoding process but slows the operation of abcde quite a bit:
LOWDISK=y

# Specify the method to use to retrieve the track information,
# I give the default below but consider setting 'musicbrainz'
# instead, which is my own preferred option:
CDDBMETHOD=cddb

# Make a local cache of cddb entries and then volunteer to use 
# these entries when and if they match the cd:
CDDBCOPYLOCAL="y"
CDDBLOCALDIR="$HOME/.cddb"
CDDBLOCALRECURSIVE="y"
CDDBUSELOCAL="y"

MP3ENCODERSYNTAX=bladeenc        # Specify encoder for MP3
BLADEENC=bladeenc                # Path to the mp3 encoder
BLADEENCOPTS='-br 192'           # Options for bladeenc

OUTPUTTYPE="mp3" 

CDROMREADERSYNTAX=cdparanoia            
CDPARANOIA=cdparanoia  
CDPARANOIAOPTS="--never-skip=40"

# Give the location of the CD identification program:       
CDDISCID=cd-discid           
                               
OUTPUTDIR="$HOME/Music"               
ACTIONS=cddb,read,encode,tag,move,playlist,clean

OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
ONETRACKOUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}'
VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}'

# Create playlists for single and various-artist encodes. I would suggest
# commenting these out for single-track encoding.
PLAYLISTFORMAT='${OUTPUT}/${ARTISTFILE}-${ALBUMFILE}/${ALBUMFILE}.m3u'
VAPLAYLISTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}.m3u'

mungefilename ()
{
  echo "$@" | sed s,:,-,g | tr / _ | tr -d \'\"\?\[:cntrl:\]
}

MAXPROCS=2                           # Run a few encoders simultaneously
PADTRACKS=y                          # Makes tracks 01 02 not 1 2
EXTRAVERBOSE=2                       # Useful for debugging
COMMENT='Encoded with bladeenc!!!'   # Place a comment...
EJECTCD=y                            # Please eject cd when finished :-)

Note that bladeenc has no tagging capability so eyeD3 will be used for this purpose. Have a look at encoding with bladeenc with perhaps an eye to how things were in the old days...

And in conclusion...

This page has been a lot of fun to write and it has been exciting to probe the historical roots of abcde and the mp3 encoders that it grew with! Please feel free to use the email address at the base of this page to pass on your thoughts about this page, any corrections, praise or condemnation. Perhaps also consider dropping in on the new Freenode IRC channel: #abcde and we can chat in realtime. And remember: Have fun!