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.

Requirements:

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.

YAWCam

Setup:

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: http://www.box.net/shared/i1rjd8p8fe (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 (192.168.1.101:8080) and replace (yourip:port). Double click reg to install to Start Menu, Double click mcl file to install to more programs.

Download: http://www.box.net/shared/98pabdm58a

















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.

Download: http://www.box.net/shared/27hgh24an8

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.

Friday, August 14, 2009

Boxee on Media Center 2005

Boxee seems pretty cool. But it's a drag to load up from Media center 2005 unless you have VNC or a mouse. Here's my workaround... This will add a Boxee icon to the More Programs menu in media center.

Download this zip file: http://www.box.net/shared/hxl5mdif42

Then extract the 2 files (Boxee.mcl & Boxee.Bat) to: C:\Documents and Settings\All Users\Start Menu\Programs\Accessories\Media Center\Media Center Programs

Now simply double click on the MCL file to install.

For those of you running Vista MCE try this: http://www.hack7mc.com/2009/01/adding-boxee-to-media-center-x86-and.html

Fixed download link 12/19/2009

Saturday, January 10, 2009

Sirius on the iPhone

Getting Sirius on my iPhone was a difficult task for me. I was using Orb with uSirius for a while but I found that orb is too heavy for my home server. Also Orb takes too long to start from the iPhone... I have to click through 5 prompts before I can hear Stern. Then if I got disconnected, which happens all too often, I had 5 more prompts to click through.

So here's my solution using all free software without transcoding and without jailbreaking my iPhone.

This is for the technologically advanced user. If you don't have a web server or never heard of asp then stop here.

Requirements:

A home web server running asp
uSirius RC 8

uSirius Mirror: http://www.mediafire.com/?kn0cotmyt52

A sirius subscription
fStream (free on appStore)

A little background info:
When a media player hits a uSirius url (e.g. http://192.168.1.101:19080/streams/stream?bandwidth=low&num=100&r=1229898108), uSirius redirects the player to the correct feed from the sirius servers (e.g. http://g.lm.akamaistream.net/D/?auth=reallylongurl&MSWMExt=.asf)

How this redirection occurs is the source of the problem. Most media players don't like to be redirected. Especially all iPhone media players I tried. So my asp script simplifies the redirect by transforming it into a m3u playlist. Here's how to do it

Open up notepad and paste this code:


<%
response.ContentType="audio/x-mpegurl"
Set stream = CreateObject("MSXML2.ServerXMLHTTP.3.0")
stream.open "GET", "http://192.168.1.101:19080/streams/stream?bandwidth=low&num=" & request.querystring("C") & "&r=1234567890", false
stream.send ""
If stream.Status = 200 AND stream.readyState = 4 Then
s = stream.ResponseText
s = Mid(s, instr(s, "=")+1)
s = Mid(s, 1, instr(s, "Ref")-3)
s = "mms" & Mid(s, 5)
end If
response.write(s)
%>

Save it as sirius.asp and put it in the your web root directory.

You would have to get the ASX playlist location from uSirius and plug it into my script, substituting your internal ip address and the "r=1234567890" part.


Lastly, in fStream you could add a stream to Howard 100 by calling this script like this: http://myexternalipaddress/sirius.asp?C=100 because Stern is Sirius channel 100.



I have found this setup to be highly effective for me and it puts little strain on my server. I know this isn't the most complete tutorial in the world but I just figured I'd share my findings with you.

If you have a better solution please share in the comments.