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

Did you managed to solve this? It works for me when running the docker exec -it command, but same error when using transcoding via Plex in the log.

Error in plex log:

Oct 08, 2023 20:49:00.913 [140475409365816] ERROR - [Req#2c7/Transcode/8dc2d641ca5dca52-com-plexapp-android/2b16246b-cb38-4288-bea6-2cc578025495] [AVHWDeviceContext @ 0x7f50d6ba6380] libva: /config/Library/Application Support/Plex Media Server/Cache/va-dri-linux-x86_64/radeonsi_drv_video.so has no function __vaDriverInit_1_0
Oct 08, 2023 20:49:00.913 [140475411475256] ERROR - [Req#2c8/Transcode/8dc2d641ca5dca52-com-plexapp-android/2b16246b-cb38-4288-bea6-2cc578025495] [AVHWDeviceContext @ 0x7f50d6ba6380] Failed to initialise VAAPI connection: -1 (unknown libva error).
Oct 08, 2023 20:49:00.913 [140475462847288] ERROR - [Req#2c9/Transcode/8dc2d641ca5dca52-com-plexapp-android/2b16246b-cb38-4288-bea6-2cc578025495] Device creation failed: -5.
Oct 08, 2023 20:49:00.913 [140475409365816] ERROR - [Req#2ca/Transcode/8dc2d641ca5dca52-com-plexapp-android/2b16246b-cb38-4288-bea6-2cc578025495] Failed to set value 'vaapi=vaapi:' for option 'init_hw_device': I/O error
Oct 08, 2023 20:49:00.913 [140475411475256] ERROR - [Req#2cb/Transcode/8dc2d641ca5dca52-com-plexapp-android/2b16246b-cb38-4288-bea6-2cc578025495] Error parsing global options: I/O error

Running via docker exec:

docker exec -it -e LIBVA_DRIVERS_PATH=/vaapi-amdgpu/lib/dri -e LD_LIBRARY_PATH=/vaapi-amdgpu/lib plex \
/lib/plexmediaserver/Plex\ Transcoder -hide_banner -loglevel debug -vaapi_device /dev/dri/renderD128
Splitting the commandline.
Reading option '-hide_banner' ... matched as option 'hide_banner' (do not show program banner) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-vaapi_device' ... matched as option 'vaapi_device' (set VAAPI hardware device (DRM path or X11 display name)) with argument '/dev/dri/renderD128'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option hide_banner (do not show program banner) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Applying option vaapi_device (set VAAPI hardware device (DRM path or X11 display name)) with argument /dev/dri/renderD128.
[AVHWDeviceContext @ 0x7f911e43f0c0] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x7f911e43f0c0] libva: Trying to open /vaapi-amdgpu/lib/dri/radeonsi_drv_video.so
[AVHWDeviceContext @ 0x7f911e43f0c0] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x7f911e43f0c0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x7f911e43f0c0] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x36313050 -> unknown.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x30323449 -> yuv420p.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x56595559 -> unknown.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x30303859 -> gray.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x50343434 -> yuv444p.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x41524742 -> bgra.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x41424752 -> rgba.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x7f911e43f0c0] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x7f911e43f0c0] VAAPI driver: Mesa Gallium driver 22.3.6 for AMD Radeon Graphics (renoir, LLVM 15.0.7, DRM 3.49, 6.2.16-3-pve).
[AVHWDeviceContext @ 0x7f911e43f0c0] Driver not found in known nonstandard list, using standard behaviour.
Successfully parsed a group of options.

Hi gang, I’m always getting this error when videos are transcoding, amdgpu.ids: No such file or directory. My CPU is an AMD Ryzen 3 2200G running OpenMediaVault server.

Also, when transcoding my videos have a green/blueish color when they are being transcoded for playing under Mozilla Firefox. Under Jellyfin, the transcoding works great.

Here is my docker compose:

---
version: "2.1"
services:
  plex:
    image: plexinc/pms-docker:plexpass
    container_name: plex
    network_mode: host
    environment:
      - PUID=1000
      - PGID=100
      - VERSION=docker
      - TZ=America/Toronto
    volumes:
      - /srv/dev-disk-by-label-DOCKER2/Docker2/Plex/config:/config
      - /srv/51c31dd0-b1ae-4e36-8d01-b9a58a87d2f6/Media01/Videos/TV:/tv:ro
      - /srv/51c31dd0-b1ae-4e36-8d01-b9a58a87d2f6/Media01/Videos/Movies:/movies:ro
      - /srv/51c31dd0-b1ae-4e36-8d01-b9a58a87d2f6/Media01/Videos/Downloads:/downloads:ro
      - /srv/51c31dd0-b1ae-4e36-8d01-b9a58a87d2f6/Media01/Music:/music:ro
      - /dev/shm:/transcode
    devices:
      - /dev/dri:/dev/dri  # for hardware transcoding
    restart: unless-stopped
    labels:
      - "com.centurylinklabs.watchtower.monitor-only=true"
      - "deunhealth.restart.on.unhealthy=true"

Let me know if more information is required.

Any help would be great. Thanks.

Hey,

My Plex Server:
1.32.7.7571-13cdc68dc
September 27, 2023

Running on
OS: Kubuntu 23.04 x86_64
Kernel: 6.2.0-35-generic

With Hardware
CPU: AMD Ryzen 7 2700 (16) @ 3.200GHz
GPU: AMD ATI Radeon RX 6900 XT
Memory: 39002MiB / 96479MiB

Now supports HardWare transcoding flawlessly for 4K to 1080p, while leaving the CPU at rest.

First of all, this is really really cool.

Now I’m pushing it a bit: when I activate Tone Mapping HDR ON.
Then the stream starts stuterring every fifteen seconds. If I pause the stream, it will stop stuttering for a while then will start again.

The CPU is at rest and GPU is between 10 and 20%; so there is plenty of hardware left to utilize, yet it stutters.

I understand this is already quite a feat that it works and AMD aren’t really supported. But given the tremendous progress made until now, what would it take to go to that last bit: supporting HDR Tone Mapping.

As let’s be honest here, 100% of my 4K content is HDR, and looks grey and washed out without tone mapping (and actually looks very good with tone mapping, but it stutters so much it’s impossible to watch).

Thank you so much for the work until now, and hopefully we see the final details finalized very soon !

Let me know if I can be of help, I am a technical person.

KR,
Paul.

I am also seeing the green color when hardware transcoding on a an AMD Ryzen processor.

I disabled HDR tone mapping just in case, but so far that hasn’t fixed this issue.

Am I right in understanding that without manual work and potential issues, hardware transcodes on AMD hardware are still not supported?

No, this is working now by default. There are a few minor issues with it, I don’t think HDR tone mapping is working properly. (yeah just confirmed that HDR Tone Mapping still leads to green screen). But the official plex docker container now supports AMD transcoding using VAAPI.

1 Like

Do you know when support for HDR Tone Mapping will be released?

2 Likes

HDR tone mapping is really mandatory for migrating a linux server from Intel to AMD.
Is there any ETA ? Or is it at least planned with someone actually assigned to this issue ?

1 Like

Kaveri APU with amdgpu driver instead of Radeon can transcode one 4k video file to 1080p. Amazing :laughing:

Any news regarding this?

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.