HW transcode problems with Kaby Lake

Server Version#: 1.29.2.6273
Player Version#: Apple TV 8.14

I’ve been having trouble getting transcoding fully working in my Ubuntu 22.10 LXC container. Started with the latest PMS version and once I eliminated passthrough issues, I tracked down some posts that matched what my logs were indicating and all those pointed toward downgrading to 1.29.2.

Once I did so, HW transcoding started working again except for any of my 4k content. I know Kaby Lake is capable of HW acceleration for HEVC 10-bit and I now know that my passthrough setup is correct. But I’m hitting a wall and haven’t been able to figure out what the logs are trying to tell me now.

Attached output from a transcode attempt below.

Thanks!

Plex Media Server.log.zip (51.5 KB)

May I see the top 4 lines of the log file please? (you cut that off)

Apologies! Here’s a full log file ending with another attempt.

I started with a direct play 4k HEVC HDR, then an automatic transcode which selected 4k h264, then a 1080p transcode.

Plex Media Server.log.zip (564.1 KB)

Thanks.

That brought up the unknown variable I was expecting.

Ubuntu 22.10 – I’ve not tested it.

Given that I do see HW what looks like transcoding enabling with vaapi,
what happens when you attempt to play in Plex/web ?

( Asking because the AppleTV is a smart player and will try to offload PMS ; thereby skewing / masking the problem )

Just attempted, same result and same output in the logs.

Screenshot 2023-01-29 at 8.10.08 PM

Edit: forgot to post errors

Jan 30, 2023 02:10:27.377 [0x7f08c9168b38] Error — [Req#211a86/Transcode/5eqmrig7z23g7vb79tevqrrn/d24aede5-b70e-4adf-8c6a-d2551c6a227f] [AVHWDeviceContext @ 0x7f481129e500] Failed to get number of OpenCL platforms: -1001.
Jan 30, 2023 02:10:27.378 [0x7f08ccca7b38] Error — [Req#211aa7/Transcode/5eqmrig7z23g7vb79tevqrrn/d24aede5-b70e-4adf-8c6a-d2551c6a227f] [AVHWDeviceContext @ 0x7f481129e500] Failed to get number of OpenCL platforms: -1001.
Jan 30, 2023 02:10:27.378 [0x7f08c956eb38] Error — [Req#211aa9/Transcode/5eqmrig7z23g7vb79tevqrrn/d24aede5-b70e-4adf-8c6a-d2551c6a227f] [Parsed_hwmap_2 @ 0x7f480dcdb340] Failed to created derived device context: -19.
Jan 30, 2023 02:10:27.378 [0x7f08c79dcb38] Error — [Req#211aad/Transcode/5eqmrig7z23g7vb79tevqrrn/d24aede5-b70e-4adf-8c6a-d2551c6a227f] [Parsed_hwmap_2 @ 0x7f480dcdb340] Failed to configure output pad on Parsed_hwmap_2
Jan 30, 2023 02:10:27.381 [0x7f08cd790b38] Error — [Req#211aaf/Transcode/5eqmrig7z23g7vb79tevqrrn/d24aede5-b70e-4adf-8c6a-d2551c6a227f] Error reinitializing filters!
Jan 30, 2023 02:10:27.381 [0x7f08c77d9b38] Error — [Req#211ab3/Transcode/5eqmrig7z23g7vb79tevqrrn/d24aede5-b70e-4adf-8c6a-d2551c6a227f] Failed to inject frame into filter network: No such device
Jan 30, 2023 02:10:27.381 [0x7f08c7022b38] Error — [Req#211ab4/Transcode/5eqmrig7z23g7vb79tevqrrn/d24aede5-b70e-4adf-8c6a-d2551c6a227f] Error while processing the decoded data for stream #0:0

Give me the log ZIP please. I need more than a snippet.

This looks like driver / passthrough failure.

Failed to inject frame into filter network: No such device

Very sorry, here’s the latest full logs.
Plex Media Server Logs_2023-01-30_02-17-09.zip (5.6 MB)

Thanks. Here’s the important line.

Jan 30, 2023 00:20:42.719 [0x7f08cd790b38] DEBUG - [Req#1fd38f/Transcode/D90B4EFE-1D62-4928-BF8B-54AE2D04310A] TPU: hardware transcoding: final decoder: vaapi, final encoder: vaapi
Jan 30, 2023 00:20:42.719 [0x7f08cd790b38] DEBUG - [Req#1fd38f/Transcode/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/JobRunner] Job running: FFMPEG_EXTERNAL_LIBS='/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Codecs/2427c16-4396-linux-x86_64/' LIBVA_DRIVERS_PATH=/usr/lib/plexmediaserver/lib/dri OCL_ICD_VENDORS="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/CL-ICDs" X_PLEX_TOKEN=xxxxxxxxxxxxxxxxxxxx4326-9cdc-8f889ec9a753 cl_cache_dir="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/Shaders/icr-15-linux-x86_64/" "/usr/lib/plexmediaserver/Plex Transcoder" -codec:0 hevc -hwaccel:0 vaapi -hwaccel_fallback_threshold:0 10 -hwaccel_output_format:0 vaapi -hwaccel_device:0 vaapi -codec:2 dca -analyzeduration 20000000 -probesize 20000000 -i "/data/movies-4K/2001- A Space Odyssey (1968) {imdb-tt0062622}/2001- A Space Odyssey (1968) {imdb-tt0062622} [Remux-2160p HEVC 10bitHDR DTS-HD MA5.1].mkv" -filter_complex "[0:0]hwupload[0];[0]scale_vaapi=w=1920:h=1080:format=p010[1];[1]hwmap=derive_device=opencl[2];[2]tonemap_opencl=tonemap=mobius:format=nv12:m=bt709:p=bt709:r=tv[3];[3]hwmap=derive_device=vaapi:reverse=1[4];[4]hwupload[5]" -map "[5]" -codec:0 h264_vaapi -b:0 13682k -maxrate:0 18243k -bufsize:0 36486k -r:0 23.975999999999999 -force_key_frames:0 "expr:gte(t,n_forced*1)" -filter_complex "[0:2] aresample=async=1:ochl='5.1':rematrix_maxval=0.000000dB:osr=48000[6]" -map "[6]" -metadata:s:1 language=eng -codec:1 libopus -b:1 687k -segment_format matroska -f ssegment -individual_header_trailer 0 -flags +global_header -segment_header_filename header -segment_time 1 -segment_start_number 0 -segment_copyts 1 -segment_time_delta 0.0625 -segment_list "http://127.0.0.1:32400/video/:/transcode/session/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576/manifest?X-Plex-Http-Pipeline=infinite" -segment_list_type csv -segment_list_size 5 -segment_list_separate_stream_times 1 -segment_list_unfinished 1 -segment_format_options output_ts_offset=10 -max_delay 5000000 -avoid_negative_ts disabled -map_metadata:g -1 -map_metadata:c -1 -map_chapters -1 "media-%05d.ts" -start_at_zero -copyts -vsync cfr -init_hw_device vaapi=vaapi:/dev/dri/renderD128 -filter_hw_device vaapi -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576/progress

It’s got the HW transcode decision but can’t talk through to the hardware

Jan 30, 2023 00:20:42.930 [0x7f08cc69eb38] ERROR - [Req#1fd3e1/Transcode/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576] [Parsed_hwmap_2 @ 0x7f5568d7c900] Failed to created derived device context: -19.
Jan 30, 2023 00:20:42.930 [0x7f08d878cb38] DEBUG - Completed: [127.0.0.1:43742] 200 POST /video/:/transcode/session/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576/progress/log?level=0&message=%5BParsed_hwmap_2%20%40%200x7f5568d7c900%5D%20Failed%20to%20created%20derived%20device%20context%3A%20-19. (22 live) 0ms 195 bytes (pipelined: 67) (range: bytes=0-) 
Jan 30, 2023 00:20:42.930 [0x7f08cd790b38] DEBUG - Request: [127.0.0.1:43742 (Loopback)] POST /video/:/transcode/session/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576/progress/log?level=0&message=%5BParsed_hwmap_2%20%40%200x7f5568d7c900%5D%20Failed%20to%20configure%20output%20pad%20on%20Parsed_hwmap_2 (22 live) #1fd3e2 Signed-in Token (joshma403) (range: bytes=0-) 
Jan 30, 2023 00:20:42.930 [0x7f08cd790b38] ERROR - [Req#1fd3e2/Transcode/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576] [Parsed_hwmap_2 @ 0x7f5568d7c900] Failed to configure output pad on Parsed_hwmap_2
Jan 30, 2023 00:20:42.930 [0x7f08d878cb38] DEBUG - Completed: [127.0.0.1:43742] 200 POST /video/:/transcode/session/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576/progress/log?level=0&message=%5BParsed_hwmap_2%20%40%200x7f5568d7c900%5D%20Failed%20to%20configure%20output%20pad%20on%20Parsed_hwmap_2 (22 live) 0ms 195 bytes (pipelined: 68) (range: bytes=0-) 
Jan 30, 2023 00:20:42.940 [0x7f08cb12ab38] DEBUG - Request: [127.0.0.1:43742 (Loopback)] POST /video/:/transcode/session/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576/progress/log?level=0&message=Error%20reinitializing%20filters%21 (22 live) #1fd3e3 Signed-in Token (joshma403) (range: bytes=0-) 
Jan 30, 2023 00:20:42.940 [0x7f08cb12ab38] ERROR - [Req#1fd3e3/Transcode/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576] Error reinitializing filters!
Jan 30, 2023 00:20:42.940 [0x7f08d8589b38] DEBUG - Completed: [127.0.0.1:43742] 200 POST /video/:/transcode/session/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576/progress/log?level=0&message=Error%20reinitializing%20filters%21 (22 live) 0ms 195 bytes (pipelined: 69) (range: bytes=0-) 
Jan 30, 2023 00:20:42.940 [0x7f08cc69eb38] DEBUG - Request: [127.0.0.1:43742 (Loopback)] POST /video/:/transcode/session/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576/progress/log?level=0&message=Failed%20to%20inject%20frame%20into%20filter%20network%3A%20No%20such%20device (22 live) #1fd3e4 Signed-in Token (joshma403) (range: bytes=0-) 
Jan 30, 2023 00:20:42.940 [0x7f08cc69eb38] ERROR - [Req#1fd3e4/Transcode/D90B4EFE-1D62-4928-BF8B-54AE2D04310A/c590ded8-05b1-4ec7-ac95-048df0511576] Failed to inject frame into filter network: No such device

In the container, did you pass all of /dev/dri or just a single renderD128 ?

Also, does the container GID (GID Plex runs as) map the a GID which minimally has RW to the real /dev/dri ?

What you’re seeing is:

  1. It knows it can transcode

  2. the moment it attempts to tone map (the OpenCL) it fails.

This points to full mapping of /dev/dri not being 100% correct

Thanks for the help so far!

I’ve set this in my config for passthrough:

lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file 0 0
lxc.idmap: u 0 100000 65536
lxc.idmap: g 0 100000 999
lxc.idmap: g 999 103 1
lxc.idmap: g 1000 101000 64536

And ls -la gives me this inside the container:

total 0
drwxr-xr-x 2 root   root       60 Jan 27 16:10 .
drwxr-xr-x 7 root   root      500 Jan 27 16:10 ..
crw-rw---- 1 nobody plex 226, 128 Jan 25 20:15 renderD128

As far as I can tell, the GID mapping is correct. I did have to tweak the mapping originally to get HW transcoding working at all, and I’ve assumed it’s correct since then.

See?

You only have renderD128 – the transcoding.

card0 is where the OpenCL is accessed.

I suggest you change your mapping -

/dev/dri/dev/dri

Pass everything through

Look at your system /dev/dri on the command line outside the container.
You want it all inside too.

Okay, I wrestled with the config again to get full /dev/dri passthrough. Didn’t realize that I needed to change create=file to create=dir, but that seems to have cleaned it up.

Here’s the passthrough config:

lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.cgroup2.devices.allow: c 226:0 rwm
lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir 0 0
lxc.idmap: u 0 100000 65536
lxc.idmap: g 0 100000 999
lxc.idmap: g 999 103 1
lxc.idmap: g 1000 101000 64536

And my ls -la /dev/dri output in the container:

total 0
drwxr-xr-x 3 nobody plex      100 Jan 25 20:15 .
drwxr-xr-x 7 root   root      500 Jan 30 03:01 ..
drwxr-xr-x 2 nobody plex       80 Jan 25 20:15 by-path
crw-rw---- 1 nobody plex 226,   0 Jan 25 20:15 card0
crw-rw---- 1 nobody plex 226, 128 Jan 25 20:15 renderD128

Additionally, I changed group ownership on /dev/dri in the host to render to simplify group mapping, so the ls -la /dev/dri on the host now produces:

total 0
drwxr-xr-x  3 root render      100 Jan 25 14:15 .
drwxr-xr-x 23 root root       4880 Jan 27 10:09 ..
drwxr-xr-x  2 root render       80 Jan 25 14:15 by-path
crw-rw----  1 root render 226,   0 Jan 25 14:15 card0
crw-rw----  1 root render 226, 128 Jan 25 14:15 renderD128

getent group render | cut -d : -f3 on the host gives me 103, and that is the GID I have mapped in the lxc.conf as shown above.

As far as I can tell that should have passthrough fully working, but unfortunately I’m running into the same problem and similar errors output. Logs attached below.

Plex Media Server Logs_2023-01-30_03-11-37.zip (1.7 MB)

May I back up and ask a basic question?

What’s your native OS?
Why 22.10 in a LXC ?

First, from the Canonical page: 22.10 is EOL in July.

If you’re going to put PMS in a container (versus native on the host where installation setup is automatic ) then set yourself up for this heartburn you’re having now.

Also, PMS is sufficiently well behaved that you don’t need to containerize it and then manage with LXD .

If you’re using ZFS then you’re going to take a performance hit on I/O which will make the database bog down quickly.

Host OS is Proxmox, I’m using it to run several VMs and getting GPU passthrough and transcoding working in a VM was just not happening, so I opted for the LXC route.

As for 22.10, I chose it for no reason other than it was the first Ubuntu template in the list. I’m aware that support will end in July and wouldn’t say I’m married to the choice in any way. Certainly willing to try it on a 22.04 container if there’s a chance it would clear things up.

Proxmox is a bear with Plex.

Have you looked at all the guides out there? No need to reinvent the wheel.

Lol that much is clear to me now. It works flawlessly for everything else in my stack so it’s been a bummer having to wrestle with Plex so much.

Previously, I had it in a docker container on my unraid server with no transcoding, which was a breeze. The hope was to get it on Proxmox and utilize quicksync with the Kaby Lake box I’ve got. Seems like it’s just on the threshold of 100% functionality and only failing at the OpenCL step with the tone mapping now. That’s my read of it, at least.

This is the guide I got started with: Intel QuickSync passthrough to an unprivileged LXC container running plex. · GitHub

Only change I’ve made from that guide at this point is passing through /dev/dri in it’s entirety and adjusting the group permissions.

There were several guides I followed using a VM with GPU passthrough instead but that just never quite came together. And everything I was reading pointed to LXC being the easier option.

Try flipping the container to privileged. you ARE accessing the hardware at a very low level.

Alright, so I’ve tried several things today with no success on any front. Same errors appearing in the logs, no change as far as I can tell.

  1. Flipped the existing Ubuntu 22.10 LXC to privileged - same error.
  2. Created an unprivileged Ubuntu 22.04 container, otherwise same config and mapping, installed PMS 1.29.2.6273 - same error
  3. Flipped the 22.04 container to privileged - same error.

Attached below are logs from the first two attempts.

22.10
Plex Media Server Logs_2023-01-31_00-18-47.zip (1.9 MB)

22.04
Plex Media Server Logs_2023-01-31_01-09-18.zip (1.9 MB)

ALL.

Because of all the possible permutations involved, We need to reduce this to the least common factor.

  1. PMS server
  2. Plex/Web playback in the browser - Playback quality 20 Mbps - 1080p

If it doesn’t work here, there’s no reason to proceed because the browser makes the server do all the work.

Test 1:

Test 2:

Test 3:

Test 4:

Test 5:

Please reply using:

Distro Name and version:
Graphics card:
Driver version installed:

Test 1: Pass/Fail
Test 2: Pass/Fail
Test 3: Pass/Fail
Test 4: Pass/Fail
Test 5: Pass/Fail

I will compile everyone’s results into a matrix and discuss with Engineering.

Well, happy to report that a brain fart has seemingly solved the problem.

After restoring my 22.10 container as unprivileged, I absentmindedly ran apt upgrade and it pulled PMS 1.30.2.6563. I know for sure that 1.30.2 wasn’t working for me before, because that’s what caused me to downgrade to 1.29.2 in the first place.

However, all of my files seem to be properly utilizing HW transcoding now. No idea what explains this, but it appears something in the process of downgrading to 1.29.2 and then upgrading to 1.30.2 again has solved all of the problems I was having. I’d wager passing through card0 properly was a part of it as well.

Thanks @ChuckPa for all the assistance up to this point!

I do still have my 22.04 container on 1.29.2 that still throws transcode errors if you’d like me to test the clips above and provide results. If not, I’ll probably switch to that one full time since 22.10 is facing end of support in a few months.

Thanks again!

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