Motion Guide

Overview

Installing with apt / debs / building from source

Important Definitions

The Configuration Files

If Motion was invoked with command line option -c pathname Motion will expect the config file to be as specified. When you specify the config file on the command line with -c you can call it anything.

If you do not specify -c or the filename you give Motion does not exist, Motion will search for the configuration file called 'motion.conf' in the following order:

  1. Current directory from where motion was invoked
  2. Then in a directory called '.motion' in the current users home directory (shell environment variable $HOME). E.g. /home/goofy/.motion/motion.conf
  3. The directory defined by the --sysconfdir=DIR when running .configure during installation of Motion
    (If this option was not defined the default is /usr/local/etc/motion)
If you have write access to /usr/local/etc/motion then the editor recommends having only one motion.conf file in the default /usr/local/etc/motion directory.

Motion has a configuration file in the distribution package called motion-dist.conf. When you run 'make install' this file gets copied to the /usr/local/etc/motion directory.

The configuration file needs to be renamed from motion-dist.conf to motion.conf. The original file is called motion-dist.conf so that your perfectly working motion.conf file does not accidentally get overwritten when you re-install or upgrade to a newer version of Motion.

If you have more than one camera you should not try and invoke Motion more times. Motion is made to work with more than one camera at the same time. The motion.conf file establishes global parameters that apply to all cameras and separate camera.conf files that specify the parameters that apply to each specific camera. The camera.conf files are specified at the bottom of the motion.conf file. If you only have one camera you only need the motion.conf file but if you have more than one camera, then you will need to have one camera config file per camera plus the motion.conf file.

So if you have for example two cameras you need motion.conf and two camera config files. So a total of three config files.

An option that is common to all cameras can be placed in motion.conf. (You can also put all parameters in the camera files but that makes a lot of editing when you change a common thing).

An option that is unique to a camera must be defined in each camera file.

It is often seen that people copy the entire motion.conf into the camera config files and change a few options. This works but it not recommended because it is more difficult to maintain and overview. Keep all the common options in motion.conf and the few unique only in the camera config files

The first camera is defined in the first camera file called from motion.conf. The 2nd camera is defined in the 2nd camera file called from motion.conf etc.

Any option defined in motion.conf will be used for all cameras except for the cameras in which the same option is defined in a camera config file.

To make it clear, the camera files format and syntax is the same as motion.conf. An example of what you might want in a camera file as follows: assume you have two cameras, attached to one system. Create files camera0.conf and camera1.conf. At the end of motion.conf, uncomment out the lines that refer to them. The full contents of the camera files can be as simple as

camera0.conf:
videodevice /dev/video0
stream_port 8081

camera1.conf:
videodevice /dev/video1
stream_port 8082

Motion reads its configuration parameters in the following sequence. If the same parameter exists more than one place the last one read wins
  1. Motion reads the configuration file motion.conf from the beginning of the file going down line by line.
  2. If the option "camera" is defined in motion.conf, the camera configuration file(s) is/(are) read.
  3. Motion continues reading the rest of the motion.conf file. Any options from here will overrule the same option previously defines in a camera config file.
  4. Motion reads the command line option again overruling any previously defined options.
So always call the camera config files in the end of the motion.conf file. If you define options in motion.conf AFTER the camera file calls, the same options in the camera files will never be used. So always put the camera file call at the end of motion.conf.

Nearly all config options can be unique for a specific camera and placed in a camera config file. There are a few options that must be in motion.conf and cannot be in a camera config file: stream_auth_method, webcontrol_* , daemon, and camera.

If motion is built without specific features such as ffmpeg, mysql etc it will ignore the options that belong to those features.

If you run the http control command http://host:port/0/config/writeyes, motion will overwrite motion.conf and all the camera.conf files by autogenerated config files neatly formatted and only with the features included that Motion was built with. If you later re-build Motion with more features or upgrade to a new version, you can use your old config files, run the motion.conf.write command, and you will have new config files with the new options included all set to their default values. This makes upgrading very easy to do.

Command Line Options

Signals (sent with e.g. kill command)

Error Logging

Basic Setup

Configuration Options-Listed Alphabetically

Configuration Options-Listed by Topic

Configuration Options-Detail Descriptions

Network Cameras

Raspberry Pi Camera

Image Processing

Motion Detection

Script Execution

Output - General Options

Output - Picture Options

Output - Movie Options

Output - Pipe Options

Steam and Webcontrol

Database

Tracking