How to Rip DVD audio to mp3 or ogg

Sponsored Link
You can extract sound from a DVD, one track at a time or a chapter at a time. Some simple command line examples should suffice to demonstrate how this is done.

First thing you need to do is make sure you have lsdvd and transcode installed:

sudo apt-get install lsdvd transcode

A DVD in your DVD drive will probably be identified as /dev/dvd. Have a look at its table of contents with the lsdvd command


to find the track information, and the longest track

Output looks like as follows
libdvdread: Using libdvdcss version 1.2.5 for DVD access
Title: 01, Length: 02:32:44 Chapters: 26, Cells: 27, Audio streams: 02, Subpictures: 01
Title: 02, Length: 00:17:36 Chapters: 02, Cells: 02, Audio streams: 01, Subpictures: 00
Title: 03, Length: 00:00:11 Chapters: 02, Cells: 02, Audio streams: 01, Subpictures: 00
Longest track: 1

To capture the audio from the tenth chapter of the first title, saving it in ogg format, the command line is simply

transcode -i /dev/dvd -x dvd -T 1,10,1 -a 0 -y ogg -m track10.ogg

The arguments identify the input as /dev/dvd (-i), the type of input as DVD (-x), the title, chapter, and angle to encode, in this case being title 1, chapter 10, and camera angle 1 (-T), the audio track is track 0 (-a), the output format is ogg (-y, and the output filename is track10.ogg (-m).

generates mp3 output of chapter 20 from title 1

transcode -i /dev/dvd -x dvd -T 1,20,1 -a 0 -y raw -m track20.mp3

To extract the whole audio track of a title (all chapters) as ogg audio

transcode -i /dev/dvd -x dvd -T 1,-1 -a 0 -y ogg -m audiotrack.ogg

If you prefer WAV files, the following will do it

transcode -i /dev/dvd -x dvd -T 1,20 -a 0 -y wav -m track20.wav

Sponsored Link

You may also like...

38 Responses

  1. Kirby says:

    For some reason a couple DVDs (Springsteen concert videos) would just come out with static when I tried the -y raw option but work with WAV output. 1 DVD worked (U2 concert video) as MP3.

    I gave up trying to figure out why and instead just used lame to convert my WAV to an MP3

    for((x=1; x<=8; x++)) do transcode -i /dev/dvd -x dvd -T 1,$x,1 -a 0 -y wav -m track$x.wav; lame -V2 track$x.wav track$x.mp3; rm track$x.wav; done;

  2. Michael says:

    Great excepg that this just doesn’t work. Transcode just borks. You can try getting the latest version. But it is only available as source and won’t build. Best not to waste your time trying with transcode. Back to google to search for something that actually works.

  3. Will says:

    Thanks Kirby, that script works perfectly! note: minor tweaks to # of chapters (the x<=8 for future reference) and the title (1st 1 in the 1,$x,1) and I'm golden!

  4. Ascentury says:

    For those who are receiving a “Bad address” error, see the advice at which clarifies that transcode has changed the way it handles command-line input slightly.

  5. Mike Rofone says:

    This article has been very helpful, and thanks in particular for Ascentury to his pointers on how to fix the “Bad address” error (summary: replace the “-x dvd” by “-x dvd,dvd” and the “-y $CODEC” to “-y null,$CODEC” in the above instructions, and there you go!

    As this is the first page to come up on Google when searching for “rip dvd audio linux”, I want to share how I succeeded in extracting the 5.1 Audio from a music DVD directly to AC3 files. I could not find any other resources on how to do so without retranscoding or conversion to Stereo Audio.

    I could not get direct AC3 extraction to work using transcode, as it would always fail with different errors depending on the “-y” values chosen. But from its output, I could derive how to do it. The following line will extract the multichannel AC3 audio from chapters 1-9 of track 4 of the DVD (“Systematic Chaos” 5.1 Mix DVD from Dream Theater) in the first optical drive in Arch Linux for files “Syschaos_{1..9].ac3”, which just play fine in VLC:

    for i in {1..9} ; do tccat -T 4,${i},1 -i “/dev/sr0” -t dvd -d 0 | tcdemux -a 0 -x ac3 -S 0 -M 1 -d 0 | tcextract -t vob -x ac3 -a 0 -d 0 > Syschaos_${i}.ac3 ; done

    The syntax of the tccat “-T” command is identical to transcode’s.

    Again, thanks to the author and Ascentury for their valuable information! 🙂
    Cheers from Germany,

  6. Mike Rofone says:

    Argh, sorry I missed some important point in the summary of the “Bad Address” fix: Instead of using “-y null,raw” one should now use “-y null,tcaud”, as the output of transcode will also state. I did not try the “-y null,wav” option, but perhaps it applies to it as well.

  7. Mike Rofone says:

    After some more fiddling with it, I ran across some more issues which I overcame.

    1) Another live DVD had both a Stereo and 5.1 mix. As the 5.1 was the second audio track, I had to change all the “-a 0” entries to “-a 1”.

    2) I found about half of the files to be unplayable in both VLC and totem. ffmpeg could process them, giving some “incomplete block” and other other errors, but the output files where then okay. Turn out that just dropping the “tcextract” invocation fixed the problem as well. The resulting files are a few 100kb larger, but they all play fine in VLC and totem.

    So finally I ended up using the following for the DVD Title 4, Chapters 1-9, Audio Track 0:
    for i in {1..9} ; do tccat -T 4,${i},1 -i “/dev/sr0” -t dvd -d 0 | tcdemux -a 0 -x ac3 -S 0 -M 1 -d 0 > Syschaos_${i}.ac3 ; done

    For another DVD (“Where Death is most alive” by “Dark Tranquillity”) I needed Title 1, Chapters 2-21, Audio Track *1*:
    for i in {2..21} ; do tccat -T 1,${i},1 -i “/dev/sr0” -t dvd -d 0 | tcdemux -a 1 -x ac3 -S 0 -M 1 > Deathalive_${i}.ac3 ; done

    3) As a side node, when creating MP3 files with transcode, one can alter the default of 128kbit/s using the -b switch, e.g. “-b 256k”.

  8. Luciano Marinho says:

    I’d tried some some some things but nothing worked to my desire that was: I have a DVD ripped in one folder in my hard drive and i expect to extract the chapters or titles, as you want to call, but no Mencoder works, not Transcode, and other things…

    But here i found the solution, thanks for Kirby!!!

    Just to know, i tried something like this:

    $mencoder dvd://1 -dvd-device /home/myfolder -ovc frameno -oac mp3lame -o 01.mp3

    This command like to work but when is 100% it just stay in loop.

Leave a Reply

Your email address will not be published. Required fields are marked *