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]: Bug Report rc3 & release #3929

Closed rce1086 closed 2 years ago

rce1086 commented 2 years ago

Describe the problem you are having

Please see attached screenshots - a stream condition causes a divide by zero exception, which leaves this stream pinned in the birds eye view, and requires a frigate restart to clear this state. Sorry not to have reported earlier - I was running rc2, where I don’t recall seeing this, when I thought I was running rc3🤦‍♂️…

Version

11-release & rc3

Frigate config file

root@HomeAssistant:/home/homeassistant# cat frigate/config/config.yml
##############
logger:
  default: warning
  logs:
    #frigate.mqtt: debug
    frigate.edgetpu: debug
    frigate.app: info

##############
mqtt:
  host: 192.168.1.16
##############
detectors:
  # Required: name of the detector
  coral:
    # Required: type of the detector
    # Valid values are 'edgetpu' (requires device property below) and 'cpu'.
    type: edgetpu
    device: usb:0
##############
# Optional: Database configuration
database:
  # The path to store the SQLite DB (default: shown below)
  path: /media/frigate/frigate.db
##############
objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
    - car
    - motorcycle
    - bicycle
    - bird
    - cat
    - dog
  # Optional: filters to reduce false positives for specific object types
  filters:
    person:
      # Optional: minimum width*height of the bounding box for the detected object (default: 0)
      min_area: 300
      # Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
      max_area: 130000
      # Optional: minimum score for the object to initiate tracking (default: shown below)
      min_score: 0.5
      # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below)
      threshold: 0.70
    dog:
      max_area: 30000
      threshold: 0.65
    cat:
      max_area: 26000
      threshold: 0.65
##############
# Optional: birdseye configuration
birdseye:
  # Optional: Enable birdseye view (default: shown below)
  enabled: True
  # Optional: Width of the output resolution (default: shown below)
  width: 800
  # Optional: Height of the output resolution (default: shown below)
  height: 480
  # Optional: Encoding quality of the mpeg1 feed (default: shown below)
  # 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
  quality: 14
  # Optional: Mode of the view. Available options are: objects, motion, and continuous
  #   objects - cameras are included if they have had a tracked object within the last 30 seconds
  #   motion - cameras are included if motion was detected in the last 30 seconds
  #   continuous - all cameras are included always
  mode: objects

##############
# Optional: ffmpeg configuration
ffmpeg:
  # Optional: global ffmpeg args (default: shown below)
  global_args: -hide_banner -loglevel info #warning
  # Optional: global hwaccel args (default: shown below)
  # NOTE: See hardware acceleration docs for your specific device
  hwaccel_args: -c:v h264_v4l2m2m -num_output_buffers 32 -num_capture_buffers 32 
  # Optional: global input args (default: shown below)
  input_args: -avoid_negative_ts make_zero -fflags nobuffer+genpts+discardcorrupt -strict experimental -rw_timeout 5000000 -use_wallclock_as_timestamps 1 -an
  # Optional: global output args
  output_args:
    # Optional: output args for detect streams (default: shown below)
    detect: -f rawvideo -pix_fmt yuv420p
    # Optional: output args for record streams (default: shown below)
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -an
    # Optional: output args for rtmp streams (default: shown below)
    rtmp: -c:v copy -f flv
#
# Optional: Detect configuration
# NOTE: Can be overridden at the camera level
##############
detect:
  # Optional: width of the frame for the input with the detect role (default: shown below)
  width: 896
  # Optional: height of the frame for the input with the detect role (default: shown below)
  height: 512
  # Optional: desired fps for your camera for the input with the detect role (default: shown below)
  # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
  fps: 5
  # Optional: enables detection for the camera (default: True)
  # This value can be set via MQTT and will be updated in startup based on retained value
  enabled: True
  # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
  max_disappeared: 25

##############
record:
  enabled: True
  retain:
    days: 1
    mode: motion
  events:
    retain:
      default: 5
      mode: active_objects

##############
snapshots:
  enabled: True

##############
# Optional: in-feed timestamp style configuration
# NOTE: Can be overridden at the camera level
timestamp_style:
  # Optional: Position of the timestamp (default: shown below)
  #           "tl" (top left), "tr" (top right), "bl" (bottom left), "br" (bottom right)
  position: "tl"
  # Optional: Format specifier conform to the Python package "datetime" (default: shown below)
  #           Additional Examples:
  #             german: "%d.%m.%Y %H:%M:%S"
  format: "%Y/%m/%d %H:%M:%S"
  # Optional: Color of font
  color:
    # All Required when color is specified (default: shown below)
    red: 255
    green: 255
    blue: 255
  # Optional: Line thickness of font (default: shown below)
  thickness: 2
  # Optional: Effect of lettering (default: shown below)
  #           None (No effect),
  #           "solid" (solid background in inverse color of font)
  #           "shadow" (shadow for font)
  #effect: None

##############
cameras:
  Doors:
    ffmpeg:
      inputs:
          ################
        #- path: rtsp://admin:@192.168.1.129:554/h264Preview_01_ext
          #path: rtmp://192.168.1.129/bcs/channel0_sub.bcs?channel=0&stream=0&user=admin&password=
          #################
        #- path: rtmp://192.168.1.129/bcs/channel0_main.bcs?token=154&channel=0&stream=0&user=admin&password=
          #roles:
          #################
        - path: rtmp://192.168.1.129/bcs/channel0_ext.bcs?token=154&channel=0&stream=0&user=admin&password=
          roles:
            - detect
            - record
            - rtmp
    ################
    snapshots:
      enabled: True
      bounding_box: True
      retain:
        default: 10
        objects:
          person: 30
    ################

    objects:
      track:
        - person
        - cat
        - dog
        - bird
      filters:
        person:
          min_area: 12000

  Sheds:
    ffmpeg:
      inputs:
        #- path: rtsp://admin:@192.168.1.131:554/h264Preview_01_ext
          #path: rtmp://192.168.1.131/bcs/channel0_sub.bcs?token=414&channel=0&stream=0&user=admin&password=
          #height: 352
          #width: 640
          #################
        #- path: rtmp://192.168.1.131/bcs/channel0_main.bcs?token=444&channel=0&stream=0&user=admin&password=
          #roles:
          #width: 1920
          #height: 1072
          #################
        - path: rtmp://192.168.1.131/bcs/channel0_ext.bcs?token=444&channel=0&stream=0&user=admin&password=
          roles:
            - detect
            - record
            - rtmp
    ################
    snapshots:
      enabled: True
      bounding_box: True
      retain:
        default: 15
        objects:
          person: 30
    ################
    objects:
      filters:
        person:
          max_area: 15000
        dog:
          max_area: 6000
    ################
    zones:
      garden:
        coordinates: 896,512,896,155,379,34,0,265,0,512
      road:
        coordinates: 0,76,316,64,382,40,896,159,896,0,0,0

  Front:
    ffmpeg:
      inputs:
        #- path: rtsp://admin:@192.168.1.130:554/h264Preview_01_ext
          #path: rtmp://192.168.1.130/bcs/channel0_sub.bcs?token=414&channel=0&stream=0&user=admin&password=q
          #height: 352
          #width: 640
          #################
        #- path: rtmp://192.168.1.130/bcs/channel0_main.bcs?token=444&channel=0&stream=0&user=admin&password=
          #roles:
          #  - clips
          #width: 1920
          #height: 1072
          #################
        - path: rtmp://192.168.1.130/bcs/channel0_ext.bcs?token=444&channel=0&stream=0&user=admin&password=
          roles:
            - detect
            - record
            - rtmp
    ################
    snapshots:
      enabled: True
      bounding_box: True
      retain:
        default: 5
        objects:
          person: 10
    ################
    zones:
      garden:
        coordinates: 84,0,522,0,589,41,588,173,896,365,896,512,96,512
      path:
        coordinates: 588,184,587,0,896,0,896,358
    ################
    objects:
      filters:
        car:
          mask:
            - 896,103,810,202,690,146,784,42
        cat:
           # Optional: minimum width*height of the bounding box for the detected object (default: 0)
          min_area: 50
          max_area: 550

  Corner:
    ffmpeg:
      inputs:
        #- path: rtsp://admin:@192.168.1.130:554/h264Preview_01_ext
          #path: rtmp://192.168.1.130/bcs/channel0_sub.bcs?token=414&channel=0&stream=0&user=admin&password=
          #height: 352
          #width: 640
          #################
        #- path: rtmp://192.168.1.128/bcs/channel0_main.bcs?token=444&channel=0&stream=0&user=admin&password=
          #roles:
          #width: 1920
          #height: 1072
          #################
        - path: rtmp://192.168.1.128/bcs/channel0_ext.bcs?token=444&channel=0&stream=0&user=admin&password=
          roles:
            - detect
            - record
            - rtmp
    ################
    snapshots:
      enabled: True
      bounding_box: True
      retain:
        default: 5
        objects:
          person: 10
    ################
    objects:
      filters:
        person:
           # Optional: minimum width*height of the bounding box for the detected object (default: 0)
          min_area: 50

  CatCam:
    ffmpeg:
      inputs:
        - path: rtmp://192.168.1.132/bcs/channel0_ext.bcs?token=444&channel=0&stream=0&user=admin&password=
          roles:
            - detect
            - record
            - rtmp
    ################
    detect:
      height: 672
      width: 896
    ################
    objects:
      track:
        - person
        - cat
        - dog
        - bird
    ################
    snapshots:
      enabled: True
      bounding_box: True
      retain:
        default: 5
        objects:
          person: 20
          cat: 10

Relevant log output

Capture process started for CatCam: 240
frigate          | [2022-09-24 13:42:15] frigate.edgetpu                INFO    : TPU found
frigate          | [2022-09-24 15:44:16] frigate.edgetpu                INFO    : Attempting to load TPU as usb:0
frigate          | [2022-09-24 15:44:19] frigate.edgetpu                INFO    : TPU found
frigate          | [2022-09-24 17:53:30] frigate.object_processing      WARNING : Unable to create jpg because frame 1664038406.221701 is not in the cache
frigate          | Process camera_processor:Front:
frigate          | Traceback (most recent call last):
frigate          |   File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
frigate          |     self.run()
frigate          |   File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
frigate          |     self._target(*self._args, **self._kwargs)
frigate          |   File "/opt/frigate/frigate/video.py", line 388, in track_camera
frigate          |     process_frames(
frigate          |   File "/opt/frigate/frigate/video.py", line 628, in process_frames
frigate          |     detect(
frigate          |   File "/opt/frigate/frigate/video.py", line 465, in detect
frigate          |     ratio = width / height
frigate          | ZeroDivisionError: division by zero
frigate          | Process camera_processor:Corner:
frigate          | Traceback (most recent call last):
frigate          |   File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
frigate          |     self.run()
frigate          |   File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
frigate          |     self._target(*self._args, **self._kwargs)
frigate          |   File "/opt/frigate/frigate/video.py", line 388, in track_camera
frigate          |     process_frames(
frigate          |   File "/opt/frigate/frigate/video.py", line 628, in process_frames
frigate          |     detect(
frigate          |   File "/opt/frigate/frigate/video.py", line 465, in detect
frigate          |     ratio = width / height
frigate          | ZeroDivisionError: division by zero
root@HomeAssistant:/home/homeassistant# docker-compose restart frigate
Restarting frigate ... done
root@HomeAssistant:/home/homeassistant# cat frigate/config/config.yml

FFprobe output from your camera

root@HomeAssistant:/home/homeassistant# ffprobe 'rtmp://192.168.1.131/bcs/channel0_ext.bcs?token=424&channel=0&stream=0&user=admin&password=Nitrox80'
ffprobe version 4.3.4-0+deb11u1+rpt1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1+rpt1 --toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-mmal --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --enable-sand --libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, flv, from 'rtmp://192.168.1.131/bcs/channel0_ext.bcs?token=424&channel=0&stream=0&user=admin&password=Nitrox80':
  Metadata:
    displayWidth    : 896
    displayHeight   : 512
  Duration: 00:00:00.00, start: 550831.664000, bitrate: N/A
    Stream #0:0: Data: none
    Stream #0:1: Video: h264 (High), yuv420p(progressive), 896x512, 11 fps, 12 tbr, 1k tbn
    Stream #0:2: Audio: aac (LC), 16000 Hz, mono, fltp
Unsupported codec with id 0 for input stream 0
root@HomeAssistant:/home/homeassistant#

Frigate stats

{"CatCam":{"camera_fps":5.3,"capture_pid":241,"detection_fps":0.0,"pid":227,"process_fps":5.3,"skipped_fps":0.0},"Corner":{"camera_fps":5.0,"capture_pid":235,"detection_fps":11.2,"pid":225,"process_fps":2.7,"skipped_fps":0.0},"Doors":{"camera_fps":5.1,"capture_pid":229,"detection_fps":0.8,"pid":220,"process_fps":5.1,"skipped_fps":0.0},"Front":{"camera_fps":5.6,"capture_pid":231,"detection_fps":10.4,"pid":224,"process_fps":3.3,"skipped_fps":0.0},"Sheds":{"camera_fps":5.0,"capture_pid":230,"detection_fps":5.3,"pid":223,"process_fps":3.3,"skipped_fps":0.0},"detection_fps":27.7,"detectors":{"coral":{"detection_start":1664045790.609751,"inference_speed":21.88,"pid":216}},"service":{"latest_version":"0.11.0","storage":{"/dev/shm":{"free":412.0,"mount_type":"tmpfs","total":419.4,"used":7.4},"/media/frigate/clips":{"free":69893.7,"mount_type":"ext4","total":159322.6,"used":76996.3},"/media/frigate/recordings":{"free":69893.7,"mount_type":"ext4","total":159322.6,"used":76996.3},"/tmp/cache":{"free":996.8,"mount_type":"tmpfs","total":1000.0,"used":3.2}},"temperatures":{},"uptime":2471,"version":"0.11.0-be7b858"}}

Operating system

Debian

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

Reolink RLC-423x1:RLC-410x2:RLC-420x1:RLC-420-5MPx1

Any other information that may be helpful

As above, I don’t recall this in rc2, but definitely in 11-release & rc3 Runs on RPI4 4MB, wired Gb Ethernet, no wireless configured (country unset) OS is fairly up to date Bullseye - Linux HomeAssistant 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux

NickM-27 commented 2 years ago

This should have been fixed in release, please get logs from the release of this occurring. Your current logs complain of line 465 which is not consistent of the release: https://github.com/blakeblackshear/frigate/blob/master/frigate/video.py#L465

github-actions[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.