Command-line CD Ripping & Encoding

A recent and rather battered book-on-CD posed more than the usual problems for Asunder, so I finally broke down and fiddled around with cdparanoia and lame. This has obviously been done many times before, but breaking it into two simple steps per CD makes the inevitable errors easier to find and work around.

Invoke cdparanoia thusly to rip an entire CD into separate tracks:

cdparanoia -B -v

The files pop out sporting names like track01.cdda.wav, but they won’t be around long enough for you to develop a deep emotional attachment.

Throw a handful of parameters at lame to convert the WAV files into tagged MP3 files:

for t in {01..18} ; do lame --preset tape --tt "D${d}:T${t}" --ta "Author Name" --tl "Book title" --tn "${t}/18" --tg "Audio Book" --add-id3v2 track${t}.cdda.wav D${d}-${t}.mp3 ; done
rm track*

There’s surely a way to make a double substitution work in the track sequence, but the syntax, ah, escapes me at the moment.

You might want to not delete the WAV files until you’re happy with the MP3 results.

In any event, that produces a sequence of MP3 files imaginatively named along the lines of D1-01.mp3, which fits neatly into the cramped LCD space available on an MP3 player.

Your quality preferences may differ…

3 thoughts on “Command-line CD Ripping & Encoding

  1. I’ve recently employed abcde with this config file:

    #See for inspiration
    FLACOPTS='-s -e -V -8'
    OPUSENCOPTS="--vbr --bitrate 128"

    It’s probably not much easier than just writing your own simple shell script.

    1. abcde is in the repository, of course, and I’ll see how it plays with book CDs; eventually I’ll converge on something sensible.

      Our tiny new “music” player shows ID3V2 tags and can decode Ogg Vorbis, so we’re slowly moving into the current millennium.

      Thanks for the pointer!

Comments are closed.