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.
Word Count: 545
Tags: bash, code, MySQL, script, surveillance



4 (Comments|Trackbacks)
[ RSS feed | Trackback URI | Leave a Comment ]
"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
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.
“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.
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
Trackback Responses to This Post: