[SOLVED] Plex doesnt do HW transcoding on Ubuntu 18.04 with i9-9900 (tone mapping related)

Server Version#: 1.22.0.4163
Player Version#:

Hello guys,

i have a little problem with my Plex install on Ubuntu 18.04 with an i9-9900k. I have a Plex pass and also drivers installed and /dev/dri is showing everything right. Every time i start a transcoding stream i get this error in the verbose debug log:

`Mar 23, 2021 12:22:02.294 [0x7f526d7fa700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi`

`Mar 23, 2021 12:22:02.303 [0x7f526d7fa700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi`

`Mar 23, 2021 12:22:02.309 [0x7f526d7fa700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi`

`Mar 23, 2021 12:22:02.313 [0x7f526d7fa700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi`

`Mar 23, 2021 12:22:02.317 [0x7f526d7fa700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi`

`Mar 23, 2021 12:22:02.320 [0x7f526d7fa700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi`

`Mar
 23, 2021 12:22:02.555 [0x7f52caffd700] DEBUG - [Transcode] TPU: 
hardware transcoding: using hardware decode accelerator vaapi`

`Mar 23, 2021 12:22:02.555 [0x7f52caffd700] DEBUG - [Transcode] TPU: hardware transcoding: zero-copy support present`

`Mar 23, 2021 12:22:02.555 [0x7f52caffd700] DEBUG - [Transcode] TPU: hardware transcoding: using zero-copy transcoding`

`Mar 23, 2021 12:22:02.555 [0x7f52caffd700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi`

`Mar
 23, 2021 12:22:02.558 [0x7f52caffd700] DEBUG - [Transcode] TPU: 
hardware transcoding: final decoder: vaapi, final encoder: vaapi`

`Mar 23, 2021 12:22:02.791 [0x7f52567fc700] DEBUG - TPU: hardware transcoding: enabled, but no hardware decode accelerator found`

`Mar 23, 2021 12:22:02.791 [0x7f52567fc700] DEBUG - Codecs: hardware transcoding: testing API vaapi`

`Mar 23, 2021 12:22:02.791 [0x7f52567fc700] DEBUG - TPU: hardware transcoding: final decoder: , final encoder:`

`Mar
 23, 2021 12:22:06.881 [0x7f52957fa700] DEBUG - 
[Transcode/aa9fn0u0afg7hr40lcynum0w] TPU: hardware transcoding: enabled,
 but no hardware decode accelerator found`

`Mar
 23, 2021 12:22:06.881 [0x7f52957fa700] DEBUG - 
[Transcode/aa9fn0u0afg7hr40lcynum0w] Codecs: hardware transcoding: 
testing API vaapi`

`Mar
 23, 2021 12:22:06.882 [0x7f52957fa700] DEBUG - 
[Transcode/aa9fn0u0afg7hr40lcynum0w] TPU: hardware transcoding: final 
decoder: , final encoder:`

So, some details about my setup:

  • i9-9900k CPU, 32gig ram

  • Plex Pass and also HW acceleration enabled in plex

  • i965-va-driver is installed, output of ls /dev/dri is as following (changed to 777 by myself!):

`drwxrwxrwx 2 root root 80 MƤr 20 02:32 by-path`

`crwxrwxrwx+ 1 root video 226, 0 MƤr 20 02:32 card0`

`crwxrwxrwx+ 1 root video 226, 128 MƤr 20 02:32 renderD128`
  • Kernel is: 5.7.1-050701-generic

Any suggestion why its not using hw transcoding? Ive read, that support for 9900k was changed to new drivers (iHD) drivers back in 2019. But i didnt see any news about support.

1 Like

@MrSliff

Support for the -9xxx CPUs is automatic via the kernel.
You do not need to install custom / manual drivers.
If you did install anything, you might have installed something which breaks it.

Permission changes are not required. I manage that when the installer runs.

Would you please do the following?

  1. Uninstall the package (don’t --purge)
  2. Reinstall the package.
  3. Show me the console output from the installer itself.
  4. Show me the contents of /tmp/plexinstaller.log

Hllo @ChuckPa

Thanks for your reply. Which package do you mean to remove? You mean Plex or the drivers package?

I may have installed these drivers in the past, before i changed the CPU from an i3-8100 to a i9-9900k. But this can be already some years ago and i cannot exactly tell if the drivers were installed automatically or by myself.

I am curious about these ā€˜drivers’ you installed. Who / where/ what did they come from?

As for uninstalling, I am requesting you uninstall PMS itself then re-install that very same package again so I may see what it found.

So, drivers. It may be a Intel Media Driver package.

Here is the Installer log of Plex install:


Vorbereitung zum Entpacken von .../plexmediaserver_1.22.0.4163-d8c4875dd_amd64.deb ...
PlexMediaServer install: Pre-installation Validation.
PlexMediaServer install: Pre-installation Validation complete.
Entpacken von plexmediaserver (1.22.0.4163-d8c4875dd) ...
plexmediaserver (1.22.0.4163-d8c4875dd) wird eingerichtet ...
PlexMediaServer install: PlexMediaServer-1.22.0.4163-d8c4875dd - Installation starting.
PlexMediaServer install: 
PlexMediaServer install: Now installing based on:
PlexMediaServer install:   Installation Type:   Update
PlexMediaServer install:   Process Control:     systemd
PlexMediaServer install:   Plex User:           plex
PlexMediaServer install:   Plex Group:          plex
PlexMediaServer install:   Video Group:         video
PlexMediaServer install:   Metadata Dir:        /var/lib/plexmediaserver/Library/Application Support
PlexMediaServer install:   Temp Directory:      /tmp  (set in Preferences.xml)
PlexMediaServer install:   Lang Encoding:       en_US.UTF-8
PlexMediaServer install:   Intel QSV Hardware:  Found
PlexMediaServer install:   Nvidia GPU card:     Not Found
PlexMediaServer install:  
PlexMediaServer install:   OpenCL library:      Installed
PlexMediaServer install:   Beignet package:     Installed
PlexMediaServer install:  
PlexMediaServer install: Completing final configuration.
PlexMediaServer install: Starting Plex Media Server.
PlexMediaServer install: PlexMediaServer-1.22.0.4163-d8c4875dd - Installation successful.  Errors: 0, Warnings: 0
Trigger für desktop-file-utils (0.23-1ubuntu3.18.04.2) werden verarbeitet ...
Trigger für libc-bin (2.27-3ubuntu1.4) werden verarbeitet ...
Trigger für mime-support (3.60ubuntu1) werden verarbeitet ...

and here the requested plexinstaller.log file content:

# Plex Media Server installation configuration info:  Di 23. MƤr 17:43:08 CET 2021
Init=0
Systemd=1
Custom=0
LinuxContainer=0
NewInstall=0
HaveOverride=0
OverrideFile=""
PlexUser="plex"
PlexGroup="plex"
VideoGroup="video"
AppSuppDir="/var/lib/plexmediaserver/Library/Application Support"
PlexTempDir="/tmp"
LangEncoding="en_US.UTF-8"
ExistingVersion=0
HaveHardware=1
HaveTranscoderPref=1
NeedUser=0
NeedGroup=0
NeedVideo=0
Verbose=1
Running=1
Errors=0
Warnings=0
Havei915=1
HaveNvidia=0
HaveBeignet=1
HaveOpenCL=1
Platform="To Be Filled By O.E.M."
Processor="Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz"
Distro="Ubuntu 18.04.5 LTS"
Kernel="Linux htpc-server 5.7.1-050701-generic #202006071230 SMP Sun Jun 7 12:32:55 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux"
Memory=""

@MrSliff

In your Preferences.xml, do you have VaapiDriver="i965" selected or do you have it in automatic mode?

As of the -9xxx processors, iHD is the driver to select. PMS prefers this by default for those processors.

Driver selection is of primary benefit now on only the J4xxx CPUs with extremely low bitrate video.

For you, this means to not have an overriding VaapiDriver selection in Preferences.xml

So, i checked the Preferences.xml, but it did not contain any option for VaapiDriver.

Just added VaapiDriver=ā€œiHDā€ for testing purposes, but it seemed to not change anything.

Would you please do the following?

  1. Verify you have DEBUG logging enabled, VERBOSE logging disabled (Settings - Server - General - Show Advanced). Save if you make any changes
  2. Start a playback
  3. Let play for 20 seconds then stop
  4. Wait 20 more seconds for logs to flush to disk
  5. Settings - Server - Troubleshooting - Download Logs
  6. Attach that ZIP file here for me to review.

I hope its right and complete. Find the file attached.
Plex Media Server Logs_2021-03-24_08-39-19.zip (5.4 MB)

@MrSliff

I’ve chatted with the transcoder team and have been educated.

I need to update my instructions to you.

The intel i9-9900k requires newer libraries than Ubuntu/Debian release.
Their libraries are ok for -8xxx processors and below.

Please uninstall the Beignet packages if you have them installed.
In their stead , please install these from Intel.

Please install them in the order given as there is a sequence dependency.

Thank you for your suggestions.

I didnt have the Beignet PAckages installed, so i just installed the new intel packages.

Afterwards i restarted the server. But no luck.

What i found out:
Playing a h.264 encoded video and transcode this shows me that it is transcoded very well and HW transcoding is turned on (speed shows around 8.0).
When i try the same with a h.265 encoded 4k/HDR movies it does not use HW transcoding.

Mayber there is the problem to search for.

Edit:

I’ve seen your Post in my Mails before you edited it.

And you are right. When i turn off tone mapping, it works quite well! Transcoding is in hw then.

But i still have beignet installed. Will try to uninstall them later and will post my findings then.

Okay,

so it seems like it its related to tone mapping. When i deactivate tone mapping in the options the streams transcode with hw acceleration.

As i read here:

Plex Media Servers using Intel Coffee Lake or newer processors on Ubuntu require version 20.04 or later.

So it looks like i need to upgrade my OS to Ubuntu 20.04

Is there maybe another way to just update the beignet library or related libraries by building them from source?

Anyways i already wanted to upgrade my server to 20.04. Maybe now the time has come to do it.

I thought you were already 20.04 ?

20.x is required. There is no kernel support for the -10x CPUs in anything prior.

No, as the title says, im still on 18.04 :slight_smile:

18.04 with a i9-9900k

Ok, but thank you anyways very much for your help! We found the solution.

So, we can mark this as solved i think.

Solution: HW Transcode support with tone mapping on 9900k only from Ubuntu 20.04+

You can generate the need .so file for 18.04 so it too can do HW Transcoding with tone mapping

I’m sorry,

I really missed something important

is the iHD distributed by Plex not compatible with the -9xxx CPUs ?

Thanks, i will try this out later.

Actually i tried to do the steps provided in the script already by myself, but seems i didnt have luck.

But i will try again later directly on the machine monitor. Working from remote atm.

I didn’t even know plex distributed a version of the iHD driver.
But as you mentioned before about plex wanting 20.04, I’d assume no.

The only way I was able to get it to work on 18.04 was after I compiled a version for 18.04

This is great information. My heartfelt thanks to everyone.

I’ve pulled this all together and written it up in detail for engineering.

I’ve chatted with the transcoder team and shared details as well.

I’ve done all I can at this point to make them aware of the problem.

Hey, can you give me a hint how you got this working?

I actually compiled the media-driver library manually according to this guide:

But the Problem is, it seems plex is not yet using the new compiled driver. This guide does the same like the script you suggested. I also have the driver installed (i see the date from today), but for example my environment variables seem to be not saved:

# export LIBVA_DRIVERS_PATH=/usr/lib/x86_64-linux-gnu/dri
# export LIBVA_DRIVER_NAME=iHD

works in the first attempt, but it looks it is not persistent.

Edit:

So it looks like my System is already prepared:

libva info: VA-API version 1.11.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_11
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.11 (libva 2.11.0.pre1)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 21.1.3 (cde19e98)
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD

So far so good, but Plex is still struggling with tone mapping turned on (doesnt show any hw transcoding with mapping on)