Live Security Camera Feeds with Windows Media Services 9

When I built my house a few years ago I installed several video cameras for security monitoring. Until recently I was only capturing still images from these. I archived the still images and published the most recent via a URL on my website allowing me to see “the latest” while away from home. I've been using a very nice shareware program to accomplish all of this called SupervisionCam by Peter Kirst. I originally used SupervisionCam for capturing stills of my house being constructed...I still haven't gotten around to encoding all those stills into a time-lapse video...sigh.

Any-hoo, this worked pretty well, but what I really wanted was live video.

I knew I could use Windows Media Services to accomplish this, but never got around to setting it up until last night. Damn, Windows Media Services 9 (built into Windows Server 2003) is easy to use! I used older versions ages ago, but have never played with the 9 Series. Kudos to Bret and everyone else involved. The UI is a bit weird, but it very discoverable, and I found the documentation to be really, really good for what I wanted to do. I have a few beefs (see below), but really solid stuff.

In order to encode and stream live video from a security camera you need the following:

  • A camera. In my case my cameras are all analog terminate as S-Video (most people will find that their cameras output composite; I have a fairly bizarre setup which I should blog about sometime).

  • A capture device of some sort. I am currently using an AverMedia DVD EasyMaker USB 2.0 device. I went with this because it was cheap and you can plug multiple into a PC at a time and each will have it's own driver loaded. I had lots of problems getting multi-input PCI capture cards working with the software I wanted to use. FWIW, I have found that these things work very well.

  • A PC for encoding. This is the PC that the capture device is installed in. Consider the quality of the video you want and the number of different bit-rates you want available simultaneously when deciding which machine to run the encoder on. The encoder machine can be the same machine as the streaming machine. The encoder machine can be running XP or W2K3 (or probably even W2K). You'll need to install the Windows Media Encoder 9 Series.

  • A PC that is your streaming server. In my case this is the same W2K3 box that hosts From my experiments for this scenario the hardware requirements are not too demanding. Use the Configure Your Server Wizard to add the “Streaming Media Server“ role.

  • A hole in your firewall for the RTSP protocol (554) that passes TCP traffic on this port to your streaming server.

I won't go into all the steps require to actually setup WMS and WME. Suffice to say that it took me about 10 minutes to figure it out using the Windows Media Services and Encoder documentation.

I can now view my security cameras from work over the! I'm currently encoding at two bit-rates (150kbps and 250kpbs 320x160 .5fps) which is good enuf. I plan on adding a lower bit-rate option so I can view the cameras live on my Windows Powered Smartphone. Now that's cool.

I do have some issues with this setup. First I'm not quite sure what machine to use as my encoder. Right now I'm using my screaming Windows Media Center Edition box, because that's where I was most recently playing with the new AverMedia capture device. I'm seeing about 30% CPU utilization encoding the two streams. I probably don't want to burden my MCE machine like this; probably not good for watching movies. At the same time I'm not sure I want to load my home automation server (running Premise); although it is a single proc server with an empty socket for another processor...

Also, I'm shocked at how hard it appears to be to get the Encoder to run as an NT Service. I assumed it would be a built-in feature, but apparently I have to write code (an NT service that uses the Encoder objects). I tried to find a tool that already does this via Google, but didn't see anything. I guess I get to write some more code which is never really a bad thing.

My next step is to build a web page that lets me control the cameras while I'm watching...