blakeblackshear / frigate

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

[Support]: clips are much longer than defined in config #4444

Closed foureight84 closed 1 year ago

foureight84 commented 1 year ago

Describe the problem you are having

I was just reviewing a few clips and I noticed that several clips are 10, 20, or even 30 minutes long. After viewing them, I noticed that the actual event only occurs within a 30-second or less time frame towards the end of the clip (this is an observation with only a handful of samples I've seen so far, I can't speak for all of them that have occurred). The person detected in the clip did not appear in the frame prior to the detection. Pre and Post capture values are set to 5 seconds so this clip should have been 1 minute at most.

In this particular clip, there were activities but none of them were part of the object detection list. There was another person in the frame a minute before the event but that person wasn't detected. The person that wasn't detected was further back in the frame so it probably didn't meet the detection threshold.

Here's a screenshot example: image

What's basically happens is that the event is reported to have occurred at 1:09:45 PM however, in the clip, the event actually occurs about 19 minutes after at around 1:28:32 PM.

image

Version

0.11.1-2EADA21

Frigate config file

mqtt:
  host: 192.168.x.x
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  stats_interval: 30

detectors:
  coral:
    type: edgetpu
    device: pci

database:
  path: /media/database/frigate.db

model:
  path: /config/models/spaghettinet/spaghettinet_edgetpu_l_compiled.tflite
  #path: /edgetpu_model.tflite
  labelmap_path: /labelmap.txt
  width: 320
  height: 320

logger:
  default: info
  logs:
    frigate.event: debug

birdseye:
  enabled: True
  width: 1280
  height: 720
  quality: 8
  mode: objects

ffmpeg:
  global_args: -hide_banner -loglevel warning
  hwaccel_args:
    #- -c:v
    #- h264_qsv
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p
  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
  output_args:
    detect: -f rawvideo -pix_fmt yuv420p
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
    rtmp: -c copy -f flv

detect:
  enabled: True
  width: 1920
  height: 1080
  fps: 30
  max_disappeared: 150 # Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
  stationary:
    interval: 0
    threshold: 300 #Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)

objects:
  track:
    - person
    - cat
    - dog
    - mouse
  filters:
    person:
      min_area: 2500
      max_area: 24000000
      min_ratio: 0.5
      max_ratio: 2.0
      min_score: 0.5
      threshold: 0.7
    cat:
      min_score: 0.5
      threshold: 0.7
    dog:
      min_score: 0.5
      threshold: 0.7

motion:
  threshold: 25
  contour_area: 15
  delta_alpha: 0.2
  frame_alpha: 0.2
  frame_height: 50
  improve_contrast: False
  mqtt_off_delay: 10

record:
  enabled: True
  expire_interval: 60
  retain:
    days: 152
    mode: all
  events:
    pre_capture: 5
    post_capture: 5
    retain:
      default: 152
      mode: motion

snapshots:
  enabled: True
  clean_copy: True
  timestamp: False
  bounding_box: False
  crop: False
  height: 175
  retain:
    default: 152

rtmp:
  enabled: False

live:
  height: 720
  quality: 8

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

cameras:
  front_porch:
    best_image_timeout: 60
    ffmpeg:
      inputs:
        - path: rtsp://x:x@192.168.x.x:8554/unicast
          roles:
            - record
            - detect
    zones:
      front_yard:
        coordinates: 0,1080,0,771,137,651,995,526,994,506,1330,468,1336,489,1590,463,1920,522,1920,1080
      doorsteps:
        coordinates: 865,1080,1468,868,1487,787,1747,695,1780,474,1920,503,1920,1080
        objects:
          - person
    record:
      events:
        required_zones:
          - front_yard
          - doorsteps
    snapshots:
      required_zones:
        - front_yard
        - doorsteps
    mqtt:
      enabled: True
      timestamp: false
      bounding_box: false
      crop: True
      height: 270
      quality: 70
    ui:
      order: 0
      dashboard: True
  back_porch:
    best_image_timeout: 60
    ffmpeg:
      inputs:
        - path: rtsp://x:x@192.168.x.x:8554/unicast
          roles:
            - record
            - detect
    zones:
       front_yard_1:
         coordinates: 136,450,308,299,856,304,857,164,1094,175,1079,318,1500,356,1711,493
       doorsteps_1:
         coordinates: 0,1080,0,599,147,448,1711,487,1920,654,1920,1080
         objects:
           - person
    record:
      events:
        required_zones:
          - front_yard_1
          - doorsteps_1
    snapshots:
      required_zones:
        - front_yard_1
        - doorsteps_1
    mqtt:
      enabled: True
      timestamp: false
      bounding_box: false
      crop: True
      height: 270
      quality: 70
    ui:
      order: 1
      dashboard: True

Relevant log output

N/A

FFprobe output from your camera

ffprobe version n5.1-2-g915ef932a3-20220731 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, rtsp, from 'rtsp://admin:npkqwert@192.168.1.52:8554/unicast':
  Metadata:
    title           : LIVE555 Streaming Media v2022.04.26
    comment         : LIVE555 Streaming Media v2022.04.26
  Duration: N/A, start: 0.000375, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1920x1080, 30 fps, 30 tbr, 90k tbn
  Stream #0:1: Audio: pcm_s16be, 16000 Hz, mono, s16, 256 kb/s

Frigate stats

{
"back_porch": {
"camera_fps": 30,
"capture_pid": 240,
"detection_fps": 7.4,
"pid": 226,
"process_fps": 30,
"skipped_fps": 0
},
"front_porch": {
"camera_fps": 30.1,
"capture_pid": 238,
"detection_fps": 63.8,
"pid": 223,
"process_fps": 28.4,
"skipped_fps": 0
},
"detection_fps": 71.2,
"detectors": {
"coral": {
"detection_start": 0,
"inference_speed": 9.56,
"pid": 216
}
},
"service": {
"latest_version": "0.11.1",
"storage": {
"/dev/shm": {
"free": 123.3,
"mount_type": "tmpfs",
"total": 134.2,
"used": 10.9
},
"/media/frigate/clips": {
"free": 5861236,
"mount_type": "btrfs",
"total": 6001175.1,
"used": 139246.7
},
"/media/frigate/recordings": {
"free": 5861236,
"mount_type": "btrfs",
"total": 6001175.1,
"used": 139246.7
},
"/tmp/cache": {
"free": 992,
"mount_type": "tmpfs",
"total": 1000,
"used": 8
}
},
"temperatures": {
"apex_0": 60.55
},
"uptime": 53,
"version": "0.11.1-2eada21"
}
}

Operating system

Debian

Install method

Docker Compose

Coral version

PCIe

Network connection

Wireless

Camera make and model

Wyze Cam V3

Any other information that may be helpful

No errors in logs during the time of the clip / detection.

NickM-27 commented 1 year ago

This will be due to a false positive, frigate sees something else as a person for the time before the actual person showed up. Recommend watching the debug view with bounding boxes to see where the false positive is.

foureight84 commented 1 year ago

This will be due to a false positive, frigate sees something else as a person for the time before the actual person showed up. Recommend watching the debug view with bounding boxes to see where the false positive is.

You can view the clip in debug view?

NickM-27 commented 1 year ago

Check out https://docs.frigate.video/contributing#2-create-a-local-config-file-for-testing

Be sure to set the camera up exactly as the original camera and remember it's a representation and not exactly what Frigate saw.

foureight84 commented 1 year ago

This will be due to a false positive, frigate sees something else as a person for the time before the actual person showed up. Recommend watching the debug view with bounding boxes to see where the false positive is.

You can view the clip in debug view?

That's awesome! Thank you! I missed that part in the documentation.