Hardware Transcoding (Clean Linux install)

Server Version#:18.04
Player Version#: 3.95.2

Hey there people,

So i recently got the lifetime plex pass and wanted to get the most of it i guess and that is with hardware trancoding.

I am currently running Ubuntu 18.04 and plex runs smootlhy.

The issue that i have is that it will not use hardware transcode.

I know that my cpu/gpu is capable of doing that because with windows 10 it was using the hardware transcode.

What i did so far is install the Radeon R7 260X drivers and enable the hardware transcode in plex.

But i am unable to get it to run.

I looked at the console and the one thing i was able to see was this:
Debug — TPU: hardware transcoding: final decoder: , final encoder:

I have attached the logs as well.

If anyone is able to help it would be much appreciated.

Plex Media Server Logs_2019-06-10_18-43-19.zip (5.5 MB)

The GPU is an i5-4440. That’s enough for HW transcoding.
Radeon HW transcoding (nor any AMD transcoding) isn’t yet supported. We need to wait for MESA support which will be some time.

Please check:

  1. ls -la /dev/dri - You should see renderD128 and others. These should be a member of group video. If not video, take note of which group is assigned and:
  2. groups plex - to see if PMS picked up the correct video group. It should have.

Subtitles will always be CPU transcoded because the GPU doesn’t support it.

Lastly, Certain codecs do not have HW transcoding support. Can you provide the media section of the XML (Get Info -> View XML) which shows which codecs are in use?

Here are the resaults of : ls -la /dev/dri

root@media:~# ls -la /dev/dri
total 0
drwxrwxr-x 3 root root 100 Jun 10 17:02 .
drwxr-xr-x 20 root root 4280 Jun 10 17:02 …
drwxrwxr-x 2 root root 80 Jun 10 17:02 by-path
crwxrwxr-x 1 root video 226, 0 Jun 10 17:02 card0
crwxrwxr-x 1 root video 226, 128 Jun 10 17:02 renderD128

And for groups plex:

root@media:~# groups plex
plex : plex root video

And here is the codec info of the movie i tested on the previous logs as well:

Codec info.txt (10.5 KB)

That should be 100% fine. My only concern is the Radeon.

Did you install Radeon display drivers? It shouldn’t have had an impact but I’m not versed in in what the Radeon drivers might do.

I installed the drivers from here:
https://www.amd.com/en/support/graphics/amd-radeon-r7-series/amd-radeon-r7-200-series/amd-radeon-r7-260x

Can i run a command for you to see ?

Otherwise what would you need to see what the issue might be ?

Command sudo vainfo to see if the drivers are visible.
Plex brings its own. If you see MESA, then the AMD drivers have taken over. I do not know how to correct that.

That command does not exist according to ubuntu, something else maybe ?

Edit:

Nevermind here are the results:

error: can’t connect to X server!
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Mesa Gallium driver 18.3.0-rc4 for AMD Radeon R7 200 Series (BONAIRE, DRM 3.30.0, 4.15.0-51-generic, LLVM 7.1.0)
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileNone : VAEntrypointVideoProc

This has me stumped.

I have a gt-620m mounted on the motherboard.

[chuck@lizum ~.108]$ sudo vainfo
error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/nouveau_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileNone                   :	VAEntrypointVideoProc
[chuck@lizum ~.109]$ vainfo
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/nouveau_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileNone                   :	VAEntrypointVideoProc
[chuck@lizum ~.110]$ sudo vainfo
error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/nouveau_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileNone                   :	VAEntrypointVideoProc
[chuck@lizum ~.111]$ 

Stupid question time:

  1. Does the CPU ASIC (iGPU) work without the Radeon installed?
  2. Would it be difficult to pull the card and test with the Radeon out?

I ask because Windows rendering is completely different than Linux.

For your first question i have no idea, regarding for your second i will be able to take the card out later on, what would you like me to do when i take the card out ?

When you take the card out, the AMD drivers should not load (nothing found).

Try a hardware transcode at that point as well as obtain the listing of /dev/dri again.

It should report:

[chuck@lizum ~.111]$ ls -la /dev/dri
total 0
drwxr-xr-x   3 root root        100 Jun  9 19:02 ./
drwxr-xr-x  22 root root       4480 Jun  9 19:02 ../
drwxr-xr-x   2 root root         80 Jun  9 19:02 by-path/
crw-rw----+  1 root render 226,   0 Jun  9 19:02 card0
crw-rw----   1 root render 226, 128 Jun  9 19:02 renderD128
[chuck@lizum ~.112]$ 

If it does, and there still no HW transcode, uninstall the AMD drivers, reboot and try one last time.

That failing, the motherboard itself must have it disabled in the firmware (BIOS / UEFI)

I will try it and let you know

Ok some weird things are happening now.

First of all as soon as i removed the radeon card my network configuration was no more good as ubuntu decided to rename the nic from enp3s0 to enp2s0.

Then i looked at the /dev/dri and it did not change:

total 0
drwxr-xr-x 3 root root 100 Jun 11 08:56 .
drwxr-xr-x 20 root root 4180 Jun 11 08:56 …
drwxr-xr-x 2 root root 80 Jun 11 08:56 by-path
crw-rw---- 1 root video 226, 0 Jun 11 08:56 card0
crw-rw---- 1 root video 226, 128 Jun 11 08:56 renderD128

But it is using hw transcode now according to dashboard of plex here is the photo:

PNG

But to be safe i have uploaded the logs again in order for you to look at as i have no clue where to search.

Plex Media Server Logs_2019-06-11_09-03-42.zip (3.3 MB)

So i guess that ubuntu at least (no idea for other distros) does no like the idea of having a the radeon.

Correct. You now have Hardware Support.

Library/Application Support/Plex Media Server/Cache/Transcode/Sessions/plex-transcode-dj8dpo8o0ri0igmrcuu86kk1-d3701ca6-c9e2-4c59-b4e4-e3076b0b9c15/temp-0.srt]
Jun 11, 2019 09:00:53.077 [0x7fecd9ffb700] DEBUG - TPU: hardware transcoding: zero-copy support present
Jun 11, 2019 09:00:53.077 [0x7fecd9ffb700] DEBUG - TPU: hardware transcoding: using zero-copy transcoding
Jun 11, 2019 09:00:53.077 [0x7fecd9ffb700] DEBUG - TPU: hardware transcoding: final decoder: vaapi, final encoder: vaapi
Jun 11, 2019 09:00:53.077 [0x7fecd9ffb700] DEBUG - Job running: EAE_ROOT='/tmp/pms-fe2685c4-1baf-4fcf-9112-8a71535f1881/EasyAudioEncoder' FFMPEG_EXTERNAL_LIBS='/var/lib/plexmediaserver/Library/Application\

final decoder: vaapi, final encoder: vaapi

There is no control mechanism in Plex to determine which resource to use.
It must have found your Radeon first and stopped searching further but then disqualified it as not-supported. The same behavior exists with nVidia GPUs in a system. If the nVidia is present and found, the iGPU is ignored.

Well i tried hw transcode and i see that the playback has some sort of blurriness/pixels whereas the normal transcode does not i suppose that is an issue of me not having a strong enough cpu ?

If not are there some settings that i can change in order to get some more juice out of the cpu ?

Hi! I planned to build a small server for plex and other things.
I wanted to buy a 220g or 2200g, but I also wanted the hardware transcoding.
From you post it seems that HW transcoding on AMD gpu on linux is planned right?
An other question: do you know if there is any quality difference between Nvidia and Intel HW transcoding?

Hardware Transcoding on AMD “has been discussed”.
Plex Engineering doesn’t give roadmap info so there is no way of knowing IF (or even WHEN) such a capability might happen.

Normal quality associated with the generation of CPU/GPU that you have. HW transcoding works but doesn’t do well with low bit rate video (under 8Mbps) which for a phone or tablet would not be an issue. If quality is more important then stick with software transcoding otherwise hardware upgrade to Broadwell (6xxx) or later for better results.

I thought so as well, meaning that my cpu is kinda old for HW transcoding.

Since quality is something i care i will go with software transcode untill i get a better cpu.

Would a ryzen 5 2600 do the trick ?

Also i have been searching but i can’t find it is there a command where i can manually kill a stream via terminal?

That is a tough call, the built in GPU on Intel chips for transcoding is just such a value vs buying a more capable AMD to do same number of streams in software transcoding. Software does have the advantage of avoiding codec obsolescence should a new one be released and works with a wider range of bit rates. An i5 or Ryzen 5 are good candidates for 3 to 4 concurrent 1080p streams, the new 3000 chips look promising enough to warrant the additional expense. A 2600 should give you double your current cpu.

As point of order?

Broadwell  = -5xxx => 1080p H264
SkyLake    = -6xxx => 4K SDR HEVC
KabyLake   = -7xxx => 4K HDR HEVC