Basic Setup
-
Motion is able to process images from many different types of cameras. The following is brief overview
of the process to set up the Motion software.
- Determine the type of camera
- v4l2 devices which are most webcams
- Composite capture cards
- Network or IP cameras
- The PI camera
- Static movie files.
- Specify the camera in the configuration files.
- Start Motion from a terminal via the command line
- Review the messages to ensure camera was found and press cntrl-c to exit
- Specify a target_dir in the configuration file.
- Enable the web stream in the configuration file
- Specify a stream_port
- Optionally turn off stream_localhost if you want to view the stream from a different computer
- Optionally adjust the number of persistent connections of your browser. By default many browsers limit the number of simultaneous connections (usually to something like 5). Since Motion uses connections for each camera, it is possible that only the first 5 cameras are displayed on the all cameras home pages. To get around this, some browsers allow the user to specify a different(higher) number of simultaneous streams. For some browsers, this is specified via the network.http.max-persistent-connections-per-server option. For other browsers, users are not permitted to customize the settings. For these browsers, users will need to specify a different port for each camera stream. The connection limit is based upon the server:port combination therefore specifying a different port for each camera avoids the limitation.
- Enable the web control in the configuration file
- Specify a webcontrol_port
- Optionally turn off webcontrol_localhost if you want to view the webcontrol from a different computer
- Specify which parameters to show on the webcontrol via webcontrol_parms
- Optionally specify a stream_preview_method
- Refine how the image is captured with the image processing parameters
- Specify the motion detection parameters
- Execute scripts, Save pictures or movies.
- Specify stream_preview_method 3
- Specify webcontrol_parms 2
- Start Motion and in a web browser navigate to the webcontrol port
- Try adjusting the threshold, noise_level, despeckle_filter and smart_mask_speed
- Make sure to write configuration to file in order to save any changes.
- Run automatically at start (Run as service)
- Remove deprecated parameters warnings (Remove deprecated)
- List/include all possible configuration parameters (All parameters)
- Start the Motion service
sudo systemctl start motion - Stop the Motion service
sudo systemctl stop motion
libcamera. libcamera provides
access to the camera as a v4l2 device but this interface is only available when using a special
application. Users must run Motion using the
command libcamerify motion and
then specify the /dev/videoX device in the Motion configuration file.
With just one camera connected to the Pi, the device name should normally be
/dev/video0. With multiple cameras connected, e.g. a regular
USB web and the Pi camera, you will need to determine the device associated with the
Pi camera and the USB camera. The list of devices can be seen using the command
(v4l2-ctl --list-devices).
Composite video cards are normally made with a chip called BT878 (older cards have a BT848). They
all use the Linux driver called 'bttv'.
There are cards with more then one video input but still only one BT878 chip. They have a video multiplexer which
input is selected with the config option input. Input channel numbers start at 0
(which is why the value -1 and not 0 disables input selection). There are video capture cards available
with 4 or 8 inputs but only one chip. They present themselves as one single video device and
you select input using the 'input' option. If you define e.g. 4 camera config files with the
same video device name but different input numbers Motion automatically
goes into round robin mode.
Many TV tuner cards have the input channels: TV Tuner = 0, Standard composite video = 1, S-VHS = 3.
Others have TV=0, composite video 1= 1, composite video = 2, S-VHS = 3.
For video capture cards input 1 is normally the composite video input.
Some capture cards are specially made for surveillance with for example 4 inputs.
Others have a TV tuner, a composite input and perhaps also a S-Video input.
For all these cards the inputs are numbered. The numbering varies from card to card so the easiest
is to experiment with a program such as VLC that can show the video stream.
If you use the TV tuner input you also need to set the frequency of the TV channel using the
option frequency. Otherwise
set frequency to 0.
Finally you need to set the TV norm.
Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default is 0 (PAL).
If your camera is a PAL black and white you may get a better result with norm=3 (PAL no colour).
Static files can also be processed by Motion in one of two ways. The first method
is by using the netcam_url option and using a prefix of file:\\. With
this method, Motion will process the file at the speed specified by
framerate. This allows the user to either speed up or slow down the video
processing to suit the particular need.
The second option for processing a static file requires a bit of additional setup and uses a
v4l2loopback device. To set this up, first install the loopback software as described in the
Output - Pipe Options
section of this guide to create a /dev/videoX device and then use software such as ffmpeg to stream
the static file into the v4l2 device. e.g.
ffmpeg -re -i mymovie.mp4 -f v4l2 /dev/video0 Then in a separate terminal, start Motion
with it set to use the /dev/video0 device as input. This method can can also be used to
reformat the content to a different format. The following outputs the original movie into a gray pixel format.
ffmpeg -re -i mymovie.mp4 -f v4l2 -pix_fmt gray /dev/video0
This can be helpful as a interim process where ffmpeg supports a particular input but that format is not yet supported
by Motion.
Run as Service
The following instructions are only applicable to Debian and Ubuntu based systems. For other distributions, users
should consult their distribution documentation and provide pull requests to the Motion developers so that this
section can be updated with their distribution.
Motion can be set up to run as a service which means that it will start automatically whenever the computer
is started. When setting up Motion to run as a service, it should be done only after all the other configuration
has been completed. It is much easier to edit and revise the parameters when Motion is just running
in a terminal rather than as a service. Motion now uses the systemctl and when running as a service,
the option daemon must be set as off
The following commands control the Motion service.
motion and this user is automatically
added to the user group of video. By only be included in this user group, when Motion is
run, it will only have limited permissions. It is NOT recommended that this user get added to the
sudo group. Instead, only add this user to groups that are specifically required.
Command Line Options
-
SYNOPSIS
- -c : Full path and filename of config file.
- -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 log file
- -p : Full path and file name for the process id file
- -m : Start in pause mode
motion [ -hbnsm ] [ -c config file path ] [ -d level ] [ -k level ] [ -p pid_file ] [ -l log_file ]
The Configuration Files
-
If Motion was invoked with command line option
- Current directory from where motion was invoked
- Then in a directory called '.motion' in the current users home directory (shell environment variable $HOME). E.g. /home/goofy/.motion/motion.conf
- The directory defined by the --sysconfdir=DIR when running .configure during installation of
Motion
(If this option was not defined the default is /etc/motion) - Motion reads the configuration file motion.conf from the beginning of the file going down line by line.
- If the option "camera" is defined in motion.conf, the camera configuration file(s) is/(are) read.
- Motion continues reading the rest of the motion.conf file. Any options from here will overrule the same option previously defines in a camera config file.
- Motion reads the command line option again overruling any previously defined options.
-c pathname Motion will expect the config file to
be as specified. When you specify the config file on the command line with -c you can call it anything.
If you do not specify -c or the filename you give Motion does not exist, Motion will search for the
configuration file called 'motion.conf' in the following order:
video_device /dev/video0
camera1.conf:
video_device /dev/video1
Motion reads its configuration parameters in the following sequence. If the same
parameter exists more than one place the last one read wins
write configuration. This will re-write the configuration files with all the current
parameters to Motion. Note that depending upon where the configuration files are located, Motion
may need to be started using sudo.
Parameters in distributed configuration files
As of this writing, Motion includes over 150 parameters. With this volume of parameters, navigating
the configuration file with every possible has become onerous. Starting with version 4.2, the distributed
configuration files only include a limited subset of the configuration parameters. Users can add to the
files as needed the parameters that are applicable to their set up. Users that wish to have every parameter
listed and included in the configuration file can follow the process described immediately above in
the Remove deprecated section.
i.e. Use the webcontrol interface to write out the configuration file.
Extended descriptions / documentation are not included in the configuration file. This guide
should be consulted for documentation of the configuration parameters.
Signals (sent with e.g. kill command)
-
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 which
you get by typing ps -ef ¦ grep motion. The PID is the first on the
list which is the parent process for the threads.
Motion responds to the following signals:
| Signal | Description | Editors comment |
|---|---|---|
| SIGHUP | The config file will be reread. | This is a very useful signal when you experiment with settings in the config file. |
| 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. |
Configuration Options-Listed Alphabetically
-
These are the options that can be used in the config file.
All number values are integer numbers (no decimals allowed). Boolean options can be on or off.
Some configuration options are only used if Motion is built on a system that has the matching software libraries installed (MySQL, PostgreSQL, SQLite, FFMPEG, etc).
| Version 4.2 | Version 4.3 | Version 4.4 | Current Version |
| area_detect | area_detect | area_detect | area_detect |
| auto_brightness | auto_brightness | auto_brightness | auto_brightness |
| camera | camera | camera | camera |
| camera_dir | camera_dir | camera_dir | camera_dir |
| camera_id | camera_id | camera_id | camera_id |
| camera_name | camera_name | camera_name | camera_name |
| daemon | daemon | daemon | daemon |
| database_busy_timeout | database_busy_timeout | database_busy_timeout | database_busy_timeout |
| database_dbname | database_dbname | database_dbname | database_dbname |
| database_host | database_host | database_host | database_host |
| database_password | database_password | database_password | database_password |
| database_port | database_port | database_port | database_port |
| database_type | database_type | database_type | database_type |
| database_user | database_user | database_user | database_user |
| despeckle_filter | despeckle_filter | despeckle_filter | despeckle_filter |
| emulate_motion | emulate_motion | emulate_motion | emulate_motion |
| event_gap | event_gap | event_gap | event_gap |
| flip_axis | flip_axis | flip_axis | flip_axis |
| framerate | framerate | framerate | framerate |
| height | height | height | height |
| lightswitch_frames | lightswitch_frames | lightswitch_frames | lightswitch_frames |
| lightswitch_percent | lightswitch_percent | lightswitch_percent | lightswitch_percent |
| locate_motion_mode | locate_motion_mode | locate_motion_mode | locate_motion_mode |
| locate_motion_style | locate_motion_style | locate_motion_style | locate_motion_style |
| log_file | log_file | log_file | log_file |
| log_level | log_level | log_level | log_level |
| log_type | log_type | log_type | log_type |
| mask_file | mask_file | mask_file | mask_file |
| mask_privacy | mask_privacy | mask_privacy | mask_privacy |
| minimum_frame_time | minimum_frame_time | minimum_frame_time | minimum_frame_time |
| minimum_motion_frames | minimum_motion_frames | minimum_motion_frames | minimum_motion_frames |
| movie_bps | movie_bps | movie_bps | movie_bps |
| movie_codec | movie_codec | movie_codec | movie_codec |
| ffmpeg_duplicate_frames | ffmpeg_duplicate_frames | movie_duplicate_frames | movie_duplicate_frames |
| movie_extpipe | movie_extpipe | movie_extpipe | movie_extpipe |
| movie_extpipe_use | movie_extpipe_use | movie_extpipe_use | movie_extpipe_use |
| movie_filename | movie_filename | movie_filename | movie_filename |
| movie_max_time | movie_max_time | movie_max_time | movie_max_time |
| movie_output | movie_output | movie_output | movie_output |
| movie_output_motion | movie_output_motion | movie_output_motion | movie_output_motion |
| movie_passthrough | movie_passthrough | movie_passthrough | movie_passthrough |
| movie_quality | movie_quality | movie_quality | movie_quality |
| native_language | native_language | native_language | native_language |
| netcam_high_params | netcam_high_params | ||
| netcam_highres | netcam_highres | netcam_high_url | netcam_high_url |
| netcam_decoder | netcam_params | netcam_params | |
| netcam_keepalive | netcam_keepalive | netcam_params | netcam_params |
| netcam_proxy | netcam_proxy | netcam_params | netcam_params |
| netcam_tolerant_check | netcam_tolerant_check | netcam_params | netcam_params |
| netcam_use_tcp |
netcam_use_tcp | netcam_params | netcam_params |
| netcam_url | netcam_url | netcam_url | netcam_url |
| netcam_userpass | netcam_userpass | netcam_userpass | netcam_userpass |
| noise_level | noise_level | noise_level | noise_level |
| noise_tune | noise_tune | noise_tune | noise_tune |
| on_area_detected | on_area_detected | on_area_detected | on_area_detected |
| on_camera_found | on_camera_found | on_camera_found | on_camera_found |
| on_camera_lost | on_camera_lost | on_camera_lost | on_camera_lost |
| on_event_end | on_event_end | on_event_end | on_event_end |
| on_event_start | on_event_start | on_event_start | on_event_start |
| on_motion_detected | on_motion_detected | on_motion_detected | on_motion_detected |
| on_movie_end | on_movie_end | on_movie_end | on_movie_end |
| on_movie_start | on_movie_start | on_movie_start | on_movie_start |
| on_picture_save | on_picture_save | on_picture_save | on_picture_save |
| pause | pause | ||
| picture_exif |
picture_exif | picture_exif | picture_exif |
| picture_output | picture_output | picture_output | picture_output |
| picture_output_motion | picture_output_motion | picture_output_motion | picture_output_motion |
| picture_filename | picture_filename | picture_filename | picture_filename |
| picture_type | picture_type | picture_type | picture_type |
| picture_quality | picture_quality | picture_quality | picture_quality |
| pid_file | pid_file | pid_file | pid_file |
| post_capture | post_capture | post_capture | post_capture |
| pre_capture | pre_capture | pre_capture | pre_capture |
| quiet | quiet | quiet | quiet |
| rotate | rotate | rotate | rotate |
| roundrobin_frames | roundrobin_frames | roundrobin_frames | roundrobin_frames |
| roundrobin_skip | roundrobin_skip | roundrobin_skip | roundrobin_skip |
| roundrobin_switchfilter | roundrobin_switchfilter | roundrobin_switchfilter | roundrobin_switchfilter |
| setup_mode | setup_mode | setup_mode | setup_mode |
| smart_mask_speed | smart_mask_speed | smart_mask_speed | smart_mask_speed |
| snapshot_filename | snapshot_filename | snapshot_filename | snapshot_filename |
| snapshot_interval | snapshot_interval | snapshot_interval | snapshot_interval |
| sql_log_movie | sql_log_movie | sql_log_movie | sql_log_movie |
| sql_log_picture | sql_log_picture | sql_log_picture | sql_log_picture |
| sql_log_snapshot | sql_log_snapshot | sql_log_snapshot | sql_log_snapshot |
| sql_log_timelapse | sql_log_timelapse | sql_log_timelapse | sql_log_timelapse |
| sql_query | sql_query | sql_query | sql_query |
| sql_query_start | sql_query_start | sql_query_start | sql_query_start |
| sql_query_stop | sql_query_stop | sql_query_stop | sql_query_stop |
| stream_auth_method | stream_auth_method | stream_auth_method | stream_auth_method |
| stream_authentication | stream_authentication | stream_authentication | stream_authentication |
| stream_cors_header | stream_cors_header | stream_header_params | stream_header_params |
| stream_grey | stream_grey | stream_grey | stream_grey |
| stream_localhost | stream_localhost | stream_localhost | stream_localhost |
| stream_maxrate | stream_maxrate | stream_maxrate | stream_maxrate |
| stream_motion | stream_motion | stream_motion | stream_motion |
| stream_port | stream_port | stream_port | stream_port |
| stream_preview_method | stream_preview_method | stream_preview_method | stream_preview_method |
| stream_preview_newline | stream_preview_newline | stream_preview_newline | stream_preview_newline |
| stream_preview_scale | stream_preview_scale | stream_preview_scale | stream_preview_scale |
| stream_quality | stream_quality | stream_quality | stream_quality |
| stream_tls | stream_tls | stream_tls | stream_tls |
| target_dir | target_dir | target_dir | target_dir |
| text_changes | text_changes | text_changes | text_changes |
| text_event | text_event | text_event | text_event |
| text_left | text_left | text_left | text_left |
| text_right | text_right | text_right | text_right |
| text_scale | text_scale | text_scale | text_scale |
| threshold | threshold | threshold | threshold |
| threshold_maximum | threshold_maximum | threshold_maximum | threshold_maximum |
| threshold_tune | threshold_tune | threshold_tune | threshold_tune |
| timelapse_codec | timelapse_codec | timelapse_codec | timelapse_codec |
| timelapse_filename | timelapse_filename | timelapse_filename | timelapse_filename |
| timelapse_fps | timelapse_fps | timelapse_fps | timelapse_fps |
| timelapse_interval | timelapse_interval | timelapse_interval | timelapse_interval |
| timelapse_mode | timelapse_mode | timelapse_mode | timelapse_mode |
| track_auto | track_auto | track_auto | track_auto |
| track_generic_move | track_generic_move | track_generic_move | track_generic_move |
| track_iomojo_id | track_iomojo_id | track_iomojo_id | track_iomojo_id |
| track_maxx | track_maxx | track_maxx | track_maxx |
| track_maxy | track_maxy | track_maxy | track_maxy |
| track_motorx | track_motorx | track_motorx | track_motorx |
| track_motory | track_motory | track_motory | track_motory |
| track_move_wait | track_move_wait | track_move_wait | track_move_wait |
| track_port | track_port | track_port | track_port |
| track_speed | track_speed | track_speed | track_speed |
| track_step_angle_x | track_step_angle_x | track_step_angle_x | track_step_angle_x |
| track_step_angle_y | track_step_angle_y | track_step_angle_y | track_step_angle_y |
| track_stepsize | track_stepsize | track_stepsize | track_stepsize |
| track_type | track_type | track_type | track_type |
| tunerdevice | tunerdevice | tuner_device | tuner_device |
| frequency | frequency | video_params | video_params |
| input | input | video_params | video_params |
| norm | norm | video_params | video_params |
| v4l2_palette | v4l2_palette | video_params | video_params |
| vid_control_params | vid_control_params | video_params | video_params |
| videodevice | videodevice | video_device | video_device |
| video_pipe | video_pipe | video_pipe | video_pipe |
| video_pipe_motion | video_pipe_motion | video_pipe_motion | video_pipe_motion |
| watchdog_tmo | watchdog_tmo | ||
| watchdog_kill | watchdog_kill | ||
| webcontrol_auth_method | webcontrol_auth_method | webcontrol_auth_method | webcontrol_auth_method |
| webcontrol_authentication | webcontrol_authentication | webcontrol_authentication | webcontrol_authentication |
| webcontrol_cert | webcontrol_cert | webcontrol_cert | webcontrol_cert |
| webcontrol_cors_header | webcontrol_cors_header | webcontrol_header_params | webcontrol_header_params |
| webcontrol_interface | webcontrol_interface | webcontrol_interface | webcontrol_interface |
| webcontrol_ipv6 | webcontrol_ipv6 | webcontrol_ipv6 | webcontrol_ipv6 |
| webcontrol_key | webcontrol_key | webcontrol_key | webcontrol_key |
| webcontrol_localhost | webcontrol_localhost | webcontrol_localhost | webcontrol_localhost |
| webcontrol_lock_attempts | webcontrol_lock_attempts | ||
| webcontrol_lock_max_ips | webcontrol_lock_max_ips | ||
| webcontrol_lock_minutes | webcontrol_lock_minutes | ||
| webcontrol_parms | webcontrol_parms | webcontrol_parms | webcontrol_parms |
| webcontrol_port | webcontrol_port | webcontrol_port | webcontrol_port |
| webcontrol_tls | webcontrol_tls | webcontrol_tls | webcontrol_tls |
| width | width | width | width |
| mmalcam_name | mmalcam_name | mmalcam_name | removed |
| mmalcam_control_params | mmalcam_control_params | mmalcam_params | removed |
Configuration Options-Listed by Topic
-
These are the options that can be used in the config file.
All number values are integer numbers (no decimals allowed). Boolean options can be on or off.
Some configuration options are only used if Motion is built on a system that has the matching software libraries installed (MySQL, PostgreSQL, SQLite, FFMPEG, etc).
System Processing-General Info
| daemon | setup_mode | pid_file | log_file |
| log_level | log_type | quiet | native_language |
| camera_name | camera_id | camera | camera_dir | target_dir | watchdog_tmo | watchdog_kill |
| video_device | video_params | auto_brightness | tuner_device |
| roundrobin_frames | roundrobin_skip | roundrobin_switchfilter |
| width | height | framerate | minimum_frame_time |
| rotate | flip_axis | locate_motion_mode | locate_motion_style |
| text_left | text_right | text_changes | text_scale |
| text_event |
| 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 |
| picture_output | picture_output_motion | picture_type | picture_quality |
| picture_exif | picture_filename | snapshot_interval | snapshot_filename |
Configuration Options-Detail Descriptions
-
The following section provides detailed descriptions of each of the configuration options.
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Disable despeckle (comment it out in motion.conf).
- Disable smartmask
- Enable both the webcontrol and streams make sure to specify the webcontrol_parms. The below assumes that the webcontrol is specified as port 8080 and the stream as 8081
- Start Motion in setup mode
- Open a browser and connect to the webcontrol interface. http://localhost:8080/ . You can now control and change almost anything while Motion is running. To disable a feature enter a space.
- Start by experimenting with noise level. Do this both during daylight and during darkness. You will be surprised to see how much noise a camera makes during night. Try using the automatic noise feature. It should work for most.
- Now try the despeckle feature. Enable it using the recommended default EedDl. If this is not enough experiment. Remember that the l must be the last letter.
- Set the threshold to what you want to trigger Motion.
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Type: Integer
- Range / Valid values: 1 - 9
- Default: 6
- Type: Discreet Strings
- Range / Valid values: See Below
- Default: ALL
- Type: Boolean
- Range / Valid values: on, off
- Default: on
- Type: Boolean
- Range / Valid values: on, off
- Default: on
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Type: Integer
- Range / Valid values: 1 - 32000
- Default: The sequence that the camera file is read
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined = current directory
- Type: int
- Range / Valid values: Integer
- Default: 30
- Type: int
- Range / Valid values: Integer
- Default: 30
- Type: String
- Range / Valid values: Max 4095 characters
- Default: /dev/video0
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- brightness
- contrast
- hue
- power_line_frequency
- saturation
- frequency
- input
- norm
- v4l2_palette
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ---------Controls---------
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: V4L2 ID Name and Range
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963776 Brightness, 0 to 127
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963777 Contrast, 0 to 63
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963778 Saturation, -100 to 100
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963788 White Balance, Automatic, 0 to 4
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: menu item: Value 0 Indoor (Incandescant Lighting)
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: menu item: Value 1 Outdoor (Sunlight) Mode
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: menu item: Value 2 Indoor (Fluorescent Lighting) M
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: menu item: Value 3 Manual Mode
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: menu item: Value 4 Auto Mode
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963790 Red Balance, 0 to 255
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963791 Blue Balance, 0 to 255
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963792 Gamma, 0 to 31
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963793 Exposure, 0 to 255
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963794 Gain, Automatic, 0 to 1
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963795 Gain, 0 to 63
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963804 Backlight Compensation, 0 to 1
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963807 Color Effects, 0 to 1
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: menu item: Value 0 None
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: menu item: Value 1 Black & White
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID09963809 Band-Stop Filter, 0 to 1
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID10025216 Auto contour, 0 to 1
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID10025217 Contour, 0 to 63
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID10025218 Dynamic Noise Reduction, 0 to 3
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID10025219 Auto White Balance Speed, 1 to 32
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID10025220 Auto White Balance Delay, 0 to 63
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID10025221 Save User Settings, 0 to 0
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID10025222 Restore User Settings, 0 to 0
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: ID10025223 Restore Factory Settings, 0 to 0
- [1:ml1:c1] [INF] [VID] v4l2_ctrls_list: --------------------------
- Type: Integer
- Range / Valid values: 0 - 20
- Default: 17
- Type: Integer
- Range / Valid values: -1, 0 - ?
- Default: -1
- Type: Integer
- Range / Valid values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour)
- Default: 0 (PAL)
- Type: Integer
- Range / Valid values: 0 - 999999
- Default: 0 (Not set)
- Type: Integer
- Range / Valid values: 0 - 3
- Default: 0
- 1: Use the brightness control to regulate the brightness (equivalent to specifying on/yes)
- 2: Use the exposure control to regulate the brightness
- 3: Use the exposure absolute control to regulate the brightness
- Type: String
- Range / Valid values: Max 4095 characters
- Default: /dev/tuner0
- Type: Integer
- Range / Valid values: 1 - 2147483647
- Default: 1
- Type: Integer
- Range / Valid values: 1 - 2147483647
- Default: 1
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Type: String
- Range / Valid values: Max 4095 characters
- Default: varies by camera type
- Type: String
- Range / Valid values: Max 4095 characters
- Default: off
- off: The historical implementation using HTTP/1.0, closing the socket after each http request.
- force: Use HTTP/1.0 requests with keep alive header to reuse the same connection.
- on: Use HTTP/1.1 requests that support keep alive as default.
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Type: Boolean
- Range / Valid values: on, off
- Default: off
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Type: int
- Range / Valid values: Integer
- Default: framerate
- Log messages indicating what the netcam capture rate is versus the log entry for the camera FPS.
- The network camera is disconnecting and reconnecting frequently.
- A significant number of ffmpeg_avcodec_log messages
- Range / Valid values: tcp, udp, see ffmpeg documentation
- Default: tcp
- Range / Valid values: mjpeg, h264, see ffmpeg documentation
- Default: tcp
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Type: String
- Range / Valid values: Max 4095 characters
- Default: varies by camera type
- Type: String
- Range / Valid values: Max 4095 characters
- Default: Not defined
- Type: Integer
- Range / Valid values: Device Dependent
- Default: 640
- Type: Integer
- Range / Valid values: Device Dependent
- Default: 480
- Type: Integer
- Range / Valid values: 2 - 100
- Default: 1
Conversion Specifiers
| %Y | year | %m | month | %d | day |
| %H | hour | %M | minute | %S | second |
| %T | HH:MM:SS | %v | event | %q | frame number |
| %t | camera 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) |
| %$ | camera name | %{fps} | current frames per second | %{host} | name of computer running Motion |
| %{ver} | The version of Motion |
System Processing
daemon
setup_mode
pid_file
log_file
log_level
log_type
quiet
native_language
camera_name
camera_id
camera
camera_dir
Users can disable a camera (config file) by renaming it so it does not end with '.conf'.
target_dir
watchdog_tmo
watchdog_kill
Video4Linux Device
-
Please refer to the Basic Setup section of this guide for an additional discussion
of Video4Linux devices and how to test and specify them correctly for Motion.
video_device
udevadm info -a -p $(udevadm info -q path -n /dev/video0) while the camera is attached. Usually
a serial number can be used. ("Usually" because some cameras have been observed to have the same serial
number for different cameras)
Once a unique attribute has been identified for each camera, edit or create the file
/etc/udev/rules.d/99-local.rules.
Assuming that the unique attribute for the camera was name and was
ATTR{name}=="Philips SPC 900NC webcam" you would add the following line to the
99-local.rules file:
KERNEL=="video[0-9]*", ATTR{name}=="Philips\ SPC\ 900NC*", SYMLINK+="video-webcam0"
Once the change has been made and saved, reboot the computer and there should now be a "sticky" device called
/dev/video-webcam0
video_params
video_params "Gain, Automatic"=1,ID09963795=50, brightness=30
a equally valid alternative method for specifying this example would be
video_params ID09963794=1,ID09963795=50, ID09963776=30
or another way of specifying it could be
video_params ID09963794=1,"Gain"=50, "brightness"=30
Example 2: Set the saturation to 50 and the contrast to 100
video_params saturation=50,contrast=100
As can be seen in these examples, the specification can use either the control ID or the name of the
control. If the control name has embedded blanks or commas, then it must be enclosed in quotes. Special
care should be taken when using the name. As shown above, there is a comma that separates the name
of the control versus the valid range of values. That comma is NOT part of the control name and only
delimits the end of the name for the Motion log.
palette
| V4l2 Option | FOURCC | v4l2_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
norm
frequency
auto_brightness
tuner_device
roundrobin_frames
roundrobin_skip
roundrobin_switchfilter
Network Cameras
-
Motion can connect to certain network cameras. Please refer to the Basic Setup section
of this guide for an additional discussion of network camera and how to test and specify them correctly for Motion.
Motion cannot connect to a video stream such a mpeg, mpeg4, divx to connect to streams such as these
the user may review the static files portion of the Basic Setup
section of this guide which illustrates some possible work arounds using ffmpeg and v4l2loopback devices.
The URL must return one single jpeg image, a mjpeg stream
a RTSP stream, RTMP stream, file or ftp. When getting a still image, make sure to validate that
the camera is serving up a actual raw JPG file and not a HTML page with an embedded JPG which Motion
will not be able to process.
When the netcam_url is defined the
video4linux options above are mostly ignored.
If the connection to a network camera is lost, Motion will reuse the last good image for
approx 30 seconds. After 30 seconds the image is replaced by a grey image with a text
telling that the signal is lost and when the connection was lost.
This text and its date format is not configurable.
netcam_url
-
http://
-
This prefix uses the traditional http format and opens a netcam that provides a motion jpg image.
When using the rtsp format, Motion will ignore the netcam_keepalive and netcam_tolerant_check options.
-
This prefix is the standard for all modern network cameras. It is recommended that users search the
web or the camera manual for the exact connection string to use for their camera.
Once a potential connection string is found, it should be validated as being functional using a
external application such as ffplay or vlc.
The connection string that works for these applications is what needs to be specified for this option.
When using the rtsp format, Motion will ignore the netcam_keepalive and netcam_tolerant_check options.
-
This prefix may be available on modern network cameras. It is recommended that users search the
web or the camera manual for the exact connection string to use for their camera.
Once a potential connection string is found, it should be validated as being functional using a
external application such as ffplay or vlc.
The connection string that works for these applications is what needs to be specified for this option.
When using the rtmp format, Motion will ignore the netcam_keepalive and netcam_tolerant_check options.
-
This option allows for the processing of a existing movie file. Motion will open the file and
process the file at the framerate specified in the Motion configuration file. Note that since the
file may have been created using a different framerate than specified in the Motion config file,
the file may be processed at either a faster or slower rate than real time.
A sample format for the netcam_url would be
netcam_url file:///home/user/cam1/cam1_20180817084027.mkv
This option is useful for "reprocessing" a movie created by Motion to fine tune the detection options.
At the end of the movie file, Motion will restart the movie file at the beginning so that you can
continue to refine the detection parameters.
-
This option allows for an alternative method of using a v4l2 device that is not natively supported by Motion.
A sample format for the netcam_url would be
v4l2:///dev/video0 Internally, this
is equivalent to running the following from the command line ffplay -f v4l2 /dev/video0
-
This is an alternative prefix for http for use when Motion is compiled without ffmpeg.
-
This option may process very old netcams with non standard mjpeg formats.
-
This option is for processing a static JPG file that is updated by processes external
to Motion. It must be a local file and specified such as jpeg:///path/current.jpg
-
This prefix opens the ftp site and grabs a static image. The camera will be expected to periodically
replace that static image as it processes images.
netcam_params
keepalive
proxy
tolerant_check
decoder
ffmpeg -decoders and looking for the name of the decoder with a 'D' next
to it and correlating this with the type of image provided from the camera. Note that although the
decoder may be listed, it still may not work within Motion.
In addition to the decoders specified by ffmpeg, additional different decoder options may also
be found by reviewing the Motion log. These decoders will be shown as "available" in the log
when log_level is specified at the INF level or higher.
Not all decoders will work even if they are indicated as available or work using ffmpeg externally
to Motion. If the camera does not open using the requested decoder, try a different
decoder or leave this parameter empty to use the default.
capture_rate
rtsp_transport
netsed can workaround this limitation of the camera using the following method:
Instead of: netcam_url rtsp://192.168.0.51:554/onvif1
Use: netcam_url rtsp://127.0.0.1:554/onvif1
Then in a different process, start netsed to substitude AVP; with AVP/TCP;
netsed tcp 554 192.168.0.51 554 's/AVP;/AVP%2FTCP;'
input_format
netcam_high_url
Motion detection on the normal resolution will trigger the saving of images from the high resolution stream. Note that the ONLY overlay that will be present on the resulting high resolution pictures and movies is the privacy mask. The other overlays such as date/time, motion boxes, camera name, etc will not be included. Users wishing to see those overlays on the resulting images and movies will need to specify the high resolution url as the netcam_url and not use this option. If the netcam_url is not specified, this option is ignored. When this option is used with the movie_passthrough even less processing occurs. Since the movie_passthrough bypasses decoding the stream, images will be saved as provided from the camera and the privacy mask will not be applied.