backing up “broken” dvds

In my long chain of processes that are in place to rip DVDs and get the episodes I want, when I insert one into my disc tray, I have a series of scripts that fire off to automate the entire process. One of these is backing up the filesystem of the disc to a directory storing all its contents. If the TV show is a cartoon, then I’ll keep it on an external drive. This gives me a lot of flexibility in case I ever want to go back and do testing such as different codecs or settings, or just need to run queries on stats, or whatever else.

For the most part, getting a backup of a DVD isn’t a big deal. For years I’ve used the tool dvdbackup which works great. It’s only been relatively lately that I wrote my own dvdbackup clone, part of the dvd_info tool set, called dvd_backup. I never wrote one of my own for the very simple reason that I didn’t need one — the original tool works just fine. As much as I enjoy playing with experimental software, I’m also very pragmatic on some fronts — if it works well enough, I just leave it alone. In fact, I don’t even use mine at all right now except to debug problems with DVDs. Which brings me to this post.

DVDs that have 99 tracks on them are generally authored intentionally to break ripping software, though, and that’s one that I’m working with right now. I’ve got an X-Men DVD of the original cartoon series that is being a bit of a pain. I’m an archivist, so I look for a bit-exact copy as much as possible when working with my content. Ones like these though are authored to make it confusing which tracks have the content on them, plus authoring them so that it gives filesystem problems. In cases like this, the DVD will usually rip to an enormous size — 16 GB in this one, even though the actual content is about 7.5 GB. It’s a common tactic used. The thinking is probably that if it makes it hard enough for consumers to rip, then they won’t bother doing it at all.

The first thing to do is find out which tracks are the actual content. I use VLC for this because it has a GUI to navigate through the episode selection. All that needs to be done, is start playing one of the episodes from the menu, and then see which track is playing. Pretty simple that part, it just takes some manual interaction to find out where the valid ones are.

DVDs have “video title sets” on them, which is a collection of one or more tracks separated by boundaries. If you’ve looked at a DVD’s filesystem and seen things like “VTS_06_1.VOB” or so on, that’s what the VTS stands for.

Back to backing it up though, if I backed up all the tracks on the DVD, it would take a long time. So what I do here instead is only back up the title sets where I’ve confirmed that that tracks are residing.

dvd_info’s default output will display what title set a track is residing on. Starting with the example above, check to see where track 11 is:

$ dvd_info --track 11
Track: 11, Length: 00:21:20.967, Chapters: 06, Cells: 14, Audio streams: 03, Subpictures: 05, Title set: 03, Filesize: 914 MBs

For this one, it’s on the third title set. Now use dvd_backup to rip *just* that title set, instead of the whole DVD:

Opening device /dev/sr0
Opening VMG IFO
36 Video Title Sets present
Writing to VIDEO_TS.IFO
Writing to VIDEO_TS.BUP
Writing to VTS_03_0.IFO
Writing to VTS_03_0.BUP
MX1-0N-NW1_DES/VIDEO_TS/VTS_03_0.VOB blocks written: 6 of 6
[VTS 3]
Blocks: 471694
Filesize: 966029312
VOBs: 1
VOB 1 filesize: 966029312
MX1-0N-NW1_DES/VIDEO_TS/VTS_03_1.VOB blocks written: 471694 of 471694, skipped: 135

By default, mine will read each DVD block individually (2k). It makes for a slower rip, but it does get as much as possible. dvdbackup (not mine) by default will rip 512 blocks at once (1 MB), but has the option to do invidiual blocks as well. I’m currently looking at maybe having that option in mine as well, though I am unsure as to how much I would use it.

The dvd_backup (mine) program will copy all main IFO and BUP files as well, which means that you could actually run any commands against that backup directory, and it will read it as the same DVD. Which means you can rip straight from there, once the title sets are backed up.

Going this route is a bit tedious though, and I currently only do it if I’m experimenting with the filesystem or not. Generally, I’ll use dd_rescue to scrap as many bits off of there as well. This also takes a long time .. the shortest I’ve seen is 30 minutes, and the longest is around 6 hours … but it will get almost all of the disc, and at its original filesize:

$ ddrescue -n -b 2048 /dev/sr0 dvd.iso

So there you go, two ways to back up “broken” DVDs. For now, my dvd_info package is on github and the latest packages aren’t in any distro repositories, but I’m working on that. For now, you’d have to check out the code or download a release and build it manually. Instructions are here: building dvd_info from source.

Have fun. 🙂

Leave a Reply