MOTION(1)
π MOTION(1) β Motion Options and Config Files π
okay bestie, welcome to the MOTION(1) page! it's giving Motion Options and Config Files, and we're about to vibe-check every flag, option, default, and little technical crumb. no cap. π«Ά
β¨ NAME β¨
motion β detect motion using a video4linux device or network camera π
π¦ SYNOPSIS π¦
motion [ -hbnsm ] [ -c config file path ] [ -d level ] [ -k level ] [ -p
pid_file ][ -l log_file ]
πΈ DESCRIPTION πΈ
okay so 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. she's literally doing the most, and we're obsessed. π
π OPTIONS π
-cβ full path and filename of config file. for example:/home/kurt/motion.confthe default is/usr/local/etc/motionunless specified differently when building Motion. many RPMs and Debian packages will use/etcor/etc/motionas 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 π
okay so 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). periodt. π
daemon π€
- Values:
on/off - Default:
off - Description: when specified as
ON, Motion goes into daemon (background process) mode and releases the terminal. π
setup_mode π οΈ
- Values:
on/off - Default:
off - Description: start in Setup-Mode, daemon disabled. β¨
pid_file π
- Values: User specified string
- Default: Not defined
- Description: file to store the process ID, also called pid file. π
log_file π
- Values: User specified string
- Default: Not Defined
- Description: file to save logs messages, if not defined stderr and syslog is used. ποΈ
log_level πΆ
- Values:
1to9(EMG,ALR,CRT,ERR,WRN,NTC,INF,DBG,ALL) - Default:
6/NTC - Description: specify the level of verbosity in the messages sent to the log. π
log_type π·οΈ
- Values:
COR,STR,ENC,NET,DBL,EVT,TRK,VID,ALL - Default:
ALL - Description: filter to log messages by type. π§
quiet π€«
- Values:
on/off - Default:
on - Description: do not sound beeps when detecting motion. π
native_language π
- Values:
boolean - Default:
on - Description: use this option to enable native language on the webcontrol and log message. specify
offto have messages provided in English. π¬
camera_name π·
- Values: User specified string
- Default: Not Defined
- Description: user specified string to describe the camera. π·οΈ
camera_id π’
- Values: Numeric identification number for the camera
- Default: The order in which the camera is opened by Motion
- Description: use this option to assign a number to each camera that is consistent every time that Motion is started. by default Motion will assign a number based upon the sequence in which it reads the configuration and this sequence may not be the same every time that Motion starts. π―
camera π₯
- Values: User specified string
- Default: Not Defined
- Description: this option specifies the full path and file name to individual camera files. this option can be listed multiple times. each camera file should contain the options that are unique to that camera/video device. common options are obtained from the
motion.conffile and values are overwritten from each camera file. while themotion.confincludes four sample camera files, the actual limit of cameras is only dependent upon the machine capabilities. Remember: if you have more than one camera you must have one camera file for each one. For example, 2 cameras would require 3 files: Themotion.conffile ANDcamera1.confandcamera2.conf. only put the options that are unique to each camera in the camera config files. πΈ
camera_dir π
- Values: User specified string
- Default: Not Defined
- Description: this option specifies the optional subdirectory that contains the camera config files. ποΈ
target_dir π―
- Values: User specified string
- Default: Not defined
- Description: target base directory for pictures and films. it is recommended to use an absolute path. if this option is not defined, the current working directory is used. this option accepts the conversion specifiers included at the end of this manual. π
video_device ποΈ
- Values: User specified string
- Default:
/dev/video0 - Description: string to specify the video device to be used for capturing. the format is usually
/dev/videoXwhere X varies depending upon the video devices connected to the computer. for FreeBSD certain devices use thebktrsubsystem and they will use/dev/bktr0. πΉ
video_params βοΈ
- Values: User specified string
- Default: None
- Description: string to specify the parameters to pass in for a
video_device. the parameters permitted are dependent upon the device. this only applies to V4L2 devices. the Motion log reports all the available options for the device. π§
auto_brightness βοΈ
- Values:
0-3 - Default:
0 - Description: the auto_brightness feature uses the device options to adjust the brightness. only recommended for cameras without auto brightness.
0-disabled,1=Use brightness,2=Use exposure,3=Use absolute exposure. π‘
tuner_device πΊ
- Values: User Specified String
- Default:
/dev/tuner0 - Description: tuner device to be used for capturing images. this is ONLY used for FreeBSD. π‘
roundrobin_frames π
- Values:
1to unlimited - Default:
1 - Description: number of frames to capture in each roundrobin step. ποΈ
roundrobin_skip βοΈ
- Values:
1to unlimited - Default:
1 - Description: number of frames to skip before each roundrobin step. β©
roundrobin_switchfilter π§Ή
- Values:
on/off - Default:
off - Description: filter out noise generated by roundrobin. β¨
netcam_url π
- Values: User specified string
- Default: None
- Description: full connection URL string to use to connect to a network camera. in addition to standard camera protocols, the following prefixes are added by the Motion application.
ftp:// mjpg:// mjpeg:// file:// v4l2://
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. π
netcam_params π§
- Values: User specified string
- Default: Not Defined
- Description: user specified parameters for the network camera. βοΈ
netcam_high_url πΉ
- Values: User specified string
- Default: None
- Description: full connection URL string to use to connect to a high resolution network camera. the URL must provide a stream of images instead of only a static image. the following prefixes are recognized
rtsp:// rtmp://
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_high_params π©
- Values: User specified string
- Default: Not Defined
- Description: user specified parameters for the network camera. π οΈ
netcam_userpass π
- Values: User specified string
- Default: Not Defined
- Description: the user id and password required to access the network camera string. only basic authentication is supported at this time. format is in
user:passwordformat when both a user name and password are required. π
width βοΈ
- Values: Dependent upon video device
- Default:
640 - Description: image width in pixels for the video device. π
height βοΈ
- Values: Dependent upon video device
- Default:
480 - Description: image height in pixels for the video device. π
framerate ποΈ
- Values:
2-100 - Default:
15 - Description: the maximum number of frames to capture in 1 second. the default of
100will normally be limited by the capabilities of the video device. typical video devices have a maximum rate of30. π¬
minimum_frame_time β±οΈ
- Values:
0to unlimited - Default:
0 - Description: the minimum time in seconds between capturing picture frames from the camera. the default of
0disables this option and relies upon the capture rate of the camera. this option is used when you want to capture images at a rate lower than 2 per second. β³ rotateβ spin your whole image around by this many degrees, bestie π«- Values:
0,90,180,270 - Default:
0 - This rotation hits all your saved images and your movies. Everything. No escape. π
- Values:
flip_axisβ flip the images vertically or horizontally β¨- Values:
none,v,h - Default:
none - Same energy as
rotate: it affects all saved images as well as movies. π¦
- Values:
locate_motion_modeβ find the moving thing and draw a lil box around it π―- Values:
on/off/preview - Default:
off - Set it to
'on'and it locates the moving object and draws a box around it. Set it to'preview'and it only draws that box inpreview_shotpictures. Sneaky, lowkey. π
- Values:
locate_motion_styleβ okay but how do we mark it tho π- Values:
box: draw a traditional box around the part of the image generating the motionredbox: draw a red box around the part of the image generating the motioncross: draw a cross on the part of the image generating the motionredcross: draw a red cross on the part of the image generating the motion
- Default:
box - When
locate_motion_modeis enable, this option specifies how the motion will be indicated on the image. π
- Values:
text_leftβ text for the lower left corner π- Values: User specified string
- Default: Not defined
- Text to place in lower left corner of image. Format specifiers follow C function
strftime(3). β°
text_rightβ text for the lower right corner π«Ά- Values: User specified string
- Default:
%Y-%m-%d\n%T - Text to place in lower right corner of image. Format specifiers follow C function
strftime(3). β°
text_changesβ show off how much stuff moved π- Values:
on/off - Default:
off - When specified, draw the number of changed pixed on the images. This option will normally be set to
offexcept when you setup and adjust the motion settings. The text is placed in upper right corner of the image. π§
- Values:
text_scaleβ how big we drawing that text π- Values:
1to10 - Default:
1 - The scale at which to draw text over the image. β
- Values:
text_eventβ the special event name-maker π- Values: User specified string
- Default:
%Y%m%d%H%M%S - Define the value of the special event conversion specifier
%C. The user 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. The%Ccan be used filenames andtext_left/rightfor creating a unique identifier for each event. π₯
emulate_motionβ fake it till you make it, motion edition π- Values:
on/off - Default:
off - Always save images even if there was no motion. fr fr, zero motion, still saving. π
- Values:
pauseβ hold up, pause the detection βΈοΈ- Values:
on/off - Default:
off - When Motion is started, pause the motion detection.
- Values:
thresholdβ how much has to change before we call it motion π¨- Values:
1to unlimited - Default:
1500 - Threshold for number of changed pixels in an image that triggers motion detection.
- Values:
threshold_maximumβ and a ceiling for that π§±- Values:
0,1to unlimited - Default:
0 - Maximum of changed pixels in an image that triggers motion detection. A value of zero disables this option.
- Values:
threshold_tuneβ auto-tune that threshold ποΈ- Values:
on/off - Default:
off - Automatically tune the threshold down if possible.
- Values:
noise_levelβ background noise? not today π«οΈ- Values:
1to unlimited - Default:
32 - Noise threshold for the motion detection.
- Values:
noise_tuneβ auto-tune the noise π- Values:
on/off - Default:
on - Automatically tune the noise threshold.
- Values:
despeckle_filterβ clean up the messy lil speckles π§Ό- Values:
e/E: eroded/D: dilatel: label
- Default: Not defined
- Despeckle motion image using (e)rode or (d)ilate or (l)abel. The recommended value is
EedDl. Any combination (and number of) ofE,e,d, andDis valid. (l)abeling must only be used once and the'l'must be the last letter. Comment out to disable. π
- Values:
area_detectβ trigger scripts from specific zones π- Values:
1to9 - Default: Not Defined
- When motion is detected in the predefined areas indicated below, trigger the script indicated by the
on_area_detected. The trigger is only activated once during an event. one or more areas can be specified with this option. Note that this option is only used to trigger the indicated script. It does not limit all motion detection events to only the area indicated.
- Values:
Image Areas
123
456
789
mask_fileβ a PGM mask telling motion where to look π- Values: User specified string
- Default: Not defined
- When particular area should be ignored for motion, it can be accomplished using a PGM mask file. The PGM mask file is a specially constructed mask file that allows the user to indicate the areas for which motion should be monitored. This option specifies the full path and name for the mask file.
mask_privacyβ a PGM mask that hides stuff from every image π- Values: User specified string
- Default: Not defined
- The PGM mask file is a specially constructed mask file that allows the user to indicate the areas to remove from all images. This option specifies the full path and name for the privacy mask file.
smart_mask_speedβ how fast the dynamic mask changes πββοΈ- Values:
0to10 - Default:
0(off) - Speed of mask changes when creating a dynamic mask file.
- Values:
lightswitch_percentβ ignore the lights getting flipped on π‘- Values:
0to100 - Default:
0 - Ignore sudden massive light intensity changes. Triggers when the percentage of the picture area that changed intensity is greater than this value.
- Values:
lightswitch_framesβ how many frames we sit out after that π€- Values:
1to1000 - Default:
5 - Number of frames to ignore when lightswitch has been triggered.
- Values:
minimum_motion_framesβ how many frames in a row before we commit π¬- Values:
1to unlimited - Default:
1 - The minimum number of picture frames in a row that must contain motion before a event is triggered. The default of
1means that all motion is detected. The recommended range is1to5.
- Values:
event_gapβ how long a silence ends an event β³- Values:
-1to unlimited - Default:
60 - The number of seconds of no motion that triggers the end of an event. An event is defined as a series of motion images taken within a short timeframe. The recommended value is
60seconds. The value-1is allowed and disables events causing all Motion to be written to one single movie file and nopre_capture. If set to0, motion is running in gapless mode. Movies don't have gaps anymore. An event ends right after no more motion is detected andpost_captureis over.
- Values:
pre_captureβ the buffered pics from before the motion π»- Values:
0to unlimited - Default:
0 - The number of pre-captured (buffered) pictures from before motion was detected that will be output upon motion detection. The recommended range is
0to5. It is not recommended to use large values since it will cause Motion to skip frames. To smooth movies use larger values ofpost_captureinstead.
- Values:
post_captureβ and the pics after the motion ποΈ- Values:
0to unlimited - Default:
0 - Number of frames to capture after motion is no longer detected.
- Values:
π¬ Script Options π
on_event_start,on_event_end,on_picture_saveon_motion_detected,on_area_detected,on_movie_starton_movie_end,on_camera_lost,on_camera_found- Values: User defined string
- Default: Not defined
- Specify the full path and file name for the script to execute when the indicated event occurs. When a file name is required for the script, append a
%fto the script string. π«Ά
picture_outputβ when do we save pics πΈ- Values:
on,off,first,best,center - Default:
off - Output pictures when motion is detected. When set to
'first', only the first picture of an event is saved. Picture with most motion of an event is saved when set to'best'. Picture with motion nearest center of picture is saved when set to'center'. Can be used as preview shot for the corresponding movie. π
- Values:
picture_output_motionβ ghost images only, iconic tbh π»- Values:
on/off - Default:
off - Output pictures with only the pixels moving object (ghost images).
- Values:
picture_typeβ pick your format πΌοΈ- Values:
jpeg/ppm/webp/grey - Default:
jpeg - The file type of output images.
- Values:
picture_qualityβ how crispy π- Values:
1to100 - Default:
75 - The quality (in percent) to be used by the jpeg and webp compression.
- Values:
picture_exifβ a lil note in the EXIF π- Values: User specified string
- Default: Not defined
- Text to include in a JPEG EXIF comment.
picture_filenameβ bestie, this is the file path for your motion triggered images (jpeg, ppm or webp), relative totarget_dir. π- Values: User specified string
- Default:
%v-%Y%m%d%H%M%S-%q - The file extension
.jpg,.ppmor.webpgets added automatically, so do not include it yourself, okay? π«Ά - Set it to
'preview'and team it up with the best-preview feature and you unlock a special naming convention for preview shots. β¨ - This option accepts the conversion specifiers included at the end of this manual.
snapshot_intervalβ how often we're out here snatching snapshots. πΈ- Values: 0 to unlimited
- Default:
0 - When it's
0, the snapshot feature is straight up disabled, periodt. When you give it a value, that value is the number of seconds between snapshots.
snapshot_filenameβ the file path for snapshots, relative totarget_dir. π- Values: User specified string
- Default:
%v-%Y%m%d%H%M%S-snapshot - The file extension
.jpg,.ppmor.webpis automatically added so do not include this. - A symbolic link called
lastsnap.jpgcreated in thetarget_dirwill always point to the latest snapshot β unlesssnapshot_filenameis exactly'lastsnap'. π - This option accepts the conversion specifiers included at the end of this manual.
movie_outputβ useffmpegto encode movies of the motion. cinema, but make it yours. π¬- Values: on/off
- Default:
on
movie_output_motionβ useffmpegto encode movies with only the pixels of the moving object. ghost images, lowkey iconic. π»- Values: on/off
- Default:
off
movie_max_timeβ the maximum length in seconds of a movie. β±οΈ- Values: 0 to unlimited
- Default:
120 - When the value is exceeded, a new movie file gets created. A value of
0means there is no limit at all, go off.
movie_bpsβ the bitrate to be used by theffmpegencoder. π- Values: 0 to unlimited
- Default:
400000 - This option is ignored if
movie_qualityis not0.
movie_qualityβ enable and define the variable bitrate for theffmpegencoder. π- Values: 0 to 100
- Default:
60 movie_bpsis ignored if variable bitrate is enabled.- When specified as
0, use the fixed bitrate defined bymovie_bps. - When defined as
1-100, it varies the quality of the movie. A value of1is worst quality versus a value of100is best quality. slay.
movie_codecβ for regular motion videos, the container/codec must be available in theffmpeginstalled on the computer. no cap, check your install first. π- Values:
- Motion videos:
mpeg4- Creates.avifilemsmpeg4- Creates.avifileswf- Flash film with extension.swfflv- Flash video with extension.flvffv1- FF video codec 1 for Lossless Encodingmov- QuickTimemp4- MPEG-4 Part 14 H264 encodingmkv- Matroska H264 encodinghevc- H.265 / HEVC (High Efficiency Video Coding)
- Motion videos:
- Default:
mkv
- Values:
movie_duplicate_framesβ when creating videos, should frames be duplicated in order to keep up with the requested frames per second? π- Values: on/off
- Default:
off
movie_passthroughβ when using a rtsp camera, make movies without decoding the stream. efficiency queen. π- Values: on/off
- Default:
off
movie_filenameβ file path for motion triggeredffmpegfilms (movies), relative totarget_dir. π- Values: User specified string
- Default:
%v-%Y%m%d%H%M%S - The extensions (
.swf,.avi, etc) are automatically added so do not include them. - This option accepts the conversion specifiers included at the end of this manual.
movie_extpipe_useβ use the external pipe in order to encode videos. π₯- Values: on/off
- Default:
off - This is a replacement option for the FFMPEG builtin encoder for
movie_outputonly. - The options
movie_filenameandtimelapse_filenameare also used from the ffmpeg feature.
movie_extpipeβ command line string to receive and process a pipe of images to encode. π«Ά- Values: User specified string
- Default: Not defined
- Generally, use
'-'for STDIN.
timelapse_intervalβ number of seconds between frame captures for a timelapse movie. β³- Values: 0 to unlimited
- Default:
0 - Specify
0to disable the timelapse.
timelapse_modeβ file rollover mode for the timelapse video. ποΈ- Values:
hourlydailyweekly-sundayweekly-mondaymonthlymanual
- Default:
daily
- Values:
timelapse_fpsβ frames per second used for playback of the timelapse video. πΈ- Values: 0 to unlimited
- Default:
30
timelapse_codecβ formpgtimelapse videos, if motion is shutdown and restarted, new pics will be appended to any previously created file with the name indicated for timelapse. Formpeg4timelapse videos, if motion is shutdown and restarted, new pics will create a new file with the name indicated for timelapse. different vibes, both valid. π«- Values:
mpg- Creates mpg file with mpeg-2 encoding.mpeg4- Creates avi file with the default encoding.
- Default:
mpg
- Values:
timelapse_filenameβ file path for timelapse movies relative totarget_dir. π- Values: User specified string
- Default:
%Y%m%d-timelapse - The file extensions (
.mpg.avi) are automatically added so do not include them. - This option accepts the conversion specifiers included at the end of this manual.
video_pipeβ output images to a video4linux loopback device. π¦- Values: User specified string
- Default: Not Defined
video_pipe_motionβ output motion images to a video4linux loopback device. β¨- Values: User specified string
- Default: Not Defined
webcontrol_portβ port number for the web control / preview page. π- Values: 0 to maximum port number
- Default:
0
webcontrol_ipv6β listen to IPv6 localhost instead of IPv4. π- Values: on/off
- Default:
off - This option is also applicable for all streams.
webcontrol_localhostβ restrict control connections to localhost only. safety first, bestie. π- Values: on/off
- Default:
on
webcontrol_parmsβ the type of parameters that are able to be modified via the web interface. π οΈ- Values:
0= No parameters available to change on web control1= Limited list of parameters available to change2= Advanced list of parameters (usually requires restart to become effective)3= Restricted list of parameters (User IDs, passwords, commands to execute, etc)
- Default:
0 - > This parameter can never be modified via the web interface and must be specified directly in the configuration file. no shortcuts, babes. π
- Values:
webcontrol_interfaceβ specifies the web control interface type. π¨- Values: 0-2
- Default:
0 0=css,1=text,2=legacy
webcontrol_auth_methodβ the authentication method to use for the webcontrol. π- Values:
0= disabled1= Basic authentication2= MD5 digest (the safer authentication)
- Default:
0
- Values:
webcontrol_authenticationβ the username and password to use for authentication of the webcontrol. π- Values: User specified string
- Default: Not defined
- The format is
Username:Password
webcontrol_tlsβ when specified ason, use SSL/TLS for the webcontrol. πβ¨- Values: on/off
- Default:
off
webcontrol_certβ the full path to the SSL certification file for webcontrol. π- Values: User specified string
- Default: Not defined
webcontrol_keyβ the full path to the SSL key file for webcontrol. ποΈ- Values: User specified string
- Default: Not defined
webcontrol_header_paramsβ the comma separatedheader=valuepairs to use for the webcontrol responses. π- Values: User specified string
- Default: Not defined
webcontrol_lock_attemptsβ the number of failed authentication attempts before IP is locked out. π«- Values: integer
- Default:
5
webcontrol_lock_minutesβ the number of minutes a failed authentication IP is locked out. β²οΈ- Values: integer
- Default:
5
webcontrol_lock_max_ipsβ the maximum number of concurrent IPs that can be locked out. π- Values: integer
- Default:
5
stream_portβ this option is the port number that the mini-http server listens on for streams of the pictures. πΊ- Values: 0 to port number limit
- Default:
0
stream_localhostβ restricts stream connections to localhost only π- Values:
on/off - Default:
on - Description: Restrict stream connections to localhost only
- Values:
stream_auth_methodβ the authentication method to use for viewing the stream π- Values:
0= disabled1= Basic authentication2= MD5 digest (the safer authentication)
- Default:
0 - Description: The authentication method to use for viewing the stream.
- Values:
stream_authenticationβ the username and password for stream auth π«Ά- Values: User specified string
- Default: Not defined
- Description: The username and password to use for authentication of the stream. The format is
Username:Password
stream_tlsβ turn on SSL/TLS for the stream port β¨- Values:
on/off - Default:
off - Description: When specified as
on, use SSL/TLS for the stream port.
- Values:
stream_header_paramsβ extra header pairs for stream responses π- Values: User specified string
- Default: Not defined
- Description: The comma separated
header=valuepairs to send for the stream responses.
stream_preview_scaleβ how much to scale preview images π¦- Values:
1to100 - Default:
25 - Description: This defines what percentage the stream image should be scaled to for the preview page
- Values:
stream_preview_newlineβ stack preview images or keep them side by side πΈ- Values:
on/off - Default:
off - Description: When the image is put on the preview page, should the image start on a new line. This option allows the user to specify whether the preview images should be side by side or stacked on the page.
- Values:
stream_preview_methodβ how images show up on the webcontrol page π- Values:
0to2 - Default:
0 - Description: Method to display images on webcontrol page.
0=Full,1=Substream,2=Static
- Values:
stream_qualityβ jpg quality percent for the stream π₯- Values:
1to100 - Default:
50 - Description: The quality in percent for the jpg images streamed.
- Values:
stream_greyβ send the live stream in black and white π€- Values:
on/off - Default:
off - Description: Send the live stream of the camera in grey (black and white) instead of color.
- Values:
stream_maxrateβ maximum frame rate for the stream πββοΈ- Values:
1to unlimited - Default:
1 - Description: Maximum frame rate to send to stream
- Values:
stream_motionβ drop to 1 fps when nothing is moving π- Values:
on,off - Default:
off - Description: Limit stream to 1 fps when no motion is being detected.
- Values:
database_typeβ which database bestie are we using ποΈ- Values:
mysql,mariadb,postgresql,sqlite3 - Default: Not defined
- Description: The type of database being used.
- Values:
database_dbnameβ the database name (or SQLite3 path) π- Values: User defined string
- Default: Not defined
- Description: The name of the database being used (
dbname). For SQLite3, the full path to the database.
database_hostβ where the database lives π- Values: User defined string
- Default:
localhost - Description: The hostname, DNS name, or IP address at which the database is running. Optionally for PostgreSQL, full path of the local directory containing its Unix domain pipe. For SQLite3, ignored.
database_portβ TCP port for database access π- Values:
0to maximum port number - Default: Not defined
- Description: TCP port number used for database access. For SQLite3, ignored. Default ports used by DBMSs: MySQL & MariaDB,
3306; PostgreSQL,5432.
- Values:
database_userβ username to access the database πββοΈ- Values: User defined string
- Default: Not Defined
- Description: The username to access the database. For SQLite3, ignored.
database_passwordβ password for that database user π- Values: User defined string
- Default: Not Defined
- Description: The database password for the user to access the database. For SQLite3, ignored.
database_busy_timeoutβ SQLite3 wait time for locked database β³- Values:
0to unlimited - Default:
0 - Description: SQLite3 only: database wait time in milliseconds for locked database to be unlocked before returning database locked error
- Values:
sql_log_pictureβ log when a motion-triggered picture is created πΈ- Values:
on/off - Default:
off - Description: Log to the database when creating motion triggered picture file
- Values:
sql_log_snapshotβ log when a snapshot image file is created πΌοΈ- Values:
on/off - Default:
off - Description: Log to the database when creating a snapshot image file
- Values:
sql_log_movieβ log when a motion-triggered movie file is created π¬- Values:
on/off - Default:
off - Description: Log to the database when creating motion triggered movie file
- Values:
sql_log_timelapseβ log when timelapse movie files are created β±οΈ- Values:
on/off - Default:
off - Description: Log to the database when creating timelapse movies file
- Values:
sql_queryβ the SQL that runs when Motion saves an image or starts recording π§Ύ- Values: User defined string
- Default: Not defined
- Description: SQL statement to execute when Motion saves an image file or begins recording a movie and the corresponding file type's
sql_log_*configuration option is seton. Use same conversion specifiers as for text features. Additional special conversion specifiers are:%n= the number representing the file_type%f= filename with full path
- Sample table set up (not
sql_query):
Mysql: CREATE TABLE security (camera INTEGER NOT NULL, filename CHAR(80) NOT NULL, frame INTEGER, file_type INTEGER NOT NULL, time_stamp DATETIME NOT NULL, text_event CHAR(255));
Postgresql: CREATE TABLE security (camera INTEGER NOT NULL, filename VARCHAR NOT NULL, frame INTEGER, file_type INTEGER NOT NULL, time_stamp TIMESTAMP NOT NULL, text_event VARCHAR);
- Sample
sql_query
INSERT INTO security(camera, filename, frame, file_type, time_stamp, text_event) VALUES(%t, '%f', %q, %n, '%Y-%m-%d %T', '%C')
sql_query_startβ SQL that runs at the start of a motion event π¦- Values: User defined string
- Default: Not defined
- Description: SQL statement to execute at the start of a motion event. When the related table schema (and, for PostgreSQL, a
RETURNINGclause included in this statement) provide for it, the database generates a table-unique event ID that is returned and substituted for the%{dbeventid}conversion specifier. When no valid value is returned,%{dbeventid}is replaced by zero.
sql_query_stopβ SQL that runs when a motion event movie or timelapse movie closes π- Values: User defined string
- Default: Not defined
- Description: SQL statement to execute upon closure of a motion event movie or timelapse movie file, provided the corresponding file type's
sql_log_*configuration option is seton.
track_typeβ what kind of tracker are we working with π―- Values:
0= none1= stepper2= iomojo3= pwc4= generic5= uvcvideo6= servo
- Default:
0 - Description: This option specifies the type of tracker. The
generictype enables the definition of motion center and motion size to be used with the conversion specifiers for options likeon_motion_detected
- Values:
track_autoβ automatic tracking on or off π€- Values:
on/off - Default:
off - Description: Enables/disables the automatic tracking.
- Values:
track_portβ serial port of the motor π- Values: User specified string
- Default: Not defined
- Description: The serial port of the motor. For example
/dev/ttyS0
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β the tracking parameter squad π- Values: device dependent
- Default:
0 - Description: These options specify the parameters for cameras with tracking capabilities.
track_generic_moveβ script to run for generic tracking movement π- Values: User specified string
- Default: Not defined
- Description: Full path and file name for the script to execute to move a camera in generic tracking mode.
π‘ 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 πΎ
Okay bestie, this is the part where Motion figures out which config file to read and how it handles your whole camera situation, and it's giving very organized queen energy. Let's go. β¨
If Motion got invoked with the command line option -c pathname, then Motion is gonna expect the config file to be exactly the one you specified. And the slay part? When you pass the config file on the command line with -c, you can name it literally anything. No rules. Free spirit. π¦
But if you don't pass -c, or the filename you gave Motion doesn't actually exist, Motion goes hunting for a config file called motion.conf, and it searches in this exact order:
- The current directory from where motion was invoked
- Then a directory called
.motioninside the current user's home directory (shell environment variable$HOME). Like, for example,/home/goofy/.motion/motion.conf - The
motion/subdirectory inside the directory defined by the--sysconfdir=DIRwhen you ran.configureduring installation of Motion (and if that option wasn't 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. One. Singular. Not a whole collection. π
Motion ships with a config file in the distribution package called motion-dist.conf. When you run make install, this file gets copied to the /usr/local/etc/motion directory.
And here's the tea: that config file needs to be renamed from motion-dist.conf to motion.conf. Why is the original called motion-dist.conf? Because the naming means your perfectly working motion.conf does not accidentally get overwritten when you re-install or upgrade to a newer version of Motion. Protective king behavior, honestly. π
Now, if you have more than one camera, do not try and invoke Motion a bunch of times. Just don't. Motion is built 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 spin up an extra thread of itself for each camera. So if you've only got one camera, you only need the motion.conf file. But the minute you have two or more cameras, you must have one camera config file per camera besides the motion.conf file.
So, say you've got two cameras? You need motion.conf plus two camera config files. That's 3 config files total. Math is math. π’
An option that's common to all cameras can live in motion.conf. (You can also put all parameters in the camera files, but that makes for a lot of editing when you change one common thing. Nobody wants that.) 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 gets used for all cameras, except for the cameras where that same option is defined in a camera config file.
Motion reads its configuration parameters in this sequence, and if the same parameter exists in more than one place, the last one read wins:
- Motion reads the configuration file
motion.conffrom the beginning of the file going down line by line. - If the option
camerais defined inmotion.conf, the camera configuration file(s) is/(are) read. - Motion continues reading the rest of the
motion.conffile. Any options from here will overrule the same option previously defined in a camera config file. - Motion reads the command line option again, overruling any previously defined options.
So always call the camera config files at the end of the motion.conf file. Because if you define options in motion.conf after the camera file calls, the same options in the camera files will never be used. Never ever. So always put the camera file call at the end of motion.conf. Periodt. π
If motion is built without specific features such as ffmpeg, mysql etc, it will ignore the options that belong to those features. You do not have to remove them or comment them out. Chill.
And if you run the http control command
http://host:port/0/config/writeyes
motion will overwrite motion.conf and all the camera.conf files with autogenerated config files, neatly formatted, and only with the features included that Motion was built with. Then 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 boom β you'll have new config files with the new options included, all set to their default values. This makes upgrading very easy to do. Upgrading? Easy. Iconic. π₯
π 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.
And in text_left and text_right you can additionally use '\n' for a new line. Cute, right? π
%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 thetext_eventfeature.%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 theon_picture_save,on_movie_start,on_movie_end, andsql_queryfeatures.%Fβ Equivalent to%Y-%m-%d(the ISO 8601 date format).%hβ The height of the image.%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 whenlocateis 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 whenlocateis 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 theon_picture_save,on_movie_start,on_movie_end, andsql_queryfeatures.%Nβ Noise level.%oβ Threshold. The number of detected pixels required to trigger motion. Whenthreshold_tuneis'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 aspmand midnight asam.%Pβ Like%pbut in lowercase:amorpmor 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 thedespecklefeature.%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., since1970-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%Vand%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%Uand%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 frommysql_insert_id.%{ver}β The version number of Motion.
π More information π
Motion homepage: https://motion-project.github.io/
Motion Guide (user and installation guide):
And yes, bestie β the link after that colon is literally just... blank in the page. Nothing there. Not me staring at it π. We report, we don't invent. π
π 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 others.
And that's a wrap on MOTION(1), babe! π«Ά This page came from the Motion project and it's dated 2020-10-19 β so if you're reading this and the date feels like a lil throwback, that's why. Go point a camera at something and make it move. πΈβ¨ Byeee! π
π¦ where this page comes from
- arch rolling: motion 4.7.1-2 Β· GPL
- debian trixie: motion 4.7.0-3 Β· GPL-2.0-or-later
- nixos 26.05: motion 4.7.1
- nixpkgs unstable: motion 4.7.1
- ubuntu questing: motion 4.7.0-3
- ubuntu resolute: motion 4.7.1-1build1 Β· GPL-2.0-or-later
- ubuntu stonking: motion 4.7.1-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms