Extract individual audio tracks from an audio DVD

Solution 1:

Here's how I did it in the end, since I was unsuccessful using VLC. In some cases, I ended up with static in the file, and the command line instructions from some of the guides I posted in the question failed, since the commands seem to have changed.

I also tried tools like ffmpeg, but didn't get any usable output from that either.

What finally worked were the instructions found here: http://www.essl.de/wp/2008/01/28/rip-audio-from-a-dvd/

First, I installed the following tools using Homebrew:

$ brew install lame
$ brew install mplayer

Secondly, to get a list of the chapters of the DVD, I used this with the DVD in the drive of my MacBook Pro:

$ mplayer -identify -frames 0 dvd://1 | grep "_CHAPTERS"

This will print the number of chapters per title, in my case, I noticed that there are 13 tracks in the first title.

To get the available audio channels listed, I used a similar command:

$ mplayer -identify -frames 0 dvd://1 | grep "aid"

This showed that the channel with the aid value of 160 had the DVD's stereo track (lpcm).

To extract the audio and convert it to MP3, I wrote the following reusable script (ripaudio.sh), which extracts and converts one chapter:

#!/bin/bash

CHAPTER=$1
AID=$2

mplayer -benchmark -vc null -vo null dvd://1 -chapter $CHAPTER-$CHAPTER -aid $AID -ao pcm:fast:file=$CHAPTER.wav && lame --preset standard $CHAPTER.wav $CHAPTER.mp3 && rm $CHAPTER.wav

Make the script executable using

$ chmod +x ripaudio.sh

Call it to extract the first chapter using

$ ./ripaudio 1 160

What this basically does is this:

  • MPlayer extracts the audio track with id 160 of the first track and saves it to a file called 1.wav. The video part of the track is ignored
  • The Lame encoder is used to encode the .wav file into an MP3 file called 1.mp3. Lame's standard preset is used.
  • The file 1.wav is deleted.
  • The commands are chained using the && operator to make sure they only run when the previous one succeeds. The whole mplayer etc. command needs to be on a single line.

To convert all of the chapters, the following for loop can be used:

for i in {1..13}; do ./ripaudio.sh $i 160 ; done

This will take a while, but once it's done, you'll end up with one MP3 file per chapter in the current directory.

The script can easily be adapted to use something like flac instead of lame for the encoding. Place the script in your user's ~/bin folder to call it from any location.

While this took a while to research and doesn't have a fancy UI, it was the best method I've found.