Plex HTPC feedback

Ugh, I swore that this worked on Windows. Likely this is due to the fact that Windows doesn’t actually have a state for fullscreen windows so it’s not getting sized properly on a resolution change?

HTPC can actually use the mouse which is why it’s hidden after it is not used for a bit. Only Windows makes it unhidden on a display mode change.

What I shared contained all the shaders. There were three external shaders listed in that snippet and FSRCNN is only the first.

I presume this means you are playing 4k content on a 4k display. If so, the first two shaders get disabled (the first being a pre-scaler doubler and the second being a downscaler). There is no need to scale the luma channel because the resolution already matches and so that only leaves the KrigBilateral scaler for the chroma channel (unless you are playing 4:4:4 content but that’s highly unlikely outside of raw video editing).

It sounds like you should be doing some performance testing. I would suggest downloading MPV for Windows, copying one of these files (or part of it) to your computer, and running MPV on the CLI with options to see how it performs on your system. Back when I was diagnosing the audio dropouts, I was using this:

mpv.com --hwdec=auto --no-config  --audio-spdif=ac3,eac3 --fullscreen --glsl-shaders="\Users\YourUsernameHere\AppData\Local\Plex HTPC\shaders\FSRCNNX_x2_8-0-4-1.glsl" --scale=ewa_lanczos --msg-level=all=v --glsl-shaders-append="\Users\YourUsernameHere\AppData\Local\Plex HTPC\shaders\SSimDownscaler.glsl" --dscale=mitchell --linear-downscaling=no --glsl-shaders-append="\Users\YourUsernameHere\AppData\Local\Plex HTPC\shaders\KrigBilateral.glsl" --cscale=mitchell --sigmoid-upscaling=yes --video-sync=desync testfile.mkv

Then, during playback, if you type shift+i you’ll get an information overlay which includes last, average, and largest frame times. If you then type 2, you’ll get a page which includes these times for each shader. Note that FSRCNN transforms into several staders and some of the others do as well. This should give you a good idea on what can perform on your system.

If it turns out these three scalers are too much for your system, then you may want to look at some other sources for possible options to try. Of the pages that I found containing useful information, one may be of help to you to find the best config that your system can perform.

I’m not sure how much of this market remains with an HTPC device. My expectation is that most of this has been eroded away by cheap streaming boxes. As I said, RPi would depend on how much available time there is.

all good and understand, thanks for even considering it!

Wow, thanks so much for this in-depth reply. I’ll give all of those bits a read and do some testing.

And yes, 4K LG BX playing 4K content through my PC. I’ve never heard of mpv before Plex, let alone played with or downloaded it! All good fun.

Whilst I am probably not playing 4:4:4 content, the TV is in PC mode and so 4:4:4 is enabled system wide; confirmed in nVidia control panel. Might this be the issue?

Cheers!

Looks like this was it. Commenting out KrigBilateral, but leaving in gpu-content=d3d11 plus the other two shaders seems to work well.

Resolution switching isnt working for me though; same issue as other users where it only shows the top left hand corner of the video.

No, this is normal. Your content is likely 4:2:0 which means that the chroma channel (luma is brightness, chroma is color) is at half the resolution. So a 4K video file will have 3840x2160 resolution luma but only 1920x1080 chroma. So the chroma channel has to be upscaled (doubled in this case) for display.

Maybe it’s just this shader which is too much for your system or maybe the external shaders in general are. Note that if you are playing 4k content on a 4k output resolution, the other shaders disable themselves because they scale the luma channel which requires no scaling in this case.
A better test of the other scalers would be to play non-4k content and disable resolution switching. Play something that’s 1080p, 720p, and SD and see what the performance is.

You may also want to try out the configuration using only the SSimSuperRes shader (see my above links for information on that configuration).

This is interesting. I tested this myself yesterday on a machine with an Intel GPU. The display on it is only 1080p but I was playing 720p content and it was working. It changed resolution to 720p, the entire video and UI were visible, and when it switched back it was again properly displaying. This particular display had content scaling set to 125% and it retained that scaling after the resolution change (didn’t seem to be possible for it to have different scaling for different resolutions). I’m not sure what the difference is causing you to see this issues when I am not.

Hmmm. I am now confused.

When I posted before, I should’ve mentioned that both 4K and 1080p were stuttering (my bad) and it seemed commenting out Krig did the job.

But now, to test, I’ve uncommented Krig…and it works fine. Works fine with both res switching on and off. In fact, in one test the res switching worked until I rebooted the machine. I’ve noticed that when testing with the Windows 10 explorer shell active I get different results from my usual operation, which is Steam Big Picture running as shell - which in itself is troublesome and a little irritating.

I’m beginning to wonder if I’ve done something wrong - in my troubleshooting I did edit an mpv.conf in Program Files, but realised everyone was talking about files in AppData so I deleted it. Now I have the shaders and mpv.conf running from C:\User\AppData\Local\Plex HTPC.

Is this correct?

If by C:\User you mean C:\Users\YourUsernameHere, then that is the correct location. I’m not sure what the mpv.conf in program files is about thought. MPV reads it from the %AppData% dir (mpv.io). Having multiple mpv.conf files in other directories isn’t going to affect HTPC because it only reads it from its own app data directory.

Hopefully in your testing you are able to track down the factors involved. It’s a bit annoying optimizing everything for your system at times.

I just wanted to add a suggestion - I apologize if this is a duplicate. I’m building my dream theater now. I’m super excited about HTPC and can’t wait to chomp my teeth into it! I’m a long-time PLEX user, and former XBMC user - modded my original Xbox back in the day. Anyway, I have a feature request, could you please, please, please, put in the roadmap to add full-screen support for 2.40:1 Cinema format? So that we can do everything within the black bars? This would be KILLER!!! I know there’s another well-known device out there that does this. I think it sounds like Kaleidoscope or something ;-).

Just rebuilt my htpc on top of windows server 2022 but I am still disappointed this new HTPC app does not work without a (dummy) router, considering that the classic Plex Media Player app works offline pointed at 127.0.0.1. Doing the same thing on this new app just doesn’t seem to work and a self contained localhost htpc is more important to me than the new features (which are good) so I’m still forced to use the old app. Has any user managed to get around this or any dev pitch in why exactly this change was implemented (intentionally or unintentionally)?

Hopefully these legal questions are answered soon, 2022 without proper HDR on windows with plex just feels wrong.

Another solution that I’m sure many would enjoy would be for plex to just ship Plex HTPC with whatever MPV build that has no legal complications and then simply allow us to use whatever MPV build we would like.

Just put a disclaimer that no support will be offered for users who do not use the shipped MPV build.

2 Likes

The windowed version of the App does not remember its size on restart. It keeps maximizing on pressing “” to move to windowed mode.

Is commercial skip supposed to be working in HTPC yet?
I see it often pops up to skip intro but I have never once seen it pop up to offer to skip adverts, even in recordings I know have been marked as they show up on Roku for instance.

Re-quoting this as it continues to happen :frowning:

Can we set a HWND manually? What exactly is HWND? Can you take a guess at me being able to check anything else to see what might be suddenly causing this out of the blue?

I noticed that for a few days the issue was seemingly gone, but tonight after upgrading Nvidia drivers and having to manually select the correct audio device in PHTPC, the problem seemed to be back.

Thanks

Thanks

Looks like we’ll have to modify the library to remove one feature to bring in this library. That’s a shame but not entirely unexpected since this is related to a technology by a company who’s name is spelled a lot like the name of a house elf in Harry Potter.

The MPV library is and has always been a dll sitting in the install (titled mpv-1.dll). It’s compiled using the LGPL license (and we enable the LGPL code there). So you are free to do just this and we have to allow such per the license requirements. In fact I have tried out test builds of MPV inside HTPC numerous times by replacing this lib.

I presume you mean you pressed \ or a key to toggle fullscreen or something? Regardless, this has already been fixed and will be in the next version.

I asked one of the other devs and he said this may not have been implemented yet.

HWND in a Handle to a WiNDow in Windows. The thing is if you don’t know what that is, you likely don’t know what’s required to get the value since the HWND changes with each app start. It is possible to set it in the mpv.conf using the wid property (which is how we set it) but the changing nature likely makes this unusable for you.

I did dig through the entire code-path trying to figure out what could be done in your case and there is a check in MPV (https://github.com/mpv-player/mpv/blob/555c15efba09c3f4ed0696606d8533cb82ee11a0/video/out/w32_common.c#L1520) which checks for a negative value and rejects it if it is. Though this isn’t likely what’s occurring your case but describing it requires a lot of details in signed/unsigned number conversions and their binary representations. Perhaps that particular if statement in MPV is wrong and that the correct value is negative when expressed as a signed number. Either way I did add a log line to the next versions so hopefully when you get that it’ll shed some light on the situation.

Understood, thanks for being willing to help out. Once the next update is applied i’ll upload my logs.

As nobody has replied I thought I would attempt to answer some of this :wink:

Note: I’m not part of the Plex development team - although I am a software engineer. Some of my open source contributions are used in Plex but they are a third party library known as libcurl although I’ve not contributed to it for a couple of years now.

Essentially it is a “handle” to the client window that Plex renders to. Each window or control in Windows has a unique “handle” which programmers can used, either via Microsoft’s APIs (Application Programming Interfaces), or any third party libraries that also exposes them.

There is a tool call Spy++ in Microsoft Visual Studio that can be used to inspect the HWND of most windows in the system.

For example: This is Plex HTPC running on my Windows 10 machine and a few other applications:

Spy++ Example

You could download and install the Community Edition of Visual Studio, running Spy++ and reporting back what the value of the HWND is for Plex HTPC. If it is very large, Plex could be interpreting it as a negative number.

Update: I see @gbooker02 has responded - sorry if I have trod on any toes here - hopefully some of what I wrote is useful, if not please ignore :wink:

3 Likes

Thanks so much for the reply, @captain_caveman2k - I really appreciate. I’ll look into this asap :slight_smile:

1 Like

Another update on my side.

  • I now tried the resolution and refresh rate switching function on Linux. There it works as intended, even the scaling issues mentioned are not present, the UI scales perfectly to the new resolution!
    One thing to say there is, that the resolution matching only works because the Linux system only recognized the “standard” EDID modes (e.g. 1280x720, 1920x1080, 1920x1200, 3840x2160…) and no special ultrawide modes like (3840x1620) where it could falsely switch to.

  • When Resolution matching is enabled it switches also to the very old DVD/SD resolutions. (which is as intended) On an older TV this might be fine however, newer TVs (LG OLED) only show a small window with the dimensions of the SD video in the middle of the screen.
    Maybe add an option to let the user decide if Plex HTPC should switch to those Low-res SD modes?

  • One thing I noticed is when passthrough is disabled and sw decoding DTS-HD 7.1 tracks it tops out at 5.1. Plain mpv decodes and outputs it fine to 7.1. This is also present in PMP.
    Is this still a licensing issue with plex?

- UI:

  • A small addition would be awesome. On the shield version of the UI there is a small resolution and HDR tag presented when the timeline is up. Would love to see this on Plex HTPC as well!

Sorry to bring up the “curser visible on mode change” thing again but after trying this with PMP (where it also happens and PMP can also use the mouse) there is an option to hide the mouse. With this is set, the curser is not present after a mode change. I know this is a very small thing but maybe it could be brought back to Plex HTPC!

mpv.conf

  • When watching a file with Dolby Vision many useless lines of “HAL Unit 63” are printed into the log. After 10 minutes I had Plex HTPC.log.1 to 5 (each 10,3mb) all filled with this useless information.
    Just add msg-level=ffmpeg/video=status into the mpv.conf and the “HAL Unit” lines are gone! (Other useful ffmpeg/video lines are not touched by this addition)

FYI, the wid we give to MPV is the middle of those three sub windows (the one with the class Plex Inner).

The next version also restricts resolution switching to certain whitelisted modes (640x480, 720x576, 720p, 1080p, 2160p).

What? If I’m understanding you correctly that sounds rather bad. Why would anyone think this behavior in a TV is a good idea?

We don’t have a license to the the patents covering DTS-HD so it decodes the core. The patents for plain DTS are expired so we can decode it.

It’s worth noting this is exclusively a Windows problem. We are telling it to hide the mouse unless moved. Apparently changing refresh rate or resolution counts as moving the mouse or some other @#$%. I’ve only ever seen this the first time after changing to a new mode and never again after that.

3 Likes

Can confirm the multimonitor, multiscale factor window size issues are addressed in the 1.14 release. Thank you!