#!/bin/bash # (c) 2003 Vajna Miklos # divx2svcd for MPlayer # distributed under GPL License # simple utility that creates a SVCD from a video in an AVI container # The newest version of this utility can be found at # http://vmiklos.uw.hu/divx2svcd/divx2svcd # MPlayer available at # http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0pre3try2.tar.bz2 ###changelog### #nobody cares about it :-) cat >/dev/null < - support for toolame instead of mp2enc - suppert for libavcodec mpeg2video codec instead of mpeg2enc 0.2 - support for tcmplex instead of mplex 0.1rc2-rc4 - small bugfixes 0.1rc1 - initial release EOF ###preparing### #help usage() { cat </dev/null 2>&1 bcbin=`which bc 2>/dev/null` if [ $? != 0 ]; then cat </dev/null 2>&1 bcbin=`which vcdimager 2>/dev/null` if [ $? != 0 ]; then cat </dev/null 2>&1 if [ $? = 0 ]; then tcp_path=`which tcmplex-panteltje 2>&1` else tcp_path="x" fi which tcmplex >/dev/null 2>&1 if [ $? = 0 ]; then tc_path=`which tcmplex 2>&1` else tc_path="x" fi if [ -x $tcp_path ]; then tcbin=tcmplex-panteltje tcopt=-0 elif [ -x $tc_path ]; then tcbin=tcmplex tcopt=-p else cat </dev/null 2>&1 cdrbin=`which cdrecord 2>/dev/null` if [ $? != 0 ]; then cat <= 2.01a14 echo -n "Checking for cdrecord version >= 2.01a14... " $cdrbin cuefile=a 2>&1 |grep 'Bad Option' >/dev/null 2>&1 if [ "$?" = 0 ]; then cat <= 2.01a14. You can download it at ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-2.01a20.tar.gz EOF else echo "`$cdrbin -version |cut -d ' ' -f 2`" fi fi fi #checking for sub avariable if [ -f "$nev.sub" ]; then subopts=$nev.sub else subopts='' fi if [ "x$subopts" = "x" ]; then subs='' else subs='-sub ' fi #checking for what height needed inputwidth=`mplayer -vo null -ao null "$input" -frames 1 2>/dev/null |grep '=>'|cut -d ' ' -f 5|cut -d x -f 1` inputheight=`mplayer -vo null -ao null "$input" -frames 1 2>/dev/null |grep '=>'|cut -d ' ' -f 5|cut -d x -f 2` svcdaspect=`echo -e "scale=10\n1.596/($inputwidth/$inputheight)"|bc /dev/stdin` height=`echo -e "scale=10\n$svcdaspect*480"|bc /dev/stdin|cut -d . -f 1` #checking for ratios less than 1.33 istoohigh=`expr $height \> 577` if [ "$istoohigh" = 1 ]; then height=576 fi #find out the vf options if [ "$height" = 576 ]; then vfopts='-vf scale=480:576' else #-vf processes filters in reverse order exy=`echo -e "scale=10\n(576-$height)/2"|bc /dev/stdin|cut -d . -f 1` vfopts="-vf scale=480:$height,expand=480:576:0:$exy:1" echo "Using filter options: '$vfopts'" fi #finish displaying informations if [ "$burning" = 1 ]; then #asking for cd cat < template $tcbin -i "$nev.m2v" $tcopt "$nev.mp2" -o "$nev.mpg" -m s -F template rm template rm "$nev.m2v" "$nev.mp2" fi for i in *mpg do nev2=`basename "$i" .mpg` #creating images vcdimager -t svcd -c "$nev2.cue" -b "$nev2.bin" "$i" #burning if needs if [ "$burning" = 1 ]; then if [ "$firstcd" != 1 ]; then cat <