dvdmaker

dvdmaker is a command line utility to generate DVD ISO images.

it's a simple shell script that invokes mencoder, dvdauthor and mkisofs or growisofs to convert *any* given video file to dvd-mpeg and write it as single-title without a menu on a DVD.

shell script

dvdmaker.sh

#!/bin/sh

TMP=/tmp
INTERFILE=$TMP/dvd-movie.mpg
OUTPUTISO=$TMP/dvd-project.iso
DVDTMPDIR=/tmp/dvd-project  ## case sensitive folder! (no VFAT here)


function bailout { echo "Error." ; exit ; }

function cleanup
{
 rm -f $INTERFILE
 rm -rf $DVDTMPDIR
}

if [ "$1" == "-c" ]; then
    echo " cleaning up."
    cleanup;
    rm -f $OUTPUTISO
    exit;
elif [ "$1" == "-r" ]; then
    cleanup;
    INPUTFILE=$2;
elif [ "$1" == "-h" -o "$1" == "--help" ]; then
    INPUTFILE=""
else
    INPUTFILE=$@
fi

if [ -z "$INPUTFILE" ]; then
    echo "usage: $0 [-c|-r] <movie-file>"
    echo "       -c: remove prev. result and temp files, then exit."
    echo "       -r: remove intermediate files before processing.."
    bailout;
fi

if [ -e $INTERFILE ]; then echo -e " intermediate video file exists - use '-r' to override\n - move '$INTERFILE' out of the way!"; exit; fi
if [ ! -d $TMP ]; then echo "TEMP dir does not exist!"; exit; fi
if [ -d $DVDTMPDIR ]; then echo " Project  dir already exists - move '$DVDTMPDIR' out of the way!"; exit; fi
if [ -e $OUTPUTISO ]; then echo " Output file already exists - move '$OUTPUTISO' out of the way!"; exit; fi


echo
echo "                          Encoding Video"
echo
mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -fps 25 -ofps 25 -vf harddup -lavcopts vcodec=mpeg2video:vrc_maxrate=7500:vrc_buf_size=1835:vbitrate=5000:keyint=15:acodec=ac3:abitrate=224:aspect=4/3 -o $INTERFILE $INPUTFILE || bailout
echo
echo "                          Creating DVD Structure"
echo
dvddirdel -o $DVDTMPDIR || bailout
dvdauthor -o $DVDTMPDIR -t $INTERFILE || bailout
dvdauthor -o $DVDTMPDIR -T || bailout
echo
echo "                          Writing .iso"
echo
mkisofs -dvd-video -v -o $OUTPUTISO $DVDTMPDIR || bailout
echo
echo "done."
echo
echo "#write to DVD with:"
echo "# growisofs -dvd-compat -Z /dev/dvd=$OUTPUTISO"
echo

example command lines

DVD mastering/transcoding examples

# combine audio/video
ffmpeg -i ~/ext/wicked/rushes/wicked_VT001.mov -i /tmp/vt001-stereo.wav -map 0:0 -map 1:0 -target pal-dvd -b 5000k -acodec ac3 -aspect 4:3  /tmp/newmovie1.mpg

# merge multiple video files and transcode to DVD-mpeg2 into file /tmp/dvd-movie.mpg cutting at 2:1 aspect and
adding a letterbox to PAL.
mencoder -vf crop=720:360:0:108,expand=0:-216:0:108 -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -fps 25 -ofps 25 -lavcopts vcodec=mpeg2video:vrc_maxrate=7500:vrc_buf_size=1835:vbitrate=5000:keyint=15:acodec=ac3:abitrate=224:aspect=4/3 -o  /tmp/dvd-movie.mpg /tmp/newmovie1.mpg /tmp/newmovie2.mpg

# master DVD (create VOBs using /tmp/dvd-movie.mpg)
dvdauthor -o /tmp/dvd-project/ -x /tmp/dvd-projext.xml

#create DVD image
mkisofs -dvd-video -p "RSS" -publisher "RSS" -V "TITLE" -v -o /tmp/master.iso tmp/dvd-project/

# write to DVD
growisofs -dvd-compat -Z /dev/dvd=/tmp/master.iso

the /tmp/dvd-project.xml file reads:

<dvdauthor>
    <vmgm />
    <titleset>
        <titles>
            <pgc>
                <vob file="/tmp/dvd-movie.mpg" />
            </pgc>
        </titles>
    </titleset>
</dvdauthor>
 
oss/dvdmaker/start.txt · Last modified: 12.04.2009 15:48 by rgareus