Tuesday, January 13, 2009

Watching UCLA Hoops from Barcelona using Orb, FFMPEG, and Zune

I am a big UCLA Bruins basketball fan. I started following the Bruins when I was probably 11 or 12 years old. This was during the Trevor Wilson/Pooh Richardson era. My brother was attending UCLA and I was really starting to get more interested in sports of all kinds.  Even when I first attended UW for my first 2 quarters out of high school, I found myself rooting for the Bruins against the Huskies in Pac-10 play.  After I transfered to UCLA, I could see the games in person as a student as well as always catch them on local TV.

After graduating, I still followed the games and other events closely, which was quite easy in the LA area between local cable (Fox Sports West) and the LA Times . Once moving to Spain, however, it has been a much bigger challenge to catch games that are:

  1. Broadcast regionally only in the USA
  2. Scheduled in the evenings (California time .... 9 hours behind Spain)
The first 2 years I had used a Tivo  connected to a Slingbox  at my parents' house.  It worked well enough but the quality was not great and the hard drive of the Tivo finally died this summer.

I now have a setup that is working quite well for the 2008-2009 season.  I bought a Haupauge 1600 TV card for my parents' PC and installed Orb.  Orb is a fantastic service that principally turns any computer into a powerful Slingbox with a built in PVR.

It is very easy to use and runs in the background.  I schedule the recordings using the web interface here in Spain.
I just look up the channel and the time (I have the schedule setup as an RSS feed from Google Calendar to have it all on the same page) and I click record:

Once the game is scheduled, I just wait.  Orb records video in dvr-ms format, which uses MPEG-2 video.  Although, very high quality, MPEG-2 makes just way too big of files to download (average size of 1 game is 3.2GB!).  

I could stream the games directly using Orb, but the PC at my parents house is not very powerful and the Internet connections are just too slow and far away between Spain and CA to maintain a stable streaming connection for 2 hours.  Additionally, since I have 2 young children, it is rare that I ever get 2 whole hours to sit and watch something, let alone 2 times per week during the season.

So, generally I watch the games partially on my PC and partially on my Zune (when it is working ).  To make the dvr-ms file, small enough to download (700MB) and is in a format able to be viewed on the Zune (WMV), I run a script to transcode  the video using FFMPEG.  It runs nightly and checks if a newly recorded video exists and if has not already converted that video, it quietly makes a copy in wmv.

I wake up morning following the game and initiate the download via Orb:

After the multiple hour download, I can start watching it on the PC or sync the game to my Zune to watch later.

This has worked so far after a lot of trial and error, especially with the file conversion (tried DVRMSToolbox and MCEBuddy before writing my own script with ffmpeg) and syncing.  I am about 3/4 done watching the UCLA vs. USC game and will finish watching it later today.  

Do not tell me who won please!

Hopefully, Orb will eventually be able to record directly to other formats like wmv or H.264 and soon I plan on changing my Zune for a Nokia 5800 XpressMusic.

Go Bruins! 


  1. I was wondering if you could post your command line args for FFMPEG to convert to zune. Or better yet your whole script. I've been playing with a perl script that does something similar to what you are talking about but I can't get the encoding right. It actually worked on a small file but when i tried it on a large file (350Mb+) it said that the file was corrupt even though it plays fine in the desktop software.

    By the way, if you don't want your script to run nightly you can use perl to monitor folders in real time for changes and then convert right when the download completes.


  2. Sorry for the delay but here is the script...

    @echo off
    for /F "tokens=*" %%M in ('dir "C:\Documents and Settings\All Users\Documents\Recorded TV\*.*" /A:-D /B ^') do (
    echo %%M

    if not exist "C:\Documents and Settings\[USER_NAME]\My Documents\My Videos\ffmpeged\a-%%M.wmv" (
    echo %%~nM does not exist
    ffmpeg -i "C:\Documents and Settings\All Users\Documents\Recorded TV\%%M" -v 1 -s 320x240 -r 30/1.001 -acodec wmav2 -ar 48000 -ab 68k -vcodec wmv2 -b 600k -async 2 "C:\Documents and Settings\[USER_NAME]\My Documents\My Videos\ffmpeged\a-%%M.wmv"


    Now I have a Nokia 5800 so I will be modding the script for a new format using MP4 and divx.