Ubuntu GTX1060 Hardware Encode doesn't work

Server Version#: 1.18.8.2468
Player Version#: 4.22.2

Fresh Ubuntu 19.10 install with Nvidia GTX 1060 using Nvidia 435 drivers from PPA repo.

When enabling hardware transcoding the stream stops and just shows a black screen. Unchecking “Use Hardware-Accelerated Video Encoding” then allows the video to transcode and play without issue.

Found the following in logs:

DEBUG - Codecs: testing h264_vaapi (encoder)
DEBUG - Codecs: hardware transcoding: testing API vaapi
DEBUG - Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Input/output error
DEBUG - Codecs: testing h264_nvenc (encoder)
DEBUG - Codecs: hardware transcoding: testing API nvenc
DEBUG - Codecs: testing h264 (decoder) with hwdevice vaapi
DEBUG - Codecs: hardware transcoding: testing API vaapi
DEBUG - Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Input/output error
DEBUG - Codecs: testing h264 (decoder) with hwdevice nvdec
DEBUG - Codecs: hardware transcoding: testing API nvdec

I added user plex to both the video and render group

nvidia-smi does not show process /usr/lib/plexmediaserver/Plex Transcoder unless Encoding is unselected.

ls -l /dev/dri lists the following:

$ ls -l /dev/dri
total 0
drwxr-xr-x  2 root root         80 Mar  9 22:35 by-path
crw-rw----+ 1 root render 226,   0 Mar  9 22:39 card0
crw-rw----+ 1 root render 226, 128 Mar  9 22:39 renderD128

Any ideas would be greatly appreciated.

Full DEBUG logs ZIP please which capture this?

It’s not possible to diagnose from snippets

Did you restart PMS after adding to the group?

Logs attached.

I restarted the service after adding to groups. I also restarted the server.

groups plex outputs the following:

$ groups plex
plex : plex video render

Plex Media Server Logs_2020-03-10_08-25-58.zip (925.2 KB)

Thanks for the logs.

It’s clearly not able to find the nvidia card.

Is this a headless server? If so, is there a dummy HDMI plug attached?

1 Like

Using 1.18.8 and the lab’s GT1060,

Mar 10, 2020 17:11:52.226 [0x7fa4157fa700] DEBUG - [FFMPEG] - Loaded sym: cuExternalMemoryGetMappedMipmappedArray
Mar 10, 2020 17:11:52.226 [0x7fa4157fa700] DEBUG - [FFMPEG] - Loaded sym: cuMipmappedArrayGetLevel
Mar 10, 2020 17:11:52.226 [0x7fa4157fa700] DEBUG - [FFMPEG] - Loaded sym: cuMipmappedArrayDestroy
Mar 10, 2020 17:11:52.226 [0x7fa4157fa700] DEBUG - [FFMPEG] - Loaded sym: cuImportExternalSemaphore
Mar 10, 2020 17:11:52.226 [0x7fa4157fa700] DEBUG - [FFMPEG] - Loaded sym: cuDestroyExternalSemaphore
Mar 10, 2020 17:11:52.226 [0x7fa4157fa700] DEBUG - [FFMPEG] - Loaded sym: cuSignalExternalSemaphoresAsync
Mar 10, 2020 17:11:52.226 [0x7fa4157fa700] DEBUG - [FFMPEG] - Loaded sym: cuWaitExternalSemaphoresAsync
Mar 10, 2020 17:11:52.239 [0x7fa4157fa700] DEBUG - Codecs: Testing with profile 'High'
Mar 10, 2020 17:11:52.247 [0x7fa4157fa700] DEBUG - Scaled up video bitrate to 2793Kbps based on 1.500000x fudge factor.
Mar 10, 2020 17:11:52.247 [0x7fa4157fa700] DEBUG - MDE: Rush Hour 2 (2001): Audio Direct Streaming is disabled, so video's audio stream will be transcoded
Mar 10, 2020 17:11:52.247 [0x7fa4157fa700] DEBUG - MDE: Cannot direct stream audio stream due to profile or setting limitations
Mar 10, 2020 17:11:52.247 [0x7fa4157fa700] DEBUG - MDE: Rush Hour 2 (2001): selected media 0 / 16984
Mar 10, 2020 17:11:52.247 [0x7fa4157fa700] DEBUG - Streaming Resource: Adding session 0x7fa404433d90:l35x16w1mmhsettfsngbbvrb which is using transcoder slot.  Used slots is now 1
Mar 10, 2020 17:11:52.247 [0x7fa4157fa700] DEBUG - Streaming Resource: Added session 0x7fa404433d90:l35x16w1mmhsettfsngbbvrb
Mar 10, 2020 17:11:52.247 [0x7fa4157fa700] DEBUG - Streaming Resource: Reached Decision id=9825 codes=(General=1001,Direct play not available; Conversion OK. Direct Play=3000,App cannot direct play this item. Direct play is disabled. Transcode=1001,Direct play not available; Conversion OK.) media=(id=16984 part=(id=16984 decision=transcode container=mp4 protocol=dash streams=(Video=(id=29901 decision=transcode bitrate=2793 encoder=h264_nvenc width=1920 height=800) Audio=(id=29902 decision=transcode bitrate=256 encoder=aac channels=2 rate=48000))))
Mar 10, 2020 17:11:52.248 [0x7fa496ffd700] DEBUG - Completed: [192.168.0.229:58605] 200 GET /video/:/transcode/universal/decision?hasMDE=1&path=%2Flibrary%2Fmetadata%2F9825&mediaIndex=0&partIndex=0&protocol=dash&fastSeek=1&directPlay=0&directStream=0&subtitleSize=100&audioBoost=100&location=lan&addDebugOverlay=0&autoAdjustQuality=0&directStreamAudio=0&mediaBufferSize=102400&session=nbbux0asd5tfaf3uw659xtvq&subtitles=burn&Accept-Language=en (17 live) TLS GZIP 156ms 3188 bytes (pipelined: 4)
Mar 10, 2020 17:11:52.319 [0x7fa4967fc700] DEBUG - Auth: authenticated user 1 as LeiFaWing
Mar 10, 2020 17:11:52.319 [0x7fa44dffb700] DEBUG - Request: [192.168.0.229:58606 (Subnet)] GET /video/:/transcode/universal/start.mpd?hasMDE=1&path=%2Flibrary%2Fmetadata%2F9825&mediaIndex=0&partIndex=0&protocol=dash&fastSeek=1&directPlay=0&directStream=0&subtitleSize=100&audioBoost=100&location=lan&addDebugOverlay=0&autoAdjustQuality=0&directStreamAudio=0&mediaBufferSize=102400&session=nbbux0asd5tfaf3uw659xtvq&subtitles=burn&Accept-Language=en (17 live) TLS GZIP Signed-in Token (LeiFaWing)
Mar 10, 2020 17:11:52.319 [0x7fa44dffb700] DEBUG - Found session GUID of nbbux0asd5tfaf3uw659xtvq in session start.
Mar 10, 2020 17:11:52.319 [0x7fa44dffb700] DEBUG - TranscodeUniversalRequest: using augmented profile Firefox
Mar 10, 2020 17:11:52.320 [0x7fa44dffb700] DEBUG - Downloading document http://127.0.0.1:32400/library/metadata/9825?checkFiles=1&includeBandwidths=1&offset=-1&X-Plex-Incomplete-Segments=1&X-Plex-Session-Identifier=l35x16w1mmhsettfsngbbvrb
Mar 10, 2020 17:11:52.320 [0x7fa44dffb700] DEBUG - Auth: authenticated user 1 as LeiFaWing
Mar 10, 2020 17:11:52.329 [0x7fa44dffb700] DEBUG - We're going to try to auto-select an audio stream for account 1.
Mar 10, 2020 17:11:52.329 [0x7fa44dffb700] DEBUG - Selecting best audio stream for part ID 16984 (autoselect: 0 language: en)
Mar 10, 2020 17:11:52.329 [0x7fa44dffb700] DEBUG - Audio Stream: 29902, Subtitle Stream: -1
Mar 10, 2020 17:11:52.330 [0x7fa44dffb700] DEBUG - Found session GUID of nbbux0asd5tfaf3uw659xtvq in session start.
Mar 10, 2020 17:11:52.330 [0x7fa44dffb700] DEBUG - Cleaning directory for session nbbux0asd5tfaf3uw659xtvq ()
Mar 10, 2020 17:11:52.331 [0x7fa44dffb700] DEBUG - Starting a transcode session nbbux0asd5tfaf3uw659xtvq at offset -1.0 (state=3)
Mar 10, 2020 17:11:52.331 [0x7fa44dffb700] DEBUG - TPU: hardware transcoding: using hardware decode accelerator nvdec
Mar 10, 2020 17:11:52.331 [0x7fa44dffb700] DEBUG - [Universal] Using local file path instead of URL: /mnt/media/Videos/Movies/Rush Hour 2 (2001) [1080p]/Rush.Hour.2.2001.1080p.BluRay.x264.YIFY.mp4
Mar 10, 2020 17:11:52.331 [0x7fa44dffb700] DEBUG - TPU: hardware transcoding: zero-copy support present
Mar 10, 2020 17:11:52.331 [0x7fa44dffb700] DEBUG - TPU: hardware transcoding: using zero-copy transcoding
Mar 10, 2020 17:11:52.332 [0x7fa44dffb700] DEBUG - TPU: hardware transcoding: final decoder: nvdec, final encoder: nvenc
Mar 10, 2020 17:11:52.332 [0x7fa44dffb700] DEBUG - Job running: EAE_ROOT='/tmp/pms-04ac11ff-f0c8-4f95-b2e1-278f818eb2e3/EasyAudioEncoder' FFMPEG_EXTERNAL_LIBS='/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Codecs/0bc617e-2974-linux-x86_64/' XDG_CACHE_HOME='/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache' XDG_DATA_HOME='/usr/lib/plexmediaserver/Resources' X_PLEX_TOKEN='xxxxxxxxxxxxxxxxxxxx' '/usr/lib/plexmediaserver/Plex Transcoder' '-codec:#0x01' 'h264' '-hwaccel:#0x01' 'nvdec' '-hwaccel_fallback_threshold:#0x01' '10' '-hwaccel_output_format:#0x01' 'cuda' '-codec:#0x02' 'aac' '-analyzeduration' '20000000' '-probesize' '20000000' '-i' '/mnt/media/Videos/Movies/Rush Hour 2 (2001) [1080p]/Rush.Hour.2.2001.1080p.BluRay.x264.YIFY.mp4' '-filter_complex' '[0:#0x01]hwupload[0];[0]scale_cuda=w=1920:h=800:format=nv12[1]' '-filter_complex' '[0:#0x02] aresample=async=1:ocl='\''stereo'\'':osr=48000[2]' '-map' '[1]' '-codec:0' 'h264_nvenc' '-b:0' '2094k' '-maxrate:0' '2793k' '-bufsize:0' '5586k' '-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' 'init-stream$RepresentationID$.m4s' '-media_seg_name' 'chunk-stream$RepresentationID$-$Number%05d$.m4s' '-window_size' '5' '-delete_removed' 'false' '-skip_to_segment' '1' '-time_delta' '0.0625' '-manifest_name' 'http://127.0.0.1:32400/video/:/transcode/session/nbbux0asd5tfaf3uw659xtvq/d45026a9-68c9-4ccd-8f6d-f0c499b0dc0e/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/nbbux0asd5tfaf3uw659xtvq/d45026a9-68c9-4ccd-8f6d-f0c499b0dc0e/progress'
Mar 10, 2020 17:11:52.332 [0x7fa44dffb700] DEBUG - Jobs: Starting child process with pid 30021
Mar 10, 2020 17:11:52.337 [0x7fa46d7fa700] DEBUG - Request: [127.0.0.1:47288 (Loopback)] PUT /video/:/transcode/session/nbbux0asd5tfaf3uw659xtvq/d45026a9-68c9-4ccd-8f6d-f0c499b0dc0e/progress?status=startup (18 live) Signed-in Token (LeiFaWing) (range: bytes=0-) 
Mar 10, 2020 17:11:52.337 [0x7fa4967fc700] DEBUG - Completed: [127.0.0.1:47288] 204 PUT /video/:/transcode/session/nbbux0asd5tfaf3uw659xtvq/d45026a9-68c9-4ccd-8f6d-f0c499b0dc0e/progress?status=startup (18 live) 0ms 203 bytes (pipelined: 1) (range: bytes=0-) 
Mar 10, 2020 17:11:52.364 [0x7fa44e7fc700] DEBUG - Request: [127.0.0.1:47288 (Loopback)] PUT /video/:/transcode/session/nbbux0asd5tfaf3uw659xtvq/d45026a9-68c9-4ccd-8f6d-f0c499b0dc0e/progress?status=startup (18 live) Signed-in Token (LeiFaWing) (range: bytes=0-) 
Mar 10, 2020 17:11:52.364 [0x7fa4967fc700] DEBUG - Completed: [127.0.0.1:47288] 204 PUT /video/:/transcode/session/nbbux0asd5tfaf3uw659xtvq/d45026a9-68c9-4ccd-8f6d-f0c499b0dc0e/progress?status=startup (18 live) 0ms 203 bytes (pipelined: 2) (range: bytes=0-) 
Mar 10, 2020 17:11:52.364 [0x7fa415ffb700] DEBUG - Request: [127.0.0.1:47288 (Loopback)] PUT /video/:/transcode/session/nbbux0asd5tfaf3uw659xtvq/d45026a9-68c9-4ccd-8f6d-f0c499b0dc0e/progress?status=opening (18 live) Signed-in Token (LeiFaWing) (range: bytes=0-) 

But if finds the nvidia card when I disable encoding, logs attached. And nvida-smi shows the decode process:

$ nvidia-smi
Tue Mar 10 14:04:06 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 435.21       Driver Version: 435.21       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| 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 106...  Off  | 00000000:03:00.0  On |                  N/A |
|  0%   58C    P2    34W / 120W |    383MiB /  6078MiB |      5%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1384      G   /usr/lib/xorg/Xorg                            39MiB |
|    0      1639      G   /usr/bin/gnome-shell                          46MiB |
|    0      2241      C   /usr/lib/plexmediaserver/Plex Transcoder     285MiB |
+-----------------------------------------------------------------------------+

It is a headless machine yes, and yes I have a HDMI dummy attached.

Thanks for the help.

Plex Media Server Logs_2020-03-10_14-06-16.zip (940.6 KB)

Which nvidia drivers are you using?

perhaps try one of the newer drivers, there is a list of known working drivers @ https://github.com/keylase/nvidia-patch

edit: (you DO need the patch to remove encoder limit)

I thought that was going to be it.

The newest driver offered by the ppa repo is 435.21 which shows not supporting NVFBC. I purged and installed 440.64.00 manually.

Same results. Only works with encoding disabled. Decode only.

Anything else I can try?

well as a hail mary, try plugging in a monitor.

i have a 1650 on debian and it been trouble free for me, and well my setup is completely different (diff card/os).

Lab drivers are still 418.30

That’s the min version required.

I do think a HDMI dummy plug or monitor is required.

I’m 3000 miles from the lab so can’t try both ways.

I’ll try rolling back the drivers maybe.

I do have a dummy plug. But I’ll try a monitor next too.

So, I tried a few different versions of the nvidia drivers both manual and ppa repo apt-get style with no changes. Also plugged in a monitor instead of the dummy plug.

Finally found the solution and not sure why it worked. I found another forum post where someone ran the patch here: https://github.com/keylase/nvidia-patch even though it’s no longer required and it work. I tried it and sure enough hardware encode and decode works perfect now.

1 Like

Yes, I just came back to follow up, I posted above that the patch is not needed, but I was thinking of the transcoder patch.

this patch linked above will remove the 2 encode limit from the gtx.

as your screenshot above showed, it was already using 2 process before plex, which was preventing plex from using hw encoding.

That makes sense. I wonder if it’s because there’s an x server installed or if it’s because I have a remote desktop server installed (nomachine).

I assumed since those were both compute processes they didn’t count towards the 2 stream max.

Thanks for all the help Tekno and Chuck!

:man_facepalming:

I am blind.

Yes. glass manager had taken control of it (count = 2)

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