motion man page
motion — Detect motion using a video4linux device Motion uses a video4linux device to detect motion. If motion is detected both normal and motion pictures will be taken. Motion can also take actions to notify you if needed. Creation of automated snapshots is also possible. These are the options that can be used in the config file. They are overridden by the commandline! All number values are integer numbers (no decimals allowed). Boolean options can be on or off (values "1", "yes" and "on" all means true and any other value means false). Motion responds to the following signals: Motion homepage: http://motion.sourceforge.net/ Motion Guide (user and installation guide): Jeroen Vreeken (firstname.lastname@example.org), Folkert van Heusden, Kenneth Lavrsen (email@example.com)
motion [ -hmns ] [ -c config file path ] [ -d log level ] [ -k log type ] [ -p process_id_file ] [ -l logfile ]
Config File Options
Detect motion in predefined areas (1 - 9). Areas are numbered like that: 1 2 3
A script (on_area_detected) is started immediately when motion is 4 5 6
detected in one of the given areas, but only once during an event. 7 8 9
One or more areas can be specified with this option. Take care: This option does NOT restrict detection to these areas! (Default: not defined)
Let motion regulate the brightness of a video device. Only recommended for cameras without auto brightness
The brightness level for the video device.
The contrast level for the video device.
Start in daemon (background) mode and release terminal. This option must be placed in motion.conf and not in a thread config file.
Name of the database.
IP address or domain name for the database server. Use "localhost" if motion and database runs on the same server.
The database password.
The database server port number.
The database type ( mysql , postgresql ).
The database user name.
Despeckle motion image using combinations of (E/e)rode or (D/d)ilate. And ending with optional (l)abeling.
Picture are saved continuously as if motion was detected all the time.
Event Gap is the seconds of no motion detection that triggers the end of an event. An event is defined as a series of motion images taken within a short timeframe.
Text to include in a JPEG EXIF comment , may be any text, including conversion specifiers. The EXIF timestamp is included independent of this text.
pipe raw video to generally - 'STDIN', allowing to use an external video encoder.
e.g. using memcoder :
extpipe mencoder -demuxer rawvideo -rawvideo w=320:h=240:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt: threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %fps
Bitrate of movies produced by ffmpeg. Bitrate is bits per second. Default: 400000 (400kbps). Higher value mans better quality and larger files. Option requires that ffmpeg libraries are installed.
Use ffmpeg libraries to encode motion type movies where you only see the pixels that changes.
Use ffmpeg libraries to encode movies in realtime.
Use ffmpeg to deinterlace video. Necessary if you use an analog camera and see horizontal combing on moving objects in video or pictures.
Create a timelapse movie saving a picture frame at the interval in seconds set by this parameter. Set it to 0 if not used.
The file rollover mode of the timelapse video.
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.
Codec to be used by ffmpeg for the video compression. Timelapse movies are always made in mpeg1 format independent from this option.
Maximum number of frames to be captured from the camera per second.
The frequency to set the tuner to (kHz). Valid range: per tuner spec, default: 0 (Don't set it)
The height of each frame in pixels.
The hue level for the video device.
Input channel to use expressed as an integer number starting from -1. Should normally be set to 1 for video/TV cards, and -1 for USB cameras.
Enable or disable IPV6 for http control and stream.
Ignore sudden massive light intensity changes given as a percentage of the picture area that changed intensity.
Locate and draw a box around the moving object. Value 'preview' makes Motion only draw a box on a saved preview jpeg image and not on the saved movie.
Use a file to save logs messages, if not defined stderr and syslog is used.
Use a file to save logs messages, if not defined stderr and syslog is used. ( if syslog is set then will log to stderr and syslog )
Level of log messages [1..9] (EMR, ALR, CRT, ERR, WRN, NTC, ERR, DBG, ALL). (default: 6 / NTC).
Filter to log messages by type (STR, ENC, NET, DBL, EVT, TRK, VID, ALL).
PGM file to use as a sensitivity mask. This picture MUST have the same width and height as the frames being captured and be in binary format.
The maximum length of a movie in seconds. Set this to zero for unlimited length.
Minimum time in seconds between the capturing picture frames from the camera. Default: 0 = disabled - the capture rate is given by the camera framerate.
Picture frames must contain motion at least the specified number of frames in a row before they are detected as true motion. At the default of 1, all motion is detected. Valid range is 1 to thousands, but it is recommended to keep it within 1-5.
The video4linux video loopback input device for motion images. If a particular pipe is to be used then use the device filename of this pipe, if a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe. Default: not set
File path for motion triggered ffmpeg movies relative to target_dir. This was previously called ffmpeg_filename.
Set less strict jpeg checks for network cameras with a poor/buggy firmware.
The setting for keep-alive of network socket, should improve performance on compatible net cameras.
URL to use for a netcam proxy server, if required. The syntax is http://myproxy:portnumber
Specify an url to a downloadable jpeg file or raw mjpeg stream to use as input device. Such as an AXIS 2100 network camera.
http:// ftp:// mjpg:// or file:/// ( mjpg:// is for network cameras with codec mjpeg ).
For network cameras protected by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication.
The noise level is used as a threshold for distinguishing between noise and motion.
Activates the automatic tuning of noise level.
Select the norm of the video device. Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL)
Command to be executed when motion in a predefined area is detected, check option area_detect.
Command to be executed when a camera can't be opened or if it is lost. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command.
Command to be executed when an event ends after a period of no motion. The period of no motion is defined by option event_gap. You can use Conversion Specifiers and spaces as part of the command.
Command to be executed when an event starts. An event starts at first motion detected after a period of no motion defined by event_gap. You can use ConversionSpecifiers and spaces as part of the command.
Command to be executed when a motion frame is detected. You can use Conversion Specifiers and spaces as part of the command.
Command to be executed when an ffmpeg movie is closed at the end of an event. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command.
Command to be executed when a movie is created. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command.
Command to be executed when an image is saved. You can use Conversion Specifiers and spaces as part of the command. Use %f for passing filename (with full path) to the command.
Output pictures with only the moving object. This feature generates the special motion type movies where you only see the pixels that changes as a graytone image. If labelling is enabled you see the largest area in blue. Smartmask is shown in red.
Normal image is an image that is stored when motion is detected. It is the same image that was taken by the camera. I.e. not a motion image like defined by output_motion. Default is that normal images are stored.
File path for motion triggered images (jpeg or ppm) relative to target_dir. Value 'preview' makes a jpeg filename with the same name body as the associated saved movie file.
Type of images motion will trigger when motion is detected.
Specifies the number of frames to be captured after motion has been detected.
Specifies the number of previous frames to be outputted at motion detection. Recommended range: 0 to 5, default=0. Do not use large values! Large values will cause Motion to skip video frames and cause unsmooth movies. To smooth movies use larger values of post_capture instead.
File to store the process ID, also called pid file. Recommended value when used: /var/run/motion.pid
The quality for the jpeg images in percent.
Be quiet, don't output beeps when detecting motion.
Rotate image the given number of degrees. The rotation affects all saved images as well as movies.
Specifies the number of frames to capture before switching inputs, this way also slow switching (e.g. every second) is possible.
Specifies the number of frames to skip after a switch. (1 if you are feeling lucky, 2 if you want to be safe).
The colour saturation level for the video device.
Number of motion thread to show in SDL Window (default: 0 = disabled)
Run Motion in setup mode.
Slugginess of the smart mask. Default is 0 = DISABLED. 1 is slow, 10 is fast.
File path for snapshots (jpeg or ppm) relative to target_dir.
Make automated snapshots every 'snapshot_interval' seconds.
Log to the database when creating motion triggered image file.
Log to the database when creating motion triggered movie file.
Log to the database when creating a snapshot image file.
Log to the database when creating timelapse movie file
SQL query string that is sent to the database. The values for each field are given by using convertion specifiers
Set the authentication method for stream.
Authentication for the stream.
Limit the number of frames to number frames. After 'stream_limit' number of frames the connection will be closed by motion. The value 0 means unlimited.
Limits the access to the stream to the localhost.
Limit the framerate of the stream in frames per second. Default is 1. Set the value to 100 for practically unlimited.
If set to 'on' Motion sends slows down the stream to 1 picture per second when no motion is detected. When motion is detected the stream runs as defined by stream_maxrate. When 'off' the stream always runs as defined by stream_maxrate.
TCP port on which motion will listen for incoming connects with its stream server.
Quality setting in percent for the mjpeg picture frames transferred over the stream connection. Keep it low to restrict needed bandwidth.
Turns the switch filter on or off. The filter can distinguish between most switching noise and real motion. With this you can even set roundrobin_skip to 1 without generating much false detection.
Target directory for picture and movie files.
Turns the text showing changed pixels on/off.
Draw characters at twice normal size on images.
This option defines the value of the special event conversion specifier %C. You can use any conversion specifier in this option except %C. Date and time values are from the timestamp of the first image in the current event.
User defined text overlayed on each in the lower left corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # < > | , . : - + _ 0and conversion specifiers (codes starting by a %).
User defined text overlayed on each in the lower right corner. Use A-Z, a-z, 0-9, " / ( ) @ ~ # < > | , . : - + _ 0and conversion specifiers (codes starting by a %). Default: %Y-%m-%d0T = date in ISO format and time in 24 hour clock
Specifies full path and filename for a thread config file. Each camera needs a thread config file containing the options that are unique to the camera. If you only have one camera you do not need thread config files. If you have two or more cameras you need one thread config file for each camera in addition to motion.conf. This option must be placed in motion.conf and not in a thread config file.
Threshold for declaring motion. The threshold is the number of changed pixels counted after noise filtering, masking, despeckle, and labelling.
Activates the automatic tuning of threshold level.
File path for timelapse movies relative to target_dir (ffmpeg only).
Enable auto tracking
Use this option if you have an iomojo smilecam connected to the serial port instead of a general stepper motor controller.
The maximum position for servo x.
The maximum position for servo y.
The motor number that is used for controlling the x-axis.
The motor number that is used for controlling the y-axis.
Delay during which tracking is disabled after auto tracking has moved the camera. Delay is defined as number of picture frames.
This is the device name of the serial port to which the stepper motor interface is connected.
Speed to set the motor to.
Angle in degrees the camera moves per step on the X-axis with auto tracking. Currently only used with pwc type cameras.
Angle in degrees the camera moves per step on the Y-axis with auto tracking. Currently only used with pwc type cameras.
Number of steps to make.
Type of tracker.
The tuner device used for controlling the tuner in a tuner card. This option is only used when Motion is compiled for FreeBSD.
Enables extpipe to use an external video encoder feeding with YUV420 using a pipe .
Allow to choose preferable palette to be use by motion to capture from those supported by your videodevice.
The video4linux video loopback input device for normal images. If a particular pipe is to be used then use the device filename of this pipe. If a dash '-' is given motion will use /proc/video/vloopback/vloopbacks to locate a free pipe.
The video device to be used for capturing. Default for Linux is /dev/video0. for FreeBSD the default is /dev/bktr0.
To protect HTTP Control by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username: password. Do not specify this option for no authentication. This option must be placed in motion.conf and not in a thread config file.
Enable HTML in the answer sent back to a browser connecting to the webcontrol_port. This option must be placed in motion.conf and not in a thread config file.
Limits the webcontrol to the localhost. This option must be placed in motion.conf and not in a thread config file.
Sets the port number for the http (html using browser) based remote webcontrol. This option must be placed in motion.conf and not in a thread config file.
The width in pixels of each frame. Valid range is camera dependent.
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/)
If you have write access to /usr/local/etc then the editor recommends having only one motion.conf file in the default /usr/local/etc/ directory.
Motion has a configuration file in the distribution package called motion-dist.conf. When you run 'make install' this files gets copied to the /usr/local/etc 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 in a very elegant way and the way to do it is to create a number of thread config files. Motion will then create an extra tread of itself for each camera. If you only have one camera you only need the motion.conf file. The minute you have two or more cameras you must have one thread config file per camera besides the motion.conf file.
So if you have for example two cameras you need motion.conf and two thread config files. Total of 3 config files.
An option that is common to all cameras can be placed in motion.conf. (You can also put all parameters in the thread 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 thread file.
The first camera is defined in the first thread file called from motion.conf. The 2nd camera is defined in the 2nd thread 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 thread config file.
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 "thread" is defined in motion.conf, the thread 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 thread config file.
4. Motion reads the command line option again overruling any previously defined options.
So always call the thread config files in the end of the motion.conf file. If you define options in motion.conf AFTER the thread file calls, the same options in the thread files will never be used. So always put the thread file call at the end of motion.conf.
If motion is built without specific features such as ffmpeg, mysql etc it will ignore the options that belongs to these features. You do not have to remove them or comment them out.
If you run the webcontrol command http://host:port/0/config/writeyes, motion will overwrite motion.conf and all the thread.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.
In text_left and text_right you can additionally use '0 for new line.
Motion uses a video4linux device to detect motion. If motion is detected both normal and motion pictures will be taken. Motion can also take actions to notify you if needed. Creation of automated snapshots is also possible.
These are the options that can be used in the config file. They are overridden by the commandline! All number values are integer numbers (no decimals allowed). Boolean options can be on or off (values "1", "yes" and "on" all means true and any other value means false).
Motion responds to the following signals:
Motion homepage: http://motion.sourceforge.net/
Motion Guide (user and installation guide):
Jeroen Vreeken (firstname.lastname@example.org), Folkert van Heusden, Kenneth Lavrsen (email@example.com)