undvd: dvd ripping made easy

January 29th, 2007

I always found ripping dvds to be a huge pain, because of how complex the process is. There is a million ways to convert a dvd into avi format, a myriad of settings to play with, options to tune for performance, for size etc. That's great if you want to tinker. But it's much more difficult to give a straight answer to the question "how do I rip a dvd?" without going into all these details. I for one would like a simple way that would work on any dvd everytime.

So that's what I set out to do. It took me *a lot* of testing and playing with the settings to find a recipe that both gives great quality and doesn't take too long. And still there may be, and probably will be, cases where the results aren't great. But for my own use, it works very well. My main goal was to hide as many details as possible from the user, turning the complicated maze that is mencoder into a single button to push. As it turns out, however, it's really hard to abstract away everything completely, so even with undvd there is a (hopefully modest) learning curve.

undvd is a collection of a couple bash scripts, which I decided to base on lsdvd and mencoder, part of mplayer. In doing so, I wanted to use the disc as little as possible, considering all the problems I've had with reading dvds in the past. I also found out that by extracting the vob, some of the information about audio/subtitles is lost, so I first clone the disc with dd, and then go to work on it. The script starts off by making an image of the disc, whereupon the disc is no longer needed.

First, to see what's on the disc, run scandvd.sh.

scandvd.png

At this point, you have to decide on which title(s) to rip. If you don't know what they are, scandvd.sh suggests using mplayer to find out. Once you know what to rip, you run undvd.sh with the chosen options. Just keep in mind that the files will be created in the directory you run undvd.sh from, so make sure you have enough disk space.

undvd.png

What is worth noting here is everything that you don't see. mencoder is run in the background, with a host of complicated settings, but you don't see the horrifying output. You only see the status of what is happening, the settings you chose, and mencoder's estimated time to completion. Sure, the full log is there if you want it, just say the word. But unless something goes wrong, you don't need to see it, this will do just fine.

undvd_result.png

After ripping is finished, what you'll have is the files shown. 01.avi and 02.avi are the titles. disc.iso is the image of the dvd, which you can use to rip more titles still, or just delete. And then there's logs that you won't bother even looking at unless something went haywire.

And that is dvd ripping reduced to one line of output for every title. Simple, isn't it? :)

Get undvd from opendesktop.org.

A technical note

Make sure you have lsdvd and mplayer installed (with support for encoding, x264, xvid, and mp3/mad).

:: random entries in this category ::

36 Responses to "undvd: dvd ripping made easy"

  1. David Grant says:

    This is awesome!

  2. erik says:

    You might have to walk me through this personally some time :D

  3. Graham says:

    Looks sweet - I think I asked too many questions in the thread without reading your post first.

    This may just be my tool of choice if ever I decide to settle for a ripped movie in the future ;)

  4. microchip says:

    maybe check out my h264enc and xvidenc scripts too. They are packed with options, BUT, also support quality presets that when used bypass the options and use the specified preset instead. You only have to answer stuff like which DVD title to encode, scaling, video bitrate, audio codec and maybe a few more and that's it. If you always use the quality presets, my scripts are really easy to use... still all options of xvid and x264 are supported in case you need to tweak something ;)

    http://h264enc.sourceforge.net
    http://xvidenc.sourceforge.net

  5. [...] undvd was 80% complete by version 0.2.2, with packages for Gentoo, Ubuntu and Fedora. Version 0.3.x added things I didn’t plan to include at all when I started this project. The new features made it possible to set an output size (and thus indirectly set the bitrate), set 2 pass encoding, and set scaling. I was wary about compromising the key principle: undvd should be obvious and easy to use. But the new goodies were tucked into an “advanced” menu and so I don’t think they did a lot of damage. [...]

  6. Jeff says:

    I've been using this all week. By adding an alias to my .bashrc I can copy a disc with my preferences with a single short command.

    The video quality is much better than using DVD Shrink. In fact, it appears that the .avi file has equal quality to the original DVD (at least on my monitor, which is 22" hi-def).

    Plus, you can archive up to five movies on a single DVD. Really sweet.

    Applications like this are converting me to a command-line user. Far superior to the GUI programs I've tried.

    Question: Why does the script create an .iso file by default? I don't find it useful, as the .iso is usually too large to burn to a standard DVD. I've been ripping directly from the disc with no problems. Is there an advantage to creating the .iso first?

  7. Jeff says:

    Now I'm embarrassed. My post tattled and said I'm posting from Windows. I feel like I have egg on my face. Shouldn't have posted from work.

    For the record, I use Gutsy Gibbon.

  8. numerodix says:

    Jeff:
    The .iso is a by product, not an end product. Imagine it takes you 5h to rip a DVD and you're almost done when your DVD drive decides to throw a bunch of read errors and stop co-operating. That's quite vexing and it's happened to me. Therefore I would rather spend 10 minutes cloning the DVD first and if that succeeds I know I no longer depend on the plastic disc. After I'm done encoding the video I delete the .iso.

    Yes, unfortunately this incident of Windows use will forever be a stain on your record ;)

    Btw how did you find out about undvd? :)

  9. Jeff says:

    "Btw how did you find out about undvd?"

    I was googling for info on how to get MEncoder to do what I wanted, and came across this site.

    Many thanks

  10. Matthew says:

    Very cool! I've done a lot of experimentation with dvd ripping and it's always been either a big pain trying to decipher all the options or a big disappointment encoding for five hours to get a sub-standard quality end-product. More frequently both. I can now kick off an encode and sleep well knowing in the morning I'll have an incredibly faithful digital copy waiting for me.

    This is DVD quality. This stood up to Lord Of The Rings action sequences without a blur, a stutter, sync issues, or graininess. Well done!

    And yeah, this comment is from Windows because fantastic programs like yours are helping me turn my Linux laptop into an ssh-controlled (soon to be LIRC-controlled) multimedia appliance.

  11. numerodix says:

    Very pleased to hear it works well for you, Matthew. :)

  12. Octavian says:

    Any idea if it is possible to rip a DVD with more than one audio track?

    Regards,
    Octavian

  13. numerodix says:

    You mean so that you can preserve the choice of different audio tracks in the output file? As far as I know that's not possible. The matroska container (which is not what undvd uses, it uses plain avi) supports multiple subtitles, but I never heard of people having multiple audio tracks in one file.

  14. Octavian says:

    Yes, I meant that. I need to save the genuine English audio and the dutch one for my son.

  15. numerodix says:

    Well I suppose you could rip it twice, but then you'd have two separate files. Only solution that I know.

  16. Douglas says:

    Trying the program for the first time, it seems very good. I have two titles on the dvd I am ripping. I have completed title 01 but unfortunatly another program froze my computer and caused a shutdown halof way through title 02. I can see the disc iso in my nhome folder, but when I direct the program to it it fails I used

    do I need to use the disc again? or can I use the iso? if so how.

    Thanks

    Douglas

  17. numerodix says:

    You should be able to use the disc.iso image to rip, yes. Can you be more specific about how it "fails"?

    This is how you would tell undvd to use the disc.iso file:

    undvd -i disc.iso [other parameters]

  18. Douglas says:

    Hi Numerodix

    I just followed your instructions and bingo we are working. I think as a fairly new user to Linux, I might have used the full path, ie douglas@desktop undvd -t 02 -a en -i /home/douglas/disc.iso when i was already in my /home/douglas directory and maybe that is what caused it to fail. This time I used -

    douglas@desktop:~$ undvd -i disc.iso -t 02 -a en

    and as I say it is working perfectly. So my apologies it was not the program you wrote, but the one in my head lol.

    Thank you so much for the program and the answer to my mistake.

  19. Kabads says:

    I'm trying this on a Ubuntu Hardy system and I get the error:

    -x264encopts is not an MEncoder option

    with my log file looking like:
    http://dpaste.com/hold/61790/

    If I try and install any package from the ubuntu repositories, aptitude picks up a dependency issue and tries to uninstall undvd and mencoder.

  20. numerodix says:

    It looks like you are missing x264, the codec used to encode video. I think the package is called libx264-57 on ubuntu. Otherwise you could try passing the -x flag to use the xvid codec instead.

    undvd tries to detect if any of the things it depends on are missing, try:
    $ undvd -C

    As for the other issue, that sounds nasty, but what is the dependency that is missing?

  21. Kabads says:

    Hmm - got it to rip fine - thanks. However, the .avi files don't seem to play on ps3 through mediatomb. IIRC ps3 plays Divx files. Can Undvd cope with this codec?

  22. numerodix says:

    No, undvd is meant to produce files that are likely to play on any given desktop machine. All these portable devices have their own, stricter, requirements for what formats work on them. There are tools out there that produce video files especially for certain devices, but I haven't used them.

  23. [...] I started undvd I set out to solve one very specific, yet sizeable, problem: dvd ripping&encoding. I did [...]

  24. Pieter Swinkels says:

    Hi,

    The undvd script seems to contain a small bug: the language to extract is not passed to mencoder, so you always get the English language. I "fixed" it by adding the line

    push(@args, @audio_args);

    after line 301 in the undvd script right before the call to run_encode (undvd version 0.7.3). I have no experience with Perl and there is probably a better place in the script to fix this. However, a small test revealed that this did it for me.

    Kind regards,

    Pieter.

  25. numerodix says:

    Thanks a lot for reporting the issue, Pieter! I'll have a look at it.

  26. FerhatAKIN says:

    Thanks For Author ;)

  27. Kelsoo says:

    Hi. Working well on my already ripped .iso's. I tried it on my samsung nc 10 netbook running Debian. I needed to plugin my external usb DVD drive before it would start. I got "The device /dev/dvd doesnot exist" and "Supply the right dvd device to undvd...." I'm not sure if there is a way to disable the need for a for undvd to run without a DVD device present or not but though I'd mention it.

    Thanks

  28. numerodix says:

    That message comes up because undvd assume you want to rip from a dvd disc. You can also pass -i (or --iso) or -q (or --dir) to rip from an iso or a directory instead of a disc.

  29. Kelsoo says:

    Yes I understand, your help file is very clear. But on my net book with NO dvd drive undvd would not run as it couldn't find the drive.

    Only after I connected my external drive did it run. Even though I was converting from an already existing .iso and the external drive was not being used.

    I've just got back from work and both the rips have finished. Very happy with the results. The subs seem burned in as I couldn't switch the on and off. I'll have a proper play later, but I really like it. Thanks.

  30. numerodix says:

    You've found a bug. Thanks! :)

    I've just rolled out 0.7.5 which has the fix.

  31. Monty's SoupCatcher says:

    Is this tool capable of just ripping a copy protected dvd? ie, no transcoding to avi & altering the files etc.

    Anyone who's used dvd-decrypter on windows in the past knows what I mean. It would be incredibly useful to be able to copy the VIDEO_TS directly from disc to hdd. Then is can be burned to a dual-layer disc as is, or compressed to burn to a 4.7 GB dvd, or stipped of menus, or converted to avi if that's your thing.

    At the moment I'm still using windows app's running via wine to do things like that (DVDFab to rip and DVD2One to compress). So far I cannot find any native tool that can do those tasks.

  32. numerodix says:

    Well, undvd is not made for that purpose, it is meant to be a fuller pipeline than that. But there is a program called vobcopy (and indeed undvd uses it internally if you tell it to) that does exactly what you're asking. As far as decrypting goes, I believe the general rule is you want libdvdcss installed. And if it's there then both mplayer and vobcopy will use it.

    http://vobcopy.org/

  33. Kelsoo says:

    Thank you, that was fast :) I can confirm it worked fine. Very nice and easy to use and good quality results on my 4.4gb .iso's The only thing i'd prefer is a separate srt file but that's easy enough to create elseware.

  34. Craig says:

    I'm on a strict Ubuntu diet, but I still have an XP VM running to do DVD rips and re-encoding (via DVD-Rebuilder) to get them onto a single layer DVD-R (or +R).

    Would undvd do something similar? My goal is to, using Ubuntu, take a purchased DVD (dual-layer), strip off the encryption (via libdvdcss) and compress it down to 4.3GB (with our without menus depending on compression level required). I would then burn the resulting .ISO (or set of files in a VIDEO_TS folder) to a blank DVD.

    Ideally, this process would re-encode (via HC Encoder or similar) and not transcode (ala DVDShrink). I'm patient and can wait for re-encoding.

    Is something like this possible with undvd? If not, any suggestion on what products for Linux would do this? Command-line is fine. I just want something that works well and is consistent.

    Thanks,

    -Craig

  35. numerodix says:

    I'm not really sure what you're trying to do vis a vis encoding. undvd can encode video to pretty much any codec supported by mplayer/mencoder at arbitrary resolution and bitrate. So if you wanted to shrink a dual layer dvd down to 4.3gb I imagine you could do that although I've never done such a thing.

    I'm not familiar with the software you mention so I have no idea what your custom is.

  36. swedski says:

    Great program BUT I have one problem. When I view the rips on my Popcorn hour I get lag between the video audio and subtitles. When I watch it on my computer its fine. Any suggestions why this happens and is there any way to tweak this?