Difference between revisions of "Extract DVD"

From Maze's wiki
Jump to: navigation, search
m (moved Video to Extract DVD)
Line 3: Line 3:
 
*ac3 for audio
 
*ac3 for audio
 
*any subtitles
 
*any subtitles
 
+
==Installation==
 
Install the packages
 
Install the packages
 
<pre>
 
<pre>
Line 15: Line 15:
 
make install
 
make install
 
</pre>
 
</pre>
 
+
==Prepare==
 
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.
 
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.
 
<pre>
 
<pre>
 
lsdvd -x /dev/dvd
 
lsdvd -x /dev/dvd
 
</pre>
 
</pre>
 
+
Write the stream to the harddrive so the next steps will go faster.
Write the video stream to the harddrive so the next steps will go faster.
 
 
<pre>
 
<pre>
 
mplayer dvdnav://<stream> -dumpstream -dumpfile <title>.vob
 
mplayer dvdnav://<stream> -dumpstream -dumpfile <title>.vob
 
</pre>
 
</pre>
 
+
==Video==
Now extract audio from the stream. Just use AC3.
 
<pre>
 
mplayer <title>.vob -aid <aid> -dumpaudio -dumpfile <title>.ac3
 
</pre>
 
 
 
Convert the ac3 file to 6 channel wave
 
<pre>
 
mplayer <title>.ac3 -af channels=6:6:0:0:1:4:2:5:3:2:4:1:5:3 -channels 6 -ao pcm:nowaveheader:file=<title>.wav6
 
</pre>
 
 
 
Convert the 6 channel wave to a 6 channel ogg
 
<pre>
 
oggenc -r -B 16 -C 6 -R 48000 --resample 44100 -b 200 <title>.wav6
 
</pre>
 
 
 
 
Detect the amount to crop. Keep it running till it is stable for a while
 
Detect the amount to crop. Keep it running till it is stable for a while
 
<pre>
 
<pre>
Line 59: Line 43:
 
<pre>
 
<pre>
 
MP4Box -add <title>.264 <title>.mp4
 
MP4Box -add <title>.264 <title>.mp4
 +
</pre>
 +
==Audio==
 +
Now extract audio from the stream. Just use AC3.
 +
<pre>
 +
mplayer <title>.vob -aid <aid> -dumpaudio -dumpfile <title>.ac3
 +
</pre>
 +
 +
Convert the ac3 file to 6 channel wave
 +
<pre>
 +
mplayer <title>.ac3 -af channels=6:6:0:0:1:4:2:5:3:2:4:1:5:3 -channels 6 -ao pcm:nowaveheader:file=<title>.wav6
 
</pre>
 
</pre>
  
 +
Convert the 6 channel wave to a 6 channel ogg
 +
<pre>
 +
oggenc -r -B 16 -C 6 -R 48000 --resample 44100 -b 200 <title>.wav6
 +
</pre>
 +
==Subtitles==
 
Extract the subtitles from the stream.
 
Extract the subtitles from the stream.
 
<pre>
 
<pre>
 
mencoder <title>.vob -oac copy -nosound -ovc frameno -o /dev/null -sid <sid> -vobsubout <title> -vobsuboutindex <index> -vobsuboutid <langcode>
 
mencoder <title>.vob -oac copy -nosound -ovc frameno -o /dev/null -sid <sid> -vobsubout <title> -vobsuboutindex <index> -vobsuboutid <langcode>
 
</pre>
 
</pre>
 
+
==Merging==
 
Combine everything in a mkv container
 
Combine everything in a mkv container
 
<pre>
 
<pre>
 
mkvmerge -o <title>.mkv <title>.ogg <title>.idx <title>.mp4
 
mkvmerge -o <title>.mkv <title>.ogg <title>.idx <title>.mp4
 
</pre>
 
</pre>

Revision as of 08:48, 21 March 2012

This describes how to convert a DVD to mkv using:

  • x264 for video
  • ac3 for audio
  • any subtitles

Installation

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

Prepare

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 stream to the harddrive so the next steps will go faster.

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

Video

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 crop=<cropvalues> -oac copy -ovc x264 -x264encopts pass=1:bitrate=800 -nosub -of rawvideo -o <title>.264

Run the second pass on the video

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

Put the video in a MP4 container

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

Audio

Now extract audio from the stream. Just use AC3.

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

Convert the ac3 file to 6 channel wave

mplayer <title>.ac3 -af channels=6:6:0:0:1:4:2:5:3:2:4:1:5:3 -channels 6 -ao pcm:nowaveheader:file=<title>.wav6

Convert the 6 channel wave to a 6 channel ogg

oggenc -r -B 16 -C 6 -R 48000 --resample 44100 -b 200 <title>.wav6

Subtitles

Extract the subtitles from the stream.

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

Merging

Combine everything in a mkv container

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