How to encode DVD to AVI using Mencoder

If you have a DVD image in ISO format or in directory structure (see below) and you would like to encode this image to AVI format for later watching in smaller size, Mencoder may help you automate this task by a single command as well as consuming the computer power of a cluster through batch scheduler. The DVD structure looks like below.

DVD/
|--- AUDIO_TS
`--- VIDEO_TS
     |--- VIDEO_TS.BUP
     |--- VIDEO_TS.IFO
     |--- VIDEO_TS.VOB
     |--- VTS_01_0.BUP
     |--- VTS_01_0.IFO
     |--- VTS_01_0.VOB
     |--- VTS_02_0.BUP
     |--- VTS_02_0.IFO
     |--- VTS_02_0.VOB
     |--- VTS_03_0.BUP
     |--- VTS_03_0.IFO
     |--- VTS_03_0.VOB
     |--- VTS_04_0.BUP
     |--- VTS_04_0.IFO
     `--- VTS_04_0.VOB

According to above structure, it indicates that this DVD has 4 titles. You may use mencoder to encode each VOB to AVI individually and then merge them together. Anyway, that is not the best way. mencoder and mplayer do support this directory structure as well as ISO directly.

mencoder dvd://$title -dvd-device "$input" \
         -oac mp3lame \
         -lameopts mode=2:cbr:br=96:vol=0 \
         -ovc lavc \
         -lavcopts vcodec=mpeg4:vbitrate=400:vhq:autoaspect \
         -o output.avi

Above is the command line I used for encoding specified title into an AVI with MPEG4 at 400 kbps. The missing part is $input which should be the path to the DVD structure as mentioned earlier and $title is the title number. For submission to batch scheduler in a cluster, you might need to write a kind of job script as follows.

#!/bin/sh
#$ -S /bin/sh
 
title=$1
input=$2
prefix=$3
 
mencoder dvd://$title -dvd-device "$input" \
         -oac mp3lame \
         -lameopts mode=2:cbr:br=96:vol=0 \
         -ovc lavc \
         -lavcopts vcodec=mpeg4:vbitrate=400:vhq:autoaspect \
         -o "$prefix-$title.avi"

And then submit a title like this.

qsub -cwd dvd2avi.sh 1 dvd/ mydvd

After a while you will get mydvd-1.avi in current working directory. Note that above job script is written for Sun Grid Engine. For other scheduler, you might need some tweak.

Tags: , , ,

very good. i'll try, thanks.

very good. i'll try, thanks.

Post new comment