MOTION(1) Motion Options and Config Files MOTION(1) NAME motion - Detect motion using a video4linux device SYNOPSIS motion [ -BCDhlmNpQw] [ -A ipnr] [ -a seconds] [ -c changes] [ -d device] [ -E command] [ -F file(1,n)] [ -f nr] [ -G seconds] [ -g seconds] [ -i input] [ -L noise] [ -M address] [ -n norm] [ -O command] [ -P device] [ -q quality] [ -S nr] [ -s widthxheight] [ -t target dir] [ -u user:pass ] [ -U webcam_path ] [ -V device] DESCRIPTION Motion uses a video4linux device to detect motion. If motion is detected both normal and motion pictures will be taken. Motion can also take actions to notify you if(3,n) needed. Creation of automated snapshots is also possible. OPTIONS -A IP address or URL for Network Camera (e.g. an Axis network cam- era). Only relevant for network cameras. -a seconds time(1,2,n) between two automated snapshots, valid range: 0 to thou- sands, default: 0. The default value of 0 means that the fea- ture is disabled. -B Encode all jpg images to mpeg after a event using mpeg_encode -C Output changes count for every frame, usable for tuning. Writes the detected number of changed pixels (after noise filtering) to the console(4,n) (non-daemon mode only). -c changes threshold for detecting a change, Valid range: 1 to thousands, default: 1500. -D Daemonize -d device video4linux capture device, default: /dev/video0 -E command Execute 'command' when detecting motion. The command is exe- cuted at the beginning of the event before the images are stored. -F file(1,n) pgm image to use as a mask for filtering motion. This file(1,n) must have the same size as you have set(7,n,1 builtins) for the video4linux device. Black area means masked out. White means fully include in(1,8) motion detection. -f number Maximum number of picture frames per second that motion takes when detecting movement. Valid range: 0 to limit of camera. Default is none which means that it takes as many as possible. -G seconds Minimum gap between two shots in(1,8) seconds. 0 to thousands, default: 0 -g seconds minimum gap between events, Valid range: 1 to thousands, default 60. An event is defined as a series of motion images taken within a short timeframe. -h Display an short text with all command line functions. -i input input channel to use for video capture cards. Valid range: depends on video capture card, default: not set(7,n,1 builtins) -L noise Noise level, all changes smaller than this level will be consid- ered noise. Valid range: 1 to 255, default: 32 -l Do not locate and mark motion on output pictures. The mark is in(1,8) the form of a rectangle on the saved images so that you can easily see what it was that was moving in(1,8) the picture. -M address Send a mail(1,8) to 'address' when detecting motion. -m Output 'motion' images. Motion images shows the motion content of the pictures. This is good for tuning and testing but proba- bly not very interesting for the general public. Default is not to store motion images. Motion pictures have an m at the end of the filename. -N Don't output normal images. Normal image is an image that is stored when motion is detected. It is the same image that was taken by the camera. This option turns the feature OFF. -n norm norm to use (pal/pal-nc/ntsc/secam), default: pal. For capture cards only. -O command Execute 'command' when an image is saved. The name of the image will be given as argument. -P device video4linux video loopback input for normal images. If a dash '-' is given as device, motion will try to use /proc(5,n)/video/vloopback/vloopbacks to find a free pipe(2,8) on its own. default: not set(7,n,1 builtins) -p Output ppm images instead of jpeg. This will reduce CPU load(7,n) but disk I/O will increase a lot. -Q Don't sound the warning beep(1,3x,3x curs_beep) when detecting motion. (This doesn't change anything in(1,8) daemon mode, there never is a beep(1,3x,3x curs_beep) there) -q quality JPEG image quality, Valid range: 0-100,default: 75. -S number Send a SMS to number using sms_client when detecting motion. -s widthxheight Picture size, Valid range: Camera dependent, default: 352x288 -t target-dir destination for snapshots. Default is current working directory. -U url|IP_addr Webcam path. URL for a net camera. -u user:pass For password-protected network cameras, use this option for the HTTP 1.1 Basic authentication mechanism. default: No authentica- tion. Only relevant for network cameras. -V device Output device name. Device name that motion uses to generate output for the video loopback device driver. -w Activate light switch(1,n) filter. With this option on motion will not classify sudden light differences as a motion (not 100% fail proof!) CONFIG FILE OPTIONS These are the options that can be used in(1,8) the config(1,5) 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). adjust_rate on|off Try to make the frame rate of the created mpegs as normal as possible. Normal means round 25 frames per second. Allowed val- ues: on, off. Default: off always_changes on|off Always display the differences between the captured frame and the reference frame (non-daemon mode only). This can come in(1,8) handy while tuning your setup. Default: off auto_brightness on|off Motion will try to adjust the brightness of the video device if(3,n) the images captured are to dark or to light. This option will be most useful for video devices like web cams, which sometimes don't have such an option in(1,8) hardware. Default: off berkeley_single_directory on|off Use single directory structure (For Berkeley mpeg_encode feature only). Default: off control_localhost on|off Limits the xml-rpc control to the localhost. Default: on control_port port_no Sets the port number for the xml-rpc based remote control. Default: 0 (not defined) daemon on|off Start motion in(1,8) daemon mode and release terminal. Default: off despeckle EedDl Despeckle motion image using (e)rode or (d)ilate followed by optional (l)abeling of largest area (Default: not defined) Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid. (l)abeling must only be used once and as the last letter. Comment out to disable execute command External command to be executed when detecting motion. Default: none ffmpeg_bps bps Bitrate of mpegs produced by ffmpeg. Default: 400000 (400Kbps) ffmpeg_cap_new on|off Use ffmpeg libraries to encode mpeg movies in(1,8) realtime. Default = off. FFmpeg Streaming Multimedia System must be installed saperately. ffmpeg_cap_motion on|off Use ffmpeg libraries to encode motion type mpeg movies in(1,8) real- time. Default = off. FFmpeg Streaming Multimedia System must be installed saperately. ffmpeg_filename filepath File path for motion triggered ffmpeg films (mpeg) relative to target_dir. Default value (%v-%Y%m%d%H%M%S) is equivalent to legacy 'oldlay- out' option. For Motion 3.0 compatible mode (directories based on date and time(1,2,n)) choose: %Y/%m/%d/%H%M%S. File extension .mpg is automatically added so do not include this. This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: %Y = year, %m = month as two digits, %d = date, %H = hour, %M = minute, %S = second. Two are unique to motion %v = event, %q = frame number. With a combination of text and conversion specifiers you have full flexibility to define your directory- and filenames. For a full list of conversion specifiers see the section 'Conversion Specifiers for Advanced Filename and Text Feature'. If you are happy with the directory structures the way they were in(1,8) earlier versions of motion use %v-%Y%m%d%H%M%S for 'oldlayout on' and %Y/%m/%d/%H%M%S for 'oldlayout off'. ffmpeg_timelapse_mode The file(1,n) rollover mode of the timelapse video. Valid values: hourly, daily (default), weekly-sunday, weekly-monday, monthly, manual. ffmpeg_timelapse seconds Use ffmpeg libraries to encode a timelapse movie, saving a pic- ture frame at the interval in(1,8) seconds set(7,n,1 builtins) by this parameter. Default = not defined. Set it to 0 if(3,n) not used. ffmpeg_variable_bitrate Enables and defines variable bitrate for the ffmpeg encoder. ffmpeg_bps is ignored if(3,n) variable bitrate is enabled. Valid values: 0 (default) = fixed bitrate defined by ffmpeg_bps, or the range 2 - 31 where 2 means best quality and 31 is worst. ffmpeg_video_codec Codec to used by ffmpeg for the video compression. Supported formats are: mpeg1 (default), mpeg4, and msmpeg4. Timelapse mpegs are always made in(1,8) mpeg1 format independent from this option. mpeg1 gives you files with extension .mpg mpeg4 or msmpeg4 give you files with extension .avi msmpeg4 is recommended for use with Windows Media Player because it requires with no installation of codec on the Windows client. framerate number Maximum number of frames that are saved per second. Valid range: 2-100. Default: 100 (almost no limit). To set(7,n,1 builtins) intervals longer than one second use the 'minimum_gap' option instead. frequency value The frequency to set(7,n,1 builtins) the tuner to (kHz). Valid range: per tuner spec, default: 0 (Don't set(7,n,1 builtins) it) gap seconds The minimum gap between two events in(1,8) seconds. Default: 60. An event is defined as a series of motion images taken within a short timeframe. height pixels The height of each frame. Valid range: Camera dependent, default: 288 input number Select the input of the video device. Valid range: depends on video capture card, default: 8. Only used for video capture cards (bttv driver). jpg_cleanup on|off Remove all jpeg images after making a mpeg movie of them. Default: off jpeg_filename filepath File path for motion triggered images (jpeg or ppm) relative to target_dir. Default value (%v-%Y%m%d%H%M%S-%q) is equivalent to legacy 'old- layout' option. For Motion 3.0 compatible mode (directories based on date and time(1,2,n)) choose: %Y/%m/%d/%H/%M/%S-%q. File extension .jpg or .ppm is automatically added so do not include this. This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: %Y = year, %m = month as two digits, %d = date, %H = hour, %M = minute, %S = second. Two are unique to motion %v = event, %q = frame number. With a combination of text and conversion specifiers you have full flexibility to define your directory- and filenames. For a full list of conversion specifiers see the section 'Conversion Specifiers for Advanced Filename and Text Feature'. If you are happy with the directory structures the way they were in(1,8) earlier versions of motion use %v-%Y%m%d%H%M%S-%q for 'old- layout on' and %Y/%m/%d/%H/%M/%S-%q for 'oldlayout off'. The mpeg_encode feature assumed that the jpegs are stored specific places and with specific names. If you enable berkeley_single_directory - jpeg_filename must be the default value %v-%Y%m%d%H%M%S-%q. If you disable berkeley_single_directory - jpeg_filename must be %Y/%m/%d/%H/%M/%S-%q. lightswitch percent Ignore sudden massive light intensity changes given as a per- centage of the picture area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled locate on|off Locate and draw a box around the moving object. Default: off low_cpu framerate When this option is not zero motion will be in(1,8) a low cpu(5,8,8 cpu-ldap) mode while not detecting motion. In low cpu(5,8,8 cpu-ldap) mode Motion reduces the framerate to the value given for this option. Value zero means disabled. Default: 0 (disabled). mail(1,8) address Address to send(2,n) an e-mail to when detecting motion Default: none mask_file file(1,n) PGM file(1,n) to use as a sensitivity mask. This picture MUST have the same width and height as the frames being captured and be binary format. Use gray scale to adjust motion sensitivity from none (black) to full (white). Default: not set. max_mpeg_time seconds The maximum length of an mpeg movie. Default: 3600 seconds (one hour). Set this to zero for unlimited length. mpeg_encode on|off Use the Berkeley mpeg encoder 'mpeg_encode' to make movies of the events Default: off mpeg_encode_bin path Specify the path to the mpeg_encoder. Default is /usr/local/bin/mpeg_encode minimum_gap seconds The minimum time(1,2,n) between two shots in(1,8) seconds while detecting motion. Valid range: 0 to thousands, default: 0 (no minimum) minimum_motion_frames number Picture frames must contain motion at least the specified number of frames in(1,8) a row before they are detected as true motion. At the default of 1, all motion is detected. Valid range: 1 to thousands, recommended 1-10. motion_video_pipe devicename|- The video4linux video loopback input device for motion images. If a particular pipe(2,8) is to be used then use the device filename of this pipe(2,8), if(3,n) a dash '-' is given motion will use /proc(5,n)/video/vloopback/vloopbacks to locate a free pipe. Default: not set(7,n,1 builtins) netcam_url URL Specify an url to a downloadable jpeg file(1,n) to use as input device. Such as an AXIS 2100 network camera. Default: not set. netcam_userpass user:pass For network cameras protected by username and password, use this option for HTTP 1.1 Basic authentication. The string(3,n) is speci- fied as username:password. Default: No authentication night_compensate on|off When this option is set(7,n,1 builtins) the noise threshold will be lowered if(3,n) the picture is to dark. This will improve the sensitivity in(1,8) dark places. However it might also increase the number of false alarms since most cameras also compensate for this with their AGC which will increase noise. Default: off noise_level level The noise level is used as a threshold for distinguishing between noise and motion. Valid range: 1 to 255, default: 32. This is different from the threshold parameter. noise_level works for changes at pixel level. noise_tune on|off With this option enabled the noise_level is ignored, motion will measure the average noise level and calculate the level itself. Default: on norm 0|1|2|3 Select the norm of the video device. Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL). For capture cards only. onffmpegclose command Execute 'command' when an mpeg movie, which is generated by ffm- peg, is closed. Default: not set. onmpeg command Execute 'command' when an mpeg movie is generated. The name of the movie will be given as argument. Default: not set. onsave command Execute 'command' when an image is saved. The name of the image will be given as argument. Default: not set. output_all on|off Always save pictures (which depends on output_normal and out- put_motion) even when no motion is detected. output_motion on|off Output pictures with only the moving object. Default: off output_normal on|off Output 'normal' pictures. Default: on post_capture number Specifies the number of frames to be captured after motion has been detected. Valid range: 0 to thousands, default=0. ppm on|off Output ppm images instead of jpeg. This uses less(1,3) CPU time(1,2,n), but causes a LOT of hard disk I/O, it is generally slower than jpeg. Default: off pre_capture number Specifies the number of previous frames to be outputed at motion detection. Valid range: 0 to thousands, default=0. predict_description filename.desc Load prediction description file. This option can be repeated for each additional files that needs to be loaded. predict_enable on|off Enable the new experimental prediction feature. Default: off. predict_filename filepath File path for prediction files. Default value (%v-%Y%m%d%H%M%S) is equivalent to legacy 'oldlay- out' option. For Motion 3.0 compatible mode (directories based on date and time(1,2,n)) choose: %Y/%m/%d/%H%M%S. File extension .desc is automatically added so do not include this. This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: %Y = year, %m = month as two digits, %d = date, %H = hour, %M = minute, %S = second. Two are unique to motion %v = event, %q = frame number. With a combination of text and conversion specifiers you have full flexibility to define your directory- and filenames. For a full list of conversion specifiers see the section 'Conversion Specifiers for Advanced Filename and Text Feature'. If you are happy with the directory structures the way they were in(1,8) earlier versions of motion use %v-%Y%m%d%H%M%S for 'oldlayout on' and %Y/%m/%d/%H%M%S for 'oldlayout off'. predict_threshold value Set threshold for reporting motion as predicted on the console. Default: 90 quality value The quality for the jpeg images. Valid range: 1-100,default: 75 quiet on|off Be quiet, don't output beeps when detecting motion. Default: off rotate degrees Rotate image this number of degrees. The rotation affects all saved images as0 well as mpeg movies. Valid values: 0 (default = no rotation), 90, 180 and 270 roundrobin_frames number Specifies the number of frames to capture before switching inputs, this way also slow switching (e.g. every second) is pos- sible. Default: 1. Used for capture cards with more than one input. When creating thread config(1,5) files for the same video device but different channel/frequency motion goes into round robing mode. This means that motion changes the channel/fre- quency of the capture card and thread each channel as individual and seperate inputs. roundrobin_skip number Specifies the number of frames to skip after a switch. (1 of you are feeling lucky, 2 if(3,n) you want to be safe). Default: 1 sms number Number to send(2,n) an SMS to with sms_client. Default: none snapshot_filename filepath File path for snapshots (jpeg or ppm) relative to target_dir. Default value (%v-%Y%m%d%H%M%S-snapshot) is equivalent to legacy 'oldlayout' option. For Motion 3.0 compatible mode (directories based on date and time(1,2,n)) choose: %Y/%m/%d/%H/%M/%S-snapshot. File extension .jpg or .ppm is automatically added so do not include this. A symbolic link(1,2) called lastsnap.jpg (or lastsnap.ppm) created in(1,8) the target_dir will always point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap'. This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: %Y = year, %m = month as two digits, %d = date, %H = hour, %M = minute, %S = second. Two are unique to motion %v = event, %q = frame number. With a combination of text and conversion specifiers you have full flexibility to define your directory- and filenames. For a full list of conversion specifiers see the section 'Conversion Specifiers for Advanced Filename and Text Feature'. If you are happy with the directory structures the way they were in(1,8) earlier versions of motion use %v-%Y%m%d%H%M%S-snapshot for 'oldlayout on' and %Y/%m/%d/%H/%M/%S-snapshot for 'oldlayout off'. For the equivalent of the now obsolete option 'snap_overwrite' use the value 'lastsnap'. snapshot_interval seconds Make automated snapshots every N seconds. Valid range: 0 to thousands, default: 0 (No snapshots) switchfilter on|off Turns the switch(1,n) filter(1,3x,3x curs_util) on or off. Default is off. The filter(1,3x,3x curs_util) can distinguish between most switching noise and real motion. With this you can even set(7,n,1 builtins) roundrobing_skip to 1 without gener- ating much false detection. target_dir directory_path Target directory for pictures. Default: Current working direc- tory. This is the target directory for all snapshots, motion images and normal images. The default is the current working directory (current working directory of the terminal from which motion was started). You will normally always want to specify this parameter either as a command line option or in(1,8) the config(1,5) file. Use an absolute directory path (not relative) if(3,n) you want to use mpeg_encode. Note that the options snapshot_filename, jpeg_filename, ffm- peg_filename, timelapse_filename and predict_filename all allows specifying directories. These will all be relative to 'tar- get_dir'. This means in(1,8) principle that you can specify tar- get_dir as '/' and be 100% flexible. It also means that Motion can write(1,2) files all over your harddisk if(3,n) you make a mistake. It is recommended to specify the target_dir as deep or detailed as possible for this reason. The Berkeley mpeg_encode feature still demands that the tar- get_dir points directly to the real target directory. text_changes on|off Turns the text showing changed pixels on/off. Default: off By setting this option to 'on' the number of pixels that changed compared to the reference frame is displayed in(1,8) the upper right corner of the pictures. text_left TEXT User defined text is displayed in(1,8) the lower left corner of the pictures. If the option is not defined no text is displayed at this position. The user defined text can be the english alphabet and a selec- tion of symbols: (A-Z, a-z, 0-9, " / ( ) @ ~ # < > | , . : - + _ \n) and conversion specifiers. You can place the text in(1,8) quota- tion marks to allow leading spaces. With a combination is spa- ces and newlines you can position the text anywhere on the pic- ture. A conversion specifier is a code that starts by % (except new- line which is \n). The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: %Y = year, %m = month as two digits, %d = date, %H = hour, %M = minute, %S = second, %T = HH:MM:SS. Two are unique to motion %v = event, %q = frame number. With a combination of text, spaces, new lines \n and conversion specifiers you have some very flexible text features. For a full list of conversion specifiers see the section 'Conversion Specifiers for Advanced Filename and Text Feature'. text_right TEXT User defined text is displayed in(1,8) the lower right corner of the pictures. If the option is not defined the default date- and timestamp is displayed at this position. Default: %Y-%m-%d\n%T = date in(1,8) ISO format and time(1,2,n) in(1,8) 24 hour clock(3,n) The user defined text can be the english alphabet and a selec- tion of symbols: (A-Z, a-z, 0-9, " / ( ) @ ~ # < > | , . : - + _ \n) and conversion specifiers. You can place the text in(1,8) quota- tion marks to allow leading spaces. With a combination is spa- ces and newlines you can position the text anywhere on the pic- ture. A conversion specifier is a code that starts by % (except new- line which is \n). The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: %Y = year, %m = month as two digits, %d = date, %H = hour, %M = minute, %S = second, %T = HH:MM:SS. Two are unique to motion %v = event, %q = frame number. With a combination of text, spaces, new lines \n and conversion specifiers you have some very flexible text features. For a full list of conversion specifiers see the section 'Conversion Specifiers for Advanced Filename and Text Feature'. A major difference from text_left is that if(3,n) this option is undefined the default is %Y-%m-%d\n%T which displays the date in(1,8) ISO for- mat YYYY-MM-DD and below the time(1,2,n) in(1,8) 24 hour clock(3,n) HH:MM:SS. If you do not want any text specify an empty string(3,n) "". thread filename Thread option. With this a separate config(1,5) file(1,n) can be specified to be used for a new separate thread. This is used when you have more than more camera/device. A single camera can get all its options from the default motion.conf file. If you have two or more cameras all cameras must have their unique information in(1,8) a separate thread config(1,5) file. This must be at least the definition of the device or input num- ber of a capture card. Additionally you can add any other options such as target_dir, height/width etc. Format of the thread config(1,5) files is the same as for the motion.conf. You add one thread statement for each camera in(1,8) motion.conf. An option in(1,8) a thread config(1,5) file(1,n) overrides the same option in(1,8) motion.conf. This means that the options in(1,8) motion.conf becomes the default value for all the cameras. The thread options must be the last options in(1,8) the motion.conf file. threshold value Threshold for declaring motion. Valid range: 1 to thousands, default: 1500. threshold_tune on|off Activates the automatic tuning of threshold level. Default: on timelapse_filename filepath File path for timelapse mpegs relative to target_dir (ffmpeg only). Default: %v-%Y%m%d-timelapse Default value is equivalent to legacy 'oldlayout' option. For Motion 3.0 compatible mode (directories based on date and time(1,2,n)) choose: %Y/%m/%d-timelapse . File extension .mpg is automatically added so do not include this. This option uses conversion specifiers which are codes that start by % and then a letter. The conversion specifiers used has the same function as for the C function strftime (3). The most commonly used are: %Y = year, %m = month as two digits, %d = date, %H = hour, %M = minute, %S = second. Two are unique to motion %v = event, %q = frame number. With a combination of text and conversion specifiers you have full flexibility to define your directory- and filenames. For a full list of con- version(1,3,5) specifiers see the section 'Conversion Specifiers for Advanced Filename and Text Feature'. If you are happy with the directory structures the way they were in(1,8) earlier versions of motion use %v-%Y%m%d-timelapse for 'oldlayout on' and %Y/%m/%d- timelaps for 'oldlayout off'. videodevice device_name The videodevice to be used for capturing. Default: /dev/video0 video_pipe device_name|- The video4linux video loopback input device for normal images. If a particular pipe(2,8) is to be used then use the device filename of this pipe(2,8), if(3,n) a dash '-' is given motion will use /proc(5,n)/video/vloopback/vloopbacks to locate a free pipe. Default: not set(7,n,1 builtins) webcam_limit number Limits the number of images per connection to the webcam (default: 0 = unlimited). Number can be defined by multiplying actual webcam rate by desired number of seconds. Actual webcam rate is the smallest of the numbers framerate and web- cam_maxrate. webcam_localhost on|off Limit connections to the webcam server to localhost only. webcam_maxrate rate Limit the framerate of the webcam. Default is 100. webcam_motion on|off If set(7,n,1 builtins) to on only send(2,n) images with motion over the webcam con- nection, else send(2,n) frames continuously. Default is off. webcam_port port_no TCP port on which motion will listen(1,2,7) for incoming connects with its http server. Default is 0 which is disabled. Motion has a mini http server built in. Each thread can have its own web- server. If you enable the webcam server (option webcam_port to a number different from 0) and you have threads you must make sure to include webcam_port to different ports or zero (disable) in(1,8) each thread config(1,5) file. Otherwise motion will crash because each webcam server will use the setting from the motion.conf file(1,n) and try to bind(2,n,1 builtins) to the same port. The webserver generates a stream in(1,8) "multipart jpeg" format. To view in(1,8) webbrowser use the Cambozola Java applet. webcam_quality level Quality setting for the jpeg files transferred over this connec- tion (usually very low). Default is 30. width pixels The width of each frame. Valid range: Camera dependent, default: 352 Common Options For MySQL and PostgreSQL database features. If you compiled motion with MySQL or PostgreSQL support you will need to set(7,n,1 builtins) the following options if(3,n) you want motion to log events to the database. Options require the MySQL/PostgreSQL options to be active also. sql_log_image on|off Log to the database when creating motion triggered image file(1,n) (default: on). sql_log_snapshot on|off Log to the database when creating a snapshot image file(1,n) (default: on). sql_log_mpeg on|off Log to the database when creating motion triggered mpeg file(1,n) (default: off). sql_log_timelapse on|off Log to the database when creating timelapse mpeg file(1,n) (default: off). sql_log_prediction on|off Log to the database when creating a prediction file(1,n) (default: off). MySQL CONFIG FILE OPTIONS If you compiled motion with MySQL support you will need to set(7,n,1 builtins) the fol- lowing options if(3,n) you want motion to log events to the database. Data- base must contain a table security with the following fields: filename char(60) not null, minute int, hour int, day int, month int, year int, type int. mysql_db data_base Name of the MySQL database mysql_host host(1,5) IP address or domain name for the MySQL server. Use "localhost" if(3,n) motion and MySQL runs on the same server. mysql_user user_name The MySQL user name. mysql_password The MySQL password. PostgreSQL CONFIG FILE OPTIONS If you compiled motion with PostgreSQL support you will need to set(7,n,1 builtins) the following options if(3,n) you want motion to log events to the database. Database must contain a table security with the following fields: file- name char(60) not null, minute int, hour int, day int, month int, year int, type int. pgsql_db database Name of the PostgresSQL database pgsql_host host(1,5) IP address or domain name for the PostgresSQL server. Use "localhost" if(3,n) motion and PostgresSQL runs on the same server. pgsql_user user_name The PostgresSQL user name pgsql_password password The PostgresSQL password pgsql_port port The PostgresSQL server port number. Default is 5432 TRACKING CONFIG FILE OPTIONS Motion has special tracking options which use either a serial stepper motor controller, an iomojo smile cam or a Philips WebCam driver com- patible pan/tilt camera such as the Logitech Quickcam Sphere or Orbit. For this motion has the following options: track_type type Type of tracker (0=none, 1=stepper, 2=iomojo, 3=pwc), default 0 Motion has special tracking options which use either a serial stepper motor controller, an iomojo smile cam or a Philips Web- Cam driver compatible pan/tilt camera such as the Logitech Quickcam Sphere or Orbit. Normally this is set(7,n,1 builtins) to 0 and the other track options are ignored. Value 1 is for the special Motion Tracking Project using a stepper motor and a home made controller. Value 2 is for the iomojo smilecam Value 3 is for the a camera such a the Logitech Quickcam Sphere/Orbit which is driven by the pwc (Philips WebCam) driver. To use this camera your version(1,3,5) of pwc must be at least 8.12. track_port port This is the serial port to which the stepper motor interface is connected (only used for stepper motor). track_motorx number The motor number that is used for controlling the x-axis (only used for stepper motor). track_maxx position The maximum possition for servo x (only used for stepper motor). track_iomojo_id number Use this option if(3,n) you have an iomojo smilecam connected to the serial port instead of a general stepper motor controller. Default: -1 (Use the stepper motor interface) track_speed number Speed to set(7,n,1 builtins) the tracking stepper motor to track_stepsize steps The maximum number of steps to make (only used for stepper motor). SIGNALS Motion responds to the following signals: SIGALRM Motion will generate a snapshot. SIGHUP The config(1,5) file(1,n) will be reread. SIGTERM If needed motion will create an mpeg file(1,n) of the last event and exit(3,n,1 builtins) SIGUSR1 Motion will create an mpeg file(1,n) of the current event. SEE ALSO mpeg_encode(1), mail(1,8)(1), sms_client(1) NOTES Snapshot A snapshot is a picture taken at regular intervals independently of any movement in(1,8) the picture. Motion image A "motion" image or "realmotion image" 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. Normal image A normal image is the entire image taken by the camera. Threads and config(1,5) files Motion generates a thread for each camera plus two extra control threads. All options for the first camera must be in(1,8) the motion.conf file. For each extra camera you make a thread con- fig(1,5) file(1,n) which contains all the unique options for this camera. The option that are found in(1,8) a thread file(1,n) overrules the same parameter defined in(1,8) the motion.conf file. Motion reads its configuration in(1,8) the following sequence. If the same parameter exists more than one place the last one read(2,n,1 builtins) wins. 1. Motion reads the configuration file(1,n) motion.conf from the beginning of the file(1,n) going down line by line. 2. If the option "thread" is defined in(1,8) motion.conf, the thread configuration file(1,n)(s) is/(are) read. 3. Motion continues reading the rest of the motion.conf file. Any options from here will overrule the same option previously defines in(1,8) a thread config(1,5) file. 4. Motion read(2,n,1 builtins) the command line option again overruling any previously defined options. Conversion Specifiers for Advanced Filename and Text Features The list below shows all the supported Conversion Specifiers you can use in(1,8) the options text_left, text_right, snapshot_filename, jpeg_filename, ffmpeg_filename, timelapse_filename and pre- dict_filename. In text_left and text_right you can additionally use '\n' for new line. Conversion Specifier - Description %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(1,2,n) representation for the current locale. %d The day of the month as a decimal number (range 01 to 31). %D Equivalent to %m/%d/%y. (Yecch - for Americans only. Americans should note that in(1,8) other countries %d/%m/%y is rather common. This means that in(1,8) international context this format is ambigu- ous and should not be used.) %E Modifier: use alternative format, see below. %F Equivalent to %Y-%m-%d (the ISO 8601 date format). %H The hour as a decimal number using a 24-hour clock(3,n) (range 00 to 23). %I The hour as a decimal number using a 12-hour clock(3,n) (range 01 to 12). %j The day of the year as a decimal number (range 001 to 366). %k The hour (24-hour clock(3,n)) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.) %l The hour (12-hour clock(3,n)) as a decimal number (range 1 to 12); single digits are preceded by a blank. (See also %I.) %m The month as a decimal number (range 01 to 12). %M The minute as a decimal number (range 00 to 59). %p Either 'AM' or 'PM' according to the given time(1,2,n) value, or the corresponding strings for the current locale. Noon is treated as `pm' and midnight as `am'. %P Like %p but in(1,8) lowercase: `am' or `pm' or a corresponding string(3,n) for the current locale. %q Picture frame number within current second. For jpeg filenames this should always be included in(1,8) the filename if(3,n) you save more then 1 picture per second to ensure unique filenames. It is not needed in(1,8) filenames for mpegs. %r The time(1,2,n) in(1,8) a.m. or p.m. notation. %R The time(1,2,n) in(1,8) 24-hour notation (%H:%M). %s The number of seconds since the Epoch, i.e., since 1970-01-01 00:00:00 UTC. %S The second as a decimal number (range 00 to 61). %T The time(1,2,n) in(1,8) 24-hour notation (%H:%M:%S). %u The day of the week as a decimal, range 1 to 7, Monday being 1. See also %w. %U The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01. See also %V and %W. %v Event number. An event is a series of motion detections happen- ing with less(1,3) 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(1,8) the current year, and with Monday as the first day of the week. See also %U and %W. %w The day of the week as a decimal, range 0 to 6, Sunday being 0. See also %u. %W The week number of the current year as a decimal number, range 00 to 53, starting with the first Monday as the first day of week 01. %x The preferred date representation for the current locale(3,5,7) without the time. %X The preferred time(1,2,n) representation for the current locale(3,5,7) 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(1,2,n) zone or name or abbreviation. More information Motion homepage: http://motion.sourceforge.net/ Motion Guide (user and installation guide): http://www.lavrsen.dk/sources/webcam/motion_guide.htm AUTHORS Jeroen Vreeken (pe1rxq@amsat.org), Folkert van Heusden, Kenneth Lavrsen (kenneth@lavrsen.dk) Motion 2004-10-14 MOTION(1)