seydx / homebridge-camera-ui

Homebridge plugin for RTSP Cameras with HSV, motion detection support, Image Rekognition, Web UI to manage/watch streams and WebApp support
MIT License
649 stars 92 forks source link

Recording work intermittently even though there is motion on the screen #569

Closed utezduyar closed 2 years ago

utezduyar commented 2 years ago

I have noticed that recording part of one camera becomes quite unreliable after a while that I have substantially less recordings even though there is movement in the screen. Live view works all the time and the only way to make things reliable again is to remove the camera from Home/camera.ui and re-add it.

Below I have an example from this morning where I was in front of the camera at 6:39 am and 6:46 am. Homekit has a recording for 6:46 but nothing for 6:39.

There are bunch of FFront: FFmpeg exited with code: null and signal: SIGKILL (Expected) logs when the motion is not triggered but I am not sure if this is something I should dig deep.

[31/05/2022, 04:00:00] [CameraUI] FFront: Sheduled restart of videoanalysis is executed...
[31/05/2022, 04:00:00] [CameraUI] FFront: Restart videoanalysis session..
[31/05/2022, 04:00:00] [CameraUI] FFront: FFmpeg videoanalysis process exited (expected)
[31/05/2022, 04:00:00] [CameraUI] FFront: Videoanalysis process closed
[31/05/2022, 04:00:14] [CameraUI] FFront: Incoming ping request for: rtsp://homekit:homekit@10.0.0.36/axis-media/media.amp?resolution=1920x1080&fps=10&videozstrength=20&videozgopmode=fixed&videokeyframeinterval=40 - Timeout: 1s
[31/05/2022, 04:00:14] [CameraUI] FFront: Pinging 10.0.0.36:80
[31/05/2022, 04:00:14] [CameraUI] FFront: Pinging 10.0.0.36:80 - successful
[31/05/2022, 04:00:14] [CameraUI] FFront: Start videoanalysis...
[31/05/2022, 04:00:14] [CameraUI] FFront: Videoanalysis command: /var/lib/homebridge/node_modules/.pnpm/ffmpeg-for-homebridge@0.0.9/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -loglevel error -i rtsp://homekit:homekit@10.0.0.36/axis-media/media.amp?resolution=640x480&fps=5&videozstrength=20&videozgopmode=fixed&videokeyframeinterval=20 -an -vcodec pam -pix_fmt rgb24 -f image2pipe -vf fps=2,scale=640:360 pipe:1
[31/05/2022, 04:00:14] [CameraUI] FFront: Videoanalysis: Difference: 5 - Sensitivity: 75 - Zones: [{"name":"region0","difference":5,"percent":25,"polygon":[{"x":0,"y":360},{"x":0,"y":0},{"x":640,"y":0},{"x":640,"y":360}]}]
[31/05/2022, 04:00:14] [CameraUI] FFront: Videoanalysis scheduled for restart at 4AM: 1440 minutes
[31/05/2022, 06:39:53] [CameraUI] FFront: Snapshot requested: 1280 x 720
[31/05/2022, 06:39:53] [CameraUI] FFront: Snapshot command: /var/lib/homebridge/node_modules/.pnpm/ffmpeg-for-homebridge@0.0.9/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -loglevel error -analyzeduration 0 -probesize 691652 -f mpegts -i tcp://127.0.0.1:17185 -frames:v 1 -f image2 -
[31/05/2022, 06:39:53] [CameraUI] FFront: Prebuffer request ended
[31/05/2022, 06:39:53] [CameraUI] FFront: Fetching snapshot took 0.971 seconds.
[31/05/2022, 06:39:53] [CameraUI] FFront: Sending snapshot: 1280x720
[31/05/2022, 06:39:53] [CameraUI] FFront: Resize command: /var/lib/homebridge/node_modules/.pnpm/ffmpeg-for-homebridge@0.0.9/node_modules/ffmpeg-for-homebridge/ffmpeg -i pipe: -frames:v 1 -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease -f image2 -
[31/05/2022, 06:39:55] [CameraUI] FFront: Start stream requested: 1280x720, 30 fps, 299 kbps
[31/05/2022, 06:39:55] [CameraUI] FFront: Incoming ping request for: rtsp://homekit:homekit@10.0.0.36/axis-media/media.amp?resolution=1920x1080&fps=10&videozstrength=20&videozgopmode=fixed&videokeyframeinterval=40 - Timeout: 1s
[31/05/2022, 06:39:55] [CameraUI] FFront: Pinging 10.0.0.36:80
[31/05/2022, 06:39:55] [CameraUI] FFront: Pinging 10.0.0.36:80 - successful
[31/05/2022, 06:39:55] [CameraUI] FFront: Setting prebuffer stream as input
[31/05/2022, 06:39:55] [CameraUI] FFront: Starting video stream: native
[31/05/2022, 06:39:55] [CameraUI] FFront: Stream command: /var/lib/homebridge/node_modules/.pnpm/ffmpeg-for-homebridge@0.0.9/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -analyzeduration 0 -probesize 500000 -f mpegts -i tcp://127.0.0.1:26312 -an -sn -dn -vcodec copy -pix_fmt yuv420p -color_range mpeg -f rawvideo -payload_type 99 -ssrc 12325877 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params G0gCfeg/TsRTbHHf25QyaMNZtyjkF+/eW0TIGlg/ srtp://10.0.0.17:61824?rtcpport=61824&pkt_size=1318 -progress pipe:1
[31/05/2022, 06:39:56] [CameraUI] FFront: Getting the first frames took 1.537 seconds.
[31/05/2022, 06:40:04] [CameraUI] FFront: Reconfigure stream requested: 640x360, 30 fps, 132 kbps (Ignored)
[31/05/2022, 06:40:06] [CameraUI] FFront: Stop stream requested
[31/05/2022, 06:40:06] [CameraUI] FFront: Stopped video stream.
[31/05/2022, 06:40:06] [CameraUI] FFront: Prebuffer request ended
[31/05/2022, 06:40:06] [CameraUI] FFront: FFmpeg exited with code: null and signal: SIGKILL (Expected)
[31/05/2022, 06:40:14] [CameraUI] FFront: Start stream requested: 1280x720, 30 fps, 299 kbps
[31/05/2022, 06:40:14] [CameraUI] FFront: Incoming ping request for: rtsp://homekit:homekit@10.0.0.36/axis-media/media.amp?resolution=1920x1080&fps=10&videozstrength=20&videozgopmode=fixed&videokeyframeinterval=40 - Timeout: 1s
[31/05/2022, 06:40:14] [CameraUI] FFront: Pinging 10.0.0.36:80
[31/05/2022, 06:40:14] [CameraUI] FFront: Pinging 10.0.0.36:80 - successful
[31/05/2022, 06:40:14] [CameraUI] FFront: Setting prebuffer stream as input
[31/05/2022, 06:40:14] [CameraUI] FFront: Starting video stream: native
[31/05/2022, 06:40:14] [CameraUI] FFront: Stream command: /var/lib/homebridge/node_modules/.pnpm/ffmpeg-for-homebridge@0.0.9/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -analyzeduration 0 -probesize 500000 -f mpegts -i tcp://127.0.0.1:38549 -an -sn -dn -vcodec copy -pix_fmt yuv420p -color_range mpeg -f rawvideo -payload_type 99 -ssrc 6732251 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params tHTNc9HF0qid1OBTtQd/zeXa3QVuQvDe+7IGwFpj srtp://10.0.0.10:57314?rtcpport=57314&pkt_size=1318 -progress pipe:1
[31/05/2022, 06:40:16] [CameraUI] FFront: Getting the first frames took 1.661 seconds.
[31/05/2022, 06:40:17] [CameraUI] FFront: Stop stream requested
[31/05/2022, 06:40:17] [CameraUI] FFront: Stopped video stream.
[31/05/2022, 06:40:17] [CameraUI] FFront: Prebuffer request ended
[31/05/2022, 06:40:17] [CameraUI] FFront: FFmpeg exited with code: null and signal: SIGKILL (Expected)
[31/05/2022, 06:40:25] [CameraUI] FFront: Start stream requested: 1280x720, 30 fps, 299 kbps
[31/05/2022, 06:40:25] [CameraUI] FFront: Incoming ping request for: rtsp://homekit:homekit@10.0.0.36/axis-media/media.amp?resolution=1920x1080&fps=10&videozstrength=20&videozgopmode=fixed&videokeyframeinterval=40 - Timeout: 1s
[31/05/2022, 06:40:25] [CameraUI] FFront: Pinging 10.0.0.36:80
[31/05/2022, 06:40:25] [CameraUI] FFront: Pinging 10.0.0.36:80 - successful
[31/05/2022, 06:40:25] [CameraUI] FFront: Setting prebuffer stream as input
[31/05/2022, 06:40:25] [CameraUI] FFront: Starting video stream: native
[31/05/2022, 06:40:25] [CameraUI] FFront: Stream command: /var/lib/homebridge/node_modules/.pnpm/ffmpeg-for-homebridge@0.0.9/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -analyzeduration 0 -probesize 703308 -f mpegts -i tcp://127.0.0.1:19513 -an -sn -dn -vcodec copy -pix_fmt yuv420p -color_range mpeg -f rawvideo -payload_type 99 -ssrc 7463367 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params n5wGQl1jeYW1D8sMewRWOM39WXnGRGUCAeAt9Lm4 srtp://10.0.0.10:58006?rtcpport=58006&pkt_size=1318 -progress pipe:1
[31/05/2022, 06:40:25] [CameraUI] FFront: Getting the first frames took 0.424 seconds.
[31/05/2022, 06:40:30] [CameraUI] FFront: Reconfigure stream requested: 640x360, 30 fps, 132 kbps (Ignored)
[31/05/2022, 06:40:55] [CameraUI] FFront: Stop stream requested
[31/05/2022, 06:40:55] [CameraUI] FFront: Stopped video stream.
[31/05/2022, 06:40:55] [CameraUI] FFront: Prebuffer request ended
[31/05/2022, 06:40:55] [CameraUI] FFront: FFmpeg exited with code: null and signal: SIGKILL (Expected)
[31/05/2022, 06:40:58] [CameraUI] FFront: Start stream requested: 1280x720, 30 fps, 299 kbps
[31/05/2022, 06:40:58] [CameraUI] FFront: Incoming ping request for: rtsp://homekit:homekit@10.0.0.36/axis-media/media.amp?resolution=1920x1080&fps=10&videozstrength=20&videozgopmode=fixed&videokeyframeinterval=40 - Timeout: 1s
[31/05/2022, 06:40:58] [CameraUI] FFront: Pinging 10.0.0.36:80
[31/05/2022, 06:40:58] [CameraUI] FFront: Pinging 10.0.0.36:80 - successful
[31/05/2022, 06:40:58] [CameraUI] FFront: Setting prebuffer stream as input
[31/05/2022, 06:40:58] [CameraUI] FFront: Starting video stream: native
[31/05/2022, 06:40:58] [CameraUI] FFront: Stream command: /var/lib/homebridge/node_modules/.pnpm/ffmpeg-for-homebridge@0.0.9/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -analyzeduration 0 -probesize 500000 -f mpegts -i tcp://127.0.0.1:31346 -an -sn -dn -vcodec copy -pix_fmt yuv420p -color_range mpeg -f rawvideo -payload_type 99 -ssrc 11748394 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params +pp/+IZ70cKLwW7/XYPMHXVx9h+2oYzma6IAibhO srtp://10.0.0.10:52322?rtcpport=52322&pkt_size=1318 -progress pipe:1
[31/05/2022, 06:41:00] [CameraUI] FFront: Getting the first frames took 2.115 seconds.
[31/05/2022, 06:41:04] [CameraUI] FFront: Stop stream requested
[31/05/2022, 06:41:04] [CameraUI] FFront: Stopped video stream.
[31/05/2022, 06:41:04] [CameraUI] FFront: Prebuffer request ended
[31/05/2022, 06:41:04] [CameraUI] FFront: FFmpeg exited with code: null and signal: SIGKILL (Expected)
[31/05/2022, 06:45:59] [CameraUI] VIDEOANALYSIS: New message: Data: [{"zone":"region0","percent":25.14105987548828,"sensitivity":76,"dwell":60,"forceClose":3}] - Motion: detected - Camera: FFront
[31/05/2022, 06:45:59] [CameraUI] FFront: {"error":false,"message":"Handling through extern controller.."}
[31/05/2022, 06:45:59] [CameraUI] FFront: Motion ON
[31/05/2022, 06:46:00] [CameraUI] FFront: Video fragments requested from HSV
[31/05/2022, 06:46:00] [CameraUI] FFront: Setting prebuffer stream as input
[31/05/2022, 06:46:00] [CameraUI] FFront: Prebuffer requested with a duration of -4s
[31/05/2022, 06:46:00] [CameraUI] FFront: Start recording...
[31/05/2022, 06:46:00] [CameraUI] FFront: Recording command: /var/lib/homebridge/node_modules/.pnpm/ffmpeg-for-homebridge@0.0.9/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -analyzeduration 0 -probesize 886332 -f mp4 -i tcp://127.0.0.1:19101 -f mp4 -vcodec copy -an -movflags frag_keyframe+empty_moov+default_base_moof -max_muxing_queue_size 1024 tcp://127.0.0.1:15494
[31/05/2022, 06:46:00] [CameraUI] FFront: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tcp://127.0.0.1:19101':
[31/05/2022, 06:46:00] [CameraUI] FFront:   Metadata:
[31/05/2022, 06:46:00] [CameraUI] FFront:     major_brand     : iso5
[31/05/2022, 06:46:00] [CameraUI] FFront:     minor_version   : 512
[31/05/2022, 06:46:00] [CameraUI] FFront:     compatible_brands: iso5iso6mp41
[31/05/2022, 06:46:00] [CameraUI] FFront:     title           : Session streamed with GStreamer
[31/05/2022, 06:46:00] [CameraUI] FFront:     encoder         : Lavf59.16.100
[31/05/2022, 06:46:00] [CameraUI] FFront:     comment         : rtsp-server
[31/05/2022, 06:46:00] [CameraUI] FFront:   Duration: 04:45:48.00, start: 17144.000000, bitrate: N/A
[31/05/2022, 06:46:00] [CameraUI] FFront:   Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, 0 kb/s, 10 fps, 10 tbr, 10240 tbn (default)
[31/05/2022, 06:46:00] [CameraUI] FFront:     Metadata:
[31/05/2022, 06:46:00] [CameraUI] FFront:       handler_name    : VideoHandler
[31/05/2022, 06:46:00] [CameraUI] FFront:       vendor_id       : [0][0][0][0]
[31/05/2022, 06:46:00] [CameraUI] FFront: Output #0, mp4, to 'tcp://127.0.0.1:15494':
[31/05/2022, 06:46:00] [CameraUI] FFront:   Metadata:
[31/05/2022, 06:46:00] [CameraUI] FFront:     major_brand     : iso5
[31/05/2022, 06:46:00] [CameraUI] FFront:     minor_version   : 512
[31/05/2022, 06:46:00] [CameraUI] FFront:     compatible_brands: iso5iso6mp41
[31/05/2022, 06:46:00] [CameraUI] FFront:     title           : Session streamed with GStreamer
[31/05/2022, 06:46:00] [CameraUI] FFront:     comment         : rtsp-server
[31/05/2022, 06:46:00] [CameraUI] FFront:     encoder         : Lavf59.16.100
[31/05/2022, 06:46:00] [CameraUI] FFront:   Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, q=2-31, 0 kb/s, 10 fps, 10 tbr, 10240 tbn (default)
[31/05/2022, 06:46:00] [CameraUI] FFront:     Metadata:
[31/05/2022, 06:46:00] [CameraUI] FFront:       handler_name    : VideoHandler
[31/05/2022, 06:46:00] [CameraUI] FFront:       vendor_id       : [0][0][0][0]
[31/05/2022, 06:46:00] [CameraUI] FFront: Stream mapping:
[31/05/2022, 06:46:00] [CameraUI] FFront:   Stream #0:0 -> #0:0 (copy)
[31/05/2022, 06:46:00] [CameraUI] FFront: Press [q] to stop, [?] for help
[31/05/2022, 06:46:00] [CameraUI] FFront: frame=    1 fps=0.0 q=-1.0 size=       1kB time=00:00:00.00 bitrate=72979.6kbits/s speed=  49x    
[31/05/2022, 06:46:00] [CameraUI] FFront: Recording started
[31/05/2022, 06:46:04] [CameraUI] FFront: frame=   82 fps= 21 q=-1.0 size=    1576kB time=00:00:08.10 bitrate=1594.1kbits/s speed=2.09x    
[31/05/2022, 06:46:08] [CameraUI] FFront: frame=  122 fps= 15 q=-1.0 size=    2008kB time=00:00:12.10 bitrate=1359.3kbits/s speed=1.53x    
[31/05/2022, 06:46:12] [CameraUI] FFront: frame=  162 fps= 14 q=-1.0 size=    2378kB time=00:00:16.10 bitrate=1209.8kbits/s speed=1.36x    
[31/05/2022, 06:46:14] [CameraUI] FFront: Motion OFF - Motion handler timeout.
[31/05/2022, 06:46:16] [CameraUI] FFront: Recording completed (HSV)
[31/05/2022, 06:46:16] [CameraUI] FFront: New HSV alert
[31/05/2022, 06:46:16] [CameraUI] FFront: frame=  202 fps= 13 q=-1.0 size=    2736kB time=00:00:20.10 bitrate=1115.1kbits/s speed=1.27x    
[31/05/2022, 06:46:16] [CameraUI] FFront: Notifications not enabled, skip MQTT (notification)..
[31/05/2022, 06:46:16] [CameraUI] FFront: Notifications not enabled, skip Webhook..
[31/05/2022, 06:46:16] [CameraUI] FFront: Notifications not enabled, skip Webpush..
[31/05/2022, 06:46:16] [CameraUI] FFront: Notifications not enabled, skip Alexa..
[31/05/2022, 06:46:16] [CameraUI] FFront: Recording not enabled, skip recording..
[31/05/2022, 06:46:16] [CameraUI] FFront: Recording skipped. Notification skipped.
[31/05/2022, 06:46:16] [CameraUI] FFront: Closing recording process
[31/05/2022, 06:46:16] [CameraUI] FFront: Prebuffer request ended
[31/05/2022, 06:46:16] [CameraUI] FFront: FFmpeg recording process exited (expected)
[31/05/2022, 06:46:59] [CameraUI] VIDEOANALYSIS: New message: Data: {"time":"2022-05-31T04:46:59.963Z","event":"dwellTime (60s)"} - Motion: resetted - Camera: FFront
[31/05/2022, 06:46:59] [CameraUI] FFront: {"error":false,"message":"Handling through extern controller.."}
{
    "name": "FFront",
    "manufacturer": "Axis",
    "model": "P3245",
    "motion": true,
    "motionTimeout": 15,
    "unbridge": true,
    "hsv": true,
    "prebuffering": true,
    "prebufferLength": 4,
    "videoConfig": {
        "source": "-i rtsp://homekit:homekit@10.0.0.36/axis-media/media.amp?resolution=1920x1080&fps=10&videozstrength=20&videozgopmode=fixed&videokeyframeinterval=40",
        "subSource": "-i rtsp://homekit:homekit@10.0.0.36/axis-media/media.amp?resolution=640x480&fps=5&videozstrength=20&videozgopmode=fixed&videokeyframeinterval=20",
        "vcodec": "copy",
        "acodec": "libfdk_aac",
        "audio": false,
        "stillImageSource": "-i rtsp://homekit:homekit@10.0.0.36/axis-media/media.amp?resolution=1920x1080&fps=10&videozstrength=20&videozgopmode=fixed&videokeyframeinterval=40"
    },
    "smtp": {
        "email": "FFront"
    },
    "videoanalysis": {
        "active": true
    },
    "mqtt": {}
}

Environment I am running pi image of homekit from couple of days ago.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.