blakeblackshear / frigate

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

[Support]: Clips missing actual events #2011

Closed MrAnonymous722 closed 2 years ago

MrAnonymous722 commented 3 years ago

Describe the problem you are having

I will have motion events which have metadata that I would expect, for example, my mail man coming by generates an event that has expected time stamps (about 40 seconds worth of time), but the clip saved is only 12 seconds long and does not include any motion. Its also weird because I have 10 seconds of pre and post capture, so I'd expect the clip to be at least 20 seconds long. I do get a thumbnail with the person that set off the event. Furthermore, sometimes the clips will include the whole clip, but will later be cut much shorter. I have a clip that was over a minute that I watched shortly after it happened that is now only 4 seconds.

Version

0.9.1-800F33E

Frigate config file

mqtt:
  host: 192.168.0.127
  user: mqttuser
  password: ohnoiforgottoomitmypassword
detectors:
#  cpu1:
#    type: cpu
#  cpu2:
#    type: cpu
#  cpu3:
#    type: cpu
#  cpu4:
#    type: cpu
  coral:
    type: edgetpu
    device: usb
birdseye:
  enabled: True
  mode: objects
motion:
  frame_height: 180
ffmpeg:
  hwaccel_args:
    - -hwaccel
    - qsv
    - -qsv_device
    - /dev/dri/renderD128
cameras:
  driveway-cam:
    ffmpeg:
      input_args:
        - -avoid_negative_ts
        - make_zero
        - -fflags
        - nobuffer+genpts+discardcorrupt
        - -flags
        - low_delay
        - -strict
        - experimental
        - -analyzeduration
        - 1000M
        - -probesize
        - 1000M
        - -rw_timeout
        - "5000000"
      inputs:
        - path: http://192.168.0.213/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=ohnoiforgottoomitmypassword
          roles:
            - record
#            - rtmp
        - path: http://192.168.0.213/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=ohnoiforgottoomitmypassword
          roles:
            - detect
    record:
      enabled: True
      retain_days: 0
      events:
        pre_capture: 10
        post_capture: 10
        required_zones: [yard, driveway, porch]
    detect:
      width: 640
      height: 480
      fps: 7
    snapshots:
      required_zones: [yard, driveway, porch]
      enabled: True
      timestamp: True
      crop: True
    objects:
#      filters:
#        car:
#          mask:
#           - 1920,0,1920,206,1550,144,1027,129,609,181,383,229,0,379,0,88,61,0
      track:
       - person
       - car
#       - bicycle
       - dog
#       - cell phone
#       - bus
       - cat
    motion:
      mask: 190,7,297,13,452,10,452,27,190,26
    zones:
      yard:
        coordinates: 491,168,249,81,56,100,158,209
        objects:
         - person
         - dog
         - cat
      driveway:
        coordinates: 0,251,253,193,450,179,640,286,640,480,0,480
      porch:
        coordinates: 0,113,62,111,169,206,0,245
  garage-cam:
    detect:
      width: 1920
      height: 1080
      fps: 5
    record:
      enabled: True
      retain_days: 0
      events:
        post_capture: 10
    ffmpeg:
      inputs:
       - path: rtsp://192.168.0.4:8554/garage-cam
         roles:
          - detect
          - record
    motion:
      mask:
        - 1387,1052,1868,1052,1863,1013,1389,1011
    snapshots:
      enabled: True
      timestamp: True
    objects:
      track:
       - person
       - backpack
  backyard-cam:
    detect:
      width: 1920
      height: 1080
      fps: 5
    record:
      enabled: True
      retain_days: 0
      events:
        post_capture: 10
    motion:
      mask: 
       - 1872,1015,1876,1059,1383,1059,1381,1013
       - 478,114,737,109,1264,148,1479,0,1212,0,798,0,591,0,182,0,0,0,0,209
    ffmpeg:
      inputs:
       - path: rtsp://byard:ohnoiforgottoomitmypassword@192.168.0.141/live
         roles:
          - detect
          - record
    objects:
      filters:
        bird:
          mask:
           - 1920,781,1619,527,1683,250,1920,396
    snapshots:
      enabled: True
      timestamp: True
    objects:
      track:
       - person
       - bird
       - cat
       - dog

Relevant log output

N/A

FFprobe output from your camera

Nothing useable from this command

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

USB

Network connection

Wireless

Camera make and model

Reolink RLC 520

Any other information that may be helpful

Running the camera via the example RLC configuration in the docs. Also as far as I know, this only happens with my RLC camera, though I don't have many other events on the other two so its hard to say that with any confidence.

blakeblackshear commented 3 years ago

I'm thinking this happens somewhere in the recording expiration logic, but I haven't found it yet. There are several similar reported issues.

MrAnonymous722 commented 3 years ago

Is there anything I can do to help it in the mean time? Maybe increasing the recording retention to a day or something?

quick00198 commented 3 years ago

I am getting the same thing. I get a snapshot of the actual motion but when I watch the clip it is timed completely wrong and the motion is not included in the video

thorzh commented 3 years ago

I'm thinking this happens somewhere in the recording expiration logic, but I haven't found it yet. There are several similar reported issues.

I believe this is exactly the case. If I retain the recording for longer period, say 1 or 2 days, there won't be any missing clips of the events during that period. Once the retain period passed, then maybe 30% to 50% of the events of that same period will have shorter clips left.

blakeblackshear commented 3 years ago

It would be helpful to confirm that setting retain_days to 1 eliminates the issue for anything in the past 24 hours.

quick00198 commented 3 years ago

It would be helpful to confirm that setting retain_days to 1 eliminates the issue for anything in the past 24 hours.

I have changed mine to 1 day. Hopefully I will have some news for you tomorrow

quick00198 commented 3 years ago

I can confirm that nothing is missing in motion clips when retain_days is set to 1. Problem is I would need a much bigger sd card. Hope this helps you solve the problem.

blakeblackshear commented 3 years ago

For those running the amd64 version with docker directly, please give blakeblackshear/frigate:0.9.2-ef82c5c-amd64 a try. I think this will fix the issue.

MrAnonymous722 commented 3 years ago

Giving it a download now!

On Fri, Oct 15, 2021 at 7:51 AM Blake Blackshear @.***> wrote:

For those running the amd64 version with docker directly, please give blakeblackshear/frigate:0.9.2-ef82c5c-amd64 a try. I think this will fix the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/blakeblackshear/frigate/issues/2011#issuecomment-944271903, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGNPLPXQDTYUHVMQV52WMSLUHAPVHANCNFSM5F6OHAEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Minglarn commented 3 years ago

Sorry but it didn't make any difference for me... In the event list I see these events: image

But in the recodings folder events with timestamp: 22:46:03-22:46:37 & 22:46:25-22:46:45 are missing... image

blakeblackshear commented 3 years ago

Can you also post the logs from the time of these events as well?

Minglarn commented 3 years ago

All i've got is this...

frigate    | [2021-10-15 23:20:43] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:60224]
frigate    | [2021-10-15 23:20:46] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:60224]
frigate    | [2021-10-15 23:21:14] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:60572]
frigate    | [2021-10-15 23:22:23] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:60572]
frigate    | [2021-10-15 23:22:24] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:60748]
frigate    | [2021-10-15 23:22:24] frigate.output                 WARNING : Unable to copy frame frigate_lillstugan1634332943.445167 to birdseye.
frigate    | [2021-10-15 23:22:29] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:60748]
frigate    | [2021-10-15 23:22:32] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:39908]
frigate    | [2021-10-15 23:22:32] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:42360]
frigate    | [2021-10-15 23:29:57] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:33838]
frigate    | [2021-10-15 23:29:57] frigate.output                 WARNING : Unable to copy frame frigate_entren1634332949.346791 to birdseye.
frigate    | [2021-10-15 23:32:55] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:39272]
frigate    | [2021-10-15 23:41:39] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:42360]
frigate    | [2021-10-15 23:41:39] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:33838]

Nothing useful I guess.. No warnings from ffmpeg as you can see..

MrAnonymous722 commented 3 years ago

So far after a day of using it, none of my clips have been cut short of what their metadata says they should be. The time stamps Frigate reports match what the timestamps on the video start at.

Edit: I found what I think is the best way to audit this information is by Home Assistant's media browser, as the clips are named with how long they should be so its as simple as clicking on a video and comparing the name to how long the video is in the player.

tunip commented 3 years ago

I am also testing 0.9.2-ef82c5c-amd64 right now. From my side it looks good. Every event has the expected complete clip.

blakeblackshear commented 3 years ago

I'm hoping to finish 0.9.2 today which will include this along with a few other improvements.

Minglarn commented 3 years ago

Installed 0.9.2-7AB6961 and after aprox 200 recordings none is missing! But im not sure if it was the latest version or if my newly cleaned/added settings in config.yml Going to let it roll for a couple of days just in case..

Changed settings in config.yml are:

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

output_args:
  record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:a aac -c:v copy -c:a aac

where detect is changed from 25 to 30 where record segment time is set to 60 instead of 10 ..

DomiStyle commented 3 years ago

I was also having the same issue and tried the new Docker image. Looks like the problem is fixed and the clips start properly now.

However, I have set pre_capture: 10 in my config just like in the original issue, yet some of the clips start right after a person has already entered the frame instead of 10 seconds before. Did I misinterpret the pre_capture option or is this also unexpected behavior?

blakeblackshear commented 3 years ago

It really depends on when the object was identified by frigate, so I can't say for sure. I don't expect an issue with pre_capture to be related to the issue identified here.

huzaw commented 3 years ago

Hi I still have this issue. Sometimes the clip start 10-15s before the event, other times the clip starts at the exact time the event happens and other times it starts when the event is over. I am on version 0.9.4-26AE608. Should I create a new issue?

Bod1985 commented 2 years ago

I am experiencing this issue on 0.10 Beta 3, I will enable retain for 1 day to see if the issue is still present

Edit: This doesn’t appear to happen with 1 day retain enabled

Edit 2: It seems like it still happens with 1 day retain enabled, but less frequently

MrAnonymous722 commented 2 years ago

Closing this issue since I haven't run into it since the fixes mentioned above^