Archive for June 23rd, 2008

Ripping CDs with Gnome

1. The problem

The Linux lusers are trying to convince us for years now that GNU/Linux is ready for the desktop, but they still can’t manage to put together a reasonable GUI to rip CDs. JBQ got the Foo Fighter CDs and he asked me to rip them on Linux because two of these six CDs have the Sony rootkit for Mac/Win.

So there I went to rip them in mp3 with Sound Juicer and it was a pain in the butt. It took me half an hour to understand all the gst-lame switches and configure them, as there is simply no in-depth user documentation for them (and gst-inspect was not installed even if all the other needed libs were). On the gstreamer manual they tell you that the “mode” switch can take values from 0 to 4, but no one tells you what these values are. To get that information, you have to look at the source code! So after fucking around with it, I think I got my head around most of that shit, so here’s a small tutorial for all of you who feel the same way. A tutorial with real information instead of half baked man pages.

2. Learning about the switches

Assuming you have installed the mp3 libraries and encoders and gstreamer-ugly libraries and other shit that should have been installed by default but they aren’t, Sound Juicer reads the gstreamer presets on how to rip. To modify these presets load the gnome-audio-profiles-properties application from a terminal (or via Sound Juicer’s preferences and profile editor). Create a new mp3 profile and in there you will have to type crazy ass switches, but thankfully I have the most common of them explained for you here:

(used with CBR encodings)
bitrate = Specify the constant bitrate. Goes from 8 to 320 kbps.
quality = With it you can choose which algorithm to use to encode. Default is 5. 0 is best, 10 is worst.

(mostly used with VBR encodings)
vbr = Specify bitrate algorithm, because the Lame developers can’t decide which one is best, so they leave that to the user to decide who knows nothing about algorithms. Anyways, it goes from 0 to 4. If you are encoding in constant bitrate use 0, otherwise use 4, which is the latest VBR algorithm.
vbr-max-bitrate = Specify maximum VBR bitrate (8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 or 320).
vbr-min-bitrate = Specify minimum VBR bitrate (8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 or 320).
vbr-quality = You can let the system specify the above two VBR bitrates if you don’t want to. 5 is medium quality, 0 is best, 10 is worse. So for example, vbr-quality=0 goes up to 256 kbps.
xingmux = some shit that you add when in VBR mode only, in order to make the mp3 file more compatible — like we didn’t want that to be ON by default!

(used with both CBR and VBR encodings)
mode = goes from 0 to 4. In order 0 means “stereo”, 1 means “joint stereo”, 2 means “dual channel”, 3 means “Mono”, and 4 means “auto”.

(only used when encoding via presets)
preset = Goes from 1001 to 1004, that is, from “medium” quality, to “standard”, “extreme” and finally, “insane” quality. That’s between 96 kbps and 256kbps, VBR.

3. Creating the truly lame gst-lame switches:

1. Constant bitrate CBR.
In this example below we create a joint stereo mp3, with constant bitrate of 160kbps and one of the best but slower algorithms for the encoding (that comes out from the quality=2):
audio/x-raw-int,rate=44100,channels=2 ! lame name=enc mode=1 vbr=0 bitrate=160 quality=2 ! id3v2mux

2. Using VBR.
In the following, we use variable bit rate with joint stereo and VBR algorithm #4, and we specify that we want the minimum bitrate to be 128 kbps and the maximum to be 192 kbps. We have to use the xingmux switch too to make the resulted mp3 file more compatible with players.
audio/x-raw-int,rate=44100,channels=2 ! lame name=enc mode=1 vbr=4 vbr-min-bitrate=128 vbr-max-bitrate=192 ! xingmux ! id3v2mux

In the following, we use variable bit rate with joint stereo and VBR algorithm #4, but instead of specifying the minimum and maximum bitrate, we let the encoder decide based on vbr-quality value (I used quality 3) which is about between 160 and 220 kbps or something. Remember, when using VBR instead of CBR you must use the xingmux thingie to make it more compatible with mp3 players (and even then, the Totem Gnome media player has problems).
audio/x-raw-int,rate=44100,channels=2 ! lame name=enc mode=1 vbr=4 vbr-quality=3 ! xingmux ! id3v2mux

3. Using Presets.
In the following, we use the preset 1002, which is of standard quality, VBR (at around 160 kbps), that we also run through xingmux.
audio/x-raw-int,rate=44100,channels=2 ! lame name=enc preset=1002 ! xingmux ! id3v2mux

UPDATE: Here’s a mockup of how things should have been.