Got HW Transcoding to work with libva/vaapi on Ryzen APU (Ryzen 7 4700U)

I checked to make sure I wasn’t completely talking out my xxxhat :slight_smile:

  1. Driver version info
  2. It’s not blacklisted.
  3. Rendering surface created
  4. It can’t render what it wants on it (either target codec & resolution -or- asking it to burn subtitles)
  5. It falls back to SW

Beyond that, I’m afraid you’re ahead of me.

I’m a few months behind at this point. (waiting for mobo to arrive for a E5-2690v3 build to start)

6 Likes

The AMD users around here appreciate you following up with the Transcoder team. Thanks a bunch!

11 Likes

Yes, thank you, thank you, thank you, @ChuckPa ! At least if I could spin up a fixed version of PMS in a Linux VM, I might be able to get a workaround going here. That would be totally ideal and riddled with other issues to work around, but the Windows version itself has issues with hardware encoding with a subset of Video Core Next (Ryzen 4000 and later, 1st Gen Navi and later).

1 Like

Any update about this? I’d love to be able to hw transcode with my 5600G APU running Linux.

We’re still blocked on getting the actual transcoding to work on latest Plex versions. HW accelerated decoding still works fine.

Bi-weekly update: still working to iron out transcoding issues. @ChuckPa any update yet from the transcoder team?

1 Like

Correction. I just managed to do a spritsail based container build (all musl based) build of Plex 1.24.4.5081.

Initialisation of the transcoder for decoding and re-encoding is now working as expected. I confirmed GPU usage via radeontop.

Screenshot 2021-10-19 142150
Screenshot 2021-10-19 142312

I’ve made the container available at Docker Hub
Even HDR tone-mapping seems to work (altough I only tested this briefly)

5 Likes

I am very much in the dark about what the team might be doing, sorry.

Normally I have some insight. At present, I do not.

I have been rather busy on other tasks. I’ll see what I can find out. If report worthy, I’ll post back.

1 Like

Any insight is appreciated, however no longer that urgent, seems transcoding on AMD platforms seems to be back working both ends (en- and decoding). Overall this is great for all AMD users out there.

2 Likes

Is there a Dockerfile available somewhere?

I’ll be uploading this to Github as soon as I have a minute

3 Likes

Dockerfile is here: GitHub - mauimauer/spritsail-plex-media-server: Worlds smallest Docker image for Plex Media Server, built on spritsail/busybox
Uses spritsail’s alpine base image, the only modification there is to use Alpine edge to ensure latest mesa drivers. GitHub - mauimauer/spritsail-alpine: Alpine Linux base image, tweaked from library/alpine

4 Likes

@mauimauer I have been watching this thread for a few weeks now. Thanks for sticking with this, I appreciate all the work you have done in this space.

I’m having issues getting HW acceleration working using your new container. This is what my logs are showing:

Oct 20, 2021 06:04:09.593 [0x7f22b32f6b38] DEBUG - [Transcode] We’re going to try to auto-select an audio stream for account 1.
Oct 20, 2021 06:04:09.593 [0x7f22b32f6b38] DEBUG - [Transcode] Selecting best audio stream for part ID 20900 (autoselect: 0 language: en)
Oct 20, 2021 06:04:09.593 [0x7f22b32f6b38] DEBUG - [Transcode] Audio Stream: 43791, Subtitle Stream: -1
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Codecs: testing h264_nvenc (encoder)
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Codecs: hardware transcoding: testing API nvenc
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Unknown error occurred
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Codecs: testing hevc (decoder) with hwdevice vaapi
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Generic error in an external library
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Codecs: testing hevc (decoder) with hwdevice nvdec
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Codecs: hardware transcoding: testing API nvdec
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Unknown error occurred
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Scaled up video bitrate to 109359Kbps based on 4.500000x fudge factor.
Oct 20, 2021 06:04:09.594 [0x7f22b32f6b38] DEBUG - [Transcode] Scaled maximum bitrate for resolution reduction to 69989Kbps.
Oct 20, 2021 06:04:09.595 [0x7f22b32f6b38] DEBUG - [Transcode] MDE: Selected protocol dash; container: mp4

product: AMD Ryzen 5 3400G with Radeon Vega Graphics

Running
Ubuntu 20.04

I can run this native outside of the container also if you think that will perform better? Sometimes that layer of abstraction isn’t really worth it especially when I’m already running linux.

Thank You

-Marc

Hi!

Working smooth here with 4k HDR file. Great job!!!

Same CPU (AMD Ryzen 5 3400G with Radeon Vega Graphics) but on Unraid OS (6.9.2)

1 Like

Have you passed trough /dev/dri to your container?

Great to see it working for you as well

Thanks that was it. I still see the plex media transcoder taking up a 250% CPU. Is that normal?

Thank you so much @mauimauer for the effort you put into this!
So now, when maintaining my own installation, I have to copy more/different files? Link

In theory yes, but you might encounter problems if the distribution in your container uses glibc, the dependencies being pulled in by the AMD mesa drivers might looks different then.

That does not seem normal. I get 20% usage as a maximum when transcoding 4K HDR material. Much less for anything in 1080p. My APU is a 4700U.

You also might want to try monitoring if the GPU is really active by using radeontop (a very useful tool to monitor graphics core usage on AMD platforms)