Difference between revisions of "Extract DVD"

From Maze's wiki
Jump to: navigation, search
Line 28: Line 28:
 
Extract the subtitles from the stream.
 
Extract the subtitles from the stream.
 
<pre>
 
<pre>
mencoder <title>.vob -oac copy -ovc copy -o /dev/null -sid <sid> -vobsubout <title>
+
mencoder <title>.vob -oac copy -ovc copy -o /dev/null -sid <sid> -vobsubout <title> -vobsuboutindex <index> -vobsuboutid <langcode>
 
</pre>
 
</pre>
  

Revision as of 21:16, 13 March 2012

This describes how to convert a DVD to mkv using:

  • x264 for video
  • ac3 for audio
  • any subtitles

Install the packages

apt-get install mencoder mplayer gpac mkvtoolnix lsdvd

For using encrypted DVDs build and install libdvdcss from http://download.videolan.org/pub/libdvdcss/last

./configure --prefix=/usr
make
make install

Use lsdvd to see what's on DVD. Determine the stream you would like to extract as well as the aid for audio and the sid for subtitles.

lsdvd -x /dev/dvd

Write the video stream to the harddrive so the next steps will go faster.

mplayer dvd://<stream> -dumpstream -dumpfile <title>.vob

Extract the subtitles from the stream.

mencoder <title>.vob -oac copy -ovc copy -o /dev/null -sid <sid> -vobsubout <title> -vobsuboutindex <index> -vobsuboutid <langcode>

Now extract audio from the stream. Just use AC3.

mplayer <title>.vob -aid <aid> -dumpaudio -dumpfile <title>.ac3

Detect the amount to crop. Keep it running till it is stable for a while

mplayer <title>.vob -vf cropdetect

Run the first pass on the video

mencoder <title>.vob -vf <cropvalues> -oac copy -ovc x264 -x264encopts pass=1 -nosub -of rawvideo -o <title>.264

Run the second pass on the video

mencoder <title>.vob -vf <cropvalues> -oac copy -ovc x264 -x264encopts pass=2 -nosub -of rawvideo -o <title>.264

Put the video in a MP4 container

MP4Box -add <title>.264 <title>.mp4

Combine everything in a mkv container

mkvmerge -o <title>.mkv <title>.ac3 <title>.idx <title>.mp4