Motion

# Configuration

## Configuration Options-Listed by Topic

Configuration options sorted by topic.

System Processing-General Info

daemon | pid_file | log_file | log_level
log_fflevel | log_type | native_language | target_dir

General Device Parameters

device_name | device_id | device_tmo | pause
| schedule_params | cleandir_params | watchdog_tmo | watchdog_kill
camera | config_dir

Camera Source Parameters

v4l2_device | v4l2_params | libcam_device | libcam_params
netcam_url | netcam_params | netcam_high_url | netcam_high_params
netcam_userpass

Image Processing-General Info

width | height | framerate | text_event
rotate | flip_axis | locate_motion_mode | locate_motion_style
text_left | text_right | text_changes | text_scale

Motion Detection-General Info

emulate_motion | threshold | threshold_maximum | threshold_tune
secondary_method | secondary_params | noise_level | noise_tune
despeckle_filter | area_detect | mask_file | mask_privacy
smart_mask_speed | lightswitch_percent | lightswitch_frames | minimum_motion_frames
event_gap | pre_capture | post_capture | static_object_time

Script Execution-General Info

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 | on_secondary_detect | on_action_user | on_sound_alert

Pictures-General Info

picture_output | picture_output_motion | picture_type | picture_quality
picture_exif | picture_filename | snapshot_interval | snapshot_filename

Movies-General Info

movie_output | movie_output_motion | movie_max_time | movie_bps
movie_quality | movie_container | movie_retain | movie_passthrough
movie_filename | movie_extpipe_use | movie_extpipe | movie_all_frames
timelapse_filename | timelapse_interval | timelapse_mode | timelapse_container
timelapse_fps

Pipes-General Info

video_pipe | video_pipe_motion

Webcontrol-General Info

webcontrol_port | webcontrol_ipv6 | webcontrol_localhost | webcontrol_access
webcontrol_interface | webcontrol_auth_method | webcontrol_auth_admin | webcontrol_auth_user
webcontrol_tls | webcontrol_cert | webcontrol_key | webcontrol_headers
webcontrol_actions | webcontrol_html | webcontrol_base_path | webcontrol_lock_attempts
webcontrol_lock_minutes | webcontrol_lock_script

Live Stream-General Info

stream_preview_scale | stream_preview_newline | stream_allcam_params | stream_preview_method
stream_preview_ptz | stream_quality | stream_grey | stream_maxrate
stream_motion | stream_scan_time | stream_scan_scale

Database-General Info

database_type | database_dbname | database_host | database_port
database_user | database_password | database_busy_timeout | sql_event_end
sql_event_start | sql_movie_end | sql_movie_start | sql_pic_save

Tracking-General Info

ptz_auto_track | ptz_wait | ptz_move_track | ptz_pan_left
ptz_pan_right | ptz_tilt_up | ptz_tilt_down | ptz_zoom_in
ptz_zoom_out

Sound Detection

snd_device | snd_params | snd_alerts | snd_window
snd_show

## Configuration Options-Detail Descriptions

The following section provides detailed descriptions of each of the configuration options.

### Conversion Specifiers

%Y | year | %m | month | %d | day
%H | hour | %M | minute | %S | second
%T | HH:MM:SS | %v | event | %q | frame number
%t | device id number | %D | changed pixels | %N | noise level
%w | width of the image | %h | height of the image | %i | width of motion area
%J | height of motion area | %K | X coordinates of motion center | %L | Y coordinates of motion center
%C | value defined by text_event | %f | filename with full path | %n | number indicating filetype
%o | threshold | %Q | Number of labels from despeckle | %{eventid} | Unique identifier for event (cam id + date/time)
%$ | device name | %{fps} | current frames per second | %{host} | name of computer running Motion
%{ver} | version of Motion | %{trig_nbr} | sound alert number that was triggered | %{trig_nm} | sound alert name that was triggered
%{trig_freq} | frequency that triggered the sound alert | %{movienbr} | id number for the movie within the event

The use of quotation marks around string is permitted. In addition to the above, the conversion specifiers include the same options as for the C function strftime (3).

### System Processing

### daemon

- Values: on, off | Default: off
Run in daemon mode. When running Motion under systemd specify as off.

### pid_file

- Values: String | Default: Not defined
The full path and name of the process id file.

### log_file

- Values: String | Default: Not defined
The full path and name for the log file. When not specified, use syslog.

### log_level

- Values: 1 - 9 | Default: 6
Verbosity level(EMR, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL) of messages.
At the DBG Level(8) and higher:
Additional values related to the trigger, motion, precap and postcap are overlayed on the images.
Additional information regarding the available parameters to libcamera are printed to the log.
Additional information regarding the available parameters to v4l2 devices is printed to the log.
If a secondary detection algorithms is specified:
The image sent to the secondary algorithm for detection will be saved to the target directory with the name src_"algorithm".jpg e.g. src_haar.jpg
If the secondary algorithm is triggered by the image, the resulting image will be saved into the target directory with the name detect_"algorithm".jpg e.g. detect_haar.jpg

### log_fflevel

- Values: 1 - 9 | Default: 3
Verbosity level of ffmpeg messages.

- 1 = AV_LOG_QUIET
- 2 = AV_LOG_PANIC
- 3 = AV_LOG_FATAL
- 4 = AV_LOG_ERROR
- 5 = AV_LOG_WARNING
- 6 = AV_LOG_INFO
- 7 = AV_LOG_VERBOSE
- 8 = AV_LOG_DEBUG
- 9 = AV_LOG_TRACE

### log_type

- Values: COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL | Default: ALL
The component for which to log messages.

### native_language

- Values: on, off | Default: on
Enable native language messages.

### target_dir

- Values: String
The full path for the target directory for pictures, snapshots, movies, etc. to be saved.

Default: The sub directory of lib/motion/media from the directory defined by --localstatedir=DIR during the configure step of installation. If this was not defined, it will default to /var/lib/motion/media or /usr/local/var/lib/motion/media depending upon your system

### device_name

- Values: String | Default: Not defined
The device name to be used in the format specifiers and web interface.

### device_id

- Values: 1 - 32000 | Default: The sequence that the device file is read
Unique numeric id for the device.

### device_tmo

- Values: Integer | Default: 30
Number of seconds that elapse before the device is deemed to be lost.

### pause

- Values: Boolean | Default: false
- Values: on, off, schedule | Default: schedule
Use 'on' and 'off' to pause or enable motion detection respectively. Use 'schedule' to allow the schedule process to pause or enable detection.

### schedule_params

- Values: String | Default: Not Defined
Comma separated list of configuration parameters. Format is: option=value,option2=value2

This parameter specifies the time of the day that Motion will perform motion detection. To use this, the pause parameter must be set to schedule.

#### default

Boolean specifying the default for the motion detection. The times specified for the other parameters will then indicate the times for the inverse of this option. For example, if the default is specified as `on`, then motion detection will be on by default and the times specified will have motion detection turned off. And if the default is specified as `off` the times specified would indicate when motion detection would be on.

#### action

This parameter has the option values of `pause` or `stop`. When the `pause` value is specified the motion detection is paused and the camera will continue to process images. This will allow the webcontrol to continue to show images. When this option is specified as `stop`, the camera will be shut down and therefore images will not be available via the webcontrol.

#### sun, mon, tue, wed, thu, fri, sat

These parameters specify the day and the values specify the time period. The time period is specified in the format `hhmm-hhmm` where the first `hhmm` specifies the start time and the second `hhmm` is the end time. If the hours or minutes is less than 10, leading zeros must be included. Each time value is also inclusive meaning that the criteria is greater than or equal or less than or equal. For multiple time periods during the same day specify the parameter multiple times. For example, `wed=0905-1130,wed=1330-1605`.

#### params_file

- Values: String | Default: Not Defined
Full path and file name for a file containing the params listed one per line.

### cleandir_params

- Values: String | Default: Not Defined
Comma separated list of configuration parameters. Format is: option=value,option2=value2

This parameter specifies the information used for purging older recording and pictures created by Motion. This option is only applicable if a database has been specified. The default for this parameter is an empty string which means that no clean directory actions will be performed.

#### action

String specifying either `delete` or `script`. If the option of `script` is specified, then the provided script will be executed at the specified interval. If the option of `delete` is specified, then all files that were created by Motion will be deleted from the system according to the schedule. The default for this parameter is `delete`

#### freq

This parameter specifies the frequency that the clean directory will be run. Valid options for this parameter are `hourly`, `daily` or `weekly`. The default value for this parameter is `weekly`.

#### runtime

This parameter specifies the timing for running the clean directory actions. The format of this value varies depending upon the frequency specified.

- `hourly` | Specify the minute of the hour using the format mm. e.g. 05 for 5 minutes past each hour
- `daily` | Specify the hour and minute using the format hhmm. e.g. 1420 for 2:20pm
- `weekly` | Specify the day, hour and minute using the format dow-hhmm. e.g. tue-1420 for Tuesdays at 2:20pm

#### dur_unit

This parameter specifies the unit of duration for the criteria used to select files. Valid options for this parameter are `m`, `h`,`d` or `w`. For minutes, hours, days or weeks. The default value for this parameter is `d`. As an example, if the `dur_unit=d` and the `dur_val=7` then all files older than 7 days would be deleted.

#### dur_val

This parameter specifies the number associated with the duration units for the criteria used to select files. The default value for this parameter is `7`. As an example, if the `dur_unit=d` and the `dur_val=7` then all files older than 7 days would be deleted.

#### removedir

This parameter is a boolean that specifies whether the associated directory (only one level up) should be removed if there are no longer any files in it after the clean process has run. If there are other files in the directory that are not created by Motion, then the directory will not be removed.

#### script

This parameter specifies the full path to a script to run at the scheduled time.

#### params_file

- Values: String | Default: Not Defined
Full path and file name for a file containing the params listed one per line.

### watchdog_tmo

- Values: Integer | Default: 90
Number of seconds that elapse before a camera is deemed to be unresponsive and Motion triggers a watchdog timeout and begins to force the camera to shut down. When camera is initially starting, the timeout is set to three(3) times this value.

### watchdog_kill

- Values: Integer | Default: 0
Specifying a value of zero indicates that Motion will completely terminate after the watchdog_tmo. Values greater than zero represent the number of additional seconds after the watchdog_tmo Motion will wait until camera processes are forcefully terminated. Forceful termination of camera processes will result in memory leaks and detrimental effects therefore the default is to completely terminate the application let external processes such as systemctl or cron jobs restart Motion.

### camera

- Values: String | Default: Not defined
The full path and file name with the configuration parameters for the individual camera.

### config_dir

- Values: String | Default: Not defined
Directory containing individual device configuration files. Any files ending in '.conf' in the directory will be read as a device configuration file.

### Devices

### v4l2_device

- Values: String | Default: Not Defined
The v4l2 device to be used for capturing.

### v4l2_params

- Values: String | Default: Not Defined
Comma separated list of configuration parameters (aka controls) for the v4l2 device.

The configuration parameters for v4l2_params are specified by name or ID. They may also be enclosed in double quotes. Review the Motion log with log_level 8 to see the options that are applicable to the device. The following is a sample output from the log and examples of how to specify the parameters

- Log: [INF][VID][01:ml01:cam01] v4l2_ctrls_log: ID09963776 : Brightness : 0 to 255

- Example 1:`v4l2_params Brightness=130,palette=15`
- Example 2:`v4l2_params "Brightness"=130,palette=15`
- Example 3:`v4l2_params ID09963776=130,palette=15`

Additional Motion specific options for v4l2_params are listed below.

#### palette

- Values: 0 - 20 | Default: 17
Preferred color palette for Motion to use for the device. See table below for the meaning of each parameter number value.

V4l2 Option | FOURCC | palette option
V4L2_PIX_FMT_SN9C10X | S910 | 0
V4L2_PIX_FMT_SBGGR16 | BYR2 | 1
V4L2_PIX_FMT_SBGGR8 | BA81 | 2
V4L2_PIX_FMT_SPCA561 | S561 | 3
V4L2_PIX_FMT_SGBRG8 | GBRG | 4
V4L2_PIX_FMT_SGRBG8 | GRBG | 5
V4L2_PIX_FMT_PAC207 | P207 | 6
V4L2_PIX_FMT_PJPG | PJPG | 7
V4L2_PIX_FMT_MJPEG | MJPG | 8
V4L2_PIX_FMT_JPEG | JPEG | 9
V4L2_PIX_FMT_RGB24 | RGB3 | 10
V4L2_PIX_FMT_SPCA501 | S501 | 11
V4L2_PIX_FMT_SPCA505 | S505 | 12
V4L2_PIX_FMT_SPCA508 | S508 | 13
V4L2_PIX_FMT_UYVY | UYVY | 14
V4L2_PIX_FMT_YUYV | YUYV | 15
V4L2_PIX_FMT_YUV422P | 422P | 16
V4L2_PIX_FMT_YUV420 | YU12 | 17
V4L2_PIX_FMT_Y10 | Y10 | 18
V4L2_PIX_FMT_Y12 | Y12 | 19
V4L2_PIX_FMT_GREY | GREY | 20

#### input

- Values: Integer | Default: -1
Input channel for the v4l2 device. Use -1 for web cams.

#### norm

- Values: 0-3: | Default: 0
The TV norm to use for the device (PAL, NTSC, SECCAM, PAL-BW)

#### frequency

- Values: Long | Default: 0
The tuner frequency to use for the device.

#### params_file

- Values: String | Default: Not Defined
Full path and file name for a file containing the params listed one per line.

### libcam_device

- Values: String | Default: Not Defined
The libcamera device. The log will list the availble devices. If the user specifies 'camera0' the first device found will be used. (Useful when there is only one camera on system). Otherwise, the specify the device description in the log or using the command `cam -l` Note that you can also specify v4l2 devices(webcams) for the libcam_device.

### libcam_params

- Values: String | Default: Not Defined
Comma separated list of configuration parameters (aka controls) for the libcamera device.

#### pixelformat

User requested pixelformat to use. Default of YU12 is most efficient. Usually this parameter is specified as the fourcc character code.

#### Orientation(string)

(These are libcamera orientation options and may not provide result you anticipate.)

- Rotate0
- Rotate0Mirror
- Rotate90
- Rotate90Mirror
- Rotate180
- Rotate180Mirror
- Rotate270
- Rotate270Mirror

#### AeEnable(bool)

#### AeLocked(bool)

#### AeMeteringMode(int)

- MeteringCentreWeighted = 0
- MeteringSpot = 1
- MeteringMatrix = 2
- MeteringCustom = 3

#### AeConstraintMode(int)

- ConstraintNormal = 0
- ConstraintHighlight = 1
- ConstraintShadows = 2
- ConstraintCustom = 3

#### AeExposureMode(int)

- ExposureNormal = 0
- ExposureShort = 1
- ExposureLong = 2
- ExposureCustom = 3

#### ExposureValue(float)

#### ExposureTime(int)

#### AnalogueGain(float)

#### Brightness(float)

#### Contrast(float)

#### Lux(float)

#### AwbEnable(bool)

#### AwbMode(int)

- AwbAuto = 0
- AwbIncandescent = 1
- AwbTungsten = 2
- AwbFluorescent = 3
- AwbIndoor = 4
- AwbDaylight = 5
- AwbCloudy = 6
- AwbCustom = 7

#### AwbLocked(bool)

#### ColourGains(Pipe delimited)

- Red | Blue

#### ColourTemperature(int)

#### Saturation(float)

#### SensorBlackLevels(Pipe delimited)

- var1|var2|var3|var4

#### Sharpness(float)

#### FocusFoM(int)

#### ColourCorrectionMatrix(Pipe delimited)

- var1|var2|var3|var4|var5|var6|var7|var8|var9

#### ScalerCrop(Pipe delimited)

- x|y|height|width

#### DigitalGain(float)

#### FrameDuration(int)

#### FrameDurationLimits(Pipe delimited)

- min|max

#### SensorTemperature(float)

#### SensorTimestamp(int)

#### AfMode(int)

- AfModeManual = 0
- AfModeAuto = 1
- AfModeContinuous = 2

#### AfRange(0-2)

- AfRangeNormal = 0
- AfRangeMacro = 1
- AfRangeFull = 2

#### AfSpeed(int)

- AfSpeedNormal = 0
- AfSpeedFast = 1

#### AfMetering(int)

- AfMeteringAuto = 0
- AfMeteringWindows = 1

#### AfWindows(Pipe delimited)

- x|y|height|width

#### AfTrigger(int)

- AfTriggerStart = 0
- AfTriggerCancel = 1

#### AfPause(int)

- AfPauseImmediate = 0
- AfPauseDeferred = 1
- AfPauseResume = 2

#### LensPosition(float)

#### AfState(int)

- AfStateIdle = 0
- AfStateScanning = 1
- AfStateFocused = 2
- AfStateFailed = 3

#### AfPauseState(int)

- AfPauseStateRunning = 0
- AfPauseStatePausing = 1
- AfPauseStatePaused = 2

#### AePrecaptureTrigger(int)

- AePrecaptureTriggerIdle = 0
- AePrecaptureTriggerStart = 1
- AePrecaptureTriggerCancel = 2

#### NoiseReductionMode(int)

- NoiseReductionModeOff = 0
- NoiseReductionModeFast = 1
- NoiseReductionModeHighQuality = 2
- NoiseReductionModeMinimal = 3
- NoiseReductionModeZSL = 4

#### ColorCorrectionAberrationMode(int)

- ColorCorrectionAberrationOff = 0
- ColorCorrectionAberrationFast = 1
- ColorCorrectionAberrationHighQuality = 2

#### AeState(int)

- AeStateSearching = 1
- AeStateConverged = 2
- AeStateLocked = 3
- AeStateFlashRequired = 4
- AeStatePrecapture = 5

#### AwbState(int)

- AwbStateInactive = 0
- AwbStateSearching = 1
- AwbConverged = 2
- AwbLocked = 3

#### SensorRollingShutterSkew(int)

#### LensShadingMapMode(int)

- LensShadingMapModeOff = 0
- LensShadingMapModeOn = 1

#### PipelineDepth(int)

#### MaxLatency(int)

#### TestPatternMode(int)

- TestPatternModeOff = 0
- TestPatternModeSolidColor = 1
- TestPatternModeColorBars = 2
- TestPatternModeColorBarsFadeToGray = 3
- TestPatternModePn9 = 4
- TestPatternModeCustom1 = 256

### netcam_url

- Values: String | Default: Not defined
URL associated with the network camera.

### netcam_params

- Values: String | Default: Not Defined
Comma separated list of configuration parameters. Format is: option=value,option2=value2

Motion uses the ffmpeg libraries to process network cameras. This option is a comma separated list of the ffmpeg options for the camera. In addition to the ffmpeg options, Motion includes the following additional options.

#### capture_rate

The number of frames per second to capture from the camera. This option should be slightly higher than the FPS that the camera is sending image. Users can also specify the capture_rate as `pts`. When using `pts` as the capture_rate Motion will sync the timing of the capture to match between the clock and the presentation time stamps sent from the camera.

#### decoder

The ffmpeg hardware decoder to use. Note that not all of the hardware decoders provided by ffmpeg are available. The only hardware decoders are those that do not require customization of library usage. The ffmpeg libraries on the computer must usually be built from source in order to enable hardware decoding.

#### interrupt

The duration in seconds permitted for the library functions to respond. For the initial connection to the camera, the maximum duration is set equal to three times the interrupt specified. The default is 90 seconds.

#### input_format

The ffmpeg input format to use for the network camera. For cameras using http/https the input_format defaults to mjpeg. Another common option for this parameter with a http/https stream would be mpegts.

#### params_file

- Values: String | Default: Not Defined
Full path and file name for a file containing the params listed one per line.

### netcam_high_url

- Values: String | Default: Not defined
URL associated with the high resolution stream of the network camera. This option is typically used with the movie_passthrough to minimize CPU usage. The netcam_url specifies a low resolution stream which is decoded and processed and the movies are saved directly from the data provided from the netcam_high_url without decoding or processing it.

### netcam_high_params

- Values: String | Default: Not Defined
Comma separated list of configuration parameters. Format is: option=value,option2=value2

Motion uses the ffmpeg libraries to process network cameras. This option is a comma separated list of the ffmpeg options for the stream specified by netcam_high_url. In addition to the ffmpeg options, Motion includes the following additional options.

#### capture_rate

The number of frames per second to capture from the camera. This option should be slightly higher than the FPS that the camera is sending images. Users can also specify the capture_rate as `pts`. When using `pts` as the capture_rate Motion will sync the timing of the capture to match between the clock and the presentation time stamps sent from the camera.

#### input_format

The ffmpeg input format to use for the network camera. For cameras using http/https the input_format defaults to mjpeg. Another common option for this parameter with a http/https stream would be mpegts.

#### params_file

- Values: String | Default: Not Defined
Full path and file name for a file containing the params listed one per line.

### netcam_userpass

- Values: String | Default: Not defined
Username and password for the network camera specified as username:password.

### Image Processing

### width

- Values: Integer | Default: 640
The width of the image in pixels. Must be a multiple of 8.

### height

- Values: Integer | Default: 480
The height of the image in pixels. Must be a multiple of 8.

### framerate

- Values: 2 - 100 | Default: 15
The number of frames to be processed per second for motion detection.

### rotate

- Values: 0, 90, 180, 270 | Default: 0
Rotate image the given number of degrees.

### flip_axis

- Values: none, vertical, horizontal | Default: none
Flip the image according to specified axis.

### locate_motion_mode

- Values: on, off, preview | Default: off
Locate and draw around/on the moving object. Preview only applies to pictures.

### locate_motion_style

- Values: box, redbox, cross, redcross | Default: box
Set the look and style of the locate mode.

### text_left

- Values: String | Default: Not defined
User defined text overlaid in the lower left corner.

### text_right

- Values: String | Default: %Y-%m-%d\\n%T
User defined text overlaid in the lower right corner.

### text_changes

- Values: on, off | Default: off
Show the number of pixels that changed in the upper right corner.

### text_scale

- Values: 1 - 10 | Default: 1
Scale factor for text drawn on images.

### text_event

- Values: String | Default: %Y%m%d%H%M%S
Creates conversion specifier %C

### Motion Detection

### emulate_motion

- Values: on, off | Default: off
Always save images even if there was no motion

### threshold

- Values: Integer | Default: 1500
Minimum number of changed pixels that triggers an event.

### threshold_maximum

- Values: Integer | Default: 0
Maximum number of changed pixels that triggers an event. If the number of changed pixels is over the threshold maximum, no event is triggered. A value of zero disables threshold_maximum.

### threshold_tune

- Values: on, off | Default: off
Continuously adjust the threshold for triggering an event.

### secondary_method

- Values: haar, hog, dnn | Default: Not Defined
The secondary detection method.

### secondary_params

- Values: String | Default: Not Defined
Comma separated list of configuration parameters for the camera. Format is option=value,option2=value2

This option is a comma separated list of the secondary detection model options. In addition to the options for each of the models, Motion includes the following additional options.

#### frame_interval

- Values: Integer | Default: 5
The interval of images between processing using the secondary method. This works in conjunction with the framerate. For example, a frame_interval of 5 with a framerate of 30 means secondary processing will be at 6 fps while a frame_interval of 60 would have secondary processing every other second.

#### model_file

- Values: String | Default: Not Defined
Full path and file name for the model file associated with the secondary model.

#### image_type

- Values: full, grey, roi | Default: full
Process full color image, the full grey image or just the region of interest(roi).

#### rotate

- Values: Integer | Default: 0
Rotation of image when being processed through secondary detection model.

#### params_file

- Values: String | Default: Not Defined
Full path and file name for a file containing the params listed one per line.

#### threshold

- Values: String | Default: Not Defined

#### scalefactor

- Values: String | Default: Not Defined

#### minsize

- Values: String | Default: Not Defined

#### maxsize

- Values: String | Default: Not Defined

#### padding

- Values: String | Default: Not Defined

#### threshold_model

- Values: String | Default: Not Defined

#### winstride

- Values: String | Default: Not Defined

#### flags

- Values: String | Default: Not Defined

#### minneighbors

- Values: String | Default: Not Defined

#### config

- Values: String | Default: Not Defined

#### classes_file

- Values: String | Default: Not Defined

#### framework

- Values: String | Default: Not Defined

#### backend

- Values: String | Default: Not Defined

#### target

- Values: String | Default: Not Defined

#### scale

- Values: String | Default: Not Defined

#### width

- Values: String | Default: Not Defined

#### height

- Values: String | Default: Not Defined

### noise_level

- Values: 1 - 255 | Default: 32
The minimum amount of change in a single pixel before it is counted towards the threshold value.

### noise_tune

- Values: on, off | Default: on
Continuously adjust the noise_level parameter.

### despeckle_filter

- Values: Combinations of E,e,D,d and l | Default: EedDl
Despeckle the image using combinations of (E/e)rode or (D/d)ilate. And ending with optional (l)abeling. This reduces noise in the motion image. Adding a trailing l enables labeling in which only the largest section section is used to calculate the threshold.

### area_detect

- Values: String | Default: Not defined
Detect motion in predefined areas (1 - 9) and when Motion is detected in the area, execute the script. This option is only to execute the on_area_detect script.

Areas are numbered like

- 1 2 3
- 4 5 6
- 7 8 9

### mask_file

- Values: String | Default: Not defined
The full path and filename for the masking pgm file. If needed, the mask will be resized to match the width and height of the image. The areas in the mask file colored black will be excluded from motion detection. Shades of grey on the mask will diminish the detection while areas of white will not have any impact on motion detection.

### mask_privacy

- Values: String | Default: Not defined
The full path and filename for the privacy masking pgm file. This mask completely removes the indicated sections of the image.

### smart_mask_speed

- Values: 0 - 10 | Default: 0
The smartmask is intended to be a dynamic, self-learning mask to decrease sensitivity in areas with frequent motion. The speed specified by this parameter is how quickly the mask gets adjusted. Zero disables the smart mask

### lightswitch_percent

- Values: 0 - 100 | Default: 0
The minimum change in the portion of the image that will trigger a lightswitch condition

### lightswitch_frames

- Values: Integer | Default: 5
The number of frames to ignore when the lightswitch condition is triggered (see above).

### minimum_motion_frames

- Values: Integer | Default: 1
The number of frames that must contain motion in order to trigger an event.

### event_gap

- Values: Integer | Default: 60
The seconds of no motion detection that triggers the end of an event.

### pre_capture

- Values: Integer | Default: 3
The number of pre-captured (buffered) frames to be captured before an event.

### post_capture

- Values: Integer | Default: 10
The number of frames to be captured after an event has ended.

### static_object_time

- Values: Integer | Default:
Number of seconds before a new object is included in the reference image.

### Script Execution

The following applies to all scripts being executed by Motion. If webcontrol_access is set to a value greater than or equal 3(i.e. the webcontrol allows changes to scripts), then the program/script must be saved in a subdirectory from the motion.conf file called 'scripts'. For example, if the `motion.conf` file is located at `/var/lib/motion/motion.conf`, the scripts must be saved in the directory `/var/lib/motion/scripts`.

### on_event_start

- Values: String | Default: Not defined
The full path and file name of the program/script to be executed at the start of an event.

### on_event_end

- Values: String | Default: Not defined
The full path and file name of the program/script to be executed at the end of an event.

### on_picture_save

- Values: String | Default: Not defined
The full path and file name of the program/script to be executed when a picture is saved.

### on_motion_detected

- Values: String | Default: Not defined
The full path and file name of the program/script to be executed when motion is detected.

### on_area_detected

- Values: String | Default: Not defined
The full path and file name of the program/script to be executed when motion is detected in the area specified.

### on_movie_start

- Values: String | Default: Not defined
The full path and file name of the program/script to be executed at the creation of a movie.

### on_movie_end

- Values: String | Default: Not defined
The full path and file name of the program/script to be executed when a movie ends.

### on_camera_lost

- Values: String | Default: Not defined
The full path and file name of the program/script to be executed when the camera is no longer detected.

### on_camera_found

- Values: String | Default: Not defined
The full path and file name of the program/script to be executed when a previously lost camera is active again.

### on_secondary_detect

- Values: String | Default: Not Defined
The full path and file name of the program/script to be executed when secondary detection occurs.

### on_action_user

- Values: String | Default: Not Defined
The full path and file name of the program/script to be executed when user selects the user action from the web interface.

### on_sound_alert

- Values: String | Default: Not Defined
The full path and file name of the program/script to be executed when a sound alert is triggered.

### Output - Picture Options

### picture_output

- Values: on, off, first, best | Default: off
'on' saves all motion images during an event. 'first' saves only the first image that detected motion. 'best' saves image with most changed pixels.

### picture_output_motion

- Values: on, off, roi | Default: off
Save the motion(debug) pictures with the pixels that change as a graytone image. If labeling is enabled via the despeckele option, the largest area will be blue and areas in red are those determined by the smartmask option.

The option of 'roi' provides a smaller normal image of just the section that caused the motion. i.e. The Region Of Interest).

### picture_type

- Values: jpeg, webp, ppm | Default: jpeg
The type of picture file to output.

### picture_quality

- Values: 1 - 100 | Default: 75
The image quality for the jpeg or webp images in percent. The value of 1 is worst and 100 is best.

### picture_exif

- Values: String | Default: Not defined
The text for the JPEG EXIF comment with the EXIF timestamp.

### picture_filename

- Values: String | Default: %v-%Y%m%d%H%M%S-%q
The file name and optionally the path for the pictures relative to target_dir. The file extension will be added based upon the picture_type.

### snapshot_interval

- Values: Integer | Default: 0
The number of seconds between snapshots

### snapshot_filename

- Values: String | Default: %v-%Y%m%d%H%M%S-snapshot
The file name and optionally the path for the snapshots relative to target_dir. The file extension is automatically added. A symbolic link called lastsnap.jpg is created in the target_dir and will always point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap'

### Output - Movie Options

### movie_output

- Values: on, off | Default: on
Encode movies of the motion events.

### movie_output_motion

- Values: on, off | Default: off
Encode movies that show the pixels that changed. If labeling is enabled via the despeckle option, the largest area will be in blue. If smartmask is enabled it will be shown in red. The filename will be the same as normal movies except with an 'm' appended.

### movie_max_time

- Values: Integer | Default: 120
The maximum length of a movie in seconds. Set this to zero for unlimited length.

### movie_bps

- Values: Integer | Default: 400000
Bitrate to use in encoding of movies. This option is ignored if movie_quality is specified.

### movie_quality

- Values: 0 - 100 | Default: 60
A value of 0 disables this option while values 1 - 100 change the quality of the movie. The value of 1 means worst quality and 100 is the best quality. High values of this option (e.g. 100) may cause difficulty with some players.

### movie_container

- Values: flv, ogg, webm, mp4, mkv, hevc, mov | Default: mkv
Container/Codec to be used for the video. Preferred codec can be appended e.g. `mkv:libx265`

### movie_retain

- Values: on, off | Default: off
Retain movie only if the secondary detection occurred.

### movie_passthrough

- Values: on, off | Default: off
When using a RTSP, RTMP, mjpeg and some V4l2 cameras, create movie files with the packets obtained directly from the camera.

### movie_filename

- Values: String | Default: %v-%Y%m%d%H%M%S
The file name and optionally the path for the movie relative to target_dir. The file extension is automatically added based upon the container.

### movie_extpipe_use

- Values: on, off | Default: off
Specifies whether to send the pictures to pipe for external encoding into a movie.

### movie_extpipe

- Values: String | Default: Not defined
The program name and options for processing the images.

### movie_all_frames

- Values: on, off | Default: on
Specifies whether to send all frames for encoding during an event instead of just those associated with motion or pre/post capture.

### timelapse_interval

- Values: Integer | Default: 0
Interval in seconds for saving a picture into timelapse movie. Zero disables timelapse.

### timelapse_mode

- Values: hourly, daily, weekly-sunday, weekly-monday, monthly, manual | Default: daily
File rollover mode of the timelapse video.

### timelapse_fps

- Values: Integer | Default: 30
The frame per second rate to use in the playback of the timelapse video.

### timelapse_container

- Values: mpg, mkv | Default: mpg
Container to be used by timelapse video.

- mpg - Creates mpg file with mpeg-2 encoding. If Motion is shutdown and restarted, new pictures will be appended to any previously created file with name indicated for timelapse.
- mkv - Creates mkv file with the default encoding. If Motion is shutdown and restarted, new pictures will create a new file with the name indicated for timelapse.

### timelapse_filename

- Values: String | Default: %Y%m%d-timelapse
The file name and optionally the path for the timelapse movies relative to target_dir. The file extension is automatically added based upon the container.

### Output - Pipe Options

### video_pipe

- Values: String | Default: Not defined
The video4linux video loopback device for normal images. The device would be specified in the format like /dev/video1

### video_pipe_motion

- Values: String | Default: Not defined
The video4linux video loopback device for motion images. The device would be specified in the format like /dev/video1

### Web Control

These options may be placed in the motion.conf or camera.conf files. When the same port is specified in multiple camera.conf files, then all the cameras specified will be available. Note that if other webcontrol parameters differ between camera files, Motion will only select one of those sets to use for that port. For example, if camera1.conf and camera2.conf both specify webcontrol_port 8081 but camera1.conf and camera2.conf have different webcontrol_auth_user parameters, then Motion will only use EITHER the one in camera1.conf OR the one in camera2.conf. Which one it uses is random.

### webcontrol_port

- Values: 0 to 65535 | Default: 8080
The port number for the web based interface of Motion.

### webcontrol_ipv6

- Values: on, off | Default: off
Listen for connections from IPv6 and IPV4.

### webcontrol_localhost

- Values: on, off | Default: on
Restrict the webcontrol of Motion to the localhost.

### webcontrol_base_path

- Values: Valid url path | Default: Not Defined
Specify new base url path for the webcontrol.

### webcontrol_access

- Values: 0 - 3 | Default: 2
Set the type of parameters that can be accessed via the webcontrol page.

- 0: None - No configuration parameters or actions will be available.
- 1: Limited- A limited list of parameters will be available.
- 2: Advanced - The advanced list of parameters will be available. These typically require Motion to be restarted to become effective.
- 3: Restricted - User IDs, passwords and "on_" commands.

webcontrol_access is not shown or allowed to be revised from the web interface. This allows users to lock out any changes to parameters. This may be desired if the webcontrol port is opened to the internet.

### webcontrol_interface

- Values: `default`, `user` or `stream` | Default: `default` for motion.conf file , `stream` for camera configuration files
The type of webcontrol interface to provide.

- The value of `default` provides a traditional web page interface using html/css.
- The value of `user` means the html will be provided by file specified in webcontrol_html
- The value of `stream` means the camera stream will be provided

### webcontrol_auth_method

- Values: none, basic, digest | Default: none
Authentication method to use for the webcontrol port

### webcontrol_auth_admin

- Values: String | Default: Not defined
The admin username and password specified as username:password This user has all the permissions granted by the webcontrol_access and webcontrol_actions.

### webcontrol_auth_user

- Values: String | Default: Not defined
The user username and password specified as username:password. This user has only read/view permissions on the webcontrol

### webcontrol_tls

- Values: on, off | Default: off
Enable SSL/TLS (https) for the webcontrol.

### webcontrol_cert

- Values: String | Default: Not defined
Full path and file name to the certification file for SSL/TLS support. Only used when webcontrol_tls is enabled.

### webcontrol_key

- Values: String | Default: Not defined
Full path and file name to the key file for SSL/TLS support. Only used when webcontrol_tls is enabled.

### webcontrol_headers

- Values: String | Default: Not defined
Comma separated list of headers=values for the webcontrol. Use Access-Control-Allow-Origin header to specify the CORS header.

### webcontrol_actions

- Values: String | Default: Not defined
Comma separated list of the actions=values to allow and show on the web control page. The following parameters are recognized.

- pause: Applies for Pause On, Pause Off and Pause schedule actions
- event: Applies for both Start Event and End Event actions
- snapshot
- camera_add
- camera_delete
- ptz: Applies for all PTZ commands
- stop
- restart
- action_user
- config_write
- config: Applies for any and all configuration parameters
- movies: Show page of recorded movies on webcontrol for downloading (requires database functionality)

Specify each of these using values of `on` or `off` to permit or deny respectively. The specification in this parameter will override the default that is associated with webcontrol_access.

### webcontrol_html

- Values: String | Default: Not defined
The file name for a user specified html page to use as the webcontrol. The file must be placed in a subdirectory from the motion.conf file called webcontrol. e.g. if the `motion.conf` file is located at `/var/lib/motion/motion.conf`, the webcontrol page must be located in the directory `/var/lib/motion/webcontrol`. Additionally, any files in the webcontrol directory with an extension of html, json, js or css will also be available as resources to the user html page.

### webcontrol_lock_attempt

- Values: Integer | Default: 3
Number of permitted attempts to log in before triggering lockout.

### webcontrol_lock_minutes

- Values: Integer | Default: 10
Number of minutes that the IP will be locked out from further attempts to log in.

### webcontrol_lock_script

- Values: String | Default: Not Defined
Script to execute when a lockout has been triggered. Two additional parameters are passed to this script when executed. The number of times the userid failed as well as the IP address attempting to log in.

If webcontrol_access is set to a value greater than or equal 3(i.e. the webcontrol allows changes to scripts), then the program/script must be saved in a subdirectory from the motion.conf file called 'scripts'. For example, if the `motion.conf` file is located at `/var/lib/motion/motion.conf`, the scripts must be saved in the directory `/var/lib/motion/scripts`.

### Live Stream

### stream_preview_scale

- Values: Integer | Default: 100
The percentage to scale the stream image when it is placed on the webcontrol page or into the combined image when the stream_preview_method is set to combined.
Numbers greater than 100 are permitted.

### stream_preview_newline

- Values: on, off | Default: off
Insert a new line indicator prior to the image on the webcontrol web page.

Note that this parameter is ignored when the stream_preview_method is set to combined.

### stream_allcam_params

- Values: String | Default: Not Defined
Comma separated parameters for the consolidated image video streams. The consolidated image puts together a single image of all the cameras currently running on the webcontrol_port. Format is parm1=value1,parm2=value2 etc.

#### Muliple webcontrol ports

Since consolidated cameras streams may be available on multiple ports, parameter names can be customized to provide different values per port. Simply append the applicable port number to the parameter name. For example, the parameter values of `row=2;row8082=3` would indicate that the default row would be 2 and for the consolidated stream provided on `webcontrol_port 8082` the row would be 3

#### row

- Values: positive integers | Default: Not Defined
On the consolidated image, the row number that the image will be shown. Row numbers are counts of images on the page and not pixels. For example, if there are six cameras running and they are all stacked on top of each other on the page, the last image will be at row 6 (Not image1 height + image2 height + ...image 5 height)

#### col

- Values: positive integers | Default: Not Defined
On the consolidated image, the column number that the image will be shown. Column numbers are counts of images on the page and not pixels. For example, if there are six cameras running and they are all put side by side on the page, the last image will be at column 6 (Not image1 width + image2 width + ...image 5 width)

#### offset_col

- Values: positive and negative integers | Default: 0
On the consolidated image, Motion will arrange the image of the camera into the row and columns indicated by the other parameters. After the image is positioned, Motion centers the image in the row and column grid space. This parameter allows the user to move the image to the left(negative values) or right(positive values) from that center position.

This parameter is in pixels.

#### offset_row

- Values: positive and negative integers | Default: 0
On the consolidated image, Motion will arrange the image of the camera into the row and columns indicated by the other parameters. After the image is positioned, Motion centers the image in the row and column grid space. This parameter allows the user to move the image up (negative values) or down(positive values) from that center position.

This parameter is in pixels.

#### scale

- Values: Integers | Default: 100
The percentage to scale the image. Numbers greater than 100 are permitted.

Note that the row and col must be continuous without gaps in the numbers. e.g. If one of the cameras specifies a row number of 5, then some of the other cameras must specify numbers 1 to 4 inclusive. Likewise on the col parameter. For each row, the col must start at 1 and increase sequentially. It is however permitted to have a different number of cameras on each row.

#### Illustrative sample:

Two cameras on first row, one camera on second row, three cameras on third row.

- camera1 configuration: `stream_allcam_params row=3,col=1`
- camera2 configuration: `stream_allcam_params row=1,col=2`
- camera3 configuration: `stream_allcam_params row=3,col=3`
- camera4 configuration: `stream_allcam_params row=1,col=1`
- camera5 configuration: `stream_allcam_params row=3,col=2`
- camera6 configuration: `stream_allcam_params row=2,col=1`

### stream_preview_method

- Values: `combined`, `mjpg`, `static` | Default: `combined`
This option determines the method used for displaying images on the webcontrol page.

- `mjpg`
  The webcontrol page is created with a mjpg stream for each camera. This method creates a connection to the server for each camera. Note that if there are many cameras, this method may not show/refresh properly in the browser due to browser settings regarding the maximum number of concurrent connections.
- `static`
  The webcontrol page loops through all the cameras and refreshes the images using static jpgs. This method provides a slower refresh rate than the mjpg option but allows for a higher number of cameras to get around the browser concurrent connection limits.
- `combined`
  The webcontrol page uses a combined single mjpg stream. The combined single mjpg stream is constructed by Motion from all of the cameras currently running.

### stream_preview_ptz

- Values: on, off | Default: on
Include the PTZ buttons on the webcontrol page.

### stream_quality

- Values: 1 - 100 | Default: 50
JPG compression quality setting in percent for the images transferred to live stream.

### stream_grey

- Values: on, off | Default: off
Send the live stream in grey rather than color.

### stream_maxrate

- Values: Integer | Default: 1
The frames per second for the webcontrol camera stream.

### stream_motion

- Values: on, off | Default: off
Limit the frames per second for the webcontrol stream to 1 when there is no motion being detected and increase to the stream_maxrate when there is motion.

### stream_scan_time

- Values: Integer | Default: 5
Time in seconds to display image when in scan mode.

### stream_scan_scale

- Values: Integer | Default: 25
Percentage scaling factor to apply on the image when in scan mode.

### Database

Only one database can be used by Motion at a time. These options must be placed in the Motion.conf file and not in a camera config files.

### database_type

- Values: mariadb, postgresql, sqlite3 | Default: sqlite3
The database type.

### database_dbname

- Values: String
The full path and file name to the Sqlite3 database.

Default: motion.db in the directory defined by --localstatedir=DIR during the configure step of installation. If this was not defined, it will default to /var/lib/motion/motion.db or /usr/local/var/lib/motion/motion.db depending upon your system

### database_host

- Values: String | Default: localhost
The host on which the database is located

### database_port

- Values: 0 - 65535 | Default: 0
The port number that is used for the database. Typical values are: MariaDB=3306 and postgresql=5432

### database_user

- Values: String | Default: Not defined
The user account name for database

### database_password

- Values: String | Default: Not defined
The user password for database

### database_busy_timeout

- Values: Integer | Default: 0
The time to wait before issuing a timeout message for sqlite3.

### sql_event_end

- Values: String | Default:
SQL query to execute at the end of the event.

### sql_event_start

- Values: String | Default:
SQL query to execute at the start of the event.

### sql_movie_end

- Values: String | Default:
SQL query to execute at the end of the movie.

### sql_movie_start

- Values: String | Default:
SQL query to execute at the start of the movie.

### sql_pic_save

- Values: String | Default:
SQL query to execute when a picture has been saved.

### Tracking

The following applies to all scripts being executed by Motion. If webcontrol_access is set to a value greater than or equal 3(i.e. the webcontrol allows changes to scripts), then the program/script must be saved in a subdirectory from the motion.conf file called 'scripts'. For example, if the `motion.conf` file is located at `/var/lib/motion/motion.conf`, the scripts must be saved in the directory `/var/lib/motion/scripts`.

### ptz_auto_track

- Values: on,off Default: off
Enable automatic tracking.

### ptz_wait

- Values: Integer | Default: 0
Time in seconds to wait after a PTZ script is called before resuming motion detection.

### ptz_move_track

- Values: String | Default: Not Defined
Full path and file name for script to execute for auto tracking.

### ptz_pan_left

- Values: String | Default: Not Defined
Full path and file name for script to pan the camera left.

### ptz_pan_right

- Values: String | Default: Not Defined
Full path and file name for script to pan the camera right.

### ptz_tilt_up

- Values: String | Default:
Full path and file name for script to tilt the camera up.

### ptz_tilt_down

- Values: String | Default: Not Defined
Full path and file name for script to tilt the camera down.

### ptz_zoom_in

- Values: String | Default: Not Defined
Full path and file name for script to zoom the camera in .

### ptz_zoom_out

- Values: String | Default: Not Defined
Full path and file name for script to zoom the camera out.

### Sound

### snd_device

- Values: String | Default: Not Defined
String specifying the sound device.

For alsa use the format such as hw:1,0

For PulseAudio, usually leave this empty and let PulseAudio use the defaults. If a specific PulseAudio device string is known, specify using this parameter.

### snd_params

- Values: String | Default: Not Defined
Comma separated list of configuration parameters for the sound device.

The configuration parameters for snd_device

#### source

- Values: String | Default: alsa
The type of source for the sound device. Currently supported sources are 'alsa' or 'pulse'.

#### channels

- Values: Integer: | Default: 1
The number of audio channels for the sound device

#### frames

- Values: Integer | Default: 2048
The number of bytes to read in for each frame from the sound device.

#### sample_rate

- Values: Integer | Default: 44100
The sample rate for the sound device.

#### pulse_server

- Values: String | Default: Not defined
The override name of the pulse server to use.

#### params_file

- Values: String | Default: Not Defined
Full path and file name for a file containing the params listed one per line.

### snd_alerts

- Values: String | Default: Not Defined
Comma separated list of configuration parameters for the criteria of each alert.

Multiple specifications of this parameter are permitted.

The configuration parameters for each alert associated with the sound detection. Multiple alerts can be specified and each one can be set up to check for a different frequency. The following are the parameters that are specified on each alert.

#### alert_id

- Values: Integer | Default:
The unique number associated with the alert.

#### volume_level

- Values: Integer | Default: 0
The minimum volume level required to be start the detection process

#### volume_count

- Values: Integer | Default: 100
The minimum number of times that the frequency must be detected above the volume_level before triggering event.

#### freq_low

- Values: Float | Default: 0
The minimum frequency associated with the detection.

#### freq_high

- Values: Float | Default: 10000
The maximum frequency associated with the detection.

#### trigger_duration

- Values: Integer | Default: 10
The duration that must occur in seconds between triggered events before resetting. This prevents a perpetual stream of on_sound_event being triggered upon a constant sound. The sound frequency must not occur for at least trigger_duration seconds before a new on_sound_event is triggered for that particular alert.

#### trigger_threshold

- Values: Integer | Default: 10
The number of times that the alert must be triggered before invoking the on_sound_event

#### alert_nm

- Values: String | Default: Not defined
The description associated with the alert.

#### params_file

- Values: String | Default: Not Defined
Full path and file name for a file containing the params listed one per line.

### snd_window

- Values: hamming, hann, none | Default: hamming
The sound frequency detection window function method to use.

### snd_show

- Values: boolean | Default: off
Write to the log the frequencies being detected.

## Command Line Options

`motion [ -hbnm ] [ -c config file path ] [ -d level ] [ -k level ] [ -p pid_file ] [ -l log_file ]`

- -c : Full path and filename of config file.
- -h : Show help screen
- -b : Run in daemon mode
- -n : Run in 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 log file
- -p : Full path and file name for the process id file
- -m : Start in pause mode

## The Configuration Files

Motion will search for the configuration file called 'motion.conf' in the following order:

1. Current directory where Motion was invoked
2. The directory called '.motion' in the current users home directory
3. The sub directory of lib/motion from the directory defined by --localstatedir=DIR during the configure step of installation. If this was not defined, it will default to /var/lib/motion or /usr/local/var/lib/motion depending upon your system
4. The directory defined by --sysconfdir=DIR during the configure step of installation. If this was not defined, it will default to /etc/motion or /usr/local/etc/motion depending upon your system. Please note that the use of this directory for the configuration files is deprecated. Some significant functionality of Motion will not be available if the configuration files are in this directory.

The Motion.conf file specifies parameters for the entire Motion application and defaults for each camera. Specifications that are unique to each camera are included in separate files.

## Signals

A signal can be sent from the command line by typing e.g. `kill -s SIGHUP pid`, where the last parameter is the process ID for Motion.

Signal | Description
--- | ---
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.