====== Blackberry Video Encoding Script ====== Brendan Kidwell\\ [[brendan@glump.net]] 29 February 2008 Here is a simple shell script you can use to encode videos for viewing on a BlackBerry. It will run on a Unix, OS X, or Windows with Cygwin installed. You must have [[http://www.mplayerhq.hu/|mplayer/mencoder]] installed. The script will probably work well for any other media player claiming MPEG4 compatibility. Adjust the output resolution, aspect ratio, and bitrates as necessary. #!/bin/bash # Specify the size of the viewport in the video player. # For BlackBerry Pearl, use 240 x 180. SCREEN_WIDTH=240 SCREEN_HEIGHT=180 # Specify the video and audio bitrates (kilobits per second). VIDEO_BITRATE=230 AUDIO_BITRATE=64 mencoder -vf expand=:::::4/3,scale=$SCREEN_WIDTH:$SCREEN_HEIGHT "$1" -o "$2" \ -of avi -ovc lavc -oac lavc \ -lavcopts vcodec=mpeg4:vbitrate=$VIDEO_BITRATE:acodec=mp3:abitrate=$AUDIO_BITRATE (Download: {{howto:bbencode.sh|}}) The filters first "expand" the input video to fill a 4:3 frame, [[http://en.wikipedia.org/wiki/Letterbox|letterboxing or pillarboxing]] as necessary. Then it scales the result down to ''SCREEN_WIDTH'' x ''SCREEN_HEIGHT''. The output is encoded using the MPEG4 video codec and MP3 audio codec, enclosed in an AVI container. I've tested the output with these options on my BlackBerry Pearl 8100 and it gets the job done.