Tuesday, October 18, 2011

Home security projects

Lately I have been playing around with some home security projects!

The script below takes a series of snapshots using a webcam and uploads these to a Picasa album called Footage. I use this script mainly to quickly check in on the house while I am away ;)

First, you will need to install and authorise google-cl: http://code.google.com/p/googlecl/downloads/list

Once installed, you should open a command prompt and type: google docs list (or a similar command).

You will need to enter an account name/password, and then authorise this via a browser - so it is probably easier to do this setup in an X environment. 

You will then need a *private* album called Footage in Picasa.

#!/bin/sh
COUNT=0
SAVELOC=this_is_where_you_save_your_security_footage
while [ $COUNT -lt 10 ]; do
 WHENREC=$(date +"%y-%m-%d-%H-%M-%S")
 FILEREC="${SAVELOC}${WHENREC}.jpeg"
 streamer -c /dev/video0 -o $FILEREC
 google picasa post --title "Footage" "$FILEREC"
 sleep 2
 COUNT=($COUNT + 1)
done
This script is designed to get a quick look at things remotely - it is triggered on demand via ssh.

The best Linux program I found for genuine surveillance is Motion.  http://www.debian-administration.org/article/An_Introduction_to_Video_Surveillance_with_%27Motion%27

By default, it saves recorded images/video to the directory it is started from. If you have Dropbox installed, cd to your Dropbox folder, type motion, and you will now be able to access the captured video/images from any computer.

One final script:
#!/bin/sh
COUNT=0
SAVELOC=this_is_where_you_save_your_security_footage
while [ $COUNT -lt 10 ]
 do
 WHENREC=$(date +"%y-%m-%d-%H-%M-%S")
 FILEREC="${SAVELOC}${WHENREC}.avi"
 streamer -q -c /dev/video0 -f rgb24 -r 3 -t 00:00:05 -o "$FILEREC"
 aaxine "$FILEREC"
 COUNT=($COUNT + 1)
done

You will need to have aaxine installed for this to work... but it will play back an ascii video from your webcam in the terminal. Replace aaxine with cacaxine for a colour version ;)


0 comments:

Post a Comment