# Preferred HW Transcoder Linux

**URL:** <https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507>\
**Category:** Plex Media Server\
**Tags:** server-linux\
**Created:** [May 21, 2020, 5:15pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507 "2020-05-21T17:15:20Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![animosity022](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/animosity022/32/83693_2.png) [@animosity022](https://forums.plex.tv/u/animosity022)\
**Post date:** [May 21, 2020, 5:15pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/1 "2020-05-21T17:15:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 21, 2020, 8:25pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/2 "2020-05-21T20:25:36Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![animosity022](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/animosity022/32/83693_2.png) [@animosity022](https://forums.plex.tv/u/animosity022)\
**Post date:** [May 21, 2020, 9:37pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/3 "2020-05-21T21:37:24Z")

</div>

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:

```auto
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).

```auto
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.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 21, 2020, 10:23pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/4 "2020-05-21T22:23:30Z")

</div>

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 )

---

<div class="post-metadata">

**Author:** ![animosity022](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/animosity022/32/83693_2.png) [@animosity022](https://forums.plex.tv/u/animosity022)\
**Post date:** [May 21, 2020, 11:27pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/5 "2020-05-21T23:27:21Z")

</div>

This is what I have:

```auto
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](https://global.discourse-cdn.com/plex/original/3X/2/9/294158fafe1b27630a428b45dcafabda97abe66b.png)

and from the log:

```auto
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:

```auto
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 |
+-----------------------------------------------------------------------------+

```

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 21, 2020, 11:42pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/6 "2020-05-21T23:42:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![animosity022](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/animosity022/32/83693_2.png) [@animosity022](https://forums.plex.tv/u/animosity022)\
**Post date:** [May 21, 2020, 11:44pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/7 "2020-05-21T23:44:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 21, 2020, 11:46pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/8 "2020-05-21T23:46:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![animosity022](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/animosity022/32/83693_2.png) [@animosity022](https://forums.plex.tv/u/animosity022)\
**Post date:** [May 21, 2020, 11:49pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/9 "2020-05-21T23:49:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dvgeek](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dvgeek/32/8864_2.png) [@dvgeek](https://forums.plex.tv/u/dvgeek)\
**Post date:** [May 24, 2020, 1:29am UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/10 "2020-05-24T01:29:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 24, 2020, 1:44am UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/11 "2020-05-24T01:44:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dvgeek](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dvgeek/32/8864_2.png) [@dvgeek](https://forums.plex.tv/u/dvgeek)\
**Post date:** [May 25, 2020, 5:50pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/12 "2020-05-25T17:50:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [May 25, 2020, 7:29pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/13 "2020-05-25T19:29:03Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![dvgeek](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dvgeek/32/8864_2.png) [@dvgeek](https://forums.plex.tv/u/dvgeek)\
**Post date:** [May 25, 2020, 10:06pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/14 "2020-05-25T22:06:04Z")

</div>

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](https://forums.plex.tv/uploads/short-url/mo6CtW5MxKiEQvwq9LpCI81hJzR.txt) (3.4 KB)

---

<div class="post-metadata">

**Author:** ![animosity022](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/animosity022/32/83693_2.png) [@animosity022](https://forums.plex.tv/u/animosity022)\
**Post date:** [May 26, 2020, 12:16pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/15 "2020-05-26T12:16:16Z")

</div>

> [@ChuckPa](#):
>
> HardwareDevicePath=“/dev/dri/renderD129”

So that did it for me as well.

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

```auto
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.

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [August 24, 2020, 12:16pm UTC](https://forums.plex.tv/t/preferred-hw-transcoder-linux/593507/16 "2020-08-24T12:16:17Z")

</div>

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