Motion is a program that monitors the video signal from cameras. It is able to detect if a significant part of the picture has changed; in other words, it can detect motion.
Even though 'motion' is in the Portage tree, you will need to download and use the svn ebuild, because the official ebuilds do not work with the latest kernels, specifically the 'v4l' drivers.
su - root mkdir -p /usr/local/portage/media-video/motion/files cd /usr/local/portage/media-video/motion/ wget https://376225.bugs.gentoo.org/attachment.cgi?id=288617 -O motion-9999.ebuild cd /usr/local/portage/media-video/motion/files/ wget http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-video/motion/files/motion.initd-r2 wget http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-video/motion/files/motion.confd echo "media-video/motion **" >>/etc/portage/package.keywords emerge motion
nano /etc/motion.conf target_dir /tmp/cam1 (or /path/to/saved/files)
tail /var/log/syslog motion_startup: Motion trunkREV544 Started become_daemon: Motion going to daemon mode main: Thread 1 is from /etc/motion.conf main: Thread 1 is device: /dev/video0 input -1 motion_init: Started motion-stream server in port 8081
Fire up your web browser to address - http://127.0.0.1:8081
motion_detected: Motion detected - starting event 1 create_path: creating directory /tmp/cam1 event_newfile: File of type 1 saved to: /tmp/cam1/01-20111102170811-00.jpg