Local realtime person detection for RTSP cameras

Dumb question perhaps but I did a search with no results.

Is there a gui to handle cams/settings etc?
Thinking about run this instead of Zoneminder.

I was hoping to look into creating one for some of this. Not on the roadmap to change settings yet though.

https://github.com/blakeblackshear/frigate/discussions/479#discussioncomment-263560

I have a strange issue.
Iā€™m looking at a snapshot of the mqtt cameras made with the HA integration and running the .80 beta 3. I have found with one of my two cameras and only when it detects cars with that one cameraā€¦the entire image is black and white. This includes the bounding box. The same camera shows a normal color picture for the snapshot when it detects people. The clips made by this camera when detecting cars are full color. Only the snapshot is black and white. Anybody else seen this?

I have saw some mentions on GitHub of increasing gpu_mem on a Pi4 (4GB) - is this still necessary/advisable?

Moreover, I am having real issues with two 480p sub streams on a Pi4 with HassOS & custom_component. The video feed would be all green or 90% full of artefacts. When looking at the HTTP endpoint there would be multiple bounding boxes rapidly appearing and disappearing. It really was not stable.

I increased the tmpfs size to 512m and it seems to resolve it if anyone else is having similar issues.

1 Like

Sorry, how you change tmpfs size in the addon? Thanks

save_clips:
  max_seconds: 300
  tmpfs_cache_size: 512m
  retain:
    default: 10
    objects:
      person: 15
1 Like

Any pointers to how I would do this line on a supervised install on Debian

Note: You also need to set LIBVA_DRIVER_NAME=radeonsi as an environment variable on the container.

Iā€™m not very proficient in docker - I installed it through the supervisor. I can find some of the docker JSON files but not sure where I would add this line. I am running this on an HP T620 Thin client which has Radeon HD 8xxxx integrated graphics.

Many thx, i got it working now!
Is there a way to change the default clips folder in the 0.8.0 addon? Cant find the option in the docs just for the old config.

Is anyone else having issues when restarting Frigate Beta Addon when HassOS is running. When i do that the above issue occurs.

To fix it, I need to stop the addon, restart home assistant and then start addon again. very annoying

I had similar issues on my reolink cameras when using the RTSP URL, another report indicated switching to the RTMP URL resolved it and it did for me as well. You might see if you have alternate protocols you can try. I donā€™t think it was a HaSS or Frigate issue I think that ffmpeg is just picky about glitches in the stream

If it helps, after some trial and error this is the setup that I got working with my Reolink RLC-410-5MP cameras. Initially with the older non-beta build, the RTSP streams were working fine, but when I switched to the 0.8 beta they had a lot of smearing. I switched to RTMP which improved things, but then when I tried to record clips off the RTMP stream the camera crashed of froze resulting in an FFMPEG crash.

Solution: Use the RTMP stream for detection, and the RTSP stream for clips:

detectors:
  coral:
    type: edgetpu
    device: 'usb:0'
mqtt:
  host: 192.168.86.xx
  port: 1883
  user: user
  password: password
ffmpeg:
  input_args:
    - '-avoid_negative_ts'
    - make_zero
    - '-fflags'
    - nobuffer
    - '-flags'
    - low_delay
    - '-strict'
    - experimental
    - '-fflags'
    - +genpts+discardcorrupt
    - '-use_wallclock_as_timestamps'
    - '1'
cameras:
  porch:
    ffmpeg:
      inputs:
        - path: >-
            rtmp://192.168.86.xx/bcs/channel0_sub.bcs?channel=0&stream=0&user=user&password=password
          roles:
            - detect
        - path: 'rtsp://user:[email protected]:554//h264Preview_01_main'
          roles:
            - clips
    height: 480
    width: 640
    fps: 5
    save_clips:
      enabled: true
      pre_capture: 5
      post_capture: 5
      objects:
        - person
      retain:
        default: 7
        objects:
          person: 7
    rtmp:
      enabled: false
    snapshots:
      show_timestamp: false
      draw_zones: false
      draw_bounding_boxes: true
      crop_to_region: false
      height: 480
    objects:
      track:
        - person
save_clips:
  max_seconds: 60
  retain:
    default: 7
    objects:
      person: 7

This works well, with good detection and saving full-res clips.

It does seem to use more CPU than the older version (~60% vs. 25-30%), and for some reason I simply canā€™t get my NAS drive to mount using a shell command as described in the thread above, but works fine with local storage.

2 Likes

Interesting I have a 410 as well and use the RTMP stream for both without issues, tons of clipsā€¦I have the same parameters in ffmpeg and running at the same resolution/fps. I am on all wiredā€¦ do you have wireless in the mix? Is your camera firmware up to date?

Latest firmware, POE wired. It may be because I was trying to record from the full-res stream? Or perhaps because I donā€™t have hardware GPU support for decoding the streams?

I had the same question and searched over hours. Seems to be more than changing one variable in a file. Changing the config file in /var/lib/docker/containers/FRIGATECONTAINER/config.v2.json does not work, its generated new every time the container starts. Guess we have to wait for a new version of the addon with the right env variable.
Maybe anyone can put a little light in the dark?

Thanks Mike

Maybe - my clips are from the 640x480 stream (same as motion detection). Iā€™m on a pi4 4GB so I have been happy enough with those to not really try the high resolution. On my other pi running Magic Mirror it canā€™t do much with the 2k stream even at the lowest settings the 410 offers

Well Iā€™m glad its not just me. I also found that file to revertā€¦ gave up last night after searching all over the place, couldnā€™t find what dynamically generates those containers @blakeblackshear - Any guidance?

Hi, Im having problems installing this and wondered if someone can advise please

Ive installed the add-on via the add-on store (Frigate NVR Beta) with a configuration:

detectors:
  coral:
    type: cpu
mqtt:
  host: 192.168.1.63
  topic_prefix: frigatetest
  client_id: frigatetest
  user: admin
  password: password
ffmpeg: {}
cameras:
  doorcam:
    ffmpeg:
      inputs:
        - path: 'rtsp://admin:[email protected]:1240/ch01/1'
          roles:
            - detect
            - rtmp
    width: 1280
    height: 720
    fps: 5

The log output is:

 * Starting nginx nginx
   ...done.
frigate.app                    INFO    : Creating directory: /tmp/cache
frigate.mqtt                   INFO    : MQTT connected
frigate.app                    INFO    : Camera processor started for doorcam: 46
detector.coral                 INFO    : Starting detection process: 43
frigate.app                    INFO    : Capture process started for doorcam: 47

But when I try to add the integration Frigate, I get a error:

Unable to connect to Frigate.
 
Host
http://ccab4aaf-frigate:5000

Im running the latest homeassistant in Proxmox on a NUC and my RTSP stream from the ip camera is a sub stream set to UDP if that makes any difference.

Thanks in anticipation.

You are unable to connect because you are using the beta.
In the address you need to add -beta behind frigate and before the colon.

Thatā€™s done it, thank you @danbutter

@blakeblackshear This addon is really awsome! The beta with the integration and media browser makes all very easy to use. Thank you!