table of contents
MOTION(1) | Motion Options and Config Files | MOTION(1) |
NAME¶
motion - Detect motion using a video4linux device or network cameraSYNOPSIS¶
motion [ -hbnsm ] [ -c config file path ] [ -d level ] [ -k level ] [ -p process_id_file ][ -l log_file ]DESCRIPTION¶
Motion uses a video4linux device or network camera to detect motion. If motion is detected both normal and motion pictures can be taken. Motion can also take actions to notify you if needed. Creation of automated snapshots is also possible.OPTIONS¶
- -c
- Full path and filename of config file. For example: /home/kurt/motion.conf The default is /usr/local/etc/motion unless specified differently when building Motion. Many RPMs and Debian packages will use /etc or /etc/motion as the default.
- -h
- Show help screen.
- -b
- Run in daemon mode.
- -n
- Run in non-daemon mode.
- -s
- Run in setup mode. Also forces non-daemon mode.
- -d
- Run with message log level 1-9.
- -k
- Run with message log type 1-9.
- -l
- Full path and file name for the log file.
- -p
- Full path and filename for process id file (pid file). E.g /var/run/motion.pid. Default is not defined. Pid file is only created when Motion is started in daemon mode.
- -m
- Start in pause mode.
CONFIG FILE OPTIONS¶
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).- daemon
Values: on/off Default: off Description:
- process_id_file
Values: User specified string Default: Not defined Description:
- setup_mode
Values: on/off Default: off Description:
- logfile
Values: User specified string Default: Not Defined Description:
- log_level
Values: 1 to 9 (EMG, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL) Default: 6 / NTC Description:
- log_type
Values: COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL Default: ALL Description:
- camera_id
Values: Numeric identification number for the camera Default: The order in which the camera is opened by Motion Description:
- camera_name
Values: User specified string Default: Not Defined Description:
- videodevice
Values: User specified string Default: /dev/video0 Description:
- v4l2_palette
Values: 0 to 17
V4L2_PIX_FMT_SN9C10X : 0 'S910' V4L2_PIX_FMT_SBGGR16 : 1 'BYR2' V4L2_PIX_FMT_SBGGR8 : 2 'BA81' V4L2_PIX_FMT_SPCA561 : 3 'S561' V4L2_PIX_FMT_SGBRG8 : 4 'GBRG' V4L2_PIX_FMT_SGRBG8 : 5 'GRBG' V4L2_PIX_FMT_PAC207 : 6 'P207' V4L2_PIX_FMT_PJPG : 7 'PJPG' V4L2_PIX_FMT_MJPEG : 8 'MJPEG' V4L2_PIX_FMT_JPEG : 9 'JPEG' V4L2_PIX_FMT_RGB24 : 10 'RGB3' V4L2_PIX_FMT_SPCA501 : 11 'S501' V4L2_PIX_FMT_SPCA505 : 12 'S505' V4L2_PIX_FMT_SPCA508 : 13 'S508' V4L2_PIX_FMT_UYVY : 14 'UYVY' V4L2_PIX_FMT_YUYV : 15 'YUYV' V4L2_PIX_FMT_YUV422P : 16 '422P' V4L2_PIX_FMT_YUV420 : 17 'YU12' V4L2_PIX_FMT_Y10 : 18 'Y10' V4L2_PIX_FMT_Y12 : 19 'Y12' V4L2_PIX_FMT_GREY : 20 'GREY' V4L2_PIX_FMT_H264 : 21 'H264'
Default: 17 Description:
- tunerdevice
Values: User Specified String Default: /dev/tuner0 Description:
- input
Values:
-1 : USB Cameras 0 : video/TV cards or uvideo(4) on OpenBSD 1 : video/TV cards
Default: -1 Description:
- norm
Values:
0 (PAL) 1 (NTSC) 2 (SECAM) 3 (PAL NC no colour)
Default: 0 (PAL) Description:
- frequency
Values: Dependent upon video device Default: 0 Description:
- power_line_frequency
Values:
-1 : Do not modify device setting 0 : Power line frequency Disabled 1 : 50hz 2 : 60hz 3 : Auto
Default: -1 Description:
- rotate
Values: 0, 90, 180, 270 Default: 0 Description:
- flip_axis
Values: none, v, h Default: none Description:
- width
Values: Dependent upon video device Default: 352 Description:
- height
Values: Dependent upon video device Default: off Description:
- framerate
Values: 2 - 100 Default: 100 Description:
- minimum_frame_time
Values: 0 to unlimited Default: 0 Description:
- netcam_url
Values: User specified string Default: None Description:
The connection string is camera specific. It is usually the same as what other video playing applications would use to connect to the camera stream. Motion currently only supports basic authentication for the cameras. Digest is not currently supported. Basic authentication can be specified in the URL or via the netcam_userpass option.
- netcam_highres
Values: User specified string Default: None Description:
The connection string is camera specific. It is usually the same as what other video playing applications would use to connect to the camera stream. Motion currently only supports basic authentication for the cameras. Digest is not currently supported. Basic authentication can be specified in the URL or via the netcam_userpass option.
- netcam_userpass
Values: User specified string Default: Not Defined Description:
- netcam_keepalive
Values:
Default: off Description:
- netcam_proxy
Values: User specified string Default: Not defined Description:
- netcam_tolerant_check
Values: on/off Default: off Description:
- rtsp_uses_tcp
Values: on/off Default: on Description:
- mmalcam_name
Values: User specified string Default: Not defined Description:
- mmalcam_control_params
Values: User specified string Default: Not defined Description:
- auto_brightness
Values: on/off Default: off Description:
- brightness
Values: 0 to 255 Default: 0 (Disabled) Description:
- contrast
Values: 0 to 255 Default: 0 (Disabled) Description:
- saturation
Values: 0 to 255 Default: 0 (Disabled) Description:
- hue
Values: 0 to 255 Default: 0 (Disabled) Description:
- roundrobin_frames
Values: 1 to unlimited Default: 1 Description:
- roundrobin_skip
Values: 1 to unlimited Default: 1 Description:
- switchfilter
Values: on/off Default: off Description:
- threshold
Values: 1 to unlimited Default: 1500 Description:
- threshold_tune
Values: on/off Default: off Description:
- noise_level
Values: 1 to unlimited Default: 32 Description:
- noise_tune
Values: on/off Default: on Description:
- despeckle_filter
Values:
e/E : erode d/D : dilate l : label
Default: EedDl Description:
- area_detect
Values: 1 to 9 Default: Not Defined Description:
- mask_file
Values: User specified string Default: Not defined Description:
- mask_privacy
Values: User specified string Default: Not defined Description:
- smart_mask_speed
Values: 0 to 10 Default: 0 (off) Description:
- lightswitch
Values: 0 to 100 Default: 0 Description:
- minimum_motion_frames
Values: 1 to unlimited Default: 1 Description:
- pre_capture
Values: 0 to unlimited Default: 0 Description:
- post_capture
Values: 0 to unlimited Default: 0 Description:
- event_gap
Values: -1 to unlimited Default: 60 Description:
- max_movie_time
Values: 0 to unlimited Default: 0 Description:
- emulate_motion
Values: on/off Default: off Description:
- output_pictures
Values: on, off, first, best, center Default: on Description:
- output_debug_pictures
Values: on/off Default: off Description:
- quality
Values: 1 to 100 Default: 75 Description:
- picture_type
Values: jpeg/ppm/webp Default: jpeg Description:
- ffmpeg_output_movies
Values: on/off Default: off Description:
- ffmpeg_output_debug_movies
Values: on/off Default: off Description:
- ffmpeg_bps
Values: 0 to unlimited Default: 400000 Description:
- ffmpeg_variable_bitrate
Values: 0 to 100 Default: 0 Description:
- ffmpeg_video_codec
Values:
Motion videos:
mpeg4 - Creates .avi file msmpeg4 - Creates .avi file swf - Flash film with extension .swf flv - Flash video with extension .flv ffv1 - FF video codec 1 for Lossless Encoding mov - QuickTime mp4 - MPEG-4 Part 14 H264 encoding mkv - Matroska H264 encoding hevc - H.265 / HEVC (High Efficiency Video Coding)
Default: mpeg4 Description:
- ffmpeg_duplicate_frames
Values: on/off Default: off Description:
- timelapse_fps
Values: 0 to unlimited Default: 30 Description:
- timelapse_interval
Values: 0 to unlimited Default: 0 Description:
- timelapse_mode
Values:
hourly
daily
weekly-sunday
weekly-monday
monthly
manual
Default: daily Description:
- timelapse_codec
Values:
mpg - Creates mpg file with mpeg-2 encoding. mpeg4 - Creates avi file with the default encoding.
Default: mpg Description:
- use_extpipe
Values: on/off Default: off Description:
- extpipe
Values: User specified string Default: Not defined Description:
- snapshot_interval
Values: 0 to unlimited Default: 0 Description:
- locate_motion_mode
Values: on/off/preview Default: off Description:
- locate_motion_style
Values:
Default: box Description:
- text_right
Values: User specified string Default: %Y-%m-%d0T-%q Description:
- text_left
Values: User specified string Default: CAMERA %t Description:
- text_changes
Values: on/off Default: off Description:
- text_event
Values: User specified string Default: %Y%m%d%H%M%S Description:
- text_double
Values: on/off Default: off Description:
- exif_text
Values: User specified string Default: Not defined Description:
- target_dir
Values: User specified string Default: Not defined Description:
- snapshot_filename
Values: User specified string Default: %v-%Y%m%d%H%M%S-snapshot Description:
- picture_filename
Values: User specified string Default: %v-%Y%m%d%H%M%S-%q Description:
- movie_filename
Values: User specified string Default: %v-%Y%m%d%H%M%S Description:
- timelapse_filename
Values: User specified string Default: %Y%m%d-timelapse Description:
- ipv6_enabled
Values: on/off Default: off Description:
- stream_port
Values: 0 to port number limit Default: 0 Description:
- substream_port
Values: 0 to port number limit Default: 0 Description:
- stream_quality
Values: 1 to 100 Default: 50 Description:
- stream_motion
Values: on/off Default: off Description:
- stream_maxrate
Values: 1 to unlimited Default: 1 Description:
- stream_localhost
Values: on/off Default: off Description:
- stream_limit
Values: 0 to unlimited Default: 0 Description:
- stream_auth_method
Values:
0 = disabled 1 = Basic authentication 2 = MD5 digest (the safer authentication)
Default: 0 Description:
- stream_authentication
Values: User specified string Default: Not defined Description:
- stream_preview_scale
Values: 1 to 100 Default: 25 Description:
- stream_preview_newline
Values: yes/no Default: no Description:
- webcontrol_port
Values: 0 to maximum port number Default: 0 Description:
- webcontrol_localhost
Values: on/off Default: off Description:
- webcontrol_html_output
Values: on/off Default: on Description:
- webcontrol_authentication
Values:
The username and password to use for authentication of the webcontrol. The format is Username:Password
- webcontrol_parms
Values:
0 = No parameters available to change on web control 1 = Limited list of parameters available to change 2 = Advanced list of parameters (usually requires restart to become effective) 3 = Restricted list of parameters (User IDs, passwords, commands to execute, etc)
Default: 0 Description:
- track_type
Values:
0 = none 1 = stepper 2 = iomojo 3 = pwc 4 = generic 5 = uvcvideo 6 = servo
Default: 0 Description:
- track_auto
Values: on/off Default: off Description:
- track_port
Values: User specified string Default: Not defined Description:
- Tracking options
track_motorx, track_motorx_reverse, track_motory, track_motory_reverse track_maxx, track_minx, track_maxy, track_miny, track_homex, track_homey track_iomojo_id, track_step_angle_x, track_step_angle_y, track_move_wait track_speed, track_stepsize
Values: device dependent Default: 0 Description:
- quiet
Values: on/off Default: on Description:
- Script Options
on_event_start, on_event_end, on_picture_save on_motion_detected, on_area_detected, on_movie_start on_movie_end, on_camera_lost, on_camera_found
Values: User defined string Default: Not defined Description:
- sql_log_picture
Values: on/off Default: on Description:
- sql_log_snapshot
Values: on/off Default: on Description:
- sql_log_movie
Values: on/off Default: off Description:
- sql_log_timelapse
Values: on/off Default: off Description:
- sql_query
Values: User defined string Default: Not defined Description:
- sql_query_start
Values: User defined string Default: Not defined Description:
- database_type
Values: mysql, postgresql, sqlite3 Default: Not defined Description:
- database_dbname
Values: User defined string Default: Not defined Description:
- database_host
Values: User defined string Default: Not Defined Description:
- database_user
Values: User defined string Default: Not Defined Description:
- database_password
Values: User defined string Default: Not Defined Description:
- database_port
Values: 0 to maximum port number Default: Not defined Description:
- database_busy_timeout
Values: 0 to unlimited Default: 0 Description:
- video_pipe
Values: User specified string Default: Not Defined Description:
- motion_video_pipe
Values: User specified string Default: Not Defined Description:
- camera_dir
Values: User specified string Default: Not Defined Description:
- camera
Values: User specified string Default: Not Defined Description:
SIGNALS¶
Motion responds to the following signals:- SIGHUP
- The config file will be reread.
- SIGTERM
- If needed motion will create an movie file of the last event and exit
- SIGUSR1
- Motion will create an movie file of the current event.
NOTES¶
- Snapshot
- A snapshot is a picture taken at regular intervals independently of any movement in the picture.
- Motion image
- A "motion" image/movie shows the pixels that have actually changed during the last frames. These pictures are not very useful for normal presentation to the public but they are quite useful for testing and tuning and making mask files as you can see exactly where motion sees something moving. Motion is shown in greytones. If labelling is enabled the largest area is marked as blue. Smart mask is shown in read.
- Normal image
- A "normal" image is the real image taken by the camera with text overlayed.
- Cameras and config 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 motion/ subdirectory inside 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/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 files 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 in a very elegant way and the way to do it is to create a number of camera 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 camera config file per camera besides the motion.conf file.
So if you have for example two cameras you need motion.conf and two camera 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 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.
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.
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.
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 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. - Conversion Specifiers for Advanced Filename and Text Features
- The table below shows all the supported Conversion Specifiers you can use
in the options text_left, text_right, snapshot_filename, jpeg_filename,
ffmpeg_filename, timelapse_filename, on_event_start, on_event_end,
on_picture_save, on_movie_start, on_movie_end, and on_motion_detected.
In text_left and text_right you can additionally use '\n' for new line. - %a
- The abbreviated weekday name according to the current locale.
- %A
- The full weekday name according to the current locale.
- %b
- The abbreviated month name according to the current locale.
- %B
- The full month name according to the current locale.
- %c
- The preferred date and time representation for the current locale.
- %C
- Text defined by the text_event feature
- %d
- The day of the month as a decimal number (range 01 to 31).
- %D
- Number of pixels detected as Motion. If labelling is enabled the number is the number of pixels in the largest labelled motion area.
- %E
- Modifier: use alternative format, see below.
- %f
- File name - used in the on_picture_save, on_movie_start, on_movie_end, and sql_query features.
- %F
- Equivalent to %Y-%m-%d (the ISO 8601 date format).
- %H
- The hour as a decimal number using a 24-hour clock (range 00 to 23).
- %i
- Width of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate is on).
- %I
- The hour as a decimal number using a 12-hour clock (range 01 to 12).
- %j
- The day of the year as a decimal number (range 001 to 366).
- %J
- Height of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate is on).
- %k
- The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.)
- %K
- X coordinate in pixels of the center point of motion. Origin is upper left corner.
- %l
- The hour (12-hour clock) as a decimal number (range 1 to 12); single digits are preceded by a blank. (See also %I.)
- %L
- Y coordinate in pixels of the center point of motion. Origin is upper left corner and number is positive moving downwards (I may change this soon).
- %m
- The month as a decimal number (range 01 to 12).
- %M
- The minute as a decimal number (range 00 to 59).
- %n
- Filetype as used in the on_picture_save, on_movie_start, on_movie_end, and sql_query features.
- %N
- Noise level.
- %o
- Threshold. The number of detected pixels required to trigger motion. When threshold_tune is 'on' this can be used to show the current tuned value of threshold.
- %p
- Either 'AM' or 'PM' according to the given time value, or the corresponding strings for the current locale. Noon is treated as `pm' and midnight as `am'.
- %P
- Like %p but in lowercase: `am' or `pm' or a corresponding string for the current locale.
- %q
- Picture frame number within current second. For jpeg filenames this should always be included in the filename if you save more then 1 picture per second to ensure unique filenames. It is not needed in filenames for mpegs.
- %Q
- Number of detected labels found by the despeckle feature
- %r
- The time in a.m. or p.m. notation.
- %R
- The time in 24-hour notation (%H:%M).
- %s
- The number of seconds since the Epoch, i.e., since 1970-01-01 00:00:00 UTC.
- %S
- The second as a decimal number (range 00 to 61).
- %t
- Camera ID number
- %T
- The time in 24-hour notation (%H:%M:%S).
- %u
- The day of the week as a decimal, range 1 to 7, Monday being 1. See also %w.
- %U
- The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01. See also %V and %W.
- %v
- Event number. An event is a series of motion detections happening with less than 'gap' seconds between them.
- %V
- The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. See also %U and %W.
- %w
- The day of the week as a decimal, range 0 to 6, Sunday being 0. See also %u.
- %W
- The week number of the current year as a decimal number, range 00 to 53, starting with the first Monday as the first day of week 01.
- %x
- The preferred date representation for the current locale without the time.
- %X
- The preferred time representation for the current locale without the date.
- %y
- The year as a decimal number without a century (range 00 to 99).
- %Y
- The year as a decimal number including the century.
- %z
- The time-zone as hour offset from GMT.
- %Z
- The time zone or name or abbreviation.
- %$
- The camera name.
- %{host}
- The computer host name
- %{fps}
- The frame per seconds.
- %{dbeventid}
- The id number returned from mysql_insert_id.
- More information
- Motion homepage: https://motion-project.github.io/
Motion Guide (user and installation guide):
AUTHORS¶
Jeroen Vreeken (pe1rxq@amsat.org), Folkert van Heusden, Kenneth Lavrsen (kenneth@lavrsen.dk), Juan Angulo Moreno <juan@apuntale.com>, the motion-project team, and many others2017-11-05 | Motion |