How I Rip and Encode MP3s on the Ubuntu Linux Command Line

I like to know how to use the command line for everything I can. Here are the tools and commands I use to make mp3s.

First, I rip from the CDROM to a wav file.

cdparanoia 1 prokofiev1.wav

cdparanoia lets me specify the input device, but I don’t need to, since the default—/dev/cdrom—is what I want. The line above just says to rip the first track to a wav file named prokofiev1.wav.

lame -h prokofiev1.wav prokofiev1.mp3

Encode the wav file to a mp3 file, in high quality (128 kb).

lltag --cddb prokofiev1.mp3

lltag helps me look up the CDDB data about the track and then add it to the mp3. I’m first prompted to make a CDDB query:

Enter CDDB query [q] (no default, h for help) ?

I’ve tried entering the hexadecimal strings I get from cd-discid, but I’ve never gotten it to return any results. Instead, I enter “prokofiev violinsonaten” verbatim from the CD’s title. I get one matching result, which I select, and then I choose the appropriate track and save the CDDB data.

id3ed -i prokofiev1.mp3 and id3v2 -l prokofiev1.mp3 let me verify that the data has been saved.

Now I’m all set to import the mp3 to Banshee and then to my iPod.


  1. great (and practical) piece of cli foo. thanks for sharing it.

  2. To query using a disc-id, you need both the disc-id and the cddb category:

    Enter CDDB query ... ? misc/940f340d
    Sending CDDB request...
    ID: 940f340d
    DATE: 1992
    ARTIST: Sergei Prokofiev
    CAT: misc
    TRACKS: 13
    GENRE: Classical
    ALBUM: Violinsonaten - 5 Melodien
    Track 01: Andante assai - Sonata for Violin and Piano No.1 in F minor, op 80

    See 'h' for help.

    CDDB does not seem to allow searching with disc-ids without any category unfortunately.

    Also, you can use lltag -S to verify the tags. And add --mp3v2 to verify id3v2 tags (not enabled by default yet).

    If it doesn't work for you, feel free to open a bug report from the lltag homepage or contact the lltag-users mailing list.


Post a Comment

Your email is never shared. Required fields are marked *


One Trackback