### This page is not a runnable script anymore...just a collection of things I'm working on, in my quest for
### the "Holy Grail". That is, pop a dvd in my dvd player, pop a blank in my dvd burner, run a script and
### burn a copy of the dvd, suitable for play on my machine (with ogle, mplayer, etc...) or on a standalone dvd player.
### Also! I'm not a programmer at all, so if you make improvements please, please email them to me at
### "jeff (at) jeffscomputer.kicks-ass.net"
### Thanks!!!
### This first script makes an avi out of the big mpeg you'll get from a dvd with:
### "mplayer dvd://1 -dumpstream -dumpfile "
#!/bin/bash
if [ -z "$1" ]; then
echo -e "\nThis script is designed to be used in one of two ways:\n";
echo -e "1. The best way is to do:\n\n mplayer dvd://1 -dumpstream -dumpfile moviename\n\n\
and then point this script at moviename. Read the script for more details.\n"
end
#echo -e "2. If you're having trouble you can try this: 'mplayer -dumpstream file1.vob' for every vob you want to include in \n\
#your final movie. Then concatenate them all together like:\n\n 'cat file1.vob file2.vob ... > big_mpeg.mpg' \n\
#Then run this script, pointing it at the big mpeg. Assuming you had a full-length movie, \n\
#it will produce about a 1.1 GB avi. \n\n"
#echo "Enter the title of the big mpeg below. (probably moviename if you followed #1)";
#read big_mpeg;
# These are for interlaced videos.
# mencoder $big_mpeg -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=1:vqmin=2:vqmax=31 lavcdeint -o $big_mpeg.avi ;
# mencoder $big_mpeg -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=2:vqmin=2:vqmax=31 lavcdeint -o $big_mpeg.avi ;
# These are for non-interlaced videos.
#mencoder $big_mpeg -ffourcc xvid -ni -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=1:vqmin=2:vqmax=31 $big_mpeg.avi ;
#mencoder $big_mpeg -ffourcc xvid -ni -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=2:vqmin=2:vqmax=31 $big_mpeg.avi ;
#mv test.avi $big_mpeg.avi
#rm divx2pass.log ;
else
#mencoder $1 -ni -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=1:vqmin=2:vqmax=31 $1.avi ;
#mencoder $1 -ni -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=2:vqmin=2:vqmax=31 $1.avi ;
# If you're having trouble with the default language, (ie the rip ends up being in French)
# try running mplayer -v on the big mpeg, then look for the languages. 128 is usually english.
#mencoder $1 -aid 128 -ni -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=1:vqmin=2:vqmax=31 $1.avi ;
#mencoder $1 -aid 128 -ni -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=2:vqmin=2:vqmax=31 $1.avi ;
# This is for the new mencoder from mplayer-1.0_pre7. The "-ffourcc xvid" bit is new to this version of mplayer.
mencoder $1 -ffourcc xvid -aid 128 -ni -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=1:vqmin=2:vqmax=31 $1.avi ;
mencoder $1 -ffourcc xvid -aid 128 -ni -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=2:vqmin=2:vqmax=31 ;
mv test.avi $1.avi ;
rm divx2pass.log ;
fi
exit
# to concatenate avi's:
# cat file1.avi file2.avi > big.avi
# mencoder -ovc copy -oac copy -o out.avi -forceidx big.avi
########################################################################################################################
### This script will take a big mpeg you've collected with "mplayer dvd://1 -dumpstream -dumpfile "
### and cut it down to whatever size you want. I use 2100 MB and put 2 on each dvd. The quality is excellent.
### Unless you have a multiprocessor box, you'll want to remove ":threads=2" from -lavcopts below.
#!/bin/bash
echo -e "Enter name of mpeg file."
read FILENAME
echo -e "Enter length (in minutes) of movie."
read MINUTES
echo -e "Enter desired final size in MB."
read FINALSIZE
FINALKBSIZE=$(($FINALSIZE*1000))
SECONDS=$(($MINUTES*60))
AUDIOSIZE=$(($SECONDS*24))
DIFFERENCE=$(($FINALKBSIZE - $AUDIOSIZE))
RATE=$((($DIFFERENCE*8) / $SECONDS))
echo -e "Title: $FILENAME"
echo -e "Length: $MINUTES"
echo -e "Number of seconds: $SECONDS"
echo "Rate is $RATE"
echo -e "An mpeg of final size $FINALSIZE MB is going to be created in 10 sec.\n I hope you know what the fuck you're doing..."
sleep 10
mencoder $FILENAME -of mpeg -aid 128 -vf scale=720:480,harddup -oac lavc -ovc lavc -lavcopts \
acodec=ac3:abitrate=192:vcodec=mpeg2video:keyint=25:vbitrate=$RATE:aspect=16/9:threads=2 \
-mpegopts format=dvd -srate 48000 -ofps 30000/1001 -o $FILENAME.mpg
exit
###########################################################################################################################
# Here's another version I'm using...I launch it like:
# mymencodeadvd.sh moviename timeInMinutes desiredSizeInMB
#!/bin/bash
#echo -e "Enter name of mpeg file."
#read FILENAME
#echo -e "Enter length (in minutes) of movie."
#read MINUTES
#echo -e "Enter desired final size in MB."
#read FINALSIZE
FILENAME=$1
MINUTES=$2
FINALSIZE=$3
FINALKBSIZE=$(($FINALSIZE*1000))
SECONDS=$(($MINUTES*60))
AUDIOSIZE=$(($SECONDS*24))
DIFFERENCE=$(($FINALKBSIZE - $AUDIOSIZE))
RATE=$((($DIFFERENCE*8) / $SECONDS))
echo -e "Title: $FILENAME"
echo -e "Length: $MINUTES"
echo -e "Number of seconds: $SECONDS"
echo "Rate is $RATE"
echo -e "An mpeg of final size $FINALSIZE MB is going to be created in 10 sec.\n I hope you know what the fuck you're doing..."
sleep 10
mencoder $FILENAME -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -aid 128 -vf scale=720:480,harddup \
-srate 48000 -lavcopts acodec=ac3:abitrate=192:vcodec=mpeg2video:keyint=25:trell:mbd=2:\
vbitrate=$RATE:aspect=16/9:threads=2 -ofps 30000/1001 -o $FILENAME.mpg
exit