Preferred HW Transcoder Linux

Server Version#: 1.19.3.2843

I have a NVidia card installed, which works great for transcoding and the one challenge I seem to have is when I update plex, it keeps adding the plex user back to the renderer group which causes it to pick the intel quicksync. I’ve been manually removing the group each time, but trying to figure out a better way than that as I always want it to use the NVidia card.

Is there a better way to handle that than removing the user from the group each time?

User plex is added to the group of the first card found

To manually override the device used, specify HardwareDevicePath="/dev/xxxxxxxxx" in Preferences.xml (while Plex is stopped)

udev should be adding both devices to the same group (render)

I want to make sure I’m translating that right in my brain. I only have 1 "card’ active, but it seems to be picking up the chipset so I see:

crw-rw----  1 root render 226,   0 May 21 13:11 card0
crw-rw----  1 root render 226, 128 May 21 13:11 renderD128
felix@gemini:/dev/dri$

which I believe card0 is the NV card and renderD128 is the chipset (unsure).

01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1) (prog-if 00 [VGA controller])
	Subsystem: Gigabyte Technology Co., Ltd GP107 [GeForce GTX 1050 Ti]
	Flags: bus master, fast devsel, latency 0, IRQ 129
	Memory at de000000 (32-bit, non-prefetchable) [size=16M]
	Memory at c0000000 (64-bit, prefetchable) [size=256M]
	Memory at d0000000 (64-bit, prefetchable) [size=32M]
	I/O ports at e000 [size=128]
	Expansion ROM at 000c0000 [virtual] [disabled] [size=128K]
	Capabilities: [60] Power Management version 3
	Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [78] Express Legacy Endpoint, MSI 00
	Capabilities: [100] Virtual Channel
	Capabilities: [250] Latency Tolerance Reporting
	Capabilities: [128] Power Budgeting <?>
	Capabilities: [420] Advanced Error Reporting
	Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
	Capabilities: [900] Secondary PCI Express
	Kernel driver in use: nvidia
	Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia

So I’d use that and put /dev/nvidia0 in there and that should ‘force’ everything to always be transcoded by the NV card and never by the Intel chipset? What I had noticed is sometimes remote players would grab the chipset transcode and that bogs me down from a system perspective, but when I remove plex from the render group, it still transcodes and always uses the NV card.

Hope that makes sense.

Are Nvidia drivers, minimum version 418.30 installed?
Does the card show as a render device (e.g renderD129) in /dev/dri ?

card0 = physical device 0
renderD128 = rendering surface 0 ( card number + 128 )

This is what I have:

root@gemini:/dev/dri# ls -al
total 0
drwxr-xr-x  3 root root        100 May 20 13:37 .
drwxr-xr-x 21 root root       4380 May 21 16:37 ..
drwxr-xr-x  2 root root         80 May 20 13:37 by-path
crw-rw----  1 root render 226,   0 May 21 13:11 card0
crw-rw----  1 root render 226, 128 May 21 13:11 renderD128

I can see it hw transcoding though:

image

and from the log:

May 21, 2020 19:25:58.091 [0x7f4b93ffb700] DEBUG - TPU: hardware transcoding: zero-copy support present
May 21, 2020 19:25:58.091 [0x7f4b93ffb700] DEBUG - TPU: hardware transcoding: using zero-copy transcoding
May 21, 2020 19:25:58.091 [0x7f4b93ffb700] DEBUG - TPU: hardware transcoding: final decoder: nvdec, final encoder: nvenc
May 21, 2020 19:25:58.092 [0x7f4b93ffb700] DEBUG - Job running: EAE_ROOT='/tmp/pms-c4a225b0-3030-4c0b-a13f-ad7b3d1e4e40/EasyAudioE
ncoder' FFMPEG_EXTERNAL_LIBS='/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Codecs/99c90e0-3095-linux-
x86_64/' XDG_CACHE_HOME='/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache' XDG_DATA_HOME='/usr/lib/ple
xmediaserver/Resources' X_PLEX_TOKEN='xxxxxxxxxxxxxxxxxxxx' '/usr/lib/plexmediaserver/Plex Transcoder' '-codec:0' 'hevc' '-hwaccel
:0' 'nvdec' '-hwaccel_fallback_threshold:0' '10' '-hwaccel_output_format:0' 'cuda' '-codec:1' 'truehd_eae' '-eae_prefix:1' 'vyu0bv
sdu98wlvlzuv57x84h_' '-analyzeduration' '20000000' '-probesize' '20000000' '-i' '/gmedia/Movies/The 5th Wave (2016)/The 5th Wave (
2016).mkv' '-filter_complex' '[0:0]hwupload[0];[0]scale_cuda=w=3058:h=1280:format=nv12[1]' '-filter_complex' '[0:1] aresample=asyn
c=1:ocl='\''stereo'\'':osr=48000[2]' '-map' '[1]' '-metadata:s:0' 'language=eng' '-codec:0' 'h264_nvenc' '-b:0' '35003k' '-maxrate
:0' '46671k' '-bufsize:0' '93342k' '-forced-idr:0' '1' '-r:0' '23.975999999999999' '-force_key_frames:0' 'expr:gte(t,0+n_forced*1)
' '-map' '[2]' '-metadata:s:1' 'language=eng' '-codec:1' 'aac' '-b:1' '256k' '-f' 'dash' '-seg_duration' '1' '-init_seg_name' 'ini
t-stream$RepresentationID$.m4s' '-media_seg_name' 'chunk-stream$RepresentationID$-$Number%05d$.m4s' '-window_size' '5' '-delete_re
moved' 'false' '-skip_to_segment' '1' '-time_delta' '0.0625' '-manifest_name' 'http://127.0.0.1:32400/video/:/transcode/session/vy
u0bvsdu98wlvlzuv57x84h/25844a1e-d12e-4cd9-b295-ac62f653c55d/manifest?X-Plex-Http-Pipeline=infinite' '-avoid_negative_ts' 'disabled
' '-map_metadata' '-1' '-map_chapters' '-1' 'dash' '-start_at_zero' '-copyts' '-vsync' 'cfr' '-y' '-init_hw_device' 'cuda=cuda:' '
-hwaccel_device' 'cuda' '-filter_hw_device' 'cuda' '-nostats' '-loglevel' 'quiet' '-loglevel_plex' 'error' '-progressurl' 'http://127.0.0.1:32400/video/:/transcode/session/vyu0bvsdu98wlvlzuv57x84h/25844a1e-d12e-4cd9-b295-ac62f653c55d/progress'
May 21, 2020 19:25:58.092 [0x7f4b93ffb700] DEBUG - Jobs: Starting child process with pid 305792

so it definitely seems to be working.

and my drivers:

root@gemini:~# nvidia-smi
Thu May 21 19:28:09 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.82       Driver Version: 440.82       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 105...  Off  | 00000000:01:00.0 Off |                  N/A |
|  0%   51C    P0    N/A /  72W |     10MiB /  4032MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

If you look here:

May 21, 2020 19:25:58.091 [0x7f4b93ffb700] DEBUG - TPU: hardware transcoding: final decoder: nvdec, final encoder: nvenc

It’s using the Nvidia to decode and to encode.

Right, which leads me back to my original question. If I add the plex user to the render group, it will use the intel quicksync rather than that.

I can remove the group but each time I update, I have to do that and was trying to find a permanent solution to that.

Plex always prefers Nvidia over QSV. It’s coded that way – unless specified in the Preferences file (and restarted)

Something is missing / preventing Linux from adding the card itself as free-standing.

You should see both in the file system. i915 -> QSV ASIC & Nvidia

Hmm, let me enable it and see if the debug log can point me in a direction.

Plex Version 1.19.3.2843 on CentOS8 with NVIDIA-Linux-x86_64-440.82 - Haswell CPU &P2000

I have the same question - why does PMS encode with vaapi when I have HW Transcoding enabled in my settings?

I had to delete the files in “/usr/lib/plexmediaserver/lib/dri” to force PMS to use the nvidia encoder

nvidia-smi would show that the P2000 was not being used. Once I deleted the i965… & iHD …files, it showed that the P2000 was being utilized and my CPU utilization came down to almost 0

The documentation for linux HW transcoding does show that the preferred order is vaapi followed by nvenc. I wish there was some setting to change this to nvenc as the first preferred.

Unfortunately, adding the setting in Preferences.xml is only a temporary fix, because as soon as something is modified in the settings and you do a save - this setting is lost.

If you wish to override default selection, which is:

  1. Nvidia if installed and valid drivers
  2. /dev/dri/renderD128 device

The preference to set in Preferences.xml is: HardwareDevicePath="/dev/dri/device-name"

e.g.

HardwareDevicePath="/dev/dri/renderD129"
-or-
HardwareDevicePath="/dev/dri/renderD128" to force the Intel QSV vaapi

Also, if the group assignment for the device differs than that of the QSV device, user plex must be manually added to that group.

3 Likes

Yup - tried these already
Only solution that worked, as I stated previously was to delete the files in …/lib/dri

Thanks for reporting. I will go find out why it’s not respecting the variable which the transcoder team added. :thinking:

May I see how you have it in your Preferences.xml file?

Think we can close my issue.

Plex reported an update was available, and I updated PMS to “plexmediaserver-1.19.3.2852-219a9974e.x86_64” before I saw this message.

It works now.

Don’t think it’s needed now, but just FYI - relevant info from my system is in the attached file
file.txt (3.4 KB)

So that did it for me as well.

I had that not in my settings and I would play something and get:

May 26, 2020 08:09:29.148 [0x7efe59df3700] DEBUG - TPU: hardware transcoding: final decoder: nvdec, final encoder: vaapi

same item after adding that, I get.

May 26, 2020 08:13:05.230 [0x7f47aa7fc700] DEBUG - TPU: hardware transcoding: final decoder: nvdec, final encoder: nvenc

so that solution worked for me as I tested today again with both video cards enabled on my system.

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