sudo yum groupinstall 'Development Tools'
- sudo yum install libjpeg-turbo libjpeg-turbo-devel gettext libmicrohttpd-dev
+ sudo yum install libjpeg-turbo libjpeg-turbo-devel gettext libmicrohttpd-devel
sudo yum install libzip-devel
@@ -561,6 +573,7 @@
The following options can be specified with the configure script to customize
how Motion is built.
+ -
-
- Support -
- News -
- Documentation -
- Download -
- Home -
-
-
+
+
+ Support
+ News
+ Documentation
+ Download
+ Home
+
+ Home
+ Download
+ Documentation
+ News
+ Support
+
+ ☰
+
+
+ Support
+ News
+ Documentation
+ Download
+ Home
+
+ Home
+ Download
+ Documentation
+ News
+ Support
+
+ ☰
+ - Configuration + Configuration
+
+
+
+
-
-
+
+
+
-
-
-
+
Specify the camera in the configuration files.
- Start Motion from a terminal via the command line
+ 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
-
+
+
+
+
+
+ Basic Setup
-
@@ -118,9 +127,10 @@
- The PI camera
- Static movie files.
- Specify a stream_port @@ -193,12 +203,12 @@ Motion permits the use of video cards that have discreet input channels. Since USB cameras do not have input channels, - the option
input must be set to the value -1 for USB cameras.
+ the option input must be set to the value -1 for USB cameras.
Network cameras are set up via the
- netcam_url parameter.
+ netcam_url parameter.
The latest versions of Motion support rtsp format which many cameras now stream. Some users have requested
a list of the network cameras that will work with Motion. Since Motion can now process RTSP streams, almost
all cameras are supported. Simply review the specifications of the camera and validate that
@@ -210,19 +220,19 @@
The URL connection string to enter is specific to the camera and is
usually provided by the manufacturer. The connection string is the same as what would be used by other
video playing software such as VLC. If the camera does not stream via RTSP and instead uses a MJPEG, then Motion
- can also view that format. See the option netcam_url
- for additional options.
+ can also view that format. See the option netcam_url for
+ additional options.
Raspberry Pi cameras can be set up two different ways. If Motion is installed by using the
apt packages (e.g. apt-get install motion), then the camera must be set up using the bcm2835-v4l2 module which creates
a v4l2 device for the camera. Users will need to install this module using the
- command sudo modprobe bcm2835-v4l2. This
+ command sudo modprobe bcm2835-v4l2. This
will set up the camera as a normal v4l2 device and it can be accessed via a standard /dev/videoX device. If Motion is
built from source or installed via the deb packages on the project release page, then an additional option is to set
- up the camera using the mmalcam_name parameter or using
- the bcm2835-v4l2 module. When Motion is installed via apt, the mmalcam option is not available.
+ up the camera using the mmalcam_name parameter or using
+ the bcm2835-v4l2 module. When Motion is installed via apt, the mmalcam option is not available.
@@ -230,7 +240,7 @@
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
+ 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
@@ -247,10 +257,10 @@
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.
+ option frequency. Otherwise
+ set frequency to 0.
- Finally you need to set the TV norm.
+ 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).
@@ -264,13 +274,13 @@
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
+ 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
+ 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
+ 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.
@@ -326,11 +336,11 @@
Command Line Options
+Command Line Options
-
SYNOPSIS
-
motion [ -hbnsm ] [ -c config file path ] [ -d level ] [ -k level ] [ -p pid_file ] [ -l log_file ]+
motion [ -hbnsm ] [ -c config file path ] [ -d level ] [ -k level ] [ -p pid_file ] [ -l log_file ]
- -c : Full path and filename of config file. @@ -348,7 +358,7 @@
The Configuration Files
+The Configuration Files
-
If Motion was invoked with command line option
-c pathname Motion will expect the config file to
@@ -414,11 +424,11 @@
camera0.conf:
- videodevice /dev/video0
+ videodevice /dev/video0
camera1.conf:
- videodevice /dev/video1
+ videodevice /dev/video1
@@ -490,14 +500,15 @@
list which is the parent process for the threads.
Motion responds to the following signals:
+ | Signal | Description | Editors comment | @@ -521,6 +532,7 @@
|---|
| Version 3.2 | +Version 3.2 | Version 4.0 | Version 4.1 | Current Version | |
| area_detect | +area_detect | area_detect | area_detect | area_detect | @@ -559,966 +580,967 @@auto_brightness |
| thread | +thread | camera | camera | camera | |
| camera_dir | camera_dir | camera_dir | |||
| camera_id | camera_id | camera_id | |||
| camera_name | camera_name | camera_name | |||
| daemon | +daemon | daemon | daemon | daemon | |
| database_busy_timeout | database_busy_timeout | database_busy_timeout | |||
| mysql_db | +mysql_db | database_dbname | database_dbname | database_dbname | |
| pgsql_db | +pgsql_db | database_dbname | database_dbname | database_dbname | |
| mysql_host | +mysql_host | database_host | database_host | database_host | |
| pgsql_host | +pgsql_host | database_host | database_host | database_host | |
| mysql_password | +mysql_password | database_password | database_password | database_password | |
| pgsql_password | +pgsql_password | database_password | database_password | database_password | |
| pgsql_port | +pgsql_port | database_port | database_port | database_port | |
| database_type | database_type | database_type | |||
| mysql_user | +mysql_user | database_user | database_user | database_user | |
| pgsql_user | +pgsql_user | database_user | database_user | database_user | |
| despeckle | +despeckle | despeckle_filter | despeckle_filter | despeckle_filter | |
| output_all | +output_all | emulate_motion | emulate_motion | emulate_motion | |
| gap | +gap | event_gap | event_gap | event_gap | |
| + | flip_axis | flip_axis | |||
| framerate | +framerate | framerate | framerate | framerate | |
| frequency | +frequency | frequency | frequency | frequency | |
| height | +height | height | height | height | |
| input | +input | input | input | input | |
| + | lightswitch_frames | ||||
| lightswitch | +lightswitch | lightswitch | lightswitch | lightswitch_percent | |
| locate | +locate | locate_motion_mode | locate_motion_mode | locate_motion_mode | |
| locate_motion_style | locate_motion_style | locate_motion_style | |||
| logfile | logfile | log_file | |||
| log_level | log_level | log_level | |||
| log_type | log_type | log_type | |||
| mask_file | +mask_file | mask_file | mask_file | mask_file | |
| + | mask_privacy | mask_privacy | |||
| minimum_frame_time | +minimum_frame_time | minimum_frame_time | minimum_frame_time | minimum_frame_time | |
| minimum_motion_frames | +minimum_motion_frames | minimum_motion_frames | minimum_motion_frames | minimum_motion_frames | |
| mmalcam_control_params | mmalcam_control_params | mmalcam_control_params | |||
| mmalcam_name | mmalcam_name | mmalcam_name | |||
| ffmpeg_bps | +ffmpeg_bps | ffmpeg_bps | ffmpeg_bps | movie_bps | |
| ffmpeg_video_codec | +ffmpeg_video_codec | ffmpeg_video_codec | ffmpeg_video_codec | movie_codec | |
| ffmpeg_duplicate_frames | ffmpeg_duplicate_frames | movie_duplicate_frames | |||
| extpipe | extpipe | movie_extpipe | |||
| use_extpipe | use_extpipe | movie_extpipe_use | |||
| movie_filename | +movie_filename | movie_filename | movie_filename | movie_filename | |
| max_mpeg_time | +max_mpeg_time | max_movie_time | max_movie_time | movie_max_time | |
| ffmpeg_cap_new | +ffmpeg_cap_new | ffmpeg_output_movies | ffmpeg_output_movies | movie_output | |
| ffmpeg_cap_motion | +ffmpeg_cap_motion | ffmpeg_output_debug_movies | ffmpeg_output_debug_movies | movie_output_motion | |
| + | movie_passthrough | ||||
| ffmpeg_variable_bitrate | +ffmpeg_variable_bitrate | ffmpeg_variable_bitrate | ffmpeg_variable_bitrate | movie_quality | |
| + | native_language | ||||
| + | netcam_highres | netcam_highres | |||
| netcam_keepalive | +netcam_keepalive | netcam_keepalive | netcam_keepalive | netcam_keepalive | |
| netcam_proxy | +netcam_proxy | netcam_proxy | netcam_proxy | netcam_proxy | |
| netcam_tolerant_check | +netcam_tolerant_check | netcam_tolerant_check | netcam_tolerant_check | netcam_tolerant_check | |
| netcam_url | +netcam_url | netcam_url | netcam_url | netcam_url | |
| rtsp_uses_tcp | rtsp_uses_tcp | netcam_use_tcp | |||
| netcam_userpass | +netcam_userpass | netcam_userpass | netcam_userpass | netcam_userpass | |
| noise_level | +noise_level | noise_level | noise_level | noise_level | |
| noise_tune | +noise_tune | noise_tune | noise_tune | noise_tune | |
| norm | +norm | norm | norm | norm | |
| on_area_detected | +on_area_detected | on_area_detected | on_area_detected | on_area_detected | |
| + | on_camera_found | on_camera_found | |||
| on_camera_lost | +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_end | |
| on_event_start | +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_motion_detected | |
| on_movie_end | +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_movie_start | |
| on_picture_save | +on_picture_save | on_picture_save | on_picture_save | on_picture_save | |
| exif_text | exif_text | picture_exif | |||
| output_normal | +output_normal | output_pictures | output_pictures | picture_output | |
| output_motion | +output_motion | output_debug_pictures | output_debug_pictures | picture_output_motion | |
| jpeg_filename | +jpeg_filename | picture_filename | picture_filename | picture_filename | |
| ppm | +ppm | picture_type | picture_type | picture_type | |
| quality | +quality | quality | quality | picture_quality | |
| process_id_file | +process_id_file | process_id_file | process_id_file | pid_file | |
| post_capture | +post_capture | post_capture | post_capture | post_capture | |
| pre_capture | +pre_capture | pre_capture | pre_capture | pre_capture | |
| quiet | +quiet | quiet | quiet | quiet | |
| rotate | +rotate | rotate | rotate | rotate | |
| roundrobin_frames | +roundrobin_frames | roundrobin_frames | roundrobin_frames | roundrobin_frames | |
| roundrobin_skip | +roundrobin_skip | roundrobin_skip | roundrobin_skip | roundrobin_skip | |
| switchfilter | +switchfilter | switchfilter | switchfilter | roundrobin_switchfilter | |
| setup_mode | +setup_mode | setup_mode | setup_mode | setup_mode | |
| smart_mask_speed | +smart_mask_speed | smart_mask_speed | smart_mask_speed | smart_mask_speed | |
| snapshot_filename | +snapshot_filename | snapshot_filename | snapshot_filename | snapshot_filename | |
| snapshot_interval | +snapshot_interval | snapshot_interval | snapshot_interval | snapshot_interval | |
| sql_log_mpeg | +sql_log_mpeg | sql_log_movie | sql_log_movie | sql_log_movie | |
| sql_log_image | +sql_log_image | sql_log_picture | sql_log_picture | sql_log_picture | |
| sql_log_snapshot | +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_log_timelapse | |
| sql_query | +sql_query | sql_query | sql_query | sql_query | |
| + | sql_query_start | sql_query_start | |||
| + | sql_query_stop | ||||
| stream_auth_method | stream_auth_method | stream_auth_method | |||
| stream_authentication | stream_authentication | stream_authentication | |||
| stream_cors_header | |||||
| stream_grey | |||||
| webcam_localhost | +webcam_localhost | stream_localhost | stream_localhost | stream_localhost | |
| webcam_maxrate | +webcam_maxrate | stream_maxrate | stream_maxrate | stream_maxrate | |
| webcam_port | +webcam_port | stream_port | stream_port | stream_port | |
| stream_preview_method | |||||
| stream_preview_newline | stream_preview_newline | stream_preview_newline | |||
| stream_preview_scale | stream_preview_scale | stream_preview_scale | |||
| webcam_quality | +webcam_quality | stream_quality | stream_quality | stream_quality | |
| stream_tls | |||||
| target_dir | +target_dir | target_dir | target_dir | target_dir | |
| text_changes | +text_changes | text_changes | text_changes | text_changes | |
| text_event | +text_event | text_event | text_event | text_event | |
| text_left | +text_left | text_left | text_left | text_left | |
| text_right | +text_right | text_right | text_right | text_right | |
| text_double | +text_double | text_double | text_double | text_scale | |
| threshold | +threshold | threshold | threshold | threshold | |
| + | threshold_maximum | ||||
| threshold_tune | +threshold_tune | threshold_tune | threshold_tune | threshold_tune | |
| ffmpeg_video_codec | +ffmpeg_video_codec | ffmpeg_video_codec | timelapse_codec | timelapse_codec | |
| timelapse_filename | +timelapse_filename | timelapse_filename | timelapse_filename | timelapse_filename | |
| + | timelapse_fps | timelapse_fps | |||
| ffmpeg_timelapse | +ffmpeg_timelapse | ffmpeg_timelapse | timelapse_interval | timelapse_interval | |
| ffmpeg_timelapse_mode | +ffmpeg_timelapse_mode | ffmpeg_timelapse_mode | ffmpeg_timelapse_mode | timelapse_mode | |
| track_auto | +track_auto | track_auto | track_auto | track_auto | |
| + | track_generic_move | ||||
| track_iomojo_id | +track_iomojo_id | track_iomojo_id | track_iomojo_id | track_iomojo_id | |
| track_maxx | +track_maxx | track_maxx | track_maxx | track_maxx | |
| track_maxy | +track_maxy | track_maxy | track_maxy | track_maxy | |
| track_motorx | +track_motorx | track_motorx | track_motorx | track_motorx | |
| track_motory | +track_motory | track_motory | track_motory | track_motory | |
| track_move_wait | +track_move_wait | track_move_wait | track_move_wait | track_move_wait | |
| track_port | +track_port | track_port | track_port | track_port | |
| track_speed | +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_x | |
| track_step_angle_y | +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_stepsize | |
| track_type | +track_type | track_type | track_type | track_type | |
| tunerdevice | +tunerdevice | tunerdevice | tunerdevice | tunerdevice | |
| v4l2_palette | +v4l2_palette | v4l2_palette | v4l2_palette | v4l2_palette | |
| brightness | +brightness | brightness | brightness | vid_control_params | |
| contrast | +contrast | contrast | contrast | vid_control_params | |
| hue | +hue | hue | hue | vid_control_params | |
| power_line_frequency | power_line_frequency | vid_control_params | |||
| saturation | +saturation | saturation | saturation | vid_control_params | |
| video_pipe | +video_pipe | video_pipe | video_pipe | video_pipe | |
| motion_video_pipe | +motion_video_pipe | motion_video_pipe | motion_video_pipe | video_pipe_motion | |
| videodevice | +videodevice | videodevice | videodevice | videodevice | |
| + | webcontrol_auth_method | ||||
| control_authentication | +control_authentication | webcontrol_authentication | webcontrol_authentication | webcontrol_authentication | |
| + | webcontrol_cert | ||||
| + | webcontrol_cors_header | ||||
| control_html_output | +control_html_output | webcontrol_html_output | webcontrol_html_output | webcontrol_interface | |
| ipv6_enabled | ipv6_enabled | webcontrol_ipv6 | |||
| + | webcontrol_key | ||||
| control_localhost | +control_localhost | webcontrol_localhost | webcontrol_localhost | webcontrol_localhost | |
| + | webcontrol_parms | webcontrol_parms | |||
| control_port | +control_port | webcontrol_port | webcontrol_port | webcontrol_port | |
| + | webcontrol_tls | ||||
| width | +width | width | width | width | |
| ffmpeg_deinterlace | +ffmpeg_deinterlace | -Depreciated | -Depreciated | -Depreciated | |
| sdl_threadnr | -Depreciated | -Depreciated | |||
| webcam_limit | +webcam_limit | stream_limit | stream_limit | -Depreciated | |
| webcam_motion | +webcam_motion | stream_motion | stream_motion | -Depreciated | |
| + | substream_port | -Depreciated |
Configuration Options-Listed by Topic
@@ -1535,7 +1557,7 @@ System Processing-General Info-
-
- Default: off - When using a RTSP, RTMP or mjpeg camera, create movie files of the motion with the packets obtained directly - from the camera. For mjpeg cameras, the url must be specified using the
input or frequency options to change camera.
+ device. Each camera can then set different input or
+ frequency options to change camera.
If multiple cameras use the same video device, they each can capture roundrobin_frames number of frames before having
to share the device with the other cameras.
@@ -2803,11 +2830,12 @@
per input. If you only need 2 or 3 cameras you can also simply put 2 or 3 cheap TV cards in the computer.
Linux has no problem working with multiple TV cards. (or better yet, it multiple cheap network cameras)
If multiple cameras use the same video device, they each can capture
- roundrobin_frames number of frames
+ roundrobin_frames number of frames
before having to share the device with the other cameras.
When another camera wants to watch another input or frequency or size the first
- roundrobin_skip number of frames are skipped to allow the
- device to settle. The last option roundrobin_switchfilter is supposed
+ roundrobin_skip number of frames are skipped to allow the
+ device to settle. The last option
+ roundrobin_switchfilter is supposed
to prevent the change of camera from being detected
as Motion. Its function is not perfect and sometimes prevents detection of real motion. You should start
with having the option disabled and then try with the option enabled to see if you can skip less frames
@@ -3313,28 +3341,14 @@
This is how the overlaid text is located.
-
-
|
+ + | CHANGES |
+ ||||
TEXT_LEFT |
+ TEXT_RIGHT YYYY-MM-DD HH:MM:SS |
-
|
+ + | CHANGES |
+ ||||
TEXT_LEFT |
+ TEXT_RIGHT YYYY-MM-DD HH:MM:SS |
-
|
+ + | CHANGES |
+ ||||
TEXT_LEFT |
+ TEXT_RIGHT YYYY-MM-DD HH:MM:SS |
rotate or flip_axis options, note that the mask is
+ If you are using the rotate
+ or flip_axis options, note that the mask is
applied after the rotation.
Detailed Description
@@ -3740,11 +3728,11 @@
is constant over all available framerates.
When smartmask is enabled and motion is also configured to either write motion-images or motion-mpegs,
the current smartmask is copied as an overlay into the black/white motion-pictures/mpegs in red colour.
- Same thing happens to the webcam stream when Motion runs in setup_mode.
+ Same thing happens to the webcam stream when Motion runs in setup_mode.
That way you can
easily adjust smart_mask_speed.
- The mask_file option provides a static mask to turn off sensitivity in certain areas.
+ The mask_file option provides a static mask to turn off sensitivity in certain areas.
This is very useful to mask a street with cars passing by all day long etc...
But imagine a scenario with large bushes and big trees where all the leaves are moving
@@ -4413,9 +4401,19 @@
mjpeg prefix rather than
+ When using a RTSP, RTMP, mjpeg and some V4l2 cameras, create movie files of the motion with the packets
+ obtained directly from the camera.
+
+ For mjpeg cameras, the url must be specified using the mjpeg prefix rather than
as http
+
+ For v4l2 cameras to use the movie_passthrough, they must be specified using the
+ netcam_url parameter and the v4l2 prefix.
+ Only webcams that provide mjpeg (v4l2_palette option 8)
+ or H264 (v4l2_palette option 21) will work with the
+ movie_passthrough.
+
+
When using only the single netcam_url this option will reduce the processing
required when encoding the images to the resulting movie file. Decoding of the image will still occur on the
@@ -4487,13 +4485,21 @@
Sample:
+
movie_extpipe mencoder -demuxer rawvideo -rawvideo w=%w:h=%h:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %fps
+
+
movie_extpipe x264 - --input-res %wx%h --fps %fps --bitrate 2000 --preset ultrafast --quiet -o %f.mp4
+
+
movie_extpipe mencoder -demuxer rawvideo -rawvideo w=%w:h=%h:fps=%fps -ovc x264 -x264encopts preset=ultrafast -of lavf -o %f.mp4 - -fps %fps
+
+
movie_extpipe ffmpeg -y -f rawvideo -pix_fmt yuv420p -video_size %wx%h -framerate %fps -i pipe:0 -vcodec libx264 -preset ultrafast -f mp4 %f.mp4
+
@@ -4605,7 +4611,7 @@
The video loopback device can be added installed via apt in many distributions. The package tested
with Motion is v4l2loopback-dkms. Once the package is installed, you just need to run
- sudo modprobe v4l2loopback. This will add a new video device that you
+ sudo modprobe v4l2loopback. This will add a new video device that you
can use for the loopback. It is believed that there are additional options associated with the
v4l2loopback that allows for adding more than one device. See the documentation of the v4l2loopback
project for additional details.
@@ -4676,36 +4682,40 @@
Example to pause motion detection
- - lwp-request http://localhost:8080/0/detection/pause+
+ lwp-request http://localhost:8080/0/detection/pause
+
Example to start motion detection
- - lwp-request http://localhost:8080/0/detection/start+
+ lwp-request http://localhost:8080/0/detection/start
+
Example script to update the text_left with cpu load (verbose for clarity)
-
- #!/bin/bash
-
- LOAD=`top -b -n2 | grep "Cpu(s)" | awk '{print $2+$4}' | tail -n1`
-
- TEXTLEFT=""
- TEXTLEFT=$TEXTLEFT"System at %{host}"
- TEXTLEFT=$TEXTLEFT"\nCPU $LOAD "
- TEXTLEFT=$TEXTLEFT"\nfps: %{fps}"
- TEXTLEFT=$TEXTLEFT"\nDate: %Y-%m-%d"
- TEXTLEFT=$TEXTLEFT"\n%T-%q"
-
- # Replace special chars with needed urlcodes
- TEXTLEFT="${TEXTLEFT//%/%25}" #Replace % with %25
- TEXTLEFT="${TEXTLEFT// /%20}" #Replace spaces with %20
- TEXTLEFT="${TEXTLEFT//\{/%7B}" #Replace { with %7B
- TEXTLEFT="${TEXTLEFT//\}/%7D}" #Replace } with %7D
-
- curl http://localhost:8080/1/config/set?text_left=$TEXTLEFT
-
- return 0
+
+
+ #!/bin/bash
+
+ LOAD=`top -b -n2 | grep "Cpu(s)" | awk '{print $2+$4}' | tail -n1`
+
+ TEXTLEFT=""
+ TEXTLEFT=$TEXTLEFT"System at %{host}"
+ TEXTLEFT=$TEXTLEFT"\nCPU $LOAD "
+ TEXTLEFT=$TEXTLEFT"\nfps: %{fps}"
+ TEXTLEFT=$TEXTLEFT"\nDate: %Y-%m-%d"
+ TEXTLEFT=$TEXTLEFT"\n%T-%q"
+
+ # Replace special chars with needed urlcodes
+ TEXTLEFT="${TEXTLEFT//%/%25}" #Replace % with %25
+ TEXTLEFT="${TEXTLEFT// /%20}" #Replace spaces with %20
+ TEXTLEFT="${TEXTLEFT//\{/%7B}" #Replace { with %7B
+ TEXTLEFT="${TEXTLEFT//\}/%7D}" #Replace } with %7D
+
+ curl http://localhost:8080/1/config/set?text_left=$TEXTLEFT
+
+ return 0
+
Note that the replacement of characters with the urlcode values is required whenever updating via
a script or outside the html/css webcontrol_interface
@@ -5351,13 +5361,13 @@
SQL query that executes against the event table which tracks the unique events of motion.
Once the new record is added to this table, the mysql function mysql_insert_id is then
- executed to provide the key back into the dbeventid specifier.
+ executed to provide the key back into the dbeventid specifier.
- The dbeventid specifier can then be used in the sql_query as a parameter
+ The dbeventid specifier can then be used in the sql_query as a parameter
to that query for inserting into the table.
- Although this query is run for all the different database options, the dbeventid is
- only set for mysql databases. For the other databases, the dbeventid is always set
+ Although this query is run for all the different database options, the dbeventid is
+ only set for mysql databases. For the other databases, the dbeventid is always set
to zero.
@@ -5706,43 +5716,45 @@
variables. The 3/8 and 5/8 are illustrative only and set based upon testing with a VIVOTEK PZ81X1 camera. The
values and methods applicable to any other camera would need to be established by the user.
-#!/bin/bash
-
-LOCKFILE=/tmp/track_generic_move_netcam.lock
-if [ -e "$LOCKFILE" ]; then # Trick to avoid flooding
- exit 0 # the netcam of multiple
-fi # moving commands.
-
-function movecam() {
- touch $LOCKFILE
- curl "http://youripaddress/cgi-bin/camctrl/camctrl.cgi?move=$1"
- LOCKED=true
-}
-
-case "$TRACK_ACTION" in
- "center")
- movecam home
- ;;
- "move")
- if [ "$TRACK_CENT_X" -lt "$((TRACK_IMGS_WIDTH*3/8))" ]; then
- movecam left
- fi
- if [ "$TRACK_CENT_X" -gt "$((TRACK_IMGS_WIDTH*5/8))" ]; then
- movecam right
- fi
- if [ "$TRACK_CENT_Y" -lt "$((TRACK_IMGS_HEIGHT*3/8))" ]; then
- movecam up
- fi
- if [ "$TRACK_CENT_Y" -gt "$((TRACK_IMGS_HEIGHT*5/8))" ]; then
- movecam down
- fi
- ;;
-esac
-
-if [ "$LOCKED" = "true" ]; then
- sleep 2
- rm -f "$LOCKFILE"
-fi
+
+ #!/bin/bash
+
+ LOCKFILE=/tmp/track_generic_move_netcam.lock
+ if [ -e "$LOCKFILE" ]; then # Trick to avoid flooding
+ exit 0 # the netcam of multiple
+ fi # moving commands.
+
+ function movecam() {
+ touch $LOCKFILE
+ curl "http://youripaddress/cgi-bin/camctrl/camctrl.cgi?move=$1"
+ LOCKED=true
+ }
+
+ case "$TRACK_ACTION" in
+ "center")
+ movecam home
+ ;;
+ "move")
+ if [ "$TRACK_CENT_X" -lt "$((TRACK_IMGS_WIDTH*3/8))" ]; then
+ movecam left
+ fi
+ if [ "$TRACK_CENT_X" -gt "$((TRACK_IMGS_WIDTH*5/8))" ]; then
+ movecam right
+ fi
+ if [ "$TRACK_CENT_Y" -lt "$((TRACK_IMGS_HEIGHT*3/8))" ]; then
+ movecam up
+ fi
+ if [ "$TRACK_CENT_Y" -gt "$((TRACK_IMGS_HEIGHT*5/8))" ]; then
+ movecam down
+ fi
+ ;;
+ esac
+
+ if [ "$LOCKED" = "true" ]; then
+ sleep 2
+ rm -f "$LOCKFILE"
+ fi
+
diff --git a/motion_stylesheet.css b/motion_stylesheet.css
index 964aff75..139f0a8d 100644
--- a/motion_stylesheet.css
+++ b/motion_stylesheet.css
@@ -1,21 +1,19 @@
* {
- box-sizing: border-box; }
+ box-sizing: border-box;}
body {
padding: 0;
margin: 0;
font-family: Helvetica, Arial, sans-serif;
+ word-wrap: break-word;
font-size: 16px;
line-height: 1.5;
- color: #606c71;
- }
-
+ color: #606c71; }
a {
color: #1e6bb8;
- text-decoration: none; }
- a:hover {
+ text-decoration: none;}
+a:hover {
text-decoration: underline; }
-
.btn {
display: inline-block;
margin-bottom: 1rem;
@@ -26,145 +24,85 @@ a {
border-width: 1px;
border-radius: 0.3rem;
transition: color 0.2s, background-color 0.2s, border-color 0.2s; }
- .btn + .btn {
+.btn + .btn {
margin-left: 1rem; }
-
.btn:hover {
color: rgba(255, 255, 255, 0.8);
text-decoration: none;
background-color: rgba(255, 255, 255, 0.2);
border-color: rgba(255, 255, 255, 0.3); }
-
-@media screen and (min-width: 64em) {
- .btn {
- padding: 0.75rem 1rem; } }
-
-@media screen and (min-width: 42em) and (max-width: 64em) {
- .btn {
- padding: 0.6rem 0.9rem;
- font-size: 0.9rem; } }
-
-@media screen and (max-width: 42em) {
- .btn {
- display: block;
- width: 100%;
- padding: 0.75rem;
- font-size: 0.9rem; }
- .btn + .btn {
- margin-top: 1rem;
- margin-left: 0; } }
-
.page-header {
color: #fff;
text-align: center;
background-color: #159957;
background-image: linear-gradient(120deg, #155799, #159957); }
-
-@media screen and (min-width: 64em) {
- .page-header {
- padding: 1rem 2rem; } }
-
-@media screen and (min-width: 42em) and (max-width: 64em) {
- .page-header {
- padding: 1rem 2rem; } }
-
-@media screen and (max-width: 42em) {
- .page-header {
- padding: 1rem 1rem; } }
-
+.page-header h1 {
+ margin-bottom: 0.1em;
+ margin-top: 0.1em;}
.project-name {
margin-top: 0;
margin-bottom: 0.1rem; }
-
-@media screen and (min-width: 64em) {
- .project-name {
- font-size: 3.25rem; } }
-
-@media screen and (min-width: 42em) and (max-width: 64em) {
- .project-name {
- font-size: 2.25rem; } }
-
-@media screen and (max-width: 42em) {
- .project-name {
- font-size: 1.75rem; } }
-
.project-tagline {
margin-bottom: 2rem;
font-weight: normal;
opacity: 0.7; }
-
-@media screen and (min-width: 64em) {
- .project-tagline {
- font-size: 1.25rem; } }
-
-@media screen and (min-width: 42em) and (max-width: 64em) {
- .project-tagline {
- font-size: 1.15rem; } }
-
-@media screen and (max-width: 42em) {
- .project-tagline {
- font-size: 1rem; } }
-
.main-content :first-child {
margin-top: 0; }
.main-content img {
max-width: 100%; }
.main-content h1, .main-content h2, .main-content h3, .main-content h4, .main-content h5, .main-content h6 {
- margin-top: 2rem;
- margin-bottom: 1rem;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
font-weight: normal;
- color: #159957; }
+ color: #159957;}
.main-content p {
margin-bottom: 1em; }
.main-content code {
padding: 2px 4px;
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
- font-size: 0.9rem;
color: #383e41;
background-color: #f3f6fa;
- border-radius: 0.3rem; }
+ border-radius: 0.3rem;}
.main-content pre {
padding: 0.8rem;
margin-top: 0;
margin-bottom: 1rem;
font: 1rem Consolas, "Liberation Mono", Menlo, Courier, monospace;
color: #567482;
- word-wrap: normal;
background-color: #f3f6fa;
border: solid 1px #dce6f0;
- border-radius: 0.3rem; }
+ border-radius: 0.3rem;}
.main-content pre > code {
- padding: 0;
- margin: 0;
- font-size: 0.9rem;
- color: #567482;
- word-break: normal;
- white-space: pre;
- background: transparent;
- border: 0; }
+ padding: 0;
+ margin: 0;
+ font-size: 0.9rem;
+ color: #567482;
+ word-break: normal;
+ white-space: pre;
+ background: transparent;
+ border: 0;}
.main-content .highlight {
margin-bottom: 1rem; }
.main-content .highlight pre {
- margin-bottom: 0;
- word-break: normal; }
+ margin-bottom: 0;
+ word-break: normal; }
.main-content .highlight pre, .main-content pre {
padding: 0.8rem;
overflow: auto;
font-size: 0.9rem;
line-height: 1.45;
- border-radius: 0.3rem; }
+ border-radius: 0.3rem;}
.main-content pre code, .main-content pre tt {
display: inline;
- max-width: initial;
padding: 0;
margin: 0;
- overflow: initial;
+ overflow: scroll;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0; }
.main-content pre code:before, .main-content pre code:after, .main-content pre tt:before, .main-content pre tt:after {
- content: normal; }
+ content: normal; }
.main-content ul, .main-content ol {
margin-top: 0; }
.main-content blockquote {
@@ -173,218 +111,375 @@ a {
color: #819198;
border-left: 0.3rem solid #dce6f0; }
.main-content blockquote > :first-child {
- margin-top: 0; }
+ margin-top: 0; }
.main-content blockquote > :last-child {
- margin-bottom: 0; }
+ margin-bottom: 0; }
+/*
.main-content table {
display: block;
- width: 100%;
overflow: auto;
word-break: normal;
- word-break: keep-all; }
+ }
.main-content table th {
- font-weight: bold; }
- .main-content table th, .main-content table td {
- padding: 0.5rem 1rem;
- border: 1px solid #e9ebec; }
+ font-weight: bold; }
+.main-content table th, .main-content table td {
+ padding: 0.5rem 1rem;
+ border: 1px solid #e9ebec;}
+*/
.main-content dl {
padding: 0; }
- .main-content dl dt {
- padding: 0;
- margin-top: 1rem;
- font-size: 1rem;
- font-weight: bold; }
- .main-content dl dd {
- padding: 0;
- margin-bottom: 1rem; }
+.main-content dl dt {
+ padding: 0;
+ margin-top: 1rem;
+ font-size: 1rem;
+ font-weight: bold;}
+.main-content dl dd {
+ padding: 0;
+ margin-bottom: 1rem;}
.main-content hr {
height: 2px;
padding: 0;
margin: 1rem 0;
background-color: #eff0f1;
- border: 0; }
-
-@media screen and (min-width: 64em) {
- .main-content {
- max-width: 64rem;
- padding: 2rem 6rem;
- margin: 0 auto;
- font-size: 1.1rem; } }
-
-@media screen and (min-width: 42em) and (max-width: 64em) {
- .main-content {
- padding: 2rem 4rem;
- font-size: 1.1rem; } }
-
-@media screen and (max-width: 42em) {
- .main-content {
- padding: 2rem 1rem;
- font-size: 1rem; } }
+ border: 0;}
.site-footer {
padding-top: 2rem;
margin-top: 2rem;
- border-top: solid 1px #eff0f1; }
-
+ border-top: solid 1px #eff0f1;}
.site-footer-owner {
display: block;
font-weight: bold; }
-
.site-footer-credits {
- color: #819198; }
+ color: #819198;}
-@media screen and (min-width: 64em) {
- .site-footer {
- font-size: 1rem; } }
-
-@media screen and (min-width: 42em) and (max-width: 64em) {
- .site-footer {
- font-size: 1rem; } }
-
-@media screen and (max-width: 42em) {
- .site-footer {
- font-size: 0.9rem; } }
-
-.nav-button {
- list-style-type: none;
- margin: 0;
- padding: 0;
- overflow: hidden;
- background-color: #333;
+.topnav-d, .topnav-m {
+ color: #1e6bb8;
+ text-decoration: none;
}
-
-.nav-button ul {
- list-style-type: none;
- margin: 0;
- padding: 0;
- overflow: scroll;
+.topnav {
background-color: #333;
- }
-.nav-button li {
- float: right;
- }
- .nav-button li a {
+ overflow: hidden;
+}
+.topnav a, .topnav-m, .topnav-d {
+ float: left;
display: block;
- color: white;
+ color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
- }
-
-@media screen and (min-width: 64em) {
- .nav-button {
- font-size: 1rem; } }
-
-@media screen and (min-width: 42em) and (max-width: 64em) {
- .nav-button {
- font-size: 1rem; } }
-
-@media screen and (max-width: 42em) {
- .nav-button {
- font-size: 0.9rem; } }
-
-.nav-vertical {
- list-style-type: none;
- margin: 0;
- padding: 0;
- overflow: scroll;
+ font-size: 17px;
}
-.nav-vertical body {
- margin: 0;
+.topnav .icon {
+ display: none;
}
-.nav-vertical ul {
- list-style-type: none;
- margin: 0;
- padding: 0;
- width: 25%;
- background-color: #f1f1f1;
- height: 100%;
- overflow: scroll;
- }
-.nav-vertical li {
- float: left;
- }
- .nav-vertical li a {
+.topnav a:hover{
+ background-color: #555;
+ color: white;
+}
+@media screen and (min-width: 48em) {
+ .topnav a {
+ float: right;
+ }
+
+ .topnav .topnav-d {
+ float: right;
display: block;
- color: #000;
- padding: 8px 16px;
- text-decoration: none;
+ }
+
+ .topnav .topnav-m {
+ float: right;
+ display: none;
+ }
+
+ .topnav .logoimg {
+ width:auto;
+ height:3.0em;}
+
+}
+@media screen and (max-width: 48em) {
+
+ .topnav a:not(:first-child) {
+ display: none;
}
-@media screen and (min-width: 64em) {
- .nav-vertical {
- font-size: 1rem; } }
+ .topnav .topnav-d{
+ display: none;
+ }
-@media screen and (min-width: 42em) and (max-width: 64em) {
- .nav-vertical {
- font-size: 1rem; } }
+ .topnav .topnav-m:not(:first-child) {
+ display: none;
+ }
-@media screen and (max-width: 42em) {
- .nav-vertical {
- font-size: 0.9rem; } }
+ .topnav a.icon {
+ float: right;
+ display: block;
+ }
-.vertical-menu {
- height: 100%;
- width: 15%;
- position: fixed;
- z-index: 1;
+ .topnav.responsive {position: relative;}
+ .topnav.responsive a.icon {
+ position: absolute;
+ right: 0;
top: 0;
- left: 0;
- overflow-x: scroll;
- padding-top: 60px;
- transition: 0.5s;
-}
- .vertical-menu a {
- padding: 5px 14px 4px 16px;
- text-decoration: none;
- font-size: 0.80em ;
- display: block;
- transition: 0.3s
}
- .vertical-menu a:hover {
- background-color: #ccc;
- }
- .vertical-menu a.active {
- background-color: #4CAF50;
- color: white;
- }
- .vertical-menu button {
- padding: 5px 14px 4px 16px;
- text-decoration: none;
+ .topnav.responsive a {
+ float: none;
display: block;
- transition: 0.3s;
- border: none;
- width: 100%;
- overflow-x: scroll;
text-align: left;
- outline: none;
- background-color: white;
- color: #1e6bb8;
+ }
+
+ .topnav.responsive .topnav-d {
+ float: none;
+ display: none;
+ text-align: left;
+ }
+
+ .topnav.responsive .topnav-m {
+ float: none;
+ display: block;
+ text-align: left;
+ }
+
+ .topnav.responsive .dropdown {float: none;}
+ .topnav.responsive .dropdown-content {position: relative;}
+ .topnav.responsive .dropdown .dropbtn {
+ display: block;
+ width: 100%;
+ text-align: left;
+ }
}
-.vertical-menu button:hover {
- background-color: #cdc;
+
+.subnav {
+ overflow: hidden;
+ background-color: #159957;
+ background-image: linear-gradient(120deg, #155799, #159957);
+ border-top: 2px solid black;
+}
+.subnav a {
+ float: left;
+ display: block;
+ color: white;
+ text-align: center;
+ padding: 5px;
+ text-decoration: none;
+ font-size: 12px;
+}
+.subnav .icon {
+ display: none;
+}
+.dropdown {
+ float: left;
+ overflow: hidden;
+}
+.dropdown .dropbtn {
+ font-size: 12px;
+ border: none;
+ outline: none;
+ color: white;
+ padding: 14px 16px;
+ background-color: inherit;
+ font-family: inherit;
+ margin: 0;
+}
+.dropdown-content {
+ display: none;
+ position: absolute;
+ background-color: #f1f1f1;
+ min-width: 160px;
+ box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
+ z-index: 1;
+}
+.dropdown-content a {
+ float: none;
+ color: black;
+ padding: 12px 16px;
+ text-decoration: none;
+ display: block;
+ text-align: left;
+}
+.subnav a:hover, .dropdown:hover .dropbtn {
+ background-color: #555;
+ color: white;
+}
+.dropdown-content a:hover {
+ background-color: #ddd
+ color: black;
+}
+.dropdown:hover .dropdown-content {
+ display: block;
+}
+
+@media screen and (min-width: 48em) {
+ .subnav a {
+ float: left;
+ }
+}
+@media screen and (max-width: 48em) {
+ .subnav a:not(:first-child), .dropdown .dropbtn {
+ display: none;
+ }
+ .subnav a.icon {
+ float: right;
+ display: block;
+ }
+ .subnav.responsive {position: relative;}
+ .subnav.responsive a.icon {
+ position: absolute;
+ right: 0;
+ top: 0;
+ }
+ .subnav.responsive a {
+ float: none;
+ display: block;
+ text-align: left;
+ }
+ .subnav.responsive .dropdown {float: none;}
+ .subnav.responsive .dropdown-content {position: relative;}
+ .subnav.responsive .dropdown .dropbtn {
+ display: block;
+ width: 100%;
+ text-align: left;
+ }
}
.panel {
- padding: 5px 14px 4px 16px;
- background-color: white;
- max-height: 0;
- overflow: scroll;
- overflow-x: hidden;
- transition: max-height 0.2s ease-out;
+ padding: 0.5em 1.4em 0.4em 1.6em;
+ background-color: white;
+ max-height: 0;
+ overflow: scroll;
+ overflow-x: hidden;
+ transition: max-height 0.2s ease-out;
+}
+.active {
+ background-color: #4CAF50;
+ color: white;
+}
+.logoimg {
+ width:auto;
+ height:3.0em;
}
-@media screen and (min-width: 64em) {
- .vertical-menu {
- font-size: 1rem; } }
-@media screen and (min-width: 42em) and (max-width: 64em) {
- .vertical-menu {
- font-size: 1rem; } }
-@media screen and (max-width: 42em) {
- .vertical-menu {
- font-size: 0.9rem; } }
+@media screen and (min-width: 48em) {
+ .nav-vertical { font-size: 1em; }
+ .accordian { font-size: 1em; }
+ .nav-button {
+ font-size: 1em;
+ height: 2.5em;}
+ .vertical-menu { font-size: 1em; }
+ .panel { font-size: 1em; }
+ .site-footer { font-size: 1em; }
+ .project-tagline { font-size: 1.25em; }
+ .project-name { font-size: 3.25em; }
+ .page-header {
+ padding: 0.1rem 0.1rem;
+ font-size: 1rem;
+ }
+ .btn {
+ padding: 0.75em 1em; }
+ .main-content {
+ padding: 0.5em 0.5em;
+ font-size: 1.1rem; }
+ .tblalpha td {
+ height: 17px;
+ }
+
+}
+
+@media screen and (max-width: 48em) {
+ .logoimg {
+ width:auto;
+ height:3em;
+ }
+ .nav-vertical { font-size: 0.5rem; }
+ .nav-button {
+ font-size: 0.6em;
+ height: 3em;
+ }
+
+ .vertical-menu { font-size: 0.9rem; }
+ .vertical-menu a { font-size: 0.7rem; }
+ .accordian { font-size: 0.5rem; }
+ .panel { font-size: 0.5rem; }
+ .site-footer { font-size: 0.5rem;}
+ .project-tagline { font-size: 1rem; }
+ .project-name { font-size: 1.75rem; }
+ .page-header{
+ font-size: 1rem;
+ padding: 0.1rem 0.1rem;
+ }
+ .btn {
+ display: block;
+ padding: 0.75rem;
+ font-size: 0.9rem; }
+ .btn + .btn {
+ margin-top: 1rem;
+ margin-left: 0; }
+ .main-content {
+ padding: 0.5rem 0.5rem;
+ font-size: 0.7rem;}
+ .main-content {
+ table-layout: auto;
+ }
+}
+
+@media screen and (max-width: 48em) {
+
+
+ .tblsignal table,.tblsignal thead,.tblsignal tbody,.tblsignal th,.tblsignal td,.tblsignal tr,
+ .tblalpha table,.tblalpha thead,.tblalpha tbody,.tblalpha th,.tblalpha td,.tblalpha tr,
+ .tbldetail table,.tbldetail thead,.tbldetail tbody,.tbldetail th,.tbldetail td,.tbldetail tr,
+ .tblconvr table,.tblconvr thead,.tblconvr tbody,.tblconvr th,.tblconvr td,.tblconvr tr,
+ .tblpaltte table,.tblpaltte thead,.tblpaltte tbody,.tblpaltte th,.tblpaltte td,.tblpaltte tr,
+ .tblconfig table,.tblconfig thead,.tblconfig tbody,.tblconfig th,.tblconfig td,.tblconfig tr
+ {
+ display: block;
+ }
+ .tblsignal thead tr, .tblalpha thead tr, .tbldetail thead tr, .tblconvr thead tr,
+ .tblpaltte thead tr, .tblconfig thead tr {
+ position: absolute;
+ top: -9999px;
+ left: -9999px;
+ }
+ .tblsignal tr, .tblalpha tr, .tbldetail tr, .tblconvr tr,
+ .tblpaltte tr, .tblconfig tr {
+ border: 1px solid #ccc;
+ }
+ .tblsignal td, .tbldetail td, .tblconvr td, .tblpaltte td {
+ border: none;
+ border-bottom: 1px solid #eee;
+ position: relative;
+ padding-left: 5%;
+ height: 2.8em;
+ }
+ .tblsignal td:before, .tbldetail td:before, .tblconvr td:before,
+ .tblpaltte td:before, .tblconfig td:before {
+ position: absolute;
+ top: 6px;
+ left: 6px;
+ width: 65%;
+ padding-top: 10px;
+ white-space: nowrap;
+ padding-left: 5%;
+ }
+ .tblalpha td{
+ border: none;
+ border-bottom: 1px solid #eee;
+ position: relative;
+ padding-left: 15px;
+ height: 2.8em;
+ }
+ .tblconfig td {
+ border: none;
+ border-bottom: 1px solid #eee;
+ position: relative;
+ padding-left: 5%;
+ min-height: 2.8em;
+ height: auto;
+ }
+
+}
diff --git a/netcam_rtsp.c b/netcam_rtsp.c
index 6b0e9a59..8f0f4a0e 100644
--- a/netcam_rtsp.c
+++ b/netcam_rtsp.c
@@ -72,7 +72,6 @@ static void netcam_rtsp_null_context(struct rtsp_context *rtsp_data){
rtsp_data->frame = NULL;
rtsp_data->codec_context = NULL;
rtsp_data->format_context = NULL;
- rtsp_data->pktarray = NULL;
rtsp_data->transfer_format = NULL;
}
@@ -83,11 +82,10 @@ static void netcam_rtsp_close_context(struct rtsp_context *rtsp_data){
if (rtsp_data->swsframe_in != NULL) my_frame_free(rtsp_data->swsframe_in);
if (rtsp_data->swsframe_out != NULL) my_frame_free(rtsp_data->swsframe_out);
if (rtsp_data->frame != NULL) my_frame_free(rtsp_data->frame);
+ if (rtsp_data->pktarray != NULL) netcam_rtsp_pktarray_free(rtsp_data);
if (rtsp_data->codec_context != NULL) my_avcodec_close(rtsp_data->codec_context);
if (rtsp_data->format_context != NULL) avformat_close_input(&rtsp_data->format_context);
- if (rtsp_data->pktarray != NULL) netcam_rtsp_pktarray_free(rtsp_data);
if (rtsp_data->transfer_format != NULL) avformat_close_input(&rtsp_data->transfer_format);
-
netcam_rtsp_null_context(rtsp_data);
}
@@ -112,13 +110,10 @@ static void netcam_rtsp_pktarray_resize(struct context *cnt, int is_highres){
int64_t idnbr_last, idnbr_first;
int indx;
- int resize_pktarray;
struct rtsp_context *rtsp_data;
struct packet_item *tmp;
int newsize;
-
- resize_pktarray = TRUE;
if (is_highres){
idnbr_last = cnt->imgs.image_ring[cnt->imgs.image_ring_out].idnbr_high;
idnbr_first = cnt->imgs.image_ring[cnt->imgs.image_ring_in].idnbr_high;
@@ -133,32 +128,32 @@ static void netcam_rtsp_pktarray_resize(struct context *cnt, int is_highres){
/* The 30 is arbitrary */
/* Double the size plus double last diff so we don't catch our tail */
- newsize =((idnbr_first - idnbr_last) * 2 );
- newsize = newsize + ((rtsp_data->idnbr - idnbr_last ) * 2);
+ newsize =((idnbr_first - idnbr_last) * 2 ) + ((rtsp_data->idnbr - idnbr_last ) * 2);
if (newsize < 30) newsize = 30;
- if (rtsp_data->pktarray_size >= newsize) resize_pktarray = FALSE;
- if ((resize_pktarray) || (rtsp_data->pktarray_size < 30)){
- tmp = mymalloc(newsize * sizeof(struct packet_item));
- if (rtsp_data->pktarray_size > 0 ){
- memcpy(tmp, rtsp_data->pktarray, sizeof(struct packet_item) * rtsp_data->pktarray_size);
- }
- for(indx = rtsp_data->pktarray_size; indx < newsize; indx++) {
- av_init_packet(&tmp[indx].packet);
- tmp[indx].packet.data=NULL;
- tmp[indx].packet.size=0;
- tmp[indx].idnbr = 0;
- tmp[indx].iskey = FALSE;
- tmp[indx].iswritten = FALSE;
- }
- pthread_mutex_lock(&rtsp_data->mutex_pktarray);
+ pthread_mutex_lock(&rtsp_data->mutex_pktarray);
+ if ((rtsp_data->pktarray_size < newsize) || (rtsp_data->pktarray_size < 30)){
+ tmp = mymalloc(newsize * sizeof(struct packet_item));
+ if (rtsp_data->pktarray_size > 0 ){
+ memcpy(tmp, rtsp_data->pktarray, sizeof(struct packet_item) * rtsp_data->pktarray_size);
+ }
+ for(indx = rtsp_data->pktarray_size; indx < newsize; indx++) {
+ av_init_packet(&tmp[indx].packet);
+ tmp[indx].packet.data=NULL;
+ tmp[indx].packet.size=0;
+ tmp[indx].idnbr = 0;
+ tmp[indx].iskey = FALSE;
+ tmp[indx].iswritten = FALSE;
+ }
+
if (rtsp_data->pktarray != NULL) free(rtsp_data->pktarray);
rtsp_data->pktarray = tmp;
rtsp_data->pktarray_size = newsize;
- pthread_mutex_unlock(&rtsp_data->mutex_pktarray);
- MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO
- ,_("%s: Resized packet array to %d"), rtsp_data->cameratype,newsize);
- }
+
+ MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO
+ ,_("%s: Resized packet array to %d"), rtsp_data->cameratype,newsize);
+ }
+ pthread_mutex_unlock(&rtsp_data->mutex_pktarray);
}
@@ -168,10 +163,13 @@ static void netcam_rtsp_pktarray_add(struct rtsp_context *rtsp_data){
int retcd;
char errstr[128];
- if (rtsp_data->pktarray_size == 0) return;
-
pthread_mutex_lock(&rtsp_data->mutex_pktarray);
+ if (rtsp_data->pktarray_size == 0){
+ pthread_mutex_unlock(&rtsp_data->mutex_pktarray);
+ return;
+ }
+
/* Recall pktarray_size is one based but pktarray is zero based */
if (rtsp_data->pktarray_index == (rtsp_data->pktarray_size-1) ){
indx_next = 0;
@@ -702,7 +700,7 @@ static int netcam_rtsp_ntc(struct rtsp_context *rtsp_data){
,rtsp_data->codec_context->width,rtsp_data->codec_context->height
,rtsp_data->imgsize.width,rtsp_data->imgsize.height);
} else {
- MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("format than YUV420P. The image sent is being "));
+ MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("The image sent is being "));
MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("trancoded to YUV420P. If possible change netcam "));
MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("picture format to YUV420P to possibly lower CPU usage."));
}
@@ -857,9 +855,11 @@ static void netcam_rtsp_set_v4l2(struct rtsp_context *rtsp_data){
sprintf(optfps, "%s","default");
sprintf(optsize, "%s","default");
}
+ } else {
+ sprintf(optfps, "%s","default");
+ sprintf(optsize, "%s","default");
}
-
if (rtsp_data->status == RTSP_NOTCONNECTED){
MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO
,_("%s: Requested v4l2_palette option: %d")
@@ -972,6 +972,7 @@ static void netcam_rtsp_set_parms (struct context *cnt, struct rtsp_context *rts
rtsp_data->img_latest->ptr = mymalloc(NETCAM_BUFFSIZE);
rtsp_data->pktarray_size = 0;
rtsp_data->pktarray_index = -1;
+ rtsp_data->pktarray = NULL;
rtsp_data->handler_finished = TRUE;
rtsp_data->first_image = TRUE;
@@ -1341,7 +1342,7 @@ static void netcam_rtsp_handler_wait(struct rtsp_context *rtsp_data){
((rtsp_data->frame_curr_tm.tv_sec - rtsp_data->frame_prev_tm.tv_sec) * 1000000L) -
(rtsp_data->frame_curr_tm.tv_usec - rtsp_data->frame_prev_tm.tv_usec);
if ((usec_delay > 0) && (usec_delay < 1000000L)){
- SLEEP(0, usec_delay * 1000)
+ SLEEP(0, usec_delay * 1000);
}
}
diff --git a/picture.c b/picture.c
index a715491d..4b82913a 100644
--- a/picture.c
+++ b/picture.c
@@ -344,7 +344,7 @@ static unsigned prepare_exif(unsigned char **exif,
writing.buf += 2;
if (description)
- put_stringentry(&writing, TIFF_TAG_IMAGE_DESCRIPTION, description, 0);
+ put_stringentry(&writing, TIFF_TAG_IMAGE_DESCRIPTION, description, 1);
if (datetime)
put_stringentry(&writing, TIFF_TAG_DATETIME, datetime, 1);
diff --git a/picture.h b/picture.h
index 5076bcbb..f15a71fa 100644
--- a/picture.h
+++ b/picture.h
@@ -20,7 +20,6 @@ int put_picture_memory(struct context *, unsigned char*, int, unsigned char *, i
void put_picture(struct context *, char *, unsigned char *, int);
unsigned char *get_pgm(FILE *, int, int);
void preview_save(struct context *);
-unsigned char *scale_half_yuv420p(int origwidth, int origheight, unsigned char *img);
void pic_scale_img(int width_src, int height_src, unsigned char *img_src, unsigned char *img_dst);
#endif /* _INCLUDE_PICTURE_H_ */
diff --git a/version.sh b/version.sh
index e7b3b31d..6a4b855c 100755
--- a/version.sh
+++ b/version.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-BASE_VERSION="4.2"
+BASE_VERSION="4.2.1"
if [ -d .git ]; then
if test "`git diff --name-only`" = "" ; then
GIT_COMMIT="git"
diff --git a/video_v4l2.c b/video_v4l2.c
index 8b341279..57258448 100644
--- a/video_v4l2.c
+++ b/video_v4l2.c
@@ -461,7 +461,7 @@ static int v4l2_autobright(struct context *cnt, struct video_dev *curdev, int me
avg = 0;
pixel_count = 0;
- image = cnt->imgs.image_virgin.image_norm;
+ image = cnt->imgs.image_vprvcy.image_norm;
for (indx = 0; indx < cnt->imgs.motionsize; indx += 10) {
avg += image[indx];
pixel_count++;
diff --git a/webu.c b/webu.c
index 162a90ba..1d9a55ff 100644
--- a/webu.c
+++ b/webu.c
@@ -1147,6 +1147,10 @@ static void webu_answer_strm_type(struct webui_ctx *webui) {
(strcmp(webui->uri_camid,"current") == 0)){
webui->cnct_type = WEBUI_CNCT_STATIC;
+ } else if ((strlen(webui->uri_camid) > 0) &&
+ (strlen(webui->uri_cmd1) == 0)){
+ webui->cnct_type = WEBUI_CNCT_FULL;
+
} else {
webui->cnct_type = WEBUI_CNCT_UNKNOWN;
}
@@ -1434,7 +1438,7 @@ static void webu_mhd_features_basic(struct mhdstart_ctx *mhdst){
int retcd;
retcd = MHD_is_feature_supported (MHD_FEATURE_BASIC_AUTH);
if (retcd == MHD_YES){
- MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: available"));
+ MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: available"));
} else {
if ((mhdst->ctrl) && (mhdst->cnt[mhdst->indxthrd]->conf.webcontrol_auth_method == 1)){
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: disabled"));
@@ -1457,7 +1461,7 @@ static void webu_mhd_features_digest(struct mhdstart_ctx *mhdst){
int retcd;
retcd = MHD_is_feature_supported (MHD_FEATURE_DIGEST_AUTH);
if (retcd == MHD_YES){
- MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: available"));
+ MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: available"));
} else {
if ((mhdst->ctrl) && (mhdst->cnt[mhdst->indxthrd]->conf.webcontrol_auth_method == 2)){
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: disabled"));
@@ -1486,9 +1490,9 @@ static void webu_mhd_features_ipv6(struct mhdstart_ctx *mhdst){
int retcd;
retcd = MHD_is_feature_supported (MHD_FEATURE_IPv6);
if (retcd == MHD_YES){
- MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("IPV6: available"));
+ MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("IPV6: available"));
} else {
- MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("IPV6: disabled"));
+ MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("IPV6: disabled"));
if (mhdst->ipv6) mhdst->ipv6 = 0;
}
#endif
@@ -1511,7 +1515,7 @@ static void webu_mhd_features_tls(struct mhdstart_ctx *mhdst){
int retcd;
retcd = MHD_is_feature_supported (MHD_FEATURE_SSL);
if (retcd == MHD_YES){
- MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: available"));
+ MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: available"));
} else {
if ((mhdst->ctrl) && (mhdst->cnt[mhdst->indxthrd]->conf.webcontrol_tls)){
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: disabled"));
@@ -1836,6 +1840,10 @@ static void webu_start_ctrl(struct context **cnt){
free(mhdst.mhd_ops);
if (cnt[0]->webcontrol_daemon == NULL){
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Unable to start MHD"));
+ } else {
+ MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO
+ ,_("Started webcontrol on port %d")
+ ,cnt[0]->conf.webcontrol_port);
}
}
@@ -1845,6 +1853,32 @@ static void webu_start_ctrl(struct context **cnt){
return;
}
+static void webu_strm_ntc(struct context **cnt, int indxthrd){
+ int indx;
+
+ if (indxthrd == 0 ){
+ if (cnt[1] != NULL) {
+ indx = 1;
+ while (cnt[indx] != NULL){
+ MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO
+ ,_("Started camera %d stream on port/camera_id %d/%d")
+ ,cnt[indx]->camera_id
+ ,cnt[indxthrd]->conf.stream_port
+ ,cnt[indx]->camera_id);
+ indx++;
+ }
+ } else {
+ MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO
+ ,_("Started camera %d stream on port %d")
+ ,cnt[indxthrd]->camera_id,cnt[indxthrd]->conf.stream_port);
+ }
+ } else {
+ MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO
+ ,_("Started camera %d stream on port %d")
+ ,cnt[indxthrd]->camera_id,cnt[indxthrd]->conf.stream_port);
+ }
+}
+
static void webu_start_strm(struct context **cnt){
/* This function starts up the daemon for the streams. It loops through
* all of the camera context's provided and starts streams as requested. If
@@ -1905,6 +1939,8 @@ static void webu_start_strm(struct context **cnt){
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO
,_("Unable to start stream for camera %d")
,cnt[mhdst.indxthrd]->camera_id);
+ } else {
+ webu_strm_ntc(cnt,mhdst.indxthrd);
}
}
mhdst.indxthrd++;
diff --git a/webu_stream.c b/webu_stream.c
index c704bbe7..21e9af4e 100644
--- a/webu_stream.c
+++ b/webu_stream.c
@@ -44,20 +44,18 @@ static void webu_stream_mjpeg_delay(struct webui_ctx *webui) {
/* The stream rate MUST be less than 1000000000 otherwise undefined behaviour
* will occur with the SLEEP function.
*/
- stream_delay = ((time_curr.tv_usec - webui->time_last.tv_usec)*1000000) -
+ stream_delay = ((time_curr.tv_usec - webui->time_last.tv_usec)*1000) +
((time_curr.tv_sec - webui->time_last.tv_sec)*1000000000);
if (stream_delay < 0) stream_delay = 0;
if (stream_delay > 1000000000 ) stream_delay = 1000000000;
- if (webui->cnt->conf.stream_maxrate > 1){
+ if (webui->cnt->conf.stream_maxrate >= 1){
stream_rate = ( (1000000000 / webui->cnt->conf.stream_maxrate) - stream_delay);
if ((stream_rate > 0) && (stream_rate < 1000000000)){
SLEEP(0,stream_rate);
} else if (stream_rate == 1000000000) {
SLEEP(1,0);
}
- } else {
- SLEEP(1,0);
}
gettimeofday(&webui->time_last, NULL);
@@ -277,9 +275,9 @@ int webu_stream_mjpeg(struct webui_ctx *webui) {
return MHD_NO;
}
- if (webui->cnt->conf.webcontrol_cors_header != NULL){
+ if (webui->cnt->conf.stream_cors_header != NULL){
MHD_add_response_header (response, MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN
- , webui->cnt->conf.webcontrol_cors_header);
+ , webui->cnt->conf.stream_cors_header);
}
MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE
@@ -330,4 +328,4 @@ int webu_stream_static(struct webui_ctx *webui) {
MHD_destroy_response (response);
return retcd;
-}
\ No newline at end of file
+}