View Single Post
Old 03-27-2008, 08:34 AM   #1 (permalink)
New Member
Join Date: Mar 2008
Model: 8310
Carrier: Vodafone
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting videos for your BlackBerry on Linux

Please Login to Remove!

It took me a while to get this right so I thought I would share it. This is a bash script using ffmpeg to encode video so it will play on your BlackBerry (I am using an 8310 although small modifications like resolution should make it play on others).

mkdir BBV
ls -1 |
while read FILENAME; do
    ffmpeg -i "${FILENAME}" -vcodec xvid -s 320x240 -qscale 10 -ab 48k -ar 22050 -ac 1 -acodec mp3 "./BBV/${FILENAME}" &
For those who aren't very good with command line stuff run this script from the folder with your avi files in it. It will create a sub-directory "BBV" which will contain the BlackBerry version of the videos. It will run all the encoding at the same time in parallel. If you want it to encode just one file at a time (a good idea if you are trying to encode a lot of videos) remove the "&" from the end of the ffmpeg line.

You can also achieve better video quality or smaller file sizes by adjusting the number after qscale. 1 for best and I think it is 30/31 for worst quality (smallest file sizes but really bad quality). I played with the -qscale setting a bit and found that 10 was a pretty good balance between quality and size. For 45 minutes of video the files ended up being about 60-75mb. The reason for the size change is that the qscale setting adjusts the bitrate throughout the video to achieve the same quality as opposed to using a constant bitrate throughout the video.

To save space (and also mean two people can share a pair of headphones at the same time without missing anything) it converts the audio to 1 channel (-ac 1). If the audio is too tinny for you you can play with the -ab and -ar parameters. Although I found some values would cause the audio to get out of sync with the video.

Last edited by patros : 03-27-2008 at 08:42 AM.
Offline   Reply With Quote