question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AMD Ryzen hardware acceleration not supported

See original GitHub issue

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:

root@edd635788772:/opt/frigate# ls /usr/lib/x86_64-linux-gnu/dri/
i965_drv_video.so
iHD_drv_video.so

On my host system you can see the radeonsi drivers:

$ ls -lash /usr/lib64/dri/
total 243M
   0 drwxr-xr-x 1 root root  424 Nov 22 19:23 .
   0 drwxr-xr-x 1 root root  37K Nov 24 13:14 ..
 14M -rwxr-xr-x 4 root root  14M Nov 12 14:07 i915_dri.so
 14M -rwxr-xr-x 4 root root  14M Nov 12 14:07 i965_dri.so
 21M -rwxr-xr-x 8 root root  21M Nov 12 14:07 iris_dri.so
 21M -rwxr-xr-x 8 root root  21M Nov 12 14:07 kms_swrast_dri.so
9.0M -rwxr-xr-x 3 root root 8.9M Nov 12 14:07 nouveau_drv_video.so
 14M -rwxr-xr-x 4 root root  14M Nov 12 14:07 r200_dri.so
 21M -rwxr-xr-x 8 root root  21M Nov 12 14:07 r300_dri.so
 21M -rwxr-xr-x 8 root root  21M Nov 12 14:07 r600_dri.so
9.0M -rwxr-xr-x 3 root root 8.9M Nov 12 14:07 r600_drv_video.so
 14M -rwxr-xr-x 4 root root  14M Nov 12 14:07 radeon_dri.so
 21M -rwxr-xr-x 8 root root  21M Nov 12 14:07 radeonsi_dri.so
9.0M -rwxr-xr-x 3 root root 8.9M Nov 12 14:07 radeonsi_drv_video.so
 21M -rwxr-xr-x 8 root root  21M Nov 12 14:07 swrast_dri.so
 21M -rwxr-xr-x 8 root root  21M Nov 12 14:07 virtio_gpu_dri.so
 21M -rwxr-xr-x 8 root root  21M Nov 12 14:07 vmwgfx_dri.so

This is where they come from:

$ rpm -q --whatprovides /usr/lib64/dri/radeon*
Mesa-dri-20.2.2-266.1.x86_64
Mesa-dri-20.2.2-266.1.x86_64
Mesa-libva-20.2.2-266.1.x86_64

I can successfully encode:

ffmpeg -i input.mp4 -vaapi_device /dev/dri/renderD128 -vcodec h264_vaapi -vf format='nv12|vaapi,hwupload' output.mp4

or decode:

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -i rtsp://192.168.30.176/live0 derp.mp4

I forwarded /dev/dri/ to the container.

Version of frigate latest docker

Config file Include your full config file wrapped in triple back ticks.

  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128

Computer Hardware

  • OS: openSUSE Tumbleweed
  • CPU/GPU: AMD Ryzen 3400g
  • Virtualization: nope
  • Coral Version: USB
  • Network Setup: Wired

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
blakeblackshearcommented, Nov 24, 2020

So installing that driver and setting the env var is all you need? Should be easy enough to add the driver to the build.

0reactions
rb2kcommented, Jan 23, 2021

This works great now btw. Closing the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

hardware acceleration is broken since 22.7.1 : r/Amd - Reddit
In AMD Adrenalin go to Settings->Graphics->Wait for vertical refresh->Off, unless application specifies (If you set it to "Always Off" this bug ...
Read more >
Fix: VT-X/AMD-V Hardware Acceleration is Not Available on ...
In this case, accessing the BIOS settings and enabling VT-x/AMD-V will resolve the error message and allow you to run virtual machines.
Read more >
Can't activate hardware acceleration using windows 10 family ...
I would like to create a virtual device in Android Studio but I can't because hardware acceleration is disabled. It actually is enabled...
Read more >
The amd drivers are all broken. Hardware accelerat...
First of all, here's my configuration: AMD Ryzen 5 5600X AMD 6700. ... Again, disabling hardware acceleration seems to solve the problem.
Read more >
Configure hardware acceleration for the Android Emulator
AMD Virtualization (AMD-V, SVM) extensions. Most modern processors support these virtualization extensions. If you're not sure whether your processor supports ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found