HW Transcode: mf instead of QSV?

I have a Coffee Lake 8700K with UHD 630 enabled, as well as a discrete GPU. Under Graphics Settings, I have it set to prefer the Power Saving GPU, the UHD 630. As I understand it, this iGPU has QSV.

When plex does it’s hw transcode, it seems to always request mf instead of QSV, even though QSV is higher up on the priority list. Does anyone have an answer as to why the transcoder does this? EDIT: When forcing the transcoder to use the Nvidia GPU, it also requests mf instead of NVEnc.

Also for the following combinations when transcoding on the same computer as the plex server, this happens:

Both Cards connected, 1070 Ti Active, UHD 630 not displayed to

Transcoder Setting | PMP Setting | Result

Power Saving | Power Saving | CPU Transcode, UHD 630 3D

Power Saving | High Performance | CPU Transcode, 1070 Ti 3D

High Performance | Power Saving | 1070 Ti Transcode, UHD 630 3D

High Performance | High Performance | 1070 Ti Transcode, 1070 Ti 3D

Direct Play | High Performance | Direct Play, 1070 Ti 3D

Both Cards connected, UHD 630 Active, 1070 Ti not displayed to

Transcoder Setting | PMP Setting | Result

Power Saving | Power Saving | CPU Transcode, UHD 630 3D

Power Saving | High Performance | CPU Transcode, Alternating between UHD 630 3D and 1070 Ti 3D

High Performance | Power Saving | 1070 Ti Transcode, UHD 630 3D

High Performance | High Performance | 1070 Ti Transcode, UHD 630 3D

Direct Play | High Performance | Direct Play, 1070 Ti Copy

Ideally, I’d like to have the UHD 630 doing the transcoding, and the 1070 Ti doing the displaying, but I just can’t get it to set as such.

When I transcode to my iPad this is what happens:

Both Cards connected, 1070 Ti Active, UHD 630 not displayed to

Transcoder Setting | PMP Setting | Result

Power Saving | High Performance | UHD 630 Transcode

Additionally, 4K HEVC HDR transcoding seems to only be able to be done by the 1070 Ti, it defaults to CPU Transcoding when the Power Saving GPU is selected. However, 4K HEVC HDR Compressed seems to be able to be handled fine by either GPU. Is there are bitrate limit that can crash the iGPU?

1 Like

Do you mean under your Windows Settings? This has no impact on PMS. From out support article:

If your Windows computer also has a dedicated graphics card, such as an NVIDIA or AMD GPU, some functions of Intel Quick Sync Video may become unavailable when the GPU is in use.

I’m confused, where are you seeing these settings?

Actually, when mf is selected as the hardware encoder for whatever reason, using the Windows Display Settings -> Graphics Settings and selecting the preference between the Power Saving and High Performance GPUs for the Plex Transcoder.exe file does change which GPU Windows Media Foundation uses to do the hardware encoding.

This is shown in the Media Server Logs, when Windows media foundation announces which encoder it is using, either Intel® Quick Sync Video H.264 Encoder MFT or NVIDIA H.264 Encoder MFT. Please do not confuse these with the ffmpeg encoders h264_qsv or h264_nvenc, those are the Intel and Nvidia native implementations and not the Windows media foundation implementations you see being announced here.

Additionally, I don’t see why I can call Intel QSV encoding via handbrake or ffmpeg command line, but PMS cannot. The Nvidia GPU is plugged in while I’m calling QSV so it’s not like the Nvidia GPU prevents me from using QSV.

As for Transcoder | PMP Settings, those are the settings under Windows Display Settings -> Graphics Settings.

Ok, that is MF making the decision. PMS just says use MF and MF makes the decision. We can’t control that.

Right, you have to explicitly tell ffmpeg what to use, it can’t auto detect it. PMS tries to detect what’s available and only uses what it can find. As mentioned in that note, sometimes QSV can’t be detected when you have another graphics card. If your PMS is using MF, that means your card isn’t being detected either by PMS or not able to use NVENC.

I’ve managed to get NVEnc working now, so first mission succeeded. What’s happening now is that PMS is trying to test QSV, but is unable to initialize an MFX session. I am trying to understand the root cause of that.

I would also submit that an enhancement should be implemented. If I can manually call QSV and use it, there’s no reason why an auto-detection / testing algorithm is missing it. I mean, we’re talking a sample size of 4 use cases here. Brute forcing that is barely any processing power.

The technical details are beyond me so I can’t help any further. I’ll see if I can find someone that can provide more details.

Thanks for your assistance!

Well, this is the best I’ve gotten Plex to work with multiple GPUs.

Connect monitors to both 1070 Ti and UHD 630. Set UHD 630 as primary GPU by selecting the monitor connected to it as primary.

Start 4 streams, force transcode by setting 8 mbps 1080p quality.

Results in picture.

First 2 hw transcodes are sent to NVEnc. Next 2 hw transcodes are sent to Windows mediafoundation. Because UHD 630 is primary, Intel QSV for mediafoundation is used.

This sounds ideal to me? I didn’t think it would use both.

Last time I tried it on windows (months ago), was that plex used whichever GPU was the primary windows device (not both).

Btw GTX cards are limited to 2 simultaneous transcodes if you were not already aware, then sounds like plex flows on to the iGPU. Albeit there are some hacked drivers floating around that can ignore the limit (google).

Your cpu usage isn’t shown in the screenshot, but looks like you could get a few more potential transcodes going on the igpu.

ideal (for quality and direct access reasons) would be to use the native h264_qsv encoder first, then pass to the nvidia gpu for the following 2 after the intel integrated runs out of processing power, then finally the CPU.

Rather than currently passing through to the native nvidia encoder, then on the third transcode, passing through to the h264_mf encoder and getting QSV that way.

This is sort of a workaroundy implementation.

Nvidia GPUs should never be used as primary if you have an intel GPU available to use. (Personal preference)

I haven’t tried stress testing the iGPU to see how many more it can do, might do that a bit later.

Good to see you got your NVidia card working. However, if PMS is using h264_mf instead of h264_qsv, that means that PMS still could not detect that QSV was supported. This can happen if you have 2 graphic cards. Please note that MF through your 630 is not the same as QSV. Switching to MF after the 2 limit through NVidia is expected.

That doesn’t help PMS. You need to go into your BIOS settings and set the iGPU as the primary. That might get PMS to see QSV, but that NVidia card you have may still interfere.

As I’ve said before, Set UHD 630 as primary GPU by selecting the monitor connected to it as primary doesn’t help PMS, it helps mf pick the UHD 630 instead of the GTX 1070 Ti. This is crucial because once PMS falls back to mf, if mf is still using the Nvidia card, it fails because of the 2 transcode limit.

The setup I mentioned above isn’t stable, however.

Plex is now detecting QSV, but is falling back to CPU instead of NVEnc. It’s only allowing one or zero HW transcodes before it returns an error, which is doubly annoying. I just updated to 1.13.9.5439, my success was on the previous version of PMS.

Also, this is with PEG instead of IGFX set in BIOS. The old adage of setting iGPU in BIOS doesn’t always apply, as in my case.

Annoyed now that Plex detects QSV properly, it’s messing up my setup. The work continues.

Relevant error message:
[Transcoder] [h264_qsv @ 021fb9c0] Error during encoding: device failed (-17)

"Turns out the Intel API for QSV is pretty buggy. There are lots of reports online of random failures and hangs.

I switched us to a different API offered by Windows. It uses the same QuickSync CPU features under the hood, but is better maintained by Microsoft and more stable."

Of course Intel’s native API for QSV is buggy, what else is new.

Turns out Windows mf is the better way of accessing QSV than native QSV. Damnit.

Now I have to figure out how to get PMS to not detect QSV again.

Also wondering why:
Oct 30, 2018 02:03:35.690 [25756] DEBUG - Streaming Resource: Changing client to use software decoding

Instead of falling back to NVEnc?

Here are a couple of recommended changes:

I did some googling to see how other mfx consumers deal with these errors.

VLC calls MFXVideoENCODE_Reset() when it receives MFX_ERR_DEVICE_FAILED
​https://github.com/videolan/vlc/blob/d139d48a55fdf1d1a59d354d354f552a589efa25/modules/codec/qsv.c#L716-L718

QSVEnc calls Close() and Init() again on MFX_ERR_DEVICE_{FAILED,LOST}
​https://github.com/rigaya/QSVEnc/blob/b3b998c81fd2c47fb1e3619e635d6296f29af849/QSVEncC/QSVEncC.cpp#L3511-L3518

Documentation from Intel also recommends reinitializing the MFX session when getting a device failed error: ​https://software.intel.com/en-us/node/628427

Ever since PMS correctly detected QSV, hw-accelerated transcoding has been a s**tshow. Sometimes I’m lucky if I even get 1 hw-accelerated stream.

Just doing some more playing around in windows graphics settings.

If you switch between the power saving gpu and the high performance gpu for the plex media server executable file, you can change the hardware encoder from qsv to nvenc and vice versa.

Oct 30, 2018 22:09:24.193 [5064] DEBUG - [Universal] Using local file path instead of URL: E:\Movies\Blade.Runner.2049.2017.2160p.BluRay.REMUX.HEVC.DTS-HD.MA.TrueHD.7.1.Atmos-FGT.mkv
Oct 30, 2018 22:09:24.194 [5064] DEBUG - TPU: hardware transcoding: zero-copy support not present
Oct 30, 2018 22:09:24.194 [5064] DEBUG - TPU: hardware transcoding: final decoder: dxva2, final encoder: nvenc

Oct 30, 2018 22:11:57.013 [14300] DEBUG - [Universal] Using local file path instead of URL: E:\Movies\Blade.Runner.2049.2017.2160p.BluRay.REMUX.HEVC.DTS-HD.MA.TrueHD.7.1.Atmos-FGT.mkv
Oct 30, 2018 22:11:57.013 [14300] DEBUG - TPU: hardware transcoding: zero-copy support not present
Oct 30, 2018 22:11:57.013 [14300] DEBUG - TPU: hardware transcoding: final decoder: dxva2, final encoder: qsv

You can judge by the timestamps.

Right. Windows has it’s own controls. We just use what the OS allows.

I’m hoping there’s a way for PMS to assert priority and user-customizability in future releases so we can set fallback order and criteria for fallback from our end.

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