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

lsdvd

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

Incoming search terms:

Related posts

38 thoughts on “How to Rip DVD audio to mp3 or ogg

  1. Thank you very much !
    I love these tricks especially when it is about multimedia.

    Your website is in my RSS aggregator since a ‘long time’, and i can’t wait for new tips/tricks :)

    Thank you again

    Bye from France
    Manuel

    [Reply]

  2. Thank you, but one small correction…

    The switch for the output file is wrong. “-m” is for specifying an output stream. “-o” is for specifying an output file name. It also should not just be a name with extension, you should also specify a full output path. So instead of “-m track20.ogg”, as it appears in the example, it should be “-o /home/[username]/music/track20.ogg”, (or whatever is right for your setup). Using the command given will do nothing more than write the file to a stream that is not saved anywhere.

    Otherwise it works great…

    [Reply]

  3. I was excited to read your how-to as I had just given up on rip::dvd. It wouldn’t work for me after the first try, will likely get back to it, but I wanted to try your cli route.
    It looked promising but I got the following 3 error lines:
    [transcode] warning : (encoder.c) video codec not supported by export module
    [transcode] warning : failed to init export modules
    [transcode] critical: plug-in initialization failed

    I would appreciate any thoughts you might have for me. It was the same error using Russ’s edited command. Thanks!!

    [Reply]

  4. Well, there is one more thing. If you want to rip DVD to Ogg, you should use this one:

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

    Without -y null, you will get an error and few warnings. -q argument depends on what bitrate you would like to have in your ripped audio file (:

    [Reply]

  5. Hello all,

    Well…hmmm…doesn’t seem to work so swiftly for me. What am I doing wrong?

    Thanks for any light shed,
    Doug

    doug@nimbus:~$ transcode -i /dev/dvd -x dvd -T 1,2,1 -a 0 -y ogg -q 192 -o /home/doug/Desktop/Farewell_I_Tour/The_Long_Run.ogg
    transcode v1.0.2 (C) 2001-2003 Thomas Oestreich, 2003-2004 T. Bitterberg
    [tcprobe] DVD image/device
    (dvd_reader.c) DVD title 1/2: 21 chapter(s), 1 angle(s), title set 1
    (dvd_reader.c) title playback time: 01:39:09.01 5950 sec
    (dvd_reader.c) [Chapter 01] 00:00:00.000 , block from 0 to 49628
    (dvd_reader.c) [Chapter 02] 00:01:34.080 , block from 49629 to 203804
    (dvd_reader.c) [Chapter 03] 00:06:25.080 , block from 203805 to 362080
    (dvd_reader.c) [Chapter 04] 00:11:28.080 , block from 362081 to 551149
    (dvd_reader.c) [Chapter 05] 00:17:40.080 , block from 551150 to 689463
    (dvd_reader.c) [Chapter 06] 00:22:04.680 , block from 689464 to 847078
    (dvd_reader.c) [Chapter 07] 00:27:04.080 , block from 847079 to 1002248
    (dvd_reader.c) [Chapter 08] 00:31:58.440 , block from 1002249 to 1140958
    (dvd_reader.c) [Chapter 09] 00:36:18.840 , block from 1140959 to 1343112
    (dvd_reader.c) [Chapter 10] 00:42:46.800 , block from 1343113 to 1507825
    (dvd_reader.c) [Chapter 11] 00:47:52.680 , block from 1507826 to 1653207
    (dvd_reader.c) [Chapter 12] 00:52:25.080 , block from 1653208 to 1801239
    (dvd_reader.c) [Chapter 13] 00:57:36.720 , block from 1801240 to 1819579
    (dvd_reader.c) [Chapter 14] 01:01:06.240 , block from 1819580 to 1928433
    (dvd_reader.c) [Chapter 15] 01:05:44.160 , block from 1928434 to 2072420
    (dvd_reader.c) [Chapter 16] 01:10:43.920 , block from 2072421 to 2227307
    (dvd_reader.c) [Chapter 17] 01:15:15.000 , block from 2227308 to 2365080
    (dvd_reader.c) [Chapter 18] 01:19:13.320 , block from 2365081 to 2489305
    (dvd_reader.c) [Chapter 19] 01:26:36.000 , block from 2489306 to 2722745
    (dvd_reader.c) [Chapter 20] 01:30:33.480 , block from 2722746 to 2852249
    (dvd_reader.c) [Chapter 21] 01:37:02.520 , block from 2852250 to 3058384
    [transcode] (probe) suggested AV correction -D 0 (0 ms) | AV 0 ms | 0 ms
    [transcode] auto-probing source /dev/dvd (ok)
    [transcode] V: import format | unknown (V=dvd|A=(null))
    /dev/dvd:1: parser error : Document is empty

    ^
    /dev/dvd:1: parser error : Start tag expected, ‘

    [Reply]

  6. Just wanted to drop a note that if you find yourself with standard DVDs that have no video, as is the case with DVD singles lately, then you need to use

    -x null,dvd

    Otherwise, transcode will fail to read the video (because there isn’t any). So my command is:

    transcode -i /dev/dvd -x null,dvd -T 4,1,1 -a 0 -y null,ogg -o Marillion.ogg

    As a side note, this actually speeds up the extraction process too!

    [Reply]

  7. Does this extract full surround sound audio or just stereo? I have a music DVD with surroud sound and would like to keep the 5.1 format but as have yet found a way to do that.

    [Reply]

  8. Hi all,
    any one with solution as the same problem with Doug , me too.
    parser error : Start tag expected,
    thanks

    [Reply]

  9. Another useful command for ripping to wav:

    transcode -i /dev/dvd1 -x null,dvd -U file -N 0x1 -T 1,-1 -a 0 -y wav

    “-N 0x1″ processes the audio data as PCM instead of MPEG. This is better if the dvd already has PCM sound.

    “-U xxx” outputs a file for each chapter. Files are named xxx-ch01.avi, xxx-ch02.avi etc. Though the files are named avi they are still wav-files.

    [Reply]

  10. transcode wrks,but i get a little detail, my tracks aren’t longer than 127 seconds. I have tried ogg, mp3 and wav to no avail, the titles on the dvd have only 1 chapter and are most of them longer than 3 minutes; any ideas? Great work by the way. And thanks in advance.

    [Reply]

  11. I cannot seem to make the audio from my dvd to extract.

    transcode -i /media/cdrom0 -x dvd -T 1,1,1 -a 2 -y raw -o /tmp/aus_ch1.mp3
    transcode v1.0.2 (C) 2001-2003 Thomas Oestreich, 2003-2004 T. Bitterberg
    (dvd_reader.c) DVD title 1/1: 3 chapter(s), 1 angle(s), title set 1
    (dvd_reader.c) title playback time: 02:49:00.03 10141 sec
    (dvd_reader.c) [Chapter 01] 00:00:00.000 , block from 0 to 707608
    (dvd_reader.c) [Chapter 02] 00:50:29.166 , block from 707609 to 1722548
    (dvd_reader.c) [Chapter 03] 02:08:29.166 , block from 1722549 to 2260923
    [transcode] (probe) suggested AV correction -D 0 (0 ms) | AV 0 ms | 0 ms
    [transcode] auto-probing source /media/cdrom0 (ok)
    [transcode] V: import format | MPEG-2 DVD NTSC (V=dvd|A=dvd)
    [transcode] V: AV demux/sync | (2) initial MPEG sequence / enforce frame rate
    [transcode] V: import frame | 720×480 1.50:1 encoded @ 4:3
    [transcode] V: bits/pixel | 0.217
    [transcode] V: decoding fps,frc | 23.976,1
    [transcode] V: Y’CbCr | YV12/I420
    [transcode] A: import format | 0x2000 AC3 [48000,16,2]
    [transcode] A: export format | 0x55 MPEG layer-3 [48000,16,2] 128 kbps
    [transcode] V: encoding fps,frc | 23.976,1
    [transcode] A: bytes per frame | 8008 (8008.000000)
    [transcode] A: adjustment | 0@1000
    [transcode] V: IA32/AMD64 accel | sse2 (sse2 sse mmxext mmx asm C)
    tc_memcpy: using sse for memcpy
    [transcode] V: video buffer | 10 @ 720×480
    [import_dvd.so] v0.4.0 (2003-10-02) (video) DVD | (audio) MPEG/AC3/PCM
    [export_raw.so] v0.3.12 (2003-08-04) (video) * | (audio) MPEG/AC3/PCM
    [import_dvd.so] tccat -T 1,1,1 -i “/media/cdrom0″ -t dvd -d 0 -L | tcdemux -a 2 -x ac3 -S 0 -M 2 -d 0 | tcextract -t vob -x ac3 -a 2 -d 0 | tcdecode -x ac3 -d 0 -s 1.000000,1.000000,1.000000 -A 0
    [import_dvd.so] tccat -T 1,1,1 -i “/media/cdrom0″ -t dvd -d 0 | tcdemux -s 0x82 -x mpeg2 -S 0 -M 2 -f 23.976024 -P /tmp/filehhkE0I -d 0 | tcextract -t vob -a 0 -x mpeg2 -d 0 | tcdecode -x mpeg2 -d 0 -y yv12
    [import_dvd.so] delaying DVD access by 3 second(s)
    .tc_memcpy: using sse for memcpy
    ..tc_memcpy: using sse for memcpy
    [decode_mpeg2.c] libmpeg2 0.4.0b loop decoder
    [decode_mpeg2.c] libmpeg2 acceleration: mmxext
    Audio: using new version
    Audio: using lame-3.97
    [export_raw.so] codec=YV12, fps=23.976, width=720, height=480

    clean up | frame threads | unload modules | cancel signal | internal threads | done
    [transcode] encoded 0 frames (90830 dropped, 0 cloned), clip length 0.00 s

    [Reply]

  12. I’m not an Ubuntu user, but whenever I google for a Linux problem, the solution usually comes from an Ubuntu post. Thanks to everyone. My goal today was to rip the audio off of a “home-made” DVD video of my boss giving a presentation into an MP3 file so I can just listen to it on my iPod. What worked for me was this command: (rips audio of all chapters of 1st DVD track in MP3 format)

    transcode -i /dev/dvd -x null,dvd -T 1,-1 -N 0x55 -y null,raw -m /path/A.mp3

    The comments mentioning to add “null” definitely help and made the encoding process much faster. The “-N 0x55″ indicates MP3 and without it and I got best results using the -m flag for the output (contrary to the comment that it should be -o filename). It seems like specifying “null” made transcode ignore the video track.

    [Reply]

  13. Clarifying my above comment

    I’m not an Ubuntu user, but whenever I google for a Linux problem, the solution usually comes from an Ubuntu post. Thanks to everyone. My goal today was to rip the audio off of a “home-made” DVD video of my boss giving a presentation into an MP3 file so I can just listen to it on my iPod. What worked for me was this command: (rips audio of all chapters of 1st DVD track in MP3 format)

    transcode -i /dev/dvd -x null,dvd -T 1,-1 -N 0×55 -y null,raw -m /path/A.mp3

    The comments mentioning to add “null” definitely help and made the encoding process much many times faster. It seems like specifying “null” made transcode ignore the video track. The “-N 0×55? indicates MP3 and without it my output was like 5 gigs, with it 18 MB. (That might also have been because I was specifying output with -o instead of -m.) I got best results using the -m flag for the output (contrary to the previous comment that it should be -o filename).

    [Reply]

  14. I’m running Debian, but I often find Googling directs me to this very useful forum. Thanks guys.

    I’ve tried running transcode to give a .wav output, as follows:

    transcode -i /dev/dvd -x null ,dvd -T 1,2,1 -a 1 -y wav -o track2.wav

    and it gives an output file which, when played, the sound comes in one-second bursts. At least, it does when played with my default Totem movie player. I’ve found since that it works fine in VLC, Gnusound or Audacity.

    OTOH, changing the output to -y raw -o track2.mp3 gives a MP3 file which plays properly
    in Totem or VLC, but gives ‘unknown file format’ with Gnusound and plays in 22 seconds flat (with chunks omitted) in Audacity. If converted from MP3 to .wav using mpg321, the resulting .wav file also plays in 22 seconds flat.

    The moral seems to be, if one program doesn’t work, try another. And sound, like DVD formats, seems to be a black art. ;)

    I haven’t tried burning to a CD yet to see what it will do in a CD player.

    cr

    [Reply]

  15. To transcode all music chapters from 1 to 16:

    for x in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do transcode -i /dev/dvd -x dvd -T 1,$x,1 -a 0 -y raw -m track$x.mp3; done

    [Reply]

  16. Thanks everyone! Can someone tell me how to get the audio from the menu portion of the DVD? I want to get the short music that plays with the DVD menu.

    [Reply]

  17. Please advise on copying sound from dvd and converting it to mp3 format. Can a cd be reformatted to mp3 format, so that I can transfer 6 hours of music from dvd to cd. Please advise on price of software.

    A. C. M.

    [Reply]

  18. If you have an AVI video file instead of a DVD, another useful command to extract the audio into an mp3 file is the following, assuming the video file already has audio encoded in mp3:

    transcode -i input_file.avi -x null,mp3 -y null,raw -m output_file.mp3

    [Reply]

  19. Thanks for the guide.

    I ripped audio from a dvd but found that there was clipping on some of the louder parts of the music. Is there a way of preventing this? i.e. can you normalize the levels whilst ripping?

    thanks for a reply from anyone,
    Faithman2k

    [Reply]

  20. Ubuntu 8.04 LTS here.

    Error factory when attempting the build on handbrake. Many errors shown during config, but no final message saying it was fubared.

    SP

    [Reply]

  21. Hello. Thanks for posting all these things, they were very useful to me.
    I would like to say Roberto that there is a better way to do that; picture yourself that the DVD has 60 chapters…are you going to write all the 60 numbers?
    I venture to suggest that if you want to rip all chapters from 1 to 16, you use this code:

    for ((w=1; w<=16; w++)) do transcode -i /dev/dvd -x dvd -T 4,$w,1 -a 0 -y raw -m yourartistname-0$w.mp3; done

    That is just a repetitive structure, where w represents the first number of the chapter and the second w the last chapter you want to rip. Instead of writing down all the numbers, you can tell the compiler to do it for you. The line where it says “yourartistname” is for you to substitute that for the name of your favorite artist, or the single, or the disc or anything you want.
    The output filename will have the number of the chapter next to the name of your artist (specially useful if you want them to be ordered numerically)
    I get rid of longer locations in the filenames by locating the parser to the desired directory before executing the preceding order (this is writing cd /yourhomefolder/yourdesiredfolder before executing the order).
    But i have a little problem: when i do all that, the file volume is considerably low, so my question is how can i increase the volume level of my output file?
    Thanks in advance.

    [Reply]

  22. I found how to increase the volume; it is with the flag -s [1,1,1]
    changing the number, you can increase the volume.

    [Reply]

  23. Please, can anyone tell me how can i decrease de weight of an audiofile while i’m ripping the audio from the dvd?
    Thank you very much

    [Reply]

  24. Man, this trick is awesome! Congratulations for the great tip!

    Is because of people like you this thing called OpenSource works so fine!

    [Reply]

  25. I’ve tried this command on two different DVDs and both times the transcoding stops at 1:25:29 though the audio length is longer.

    transcode -i /media/cdrom0 -x dvd -T24,1 -a 0 -y raw -m redvsblue_s5.mp3

    [Reply]

  26. Did you try including the space between the “T” and “24”??
    Are you sure the audio is recorded in the same chapter number?? I mean, maybe the audio is longer, but maybe it is in 2 chapters, for example -T 24,1,1 and -T 24,2,1.

    [Reply]

  27. If that is the case you can do as I say in my first post, the one with the repetitive structure. Hope this helps.

    [Reply]

Leave a comment

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