DIY: Home Surveillance System with VLC

Posted 834 days ago - Debian, Free Stuff, Security

The current state of the global economy has shot the U.S. unemployment rate up - waay up. As a result, more people are willing to commit crimes in order to provide for themselves or their family. Just this year, two houses that share the street I live on were broken into. Based on the alleged stolen items, the crooks appeared to have prior knowledge, but I'm not taking any chances.

Rather than forking over $500 on some lame ass pre-packaged kit, I've implemented a semi-automated, fairly reliable, secure, and cost effective home surveillance system using some good old fashion: Debian, cron, bash/sh, ssh, VLC, and a couple IP cameras obtained from w00t.com a few years back. Let's run this...

Install VLC

[bigbrother ~]:# aptitude -y install vlc

Create a Script

Here's a version of the script I'm using:

[bigbrother ~/bin]:$ cat ipcam
#!/bin/sh
export DISPLAY=:0.0
dom=`date -u +%d`
streamit="http://10.254.1.114/cgi-bin/getimage.cgi?motion=1"
vlc -I dummy "$streamit" --sout "#transcode{vcodec=mp1v,vb=124,scale=1,width=320,height=240,fps=25}:duplicate{dst=std{access=file,mux=ts,dst=-}}" | split -b 536870912 -d - /mnt/sshfs/ny-dc/the-lab/vid-$dom.mpg >/dev/null 2>&1

[bigbrother ~/bin]:$

MJPEG

"streamit" is the raw MJPEG feed from the IP cam. The URL above works for an NCL-1000 model IP camera, great for those of us opposed to installing the bs ActiveX. To see the raw camera feed, simply create an HTML file with an image tag, like so:

<img src="http://10.254.1.114/cgi-bin/getimage.cgi?motion=1" />

Ta-da, no ActiveX, just a raw feed.

Break it Down

The script above does the following: exports the 'dummy' display, sets "dom" variable to the current day in numeric form, sets the location of the MJPEG stream, executes VLC in "dummy" mode, dumps stdout to /dev/null, outputs/transcodes the IP cam MJPEG stream as MPEG1 with a resolution of 320x240 @ 25 frames per second. The transcoded version is then dumped in 512 megabyte increments to an SSH file system (sshfs) mount (/mnt/sshfs/ny-dc/the-lab/) so the recorded video is stored several hundred miles away from home (what good is a camera recording to a hard-drive if they steal the computer??). The result is a series of 512 MB files neatly organized in a format like so:

vid-22.mpg00
vid-22.mpg01
vid-22.mpg02
vid-22.mpg03
etc..

Conclusion

Setup a cron job to auto-rotate the script however you like. 7am - 7pm Monday through Friday? No problem. What about just the weekends? Crontab is your friend. The best part of all this is the COST, or lack of. Hard drives and "cloud" computing are both dirt cheap compared to a decade ago, and VLC is of course free.

Unless the crook is smart enough to cut Inet access (wired), knock out my generous (naive?) neighbor's open-wifi, kill the electricity to the house, and then patient enough to wait for the UPS to die, I'd say there's an excellent chance he or she will end up on camera. SAY CHEESE. :D

Word Count: 545

Tags: , , , ,

Click Here to Submit a Comment

Permalink / Last Modified:

Support Nullamatix.com:

See Also:

  • 08/31/2009 -- Howto: Insert Bash Command Output Into MySQL
    Excerpt: "A BlogStorm reader emailed me today, Hello, I am replying to your post on http://www.blogstorm.co.uk/how-to-scrape-pages-with-coldfusion/ Wanted to see your experience in page scraping, may need your help on a project. HOw much did you do beyond the ..."
  • 02/11/2008 -- Howto: Setup cron Jobs to Restart Lighttpd & MySQL
    Excerpt: "Over the past couple weeks MySQL crashed when spiked with large amounts of traffic. To remedy this, a cron job has been implemented to simply restart mysql and lighttpd every other day. Here's how it's done. First, if you haven't already, define a cron job ..."
  • 11/22/2009 -- Count the Total Number of IPs From CIDR
    Excerpt: "After adding a few IPs to a firewall drop list, I wondered, "exactly how many IPs are in this drop list?" Since the list contained 187 entries, all in CIDR notation, adding up the total number of IPs in my head was impossible. So, I put together this little ..."
  • 04/20/2009 -- Free Data Sources For Madlib Sites
    Excerpt: "So you've read Blue Hat SEO's awesome write up detailing how to use Madlib Sites to your advantage, now what? Over the course of a few posts, I'll provide some additional information to compliment Blue Hat SEO's post. Clearly, this post contains a list of ..."

4 (Comments|Trackbacks)

[ RSS feed | Trackback URI | Leave a Comment ]

collapse Stephane # @ 2009-10-23 14:33:52 Subscribed Via Email

"Unless the crook is smart enough to cut Inet access (wired), knock out my generous (naive?) neighbor’s open-wifi, kill the electricity to the house, and then patient enough to wait for the UPS to die, I’d say there’s an excellent chance he or she will end up on camera"

=> I'd rather wear a mask and be quick ;-)

Cool setup anyway !

Stephane

 
collapse Mike Hardy # @ 2009-11-14 15:40:59 Subscribed Via Email

From experience, I can say that a) the images you capture will most likely show an obscured face (crooks aren't as dumb as they should be) and b) the police won't have time to look at them much but if they did c) they won't really care and they won't match anything.

Pretty sad, I have had this experience though.

I'm looking for something more along the lines of that hacked up system where a cat owner had a system that automatically detected whether the cat had an "offering" or not and would refuse entry or not. Combine that general idea with the idea pawn shops have of the multi-door cage. If you detect some thievery, make one exit look enticing, but also be a trap. Take that, sucka. Okay, I'm dreaming, I know it.

 
collapse Kelly # @ 2009-11-20 10:03:24 Subscribed Via Email

“Unless the crook is smart enough to cut Inet access (wired), knock out my generous (naive?) neighbor’s open-wifi, kill the electricity to the house, and then patient enough to wait for the UPS to die, I’d say there’s an excellent chance he or she will end up on camera”
–> Since I consider myself both a video and networking guru of sorts, (and primarily a windows user [oh dear god don't kick me out of these forums, it's not my fault!]) I’m curious of a few details:

1) I assume that the “raw feed” is also accessible from anywhere via the web? Did you flash any of the firmware that came preinstalled on the camera?

2) Are there other compression/transcoding options on VLC besides the MPEG1? I’ve had some good experiences with MP4 myself…

3) So you have utilized both the wired and wireless connections for this camera? Do those connections load balance or is one considered primary and the other secondary? (perhaps with one picking up if the other drops off) [P.S. - you're doing wireless now? I think I just fell out of my chair!]

4) My biggest issue with setting up home surveillance is power. I don't see a point to setting up any kind of camera/recording device if you can't be discreet and secure about it. I have the ability to wire a camera for network, , triggered recording features and mount them away from plain sight. But I'll be damned if I have found an outlet close enough to my mounting point for that 3-5' power block most of them come with.
That being said, you can rephrase the "kill the electricity to the house" to "unplug the camera" and move it to the first thing that would thwart this plan to catch the thief.

Didn't mean to rain on your parade. Bravo on the free streaming/recording setup. But I'm a skeptic city girl who shares in personal experience like Mike and have thought about it way too much to be convinced that it could be that simple to cover all the bases.

collapse Guy Patterson # @ 2009-11-21 20:05:50

1) The "raw feed" is accessible anywhere from the Internet, as long as the source IP is in the firewall access list.

2) Yes, there are other encoding, but for whatever reason, I'm having a hard time getting MP4 working with Debian. Think the Debian developers/maintainers have issues with the license or something.

3) The camera is setup to use both wired and wireless, yes. *I* don't do wireless, now, but my generous/naive neighbors do :]

4) You're right about the level of security/discreetness. I guess a potential way to mitigate the risk of simply unplugging the device is to mount the camera in the corner of the room, high toward the ceiling. Then, run the power cable into the attic, where there's a UPS, which is plugged into an outlet up there.

You're not raining on my parade :) Skepticism is what keeps up sharp and always in the pursuit for MORE KNOWLEDGE. Hope I addressed your issues adequately, and thanks for the comments/questions!

 
 

Leave a Comment

Comments are moderated prior to showing up. If your comment does not show up immediately, please do not attempt to resubmit. If you're redirected to the original post after pressing "Add Comment", your comment was successfully entered into the moderation queue.

Trackback Responses to This Post:

  • No Trackbacks, yet. Help Nullamatix.com by Linking to This Post.