#!/bin/sh # # bitrate is 2500 by default for SVCD (lower is worse) # quality factor is 8 by default for SVCD (higher is worse) # The peak bit-rate and average bit-rate should differ by 20-25% # def_docrop=true def_interlace=1 def_ratio=1 help(){ cat < Options: -c Crop the bottom by 3.333333% ($def_docrop) -i n n=0 progressive, n=1 top, n=2 bottom ($def_interlace) -r n aspect ratio, n=1 4:3, n=2 16:9 ($def_ratio) -h Print this help message END exit 0 } docrop=$def_docrop interlace=$def_interlace ratio=$def_ratio while getopts ci:r:h name "$@" do case $name in c) docrop=true ;; i) interlace=$OPTARG ;; r) ratio=$OPTARG ;; *) help ;; esac done let shiftind=$OPTIND-1 shift $shiftind if test "$#" = "1" then case $1 in *.qt) input="$1" base=`echo $input | sed "s/\.qt$//"` ;; *.avi) input="$1" base=`echo $input | sed "s/\.avi$//"` ;; *.mov) input="$1" base=`echo $input | sed "s/\.mov$//"` ;; *) help ;; esac case $docrop in true) height=464 ;; *) height=480 ;; esac case $interlace in 0) fields=NOT_INTERLACED ;; 1) fields=INTERLACED_TOP_FIRST ;; *) fields=INTERLACED_BOTTOM_FIRST ;; esac case $ratio in 2) aflag="-a3" ;; *) aflag="-a2" ;; esac echo Encoding $input to $base.mpg.... sleep 1 ( lav2wav "$input" >"$base".wav; mp2enc <"$base".wav -r44100 -b192 -o "$base".m2a ) & ( lav2yuv "$input" | \ yuvcorrect -T $fields | \ yuvscaler -O SVCD | \ yuvdenoise -S 0 -b 0,0,480,$height | \ mpeg2enc -M3 -nn $aflag -f5 -G18 -b2400 -V230 -q10 -o "$base".m2v ) & wait mplex -f4 "$base".m2v "$base".m2a -o "$base".mpg else help fi