#!/bin/sh
# credit to Joe_Linux on iAudiophile.net for the original script that I edited.
# cd to folder that contains all (and only) the files needing conversion.
echo "Bash batch video convertor script using Mencoder by Goop and Joe_Linux."
echo "Where are the files that need converting? (for example /home/foo/bar)"
read -e IDIRECTORY
cd $IDIRECTORY
echo "Where is the output folder? (for example /home/foo/bar/output)"
echo "*** Don't include a / at the end of it (so instead of /home/ do /home ) ***"
read -e ODIRECTORY
# for i in $(ls); do
for i in *; do
echo $i
echo "What filename-extension do the files you want to convert have?"
read -e FILES
o=$ODIRECTORY/${i%.$FILES}-S9.avi
echo "protip: don't bother with bitrates above the original file's bitrate."
echo "What audio bitrate?"
read -e ABITRATE
echo "What video bitrate?"
read -e VBITRATE
echo "How many frames per second?"
read -e FPS
mencoder "$i" -oac mp3lame -lameopts cbr:mode=2:br=$ABITRATE -af resample=44100 -srate 44100 -ofps $FPS -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:cbp:trell:vbitrate=$VBITRATE -vf scale=480:272 -ffourcc XVID -o "$o"
echo "Done."
exit