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 www.kindel.com. 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 Internet…live! I’m currently encoding at two bit-rates (150kbps and 250kpbs 320×160 .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… Stay tuned.

11 comments


  1. Are you securing your feeds? Also, can you speak a little more about Premise?

    Thanks!

  2. http:// says:

    One option if you’re concerned about the amount of CPU horespower used is to get the AverMedia DVD EZMaker Pro USB2.0 device since it generates MPEG2 streams. So you won’t burn any cpu cycles encoding, just a couple streaming.

    Downsides I guess are that it’s probably not as flexible, for example I’m not sure that you could get the device to output multiple bitrate streams like you currently can with Windows Media Encoder.

    Other issue is that I’ve played around with Windows Media Encoder to stream video from an attached DV camera etc. and I can’t see anyway to stream the input (in my case DV or mpeg2 for a number of capture devices) without encoding to Windows Media format first. If you know of a way please let me know.

  3. cek says:

    Yes, I am securing the feed. Plus I’m not telling anyone the URL to the feed :-).

  4. http:// says:

    i am also doing a similar things, but found there is 10 sec delay on the streaming video. Do you have this problems

  5. http:// says:

    Yes, the encoder/WM Server are not perfectly real-time. I do not know how to speed it up, but there are probably options that will help. Maybe if I figure it out i’ll post it…

  6. http:// says:

    see this for info about reducing delay,

    http://www.microsoft.com/windows/windowsmedia/howto/articles/BroadcastDelay.aspx

    Are you capturing video to hard disk and encoding live at the same time? How? Thanks.

  7. http:// says:

    I´ve some problems with windows media encoder, it works great for one and for two simultanius streaming sessions (two diferent cameras or two files).

    The problem is when I want to stream from a third camera or file…

    The cpu usage goes from 25% to 100% and the memory usage goes from 200MB to… well an x^2 curve…

    it just keeps climbing… last time i tried it it got to 4GB in under 4minutes…

    When i then kill one of the processes (doesn´t mather wich one) it creaps back to normal.

    Is this something that you have had problems with?

  8. http:// says:

    I have a streaming session set up and I can see the input, but as soon as I hit encode, the input goes blank and nothing is saved to output. Any ideas? Thanks.

  9. Squintz says:

    Thanks for sharing this. Do you have to use two seperate PC’s or can your Video Capture and Video Streaming be done on the same pc?

    Also please visit cocoontech.com and share your experiences with us there. We like to talk about security and home automation

  10. http:// says:

    Hi. I wanted to know how you were capturing still images from your video camera. What I am looking to do , is to capture images from a live video stream every 60 miliseconds. Can you tell me how to do that? I am looking into using Windows Media SDK for it, but its a little confusing. It will be great if you can guide me. Thanks.

  11. http:// says:

    Hi There,

    I have tried a similar thing but am having trouble with the encoder as it is only encoding the audio….It doesn’t come back with any errors and is set to encode video for streaming. ( I have tried different encoding setting but can’t get WME to encode the video)

    Just wondered if anyone had any ideas ?

Leave a Reply to cekCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.