Pages

Tuesday, January 5, 2016

video stream Motion detector

motion

http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionGuide

intro

capture video streams to file. detects changes to the video stream using various strategies to start capture. optionally saves event to database.

install

sudo apt-get install motion

configure

/etc/motion/motion.conf
/etc/default/motion

add group/user motion to the image dump folder

sudo chown -R motion:motion /media/storage/motion

motion installs with user and group called motion

  • add your user account to motion group
sudo usermod -a -G motion kirk

get a better understanding of the available camera

v4l2-ctl --list-formats-ext

starting the service

sudo service motion start

database

encountered a bug with mysql deprecated timestamp
https://bugs.mysql.com/bug.php?id=41510
CREATE TABLE security (camera int, filename char(80) not null, frame int, filetype int, timestamp timestamp(14), text_event timestamp(14));
resolve:
CREATE TABLE security (camera int, filename char(80) not null, frame int, filetype int, timestamp timestamp, text_event timestamp);
then added a mysql user a root:
CREATE USER 'motion'@'localhost' IDENTIFIED BY 'l1tsp33D';
GRANT SELECT, INSERT ON motion.security TO 'motion'@'localhost';
encountered another issue with the motion.conf file having eventtimestamp as a column name but the documentation has text_event.
sqlquery insert into security(camera, filename, frame, filetype, timestamp, eventtime_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')
Altered the conf file to match the table I created.

error

vim /var/log/syslog