Foolproof method to rip any dvd without reencoding under Linux


Many editors now understand that tampering with the DVD working to prevent copy is not only useless, but counter-productive. Not all of them, though, so from time to time, I need to type a few commands in order to be able to read on my mediaplayer the dvds I legally purchased, but that some bozo hasn't thought her pathetic attempt would prevent it when selecting a structural copy protection scheme. And by the way, my experience is that the tiniest the expected audience, the more absurd the copy protection scheme: I was able to transfer The Avengers (8€ on Amazon) or The Big Bang Theory (25 €/season) without trouble. However, some local little known productions that certainly everyone wanting to see is ready to purchase, I had most trouble (and regrets) after having purchased them to be able to view them at home.

Now for some action

Enough politics. If vobcopy / dvdbackup breaks, here's what you can do:

Extract the streams from the DVD

$ mplayer -dumpstream dvd://5//dev/sr0 -dumpfile res.vob

5 is the title's number, you'll have to figure it (try 1, 2, 3, etc.. if you don't know it). In my case, the dvd isn't on /dev/dvd but /dev/sr0, hence the string. The resulting file res.vob is an MPEG multiplex v2.

This is an application of the axiom of digital media: "If you can read it, you can copy it".

Fixing the ratio

DVD format (PAL) is 720x576, with a PAR (Pixel Aspect Ratio) of 16:15, for reasons I don't understand, so most of the time, you'll get a 4:3 format.

Ideally, we would like to set the DAR (Display Aspect Ratio) to 16:9, however I don't know how to do that without intervening on the video stream, that is reencoding.

There's an alternative, which is changing the PAR, however, as far as I know, this can't be done in the MPEG v2 multiplex without intervening on the video stream. However, there's an alternative: use an MPEG 4 system stream, and put the pixel ratio there (in the container), and thus there is no need to reencode the video stream. So we'll do that. First, we transfer the streams into an MPEG 4 container:

avconv  -i res.vob -map:a 0 -f mp4 -c copy res.mp4

-map:a 0 means to keep all the audio streams.
-f mp4 that we want an mpeg 4 container
-c copy to copy the inner streams (audio and video) without modification.

Setting the aspect ratio

We can now set the pixel aspect ratio.

Ideally, we would like a ratio of (16/9) / (4/3) x 16/15 ~ 1.422 (or 64/45), that is changing the pixel ratio so that the former 4:3 image now has a 16:9 ratio. However, some systems choke on this 64/45 ratio, so I use 142:100. We now set the value with MP4Box:

MP4Box -par 1=142:100 res.mp4

and that's it. I'm assuming the video track is number 1 here, hence the 1=ratio