Closed rb2k closed 3 years ago
I connected to the container and ran:
apt update
apt install mesa-va-drivers
and it seems to have stopped crashing and is working. Not 100% sure how I can verify that it is indeed using hardware acceleration though :)
Not the best picture, but it seems to be working:
So installing that driver and setting the env var is all you need? Should be easy enough to add the driver to the build.
Yes, that is all I had to do (aside from the yaml config entry)
I can 'fix' the container by running
apt update; apt install -y mesa-va-drivers
Having it in the build would be great!
This works great now btw. Closing the issue.
Would you be willing to share your config.yml for this setup? I am working on setting it up and not finding much documentation on hardware acceleration with Ryzen CPUs with integrated GPU.
There's not a lot that you have to do:
Set ffmpeg
ffmpeg:
hwaccel_args: preset-vaapi
Make sure your docker container has device /dev/dri/renderD128 forwarded (and that it exists on your system)
Set LIBVA_DRIVER_NAME environment variable for your docker to 'radeonsi'
Would you be willing to share your config.yml for this setup? I am working on setting it up and not finding much documentation on hardware acceleration with Ryzen CPUs with integrated GPU.
it's all right in the documentation https://docs.frigate.video/configuration/hardware_acceleration#amdati-gpus-radeon-hd-2000-and-newer-gpus-via-libva-mesa-driver
I feel like I am missing something obvious, but this is what I have in my configs:
config.yml
devices:
- /dev/bus/usb:/dev/bus/usb
- /dev/dri/renderD128:/dev/dri/renderD128
environment:
LIBVA_DRIVER_NAME: radeonsi
docker_compose
cameras:
FrontEast:
ffmpeg:
hwaccel_args: preset-vaapi
errors:
[2023-04-24 14:34:30] ffmpeg.FrontEast.detect ERROR : [NULL @ 0x561b63a29c80] Unable to find a suitable output format for 'preset-vaapi'
[2023-04-24 14:34:30] ffmpeg.FrontEast.detect ERROR : preset-vaapi: Invalid argument
[2023-04-24 14:34:33] frigate.video ERROR : FrontEast: Unable to read frames from ffmpeg process.
[2023-04-24 14:34:33] frigate.video ERROR : FrontEast: ffmpeg process is not running. exiting capture thread...
[2023-04-24 14:34:40] watchdog.FrontEast ERROR : Ffmpeg process crashed unexpectedly for FrontEast.
[2023-04-24 14:34:40] watchdog.FrontEast ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
I confirmed that /dev/dri/renderD128 does exist on my server and mesa-va-drivers is installed.
@y2kdread looks like you are not running frigate 0.12, you are probably on 0.11.
@NickM-27 you are right, I was actually on 0.10. I was pulling from the blakeblackshear/frigate:stable-amd64.
Thanks for the guidance!
2. Make sure your docker container has device /dev/dri/renderD128 forwarded (and that it exists on your system)
I'm using a Synology DS723+ as host for my Frigate it has a CPU AMD Ryzen R1600 and I cannot see any dri folder under dev so probably I need to admit that I don't have GPU :( On the other hand at the AMD web page announces those CPUs with 3 Vega Graphics CU's and 4K encode/decode. Not sure if in my case I should/could do anything.
I'm using also the google Coral, but I guess the GPU is still used/needed at some point, right?
@juagicre Same here. If you've found a solution please let me know
@juagicre @stefankleff did you found out any solution for hwaccel_args
in DS723+?
The R1600 in newer synology models does not have a GPU.
There are different versions of the R1600 series that do, e.g. https://www.amd.com/en/product/8426 , but not the one Synology used
@rb2k does it mean that there is no way for hwaccel_args
on DS723+ and better not use DS723+ at all? (Obviously I have one and do not want to change :/)
Yes, there is no hardware that would accelerate the video decoding/encoding from what I understand. You might still be able to get a few streams going, but it’s a pretty slow CPU, so don’t expect miracles
For now i'm using no argument for that, true. Anyway for now with Coral and 1 camera it does not have any CPU peak. What I read from this CPU is that it has integrated some sort of GPU, but, probably a weak one, but it's a multimedia server, so I believe is not that weak... and also for now i got no bottlenecks, and I expect to setup some more cameras, so if I remember I can set here my impressions.
I've done the same and it's working pretty good. The problem I had originally was that I was using frigate as addon in HA with Virtual Machine and the interference speed was really high. I changed frigate to be container and interference speed is now reasonable at 30ms.
Describe the bug A lot of the AMD Ryzen APUs have an integrated GPU that can be used to accelerate video.
Usually I would have expected to use this env far:
LIBVA_DRIVER_NAME=radeonsi
But it turns out, the container doesn't have it which causes ffmpeg to crash:
On my host system you can see the radeonsi drivers:
This is where they come from:
I can successfully encode:
or decode:
I forwarded /dev/dri/ to the container.
Version of frigate latest docker
Config file Include your full config file wrapped in triple back ticks.
Computer Hardware