Motion is a video motion detector with tracking support for webcams.
But you don’t have to build it from source. Motion is a package available in Fedora and Ubuntu, and it’s available in Gentoo under media-video/motion. I like it when the package name so very clearly matches the application. I’m not sure about debian based systems under aptitude, but if your machine has a yum repository addiction, you’ll find it easier to use the pre-packaged rpm version available for your distribution.
If you still want to build from source, and you figure out how to get support for ffmpeg working, please let me know. I have Fedora 11’s ffmpeg packages and they’re not in the right place, and when I link/copy all the files where motion wants to build them from, motion still chokes. I’d like to have the time lapse features working, but it seems I need ffmpeg_timelapse and other ffmpeg variables set in the configuration in order to get that working.
Besides that mess, it builds just fine. And that was good enough for my initial purposes. I just wanted jpeg’s captured every time the camera saw motion. I don’t have pan and tilt features on the camera, it’s just an cheap usb cam that’s several years old that I found in my parts bin the other day covered with dust.
After installing from source, I grabbed the /etc/motion/motion.conf from the fedora package and copied that into place. Other than the location of the output files, the defaults in the fedora package suited me just fine.
Here’s a few things you may be initially interested in tweaking right out of the box, especially if you’re capturing motion in the distance:
##################################### # Motion Detection Settings: ##################################### # Threshold for number of changed pixels that # triggers motion detection (default: 1500) threshold 1500 # Automatically tune the threshold down if possible (default: off) threshold_tune off # Noise threshold for the motion detection (default: 32) noise_level 32 # Automatically tune the noise threshold (default: on) noise_tune on
But there’s plenty of tuning features available, so feel free to get crazy with the cheese wiz. And if you have ffmpeg working:
# Use ffmpeg to encode mpeg movies in realtime (default: off) ffmpeg_cap_new on # Use ffmpeg to make movies with only the pixels moving # object (ghost images) (default: off) ffmpeg_cap_motion off # Use ffmpeg to encode a timelapse movie # Default value 0 = off - else save frame every Nth second ffmpeg_timelapse 0 # The file rollover mode of the timelapse video # Valid values: hourly, daily (default), weekly-sunday, weekly-monday, monthly, manual ffmpeg_timelapse_mode daily # Bitrate to be used by the ffmpeg encoder (default: 400000) # This option is ignored if ffmpeg_variable_bitrate is not 0 (disabled) ffmpeg_bps 500000 # Enables and defines variable bitrate for the ffmpeg encoder. # ffmpeg_bps is ignored if variable bitrate is enabled. # Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, # or the range 2 - 31 where 2 means best quality and 31 is worst. ffmpeg_variable_bitrate 0