BlackBerryForums.com : Your Number One BlackBerry Community
     

»Sponsored Links

BlackBerryApps.com Best Sellers



Closed Thread
 
LinkBack Thread Tools
  (#1 (permalink)) Old
patros Offline
New Member
 
Posts: 2
Join Date: Mar 2008
Model: 8310
PIN: N/A
Carrier: Vodafone
Default Converting videos for your BlackBerry on Linux - 03-27-2008, 08:34 AM

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 08:42 AM.
   
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
funkym Offline
CrackBerry Addict
 
Posts: 503
Join Date: Oct 2005
Model: 8320
Carrier: HK CSL
Default 03-30-2008, 07:30 PM

Thanks a lot. Nice script!
   
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-2010 BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.