Local realtime person detection for RTSP cameras

Hy. Anybody can tell me what is the config for hwaccel args for Home Assistant Blue?
I can’t figure out.

THX for the help.

After update 2021.12 directly got:

Logger: homeassistant.setup
Source: setup.py:153
First occurred: 21:14:47 (1 occurrences)
Last logged: 21:14:47

Setup failed for frigate: Unable to import component: cannot import name 'HTTP_BAD_REQUEST' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)

image

1 Like

I haven’t reviewed my logs in a while so it may be something related to some update.
What are the following errors?

2021-12-11T22:15:17.494893145Z [2021-12-11 17:15:17] watchdog.basement              ERROR   : FFMPEG process crashed unexpectedly for basement.
2021-12-11T22:15:17.494958238Z [2021-12-11 17:15:17] watchdog.basement              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2021-12-11T22:15:17.495082391Z [2021-12-11 17:15:17] watchdog.basement              ERROR   : You may have invalid args defined for this camera.
2021-12-11T22:15:17.495225121Z [2021-12-11 17:15:17] ffmpeg.basement.detect         ERROR   : [segment @ 0x55ec222f6200] Non-monotonous DTS in output stream 0:0; previous: 20725, current: 20725; changing to 20726. This may result in incorrect timestamps in the output file.
2021-12-11T22:15:17.495347913Z [2021-12-11 17:15:17] ffmpeg.basement.detect         ERROR   : [segment @ 0x55ec222f6200] Non-monotonous DTS in output stream 0:0; previous: 20726, current: 20726; changing to 20727. This may result in incorrect timestamps in the output file.

This is my ‘basement’ camera section in the config

  basement:
    snapshots:
      enabled: True
      bounding_box: True
    ffmpeg:
      inputs:
        - path: rtsp://10.0.0.37/live0
          roles:
            - detect
            - record
    rtmp:
      enabled: False
    motion:
      mask:
        - 223,39,978,49,1599,856,1331,1013,357,1080,1920,1080,1920,0,0,0,0,1080,347,1080
    detect:
      width: 1920
      height: 1080
      fps: 5
    objects:
      track:
        - person
      filters:
        person:
          mask:
            - 223,39,978,49,1599,856,1331,1013,357,1080,1920,1080,1920,0,0,0,0,1080,347,1080

ffmpeg settings

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p

I also tried the following

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - qsv
    - -qsv_device
    - /dev/dri/renderD128

Good Evening,

Hope everyone’s doing well this holiday season. I’m have a minor issue after updating today and am hoping someone can point me in the right direction.

I updated core to 7.0 and supervisor to 2021.12.1 and now I can’t use/toggle any of the motion switches generated by the Frigate integration. The switches are responsive to the state I set through Frigate proxy or if I change the state by logging into Frigate server itself. I’m running the current stable arm7 version of Frigate on another Pi.

These are the only errors I’m seeing in logs referencing Frigate. All other MQTT switches are working.

Thank You!

2021-12-12 17:53:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform frigate.sensor: Platform not found (cannot import name ‘Message’ from ‘homeassistant.components.mqtt.models’ (/usr/src/homeassistant/homeassistant/components/mqtt/models.py)).’

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:103
First occurred: 8:02:37 PM (1 occurrences)
Last logged: 8:02:37 PM

Detected integration that called async_timeout.timeout with loop keyword argument. The loop keyword argument is deprecated and calls will fail after Home Assistant 2022.2. Please report issue to the custom component author for frigate using this method at custom_components/frigate/api.py, line 90: async with async_timeout.timeout(TIMEOUT, loop=asyncio.get_event_loop()):

In Github someone posted


Confirmed. For others facing this issue, a temporary means of preventing the logspam could be to only allow logging errors (not warnings), although this should be strictly temporary as other deprecations/warnings will be hidden.

logger:
  logs:
    homeassistant.helpers.frame: error

Thanks for the input… apparently I didn’t read enough. Just had to update the integrations :man_facepalming:

Take care!

i has this error in recorings h265 I bought Dahua imou Bullet 2C
anyone with solution

20211213191250.mp4
[2021-12-13 19:13:09] ffmpeg.Doorbell.record_rtmp    ERROR   : [flv @ 0x56263e90b780] Video codec hevc not compatible with flv
[2021-12-13 19:13:09] ffmpeg.Doorbell.record_rtmp    ERROR   : Could not write header for output file #1 (incorrect codec parameters ?): Function not implemented
[2021-12-13 19:13:09] ffmpeg.Doorbell.record_rtmp    ERROR   : 
[2021-12-13 19:13:09] watchdog.Doorbell              INFO    : Terminating the existing ffmpeg process...
[2021-12-13 19:13:09] watchdog.Doorbell              INFO    : Waiting for ffmpeg to exit gracefully...
[2021-12-13 19:13:14] frigate.record                 WARNING : Discarding a corrupt recording segment: Doorbell-20211213191310.mp4

i chaged codex on dahua software smart pss this is easy solution

Hi guys, I would like to ask for your advices here.

I am enjoying frigate addon and integration and it is working on my old macbook5,1 with HA installed on there.
I am staying on frigate addon version 1.14 and integration version 1.12 and this is okay to run on a macbook5,1 , with about 50% - 80% of cpu load, monitoring 3 cameras without a coral USB dongle.

In the past, I considered to upgrade the addon, and tried 2.0, but that resulted in a constant cpu load of over 90%. So I went back to the old versions which was good enough to run without a USB dongle.

Now though with HA 2021.12, the old integration is broken and needs to be upgraded, which forces a addon upgrade to over 2.0 at the same time.

So, I would like to ask to any of you using frigate addon now version 2.3, on an old cpu,
without a dongle, and how is it running?

Thank you in advance!

1 Like

Try the beta addon

@blakeblackshear

Would you please elaborate, of why a beta addon is suggested?
Are the developers working to improve performance on a non-TPU setup?

Thank you.

Yes, the developers (just me at this point) expect performance to improve in the beta version for CPU usage.

The changes introduced in 0.9.x around motion detection were causing increased CPU usage. This was addressed in the upcoming 0.10.x release, so I would expect it to be better.

1 Like

Thanks much for the explanation. I will try the beta addons.

@blakeblackshear

I am trying 3.2 beta now.
Tweaking the parameters in the motion section inside frigate.yml,
but I still cannot find a good combination of parameters for
better motion detection quality/ fair cpu load , which I had on 1.1.4 addon.
I already adjusted width/height to the camera I have and I don’t use birdseye, rtmp.
Setup to detect person only.

So the sensitive parameters, threshold is set to 50 and contour_area 400,
this kind a match the cpu load that I have got for 1.1.4, but detection quality is lower than it was.
delta_alpha and frame_alpha is default value.

What was the default motion parameters set prior to 1.1.4 versions?
I didn’t change those parameters then so it was removed from the my old frigate.yml,
so cannot compare by myself.

Thank you for your support.
I really love this addon.

The old defaults would have been frame_height / 6 for the frame_height value and 100 for contour_area. The defaults for the beta version should require less CPU without sacrificing any noticeable sensitivity for most people.

There are several other reasons you could be seeing different CPU usage, but this was definitely one thing driving up CPU for many users.

If this doesn’t get you reasonably close to previous versions, I would suggest opening an issue on Github. This is about as far as I can go with support here.

Appreciate your support.
I have also found the old defaults via your GitHub, source for 0.84, and I can see the old defaults are the same compared with the new defaults.
I will experiment a bit more to see if I can find a better result.
Thank you.

i did the full OS and HA update and everything worked after update minus frigate. I googled it and updated the config. It would be nice to keep the current config in the future as it is lot of extra work to fix, re-edit the config when you have 10+ cameras. Of course you could expand the config with new functions but the existing should stay as now. @blakeblackshear

Hey did You resolve this ?
Theoretically HA addons are capable of running enviromental variables but after adding environment: to ma frigate.yml I have:

*************************************************************
*************************************************************
***    Your config file is not valid!                     ***
***    Please check the docs at                           ***
***    https://docs.frigate.video/configuration/index     ***
*************************************************************
*************************************************************
***    Config Validation Errors                           ***
*************************************************************
1 validation error for FrigateConfig
environment
  extra fields not permitted (type=value_error.extra)
*************************************************************
***    End Config Validation Errors                       ***
*************************************************************

@tmjpugh @madface @lawrence-jeff Ok so let`s have “we do not read docs from begginig to end” I would like to admin that I often read only begining an end and sometimes middle of it.

# Optional: set environment variables
environment_vars:
  EXAMPLE_VAR: value

Cannot confirm if it works because I have not finished my setup but at least it is not showing up as an error.

1 Like

Hello

I installed Frigate as docker on my Unraid server since it has more power than my HA-running pi. Is there a way to install frigate addon on Home Assistant to give me all the entities, but connect it to Frigate instance on Unraid, instead of running it locally? Thanks

1 Like