motion notes

From Noah.org
Jump to navigationJump to search


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

configuration

Edit the file /etc/motion/motion.conf. Below are the settings are most often change. I found that threshold is the most difficult to estimate. Every time I do a project I found that I kind of just have to do a few test runs with different threshold values until I find a value that works. The threshold values can be orders of magnitude different between different conditions.

videodevice /dev/video1
# HD 1080p resolution is 1920*1080 (2073600 pixels, or 2.1 megapixels)
# Logitech c910/c920 max resolution 2304 * 1296
# Note that some versions of Motion have a bug that requires the height to be a modulo of 16.
# There is a hack around this bug. Set the resolution to 1920x1200. The images will actually be
# captured at 1920x1080, but this will satisfy Motion.
width 1920
# really 1080
height 1200

# Threshold for number of pixels that triggers motion detection (default: 1500).
# This sets the threshold to 10% of all pixels, which is a massive change in most conditions.
# This will make motion detection fairly insensitive and immune the minor movements.
# This is not a good setting for distant objects as they may never register as high as 10%.
# 1920 * 1080 = 2073600 pixels
# 2073600 * 10% = 207360
threshold 207360
noise_level 64

# %v is the event number.
movie_filename %Y%m%d%H%M%S-%v
timelapse_filename %Y%m%d-timelapse
gap 10
pre_capture 1
post_capture 1

text_right %Y-%m-%d\n%T-%q
# %v is the event number. %q is the frame number.
jpeg_filename %Y%m%d%H%M%S-%v-%q
snapshot_filename %Y%m%d%H%M%S-snapshot
snapshot_interval 1
#snapshot_interval 60
framerate 30

# jpeg quality
quality 95
# Valid values: 0 (default = no rotation), 90, 180 and 270.
rotate 0
minimum_motion_frames 2
text_right %Y-%m-%d\n%T-%q
text_changes on
text_double on

A different example:

width 640
height 480
#movie_filename %Y%m%d-%H%M%S-%v
#timelapse_filename %Y%m%d-timelapse
gap 3
pre_capture 0
post_capture 0
text_right %Y%m%d-%H%M%S-%v-%q
# %v is the event number. %q is the frame number.
jpeg_filename %Y%m%d-%H%M%S-%v-%q
snapshot_filename %Y%m%d-%H%M%S-snapshot
snapshot_interval 0
#snapshot_interval 60
framerate 1
videodevice /dev/video1
# Threshold for number of pixels that triggers motion detection (default: 1500)
# 10% is a massive change.
# 640*480=307200
# 307200 * 0.05 = 15360
threshold 15360
# jpeg quality
quality 95
# Valid values: 0 (default = no rotation), 90, 180 and 270.
rotate 0
# Motion events and end cause a light to turn on and off.
on_event_end br --port=/dev/ttyUSB0 --house=A --off=1
on_motion_detected br --port=/dev/ttyUSB0 --house=A --on=1