Motion-Project / motion

Motion, a software motion detector. Home page: https://motion-project.github.io/
GNU General Public License v2.0
3.67k stars 549 forks source link

Video stutters when motion is detected #1733

Closed TheRaven500 closed 9 months ago

TheRaven500 commented 10 months ago

Did you read the guide?

No

What is the base version number of Motion being used?

4.6.x

What was the install method?

Installed via package tool

What is base architecture?

Other

What is the distro being used?

Other

Disto version number

Different Distros (Debian 12 and Dietpi)

Camera type(s) being used?

Other

Describe the issue/problem and steps to reproduce

I use motion (standalone) and in combination with motioneye. This on different platforms. My Wild-Cameras run on RaspberryPi (Dietpi, ARM64) and my Video-Server runs on x86 (Debian 12, Intel Core i7). I have direct attached USB-Cameras, MMAL Cameras and Network-Cameras over RTSP (UDP and TCP). And all of them have the same Problem: The Video runs smooth until motion is detected. Then it drops some frames (about 1s) and runs smooth again. I tried so many things, but never found a solution. I am not sure if it affects motion or ffmpeg. I think (but not sure) it goes more worse on newer versions of motion (and/or maybe ffmpeg?). I also wanted to try "motion plus" to see if it is better, but unfortunately i can't get it running on my Pi because it has Bookworm on it and there are only bullseye arm64 downloads available. First i thought it is a RaspberryPi-Problem (because of low resources) but my Core i7 has the same Problem. Does this happen only to me or is someone else with this problem? BTW: I have already been able to record four thieves. So i really love this useful software! I would appreciate any tips on how to solve this problem.

Motion log output at log_level 8

root@WildCam1:/scripts# motion -d 8 -c /scripts/motion/motion.conf
[0:motion] [NTC] [ALL] conf_load: Processing thread 0 - config file /scripts/motion/motion.conf
[0:motion] [NTC] [ALL] motion_startup: Logging to syslog
[0:motion] [NTC] [ALL] motion_startup: Motion 4.6.0 Started
[0:motion] [NTC] [ALL] motion_startup: Using default log type (ALL)
[0:motion] [NTC] [ALL] motion_startup: Using log type (ALL) log level (DBG)
[0:motion] [NTC] [ALL] pid_write: Created process id file /tmp/motion. Process ID is 3113
[0:motion] [INF] [ALL] conf_output_parms: Writing configuration parameters from all files (1):
[0:motion] [INF] [ALL] Thread 0 - Config file: /scripts/motion/motion.conf
[0:motion] [INF] [ALL] daemon                    off
[0:motion] [INF] [ALL] setup_mode                off
[0:motion] [INF] [ALL] pid_file                  /tmp/motion
[0:motion] [INF] [ALL] log_file                  
[0:motion] [INF] [ALL] log_level                 8
[0:motion] [INF] [ALL] log_type                  ALL
[0:motion] [INF] [ALL] quiet                     on
[0:motion] [INF] [ALL] native_language           off
[0:motion] [INF] [ALL] watchdog_tmo              30
[0:motion] [INF] [ALL] watchdog_kill             10
[0:motion] [INF] [ALL] camera_name               
[0:motion] [INF] [ALL] camera_id                 0
[0:motion] [INF] [ALL] target_dir                /tmp
[0:motion] [INF] [ALL] video_device              /dev/video0
[0:motion] [INF] [ALL] video_params              
[0:motion] [INF] [ALL] auto_brightness           0
[0:motion] [INF] [ALL] tuner_device              
[0:motion] [INF] [ALL] roundrobin_frames         1
[0:motion] [INF] [ALL] roundrobin_skip           1
[0:motion] [INF] [ALL] roundrobin_switchfilter   off
[0:motion] [INF] [ALL] netcam_url                
[0:motion] [INF] [ALL] netcam_params             
[0:motion] [INF] [ALL] netcam_high_url           
[0:motion] [INF] [ALL] netcam_high_params        
[0:motion] [INF] [ALL] netcam_userpass           
[0:motion] [INF] [ALL] mmalcam_name              vc.ril.camera
[0:motion] [INF] [ALL] mmalcam_params            
[0:motion] [INF] [ALL] width                     1280
[0:motion] [INF] [ALL] height                    720
[0:motion] [INF] [ALL] framerate                 30
[0:motion] [INF] [ALL] minimum_frame_time        0
[0:motion] [INF] [ALL] rotate                    180
[0:motion] [INF] [ALL] flip_axis                 none
[0:motion] [INF] [ALL] locate_motion_mode        off
[0:motion] [INF] [ALL] locate_motion_style       box
[0:motion] [INF] [ALL] text_left                 %{host}
[0:motion] [INF] [ALL] text_right                %d-%m-%Y\n%T
[0:motion] [INF] [ALL] text_changes              off
[0:motion] [INF] [ALL] text_scale                2
[0:motion] [INF] [ALL] text_event                %Y%m%d%H%M%S
[0:motion] [INF] [ALL] emulate_motion            off
[0:motion] [INF] [ALL] pause                     off
[0:motion] [INF] [ALL] threshold                 1500
[0:motion] [INF] [ALL] threshold_maximum         0
[0:motion] [INF] [ALL] threshold_tune            off
[0:motion] [INF] [ALL] noise_level               32
[0:motion] [INF] [ALL] noise_tune                on
[0:motion] [INF] [ALL] despeckle_filter          EedDl
[0:motion] [INF] [ALL] area_detect               
[0:motion] [INF] [ALL] mask_file                 
[0:motion] [INF] [ALL] mask_privacy              
[0:motion] [INF] [ALL] smart_mask_speed          0
[0:motion] [INF] [ALL] lightswitch_percent       0
[0:motion] [INF] [ALL] lightswitch_frames        5
[0:motion] [INF] [ALL] minimum_motion_frames     1
[0:motion] [INF] [ALL] event_gap                 30
[0:motion] [INF] [ALL] pre_capture               120
[0:motion] [INF] [ALL] post_capture              60
[0:motion] [INF] [ALL] on_event_start            
[0:motion] [INF] [ALL] on_event_end              
[0:motion] [INF] [ALL] on_picture_save           
[0:motion] [INF] [ALL] on_area_detected          
[0:motion] [INF] [ALL] on_motion_detected        
[0:motion] [INF] [ALL] on_movie_start            
[0:motion] [INF] [ALL] on_movie_end              
[0:motion] [INF] [ALL] on_camera_lost            
[0:motion] [INF] [ALL] on_camera_found           
[0:motion] [INF] [ALL] picture_output            best
[0:motion] [INF] [ALL] picture_output_motion     off
[0:motion] [INF] [ALL] picture_type              jpeg
[0:motion] [INF] [ALL] picture_quality           75
[0:motion] [INF] [ALL] picture_exif              
[0:motion] [INF] [ALL] picture_filename          %d-%m-%Y_%H-%M-%S
[0:motion] [INF] [ALL] snapshot_interval         0
[0:motion] [INF] [ALL] snapshot_filename         %d-%m-%Y_%H-%M-%S
[0:motion] [INF] [ALL] movie_output              on
[0:motion] [INF] [ALL] movie_output_motion       off
[0:motion] [INF] [ALL] movie_max_time            60
[0:motion] [INF] [ALL] movie_bps                 400000
[0:motion] [INF] [ALL] movie_quality             60
[0:motion] [INF] [ALL] movie_codec               mkv
[0:motion] [INF] [ALL] movie_duplicate_frames    off
[0:motion] [INF] [ALL] movie_passthrough         off
[0:motion] [INF] [ALL] movie_filename            %d-%m-%Y_%H-%M-%S
[0:motion] [INF] [ALL] movie_extpipe_use         off
[0:motion] [INF] [ALL] movie_extpipe             
[0:motion] [INF] [ALL] timelapse_interval        0
[0:motion] [INF] [ALL] timelapse_mode            daily
[0:motion] [INF] [ALL] timelapse_fps             30
[0:motion] [INF] [ALL] timelapse_codec           mpg
[0:motion] [INF] [ALL] timelapse_filename        %Y%m%d-timelapse
[0:motion] [INF] [ALL] video_pipe                
[0:motion] [INF] [ALL] video_pipe_motion         
[0:motion] [INF] [ALL] webcontrol_port           8080
[0:motion] [INF] [ALL] webcontrol_ipv6           off
[0:motion] [INF] [ALL] webcontrol_localhost      off
[0:motion] [INF] [ALL] webcontrol_parms          1
[0:motion] [INF] [ALL] webcontrol_interface      0
[0:motion] [INF] [ALL] webcontrol_auth_method    0
[0:motion] [INF] [ALL] webcontrol_authentication 
[0:motion] [INF] [ALL] webcontrol_tls            off
[0:motion] [INF] [ALL] webcontrol_cert           
[0:motion] [INF] [ALL] webcontrol_key            
[0:motion] [INF] [ALL] webcontrol_header_params  
[0:motion] [INF] [ALL] webcontrol_lock_minutes   5
[0:motion] [INF] [ALL] webcontrol_lock_attempts  5
[0:motion] [INF] [ALL] webcontrol_lock_max_ips   25
[0:motion] [INF] [ALL] stream_port               8081
[0:motion] [INF] [ALL] stream_localhost          off
[0:motion] [INF] [ALL] stream_auth_method        0
[0:motion] [INF] [ALL] stream_authentication     
[0:motion] [INF] [ALL] stream_tls                off
[0:motion] [INF] [ALL] stream_header_params      
[0:motion] [INF] [ALL] stream_preview_scale      25
[0:motion] [INF] [ALL] stream_preview_newline    off
[0:motion] [INF] [ALL] stream_preview_method     0
[0:motion] [INF] [ALL] stream_quality            60
[0:motion] [INF] [ALL] stream_grey               off
[0:motion] [INF] [ALL] stream_motion             off
[0:motion] [INF] [ALL] stream_maxrate            10
[0:motion] [INF] [ALL] stream_limit              0
[0:motion] [INF] [ALL] database_type             
[0:motion] [INF] [ALL] database_dbname           
[0:motion] [INF] [ALL] database_host             localhost
[0:motion] [INF] [ALL] database_port             0
[0:motion] [INF] [ALL] database_user             
[0:motion] [INF] [ALL] database_password         
[0:motion] [INF] [ALL] database_busy_timeout     0
[0:motion] [INF] [ALL] sql_log_picture           off
[0:motion] [INF] [ALL] sql_log_snapshot          off
[0:motion] [INF] [ALL] sql_log_movie             off
[0:motion] [INF] [ALL] sql_log_timelapse         off
[0:motion] [INF] [ALL] sql_query_start           
[0:motion] [INF] [ALL] sql_query_stop            
[0:motion] [INF] [ALL] sql_query                 
[0:motion] [INF] [ALL] track_type                0
[0:motion] [INF] [ALL] track_auto                off
[0:motion] [INF] [ALL] track_port                
[0:motion] [INF] [ALL] track_motorx              0
[0:motion] [INF] [ALL] track_motorx_reverse      off
[0:motion] [INF] [ALL] track_motory              0
[0:motion] [INF] [ALL] track_motory_reverse      off
[0:motion] [INF] [ALL] track_maxx                0
[0:motion] [INF] [ALL] track_minx                0
[0:motion] [INF] [ALL] track_maxy                0
[0:motion] [INF] [ALL] track_miny                0
[0:motion] [INF] [ALL] track_homex               128
[0:motion] [INF] [ALL] track_homey               128
[0:motion] [INF] [ALL] track_iomojo_id           0
[0:motion] [INF] [ALL] track_step_angle_x        10
[0:motion] [INF] [ALL] track_step_angle_y        10
[0:motion] [INF] [ALL] track_move_wait           10
[0:motion] [INF] [ALL] track_speed               255
[0:motion] [INF] [ALL] track_stepsize            40
[0:motion] [INF] [ALL] track_generic_move        
[0:motion] [INF] [ALL] camera                    
[0:motion] [INF] [ALL] camera_dir                
[0:motion] [DBG] [ALL] motion_ntc: v4l2   : available
[0:motion] [DBG] [ALL] motion_ntc: bktr   : not available
[0:motion] [DBG] [ALL] motion_ntc: webp   : available
[0:motion] [DBG] [ALL] motion_ntc: mmal   : not available
[0:motion] [DBG] [ALL] motion_ntc: ffmpeg : available
[0:motion] [DBG] [DBL] motion_ntc: mysql  : not available
[0:motion] [DBG] [DBL] motion_ntc: MariaDB: available
[0:motion] [DBG] [DBL] motion_ntc: sqlite3: available
[0:motion] [DBG] [DBL] motion_ntc: pgsql  : available
[0:motion] [DBG] [DBL] motion_ntc: nls    : available
[0:motion] [NTC] [STR] webu_start_strm: Starting all camera streams on port 8081
[0:motion] [DBG] [STR] webu_mhd_features_basic: Basic authentication: available
[0:motion] [DBG] [STR] webu_mhd_features_digest: Digest authentication: available
[0:motion] [DBG] [STR] webu_mhd_features_ipv6: IPV6: available
[0:motion] [DBG] [STR] webu_mhd_features_tls: SSL/TLS: available
[0:motion] [NTC] [STR] webu_strm_ntc: Started camera 0 stream on port 8081
[0:motion] [NTC] [STR] webu_start_ctrl: Starting webcontrol on port 8080
[0:motion] [DBG] [STR] webu_mhd_features_basic: Basic authentication: available
[0:motion] [DBG] [STR] webu_mhd_features_digest: Digest authentication: available
[0:motion] [DBG] [STR] webu_mhd_features_ipv6: IPV6: available
[0:motion] [DBG] [STR] webu_mhd_features_tls: SSL/TLS: available
[0:motion] [NTC] [STR] webu_start_ctrl: Started webcontrol on port 8080
[0:motion] [NTC] [ENC] ffmpeg_global_init: ffmpeg libavcodec version 59.37.100 libavformat version 59.27.100
[0:motion] [DBG] [DBL] dbse_global_init: Initializing database
[0:motion] [NTC] [ALL] translate_init: Language: English
[0:motion] [NTC] [ALL] motion_start_thread: Camera ID: 0 is from /scripts/motion/motion.conf
[0:motion] [NTC] [ALL] motion_start_thread: Camera ID: 0 Camera Name: (null) Device: /dev/video0
[0:motion] [NTC] [ALL] main: Waiting for threads to finish, pid: 3113
[1:ml1] [NTC] [ALL] motion_init: Camera 0 started: motion detection Enabled
[1:ml1] [NTC] [VID] vid_start: Opening V4L2 device
[1:ml1] [DBG] [ALL] util_parms_add: Parsed: >palette< >17<
[1:ml1] [DBG] [ALL] util_parms_add: Parsed: >input< >-1<
[1:ml1] [DBG] [ALL] util_parms_add: Parsed: >norm< >0<
[1:ml1] [DBG] [ALL] util_parms_add: Parsed: >frequency< >0<
[1:ml1] [NTC] [VID] v4l2_device_open: Using videodevice /dev/video0 and input -1
[1:ml1] [DBG] [VID] v4l2_device_capability: ------------------------
[1:ml1] [DBG] [VID] v4l2_device_capability: cap.driver: "bcm2835 mmal"
[1:ml1] [DBG] [VID] v4l2_device_capability: cap.card: "mmal service 16.1"
[1:ml1] [DBG] [VID] v4l2_device_capability: cap.bus_info: "platform:bcm2835_v4l2-0"
[1:ml1] [DBG] [VID] v4l2_device_capability: cap.capabilities=0x85200005
[1:ml1] [DBG] [VID] v4l2_device_capability: ------------------------
[1:ml1] [NTC] [VID] v4l2_device_capability: - VIDEO_CAPTURE
[1:ml1] [NTC] [VID] v4l2_device_capability: - VIDEO_OVERLAY
[1:ml1] [NTC] [VID] v4l2_device_capability: - READWRITE
[1:ml1] [NTC] [VID] v4l2_device_capability: - STREAMING
[1:ml1] [DBG] [VID] v4l2_input_select: Name = "Camera 0", type 0x00000002, status 00000000
[1:ml1] [NTC] [VID] v4l2_input_select: Name = "Camera 0"- CAMERA
[1:ml1] [NTC] [VID] v4l2_norm_select: Device does not support specifying PAL/NTSC norm
[1:ml1] [NTC] [VID] v4l2_pixfmt_try: Testing palette YU12 (1280x720)
[1:ml1] [DBG] [VID] v4l2_pixfmt_stride: Checking image size 1280x720 with stride 1280
[1:ml1] [NTC] [VID] v4l2_pixfmt_set: Using palette YU12 (1280x720)
[1:ml1] [INF] [VID] v4l2_fps_set: Trying to set fps to 30
[1:ml1] [INF] [VID] v4l2_fps_set: Device set fps to 30
[1:ml1] [INF] [VID] v4l2_ctrls_list: ---------Controls---------
[1:ml1] [INF] [VID] v4l2_ctrls_list:   V4L2 ID   Name and Range
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963776 Brightness, 0 to 100
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963777 Contrast, -100 to 100
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963778 Saturation, -100 to 100
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963790 Red Balance, 1 to 7999
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963791 Blue Balance, 1 to 7999
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963796 Horizontal Flip, 0 to 1
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963797 Vertical Flip, 0 to 1
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963800 Power Line Frequency, 0 to 3
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 Disabled
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 50 Hz
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 2 60 Hz
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 3 Auto
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963803 Sharpness, -100 to 100
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963807 Color Effects, 0 to 15
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 None
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 Black & White
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 2 Sepia
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 3 Negative
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 4 Emboss
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 5 Sketch
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 6 Sky Blue
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 7 Grass Green
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 8 Skin Whiten
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 9 Vivid
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 10 Aqua
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 11 Art Freeze
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 12 Silhouette
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 13 Solarization
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 14 Antique
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 15 Set Cb/Cr
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963810 Rotate, 0 to 360
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963818 Color Effects, CbCr, 0 to 65535
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10029518 Video Bitrate Mode, 0 to 1
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 Variable Bitrate
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 Constant Bitrate
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10029519 Video Bitrate, 25000 to 25000000
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10029538 Repeat Sequence Header, 0 to 1
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10029541 Force Key Frame, 0 to 0
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10029665 H264 Minimum QP Value, 0 to 51
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10029666 H264 Maximum QP Value, 0 to 51
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10029670 H264 I-Frame Period, 0 to 2147483647
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10029671 H264 Level, 0 to 13
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 1
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 1b
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 2 1.1
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 3 1.2
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 4 1.3
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 5 2
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 6 2.1
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 7 2.2
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 8 3
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 9 3.1
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 10 3.2
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 11 4
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 12 4.1
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 13 4.2
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10029675 H264 Profile, 0 to 4
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 Baseline
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 Constrained Baseline
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 2 Main
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 4 High
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094849 Auto Exposure, 0 to 3
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 Auto Mode
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 Manual Mode
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094850 Exposure Time, Absolute, 1 to 10000
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094851 Exposure, Dynamic Framerate, 0 to 1
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094867 Auto Exposure, Bias, 0 to 24
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094868 White Balance, Auto & Preset, 0 to 10
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 Manual
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 Auto
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 2 Incandescent
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 3 Fluorescent
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 4 Fluorescent H
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 5 Horizon
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 6 Daylight
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 7 Flash
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 8 Cloudy
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 9 Shade
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 10 Greyworld
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094870 Image Stabilization, 0 to 1
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094871 ISO Sensitivity, 0 to 4
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094872 ISO Sensitivity, Auto, 0 to 1
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 Manual
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 Auto
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094873 Exposure, Metering Mode, 0 to 3
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 Average
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 Center Weighted
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 2 Spot
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 3 Matrix
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094874 Scene Mode, 0 to 13
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 None
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 8 Night
[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 11 Sports
[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10291459 Compression Quality, 1 to 100
[1:ml1] [INF] [VID] v4l2_ctrls_list: --------------------------
[1:ml1] [DBG] [VID] v4l2_mmap_request: mmap information: frames=4
[1:ml1] [DBG] [VID] v4l2_mmap_query: 0 length=1382400 Address (688ae000) offset 0
[1:ml1] [DBG] [VID] v4l2_mmap_query: 1 length=1382400 Address (6875c000) offset 1384448
[1:ml1] [DBG] [VID] v4l2_mmap_query: 2 length=1382400 Address (6860a000) offset 2768896
[1:ml1] [DBG] [VID] v4l2_mmap_query: 3 length=1382400 Address (684b8000) offset 4153344
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 121 items
[0:cn0] [DBG] [STR] webu_parseurl: Sent url: /
[0:cn0] [DBG] [STR] webu_parseurl: Decoded url: /
[0:st0] [INF] [ALL] webu_answer_strm: Connection from: 192.168.1.101
[1:ml1] [NTC] [ALL] motion_detected: Motion detected - starting event 1.
[1:ml1] [INF] [EVT] event_ffmpeg_newfile: Source FPS 28
[1:ml1] [INF] [ENC] ffmpeg_set_quality: libx264 codec vbr/crf/bit_rate: 20
[1:ml1] [NTC] [EVT] event_newfile: Writing movie to file: /tmp/29-12-2023_17-47-37.mkv
[1:ml1] [NTC] [EVT] event_newfile: Writing image to file: /tmp/29-12-2023_17-47-41.jpg
[1:ml1] [DBG] [EVT] event_closefile: Saved movie to file: /tmp/29-12-2023_17-47-37.mkv
[1:ml1] [NTC] [ALL] mlp_actions: End of event 1
^C[0:motion] [NTC] [ALL] sig_handler: Received signal 2.
[1:ml1] [NTC] [ALL] motion_loop: Thread exiting
[1:ml1] [NTC] [VID] vid_close: Cleaning up V4L2 device
[1:ml1] [NTC] [VID] v4l2_cleanup: Closing video device /dev/video0
[1:ml1] [DBG] [VID] v4l2_device_close: close
[1:ml1] [DBG] [VID] v4l2_device_cleanup: vid_source
[0:motion] [NTC] [ALL] main: Threads finished
[0:motion] [NTC] [ALL] main: Motion terminating
[0:motion] [NTC] [ALL] motion_remove_pid: Removed process id file (pid file).
TheRaven500 commented 10 months ago

Log added. The Log is from my wildcam. Here you can download the video: Test-Video1 As you can see, the video stutters extremely when motion is detected. The same happens (but a bit less extreme) on the i7. Hope i can also get a log. By the way, it doesn't matter whether the movement is recognized by the image change or whether it is triggered externally via http webinterface command (i have a PiR connected which triggers the motion if an animal passes the camera). Additional information: This is a Raspberry Pi Zero2W. If motion is triggered cpu reaches about 70% of load. So this can not be the problem i think. Here you can see the cpu-load: CPU-Load I also tried with codec mp4 and mpeg4 but result is always the same.

tosiara commented 10 months ago

Could you try to set:

pre_capture 0 post_capture 0

And test again (attach new log and new test movie)?

TheRaven500 commented 10 months ago

Thank you very much for response. Have done this and it looks good so far! Here is the log: motion2.log And here the video: Test-Video2 BTW: I have deliberately moved the output folder to /tmp to make sure that it is not due to the slow microsd card. I will now try only with post_capture and look what happens. Edit: With "post_capture 120" it looks also good. It seems it has something to do with "pre_capture". Test-Video3 Edit2: I played around with "pre_capture". With a value of "5" it has a very small (barely noticeable) lag, with "10" it lags more and much more with a value of "30". So it looks like is has something to do with the value of pre_capture. The higher the value, the more it lags.

Mr-Dave commented 9 months ago

Closing per the edit comments.

TheRaven500 commented 9 months ago

Why have you closed this bug? What is the solution?

Mr-Dave commented 9 months ago

As per your comment, it is because of the pre_capture and the lack of power of a PI.

Edit: It is also very clearly documented in the guide to not specify large values for pre_capture or the result will be lags in the resulting videos.

TheRaven500 commented 9 months ago

No, it also happens on a intel i7. So i don't think it is a pi problem. Looks like something with pre_capter is wrong. Post_capture works fine. I try to verify this.

TheRaven500 commented 9 months ago

Sorry for late response, i am very busy ATM. It happens also on i7-6700 (Quad-Core @3.4Ghz) with RTSP camera. Interesting is that it has also a very small lag with "pre_capture 0". But if i raise "pre_capture" to 120 the lag grows. This is a combined installation (motion 4.6.0 with motioneye 0.43 python3), because of this i try to switch to motion only to be sure it is NOT a motioneye problem. Hope i find time soon to do this. :-) Edit: Ok, i have tested it and as expected it happens also with motion only. Connected 1 network rtsp camera with fullHD 1920x1080. Without pre_capture: Log1.txt Test-Video: https://bigbang.ddns.me/index.php/s/iYFXk3GtS6PTmsy With pre_capture: Log2.txt Test-Video: https://bigbang.ddns.me/index.php/s/WHSzDaisatZfJ5E As you can see it has a lag between motion and trigger. No clue why. But it happens on Rapsberry with dietpi and also on i7 with 8GB of Ram and Debian12 with different cameras (mmal and rtsp).

TheRaven500 commented 9 months ago

Oh, closed and won't fix :disappointed: I still think something is wrong, but can also be a config problem. As soon the trigger kicks in it has a short lag. Here is another video of two playing cats: Cat-Video As you can see it stutters from time to time. In this case not really a problem, bit if a thief runs very fast it can be that he can pass the camera without being filmed. BTW: I have edited my previous post to provide more info.

TheRaven500 commented 2 months ago

When I was trying to solve another problem, I stumbled across something that might relate to this problem: Only now I realized that I might have a config problem. I am confused by the documentation: https://motion-project.github.io/motion_config.html#pre_capture Until now I thought that “pre_capture” and “post_capture” were identical. In other words, it must be specified in “fps”. So if I have a camera with 20fps and I want 3s I have to set the value to 60. But if I understand the documentation correctly, “post_capture” is specified in seconds and not in fps. Is that correct?