Difference between revisions of "Extract DVD"

From Maze's wiki
Jump to: navigation, search
(Extract)
(Video)
Line 70: Line 70:
 
avconv -y -i <title>_video.vob -t 600 -vf cropdetect -an -sn -f rawvideo /dev/null 2>&1 | tail | head -n 1 | sed 's/^.*crop=//'
 
avconv -y -i <title>_video.vob -t 600 -vf cropdetect -an -sn -f rawvideo /dev/null 2>&1 | tail | head -n 1 | sed 's/^.*crop=//'
 
</pre>
 
</pre>
Convert the video stream to ogv
+
Calculate the target bitrate
 
<pre>
 
<pre>
avconv -y -i <title>_video.vob -r 25 -g 250 -bf 16 -filter:v yadif,crop=<cropvalues>,scale=in_w:in_h/sar -q:v 9 -c:v libtheora -an -sn -f ogg <title>.video
+
bitrate=`avprobe -show_format <title>_video.vob 2>/dev/null | grep bit_rate | cut -d= -f 2 | cut -d. -f 1 `; sar=`avprobe -show_streams <title>_video.vob 2>/dev/null | grep sample_aspect_ratio | cut -d= -f 2 | sed 's/:/\//'`; framerate=`avprobe -show_streams <title>_video.vob 2>/dev/null | grep r_frame_rate | cut -d= -f 2 | sed 's/:/\//'`;echo "scale=10;${bitrate}/(${sar})*(25/${framerate})/3/1000" | bc | cut -d. -f 1
 +
</pre>
 +
Convert the video stream to ogv in 2 passes
 +
<pre>
 +
avconv -y -pass 1 -i <title>_video.vob -r 25 -g 100 -bf 16 -filter:v yadif,crop=<cropvalues>,scale=in_w:in_h/sar -b:<bitrate>k -c:v libtheora -an -sn -f ogg <title>.video
 +
avconv -y -pass 2 -i <title>_video.vob -r 25 -g 100 -bf 16 -filter:v yadif,crop=<cropvalues>,scale=in_w:in_h/sar -b:<bitrate>k -c:v libtheora -an -sn -f ogg <title>.video
 
</pre>
 
</pre>
  

Revision as of 12:30, 19 September 2012

Decryption

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

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

Space not an Issue?

If hdd space is not an issue then grab the whole DVD

Installation

Install the following software

apt-get install gddrescue vobcopy genisoimage

Extract

Read the DVD to a rescue image ignoring bad blocks abd mount the image

ddrescue /dev/<dvddevice> <title>_ddrescue.iso
mkdir <title>.mnt
mount <title>_ddrescue.iso <title>.mnt

Extract and unencrypt the video files.

vobcopy <title>.mnt -m -t <title>

Then create an iso image from it

genisoimage -dvd-video -o <title>.iso <title>

Make smaller files

This describes how to convert a DVD to OGG video using:

  • libtheora for video
  • libvorbis for audio
  • srt subtitles

Installation

Install the packages

apt-get install libav-tools lsdvd mplayer oggz-tools

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.

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

Investigate the VOB file and note the numbers for the videostream and the audiostream

avprobe <title>.vob

Some VOB files report the wrong duration so just in case rebuild the vob file but only with the required videostream and audiostream.

avconv -y -i <title>.vob -map 0:<videostream> -c:v copy -an -sn -f vob <title>_video.vob
avconv -y -i <title>.vob -map 0:<audiostream> -c:a copy -vn -sn -f ac3 <title>_audio.ac3

Audio

Now extract audio from the stream and convert to OGG.

avconv -y -i <title>_audio.ac3 -c:a libvorbis -q:a 5 -ar 44100 -vn -sn -f ogg <title>.audio

Video

Detect the amount to crop.

avconv -y -i <title>_video.vob -t 600 -vf cropdetect -an -sn -f rawvideo /dev/null 2>&1 | tail | head -n 1 | sed 's/^.*crop=//'

Calculate the target bitrate

bitrate=`avprobe -show_format <title>_video.vob 2>/dev/null | grep bit_rate | cut -d= -f 2 | cut -d. -f 1 `; sar=`avprobe -show_streams <title>_video.vob 2>/dev/null | grep sample_aspect_ratio | cut -d= -f 2 | sed 's/:/\//'`; framerate=`avprobe -show_streams <title>_video.vob 2>/dev/null | grep r_frame_rate | cut -d= -f 2 | sed 's/:/\//'`;echo "scale=10;${bitrate}/(${sar})*(25/${framerate})/3/1000" | bc | cut -d. -f 1

Convert the video stream to ogv in 2 passes

avconv -y -pass 1 -i <title>_video.vob -r 25 -g 100 -bf 16 -filter:v yadif,crop=<cropvalues>,scale=in_w:in_h/sar -b:<bitrate>k -c:v libtheora -an -sn -f ogg <title>.video
avconv -y -pass 2 -i <title>_video.vob -r 25 -g 100 -bf 16 -filter:v yadif,crop=<cropvalues>,scale=in_w:in_h/sar -b:<bitrate>k -c:v libtheora -an -sn -f ogg <title>.video

Subtitles

Extract the subtitles from the stream.

To do!!!

Merging

Combine everything in a ogg container

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