BlackBerry and their Video Playback Capabilities

Here’s a list of BlackBerry Smartphones, their model, name, screen resolution and their video playback capabilities.

H.264 notes

It’s often difficult to determine the specific H.264 profiles that a BlackBerry can support, such as what’s the max bit-rate the device can handle? Looking at the specification pages for each model can assist; such as Bold 9700 specs

It’s a pretty safe bet to encode for baseline profile for a video, otherwise you might see a blank screen when you try and play it back. Take a look here for more on ffmpeg encoding for BlackBerry.

BlackBerry Models and capabilities

Blackberry® Model Resolution
BlackBerry 8100 240×260 MPEG4 Pearl
BlackBerry 8110
BlackBerry 8120
BlackBerry 8130
BlackBerry 8220 240×320 MPEG4 Pearl Flip
BlackBerry 8230
BlackBerry 8300 320×240 MPEG4 Curve
BlackBerry 8310
BlackBerry 8320
BlackBerry 8330
BlackBerry 8350i
BlackBerry 8520 320×240 H.264 Curve
BlackBerry 8530
BlackBerry 8800 320×240 MPEG4
BlackBerry 8820
BlackBerry 8830 320×240 H.264
BlackBerry 9000 480×320 H.264 Bold
BlackBerry 9500 360×480 H.264 Storm
BlackBerry 9530
BlackBerry 9550 360×480 H.264 Storm 2. OS 5.0
BlackBerry 9520
BlackBerry 9630 ? H.264 Tour
BlackBerry 9700 480×360 H.264 Bold 2. OS 5.0

Blank values mean they carry down from the model prior.

Using ffmpeg for BlackBerry Bold playback

Sometimes ffmpeg just doesn’t play like you’d hope it would. I was trying to re-encode video clips for a BlackBerry Bold (the Bold supports H.264 playback) but every encode would have a blank black screen for video, and the audio would be fine (more on audio later).

I’m currently using SVN release r19352 (and also tested with r21566 (2010-01-31)).

ffmpeg arguments for BlackBerry H.264

ffmpeg -v 0 -y -i input.mp4 -f mp4 -aspect 2.409 -vcodec libx264 -vpre default -vpre baseline -s 480x200 -r 24 -b 220k -acodec libmp3lame -ab 24kbit/s -ac 1 output.mp4

So lets break down these arguments:

-v 0 = Set verbosity level
-y = Overwrite existing file
-i input.mp4 = The file you want to convert
-f = Force the video type
-aspect = The magical number to get the resize right
-vcodec libx264 = We're going to use x264 for video codec
-vpre default
-vpre baseline = Magical presets. And ensure BlackBerry compatibility
-s = The final dimensions of the clip
-r = Video frame rate
-b = Bitrate per second (the larger number the better the video)
-acodec libmp3lame = See Audio heading below
-ab = Audio bitrate
-ac 1 = Number of Audio Channels
output.mp4 = The output file

-vpre isn’t working for me (and I’m on Windows)

ffmpeg isn’t a Windows only application and looks for its presets in /usr/local/share/ffmpeg/ so if you create a folder structure on your Windows computer c:\usr\local\share\ffmpeg\ and copy all the *.ffpreset files into said folder you won’t have problems with -vpre anymore

Audio issues (AAC)

In later releases of ffmpeg AAC (or libfaac) was disabled; I assume due to AAC being patent encumbered. There’s ways around turn libfaac back on, or you could just switch to using libmp3lame or the like.

Installing Ruby on Rails on Ubuntu Karmic Koala

Here’s the steps I took to install Ruby on Rails on a fresh Ubuntu 9.10 Karmic Koala.

Update/upgrade system

sudo apt-get update

Install ruby, irb and rdoc

sudo apt-get install ruby irb rdoc

Install required Ubuntu packages

sudo apt-get install libopenssl-ruby build-essential ruby1.8-dev libpq-dev

Install rubygems

wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar -xvzf rubygems-1.3.5.tgz
cd rubygems-1.3.5/
sudo ruby setup.rb
sudo gem update --system

Install Rails (with gem)

sudo gem install rails

If you need to install postgresql

sudo apt-get install postgresql

Create the postgres user
sudo su postgres
createuser

Need to create a postgres database?
createdb

Install the ruby to postgres driver

sudo gem install postgres

Finished

That’s it, Ruby on Rails should be installed along with Postgresql if you need it.

Credit goes to Peter Vandenabeele for the basis for these steps.

Font Smoothing in Snow Leopard with a 3rd Party LCD

Having connected a 3rd party (Polyview) 19″ LCD into the work MacBook Pro I was struck by how poor any on screen text rendered. Trying to use Terminal.app was just aweful, all jaggy and hard to read.

It turns out that font smoothing (aka sub-pixel antialiasing) on the 3rd party screen wasn’t happening and OS X was defaulting the font smoothing to CRT. Take a look at the screenshots below, bad eh?

Antialiasing for CRTs, ewwwww.

Antialiasing fixed!

How to fix the problem?

Open up terminal and paste in the following:

defaults -currentHost write -globalDomain AppleFontSmoothing -int 2

or if you find the text a little large/blurry you can try:

defaults -currentHost write -globalDomain AppleFontSmoothing -int 1

Now logout > login.

So what’s up?

The whole Snow Leopard font smoothing issue seems strange and why Apple changed the font smooth dialog is beyond me. But you can read more about it here
jjgod / blog > Snow Leopard vs. 3rd Party LCD Displays if you’d like to know a little more about the problem.

Mercurial .hgignore for xcode/cocoa

Here’s my Mercurial .hgignore template for xcode/cocoa projects.

syntax: glob
 
.DS_Store
 
# Backup files left behind by the Emacs editor.
*~
 
# Lock files used by the Emacs editor.
.\#*
 
# Temporary files used by the vim editor.
.*.swp
 
# Temporary files used by TestMate
._*
 
# build directories
**/build/*
build/*
 
# XCode user data
**.pbxuser
**.mode?v?
**.perspectivev?
 
# documentation
**.docset/*
 
# for those crazies using svn and hg at the same time
*.svn*

Bandwidth: Rackspace Cloud Server vs Rackspace Files

I’ve recently been looking at hosting a complex JBoss/Apache project at Rackspace Cloud as opposed to our own servers+pipe at work.

I had changed the application to deliver the files from a CDN (in this case Rackspace Files) but thought “well Rackspace Cloud might be on the same pipe(s) as Files and could kill two birds with one stone”.

Essentially I wanted to know the pipe difference between Rackspace Cloud Servers and Rackspace Files and if Cloud was fast enough do away with Files.

The Test

Here’s some very rudimentary results where I download a 9.6 MB zip file.

Rackspace Cloud – Average download speed: 335 kb/s – Time: 27 seconds.
Rackspace Files – Average download speed: 1154 kb/s – Time: 8 seconds.

I used curl -O http://.../content.zip for the download test.

Conclusions

Rackspace Cloud doesn’t use the same “pipes” as Rackspace Files (I’ve never read that Rackspace claim, “Cloud is as fast as Files” I wasn’t expecting the same results, just curious).

A dedicated CDN is the best way to go for delivery of large files quickly. (Rackspace Files uses the Limelight Network). I’ve heard rumours that Rackspace has Australian edge(s) and this seems to be the case.

I will still want to use Rackspace Files for large content delivery.

Misc

I use TPG ADSL2+ at home and never seen downloads faster than 1250-1300 kb/s. Using a 2.16GHz Macbook Pro.

At the time of writing: Rackspace Cloud Server is a cloud server hosting infrastructure. Rackspace Files is a Content Delivery Network.

Kindle in Australia

Some thoughts on Kindle (International version) in Australia.

Screen

I absolutely love the sharpness of the text. It’s not pixelated or jaggy and to me mimics the look of printed text. Under sunlight the screen is easy to read (doesn’t wash out like LCD screens) and interestingly the more light the better the screen looks.

The screen refresh is weird, not wrong, just weird. It flicks and redraws itself. I guess there’s time to turn a physical page anyway with traditional books/magazines.

The contrast of background to text colour is fine until you’re in low light situations and you find yourself drawn to light sources, as above the more light the better the reading.

The time for a page turn (aka screen refresh) makes web surfing nigh on impossible (a moot point here in Australia as browsing outside of the US is limited to wikipedia only).

Killer features

The inbuilt dictionary (displays at bottom of page when you select a word).
The long battery life (48 hours and 2 notches down).
Conversion from doc/pdf to Kindle (send from your email address to the kindle (fee) or back to your email client (free)) is nearly a killer feature (I wish for native PDF).
Searching within a book.
Downloading a book within 60 seconds.

Weight, size and feel

The size and weight are killer features also.

There’s a “chin” to the bottom of the product, where the keyboard buttons are. I originally though this was undesirable but lying in bed resting the “chin” of the Kindle on my chest and it dawns on me. The “chin” exists by design and props itself up making reading easier than a paper novel.

The keyboard isn’t the greatest, but you use it minimally making it not a show stopper.

Audible, MP3, mobi files and text-to-speech

Getting Audible/MP3 onto the Kindle is a breeze, you use the USB cable (supplied) and it’s mounted as a volume then just copy the audio files into the existing folder structure.

3.5mm headphone jack on top. Volume on side. Easy.

Text to speech is so-so as a plus it can be turned up loud, the inbuilt speakers (2) are very strong.

Weakest links

Some of the UI elements are strange to say the least, example: To play text-to-speech press Shift and SYM. There’s no “speech” button or menu item. huh? This goes for trying to find the Web Browser, and in all honesty the Kindle Store should be linked from the Home screen (not from a menu).

By far the weakest link with the Kindle in Australia is gulp the Kindle Store itself.

I was unable to find anything from these authors: Clive Cussler, Bryce Courtney, Dan Brown, Raymond E Fiest.

Furthering the damage, there’s limited selection of books (2) from Neal Stephenson (I wanted to get Cryptonomicon) and Faye Kellerman sees only 3 books.

There’s simply not enough books (though you’re fine if you want to read the Twilight series /sigh) and I feel that Amazon really needs to work hard on the publishers and get more books into the Amazon Kindle Store.

No backlight. Not a curse, but it would have taken it to 11.

Summary

Now I have one (only 48 hours old), would I recommend one? Easily yes, and after thinking heavily price would be the only deciding factor.

Fixing Visual Studio’s error ‘The project location is not trusted’

Scenario: My base machine (mac) hosts all my source code as I want a single code point to backup. My Windows development environment is in a Virtual Machine using VMWare Fusion. (I believe this issue will apply to VMWare Workstation, Player and Fusion).

I am using the VMWare built in “Share Folder” option, and I’m sharing only the “win” folder in my ~\src\ folder.

Screen shot 2009-09-29 at 10.19.55 PM

Issue: When trying to open source using Visual Studio 2008 I’m presented with the dreaded “The project location is not trusted” error.

Solution: Open a Command-Line box (Start > Run > cmd > OK)

cd \Windows\Microsoft.NET\Framework\v2.0.50727
caspol -m -ag 1.2 -url \\.host\* FullTrust

If you’re not using VMWare or have a share elsewhere substitute “\\.host\*” for your shared folder.

References: The project location is not trusted dialog box and The project location is not trusted dialog box when trying to use a Network Location

Sql Compact and Fluent NHibernate

I wanted a drop dead simple Fluent NHibernate connection to a Sql Compact (.sdf) file and was able to use:

?View Code CSHARP
private const string DbFile = "firstProgram.db";
 
return Fluently.Configure()
    .Database(MsSqlCeConfiguration.Standard.ShowSql().ConnectionString(c =>
        c.Is("data source=" + dbFile))
        )
    .Mappings(m =>
        m.FluentMappings.AddFromAssemblyOf<Program>()
        )
    .ExposeConfiguration(BuildSchema)
    .BuildSessionFactory();

Whereas the Sqlite connection was:

?View Code CSHARP
private const string DbFile = "firstProgram.db";
 
 return Fluently.Configure()
    .Database(SQLiteConfiguration.Standard
        .UsingFile(dbFile)
        )
    .Mappings(m =>
        m.FluentMappings.AddFromAssemblyOf<Program>()
        )
    .ExposeConfiguration(BuildSchema)
    .BuildSessionFactory();

When Googling I wasn’t able to find any samples so I hope to fill that void.

Mercurial .hgignore for C# and VB .net Projects

There’s certain files and folders that you don’t want to put into source control. With Mercurial all you need is a .hgignore file in the root path of your project. A simple windowsy way of doing this is (from a command line) is by typing

notepad c:\path_to_code\.hgignore

This will create the file so now simply add the following lines to the file:

# use glob syntax.
syntax: glob
 
# Misc Mac/Windows stuff
 
.DS_Store
Thumbs.db
Desktop.ini
 
# builds
 
*.exe
*.ex_
 
# vb6
 
*.SCC
*.vbw
*.pdb
*.log
*.Log
 
# c-sharp
#ProjectName/bin
#ProjectName/obj
*.user
*.suo
_ReSharper.*
*.sln.cache

Note: You need to change #ProjectName to your project foldername.

Now feel free to init/add/commit:

hg init
hg add
hg commit -m "Initial Commit with ignores"