blakeblackshear / frigate

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

[Support]: Frigate switches off detection upon add-on restart. #2699

Closed CMDR-Sloma closed 2 years ago

CMDR-Sloma commented 2 years ago

Describe the problem you are having

I am having some issues with Frigate recently, I noticed it switches Detection, Recordings and Snapshots off on my second camera in the back. Front camera is not affected at all.

I thought it maybe this was caused by MQTT connection issues, but frigate connects fine to mosquito broker.

Maybe I am doing something wrong, but I am getting I/O error with ffprobe: ffprobe rtmp://10.0.1.5/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=***

Version

2.3

Frigate config file

mqtt:
  host: 10.0.1.99
  user: user
  password: password

detectors:
  coral:
    type: edgetpu
    device: usb

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

cameras:
  frigate_front:
    ffmpeg:
      inputs:
        - path: rtmp://10.0.1.5/bcs/channel0_sub.bcs?channel=0&stream=0&user=admin&password=password
          roles:
            - detect
        - path: rtmp://10.0.1.5/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=password
          roles:
            - record
            - rtmp
      input_args:
        - -avoid_negative_ts
        - make_zero
        - -fflags
        - nobuffer
        - -flags
        - low_delay
        - -strict
        - experimental
        - -fflags
        - +genpts+discardcorrupt
        - -rw_timeout
        - "5000000"
        - -use_wallclock_as_timestamps
        - "1"
    motion:
      mask:
        - 303,42,296,0,390,21,425,29,523,28,519,66,640,111,640,0,0,0,0,167
        - 565,480,640,332,640,480
    zones:
      front_door:
        coordinates: 527,480,640,344,539,294,529,320,198,131,140,157,471,389,402,480
        objects:
          - person
      front_door_n:
        coordinates: 299,72,426,125,535,64,640,107,640,152,573,216,386,133,264,84
        objects:
          - person
    detect:
      enabled: True
      width: 640
      height: 480
      fps: 5
      max_disappeared: 25   
    record:
      enabled: True
      retain_days: 0
      events:
        objects:
          - person
          - car
        retain:
          default: 7
    rtmp:
      enabled: True
    snapshots:
      enabled: True

  frigate_back:
    ffmpeg:
      inputs:
        - path: rtmp://10.0.1.5/bcs/channel1_sub.bcs?channel=1&stream=1&user=admin&password=password
          roles:
            - detect
        - path: rtmp://10.0.1.5/bcs/channel1_main.bcs?channel=1&stream=1&user=admin&password=password
          roles:
            - record
            - rtmp
      input_args:
        - -avoid_negative_ts
        - make_zero
        - -fflags
        - nobuffer
        - -flags
        - low_delay
        - -strict
        - experimental
        - -fflags
        - +genpts+discardcorrupt
        - -rw_timeout
        - "5000000"
        - -use_wallclock_as_timestamps
        - "1"
    motion:
      mask:
        - 204,49,311,36,471,67,640,123,640,0,329,0,0,0,0,117
    zones:
      backyard:
        coordinates: 383,148,640,261,640,480,98,480,21,360
      backyard_n:
        coordinates: 0,235,139,171,340,93,212,71,0,153
        objects:
          - person
      street:
        coordinates: 640,159,387,72,266,55,395,30,482,57,640,110
        objects:
          - car
    detect:
      enabled: True
      width: 640
      height: 480
      fps: 5
      max_disappeared: 25   
    record:
      enabled: True
      retain_days: 0
      events:
        objects:
          - person
          - car
        retain:
          default: 7
    rtmp:
      enabled: True
    snapshots:
      enabled: True

Relevant log output

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2022-01-24 13:40:03] frigate.app                    INFO    : Starting Frigate (0.9.4-26ae608)
[2022-01-24 13:40:03] frigate.app                    INFO    : Creating directory: /tmp/cache
Starting migrations
[2022-01-24 13:40:03] peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
[2022-01-24 13:40:03] peewee_migrate                 INFO    : There is nothing to migrate
[2022-01-24 13:40:03] detector.coral                 INFO    : Starting detection process: 221
[2022-01-24 13:40:03] frigate.mqtt                   INFO    : MQTT connected
[2022-01-24 13:40:03] frigate.app                    INFO    : Output process started: 223
[2022-01-24 13:40:03] ws4py                          INFO    : Using epoll
[2022-01-24 13:40:03] frigate.app                    INFO    : Camera processor started for frigate_front: 227
[2022-01-24 13:40:03] frigate.app                    INFO    : Camera processor started for frigate_back: 229
[2022-01-24 13:40:03] frigate.app                    INFO    : Capture process started for frigate_front: 232
[2022-01-24 13:40:03] frigate.edgetpu                INFO    : Attempting to load TPU as usb
[2022-01-24 13:40:03] frigate.app                    INFO    : Capture process started for frigate_back: 235
[2022-01-24 13:40:04] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:52934]
[2022-01-24 13:40:03] frigate.mqtt                   DEBUG   : on_recordings_toggle: frigate/frigate_back/recordings/set OFF
[2022-01-24 13:40:06] frigate.edgetpu                INFO    : TPU found
[2022-01-24 13:40:03] frigate.mqtt                   INFO    : Turning off recordings for frigate_back via mqtt
[2022-01-24 13:40:03] frigate.mqtt                   DEBUG   : on_snapshots_toggle: frigate/frigate_back/snapshots/set OFF
[2022-01-24 13:40:03] frigate.mqtt                   INFO    : Turning off snapshots for frigate_back via mqtt
[2022-01-24 13:40:03] frigate.mqtt                   DEBUG   : on_detect_toggle: frigate/frigate_back/detect/set OFF
[2022-01-24 13:40:03] frigate.mqtt                   INFO    : Turning off detection for frigate_back via mqtt
[2022-01-24 13:40:03] ws4py                          INFO    : Using epoll

FFprobe output from your camera

ffprobe version 4.4.1-full_build-www.gyan.dev Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11.2.0 (Rev1, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
rtmp://10.0.1.5/bcs/channel0_main.bcs?channel=0: I/O error
'stream' is not recognized as an internal or external command,
operable program or batch file.
'user' is not recognized as an internal or external command,
operable program or batch file.
'password' is not recognized as an internal or external command,
operable program or batch file.

Frigate stats

{"detection_fps":0.0,"detectors":{"coral":{"detection_start":0.0,"inference_speed":11.64,"pid":221}},"frigate_back":{"camera_fps":5.0,"capture_pid":235,"detection_fps":0.0,"pid":229,"process_fps":0.0,"skipped_fps":0.0},"frigate_front":{"camera_fps":5.1,"capture_pid":232,"detection_fps":0.0,"pid":227,"process_fps":5.1,"skipped_fps":0.0},"service":{"storage":{"/dev/shm":{"free":1999.8,"mount_type":"tmpfs","total":2001.4,"used":1.6},"/media/frigate/clips":{"free":97164.3,"mount_type":"ext4","total":122350.8,"used":20185.6},"/media/frigate/recordings":{"free":97164.3,"mount_type":"ext4","total":122350.8,"used":20185.6},"/tmp/cache":{"free":1991.7,"mount_type":"tmpfs","total":2001.4,"used":9.7}},"uptime":298,"version":"0.9.4-26ae608"}}

Operating system

HassOS

Install method

HassOS Addon

Coral version

USB

Network connection

Wired

Camera make and model

Reolink ‎NVR (RLN8-410), 2 x RLC-410-5MP

Any other information that may be helpful

No response

blakeblackshear commented 2 years ago

Most likely this pinned issue: https://github.com/blakeblackshear/frigate/issues/2129

Normanras commented 2 years ago

So strange, I came here just now to post the same issue as @CMDR-Sloma ! Although it has been happening for a while and it only happens on one of 3 of my cameras. Will check out 2129.

eracknaphobia commented 2 years ago

Uninstalling / Re-installing the mosquitto broker fixed the issue for me. It only effected my original cameras, a camera that I just recently added did not have this issue. I'm guessing some persistent flag was held on the mqtt broker.

CMDR-Sloma commented 2 years ago

Did the update yesterday and I can confirm this is still the case, Detection, Recordings and Snapshots are being switched off upon restart.

blakeblackshear commented 2 years ago

The fix made it so switching them back on would work. You may still need to clear the retained mqtt topics.

CMDR-Sloma commented 2 years ago

The fix made it so switching them back on would work. You may still need to clear the retained mqtt topics.

OK, so I sent blank messages to all relevant topics with retain flags, then I re-set all three settings to desired values. Looks like this has solved my problem, so I will close this issue. Thanks for all the help.