User Tools

Site Tools


setupmotion

The program motion is a command line tool to detect motion in front of a camera. If a motion is detected you can choose if you get images, videos or both.

Install motion

sudo apt-get install motion

Configure motion

You will find the configuration file in /etc/motion/motion.conf This file is very good commented and therefore I will only explain some additional informations.

Configure motion with one USB Cam

The default video device for an USB device is /dev/video0. A second video device should be /dev/video1

download configuration

###########################################################
# Capture device options
############################################################
 
# Videodevice to be used for capturing  (default /dev/video0)
# for FreeBSD default is /dev/bktr0
videodevice /dev/video0

Also define witch resolution and framerate your cam support

# Image width (pixels). Valid range: Camera dependent, default: 352
width 1280
 
# Image height (pixels). Valid range: Camera dependent, default: 288
height 720
 
# Maximum number of frames to be captured per second.
# Valid range: 2-100. Default: 100 (almost no limit).
framerate 30

Configure motion with Raspberry Cam

The raspberry cam is no standard device, because it is connected through the SPI Interface. Therefore we have to stream the cam output to motion.

There exists two solutions:

mjpg_streamer

To install mjpg_streamer follow this instructions How-to create a MJPEG stream using raspistill and MJPG streamer

If you want to start the stream during the boot process automatically, you have to download this file mjpg_streamer.zip

Copy the file “mjpg_streamer” to /etc/init.d/ and “mjpg_streamer.sh” to /home/pi/motion

Change the permissions for both files to

sudo chmod 755 /etc/init.d/mjpg_streamer

Add it to the default runlevel

sudo update-rc.d mjpg_streamer defaults

Now you can see the stream in the browser http://[yourip]:8080 and you can use this link for motion as video input http://yourip:8080/?action=stream

setupmotion.txt · Last modified: 06.09.2014 00:52 by tigermatze