#LiveSimple and #ProgramThings

Keep DVD archiving simple, stupid!

I have been backing up my DVD collection for some time now, as I have noticed that some media are wearing out.
Over the years I had made several attempts with the aim of balancing occupied space and final quality, but in the end, simple solutions are always the best!!
In this little guide, I’ll use the all-in-one mencoder tool to back up my DVDs, using the open-source x264 codec and one of its presets.

Mencoder

MPlayer is considered a poorly maintained project, but, it’s the only tool out there that can encode a DVD on the fly with no intermediate steps.

Codec H264

Fo me, H264 is the best codec for ripping DVDs, and SD/HD streams in general. This is because it introduces fewer artifacts than codecs created to encode 1080p/2160p streams (e.g. h265), which would otherwise be visible at high resolutions (for example watching a DVD on a 4K monitor).
Furthermore, its diffusion makes it compatible with a large variety of devices.

The best encoding is the one closest to the source

Many encoding guides talk about filtering, rescaling, or otherwise manipulating the source stream in order to improve compression or performance at high resolutions.
But technically all popular encoders are quality lossy, using algorithms based on visual perception to better compress frames while fooling the human eye.
Consequently, there is little point in applying filters, and the source should be encoded exactly in the same format.
Many DVDs use anamorphic encoding, in other words:

+--------+     +------------------+
|        |     |                  |
|  SRC   | --> |   PLAYER SCALED  |
|  FRAME | --> |      FRAME       |
|        |     |                  |
+--------+     +------------------+

where the compressed frame is rescaled to the correct aspect ratio by the player.
So for the video stream, I won’t apply any filtering/scaling, thus producing an anamorphic video.
As for the video bitrate control, I opted for the constant rate factor. There are tons of articles about which one is the best, but it’s this article that convinced me. In any case, this guide can be easily adapted to other strategies (2-pass, constant quantitation, etc etc)

For audio, it’s even easier, because I decided to copy it as is.

Nobody knows the encoder better than its creators

Configuring the x264 encoder is not easy. There are a lot of options (motion estimation strategy, quantization matrix, etc etc) that determine its behavior. But the developers provide presets that can be used more easily and reliably (no one knows the encoder better than the developer).

Let’s begin

Here is the command used for encoding a DVD track:

$ mencoder dvd://3 -o Fringe.4x08.avi \
            -sid 1 -vobsubout subout.4x08 \
           -noaspect -nosub -ni -mc 0 -noskip -aid 128 -oac copy \
           -ovc x264 -x264encopts preset=slow:tune=film:crf=18

where:

last step, mix video track (with aspect ratio) and others tracks (audio/subtitles) in a matroska container (mkv) with the mkvmerge tool (part of mkvtoolnix).

$ mkvmerge -o Fringe.4x08.Missione.Per.Due.DVDRIP.x264[crf16].ac3.mkv \
           --title "Missione Per Due" \
           --aspect-ratio 0:16/9 --language 1:ita Fringe.4x08.avi \
           -s 0 --language 0:ita --forced-track 0:1 subout.4x08.idx

That’s all, and remember, simple is better