DVD to DVD Backup Script

From MythTV Official Wiki
Revision as of 08:51, 5 December 2011 by Wagnerrp (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This script is from a posting on the MythTV-users mailing list.

You can burn VOB files already ripped in MythDVD by commenting out the portions of the script that grab the main feature and that grab the chapter info and change the name of the VOB file in the script. Or just leave the script as is to backup from a DVD. This How-To assumes you already have MythDVD working correctly.

To have this script run uninterrupted from beginning to end, you must replace the original dvd with a blank dvd at some point during the process.

If you want to put multiple video titles on one DVD, you will want to create a DVD with a menu. To do so you will have to activate the "Make the DVD image (w/menu)" section of the script and deactive the w/o section. To create your menu, check out the DVDs With Menus How-To.


Script.png dvd-backup.sh


## Grab the .vob of the main feature
echo "Grabbing VOB from DVD."
tccat -i /dev/dvd -T 1,-1 -L >dvd.vob

## Make fifo's for extracting audio and video simultaneously
mkfifo vid.fifo
mkfifo aud.fifo

## perform the extraction
echo "Extracting audio and video from file1"
tcextract -i aud.fifo -t vob -x ac3 -a 0 > ofile1.ac3 &
tcextract -i vid.fifo -t vob -x mpeg2 > ofile1.m2v &
cat dvd.vob | tee aud.fifo vid.fifo >/dev/null

rm *.fifo

## Retrieve the chapter list.
echo "Retrieving chapter list from DVD"
tcprobe -i /dev/dvd -T 1 -H 10 2>&1 | egrep "\[Chapter ..\] " | \
cut -d " " -f 4 | perl -pi -e 's/\n/,/' | \
perl -pi -e 's/,$//' >chap.list &&

## Calculate the requantization factor
vsize1=`ls -l ofile1.m2v | awk '{print $5}'`
vsize1=`echo $vsize1 / 1048576 | bc`
asize1=`ls -l ofile1.ac3 | awk '{print $5}'`
asize1=`echo $asize1 / 1048576 | bc`
req=`echo "1.05 * $vsize1 / (4400 - $asize1)" | bc -ql`
echo Requantizing at: $req

## Perform requantization (comment out if $req < 1.0)
echo "Requantizing MPEG video for file1"
tcrequant -i ofile1.m2v -o movie1.m2v -f $req

## Put the audio and video back together
echo "mplexing file1"
mplex -f 8 -S 0 -o movie1.mpeg movie1.m2v ofile1.ac3

## Make the dvd image (w/o menu)
echo "Making DVD file system, step 1"
dvdauthor -t -a ac3+en -c `cat chap.list` -o dvd movie1.mpeg
echo "Making DVD file system, step 2"
dvdauthor -T -o dvd

## Make the dvd image (w/ menu)
#echo "Making DVD file system"
#dvdauthor -x dvd.xml

## Make DVD
echo "Writing DVD"
growisofs -Z /dev/scd0 -dvd-video dvd

echo "Done."