Linux Tweaks, HowTo's and Reviews

In the previous installments of Command Line Basics: Ripping Audio CD's, I've gone through ripping CD's and saving the files as WAV files, transcoding those files to Ogg Vorbis audio, and finally, querying an online CD database tagging those Ogg files. I the last installment, I promised to show a more automated way to do this. Yes, you could write your own Bash script to automate some of the steps, but as is often the case with Open Source Software, someone else has already done the work for you.

abcde

There is a script available for ripping and encoding audio called abcde. abcde stands for A Better CD Encoder. Check to see if it's in your distro's repositories. In Ubuntu and other Debian based systems it can be installed with:

sudo apt-get install abcde

Using abcde

Using abcde is very easy. Simply place an audio CD into your optical drive, open a terminal window and navigate to a directory where you want to place your audio files. Then just invoke the command.

abcde

By default, the script will then query an online database for artist and track information, prompt you for confirmation, and then rip the audio tracks as WAV files. It will then convert the WAV's to Ogg Vorbis audio and tag the files. So if you want your music converted to Ogg Vorbis at the default quality level of 3, that's all you have to do.

If you want to convert at a different Ogg quality level, (for this example, level 5), you can use this form of the command.

abcde -o ogg:"-q 5"

This form of the command is using the -o switch to set the output format. The -o is followed by format:options.

To encode to FLAC, you would use this command.

abcde -o flac

At this point you're probably saying, OK, this is great and all, but my music player doesn't play Ogg Vorbis or FLAC files. I need them in MP3 format. abcde can create MP3's as well as long as you have a supported encoder installed. abcde can use several different MP3 encoders, but the default one, and arguably the best one, is LAME.

If you don't already have LAME installed on you computer, you can install it (in Ubuntu) with:

sudo apt-get install lame

Now that LAME is installed, you can encode the entire CD in MP3 format with:

abcde -o mp3

To encode in MP3 with a variable bit rate and LAME's quality level of 5:

abcde -o mp3:"-V 5"

Now, if you only want to grab certain tracks from your CD, you can specify the tracks you want at the end of the command, like this:

abcde -o mp3 1-3 5 7 11

This will rip and encode tracks 1, 2, 3, 5, 7, and 11 from the CD.

abcde Defaults

If you want to change the defaults for abcde, you can create a config file in your home directory under ~/abcde.conf. A template for a config file can be found on your system under /etc/abcde.conf. If you want to make system wide changes to the defaults, that's the file to edit, otherwise create a config file in your home directory. There are some good examples of config files for encoding to different formats over at http://www.andrews-corner.org/abcde.html.

So those are the basics of ripping and encoding audio using the Linux command line. If you know of an even better way, (or just a different way), leave a comment.