Video surviellance using Motion

Motion is a linux program that very simply records still images from a video capture device (like a webcam) upon detecting ‘motion’ in the frame. Thus, you will only be recording when the software detects a change in the frame.  There are likely a bunch of other options but this is good enough for me.

Install motion on ubuntu/mint/debian: sudo apt-get install motion

To compile these photos into a video, simply run the below bash script.

jjest@canadark ~ $ cat ./motion-movie-convert.sh
#!/bin/bash
#apt-get install mencoder
DATER=`date +%Y-%m-%d`
FOLDER=”/home/jjest”
cd ${FOLDER}
ls ${FOLDER}/*.jpg > tmplist_$DATER
mencoder “mf://${FOLDER}/*.jpg” -ovc lavc -o motion-${DATER}.avi
cat $FOLDER/tmplist_$DATER|xargs rm —

Setting up motion as a service:

jjest@canadark ~/motion $ /etc/init.d/motion start
* Not starting motion daemon, disabled via /etc/default/motion

Change setting to yes!

jjest@canadark ~/motion $ cat /etc/default/motion
# set to ‘yes’ to enable the motion daemon
start_motion_daemon=yes

jjest@canadark ~/motion $ sudo /etc/init.d/motion start
* Starting motion detection daemon motion                               [ OK ]