Local realtime person detection for RTSP cameras

I asked you how you did it in LXC and you point me to Docker?

Edit: I know there is a snippet for LXC there. But I cant get that working in LXC, hence I currently have an ubuntu vm with Frigate. But I prefer LXC hence my question.

Well if you cant get it working, then post here where are the problems, maybe somebody know how to solve it :slight_smile:

This is leading nowhere… :slight_smile: You are not even answering my question but only sending me back to documentation. I kindly ask for some help on guidance how to setup this on LXC…

1 Like

Ok, concrete question here. I run frigate in an ubuntu VM atm and since coral is not able to deliver I need to use CPU…

my config:

mqtt:
  host: 192.168.1.142
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  topic_prefix: frigate200
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigate200
  # Optional: user
  user: mqtt
  # Optional: password
  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}.
  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'
  password: mqtt
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60
cameras:
  front:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - clips
    width: 2560
    height: 1440
    fps: 6
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
  back:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - clips
    width: 2048
    height: 1536
    fps: 4
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
        - car
  parking:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
    width: 3840
    height: 2160
    fps: 4
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
        - car
    motion:
      mask: 3840,0,3840,625,3840,786,2769,619,2774,357,2132,230,382,169,377,0
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
clips:
  # Optional: Maximum length of time to retain video during long events. (default: shown below)
  # NOTE: If an object is being tracked for longer than this amount of time, the cache
  #       will begin to expire and the resulting clip will be the last x seconds of the event.
  max_seconds: 30
  # Optional: size of tmpfs mount to create for cache files (default: not set)
  # mount -t tmpfs -o size={tmpfs_cache_size} tmpfs /tmp/cache
  # NOTICE: Addon users must have Protection mode disabled for the addon when using this setting.
  # Also, if you have mounted a tmpfs volume through docker, this value should not be set in your config.
  tmpfs_cache_size: 256m
  # Optional: Retention settings for clips (default: shown below)
  retain:
    # Required: Default retention days (default: shown below)
    default: 100
    # Optional: Per object retention days
    objects:
      person: 150

This does “work” but for camera’s back and parking it stops after starting the server (almost immediately… For camera front it keeps working… I see the time in the UI stopping for those cams and going further for the working one…

what can be the issue?

Edit: what is weird though… the image is not updating and the time in the corner is also stopped and not updating… (for those 2 non working cams) but this is "updating’image

EDIT: there seems to be some confusion around my question(s).

I will clarify below.

a. I am not running frigate in an LXC currently (only asking how this can be done).
b. I am running frigate in a ubuntu VM yes.
c. I am (in another instance) running the frigate addon in home assistant (hassos) which works well with 2 cams. But since it takes away all resources from my homeassistant VM I prefer not to run it there as an addon.

Hence I am now trying 2 routes:

  1. Ubuntu VM (I have that running and that is what this post-question is about)
    2. LXC container (on proxmox) (I don’t have that running)

For 2, I asked another question above.
For 2, I keep asking the same question: how to start a frigate instance on LXC. There is only this in the docs: https://blakeblackshear.github.io/frigate/installation#proxmox but I keep getting pointed to the docs…

First of all my thanks to the developer of this excellent app. I successfully have it running on my Raspberry Pi 4B as an add-on to HA and even without a Coral TPU accelerator it is managing to detect @ 5fps on a 640x480 sub stream and create clips on a 2560x1920 main stream. The detection accuracy is amazing and integration with HA a god-send.

I wanted to highlight something to any users of Reolink’s IP cams and in particular the RLC-520A who are experiencing smearing, glitching, or poor performance. Use the RTMP stream instead of RTSP stream, and include ffmpeg arguments as outlined in the docs (https://blakeblackshear.github.io/frigate/configuration/cameras#reolink-410520-possibly-others). This should fix the issues. Details of RTMP url schema can be found online easily.

Thanks again to the dev.

1 Like

I’m running Home Assistant OS with the Add-on. Running on an old i3 intel Nuc. It’s running great althoug high cpu without a coral at the moment.

Problem is that my HA is fast running out of space due to my frigate clips. Is there a way to store these to a USB drive or NAS?

I am mounting an NFS drive and passing it as an argument to docker with -v /mynfsdir:/media/frigate argument. It works mostly - but a couple of time frigate.db got corrupted when stopping frigate. I had to delete the db and restart (which worked for the most part except lost history of clips). I wish there was a separate directory for database vs media.

Problem will be probably somewhere else because this link works for me:

https://xyz.ui.nabu.casa/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/{{trigger.payload_json["after"]["camera"]}}/clip.mp4

The only difference is in “after” instead of “before” for camera name.

Hi, I just installed it and I’m testing uses with a coral usb (I think the last in stock in europe).

I have a very stupid question: how can I delete clips and records from testing recognitions?

To answer my own question:
As some people already mentioned, it is very important to use the actual dimensions of the video input. for example my camera says it records in 640x360 but it is actually in 640x352 (confirmed with VLC snapshot). After adjusting this, the substream is working flawlessly.
For the Reolink E1 Pro it is now working with the following configuration:

  • Detect on RTSP substream (minimal delay < 3 sec) with max. 7 FPS and no input_arguments for ffmepg
  • Clips on RTSP main stream with 4 MP resolution and 20 FPS
  • Hardware: Raspberry Pi 3b - no coral tpu (yet)
1 Like

Try frigate.yml

detectors:
  coral:
    type: cpu

I have 10cameras, with CPU with this settings and everything is fine.
Did you pass through the GPU to the VM? If you have intel you can pass the integrated graphic otherwise you will lost display.

Regarding LXC
Did you try this?

Btw after you will success you will have a problem that you can’t connect frigate to the hass GUI. Which will be useless if you wanted to use frigate inside the HASS like me.
Otherwise th LXC will have it own IP as i understand and you will connect directly to frigate.
Didn’t solved it yet

Yeah, for now i am not able to sort it out, i was writing to several threats.
One pointer is here, but don’t have time now.

That itst possiblee to mount the share before/after container is load. So you can change the media folder for NAS. When/If i will succeed will definetly write there as i see it is the only option. I’m surprised that nobody can just say how to do it rightaway

Evening All, I’ve got a couple of questions regarding frigate:

  1. Is possible to have cameras store files in subfolders? -
    1b) then maybe subfolders for clips and snapshots?
    1c) Is it possible to change the variables for the file name? what are the random letters and numbers at the end of the file name?

  2. A couple of my cameras only stream in h265, and I seem to be unable (tried in edge, chrome and vivaldi) to playback in the browser, I have to navigate and find the files which play without a problem in VLC - is there a way of fixing this?

  3. Is is possible to save the audio stream as well as the video stream?

  4. is it possible to display the 16:9 full stream on the home page, rather than 4:3 of the lower stream, or just force it to display in 16:9 aspect?

I know it’s a lot of questions, but i would really appreciate any help.

It is baby
frigate.yml

database:
  path: /config/frigate.db

Please can you explain how did you pass the argument? where did you and how changed it? Please i am not able to figure this out and trying for many days.
Do you use a seperate docker for frigate and docker for HASSOS? Or you have HASSOS and frigate integration?

Not last baby :smiley:

But its like 85bucks i dont know if its normal price :-E

1 Like

LOL

I took for 80€ include shipping from germany to italy. I know pci cost less but my slot was already occupied.

1 Like

is the coral worth it?

Hi,

question, when i configure 2 RTSP streams

main
width: 2304
height: 1536

sub
width: 1280
height: 720

how i should configure the setting? can be possible to set a different resolution for each stream?

Regards

1 Like

Okay can please somebody help, in const.py can i put remote share and how to be mounted?
Thank you

I finaly able to get inside the container and i am not able to mount remote share.
Any advises?
Thank you <3

root@ccab4aaf-frigate:/opt/frigate/frigate# mount -t nfs 192.168.6.66:/mnt/hoax_volume/hass /media/frigatemount.nfs: access denied by server while mounting 192.168.6.66:/mnt/hoax_volume/hass
root@ccab4aaf-frigate:/opt/frigate/frigate# mount -t cifs -o username=asdf,password=asdf,domain=WORKGROUP,vers=2 //192.168.6.66/3_hass /media/frigate
mount: /media/frigate: cannot mount //192.168.6.66/3_hass read-only.
root@ccab4aaf-frigate:/opt/frigate/frigate# mount -t cifs -o username=asdf,password=asdf,domain=WORKGROUP,vers=3  //192.168.6.66/3_hass /media/frigate
mount: /media/frigate: cannot mount //192.168.6.66/3_hass read-only.
root@ccab4aaf-frigate:/opt/frigate/frigate# mount -t cifs -o username=asdf,password=asdf,domain=WORKGROUP,vers=1  //192.168.6.66/3_hass /media/frigate
mount: /media/frigate: cannot mount //192.168.6.66/3_hass read-only.

I did even make the share accesible for anyone