BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-27-2008, 09:34 AM   #1 (permalink)
New Member
 
Join Date: Mar 2008
Model: 8310
PIN: N/A
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).

Code:
#!/bin/bash
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}" &
done
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 09:42 AM.
Offline  
Old 03-30-2008, 08:30 PM   #2 (permalink)
CrackBerry Addict
 
Join Date: Oct 2005
Model: 8320
Carrier: HK CSL
Posts: 505
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot. Nice script!
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.