Streaming Videos to BlackBerry OS3
Posted In Video By John Hass
Welcome to my first blog post, the most information you will never read!
Streaming to the blackberry is definitely more complicated then it needs to be. Yesterday I was tasked with getting video to stream to blackberry devices. The site currently works fine on Android and iPhone devices, but our group agreed that blackberry was a definite need.
Since I am not a stranger to FFmpeg I thought ok this will take 2 minutes and then I can have a drink! Well I was mistaken. You see, you can’t simply view the converted video files on a blackberry, you have to actually setup a RTSP server and stream them. Even then you can’t simply stream a mp4 using the streaming server. You have to add a hint to the meta data.
Are you confused yet? If so, or even if your not, let’s do this thing!
Keep in mind I use Centos as my server OS (whatever 5 is latest I think 5.4 I just do yum upgrade so I don’t keep track).
The Streaming Server
After much research I decided that the Darwin Streaming Server would be best suited for this purpose.
When following the steps it is best to be root.
Step 0. When building apps on Linux it’s best to be in /usr/src so go there “cd /usr/src”
Step 1. I had to install all the development applications for centos this is done easily with the “group install” option this will include rpm utilities, gcc, automake etc. I ran the command: yum groupinstall “Development Tools” just like that quotes and all
Step 2. Get the Darwin Streaming Server srpm. “wget –continue http://www.abrahamsson.com/DarwinStreamingServer-6.0.3-2.src.rpm” I had some issues downloading from this site and I had to start the download over a couple of times, so I used –continue to keep the download going.
Step 3. Install the srpm “rpm -i DarwinStreamingServer-6.0.3-2.src.rpm” “cd /usr/src/redhat/SPECS/”
Step 4. Build the source code “rpmbuild -bb DarwinStreamingServer.spec”
Step 5. Install perl SSLeay for ssl support (we will not be using this but it does not hurt “cd /usr/src/redhat/RPMS/i386/” “yum install -y perl-Net-SSLeay”
Step 6. Install Darwin Streaming Server. “rpm -U DarwinStreamingServer*”
Step 7. Freak out because it appears your console has locked up… You need to freak out because it did. Open an new SSH session (or console session). Kill the Darwin Streaming Server session. “killall -9 DarwinStreamingServer”
Step 8. Set the password for Darwin Streaming Server. “qtpasswd administrator”
Step 9. Set the server to start automatically “chkconfig –level 345 dss on”
Step 10. Restart the server “/etc/init.d/dss restart” (some may fail don’t fret it’s just because they weren’t running”
Step 11. (Optional) allow access to the web for iptables if your running ip tables. vi /etc/sysconfig/iptables
Add the line replacing x.x.x.x with your ip address:
“-A RH-Firewall-1-INPUT -p tcp -s x.x.x.x –destination-port 1220 -j ACCEPT”
“-A RH-Firewall-1-INPUT -p tcp –dport 554 -j ACCEPT”
“-A RH-Firewall-1-INPUT -p udp –dport 6970:9999 -j ACCEPT”
Save the file and restart iptables “/etc/init.d/iptables restart”
Step 12. You can now open up your web browser (of course I recommend firefox) go to http://x.x.x.x:1220 where x.x.x.x is the ip address of your darwin streaming server.
Step 13. Login with the username “administrator” and the password is the password you setup with the qtpasswd command from above.
Step 14. You are now presented with a wizard that asks you some install and setup questions, see the following steps for the answers to the questions
Step 15. Mp3 Broadcast password Leave all blank and press Next
Step 16. Secure Administration Leave check box unchecked and press Next.
Step 17. Media Folder I put all my movies in the default media folder /usr/local/movies Press Next
Step 18. Streaming on Port 80 I run apache on this server so I do not check the box. Press Finish.
The server should now be running… Congratulations you are half way there.
Converting files for use in Darwin Streaming Server
We use FFmpeg, I assume you already have it installed and have used http://dag.wieers.com/rpm/ to install it. I am going to use an FLV, but you could easily use anything that ffmpeg supports
Step 1. Convert the file. “/usr/local/bin/ffmpeg -i “<input File>.flv” -f mp4 -vcodec mpeg4 -r 15 -s 320×240 -aspect 4:3 -acodec libfaac -ar 22050 -ac 1 ~/<output file>.mp4″
Options:
-i – this is the input file or “the file we want to convert from”
-f – this is the format we want to convert to in the case of our blackberry Mpeg4
-vcodec – This is the codec version we want to use, in our case regular mpeg4
-r – this is the frame rate, Blackberry supports 15fps
-s – this is the screen resolution my 8830 curve supports 320×240
-aspect – this is the aspect ration 4:3 works perfectly on my curve, you can try 16:9 if your having issues
-acodec – this is the audio codec aac works great on the blackberry
-ar – this is the audio rate, depeding on what your doing this could be lower, but this way still makes the file smaller then FLV
-ac – this is the number of audio channels, I watch movies on Speaker phone so mono is fine with me.
So this converts the video, but this won’t actually stream the video, if you stream this file you will get an “Error 415 Unsupported Media Type”, no I am not a liar this file will stream perfectly. In order to use RTSP we must hint the file, this tells the player a bit of info about the file, chapters things like that. MP4Box is well suited for this job. It is packaged with gpac.
Installing GPAC
I was not able to install gpac completely, but I did get MP4Box and the library I needed so I will take you through those steps, don’t be scared when you get an error when compiling.
Step 1. Go to /usr/src and download gpac “cd /usr/src ; wget –continue http://downloads.sourceforge.net/gpac/gpac-0.4.5.tar.gz”
Step 2. configure the application “cd gpac ; sh ./configure; make”
Step 3. At this point it failed compilation, so I just copied the required things. “cp bin/gcc/libgpac.so /usr/lib/ ; cp bin/gcc/MP4Box /usr/local/bin”
GPAC is now installed (sort of).
Hint the mp4
Step 1. MP4Box ~/<outfile>.mp4 -hint
Step 2. move the file to dss “mv ~/<outfile>.mp4 /usr/local/movies”
You can now access your file by pointing your browser to http://x.x.x.x:554/<outfile>.mp4 replacing x.x.x.x with your Darwin Streaming Server and <outfile> with the filename of your mp4 that has been hinted.
I have tested this with blackberry OS 4.5 on my curve 8830 I watched movies for longer then an hour. I subscribe to BIS (Blackberry Internet Service), so unless your admin has rules about streaming on BES (Blackberry Enterprise Service) it should work on that as well… Happy Streaming!







hi john, very helpful article…i tried replicating the steps and got the streaming video as well…however my video takes almost 1 min to start playing from the instance i click on it…any ideas on how to reduce this initial buffering time? i am streaming over 2 Mbps wifi network using blackberry storm…
How about playing on the elder BlackBerries. Same video, I can play it on my curve 8900, but I cannot play on the older 8310 blackberry. The same file I can play it locally on the blackberry but I cannot play it via RTSP streaming, I can see video but no audio. I used aac codec as you did.
Thank you soo much could not figure out why files of the right format were not streaming this page is the result of weeks of searching, you are a god among men