Aleksoid1978 / VideoRenderer

Внешний видео-рендерер
GNU General Public License v3.0
1.04k stars 116 forks source link

MPC-BE auto change launch in FS does not work when rendering HDR video with MPC-VR #68

Closed Fr0stX76 closed 6 months ago

Fr0stX76 commented 1 year ago

Specs: Windows 10 22H2 Nvidia 3090 Driver 526.98 MPC-BE 1.6.5.3 x64 MPC-VR 0.6.3.1956 x64

The issue I have is that when I open an HDR video (see image attached) rendered by MPC-VR (default options, see attached image) , the auto change display in MPC-BE does not work if the option "launch in Fullscreen" is selected (see attached image). If I remove this option, start the video (in windowed mode), then go to Fullscreen manually, the display switches as expected.

Opening an SDR video (x265 BT709) with the same setup and option work perfectly without having to go to windowed first, it only affect HRD video.

Also using the same setup and options with MPC-BE and Madvr (which I'm trying to move away from...) will work with both HDR and SDR video, so it seems to be pointing at MPC-VR.

Is this expected? Or maybe there is something I did not setup properly in MPC-BE and/or in MPC-VR?

MPC-BE Change modejpg

MPC VR settingsjpg

HDR Video

JTGaming commented 6 months ago

I just left home, so i won't have access to the exact code for a couple hours, but the gist of it is: Check display refresh rate before ToggleHDR() and compare it to after calling that. If the refresh rate changed (which we don't want to happen), set refresh rate to what it was before ToggleHDR().

Not really fixing the issue, more just working around it, but I'm not sure there's a better way of doing it in mpcvr since there's no way to set refresh rate and hdr at the same time (like resolution and refresh rate, for example).

But at least it fixes this issue in mpcbe and mpchc too (which i use myself).

Aleksoid1978 commented 6 months ago

Better do all in MPC VR - so it's will be working with any player. So - give me a patch, i'l look and test.

Fr0stX76 commented 6 months ago

I confirm, the MPCBE test build + latest nightly build also fixes the issue on my setup

Aleksoid1978 commented 6 months ago

Tomorrow I'll try modify VR.

JTGaming commented 6 months ago

I'll be home in about an hour, so I'll publish the code then

Aleksoid1978 commented 6 months ago

Trying this build, with MPC-BE or MPC-HC. MpcVideoRenderer-0.7.2.2199_git2024.02.21-ab1a2ad.zip

JTGaming commented 6 months ago

it works for me, but I've noticed that it takes a bit longer to switch back to normal when closing the player. Your version goes: HDR 60Hz -> SDR 240Hz -> SDR 60Hz -> SDR 240Hz whereas with the build in my pr, it just does: HDR 60Hz -> SDR 240Hz besides that, it's the same.

Aleksoid1978 commented 6 months ago

That's right - when we turn off HDR mode, we can also “lose” the current display mode. We can turn on/off HDR mode not only when going to full screen or opening a file, but for example when changing settings.

Fr0stX76 commented 6 months ago

The new MPC-VR build also fixed the issue (with the official release of MPC-BE)

clsid2 commented 6 months ago

it works for me, but I've noticed that it takes a bit longer to switch back to normal when closing the player. Your version goes: HDR 60Hz -> SDR 240Hz -> SDR 60Hz -> SDR 240Hz

A possible future improvement could be to add API function to renderer that can be called by player. Something like SetDisplayInfo(displayName, displayModeNew, displayModeOriginal). Where displayModeNew is the display mode set by player and displayModeOriginal is the original one from before playback. Then add a bool to ToggleHDR to indicate if it is called when renderer is closing. In that case either displayModeNew or displayModeOriginal is acceptable. In example above, you get original mode directly after HDR exit, and you can avoid the two extra switches.

And alternatively, you can just let the renderer do all switching. Then just use the API to let player signal the desired and the original DisplayMode. Player may only need to restore original then in some cases depending on settings. This may be more efficient, as you could turn on HDR first and then correct refreshrate when needed. That would be 1 or 2 switches instead of current 2 or 3.

JTGaming commented 6 months ago

Yes, I've thought that would be more ideal - instead of having the player change refresh rate and renderer change hdr status - you would have one or the other do both jobs.

Maybe just port the hdr toggling code from the renderer to the player? But that seems like more work that requires changing both codebases, not sure how that would play with other custom players/renderers.

clsid2 commented 6 months ago

Renderer must do HDR toggle. Letting player do that makes no sense.

Only logical step is to move refreshrate switch to renderer. Only restoring original state can be left for player to do.

Aleksoid1978 commented 6 months ago

People, stop fantasizing. Nothing will be transferred anywhere. And if you don’t like the fact that it’s taking longer to switch HDR, uncheck the “restore resolution when exiting the program” checkbox in the player and you’ll be happy.