Saturday, December 19, 2009

Security Cameras Media Center and iPhone Notifications

I brought some lorex security cameras from costco only to find out that there is no API for developers, so if you don't like the stock functionality you are out of luck. I wanted to be able to see the live camera feed from my MCE 2005 boxes and I wanted to see the live feed from my iPhone.

Here's how I made it happen.


4 camera lorex camera with video out, although I suppose any webcam will do.

A server with a tuner card (hauppauge PVR 150 in my case but anyone should work) The tuner card has to be dedicated for this purpose, so no live TV recording in MCE. If you are doing a USB webcam the tuner is not necessary.



Plug the video out from the lorex monitor into the tuner card. I needed to purchase a BNC to Composite adapter from radio shack to make this happen.

Download and install YawCam

You should be able to have YawCam detect your tuner card as a webcam, once that's done, enable the streaming option. Now if you goto the stream's address on the web you should see a javascript feed of screen captures. This looks pretty close to live video, although it is simply static jpgs being feed at 30 frames per second.

Now here's the problem... the TV out from lorex displays all 4 cameras on one image which kinda sucks. I wanted to be able to zoom in on one camera at a time via the media center 10 foot experience. So I edited the streams html file to accept input from the Media Center remote. So if I click number 1 on the remote, it zooms and clips the image to the dimensions of the first camera. If I hit left, right, up or down it switches from camera 1 to 2 to 3 to 4.

I also edited the HTML file to be more iPhone compatible. I added a homescreen icon and made some other mods.

Here's the edited HTML file: (replace this into C:\Program Files\Yawcam\stream\ )

So far so good... now to add this webpage to MCE I double clicked on the MCL file on my MCE 2005 box. Now If you go to more programs in Media Center you get a My Cameras option. But of course I had to take it a step further. I wanted to add My Cameras to the MCE start menu, so I am imcluding a reg file to enable that as well.

Remember to edit the reg file and the MCL file to match the IP address of your server. Open in notepad and do a find ( and replace (yourip:port). Double click reg to install to Start Menu, Double click mcl file to install to more programs.


Now the icing on the cake. I thought wouldn't it be cool if I received notifications on my iPhone when a motion event occurred? I know it's a little overboard but that's how I roll. Yawcam offers a motion detection option. When motion is detected it can send an email (boring) or run an executable (w00t!). So I setup the motion detector to capture screenshots of the events and then run an VB Script.

The VB script first performs a system beep, since my server is headless and speakerless, I hear this beep before people can even ring the doorbell. Next the script pings my iPhone's IP address to see if I'm home and on the wifi. If the iphone reply's to ping it does nothing. If it doesn't reply to ping it sends a notification to my iphone that motion was captured. The notification is sent using the excellent Prowl app and API (on appstore). If my iPhone reply's to ping but it is between the hours of 11pm and 7am (when I'm in bed) it sends the notification. So if I'm watching a creepy show like dexter and it's late night, I get a motion detected notification on my phone, I click "My Cameras" in MCE and I have a live feed of my cameras. Best of all dexter continues to play uninterrupted while I view the feed. Pretty bad ass.


Remember to edit the variables in the vbs file to match your iphone IP address and prowl's API Key

More Screens:

Known issues: yawCam doesn't work with a 64bit OS... sucks. I am running windows 7 32bit just to use yawcam. Also if the system beep.exe doesn't work, take ownership of C:\windows\system32\beep.sys and replace with a beep.sys from windows xp box.

Props to adam pash at lifehacker for giving me all these cool ideas. Using tomato to assign a static DHCP for my iphone. Yawcam and prowl.


Waynoe said...

Is there anything you didn't think of? That is sweet how long has it been in use? Looks like I might leave boxee and jump back to mce.

Velson said...

Good job! This is good information about Security Camera and Security System. Nowadays, this business growing well in security industry.

viagra online said...

Wow you are a genius, I haven't been able to do it from the phone.

Generic Viagra Online said...

Its quiet amazing post. Thanks for sharing this Security cameras media center. I buy now.