Posted this elsewhere, but it is applicable here.
I still need to add some error checking and perhaps user input for sub-directory naming; but for now, copy this script to a directory containing .avi's you wish to convert and simply run it. It will grab all avi's and convert to .mp4 files capable of being viewed on a blackberry (tested on 8130 pearl). A pearl folder will be created and all the mp4 files will be in this directory. Seems to take about 10 minutes for a 170 Mbit avi. Once done, the file size should be a little less than half of what it was.
Please post any suggestions to maintain quality yet decrease size, or anything else that may be sueful
ls *.avi | sort > $VAR
cat $VAR | while read line; do
mencoder "$INPUT" -oac lavc -ovc lavc -of lavf -lavcopts global=1:vglobal=1:vcodec=mpeg4:vbitrate=500:acodec=libfaac -af lavcresample=24000 -vf scale=240:180,harddup -ofps 30000/1001 -o "$OUTPUT"