Advertisements

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:

d=7
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…

Advertisements

  1. #1 by Frans on 2016-01-14 - 10:41

    I’ve recently employed abcde with this config file:

    CDPARANOIAOPTS=-z
    
    #See http://www.andrews-corner.org/abcde.html for inspiration
    
    FLACOPTS='-s -e -V -8'
    OPUSENCOPTS="--vbr --bitrate 128"
    
    OUTPUTTYPE="flac,opus"
    

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

    • #2 by Ed on 2016-01-14 - 13:40

      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!

  1. Command-Line CD Ripping, Redux | The Smell of Molten Projects in the Morning