Warning: Following my trades may be hazardous to your financial health. See Disclaimer.

Wednesday, January 18, 2012

Home Surveillance Using My Android Phone


I decided to set up my HTC Sensation smartphone for home surveillance.  I thought it'd be a fun project and I might feel the need for it in the future, even if it might be short term such as to catch naughty neighborhood boys in the act.
1. Set up the Android phone
The first step is to set up my Android phone so that it can stream video and audio.  I use and recommend IP Webcam by Pas.   It's easy to set up.  Once installed, simply hit "Start server" and it's off and running.  It even tells you the local IP address (e.g. 10.1.10.6) and port (default is port 8080).   If I were to run this regularly, I'd want to set up login/password as well.

2. Test within the home network (LAN)
The previous step readily allows my home PC running a browser to view the video streamed from my smartphone.  Using the running example, the URL to get to the streaming home page would be http://10.1.10.6:8080.  Since I am using a compatible browser, i.e., Google Chrome, I am in luck.  I can simply click "Use browser built-in viewer" off the home page and I am off to go.   Both audio and video are rendered through the browser directly in my case.  To skip the home page, I simply bookmark the URL, http://10.1.10.6:8080/browser.html.

3. Configure the router for external access
The ISP assigns an external IP address to my home network.  One of the many ways to find out about this IP address is through http://CanYouSeeMe.org.  But since I have a wifi router which routes incoming internet traffic to many of my networking devices, I need to somehow direct the stream request to my Android phone that's running the IP Webcam.  To do so, I need to set up and enable "IP forwarding" (or "virtual server" as some router would call it) on my router, and point all traffic on port 8080 to the Android phone's local IP address (10.1.10.6).

One quick way to verify the set up for this step is to use http://CanYouSeeMe.org and specify 8080 in the box next to "Which port?".  If the setup is correct, it should return "Success".  Make sure the IP Webcam is running during the test!
If there is another device sitting between the cable modem and the router, most likely a VoIP telephony router such as a Ooma or Vonage box, you might run into complications.  Refer to my other blog post for walk-around when dealing with a Ooma Hub.
4. Record the streams to a file
Finally, it is only practical to be able to record the "crime scene" that's under surveillance.  To to so, first download the freeware, VLC Media Player, if it's not already on the PC.  Open it and follow the following steps using the parameters of my running example.  Replace the local IP with the external IP of the network the smartphone is running.
  1. From the Media menu, select Convert/Save...
  2. Select the Network tab, and enter http://10.1.10.6:8080/videofeed as the network URL.
  3. Click the checkbox to "Show more options"
  4. Click the checkbox to "Play another media synchronously (extra audio file,...)"
  5. Enter http://10.1.10.6:8080/audio.wav for the Extra media
  6. Click the Covert/Save button
  7. Enter the filename, for example, video_surveillance.mp4, assuming the default "Video - H.264 + AAC (MP4)" profile is used
  8. Click the Start button.
  9. Click the Stop button of the VLC Media Player to end the recording.

One last tip: sometimes I find it necessary to connect to the IP Webcam server using a browser in order to "wake it up", before attempting to record using the VLC Media Player.  Also, I  actually couldn't get the audio to be recorded but I left the instructions in any way for future twigs.
Good luck!

1 comment:

  1. It’s nice to know someone who’s using the same surveillance setup, although I started with an audio bug. I couldn’t get enough security with audio alone, so I decided to upgrade to an IP Webcam. I must say it’s easier for me to relax even when my kids are left alone at home, with or without a nanny. :] -->Meri

    ReplyDelete