Frigate addon hardware acceleration

I am using the frigate hassio addon running HA on a AMD computer with vega graphics. I am having issues with RTMP stream being reencoded from a MJPEG camera. I have added the input and put args listed in the Frigate documentation and my camera is properly detecting and recording files. When I try to view the re-encoded rtmp stream it is only outputting frames randomly and slowly. I tried to enable hardware acceleration but the frigate docs for AMD/ATI GPU says to add and environment variable LIBVA_DRIVER_NAME=radeonsi to the container. I have tried everything I know how to do and nothing seems to update the LIBVA_DRIVER_NAME from i965 ro radeonsi.

I have tried adding below to my frigate.yml but no luck. When I run the docker command inspect add-on-ccblah-frigate the config still reports i965.
environment_vars:
LIBVA_DRIVER_NAME: radeonsi

Any help or advice would be appreciated.

1 Like

I know it’s been over a year, and I hope you got this figured out.

I was having a similar problem when I migrated from a NUC to a mini PC running a Ryzen 5 with Vega 7 graphics yesterday. (I’m running HASS OS on a Trigkey S5). I kept getting crashing on Frigate and tons of corrupted files on the clips. Turning off hardware acceleration was the only thing that would let the addon start normally. So I was searching the forum for some insight and your post was the only one I could find.

I was struggling to find docker settings for the addon and then I saw way tucked down in the documentation that you just need to put environment_vars in your frigate.yml file, like this:

environment_vars:
  LIBVA_DRIVER_NAME: radeonsi

detectors:
  coral:
    type: edgetpu
    device: usb

ffmpeg:
  hwaccel_args: preset-vaapi
  input_args:
    - -avoid_negative_ts
    - make_zero
  output_args:
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac  

After a save and restart of the addon, it works like a charm. Anyway, like I said, I hope you don’t need this info, but I thought I’d post this solution in case someone else was a bit lost like I was.

4 Likes

Tried the same but Frigate keeps crashing.
I tried to pass in the docker-compose file

  • /dev/dri/card0:/dev/dri/card0

and declared the environment variable like you mentioned, but no luck.
am I missing something? :confused:

This thread was started two years ago - the information in it may be out of date. It might be better to start a new thread in which you can describe your own situation, with a link to this one to provide context if necessary.

The docs tell that hardware acceleration will not work in HA add-on installations because drivers are lacking.

@wryandginger So how did you get that work? It is this a separate Docker container

I don’t know if you’re still having an issue, but I can verify it loaded the drivers for me. It might not work on your individual hardware. I’m running plain old Home Assistant OS version 16. Here’s the beginning of my frigate.yml file as of today:

environment_vars:
  LIBVA_DRIVER_NAME: radeonsi

detectors:
  coral:
    type: edgetpu
    device: usb

ffmpeg:
  hwaccel_args: preset-vaapi
  input_args: preset-http-reolink
  output_args:
    record: preset-record-generic-audio-copy

And here’s the VAInfo Output from within Frigate:

vainfo: VA-API version: 1.22 (libva 2.10.0)
vainfo: Driver version: Mesa Gallium driver 22.3.6 for AMD Radeon Graphics (renoir, LLVM 15.0.6, DRM 3.61, 6.12.23-haos)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileHEVCMain10             :	VAEntrypointEncSlice
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile2            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc

Currently using 87% of gpu memory an 1% gpu usage at idle.