DVD rip

From The World according to Vissie
Revision as of 02:47, 10 August 2020 by SnakeSkin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
NAME='Die Kavaliers'
#mplayer dvd://2 -chapter 1 -vf cropdetect

# First pass: we are just collecting information, so the normal output is thrown away.
mencoder dvd://"$TITLE" -o /dev/null -nosound -ovc x264 \
    -x264encopts direct=auto:pass=1:turbo:bitrate=900:bframes=1:\
    me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300 \
    -vf scale=-1:-10,harddup
#    -vf crop=704:432:8:74

# Second pass: here we compress the video track using the information from the first step.
mencoder dvd://"$TITLE" -nosound -ovc x264 \                                                                                                                      
    -x264encopts direct=auto:pass=2:bitrate=900:frameref=5:bframes=1:\
    me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300 \
    -vf scale=-1:-10,harddup -o video.avi

# Here we rip and compress the audio.
#mencoder dvd://"$TITLE" -alang "$AUDIOLANG" -ovc frameno \
#    -oac mp3lame -lameopts br=96:cbr:vol=6 ac lavc -lavcopts acodec=vorbis:abitrate=224 -channels 2 -srate 48000 -o "$AUDIOLANG".avi

mencoder dvd://"$TITLE" -ovc frameno -aid 128 -oac copy -channels 2 -o audio.avi

mkvmerge -D audio.avi -A video.avi -o "$NAME".mkv

Unedited notes:

sudo apt install mplayer mencoder lsdvd libdvd-pkg libmp3lame-dev mkvtoolnix

sudo dpkg-reconfigure libdvd-pkg

How to:

This recipe uses the lsdvd and vobcopy programs, which are found in the Debian packages of the same names (verified on Debian 10 Buster).

First you need to list the content (chapters) of the video DVD:


Gathering Source Audio Information

Use lsdvd to give you more detail on the available audio streams for the title you’re working on.

lsdvd -a -t 1 /dev/dvd Disc Title: DVD_TITLE Title: 01, Length: 01:26:08.200 Chapters: 13, Cells: 13, Audio streams: 02, Subpictures: 01 Audio: 1, Language: nl - Nederlands, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 2, AP: 0, Content: Undefined, Stream id: 0x80 Audio: 2, Language: en - English, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 2, AP: 0, Content: Undefined, Stream id: 0x81

The output above shows that there are two audio streams, both AC3 Dolby Digital, however only the second one is in English. Mencoder and mplayer allow you to specify your desired audio stream by language as shown in the following example.

mencoder dvd://1 -alang eng (other options)

If your source has multiple English streams, you can specify which particular audio ID (aid) you want. Mplayer can be used to display all available audio identifiers of a DVD. The following command is a little long but it should serve you well.

mplayer dvd://1 -identify -frames 0 -vo null 2>&1 | grep aid audio stream: 0 format: ac3 (stereo) language: nl aid: 128. audio stream: 1 format: ac3 (stereo) language: en aid: 129.

From the output above, the English AC3 audio stream we want is identified by aid 129. It can be specified when using mplayer and mencoder as shown below.

mencoder dvd://1 -aid 129 (other options)