How to make a DVD rip


Preparation

You will need...

Procedure

Once you have your DVD ready to be read, simply run dvdbackup -M to copy the full disk to your computer. Read its manpage (it's short) if you want to, for instance, copy only one feature/title instead.

You should end up with a file structure like this:

.
`-- VIDEO_TS/
    |-- VIDEO_TS.BUP
    |-- VIDEO_TS.IFO
    |-- VIDEO_TS.VOB
    |-- VTS_01_0.BUP
    |-- VTS_01_0.IFO
    |-- VTS_01_0.VOB
    |-- VTS_01_1.VOB
    |-- VTS_01_2.VOB
    |-- VTS_01_3.VOB
    |-- VTS_01_4.VOB
    |-- VTS_01_5.VOB
    |-- VTS_01_6.VOB
    |-- VTS_01_7.VOB
    |-- VTS_02_0.BUP
    |-- VTS_02_0.IFO
    |-- VTS_02_0.VOB
    |-- VTS_02_1.VOB
    |-- VTS_03_0.BUP
    |-- VTS_03_0.IFO
    |-- VTS_03_0.VOB
    `-- VTS_03_1.VOB
	

It will differ depending on what amount of features the DVD contains or its lengths.

Now go into the VIDEO_TS directory. You will use a command similar to this one:

ffmpeg -i concat:VTS_01_1.VOB\|VTS_01_2.VOB\|VTS_01_3.VOB\|VTS_01_4.VOB\|VTS_01_5.VOB\|VTS_01_6.VOB\|VTS_01_7.VOB \
-map 0:v -map 0:a \
-metadata title="x" \
-c:v libx264 -tune film -preset slower -crf 19 \
-filter:v "nnedi=weights=./nnedi3_weights.bin:deint=interlaced:pscrn=new:qual=fast:nns=n16:nsize=s32x4:field=af" \
-c:a copy \
-movflags +faststart \
"x.mkv"
	

Here is a breakdown of the command, line by line:

Concatenating
The concat: input is for joining together multiple files into one input FFmpeg can use. Change the filenames accordingly.
Mapping
We need the -map options for selecting the streams we will actually use in our final output, because there is this bogus one called 'dvd_nav_packet' which is not necessary.
Assigning metadata
This is self explanatory, change the 'x' accordingly.
H.264 encoding options
I did not pick VP9 or AV1 because they are significantly slower, or H.265 because it is not suited for standard definition video.
The lack of audio options
We do not reencode the audio to FLAC or anything, as it results in desyncing.
Deinterlacer (optional)
You can take out this line if you want to keep it interlaced, although I don't see why considering how monitor technology is nowadays. nnedi is the deinterlacer using neural networks to output the best result possible.
The filename
You know what to do here. Matroska is the only real option for this if you want to embed chapters, plus, it's a royalty free format, but you already know that ;-)

Go-time

Now press enter and wait. If I frame-double (field=af), it goes at around 0.15x speed on my machine, and if I don't (field=a), at 0.3x. Not that mine is very powerful, though. You can go do something else with your time anyway, and FFmpeg automatically runs at the maximum niceness value, so your computer won't fully poop out because you're encoding.

Adding chapters to your files

Obviously, you won't always need to do this, as it's usually only on the main feature that chapters are included. FFmpeg isn't able to do it, as far as I'm aware, so you will need to do the following to embed chapters into your (Matroska) file:

Done

You should end up with files around half in size of the original source, with a practically lossless result. I may write about suggestions on how to scan CD/DVD artwork at some point in time. Here are two examples: Gustavo Cerati's Crimen videoclip and Soda Stereo's En la ciudad de la furia performed on September 20, 1997.


Additional notes

To extract the separate VOB files from a multi-angle video, I used a Windows program called IfoEdit following this guide. Contact me if you find a more portable program which is able to do this. Note you'd need to add these files as separate inputs instead of concatenating them, like this: ffmpeg -i ./1/VTS_??_?.VOB -i ./2/VTS_??_?.VOB -i ./3/VTS_??_?.VOB [...]

Credits

Many webpages I scourged to try and figure out the best options for this.