HW transcode not working with NVENC

/dev/dri/renderD128 changed from the ASPEED device to the nVidia device upon reboot.

I need a way to definitively point to the hardware device that is static between reboots.

If you can reliably point to the render device that way then do it.

It makes no sense the kernel would not reliably initialize things in the same sequence.

Doesn’t change anything. Hardcoding the device still results in the same error. I uploaded my logs earlier so hopefully they help. But as it stands, hardware transcoding is broken for some reason.

@adambahe

I have concern right here:

Please compare:

Jan 31, 2021 02:08:53.982 [0x7fa85a89a700] INFO - Plex Media Server v1.21.2.3943-a91458577 - Fedora PC x86_64 - build: linux-x86_64 redhat - GMT -06:00
Jan 31, 2021 02:08:53.982 [0x7fa85a89a700] INFO - Linux version: 32 (Thirty Two), language: en-US
Jan 31, 2021 02:08:53.982 [0x7fa85a89a700] INFO - Processor Genuine Intel(R) CPU @ 2.40GHz
Jan 31, 2021 02:08:53.982 [0x7fa85a89a700] INFO - /usr/lib/plexmediaserver/Plex Media Server

with what I get

Feb 02, 2021 10:52:19.816 [0x7fb5533a0700] INFO - Plex Media Server v1.21.2.3943-a91458577 - QNAP TVS-1282 x86_64 - build: linux-x86_64 qnap - GMT -05:00
Feb 02, 2021 10:52:19.816 [0x7fb5533a0700] INFO - Linux version: QTS 4.5.1.1495, language: en-US
Feb 02, 2021 10:52:19.816 [0x7fb5533a0700] INFO - Processor Intel(R) Coreā„¢ i7-7700 CPU @ 3.60GHz
Feb 02, 2021 10:52:19.816 [0x7fb5533a0700] DEBUG - System Memory 31.34GB

and

Feb 03, 2021 12:00:10.394 [0x7fe13794f700] INFO - Plex Media Server v1.21.1.3876-3c3adfcb4 - Docker Docker Container x86_64 - build: linux-x86_64 debian - GMT -05:00
Feb 03, 2021 12:00:10.394 [0x7fe13794f700] INFO - Linux version: 5.8.0-41-generic, language: C
Feb 03, 2021 12:00:10.394 [0x7fe13794f700] INFO - Processor Intel(R) Coreā„¢ i7-8809G CPU @ 3.10GHz

Notice the major difference?

In both of my servers, I can see the CPU which means /proc is connected to reality.
In your server, it’s not decoding which implies /proc isn’t connected to the real hardware.

What am I missing ?

Side note: I ran Fedora until a few months ago. I started with FC-3. I had to move away from it because the kernel didn’t work for Plex. I’ve half a hunch that’s what’s happening to you.

While this may not be too helpful I did want to add this information as a reference point.

I just tested playing a 1080p (HEVC Main 10) encoded file with a Roku 3 as it always needs to transcode this type of video. I can state that it worked and used HW transcoding (I checked via plex dash and the dashboard to confirm this).

My system is running fedora 33 64bit, kernel 5.10.11-200.fc33.x86_64, nvidia drivers 460.39 (installed via rpmfusion) and has a Quadro P1000.

In both of my servers, I can see the CPU which means /proc is connected to reality.

Its a dual 12 core Haswell Xeon (E7 v3). Base clock is 2.8 or somewhere around there I think.

Regarding the Fedora kernel, I can switch over to kernel-ml which is just the vanilla kernel.org kernel, but I doubt that would fix the issue. As I said, hardware transcoding used to work. And I think the issue may be specific to hardware transcoding when the client is in-browser (Chrome, Edge, etc). I have clients streaming remotely who are supposedly doing hardware transcoding (at least according to what Plex reports). These clients are typically Roku, Samsung Smart TVs, Android TV etc

Let’s look at what the OS is showing and verify it’s actually making it to where the transcoder can get to it.

I’m concerned the two devices competing and the driver compatibility.
I know there are some motherboards which work for a while and then, due to a driver change, stop working. I can’t remember which vendor’s motherboards behave that way.

You should be seeing the Nvidia being presented in /dev/dri.
You can verify this by:

cd /sys/module/nvidia/drivers/pci:nvidia/*:*:*.*

Here is how it looks for a QSV (i915 based) system:

[chuck@lizum 0000:00:02.0.508]$ cd /sys/module/i915/drivers/pci:i915/*:*:*.*/drm
[chuck@lizum drm.509]$ ls -la
total 0
drwxr-xr-x  4 root root 0 Feb  3 16:21 ./
drwxr-xr-x 10 root root 0 Feb  3 15:18 ../
drwxr-xr-x  5 root root 0 Feb  3 16:21 card0/
lrwxrwxrwx  1 root root 0 Feb  3 16:21 controlD64 -> card0/
drwxr-xr-x  3 root root 0 Feb  3 16:21 renderD128/
[chuck@lizum drm.510]$ 

What do you get?

@ChuckPa

I run inside a docker container with an nvidia and while transcoding to the CPU has no issues when playing via the clients, it just doesn’t seem to work with sync and the sync queue is just stalled either because of it or some other sync bug, but basically hw transcoding is failing for sync.

> 04
Feb 22, 2021 11:11:39.371 [0x7f003dffb700] DEBUG - PlayQueue: total generated: -1, before cursor: 0, after cursor: 9
Feb 22, 2021 11:11:39.371 [0x7f003dffb700] DEBUG - PlayQueue: decompressed 0 IDs from blob.
Feb 22, 2021 11:11:39.371 [0x7f003dffb700] DEBUG - PlayQueue: decompressed 0 IDs from blob.
Feb 22, 2021 11:11:39.371 [0x7f003dffb700] DEBUG - PlayQueue: Inserting 0 new items, starting at 0.000000.
Feb 22, 2021 11:11:39.371 [0x7f003dffb700] DEBUG - BPQ: processing 10 item(s) in queue
Feb 22, 2021 11:11:39.376 [0x7f011249a700] DEBUG - Auth: authenticated user 1 as XXXXXXXXXXXXX
Feb 22, 2021 11:11:39.376 [0x7f00bcff9700] DEBUG - Request: [192.168.0.142:51452 (WAN)] GET /playQueues/19047 (62 live) TLS GZIP Signed-in Token (ps0ps)
Feb 22, 2021 11:11:39.377 [0x7f00bcff9700] DEBUG - PlayQueue: total generated: -1, before cursor: 0, after cursor: 9
Feb 22, 2021 11:11:39.377 [0x7f00bcff9700] DEBUG - PlayQueue: decompressed 0 IDs from blob.
Feb 22, 2021 11:11:39.377 [0x7f00bcff9700] DEBUG - PlayQueue: decompressed 0 IDs from blob.
Feb 22, 2021 11:11:39.377 [0x7f00bcff9700] DEBUG - PlayQueue: Inserting 0 new items, starting at 0.000000.
Feb 22, 2021 11:11:39.379 [0x7f003dffb700] DEBUG - We're going to try to auto-select an audio stream for account 1.
Feb 22, 2021 11:11:39.379 [0x7f003dffb700] DEBUG - Selecting best audio stream for part ID 543218 (autoselect: 1 language: en)
Feb 22, 2021 11:11:39.379 [0x7f003dffb700] DEBUG - Audio Stream: 1615154, Subtitle Stream: -1
Feb 22, 2021 11:11:39.380 [0x7f003dffb700] DEBUG - Codecs: testing h264_nvenc (encoder)
Feb 22, 2021 11:11:39.380 [0x7f003dffb700] DEBUG - Codecs: hardware transcoding: testing API nvenc
Feb 22, 2021 11:11:39.427 [0x7f00bcff9700] DEBUG - It took 100.000000 ms to retrieve 10 items.
Feb 22, 2021 11:11:39.443 [0x7f011249a700] DEBUG - Completed: [192.168.0.142:51452] 200 GET /playQueues/19047 (62 live) TLS GZIP 66ms 2020 bytes (pipelined: 8)
Feb 22, 2021 11:11:39.534 [0x7f003dffb700] DEBUG - Codecs: testing h264 (decoder) with hwdevice vaapi
Feb 22, 2021 11:11:39.534 [0x7f003dffb700] DEBUG - Codecs: hardware transcoding: testing API vaapi
Feb 22, 2021 11:11:39.534 [0x7f003dffb700] ERROR - [FFMPEG] - libva: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
Feb 22, 2021 11:11:39.534 [0x7f003dffb700] ERROR - [FFMPEG] - Failed to initialise VAAPI connection: -1 (unknown libva error).
Feb 22, 2021 11:11:39.534 [0x7f003dffb700] DEBUG - Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Input/output error
Feb 22, 2021 11:11:39.534 [0x7f003dffb700] DEBUG - Codecs: testing h264 (decoder) with hwdevice nvdec
Feb 22, 2021 11:11:39.534 [0x7f003dffb700] DEBUG - Codecs: hardware transcoding: testing API nvdec
Feb 22, 2021 11:11:39.602 [0x7f003dffb700] DEBUG - Codecs: Testing with profile 'High'
Feb 22, 2021 11:11:39.636 [0x7f003dffb700] DEBUG - Scaled up video bitrate to 14286Kbps based on 1.500000x fudge factor.
Feb 22, 2021 11:11:39.636 [0x7f003dffb700] DEBUG - Scaled maximum bitrate for resolution reduction to 2013Kbps.
Feb 22, 2021 11:11:39.637 [0x7f003dffb700] DEBUG - MDE: Selected protocol http; container: mp4
Feb 22, 2021 11:11:39.637 [0x7f003dffb700] DEBUG - MDE: analyzing media item 528202
Feb 22, 2021 11:11:39.637 [0x7f003dffb700] DEBUG - MDE: E3 - XXXXXXXXXXXXXXXXXXXXXXXX: no direct play video profile exists for http/mkv/h264
Feb 22, 2021 11:11:39.637 [0x7f003dffb700] DEBUG - MDE: E3 - XXXXXXXXXXXXXXXXXXXXXXXX: no direct play video profile exists for http/mkv/h264/eac3
Feb 22, 2021 11:11:39.637 [0x7f003dffb700] DEBUG - XXXXXXXXXXXXXXXXXXXXXXXX - video.width limitation applies: 1920 > 720
Feb 22, 2021 11:11:39.637 [0x7f003dffb700] DEBUG - XXXXXXXXXXXXXXXXXXXXXXXX - video.width limitation applies: 1920 > 720
Feb 22, 2021 11:11:39.637 [0x7f003dffb700] DEBUG - MDE: E3 - XXXXXXXXXXXXXXXXXXXXXXXX: no remuxable profile found, so video stream will be transcoded
Feb 22, 2021 11:11:39.637 [0x7f003dffb700] DEBUG - Codecs: testing h264_nvenc (encoder)
Feb 22, 2021 11:11:39.637 [0x7f003dffb700] DEBUG - Codecs: hardware transcoding: testing API nvenc
Feb 22, 2021 11:11:39.758 [0x7f003dffb700] DEBUG - XXXXXXXXXXXXXXXXXXXXXXXX - video.width limitation applies: 1920 > 720
Feb 22, 2021 11:11:39.758 [0x7f003dffb700] DEBUG - MDE: Cannot direct stream video stream due to profile or setting limitations
Feb 22, 2021 11:11:39.758 [0x7f003dffb700] DEBUG - Codecs: testing h264 (decoder) with hwdevice vaapi
Feb 22, 2021 11:11:39.758 [0x7f003dffb700] DEBUG - Codecs: hardware transcoding: testing API vaapi
Feb 22, 2021 11:11:39.758 [0x7f003dffb700] ERROR - [FFMPEG] - libva: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
Feb 22, 2021 11:11:39.758 [0x7f003dffb700] ERROR - [FFMPEG] - Failed to initialise VAAPI connection: -1 (unknown libva error).
Feb 22, 2021 11:11:39.758 [0x7f003dffb700] DEBUG - Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Input/output error
Feb 22, 2021 11:11:39.758 [0x7f003dffb700] DEBUG - Codecs: testing h264 (decoder) with hwdevice nvdec
Feb 22, 2021 11:11:39.758 [0x7f003dffb700] DEBUG - Codecs: hardware transcoding: testing API nvdec
Feb 22, 2021 11:11:39.825 [0x7f003dffb700] DEBUG - Codecs: Testing with profile 'High'
Feb 22, 2021 11:11:39.860 [0x7f003dffb700] DEBUG - Scaled up video bitrate to 14286Kbps based on 1.500000x fudge factor.
Feb 22, 2021 11:11:39.860 [0x7f003dffb700] DEBUG - Scaled maximum bitrate for resolution reduction to 2013Kbps.
Feb 22, 2021 11:11:39.860 [0x7f003dffb700] DEBUG - MDE: Cannot direct stream audio stream due to codec eac3 when profile only allows aac
Feb 22, 2021 11:11:39.860 [0x7f003dffb700] DEBUG - MDE: E3 - XXXXXXXXXXXXXXXXXXXXXXXX: selected media 0 / 528202
Feb 22, 2021 11:11:39.862 [0x7f003dffb700] DEBUG - We're going to try to auto-select an audio stream for account 1.
Feb 22, 2021 11:11:39.862 [0x7f003dffb700] DEBUG - Selecting best audio stream for part ID 551676 (autoselect: 1 language: en)
Feb 22, 2021 11:11:39.862 [0x7f003dffb700] DEBUG - Audio Stream: 1640412, Subtitle Stream: -1
Feb 22, 2021 11:11:39.862 [0x7f003dffb700] DEBUG - Codecs: testing h264_nvenc (encoder)
Feb 22, 2021 11:11:39.862 [0x7f003dffb700] DEBUG - Codecs: hardware transcoding: testing API nvenc
Feb 22, 2021 11:11:39.986 [0x7f003dffb700] DEBUG - Codecs: testing h264 (decoder) with hwdevice vaapi

MODERATOR EDIT: ``` Code formatting applied*

@ps0ps

Future request please? Please just attach the ZIP unless it’s only a few lines and explicit but be advised, It’s almost impossible to diagnose from snippets which is why I always request the ZIP file.

I understand what you’re saying but the snippet above doesn’t include enough of the decision before nor what follows to what PMS actually ended up doing.

I only see it ā€œtestingā€.

Can you recreate please and attach?

@ChuckPa
Sure, here’s the log… I paused the sync queue and then resumed it and this is the log from that.log.zip (601.2 KB)

I’m sorry. I’m not seeing any ffmpeg activity.

I see the MDE come up.
I see what looks like [Transcode] messages but I’m not getting either:

  1. FFMPEG - the trancoder itself

I did just find

Feb 22, 2021 15:09:23.901 [0x7f001ffff700] DEBUG - Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Input/output error
Feb 22, 2021 15:09:23.901 [0x7f001ffff700] DEBUG - Codecs: testing hevc (decoder) with hwdevice nvdec
Feb 22, 2021 15:09:23.901 [0x7f001ffff700] DEBUG - Codecs: hardware transcoding: testing API nvdec
Feb 22, 2021 15:09:23.962 [0x7f001ffff700] DEBUG - Codecs: Testing with profile 'Main 10'
Feb 22, 2021 15:09:23.974 [0x7f001ffff700] DEBUG - Codecs: 10-bit HEVC test succeeded

I’m not sure why it’s not getting out.

If you play directly, does everything work ok?

IIRC, unless it’s been changed since I used it last, sync jobs don’t get hardware assist. I easily might be wrong here so feel free to correct me

Transcode for playing movies works perfectly. No issues there at all.

A couple versions ago sync was definitely working with hw assist and now it’s just not working and the sync queue is actually stuck… It’s not even using the CPU.

Can you purge the queue? (delete all pending, remove any not downloaded, and re-enqueue)

(I must apologize because I don’t use Sync nearly enough to keep up with everything)

So I purged all the sync’d data from every device and now it’s working again, but the web-ui doesn’t really give any indication it’s working, it just says waiting, but you can definitely see activity with files being written out. I see FFMPEG log messages where it’s loading all the Nvidia modules now, but what broke is beyond me.

There is work being done on this. I’m not at liberty to say what but it is changing (I see it here). I heard ( I think ) discussion in a recent staff meeting about releasing soon but have forgotten the details - sorry.

I can tell you that I really like what it’s doing now. Compared to previous, it’s fast. Beyond that, I don’t think I can disclose more.

Thanks for the update. It is great that this is being worked on. Sync has always been a mess.

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