Plex Suddenly Stops Hardware Transcoding

Strange.

The player is just a standard Apple TV and a Google Chromecast TV - is it even possible to make those IPs static? They’re both on Wifi

Server is definitely wired, IP is not a static IP, could look into changing that (also really hate network problems). I’d have to change both the proxmox server as well as the VM to a static IP i’d assume

Okay learnt I could assigned a static IP for my player inside my routers settings so I’ve done that.
It seems to now show up when i change to transcoding as HW transcoding (see screenshot below)

However player just seems to buffer forever, eventually loading the content on the screen but not being able to play more than a second at a time before heavy buffering. To get this to happen I had to click “convert to 1080P” on my player and wait a few minutes before even seeing this, which isnt ideal

Plex Media Server Logs_2023-05-19_19-31-30.zip (3.8 MB)

My network graph is bouncing all over the place. Im almost certain its not my network not being fast enough to load the specific item as like I mentioned previously, upon booting it works great for about 30 minutes or so before just stopping.

I hate VMs.

May 19, 2023 19:26:03.524 [139670725667640] INFO - Plex Media Server v1.32.2.7100-248a2daf0 - Debian GNU/Linux PC x86_64 - build: linux-x86_64 debian - GMT 10:00
May 19, 2023 19:26:03.524 [139670725667640] INFO - Linux version: 11 (bullseye), language: en-US
May 19, 2023 19:26:03.524 [139670725667640] INFO - Processor: 5-core Common KVM processor
May 19, 2023 19:26:03.524 [139670725667640] INFO - Compiler is - Clang 11.0.1 (https://plex.tv 9b997da8e5b47bdb4a9425b3a3b290be393b4b1f)
May 19, 2023 19:26:03.524 [139670725667640] INFO - /usr/lib/plexmediaserver/Plex Media Server
  1. Make a new VM
  2. 4 cores / 8 threads
  3. 8 GB RAM
  4. Pass through the GPU
  5. Install Ubuntu 20
  6. Install all updates
  7. Give it a different hostname than your other VM
  8. Set networking as PEER (it will be a new IP on your LAN)
  9. Load one section
  10. Test

You’ve got a fundamental systemic problem.
PITA to diagnose unless the test base is controlled.

This is just wrong. You don’t do this. Even numbers only 1-2-4-8, etc

Processor: 5-core Common KVM processor

If you have to micromanage the resources, you don’t have enough resources.

I didnt even realise I had 5 cores, must’ve been a typo from a while ago

ANYWAYS

I’ve set up a brand new VM exactly as mentioned above, added the GPU, set a static IP, and set everything up.

Now it seems to just go straight to software transcoding instead of hardware. Yes I have enabled the hardware transcoding inside my settings and have installed the correct GPU drivers, GPU is showing up as active and working inside of ubuntu.


Logs attached too if needed

Plex Media Server Logs_2023-05-19_15-01-54.zip (455.6 KB)

@KillerKaac

  1. TPU: hardware transcoding: enabled, but no hardware decode accelerator found

  2. Did you install the Nvidia drivers, nvidia-encode, and nvidia-decode ?

Verify using nvidia-smi

FYI:

tested 1.32.2.7100 on i7-3770, still no HW encoding / decoding.
Reverted to 1.32.1.6999 and still works with that version …

nvidia-smi returns everything correct. Not sure what else I’ve got to do here

Sorry for the frustration, this is driving me insane too

Nvidia SMI only tells you the kernel can see the card.
It doesnt say if the API libraries are installed.

  1. Got the API drivers for PMS?
[chuck@glockner ~.1997]$ dpkg -l | grep nvidia-encode
ii  libnvidia-encode-525-server:amd64     525.105.17-0ubuntu0.22.04.1             amd64        NVENC Video Encoding runtime library
[chuck@glockner ~.1998]$ dpkg -l | grep nvidia-decode
ii  libnvidia-decode-525-server:amd64     525.105.17-0ubuntu0.22.04.1             amd64        NVIDIA Video Decoding runtime libraries
[chuck@glockner ~.1999]$
  1. When you map through any VM, make sure the GID works.

  2. Quick test to see if GID / permissions problem.
    – SSH into the NAS
    sudo chmod 666 /dev/dri/card* /dev/dri/render*

  3. REMEMBER, In most systems, udev works with the kernel to coordinate permissions for enumerated devices in /dev.
    – English : Your UID must be a member of the group which owns /dev/dri and the inodes. (restart if changed)
    – If the device is passed through (ALL FUNCTIONS) to a VM, I know the DPKG installer (my scripts will put user plex:plex in the right group for HW access if it can see /dev/dri

[chuck@lizum ~.2004]$ ls -la /dev/dri
total 0
drwxr-xr-x   3 root root        140 May 15 16:27 ./
drwxr-xr-x  21 root root       5200 May 19 19:07 ../
drwxr-xr-x   2 root root        120 May 15 16:27 by-path/
crw-rw-r--+  1 root render 226,   0 May 18 10:00 card0
crw-rw-r--+  1 root render 226,   1 May 19 19:03 card1
crw-rw-r--+  1 root render 226, 128 May 18 10:00 renderD128
crw-rw-r--+  1 root render 226, 129 May 18 10:00 renderD129
[chuck@lizum ~.2005]$ groups plex
plex : plex video render
[chuck@lizum ~.2006]$

OKAY
Worked out the driver issue and we have hardware encoding on Ubuntu Server 20 with the setup mentioned above.

Same errors as before - transcodes for a bit and then stops

Plex Media Server Logs_2023-05-20_09-10-36.zip (2.9 MB)

Logs attached.
When using the Plex PC player, it seems to show up as HW transcoding however the file being played is just buffering. Strange as about 5 minutes before that it played a full 10 minutes on HW transcoding with no problems

Plex Media Server Logs_2023-05-20_10-51-35.zip (3.7 MB)

More logs just in case there was a lot going on during those last ones

@ChuckPa

Wanted to throw a small stone in the round :innocent:

nvidia-smi on Server:

nvidia-smi in Docker:

and both Streams:
Stream1
Stream2
StramOnPlex

HW transcoding fails 1.32.2.7002 and never work again :woozy_face:
The whole thing runs on Unraid in a Docker :upside_down_face: :face_with_hand_over_mouth:

sounds like a similar problem to mine honestly!!

@ChuckPa is working through it

  • nvidia-smi is not usable inside the docker container.
  • nvidia-smi is constrained by the Docker namespace / container limitations.
    You are not seeing truth.
  • Containers rely on the capabilities of the HOST OS. Everything must be configured and measured external to the container.

Get the mapping right. (PUID/PLEX_UID , PGID/PLEX_GID).
The UID/GID it runs as MUST BE A MEMBER OF THE GROUP WHICH OWNS /dev/dri

  1. I run docker as my username (1000,1000)
[chuck@lizum.2015]$ id chuck
uid=1000(chuck) gid=1000(chuck) groups=1000(chuck),4(adm),24(cdrom),27(sudo),30(dip),44(video),46(plugdev),109(render),120(lpadmin),131(lxd),132(sambashare)
[chuck@lizum.2016]$ 
  1. Listing of the nodes in /dev/dri (Pay attention to the group)
[chuck@lizum.2013]$ ls -la /dev/dri
total 0
drwxr-xr-x   3 root root        140 May 21 17:13 ./
drwxr-xr-x  21 root root       5200 May 21 17:13 ../
drwxr-xr-x   2 root root        120 May 21 17:13 by-path/
crw-rw----+  1 root render 226,   0 May 21 17:13 card0
crw-rw----+  1 root render 226,   1 May 22 05:44 card1
crw-rw----+  1 root render 226, 128 May 21 17:13 renderD128
crw-rw----+  1 root render 226, 129 May 21 17:13 renderD129
[chuck@lizum.2014]$
  1. OBSERVE - My username is a member of the group which owns /dev/dri
    109(render)

With these pieces,

  1. Internal to the container, everything is ‘root’ - which means nothing
  2. The UID/GID the container maps to means EVERYTHING.

If you want to throw a stone or two :innocent:
May I suggest loading Windows 10 and running PMS there ? :rofl:

PS: I also have Unraid and Proxmox; Not an issue there either :slight_smile:

Moral of this story?

Docker is NOT A REQUIREMENT for HW transcoding. Native works best

Docker adds an abstraction layer which trips up a lot of people.

I’m here to support Plex, not Docker :rofl:

I’ve spent a lot of time to make sure the installer does all the correct configuring for you in the native environment. When it sees a docker container – it does nothing.

1 Like

@ChuckPa Any possibility you can take a look at these logs if possible?

sure. give me a minute. (I’m on Dr-ordered reduced hours for the next weeks so won’t be around as much as normal)

@KillerKaac

Look here – Plex Media Server.log

  1. It’s enabled and is using Nvidia (nvdec / nvenc)
  2. Then the client closes the connection
40588819585848] DEBUG - Content-Length of /usr/lib/plexmediaserver/Resources/Plug-ins-248a2daf0/WebClient.bundle/Contents/Resources/index.html is 8276 (of total: 8276).
May 20, 2023 09:08:36.233 [140589302868792] DEBUG - Completed: [192.168.1.22:62070] 200 GET /web/index.html (19 live) #491f7 GZIP 7ms 8276 bytes (pipelined: 1)
May 20, 2023 09:08:36.238 [140589304978232] DEBUG - WebSocket: client initiated close
May 20, 2023 09:08:36.238 [140589304978232] DEBUG - handleStreamRead code 1: stream truncated
May 20, 2023 09:08:36.238 [140589304978232] DEBUG - NotificationStream: Removing because of error

Play it in Plex/web or any other player as a confirmation test.

Are you using the Android (shield) app?
I can quick check that while i’m up.

Take all the time you need!!! No rush at all, sorry to bother you!!

I get the same error no matter the player I use.

Ive tested on

  • Web broswer
  • Plex Windows/Mac App
  • Apple TV
  • Google TV
  • Plex for IOS

Im happy to provide logs for all if need be, I just have no idea of the issue. The player definitely does not loose connection as I can change over to direct play and it works fine and the same file plays as normal.

Very lost with what to do with this situation.

Use this test file in an ‘other videos’ test section.

With no other activity,

  1. Restart server
  2. Give 60 seconds to stabilize.
  3. Play this from start until failure.

Grab the logs zip

Attached @ChuckPa !

I had to re play it over a few times and quickly change from Direct Play to transcoding, which you’ll probably see
(This player isn’t the one im specifically going to really need HW transcoding on, but the same issue happens regardless of player)

Im also having some network issues tonight, but it didnt seem to effect the playback and HW transcoding when it was working (I would occasionally get the message about a slow internet connection when dropping the quality but the video played fine using HW transcoding other than that, until it didnt)

Plex Media Server Logs_2023-05-22_11-52-15.zip (4.5 MB)

  1. connection reset
May 22, 2023 11:30:20.625 [140694271380280] DEBUG - [Req#235] Final path: "/usr/lib/plexmediaserver/Resources/Plug-ins-248a2daf0/WebClient.bundle/Contents/Resources/favicon.ico"
May 22, 2023 11:30:20.625 [140694271380280] DEBUG - Content-Length of /usr/lib/plexmediaserver/Resources/Plug-ins-248a2daf0/WebClient.bundle/Contents/Resources/favicon.ico is 5430 (of total: 5430).
May 22, 2023 11:30:20.625 [140694338665272] DEBUG - Completed: [192.168.1.61:54832] 200 GET /web/favicon.ico (10 live) #235 GZIP 0ms 5430 bytes (pipelined: 10)
May 22, 2023 11:30:21.827 [140694340774712] DEBUG - handleStreamWrite code 104: Connection reset by peer
May 22, 2023 11:30:21.827 [140694340774712] DEBUG - NotificationStream: Removing because of error
May 22, 2023 11:30:21.827 [140694340774712] DEBUG - Completed after connection close: [192.168.1.8:62685] 200 GET /:/eventsource/notifications (10 live) #1b0 TLS GZIP 20001ms 296 bytes (pipelined: 1)
May 22, 2023 11:30:23.066 [140694231522104] DEBUG - Request: [192.168.1.8:62735 (Subnet)] GET / (12 live) #22f TLS GZIP Signed-in Token (KillerKaac) (Apple TV)
May 22, 2023 11:30:23.066 [140694231522104] DEBUG - [Req#22f] (Capabilities) Platform 'tvOS' not matched by plugin platform requirements
May 22, 2023 11:30:23.066 [140694340774712] DEBUG - Completed: [192.168.1.8:62735] 200 GET / (12 live) #22f TLS GZIP 0ms 4636 bytes (pipelined: 1)
May 22, 2023 11:30:23.085 [140694317189944] DEBUG - Request: [192.168.1.8:62740 (Subnet)] GET / (14 live) #239 TLS GZIP Signed-in Token (KillerKaac) (Apple TV)

Connection reset again by peer.

May 22, 2023 11:52:10.040 [140694252411704] DEBUG - Selecting best audio stream for part ID 9804 (language: )
May 22, 2023 11:52:10.040 [140694252411704] DEBUG - Audio Stream: 31466, Subtitle Stream: -1
May 22, 2023 11:52:10.047 [140694338665272] DEBUG - Completed: [192.168.1.8:62930] 200 GET /hubs/promoted?excludePhotos=1 (16 live) #35d9 TLS GZIP 10ms 11748 bytes (pipelined: 1)
May 22, 2023 11:52:10.301 [140694338665272] DEBUG - handleStreamWrite code 104: Connection reset by peer
May 22, 2023 11:52:10.301 [140694338665272] DEBUG - NotificationStream: Removing because of error
May 22, 2023 11:52:10.301 [140694338665272] DEBUG - Completed after connection close: [192.168.1.8:62901] 200 GET /:/eventsource/notifications (14 live) #3336 TLS GZIP 80004ms 13167 bytes (pipelined: 1)
May 22, 2023 11:52:10.411 [140694218677048] DEBUG - Request: [127.0.0.1:57302 (Loopback)] PUT /video/:/transcode/session/9EC7917A-BAED-4E0F-88D1-F3E928743022/03482b64-618d-453b-9c76-bdfd3af7370b/progress?progress=0.9&size=-22&remaining=-1&vdec_packets=69&vdec_hw_ok=67&speed=0.0&vdec_hw_status=1 (13 live) #35ea Signed-in Token (KillerKaac) (range: bytes=0-) 
May 22, 2023 11:52:10.411 [140694340774712] DEBUG - Completed: [127.0.0.1:57302] 206 PUT /video/:/transcode/session/9EC7917A-BAED-4E0F-88D1-F3E928743022/03482b64-618d-453b-9c76-bdfd3af7370b/progress?progress=0.9&size=-22&remaining=-1&vdec_packets=69&vdec_hw_ok=67&speed=0.0&vdec_hw_status=1 (13 live) #35ea 0ms 355 bytes (pipelined: 76) (range: bytes=0-) 

Fix the networking.

Whenever the connection breaks, the session stops because the TCP/IP streaming connection is broken and must be restarted.