blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
18.46k stars 1.68k forks source link

[Camera Support]: Eufy 2C battery camera and stitching together of recordings #5779

Closed atv2016 closed 1 year ago

atv2016 commented 1 year ago

Describe the problem you are having

Resulting from a previous ticket: Frigate shows "discarding corrupt segments in logs" and combines multiple recordings in the same recording.

It seems this is happening (in my view at least) that Frigate keeps on saying in progress for the object for a long time, longer after the eufy camera stopped recording. Because of this I see multiple detections from the Eufy camera in the same frigate recording as well (even though the eufy camera itself was not recording anymore, and the times in frigate are wildly off (3h recordings, and it orders them in the wrong way (i guess because it has different eufy recordings in the same frigate recording). Screenshot 2023-03-20 at 13 23 27

Maybe the eufy is not sending a stream stop properly or something, i dunno. But if it really was on all the time it would be out of battery :-). Also, the frigate recordings clearly show it is stitching them together, and possibly corrupting them for some reason.

I'm exploring the option in the Eufy app to set the recording to 20seconds max or so.

But i think this is at least why we are seeing the "discarding corrupt segments" in the frigate log files for Eufy camera's, possibly other battery based cams as well. At first i thought i missed recordings, but they all seem to be bunched up in a single (seemingly 3h) long recording.

If the option in the app does not fix it, maybe there's the possibility of adding a max object/in progress time for battery powered cameras? I know eufy's implementation of RTSP is buggy junk, but i have seen this on other battery camera's as well so it's seems a 'thing'.

Thanks!

Version

Beta-9

Frigate config file

mqtt:

  host: 192.168.50.148
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: mqtt
  password: **
  stats_interval: 300

record:
  expire_interval: 10

timestamp_style:
  format: "%m/%d/%Y %H:%M:%S"
  color:
    red: 255
    green: 255
    blue: 255
  thickness: 2
  effect: shadow

logger:
  default: info
  logs:
    ffmpeg.kitchen_back_door.detect: critical
    watchdog.kitchen_back_door: critical
    detector.kitchen_back_door: critical

    ffmpeg.backyard.detect: critical
    watchdog.backyard: critical
    detector.backyard: critical
#
#    ffmpeg.backyard_camera.detect: critical
#    watchdog.backyard_camera: critical
#    detector.backyard_camera: critical
#
    frigate.video: critical

go2rtc:
  streams:
    license_plate:
      - rtsp://192.168.50.15:554/user=admin&password=**&channel=5&stream=0.sdp?real_stream--rtp-caching=100
    #  - "ffmpeg:license_plate#audio=opus"
    greenhouse_2:
      - rtsp://192.168.50.170:554/user=admin&password=**&channel=3&stream=0.sdp?real_stream--rtp-caching=100
    #  - "ffmpeg:greenhouse_2#audio=opus"
    front_driveway_1:
      - rtsp://192.168.50.15:554/user=admin&password=**&channel=6&stream=0.sdp?real_stream--rtp-caching=100
    #  - "ffmpeg:front_driveway_1#audio=opus"
    front_driveway_2:
      - rtsp://192.168.50.15:554/user=admin&password=**&channel=8&stream=0.sdp?real_stream--rtp-caching=100
    #  - "ffmpeg:front_driveway_2#audio=opus"
    front_porch:
      - rtsp://192.168.50.15:554/user=admin&password=**&channel=7&stream=0.sdp?real_stream--rtp-caching=100
    #  - "ffmpeg:front_porch#audio=opus"
    back_porch:
      - rtsp://192.168.50.15:554/user=admin&password=**&channel=1&stream=0.sdp?real_stream--rtp-caching=100
    #  - "ffmpeg:back_porch#audio=opus"
    diningroom:
      - rtsp://Admin1:**@192.168.50.227/live0
    # - ffmpeg:diningroom
    #  - "ffmpeg:diningroom#audio=opus"
    kitchen:
      - rtsp://192.168.50.70/live0
    # - ffmpeg:kitchen
    #  - "ffmpeg:kitchen#audio=opus"
    garage:
      - rtsp://192.168.50.15:554/user=admin&password=**&channel=2&stream=0.sdp?real_stream--rtp-caching=100
    #  - "ffmpeg:garage#audio=opus"
    greenhouse:
      - rtsp://192.168.50.15:554/user=admin&password=**&channel=3&stream=0.sdp?real_stream--rtp-caching=100
    #  -  "ffmpeg:greenhouse#audio=opus"
    kitchen_back_door:
      - rtsp://192.168.50.48/live2
      #- "ffmpeg:kitchen_back_door#audio=aac"
    backyard:
      - rtsp://192.168.50.48/live1
      #- "ffmpeg:backyard#audio=aac"

cameras:
  backyard:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264 
      output_args:
        record: preset-record-generic-audio-aac
      inputs:
        - path: rtsp://127.0.0.1:8554/backyard
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
      stationary:
        max_frames:
          objects:
            person: 100
    objects:
      track:
        - person
        - dog
        - cat
      filters:
        person:
          min_area: 500
          min_score: 0.6
          threshold: 0.7
  #    mask:
  #      - 0,480,198,480,200,449,0,451
  #      - 640,0,640,36,640,111,608,135,485,96,504,0
  #      - 439,200,441,324,512,320,532,261,554,188,540,129,451,134
  #      - 370,0,356,100,291,79,292,0
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: false
      crop: True
      height: 500
#      required_zones:
#        - front_porch_close_in
      retain:
        default: 5
    motion:
      mask:
        - 1211,102,1682,101,1679,62,1211,64
    #zones:
    #  front_porch_close_in:
    #    coordinates: 45,480,362,480,640,480,640,213,554,145,525,328,466,343,408,272,348,70,253,64,181,118,67,178
    record:
      enabled: True
      retain:
        days: 0
        mode: active_objects
      events:
        retain:
          default: 4
          mode: active_objects
#        required_zones:
#         - front_porch_close_in
        pre_capture: 5
        post_capture: 15

  kitchen_back_door:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264 
      output_args:
        record: preset-record-generic-audio-aac
      inputs:
        - path: rtsp://127.0.0.1:8554/kitchen_back_door
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
      stationary:
        max_frames:
          objects:
            person: 100
    objects:
      track:
        - person
        - dog
        - bicycle
        - cat
      filters:
        person:
          min_area: 500
          min_score: 0.6
          threshold: 0.7
  #    mask:
  #      - 0,480,198,480,200,449,0,451
  #      - 640,0,640,36,640,111,608,135,485,96,504,0
  #      - 439,200,441,324,512,320,532,261,554,188,540,129,451,134
  #      - 370,0,356,100,291,79,292,0
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: false
      crop: True
      height: 500
#      required_zones:
#        - front_porch_close_in
      retain:
        default: 5
    motion:
      mask:
        - 1211,102,1682,101,1679,62,1211,64
    #zones:
    #  front_porch_close_in:
    #    coordinates: 45,480,362,480,640,480,640,213,554,145,525,328,466,343,408,272,348,70,253,64,181,118,67,178
    record:
      enabled: True
      retain:
        days: 0
        mode: active_objects
      events:
        retain:
          default: 4
          mode: active_objects
#        required_zones:
#         - front_porch_close_in
        pre_capture: 5
        post_capture: 15

  license_plate:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/license_plate
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    objects:
      track:
        - person
        - dog
        - cat
        - mouse
        - car
      filters:
        car:
          min_area: 15000
        person:
          min_area: 500
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
#      required_zones:
#        - front_driveway_1_close_in
#        - front_driveway_1_whole_area
      crop: True
      height: 500
      retain:
        default: 3
 #   zones:
 #     front_driveway_1_close_in:
 #       coordinates: 0,480,429,480,443,335,460,173,263,133,88,120,36,212,0,279
 #       objects:
 #         - car
 #         - person
 #         - dog
 #         - cat
 #         - bicycle
 #     front_driveway_1_whole_area:
 #       coordinates: 383,52,497,105,569,316,575,480,261,480,0,480,0,225,148,57
 #       objects:
 #         - person
 #         - cat
 #         - dog
 #         - bicycle
    motion:
      mask:
        - 1211,102,1682,101,1679,62,1211,64
    record:
      enabled: True
      retain:
        days: 0
      events:
        retain:
          default: 5
          mode: motion
#        required_zones:
#          - front_driveway_1_close_in
#          - front_driveway_1_whole_area
        pre_capture: 5
        post_capture: 15

  greenhouse_2:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/greenhouse_2
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    objects:
      track:
        - person
        - dog
        - cat
        - mouse
      filters:
        car:
          min_area: 15000
        person:
          min_area: 500
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
#      required_zones:
#        - front_driveway_1_close_in
#        - front_driveway_1_whole_area
      crop: True
      height: 500
      retain:
        default: 3
 #   zones:
 #     front_driveway_1_close_in:
 #       coordinates: 0,480,429,480,443,335,460,173,263,133,88,120,36,212,0,279
 #       objects:
 #         - car
 #         - person
 #         - dog
 #         - cat
 #         - bicycle
 #     front_driveway_1_whole_area:
 #       coordinates: 383,52,497,105,569,316,575,480,261,480,0,480,0,225,148,57
 #       objects:
 #         - person
 #         - cat
 #         - dog
 #         - bicycle
    motion:
      mask:
        - 1211,102,1682,101,1679,62,1211,64
    record:
      enabled: True
      retain:
        days: 0
      events:
        retain:
          default: 5
          mode: motion
#        required_zones:
#          - front_driveway_1_close_in
#          - front_driveway_1_whole_area
        pre_capture: 5
        post_capture: 15

  front_driveway_1:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/front_driveway_1
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    objects:
      track:
        - person
        - dog
        - bicycle
        - cat
        - car
      filters:
        car:
          min_area: 15000
        person:
          min_area: 500
          min_score: 0.6
          threshold: 0.7
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
#      required_zones:
#        - front_driveway_1_close_in
#        - front_driveway_1_whole_area
      crop: True
      height: 500
      retain:
        default: 3
    zones:
      front_driveway_1_person_at_night:
        coordinates: 739,1080,1920,1080,1920,384,1085,434
        objects:
          - car
          - person
          - dog
          - cat
          - bicycle
      front_driveway_1_driveway_only:
        coordinates: 814,1080,1920,1080,1920,536,1799,411,1091,444
        objects:
          - car
 #     front_driveway_1_whole_area:
 #       coordinates: 383,52,497,105,569,316,575,480,261,480,0,480,0,225,148,57
 #       objects:
 #         - person
 #         - cat
 #         - dog
 #         - bicycle
    motion:
      mask:
        - 1211,102,1682,101,1679,62,1211,64
    record:
      enabled: True
      retain:
        days: 0
      events:
        retain:
          default: 5
          mode: motion
#        required_zones:
#          - front_driveway_1_close_in
#          - front_driveway_1_whole_area
        pre_capture: 5
        post_capture: 15

  front_driveway_2:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/front_driveway_2
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    objects:
      track:
        - person
        - dog
        - bicycle
        - cat
        - car
      filters:
        car:
          min_area: 15000
        person:
          min_area: 500
          min_score: 0.6
          threshold: 0.7
          mask:
            - 694,805,1047,787,1096,1048,706,1056
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
#      required_zones:
#        - front_driveway_2_close_in
#        - front_driveway_2_whole_area
      crop: True
      height: 500
      retain:
        default: 3
    zones:
      front_driveway_2_person_at_night:
        coordinates: 1920,1080,1920,316,1273,395,115,509,0,600,0,1080
        objects:
          - car
          - person
          - dog
          - cat
          - bicycle
      front_driveway_2_driveway_only:
        coordinates: 0,1080,715,1080,712,453,128,504,0,596
        objects:
          - car
 #     front_driveway_2_whole_area:
 #       coordinates: 383,52,497,105,569,316,575,480,261,480,0,480,0,225,148,57
 #       objects:
 #         - person
 #         - cat
 #         - dog
 #         - bicycle
    motion:
      mask:
        - 1211,102,1682,101,1679,62,1211,64
    record:
      enabled: True
      retain:
        days: 0
      events:
        retain:
          default: 5
          mode: motion
#        required_zones:
#          - front_driveway_2_close_in
#          - front_driveway_2_whole_area
        pre_capture: 5
        post_capture: 15

  front_porch:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/front_porch
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
      stationary:
        max_frames:
          objects:
            person: 100
    objects:
      track:
        - person
        - dog
        - bicycle
        - cat
      filters:
        person:
          min_area: 500
          min_score: 0.6
          threshold: 0.7
  #    mask:
  #      - 0,480,198,480,200,449,0,451
  #      - 640,0,640,36,640,111,608,135,485,96,504,0
  #      - 439,200,441,324,512,320,532,261,554,188,540,129,451,134
  #      - 370,0,356,100,291,79,292,0
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: false
      crop: True
      height: 500
#      required_zones:
#        - front_porch_close_in
      retain:
        default: 5
    motion:
      mask:
        - 1211,102,1682,101,1679,62,1211,64
    #zones:
    #  front_porch_close_in:
    #    coordinates: 45,480,362,480,640,480,640,213,554,145,525,328,466,343,408,272,348,70,253,64,181,118,67,178
    record:
      enabled: True
      retain:
        days: 0
        mode: active_objects
      events:
        retain:
          default: 4
          mode: active_objects
#        required_zones:
#         - front_porch_close_in
        pre_capture: 5
        post_capture: 15

  back_porch:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/back_porch
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 6
    objects:
      track:
        - person
        - dog
        - cat
        - bird
        - mouse
      filters:
        cat:
          min_score: 0.3
          threshold: 0.5
        dog:
          min_score: 0.3
          threshold: 0.5
        person:
          min_area: 500
          min_score: 0.7
          threshold: 0.8
 #      person:
 #         mask:
 #           - 79,385,107,480,287,480,259,313,107,268
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
      retain:
        default: 4
    motion:
      mask:
        - 1211,102,1682,101,1679,62,1211,64
    record:
      enabled: True
      retain:
        days: 0
      events:
        retain:
          default: 4
          mode: motion
        pre_capture: 5
        post_capture: 15

  diningroom:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/diningroom
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 6
    objects:
      track:
        - person
        - dog
        - cat
        - bird
        - mouse
      filters:
        cat:
          min_score: 0.3
          threshold: 0.5
        dog:
          min_score: 0.3
          threshold: 0.5
#       person:
#          mask:
#            - 79,385,107,480,287,480,259,313,107,268
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
      retain:
        default: 4
    motion:
      mask:
        - 1382,58,1872,55,1868,8,1382,7
    record:
      enabled: True
      retain:
        days: 0
      events:
        retain:
          default: 4
          mode: motion
        pre_capture: 5
        post_capture: 15

  kitchen:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/kitchen
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 6
    objects:
      track:
        - person
        - dog
        - cat
        - bird
        - mouse
      filters:
        cat:
          min_score: 0.3
          threshold: 0.5
        dog:
          min_score: 0.3
          threshold: 0.5
#       person:
#          mask:
#            - 79,385,107,480,287,480,259,313,107,268
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
      retain:
        default: 4
    motion:
      mask:
        - 1382,58,1872,55,1868,8,1382,7
    record:
      enabled: True
      retain:
        days: 0
      events:
        retain:
          default: 4
          mode: motion
        pre_capture: 5
        post_capture: 15

  garage:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/garage
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 6
    objects:
      track:
        - person
        - dog
        - cat
        - bird
        - mouse
      filters:
        cat:
          min_score: 0.3
          threshold: 0.5
        dog:
          min_score: 0.3
          threshold: 0.5
#       person:
#          mask:
#            - 79,385,107,480,287,480,259,313,107,268
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
      retain:
        default: 4
    motion:
      mask:
        - 1211,102,1682,101,1679,62,1211,64
    record:
      enabled: True
      retain:
        days: 0
      events:
        retain:
          default: 4
          mode: motion
        pre_capture: 5
        post_capture: 15

  greenhouse:
    ffmpeg:
      hwaccel_args: preset-intel-qsv-h264
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/greenhouse
          input_args: preset-rtsp-restream-low-latency
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    objects:
      track:
        - person
        - dog
        - bicycle
        - cat
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
      retain:
        default: 3
    record:
      enabled: True
      retain:
        days: 0
      events:
        retain:
          default: 4
          mode: active_objects
        pre_capture: 5
        post_capture: 15
    motion:
      mask:
        - 1211,102,1682,101,1679,62,1211,64

detectors:
  coral:
    type: edgetpu
    device: usb

rtmp:
  enabled: false

birdseye:
  restream: True
  enabled: True
  width: 1920
  height: 1080
  quality: 1
  mode: continuous

live:
  height: 640
  quality: 1

Relevant log output

2023-03-20 12:27:03.670644764  [2023-03-20 12:27:03] frigate.record                 WARNING : Discarding a corrupt recording segment: /tmp/cache/kitchen_back_door-20230320122648.mp4

FFprobe output from your camera

[{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"24/1","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":1080,"width":1920},{"avg_frame_rate":"0/0","codec_long_name":"AAC(AdvancedAudioCoding)"}]}}]

Frigate stats

{"back_porch":{"camera_fps":6.1,"capture_pid":393,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":413,"pid":311,"process_fps":6.1,"skipped_fps":0.0},"backyard":{"camera_fps":0.0,"capture_pid":327,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":23180,"pid":298,"process_fps":0.0,"skipped_fps":0.0},"cpu_usages":{"%Cpu(s):":{"cpu":"id,","mem":"1.2"},"1":{"cpu":"0.0","mem":"0.0"},"108":{"cpu":"10.6","mem":"5.4"},"109":{"cpu":"0.0","mem":"0.0"},"116":{"cpu":"0.0","mem":"0.2"},"134":{"cpu":"0.0","mem":"0.2"},"135":{"cpu":"0.0","mem":"0.1"},"136":{"cpu":"0.0","mem":"0.1"},"137":{"cpu":"0.0","mem":"0.1"},"15":{"cpu":"0.0","mem":"0.0"},"17":{"cpu":"0.0","mem":"0.0"},"22807":{"cpu":"6.0","mem":"0.8"},"23070":{"cpu":"0.0","mem":"0.0"},"23199":{"cpu":"0.0","mem":"0.0"},"23215":{"cpu":"0.7","mem":"0.0"},"23218":{"cpu":"0.3","mem":"0.0"},"24":{"cpu":"0.0","mem":"0.0"},"25":{"cpu":"0.0","mem":"0.0"},"26":{"cpu":"0.0","mem":"0.0"},"27":{"cpu":"0.0","mem":"0.0"},"28":{"cpu":"0.0","mem":"0.0"},"283":{"cpu":"0.0","mem":"1.0"},"289":{"cpu":"1.0","mem":"0.1"},"29":{"cpu":"0.0","mem":"0.0"},"290":{"cpu":"15.3","mem":"1.8"},"292":{"cpu":"29.2","mem":"2.0"},"2943":{"cpu":"6.3","mem":"0.8"},"296":{"cpu":"0.0","mem":"1.7"},"297":{"cpu":"14.0","mem":"1.9"},"298":{"cpu":"0.0","mem":"1.5"},"299":{"cpu":"0.0","mem":"1.5"},"30":{"cpu":"0.0","mem":"0.0"},"302":{"cpu":"0.3","mem":"1.6"},"303":{"cpu":"0.0","mem":"0.2"},"304":{"cpu":"0.7","mem":"1.6"},"305":{"cpu":"0.7","mem":"2.0"},"306":{"cpu":"0.0","mem":"0.2"},"307":{"cpu":"1.0","mem":"1.8"},"308":{"cpu":"0.3","mem":"1.8"},"309":{"cpu":"0.0","mem":"0.2"},"31":{"cpu":"0.0","mem":"0.0"},"310":{"cpu":"6.3","mem":"1.7"},"311":{"cpu":"0.7","mem":"1.6"},"312":{"cpu":"0.0","mem":"0.2"},"313":{"cpu":"0.7","mem":"1.7"},"314":{"cpu":"1.0","mem":"1.7"},"315":{"cpu":"0.0","mem":"0.2"},"316":{"cpu":"1.0","mem":"1.6"},"317":{"cpu":"2.7","mem":"1.6"},"318":{"cpu":"0.0","mem":"0.2"},"319":{"cpu":"0.0","mem":"1.5"},"32":{"cpu":"0.0","mem":"0.0"},"322":{"cpu":"3.3","mem":"1.5"},"323":{"cpu":"0.0","mem":"0.2"},"327":{"cpu":"0.0","mem":"1.5"},"330":{"cpu":"0.0","mem":"0.2"},"331":{"cpu":"0.0","mem":"1.5"},"344":{"cpu":"3.3","mem":"1.5"},"351":{"cpu":"0.0","mem":"0.2"},"357":{"cpu":"4.0","mem":"1.5"},"362":{"cpu":"0.0","mem":"0.2"},"363":{"cpu":"5.6","mem":"0.8"},"365":{"cpu":"3.0","mem":"1.5"},"366":{"cpu":"6.6","mem":"0.8"},"367":{"cpu":"3.7","mem":"1.5"},"369":{"cpu":"3.7","mem":"1.5"},"371":{"cpu":"0.0","mem":"0.2"},"385":{"cpu":"4.0","mem":"1.5"},"393":{"cpu":"4.7","mem":"1.5"},"402":{"cpu":"6.3","mem":"0.8"},"408":{"cpu":"4.3","mem":"1.5"},"409":{"cpu":"0.0","mem":"0.2"},"41":{"cpu":"0.0","mem":"0.0"},"413":{"cpu":"8.3","mem":"0.8"},"414":{"cpu":"7.0","mem":"0.8"},"419":{"cpu":"6.3","mem":"0.8"},"42":{"cpu":"0.0","mem":"0.0"},"420":{"cpu":"4.3","mem":"1.5"},"429":{"cpu":"4.7","mem":"1.5"},"432":{"cpu":"0.0","mem":"0.2"},"444":{"cpu":"3.3","mem":"1.5"},"447":{"cpu":"7.3","mem":"0.8"},"453":{"cpu":"0.0","mem":"0.2"},"463":{"cpu":"8.0","mem":"0.8"},"464":{"cpu":"7.0","mem":"0.8"},"479":{"cpu":"0.0","mem":"0.2"},"506":{"cpu":"6.6","mem":"0.8"},"515":{"cpu":"14.3","mem":"0.9"},"80":{"cpu":"0.0","mem":"0.0"},"81":{"cpu":"0.0","mem":"0.0"},"82":{"cpu":"0.0","mem":"0.0"},"89":{"cpu":"12.3","mem":"0.2"},"MiB":{"cpu":"4859.4","mem":"avail"},"PID":{"cpu":"%CPU","mem":"%MEM"},"Tasks:":{"cpu":"stopped,","mem":"0"},"top":{"cpu":"users,","mem":"load"}},"detection_fps":29.4,"detectors":{"coral":{"detection_start":0.0,"inference_speed":11.06,"pid":290}},"diningroom":{"camera_fps":6.0,"capture_pid":408,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":447,"pid":313,"process_fps":6.0,"skipped_fps":0.0},"doorbell":{"camera_fps":0.0,"capture_pid":319,"detection_enabled":1,"detection_fps":0.1,"ffmpeg_pid":23170,"pid":296,"process_fps":0.1,"skipped_fps":0.0},"front_driveway_1":{"camera_fps":5.0,"capture_pid":367,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":402,"pid":307,"process_fps":5.0,"skipped_fps":0.0},"front_driveway_2":{"camera_fps":5.1,"capture_pid":369,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":414,"pid":308,"process_fps":5.1,"skipped_fps":0.0},"front_porch":{"camera_fps":5.0,"capture_pid":385,"detection_enabled":1,"detection_fps":4.1,"ffmpeg_pid":419,"pid":310,"process_fps":5.0,"skipped_fps":0.0},"garage":{"camera_fps":6.1,"capture_pid":429,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":463,"pid":316,"process_fps":6.1,"skipped_fps":0.0},"garden":{"camera_fps":5.0,"capture_pid":344,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":363,"pid":302,"process_fps":5.0,"skipped_fps":0.0},"gpu_usages":{"intel-qsv":{"gpu":"11.21 %","mem":"- %"}},"greenhouse":{"camera_fps":5.0,"capture_pid":444,"detection_enabled":1,"detection_fps":5.3,"ffmpeg_pid":506,"pid":317,"process_fps":5.0,"skipped_fps":0.0},"greenhouse_2":{"camera_fps":5.1,"capture_pid":365,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":2943,"pid":305,"process_fps":5.1,"skipped_fps":0.0},"kitchen":{"camera_fps":6.1,"capture_pid":420,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":464,"pid":314,"process_fps":6.1,"skipped_fps":0.0},"kitchen_back_door":{"camera_fps":0.0,"capture_pid":331,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":23142,"pid":299,"process_fps":0.0,"skipped_fps":0.0},"license_plate":{"camera_fps":5.0,"capture_pid":357,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":366,"pid":304,"process_fps":5.0,"skipped_fps":0.0},"service":{"last_updated":1679318449,"latest_version":"0.11.1","storage":{"/dev/shm":{"free":771.9,"mount_type":"tmpfs","total":838.9,"used":66.9},"/media/frigate/clips":{"free":166586.9,"mount_type":"ext4","total":248215.2,"used":70405.1},"/media/frigate/recordings":{"free":166586.9,"mount_type":"ext4","total":248215.2,"used":70405.1},"/tmp/cache":{"free":974.8,"mount_type":"tmpfs","total":1000.0,"used":25.2}},"temperatures":{},"uptime":3336,"version":"0.12.0-e8d8cc4"},"side_porch":{"camera_fps":5.2,"capture_pid":322,"detection_enabled":1,"detection_fps":19.9,"ffmpeg_pid":22807,"pid":297,"process_fps":5.2,"skipped_fps":0.0}}

Operating system

Other Linux

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

Eufy 2c

Any other information that may be helpful

No response

NickM-27 commented 1 year ago

Frigate is not looking to support battery / momentarily streaming cameras. This behavior makes sense because frigate sees the object and then the frame dies so it continues to go off of the last known frame while it tries to reconnect to the camera.

You most likely want to set

detect:
  stationary:
    max_frames: 300

for any battery cameras so the event does not continue.

As far as the recordings go, it is very difficult to follow this because there is no distinction being made between eufy recordings and frigate recordings. However, Frigate in no way affects how Eufy records and Frigate only recordings in 10 second segments. If a recording segment is discarded then it was invalid and not saved.

atv2016 commented 1 year ago

Fair enough about not supporting them.

And thanks, i'll try that. Maybe that will fix it. I have also updated the comment to make it more clearer.

Ofcourse Frigate doesn't affect how the eufy records, that seems clear.

But i'm thinking here if Frigate keeps looking for the object while the camera is off, would that cause this kind of behaviour of long recordings and stitching them together? The eufy obviously does not have the rtsp stream open for 5hours (as evidenced from the stitching of different recordings) and Frigate is responsible for the recording on the Frigate side.

So to me that kinda seems to be on the Frigate side?

It might be that that discarding corrupt message from Frigate is not related to how it stores a recording, maybe it is in regards to the Eufy rtsp stream being invalid.

Anyway, let's see if the config fixes this behaviour, would certainly be a fix for me.

NickM-27 commented 1 year ago

Fair enough about not supporting them.

And thanks, i'll try that. Maybe that will fix it. I have also updated the comment to make it more clearer.

Ofcourse Frigate doesn't affect how the eufy records, that seems clear.

But i'm thinking here if Frigate keeps looking for the object while the camera is off, would that cause this kind of behaviour of long recordings and stitching them together? The eufy obviously does not have the rtsp stream open for 5hours (as evidenced from the stitching of different recordings) and Frigate is responsible for the recording on the Frigate side.

Frigate is just trying to reconnect to the stream and remains in its current state (object detected) until it can get the stream back and start processing more frames. So of course that part makes sense. As far as recordings go, if the rtsp stream stops then there's no way something is still being recorded to disk because there is nothing to record (and that is why the stream is coming back as corrupt). Just because the event is 3 hours does not mean there are 3 hours of recordings files there.

It might be that that discarding corrupt message from Frigate is not related to how it stores a recording, maybe it is in regards to the Eufy rtsp stream being invalid.

It is complaining because the recordings are invalid... because there is no data being sent

atv2016 commented 1 year ago
detect:
  stationary:
    max_frames: 300

Doesn't seem to like this, do i need to put it under a object? Or under default: maybe? I'm getting:

cameras -> doorbell -> detect -> stationary -> max_frames
  value is not a valid dict (type=type_error.dict)
cameras -> side_porch -> detect -> stationary -> max_frames
  value is not a valid dict (type=type_error.dict)
cameras -> backyard -> detect -> stationary -> max_frames
  value is not a valid dict (type=type_error.dict)
cameras -> kitchen_back_door -> detect -> stationary -> max_frames
  value is not a valid dict (type=type_error.dict)

Also, what's the difference between max_disappeared and max_frames?

NickM-27 commented 1 year ago

My bad it is actually

detect:
  stationary:
    max_frames: 
      default: 300

This is from the docs:

  # Optional: Number of frames without a detection before Frigate considers an object to be gone. (default: 5x the frame rate)
  max_disappeared: 25

    # Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)
    # This can help with false positives for objects that should only be stationary for a limited amount of time.
    # It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
    # car at the default.
    # WARNING: Setting these values overrides default behavior and disables stationary object tracking.
    #          There are very few situations where you would want it disabled. It is NOT recommended to
    #          copy these values from the example config into your config unless you know they are needed.
    max_frames:
atv2016 commented 1 year ago

Thanks, I'll try it out and report back. I'm a little worried it says frames, which would suggest that it still receives a video feed. Does it still count frames even when the eufy has closed the connection ?

This probably is a thing when a connected camera looses connection as well, would max_frames still work ?

NickM-27 commented 1 year ago

I'm not 100% sure, perhaps @blakeblackshear can provide more context on this edge case

blakeblackshear commented 1 year ago

I don't think that will work because the frames end and it won't ever hit the frame count.

atv2016 commented 1 year ago

Thanks both. Hmmm.

Any way of considering a 'loss of video signal' feature if it doesn't receive video for maybe x amount of minutes? This happens sometimes with my other cabled cams as well (faulty BNC cable, connector, etc) so even if supporting battery powered camera's is not on the roadmap, this would seem like a good feature to have.

blakeblackshear commented 1 year ago

I'm not sure what you are requesting exactly. We already set the preview of the stream on the cameras page to say that no frames have been received.

atv2016 commented 1 year ago

I am talking about the recordings. These keep going as it's still looking for a frame but the RTSP connection is closed as the camera turned off. As a result i get super long recordings that are stitched together.

blakeblackshear commented 1 year ago

I would expect ffmpeg to eventually timeout when the connection stops. Are you using go2rtc with these cameras? You could try connecting directly instead of using go2rtc's restream if so.

Otherwise you will need to play with ffmpeg args to find something that stops gracefully when the stream ends. You should only lose a max of 10 seconds if the segment is discarded.

atv2016 commented 1 year ago

This is the preset i'm using and it should disconnect after 5 seconds or so:

    "preset-rtsp-restream-low-latency": _user_agent_args
    + [
        "-rtsp_transport",
        "tcp",
        TIMEOUT_PARAM,
        "5000000",
        "-fflags",
        "nobuffer",
        "-flags",
        "low_delay",
    ],

So that should already be covered. I see some ffmpeg/git issues on ffmpeg RTSP timeout options not working correctly with the stream dies though, and hanging. I will try the -stimeout and the -timeout options.

So it's definitely the ffmpeg process that is running as part of the frigate that is keeping this connection open then and responsible for the 'stitching' ?

Note that the main cameras page does go to black and says 'no frames received' when the Eufy stops sending data, it's just that the recording seems to stay open.

blakeblackshear commented 1 year ago

Ffmpeg reads from the camera and writes directly to disk in 10 second segments. If you go to /api/config you can see the exact ffmpeg command that does this.

I don't know what you mean by 'stitching'.

NickM-27 commented 1 year ago

I think based on the error log included (would be nice to have more)

2023-03-20 12:27:03.670644764 [2023-03-20 12:27:03] frigate.record WARNING : Discarding a corrupt recording segment: /tmp/cache/kitchen_back_door-20230320122648.mp4

the ffmpeg process is receiving some data that it is trying to write to a segment otherwise it would be restarted due to the timeout or no segments being written

atv2016 commented 1 year ago

Ffmpeg reads from the camera and writes directly to disk in 10 second segments. If you go to /api/config you can see the exact ffmpeg command that does this.

I don't know what you mean by 'stitching'.

It (either Frigate or ffmpeg) is concatenating the recordings together. This is all mentioned in this form previously.

NickM-27 commented 1 year ago

Ffmpeg reads from the camera and writes directly to disk in 10 second segments. If you go to /api/config you can see the exact ffmpeg command that does this. I don't know what you mean by 'stitching'.

It (either Frigate or ffmpeg) is concatenating the recordings together. This is all mentioned in this form previously.

The recordings are not physically stitched together. They are just played back together, they still exist as separate 10 second segments

atv2016 commented 1 year ago

We are going in circles here. I am not talking about a regular recording, I understand how ffmpeg puts it into 10 second files and displaying it as one recording, we are talking about multiple recordings made by the eufy with seemingly (sometimes it is) hours between them AND showing up as one recording in frigate, whilst it should be showing up as separate recordings in frigate. And yes it might not actually be hours, but that’s how it is shown.

This is not a normal recording in frigate as it would show up for a wired camera, only the eufy (and I imagine other battery powered cameras cause this behaviour.

I will play around with ffmpeg options.


From: Nicolas Mowen @.> Sent: 21 March 2023 13:54 To: blakeblackshear/frigate @.> Cc: atv2016 @.>; Author @.> Subject: Re: [blakeblackshear/frigate] [Camera Support]: Eufy 2C battery camera and stitching together of recordings (Issue #5779)

Ffmpeg reads from the camera and writes directly to disk in 10 second segments. If you go to /api/config you can see the exact ffmpeg command that does this. I don't know what you mean by 'stitching'.

It (either Frigate or ffmpeg) is concatenating the recordings together. This is all mentioned in this form previously.

The recordings are not physically stitched together. They are just played back together, they still exist as separate 10 second segments

— Reply to this email directly, view it on GitHubhttps://github.com/blakeblackshear/frigate/issues/5779#issuecomment-1477880109, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEBCFU4JTJV7LO6UDTDQADDW5GXJ5ANCNFSM6AAAAAAWBCZZLM. You are receiving this because you authored the thread.Message ID: @.***>

NickM-27 commented 1 year ago

We are going in circles here. I am not talking about a regular recording, I understand how ffmpeg puts it into 10 second files and displaying it as one recording, we are talking about multiple recordings made by the eufy with seemingly (sometimes it is) hours between them AND showing up as one recording in frigate

We are not concerned with how the eufy app shows the recordings and that is causing a lot of confusion here. You also say "showing up as one recording in frigate" which I think you actually mean showing up as one event in the frigate event list

this is of course expected because the eufy camera never sends frigate frames without the object in them, so frigate receives more frames in the future of another person and is forced to assume it is the same person

github-actions[bot] commented 1 year 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.