Local realtime person detection for RTSP cameras

I have no Coral… >

Then why have you set your config that you have?

ehm… did I? not on purpose:

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: frigateaddon
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigateaddon
  # 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:
  voordeur:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
    width: 2560
    height: 1440
    fps: 6
  schuurachter:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
    width: 2048
    height: 1536
    fps: 4
objects:
  track:
    - person
    - car

edit: think I did not have this… weird is that when I had 1 cam it worked without this config, when adding the second it did not.

detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu

Ok, next (noob) question…

I do get people and cars here:

Should I also see them when I click on this?
I do only see:

and its always empty?

You must have snapshots or clips enabled for events to be stored in the database.

Thanks! I missed it. Saw 1.9, checked the notes on that and installed. Didn’t even look at 1.7 notes after reading the skip version.

Added snapshot in any possible way into the config file but keep getting:

On what level and where should I place it?

and is only
snapshots:
engough? according to

all other is optional…

sorry for dumb question, out of options.

It would be easier if you could post your frigate.yml config file and we can see the issue and help you…

Remember to remove and passwords etc

here you go:

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: frigateaddon
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigateaddon
  # 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:
  voordeur:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
    width: 2560
    height: 1440
    fps: 6
  schuurachter:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
    width: 2048
    height: 1536
    fps: 4
    # Optional: Configuration for the jpg snapshots written to the clips directory for each event
objects:
  track:
    - person
    - car
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: 300
  # 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

EDIT: to be clear, there is NO snapshot in this config… tried everything but don’t know where or what to put… whatever I try I get that error.

Is there anything that can be done to reduce the delay in the rtmp re-stream? The decoded rtsp input used for the ‘detect’ role is .5-1s behind the source (live camera view)… but the rtmp stream lags 3-4 seconds behind (when viewed via VLC). Given that no decoding/encoding is occuring, I was surprised it isn’t near 1:1 with the detect stream

But what did you try?

  • snapshots: can be at the top level, same as clips: (no indentation)
  • it can also be as a first-level under your camera name, eg:
  schuurachter:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
    width: 2048
    height: 1536
    fps: 4
    snapshots:
      enabled: true
      crop: false

Yes, both tried and both give that error

And what version of Frigate are you using? Make sure you’re updated to the latest.

Latest version addon and (custom) integration.

EDIT:

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: frigateaddon
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigateaddon
  # 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:
  voordeur:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
    width: 2560
    height: 1440
    fps: 6
  schuurachter:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
    width: 2048
    height: 1536
    fps: 4
    snapshots:
      enabled: true
      crop: false
objects:
  track:
    - person
    - car
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: 300
  # 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 e.g. immediately gives me:

OK… now above config worked… bu only after remove the addon and installing it back…

I will come back if “snapshot is saved” (or not)

Can you adjust how often your camera sends the keyframe/“i-frame”? The ideal number for the lowest latency is the same as your framerate. The default is usually double the framerate, I believe. You don’t want to use a value less than your framerate, though. The Amcrest and Hikvision rebranded cameras I’ve used allow the adjustment and makes it better for me.

I have yeah (and thanks for the suggestion), but as I said there’s near no latency when viewing the ‘detect’ stream, if that makes sense (nor is there when viewing a duplicate feed that Blue Iris is pulling from the camera).

I am also using imou, the url you need to use is :

rtsp://admin:XXXXXXXX@IP_ADDRESS:554/cam/realmonitor?channel=1&subtype=1&unicast=true&proto=Onvif

with XXXXX password being the serial number of your camera

Note Subtype 1 is the h:264 stream while the subtype 0 would be the h:265

I received an Annke c800 camera today. I’ve now spent a few hours trying to configure it, and the detect role works just fine. The problem is that I can’t play the clips using the media browser, it just shows a broken image when I try to load the clip. I can play the clips from my computer from the folder where the clips are saved. Snapshots work. Been trying with both the mainstream and the substream for the clips role. In the web UI the stream flows nicely.

The camera is outputting h.265, and 264 isn’t an option, but from what I understand this should only be a problem with the rtmp-stream, which I don’t use.

Anyone with a (new) Annke c800 or equivalent hikvision camera that got this working?

h265 is not supported in most web browsers. This is expected that they won’t play from the media browser.

I don’t remember off-hand, but I’m pretty sure frigate does not re-encode clips. Check the encoding of the saved files. If they’re h265, you’ll need to adjust the output args to make sure it’s re-encoding to h264

I use Frigate with a C800 turret and it’s working great. My unit has no issues outputting h.264. Perhaps you can update the firmware with the equivalent hikvision firmware.