#!/bin/sh

if [ ! "$1" ]
then
 echo USAGE: divconvert.sh file.avi [newfile.avi]
 exit 1
fi

if [ "$2" ]
then
 NEWNAME=$2
else
 NEWNAME=$(echo $1 | sed "s/\(.*\)\(\..*\)$/\1-KISS\2/")
fi

if [ "$1" = "$NEWNAME" ]
then
 NEWNAME="$NEWNAME-KISS"
fi

echo Converting $1 "->" $NEWNAME

nice -15 mencoder "$1" -of avi -oac mp3lame -lameopts cbr:br=128  -ovc lavc -lavcopts vcodec=mpeg4:vhq -ffourcc DX50 -o "$NEWNAME"

