Difference between revisions of "Extract DVD"

From Maze's wiki
Jump to: navigation, search
(Video)
Line 28: Line 28:
 
Now extract audio from the stream and convert to OGG. If the original audiostream if stereo take 128 (2 channel) or 256 (6 channel) for the bitrate.
 
Now extract audio from the stream and convert to OGG. If the original audiostream if stereo take 128 (2 channel) or 256 (6 channel) for the bitrate.
 
<pre>
 
<pre>
avconv -y -i <title>1.vob -map 0:<audiostream> -f ogg -c:a libvorbis -b:a <bitrate>k -ar 44100 -vn -sn <title>.audio
+
avconv -y -i <title>1.vob -map 0:<audiostream> -f ogg -c:a libvorbis -q:a 4 -ar 44100 -vn -sn <title>.audio
 
</pre>
 
</pre>
  
Line 34: Line 34:
 
Detect the amount to crop. Depending on the size also the bitrate will be calculated
 
Detect the amount to crop. Depending on the size also the bitrate will be calculated
 
<pre>
 
<pre>
crop=`avconv -y -ss 60 -i <title>1.vob -map 0:<videostream> -t 10 -vf cropdetect -an -sn -f rawvideo /dev/null 2>&1 | tail | head -n 1 | sed 's/^.*crop=//'`; echo ${crop}; width=`echo ${crop} | cut -d : -f 1`; height=`echo ${crop} | cut -d : -f 2`; echo $((${width}*${height}*4/1000))
+
avconv -y -ss 60 -i <title>1.vob -map 0:<videostream> -t 10 -vf cropdetect -an -sn -f rawvideo /dev/null 2>&1 | tail | head -n 1 | sed 's/^.*crop=//'
 
</pre>
 
</pre>
videobitrate=(width*height*4)/1000
 
 
Convert the video stream to ogv
 
Convert the video stream to ogv
 
<pre>
 
<pre>
avconv -y -pass 1 -i <title>1.vob -map 0:<videostream> -vf crop=<cropvalues> -g 250 -bf 16 -b:v <videobitrate>k -c:v libtheora -an -sn -f ogg <title>.video
+
avconv -y -i <title>1.vob -map 0:<videostream> -vf crop=<cropvalues> -g 250 -bf 16 -b:v <videobitrate>k -c:v libtheora -an -sn -f ogg <title>.video
 
avconv -y -pass 2 -i <title>1.vob -map 0:<videostream> -vf crop=<cropvalues> -g 250 -bf 16 -b:v <videobitrate>k -c:v libtheora -an -sn -f ogg <title>.video
 
avconv -y -pass 2 -i <title>1.vob -map 0:<videostream> -vf crop=<cropvalues> -g 250 -bf 16 -b:v <videobitrate>k -c:v libtheora -an -sn -f ogg <title>.video
 
</pre>
 
</pre>

Revision as of 16:49, 27 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 lsdvd ffmpeg vobcopy oggz-tools

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

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

vobcopy -l -n <stream> -t <title>

Audio

Now extract audio from the stream and convert to OGG. If the original audiostream if stereo take 128 (2 channel) or 256 (6 channel) for the bitrate.

avconv -y -i <title>1.vob -map 0:<audiostream> -f ogg -c:a libvorbis -q:a 4 -ar 44100 -vn -sn <title>.audio

Video

Detect the amount to crop. Depending on the size also the bitrate will be calculated

avconv -y -ss 60 -i <title>1.vob -map 0:<videostream> -t 10 -vf cropdetect -an -sn -f rawvideo /dev/null 2>&1 | tail | head -n 1 | sed 's/^.*crop=//'

Convert the video stream to ogv

avconv -y -i <title>1.vob -map 0:<videostream> -vf crop=<cropvalues> -g 250 -bf 16 -b:v <videobitrate>k -c:v libtheora -an -sn -f ogg <title>.video
avconv -y -pass 2 -i <title>1.vob -map 0:<videostream> -vf crop=<cropvalues> -g 250 -bf 16 -b:v <videobitrate>k -c:v libtheora -an -sn -f ogg <title>.video

Subtitles

Extract the subtitles from the stream.

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

Merging

Combine everything in a ogg container

oggz-merge -o <title>.ogv <title>.video <title>.audio