Motion-Project / motion

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

motion_watchdog: Thread 1 - Watchdog timeout did NOT restart, killing it! #780

Closed fehlfarbe closed 6 years ago

fehlfarbe commented 6 years ago
  1. Reviewed guide and contributing documents? Yes
  2. version motion: 4.1.1+git20180805-0572a64
  3. installed as a package or compiled from sources: git
  4. standalone or part of third party: motion
  5. video stream source: rtsp, h264, 1080p
  6. hardware: ARM, Raspberry Pi 2
  7. operating system: Raspbian Stretch Lite, 4.14.61-v7+

FFMpeg version: ffmpeg version git-2018-08-08-90dc584, built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516 configuration: --arch=armel --target-os=linux --enable-gpl --enable-mmal --enable-omx --enable-omx-rpi --enable-nonfree

I want to detect motion with an RTSP IP-camera. I can decode and encode the video stream with ffmpeg and mmal/omx hardware acceleration but motion always crashs/freezes, when it detects motion:

[0:motion] [NTC] [ALL] conf_load: Processing thread 0 - config file /home/pi/motion.conf
[0:motion] [NTC] [ALL] motion_startup: Logging to syslog
[0:motion] [NTC] [ALL] motion_startup: Motion 4.1.1+git20180805-0572a64 Started
[0:motion] [NTC] [ALL] motion_startup: Using log type (ALL) log level (ALL)
[0:motion] [INF] [ALL] conf_output_parms: Writing configuration parameters from all files (1):
[0:motion] [INF] [ALL] Thread 0 - Config file: /home/pi/motion.conf
[0:motion] [INF] [ALL] daemon                    off
[0:motion] [INF] [ALL] process_id_file           /var/run/motion/motion.pid
[0:motion] [INF] [ALL] setup_mode                off
[0:motion] [INF] [ALL] logfile                   
[0:motion] [INF] [ALL] log_level                 9
[0:motion] [INF] [ALL] log_type                  all
[0:motion] [INF] [ALL] native_language           on
[0:motion] [INF] [ALL] camera_id                 0
[0:motion] [INF] [ALL] camera_name               
[0:motion] [INF] [ALL] videodevice               /dev/video0
[0:motion] [INF] [ALL] vid_control_params        
[0:motion] [INF] [ALL] v4l2_palette              17
[0:motion] [INF] [ALL] input                     -1
[0:motion] [INF] [ALL] norm                      0
[0:motion] [INF] [ALL] frequency                 0
[0:motion] [INF] [ALL] auto_brightness           0
[0:motion] [INF] [ALL] tunerdevice               
[0:motion] [INF] [ALL] roundrobin_frames         1
[0:motion] [INF] [ALL] roundrobin_skip           1
[0:motion] [INF] [ALL] switchfilter              off
[0:motion] [INF] [ALL] netcam_url                <redacted>
[0:motion] [INF] [ALL] netcam_highres            
[0:motion] [INF] [ALL] netcam_userpass           
[0:motion] [INF] [ALL] netcam_keepalive          on
[0:motion] [INF] [ALL] netcam_proxy              
[0:motion] [INF] [ALL] netcam_tolerant_check     off
[0:motion] [INF] [ALL] rtsp_uses_tcp             on
[0:motion] [INF] [ALL] mmalcam_name              
[0:motion] [INF] [ALL] mmalcam_control_params    
[0:motion] [INF] [ALL] rotate                    0
[0:motion] [INF] [ALL] width                     1920
[0:motion] [INF] [ALL] height                    1080
[0:motion] [INF] [ALL] framerate                 10
[0:motion] [INF] [ALL] minimum_frame_time        0
[0:motion] [INF] [ALL] despeckle_filter          
[0:motion] [INF] [ALL] locate_motion_mode        on
[0:motion] [INF] [ALL] locate_motion_style       box
[0:motion] [INF] [ALL] text_right                %Y-%m-%d\n%T-%q
[0:motion] [INF] [ALL] text_left                 
[0:motion] [INF] [ALL] text_changes              off
[0:motion] [INF] [ALL] text_event                %Y%m%d%H%M%S
[0:motion] [INF] [ALL] text_scale                1
[0:motion] [INF] [ALL] flip_axis                 none
[0:motion] [INF] [ALL] emulate_motion            off
[0:motion] [INF] [ALL] threshold                 3500
[0:motion] [INF] [ALL] threshold_tune            off
[0:motion] [INF] [ALL] noise_level               64
[0:motion] [INF] [ALL] noise_tune                on
[0:motion] [INF] [ALL] area_detect               
[0:motion] [INF] [ALL] mask_file                 /home/pi/allsky/mask1920.pgm
[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                 60
[0:motion] [INF] [ALL] pre_capture               1
[0:motion] [INF] [ALL] post_capture              20
[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_motion_detected        
[0:motion] [INF] [ALL] on_area_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] quiet                     on
[0:motion] [INF] [ALL] target_dir                
[0:motion] [INF] [ALL] output_pictures           first
[0:motion] [INF] [ALL] output_debug_pictures     off
[0:motion] [INF] [ALL] quality                   90
[0:motion] [INF] [ALL] picture_type              jpeg
[0:motion] [INF] [ALL] snapshot_interval         60
[0:motion] [INF] [ALL] snapshot_filename         allsky/%Y-%m-%d/%Y-%m-%d_%H-%M-%S-snapshot
[0:motion] [INF] [ALL] picture_filename          allsky/%Y-%m-%d/%Y-%m-%d_%H-%M-%S-%q
[0:motion] [INF] [ALL] exif_text                 
[0:motion] [INF] [ALL] ffmpeg_output_movies      on
[0:motion] [INF] [ALL] ffmpeg_output_debug_movies on
[0:motion] [INF] [ALL] max_movie_time            20
[0:motion] [INF] [ALL] ffmpeg_bps                400000
[0:motion] [INF] [ALL] ffmpeg_variable_bitrate   0
[0:motion] [INF] [ALL] ffmpeg_video_codec        mkv
[0:motion] [INF] [ALL] ffmpeg_duplicate_frames   off
[0:motion] [INF] [ALL] movie_filename            allsky/%Y-%m-%d/%Y-%m-%d_%H-%M-%S
[0:motion] [INF] [ALL] timelapse_interval        60
[0:motion] [INF] [ALL] timelapse_mode            daily
[0:motion] [INF] [ALL] timelapse_codec           mpeg4
[0:motion] [INF] [ALL] timelapse_fps             30
[0:motion] [INF] [ALL] timelapse_filename        allsky/%Y%m%d-timelapse
[0:motion] [INF] [ALL] ffmpeg_passthrough        off
[0:motion] [INF] [ALL] video_pipe                
[0:motion] [INF] [ALL] motion_video_pipe         
[0:motion] [INF] [ALL] use_extpipe               off
[0:motion] [INF] [ALL] extpipe                   ffmpeg -y -f rawvideo -pix_fmt yuv420p -video_size %wx%h -framerate %fps -i pipe:0 -vcodec h264_omx -b:v 3500k -f mp4 %f_omx.mp4
[0:motion] [INF] [ALL] ipv6_enabled              off
[0:motion] [INF] [ALL] stream_port               0
[0:motion] [INF] [ALL] substream_port            0
[0:motion] [INF] [ALL] stream_quality            50
[0:motion] [INF] [ALL] stream_motion             off
[0:motion] [INF] [ALL] stream_maxrate            1
[0:motion] [INF] [ALL] stream_localhost          on
[0:motion] [INF] [ALL] stream_limit              0
[0:motion] [INF] [ALL] stream_auth_method        0
[0:motion] [INF] [ALL] stream_cors_header        
[0:motion] [INF] [ALL] stream_authentication     
[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_grey               off
[0:motion] [INF] [ALL] stream_tls                off
[0:motion] [INF] [ALL] webcontrol_port           0
[0:motion] [INF] [ALL] webcontrol_localhost      on
[0:motion] [INF] [ALL] webcontrol_interface      0
[0:motion] [INF] [ALL] webcontrol_parms          0
[0:motion] [INF] [ALL] webcontrol_auth_method    0
[0:motion] [INF] [ALL] webcontrol_authentication 
[0:motion] [INF] [ALL] webcontrol_cors_header    
[0:motion] [INF] [ALL] webcontrol_tls            off
[0:motion] [INF] [ALL] webcontrol_key            
[0:motion] [INF] [ALL] webcontrol_cert           
[0:motion] [INF] [ALL] sql_log_picture           on
[0:motion] [INF] [ALL] sql_log_snapshot          on
[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] database_type             
[0:motion] [INF] [ALL] database_dbname           
[0:motion] [INF] [ALL] database_host             localhost
[0:motion] [INF] [ALL] database_user             
[0:motion] [INF] [ALL] database_password         
[0:motion] [INF] [ALL] database_port             0
[0:motion] [INF] [ALL] database_busy_timeout     0
[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] [VID] bktr_mutex_init: BKTR is not enabled.
[0:motion] [NTC] [ENC] ffmpeg_global_init: ffmpeg libavcodec version 58.22.101 libavformat version 58.17.101
[0:motion] [DBG] [DBL] dbse_global_init: Initializing database
[0:motion] [NTC] [ALL] translate_locale_chg: No native language support
[0:motion] [NTC] [ALL] motion_start_thread: Camera ID: 0 is from /home/pi/motion.conf
[0:motion] [NTC] [ALL] motion_start_thread: Camera ID: 0 Camera Name: (null) Service: rtsp:
[0:motion] [NTC] [ALL] motion_start_thread: Stream port 0
[0:motion] [NTC] [ALL] main: Waiting for threads to finish, pid: 757
[1:ml1] [NTC] [ALL] motion_init: Camera 0 started: motion detection Enabled
[1:ml1] [NTC] [VID] vid_start: Opening Netcam RTSP
[1:ml1] [INF] [NET] netcam_rtsp_set_parms: Setting up Normal resolution stream.
[1:ml1] [INF] [NET] netcam_rtsp_set_path: Setting up rtsp via ffmpeg netcam
[1:ml1] [INF] [NET] netcam_rtsp_set_rtsp: Normal resolution: Setting rtsp transport to tcp
[1:ml1] [INF] [NET] netcam_rtsp_open_context: Normal resolution: Opened camera((null))
[1:ml1] [INF] [ENC] ffmpeg_avcodec_log: deprecated pixel format used, make sure you did set range correctly
[1:ml1] [DBG] [NET] netcam_check_buffsize: expanding buffer from [0/0] to [0/3112960] bytes.
[1:ml1] [DBG] [NET] Above message repeats 1 times
[1:ml1] [DBG] [NET] netcam_check_buffsize: expanding buffer from [3110400/3112960] to [3110400/6221824] bytes.
[1:ml1] [NTC] [NET] netcam_rtsp_connect: Normal resolution: Camera ((null)) connected
[1:ml1] [DBG] [NET] netcam_check_buffsize: expanding buffer from [3110400/3112960] to [3110400/6221824] bytes.
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items
[2:nc2] [NTC] [NET] netcam_rtsp_handler: Normal resolution: Camera handler thread [2] started
[2:nc2] [INF] [NET] netcam_rtsp_open_context: Normal resolution: Opened camera((null))
[2:nc2] [INF] [ENC] ffmpeg_avcodec_log: deprecated pixel format used, make sure you did set range correctly
[2:nc2] [NTC] [NET] netcam_rtsp_connect: Normal resolution: Camera ((null)) connected
[1:ml1] [INF] [ALL] motion_init: Maskfile "/home/pi/allsky/mask1920.pgm" loaded.
[1:ml1] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 2 items
[1:ml1] [INF] [EVT] event_new_video: Source FPS 8
[1:ml1] [INF] [ENC] ffmpeg_set_quality: h264_omx codec vbr/crf/bit_rate: 5832000
[1:ml1] [NTC] [EVT] event_newfile: File of type 8 saved to: ./allsky/2018-08-10/2018-08-10_11-52-39.mkv
[1:ml1] [INF] [ENC] ffmpeg_set_quality: h264_omx codec vbr/crf/bit_rate: 5832000
[1:ml1] [NTC] [ALL] motion_detected: Motion detected - starting event 1
[0:motion] [ERR] [ALL] motion_watchdog: Thread 1 - Watchdog timeout. Trying to do a graceful restart
[0:motion] [ERR] [ALL] motion_watchdog: Thread 1 - Watchdog timeout did NOT restart, killing it!
[0:motion] [DBG] [ALL] motion_watchdog: Thread 1 - Cleaning thread.
genius3000 commented 6 years ago

I'd guess you're seeing a similar/same issue as #433 (using the h264_omx encoder on RPi). I believe @jasaw has a work-around listed in there for ffmpeg.

fehlfarbe commented 6 years ago

Thanks! I switched to extpipe which is working :+1:

Mr-Dave commented 6 years ago

Although it works with extpipe, can you try the previous method with camera dimensions that are multiples of 16 and indicate whether it still hangs?

I would like to put in some edits / log messages to prevent Motion from going into a watchdog timeout and need to know whether camera dimensions that are multiples of 16 are OK.

fehlfarbe commented 6 years ago

I changed the camera resolution to 1280x720 and capture is working now but has some color problems (tried mkv and mp4 container): vlcsnap-00001