Thursday, 7 August 2014

Ripping DVD with FFMPEG

This more a post to myself than to others, but even so, others might find it useful as well. Because sometimes having a DVD is inconvenient compared to your usual Matroska file saved on a HDD, I was looking for a simple way to encode the DVD. I have it decrypted and copied in a folder, but there are a bunch of 1 GiB VOB files, which is a) big, b) inconvenient. So the idea is, join the VOBs and transcode it into h264 (substitute theora, vp8 or dirac if you are more radical FLOSS supporter than me) and FLAC for audio. Actually simple search on the net presented me with an easy solution using FFMPEG (I kinda had problems with using the GUI ripping software), but it took some more research (reading the ffmpeg man pages) to find out how to rip more than one audio stream into the final file (I used a JAP/ENG DVD about Aikido).

-crf 18 tells that we want to use Constant Rate Factor, value 18 (which might be a bit of overkill, but I don't want to sacrifice quality for space and I don't have the time tune it).

-vf yadif use YADIF deinterlacing, because I don't wanna keep interlacing in the video – I'll be playing it on a computer, after all.

-c:a flac tells we'll be using FLAC for audio streams. It's free and lossless. Again, it might be overkill, but I like to keep the original sound without using nonfree codec like AAC or AC3.

When I originally omitted the -map parameters, only single video and single audio stream were transcoded, so it's necessary if you want to transcode more audio streams or different stream than the first one.

With your solution I found some issues. The video is not correctly generated even if the audio is fine. I found another website which uses tccat instead of concat'ing source VOBs, and appending ffmpeg in pipeline. I have tried with only 5 chapters of input DVD and they seems to work fine.Source here

Instead of transcoding the audio to flac, you can use -c:a copy. This will copy the stream directly from the input file instead of transcoding it. You said you don't want to use a nonfree codec, but x264 is a little borderline, no?