11.2.4 Konfiguraatioesimerkki

Tässä esimerkissä käytetään kahta kameraa, jotka löytyvät laitteesta
/dev/video0 kanavista 0 ja 1. Konfiguraatio muodostuu kolmesta tiedostosta. Ensimmäinen tiedosto on /etc/motion/motion.conf, jossa sijaitsee kaikkia kameroita koskevat asetukset. Kamerakohtaiset asetukset taas löytyvät tiedostoista /etc/motion/cam1.conf ja cam2.conf. Näitä tiedostoja kutsutaan motion.conf:ista.

Konfiguraatio toimii niin, että kukin kamera tekee .avi-videota kohtuullisella kuvanlaadulla aina liikettä havaittaessa. Sen lisäksi etäkatselua varten muodostetaan keskinkertaisella laadulla olevia .jpg-kuvia, joita jaetaan www-palvelimen kautta. Tarkempia tietoja etäkatselusta löytyy kappaleesta "Etäkatselu".

# /etc/motion/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 on
quiet on

# You may very well need to change this (check with 'dmesg'
# after plugging in your webcam)
videodevice /dev/video0

# Image size in pixels (valid range is camera dependent)
width 320
height 240

framerate 25
quality 85
auto_brightness off

# Initial brightness, contrast, hue (NTSC), and saturation
# 0 = disabled (valid range 0-255)
brightness 0
contrast 0
saturation 0
hue 0

# Encode movies in real-time (install ffmpeg before enabling)
ffmpeg_cap_new on

# Target base directory for pictures and films
# You should probably change this (create dir beforehand)
# target_dir /tmp

# Define a port number (e.g. 8000) to enable the mini-http 
# server. 0 = disabled
# webcam_port 0

# Set to 'off' to allow anybody (not just localhost) to view 
# the webcam via the mini-http server (http://hostname:port)
webcam_localhost off

webcam_quality 25
webcam_maxrate 5

# Omat lisäykset
output_all off
output_normal off
webcam_motion on
thread /etc/motion/cam1.conf
thread /etc/motion/cam2.conf
ffmpeg_video_codec msmpeg4

############################################################
# HTTP Based Control
############################################################

# TCP/IP port for the http server to listen on 
# (default: 0 = disabled)
control_port 8080

# Restrict control connections to localhost only (default: on)
control_localhost off

# Output for http server, select off to choose raw text plain 
# (default: on)
control_html_output on

# Authentication for the http based control. 
# Syntax username:password
# Default: not defined (Disabled)
control_authentication test:passu

# end of /etc/motion/motion.conf

# /etc/motion/cam1.conf

# You may very well need to change this (check with 'dmesg'
# after plugging in your webcam)
videodevice /dev/video0

# Target base directory for pictures and films
# You should probably change this (create dir beforehand)
target_dir /

# Define a port number (e.g. 8000) to enable the mini-http 
# server, 0 = disabled
webcam_port 8000

input 0

# width 400
# height 499

ffmpeg_filename /tmp/cams/cam1-clip%v_%d.%m.%Y_%H.%M.%S
# jpeg_filename /tmp/cams/cam1-pic%v_%d.%m.%Y_%H.%M.%S

# end of /etc/motion/cam1.conf

# /etc/motion/cam2.conf

# You may very well need to change this (check with 'dmesg'
# after plugging in your webcam)
videodevice /dev/video0

# Target base directory for pictures and films
# You should probably change this (create dir beforehand)
target_dir /

# Define a port number (e.g. 8000) to enable the mini-http 
# server, 0 = disabled
webcam_port 8001

input 1

ffmpeg_filename /tmp/cams/cam2-clip%v_%d.%m.%Y_%H.%M.%S
# jpeg_filename /tmp/cams/cam2-pic%v_%d.%m.%Y_%H.%M.%S

# end of /etc/motion/cam2.conf



Lauri Laukkarinen 2006-03-23