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)
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.
- From the Media menu, select Convert/Save...
- Select the Network tab, and enter http://10.1.10.6:8080/videofeed as the network URL.
- Click the checkbox to "Show more options"
- Click the checkbox to "Play another media synchronously (extra audio file,...)"
- Enter http://10.1.10.6:8080/audio.wav for the Extra media
- Click the Covert/Save button
- Enter the filename, for example, video_surveillance.mp4, assuming the default "Video - H.264 + AAC (MP4)" profile is used
- Click the Start button.
- 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.