环境:ubuntu12.04
版本:motion 3.2.12
最近刚好弄视频抓拍移动监测这一块,听说motion,是这调试了一下,记录下来。我是在pc虚拟机下面调试的,有关开发板哪一方面的可以参考这个博客里面的内容,其实大致差不多,(http://blog.csdn.net/guozhiyuan20095318/article/details/7310486)。
1.首先是获取源码,我已经上传了,也可以google下载,ubuntu下可以直接运行sudo apt-get install motion安装。
2.配置文件。我也是根据网上的资料来配置的,首先配置的是motion.conf,具体的内容我贴上网上的资料。建议大家原始的conf文件做一个备份,另外在自动发送邮件配置的时候肯呢个会出问题,我的配置文件如下:
#!/bin/bash
echo "111111111111111on_motion_end1111111111111111"
DIRC="/root/motion/snapshots/"
VIDEOTIME="/root/tmp/videotime"
TIME=$(cat $VIDEOTIME)
echo $TIME
ALARM_EMAIL="/root/tmp/myalarm.txt"
echo "Subject: Motion detected - $TIME - $DIRC" > $ALARM_EMAIL
echo "">> $ALARM_EMAIL
echo "Motion detected - check $TIME.avi">>$ALARM_EMAIL
MAILBODY=$(cat $ALARM_EMAIL)
#first trying of sending the avi video
echo $DIRC*$TIME
echo $MAILBODY
#echo $MAILBODY | mutt -s $TIME -a $DIRC*$TIME.avi xxx@gmail.com
echo $MAILBODY | mutt -s $TIME -a "$DIRC*$TIME.avi" -- xxx@gmail.com < "/root/aaa.txt"
#second trying of sending the avi video
TIME=$(expr $TIME - 1)
#TIME=$(expr $TIME)
echo $TIME
echo $MAILBODY | mutt -s $TIME -a $DIRC*$TIME.avi xxx@gmail.com
运行前,先修改这个文件/root/motion.conf,我的motion.conf
# Minimal motion example config file provided by the
# Debian motion package - for basic webcam operation.
#
# You most certainly want to investigate
# /usr/share/doc/motion/examples/motion-dist.conf.gz
# for further configuration options. Also, refer to the
# motion man page and /usr/share/doc/motion/motion_guide.html
# for detailed information on configuration options.
daemon off
quiet on
locate on
# You may very well need to change this (check with 'dmesg'
# after plugging in your webcam).