Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDR #61

Closed
decknine opened this issue Sep 4, 2018 · 47 comments
Closed

HDR #61

decknine opened this issue Sep 4, 2018 · 47 comments
Labels
enhancement New feature or request

Comments

@decknine
Copy link

decknine commented Sep 4, 2018

I know moonlight on android has support for HDR. Are there plans to add HDR support to the windows client?

@cgutman cgutman added the enhancement New feature or request label Sep 4, 2018
@roncamma
Copy link

I have a nvidia Shield and certains HDR games looks very bad, so, please, if you add the HDR support, add a on/off button :)

@AkazaRenn
Copy link

Streaming from a Windows machine with HDR on is honestly terrible, would be really happy if it can support a normal color in HDR mode.

@Patbott
Copy link

Patbott commented Sep 5, 2020

I saw that it was mentioned in #429 that the renderer on Windows doesn't (currently) support HDR, but that HDR should work on macOS. However, I can confirm that also on macOS HDR does not work and also results in a washed out stream.

@cgutman
Copy link
Member

cgutman commented Sep 5, 2020

Do you have an HDR display on your Mac?

@Patbott
Copy link

Patbott commented Sep 5, 2020

Don't have an HDR display on my macbook, but I've connected it to my LG C9. (HDR in macOS itself is working, I've the option enabled in system preferences and I'm able to play videos in HDR on youtube)

@koshisan
Copy link

Would it be possible to disable HDR on the host machine when connecting in the meantime? I do not wish to stream HDR at all (since my client doesn't support it), but normally my host is connected to my TV, so I have the option enabled most of the time. However, this leads to washed out colors with moonlight...
(Btw - if someone has an idea for a helper application to manage windows setting like sound output device/hdr/resolution/etc. depending on running apps/connected displays, I am all ears)

@j9ac9k
Copy link

j9ac9k commented Jan 3, 2021

I do have a HDR external display and a macOS machine, and I got a HDR stream working using the https://github.com/lyckantropen/moonlight_hdr_launcher however images are very bright, and definitely not higher contrast, indicating that the HDR image is probably not being displayed correctly.

I'll gladly setup a dev environment and assist with testing to help drive this effort forward.

@iTaybb
Copy link

iTaybb commented Jan 14, 2021

Is it possible that moving to D3D11 will also solve fix HDR on windows? (as noted in #317 )

@nefh
Copy link

nefh commented Feb 5, 2021

Hi! I've migrated my HTPC to Windows from Linux, since Linux is not supporting HDR in OS at all. Only to see that this time HDR is not supported by Moonlight Client :). What has to be done do make HDR work in Moonlight-qt? Is here DXVA2 the only solution and we are relying on MS or are there any alternatives? Maybe Vulkan Video in future?

@Nate-Hawk
Copy link

I'd like to throw in my request for this feature as well, I have an HDR TV connected to my HTPC and it would be great if the Windows Moonlight app could support HDR. I'm curious if it would work if the Moonlight Android app was installed on Windows 11 with its upcoming native Android app support.

@shokakucarrier
Copy link
Contributor

Do you have an HDR display on your Mac?

I managed to render HDR correctly in macOS, check out #676
Thanks for contributor, HDR support is already there, just a single attachment does the job to render HDR10

@Nate-Hawk
Copy link

Nate-Hawk commented Nov 18, 2021

Do you have an HDR display on your Mac?

I managed to render HDR correctly in macOS, check out #676 Thanks for contributor, HDR support is already there, just a single attachment does the job to render HDR10

I'll try to build your fork for Windows and test it out... not really a developer so I'll have to figure out how to do that as I go along

@shokakucarrier
Copy link
Contributor

Do you have an HDR display on your Mac?

I managed to render HDR correctly in macOS, check out #676 Thanks for contributor, HDR support is already there, just a single attachment does the job to render HDR10

I'll try to build your fork for Windows and test it out... not really a developer so I'll have to figure out how to do that as I go along

What I did is just for macOS, decoder are depending on platform thus nothing changed on windows
And I don't know dxva2(Windows) so can't do anything helpful at the moment

@cgutman
Copy link
Member

cgutman commented Nov 19, 2021

Anyone who wants to test @shokakucarrier's new macOS HDR fix can use this build: https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/41591040/job/pwd55w7ddry0gd4j/artifacts

Since this was only a change to the VideoToolbox (Mac) renderer, it doesn't affect Windows or Linux platforms.

@j9ac9k
Copy link

j9ac9k commented Nov 19, 2021

I'll try it out in the next day or so; I grabbed the artifact, thanks for posting the link 👍🏻 and thanks for the contribution @shokakucarrier

@j9ac9k
Copy link

j9ac9k commented Nov 19, 2021

Just tested AC Odyssey, and it just worked...

Set HDR without issue, and an running the benchmark. Before, the video would be way way way too bright (like you're outside on a really really sunny day), but this is ... Perfect

For completeness I have an AW3821DW monitor connected via display port to a 2019 13" MacBook Pro

EDIT: wrote the above on my mobile client, but @shokakucarrier thank you so much for the PR and making this happen! I know this feature isn't cross platform, but AFAIK this makes moonlight the only game streaming platform to have HDR support anywhere. @cgutman thanks for merging and maintaining this awesome tool!

EDIT2: I'll try a game that requires OS level HDR (which I also can toggle with my self) like Cyberpunk 2077 in a bit.

@nefh
Copy link

nefh commented Nov 19, 2021

Good to hear about update on macOS! Now I only wish dxva2 or d3d11 will be updated someday as well :)

@shokakucarrier
Copy link
Contributor

shokakucarrier commented Nov 21, 2021

Good to hear about update on macOS! Now I only wish dxva2 or d3d11 will be updated someday as well :)

dxva2 doesn't support HDR at all, cuz it's based on d3d9, needs to be replaced by d3d11va, and that's not an easy task

@j9ac9k
Copy link

j9ac9k commented Dec 8, 2021

slight update on this issue with respect to macOS build that @cgutman linked to above.

What doesn't work is streaming the desktop. Managed to grab the screenshot of the warning message that pops up when I attempt to stream mstsc.exe

image

The image is clearly too bright, but you can disable HDR from on the host (image still isn't quite right), disconnect, reconnect and everything looks as it should.

@cgutman
Copy link
Member

cgutman commented Dec 11, 2021

@j9ac9k yep, that's expected since custom added apps can't have HDR enabled. Assuming you've got HDR enabled on the host, the blown out colors are because GFE doesn't perform correct HDR to SDR tonemapping.

@shokakucarrier
Copy link
Contributor

shokakucarrier commented Jan 10, 2022

slight update on this issue with respect to macOS build that @cgutman linked to above.

What doesn't work is streaming the desktop. Managed to grab the screenshot of the warning message that pops up when I attempt to stream mstsc.exe

The image is clearly too bright, but you can disable HDR from on the host (image still isn't quite right), disconnect, reconnect and everything looks as it should.

Use moonlight_hdr_launcher to stream custom HDR content in the host, I'm using this with mstsc and it just works

@cgutman
Copy link
Member

cgutman commented Jan 22, 2022

@shokakucarrier @j9ac9k If you would, please test HDR on this build for me: https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/42296175/job/1u1yakfougomrpoe/artifacts

I have updated to FFmpeg 5.0 and tweaked some colorspace stuff in the VideoToolbox renderer. I want to make sure I haven't broken HDR.

@j9ac9k
Copy link

j9ac9k commented Jan 22, 2022

@shokakucarrier @j9ac9k If you would, please test HDR on this build for me: https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/42296175/job/1u1yakfougomrpoe/artifacts

I have updated to FFmpeg 5.0 and tweaked some colorspace stuff in the VideoToolbox renderer. I want to make sure I haven't broken HDR.

Not a problem; are there specific use cases you want me to test or just make sure it was working the way it was before?

@cgutman
Copy link
Member

cgutman commented Jan 22, 2022

It would be ideal if you could try both with and without HDR just to make sure the colors are correct in both cases. Thanks!

@j9ac9k
Copy link

j9ac9k commented Jan 22, 2022

might be a bit before I can follow up, looks like when upgrading to macOS 12.1 I lost the HDR option for my external display; going to investigate further:
image

EDIT: scratch that, UI bug perhaps, selected the main display then the external display; and all is well in the world:

image

@j9ac9k
Copy link

j9ac9k commented Jan 23, 2022

Just tested with Assassin's Creed Odyssey. Moonlight 3.2 and the version linked above behave the same as far as HDR is concerned, it "works"; but there are issues (with both), primary of which is that the host desktop resolution needs to be changed to match the game resolution (so alt-tab out of the game, change the resolution in the nvidia control panel, go back); if this isn't done, the video image is very fuzzy, like it's upscaling a 720p stream to my ultrawide monitor resolution.

Also, my system has changed somewhat since I tested the original version; I have a different GPU in the host now (Nvidia Quadro RTX 4000). I am unable to toggle OS-wide HDR setting (so AC Odyssey worked with HDR enabled (and looked ok) while OS HDR setting was off. I'm curious why I can't toggle OS HDR wide mode, but that's an issue for another time.

@JohnySummers
Copy link

slight update on this issue with respect to macOS build that @cgutman linked to above.
What doesn't work is streaming the desktop. Managed to grab the screenshot of the warning message that pops up when I attempt to stream mstsc.exe
The image is clearly too bright, but you can disable HDR from on the host (image still isn't quite right), disconnect, reconnect and everything looks as it should.

Use moonlight_hdr_launcher to stream custom HDR content in the host, I'm using this with mstsc and it just works

Hello, please send me instructions how enable to work with mstsc? I installed moonlight hdr launcher and hdr works in steam big screen only. Please help configure mstsc to work in hdr. Thank you!

@j9ac9k
Copy link

j9ac9k commented Jan 23, 2022 via email

@JohnySummers
Copy link

Yes, but shokakucarrier user said it worked!

@JohnySummers
Copy link

Or maybe someone know how configure moonlight_hdr_launcher to launch specified game in HDR?

@cgutman
Copy link
Member

cgutman commented Feb 5, 2022

Experimental HDR support is now implemented for Windows 10 1709 and later via a new D3D11 renderer. Please let me know how it works for you.

Here is a test build: https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/42466233/job/ahnfqu13ph0yq44b/artifacts

Known issues:

  • Performance in full-screen and borderless windowed mode with v-sync enabled is worse than expected

@JohnySummers
Copy link

Sorry, but I don't understand how to test it. I use my phone to connect with moonlight.

Experimental HDR support is now implemented for Windows 10 1709 and later via a new D3D11 renderer. Please let me know how it works for you.

Here is a test build: https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/42466233/job/ahnfqu13ph0yq44b/artifacts

Known issues:

  • Performance in full-screen and borderless windowed mode with v-sync enabled is worse than expected

@carycary246
Copy link

Experimental HDR support is now implemented for Windows 10 1709 and later via a new D3D11 renderer. Please let me know how it works for you.

Here is a test build: https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/42466233/job/ahnfqu13ph0yq44b/artifacts

Known issues:

  • Performance in full-screen and borderless windowed mode with v-sync enabled is worse than expected

Did a quick test and can confirm that the HDR is working using MassEffectAndromeda.exe workaround, but seems to be an issue where the stream would freeze randomly and needs to be restarted. Great work finally adding support for this.

@j9ac9k
Copy link

j9ac9k commented Feb 6, 2022 via email

@cgutman
Copy link
Member

cgutman commented Feb 7, 2022

Here is an updated Windows build that fixes the full-screen performance issues: https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/42471232/job/8rs0bx4ttj3b8418/artifacts

Please test HDR and let me know:

  • Selected resolution, frame rate, and display mode in Moonlight
  • Client PC GPU
  • Games tested
  • Performance: Good or Bad?
  • Anything else you think is worth noting

@j9ac9k
Copy link

j9ac9k commented Feb 7, 2022

Hi @cgutman thanks for your work on this, I understand this was a big feature, so congratulations on reaching experimental stage here.

While I did manage to toggle HDR on, and at a glance, things look correct (see screenshot) the stream overlay info did not reflect "Main 10" in the codec, despite the HDR experimental decoder being selected, and HDR being enabled in the options.

Screenshot 2022-02-06 204222

To the information you requested

  • 3840x1600 is the requested resolution @ 120Hz, Fullscreen
  • Client PC GPU is Nvidia RTX 3080
  • Hellblade Senua's Sacrifice (can also test AC Odyssey, AC Origin, and Hitman 2, if I get OS HDR working, I'll test Cyberpunk 2077, although the game would crush the host)
  • Performance: within expectations ~20-30 fps on opening intro (would say performance is good).

It's worth noticing the hardware on my host here is somewhat weak; I am running Windows in a VM with 4 cores of a Xeon E5-2680v2 CPUs allocated and a Quadro RTX 4000 GPU; so while I have wired network connectivity, I would benefit

Oddly enough; when I connected using the "moonlight_hdr_launcher", set the resolution to something more reasonable for the host (2560x1080), the codec indicated it was showing HEVC Main 10; but HDR was not shown as an option in the settings:

image

The OS wide HDR setting is disabled, and when I try and toggle it on, it just toggles itself back off; and I haven't been able to get to the bottom of that yet.

@gustavom95
Copy link

Hi @cgutman , thanks for all the work putting HDR together for the Windows client. After many hours of frustration troubleshooting from my side, I'm happy to report that I believe I got it to work, and the HDR looks to my eye just as good on my living room TV from Moonlight, as it does when I use my PC natively hooked to it (comparing Youtube HDR videos).

Below is a summary of setup
Client:

  • GTX 1070
  • Moonlight Settings - 4K, 60fps, HEVC HDR (Experimental), 150mbps, Borderless Fullscreen

Host:

  • RTX 3080
  • Ryzen 3700x
  • EDID Emulator (4K HDR)

Tested:

  • No Man's Sky
  • Youtube HDR videos through Chrome

Performance: Good

The one issue I found that took me a while to get around is that HDR does not work for me when using the Fullscreen setting in the client. According to the real-time stats, it's streaming HEVC Main 10, but my TV does not detect it as HDR so I get incorrectly colored video. However, what has worked is playing in Borderless Fullscreen; my TV does detect HDR when borderless and it looks as I would expect.

For others curious about how I did my setup, I'm using moonlight_hdr_launcher, set it up to launch GOG launcher with HDR enabled in the moonlight HDR config ini. From there I launched No Man's Sky, and messed around with some youtube videos. I'm streaming from an EDID emulator, and disable my monitors on my PC (non-HDR) so that it streams from the EDID adapter without issue (using multimonitortool and some autohotkey keybinds to enable/disable).

@cgutman
Copy link
Member

cgutman commented Feb 12, 2022

OK, here's one more build: https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/42531737/job/9mh04s3kycfqj5qu/artifacts

Changes:

  • Removed the per-app HDR compatibility check, so Moonlight will start an HDR-compatible stream for any app (regardless of official GameStream HDR support). Apps using Nvidia's older HDR APIs should work without an HDR display on the host, but apps that use Win10's OS HDR support will require an HDR display on your host.
  • Performance optimizations to reduce GPU usage while streaming HDR content

The one issue I found that took me a while to get around is that HDR does not work for me when using the Fullscreen setting in the client. According to the real-time stats, it's streaming HEVC Main 10, but my TV does not detect it as HDR so I get incorrectly colored video. However, what has worked is playing in Borderless Fullscreen; my TV does detect HDR when borderless and it looks as I would expect.

I wonder if Moonlight is changing your display mode to something that doesn't support HDR (due to HDMI limitations). Can you try the build I linked in this post and attach the Moonlight logs?

@Athanaetos
Copy link

Athanaetos commented Feb 18, 2022

OK, here's one more build: https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/42531737/job/9mh04s3kycfqj5qu/artifacts

Changes:

  • Removed the per-app HDR compatibility check, so Moonlight will start an HDR-compatible stream for any app (regardless of official GameStream HDR support). Apps using Nvidia's older HDR APIs should work without an HDR display on the host, but apps that use Win10's OS HDR support will require an HDR display on your host.
  • Performance optimizations to reduce GPU usage while streaming HDR content

The one issue I found that took me a while to get around is that HDR does not work for me when using the Fullscreen setting in the client. According to the real-time stats, it's streaming HEVC Main 10, but my TV does not detect it as HDR so I get incorrectly colored video. However, what has worked is playing in Borderless Fullscreen; my TV does detect HDR when borderless and it looks as I would expect.

I wonder if Moonlight is changing your display mode to something that doesn't support HDR (due to HDMI limitations). Can you try the build I linked in this post and attach the Moonlight logs?

I can't get it to work no matter what i try. Games that work on my phone don't work on the TV. There's 0 indication or settings on the Moonlight build itself to let me know what's wrong. Am i supposed to enable HDR somehow?

All games have HDR grayed out.

@cgutman
Copy link
Member

cgutman commented Feb 18, 2022

To enable HDR, you'll need to adjust the Video codec option to "HEVC HDR". If that option doesn't appear, then your PC probably doesn't meet the requirements here: https://docs.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range#system-requirements

@j9ac9k
Copy link

j9ac9k commented Feb 18, 2022

Hi @cgutman sorry it took me a bit to get to this.

Starting with mstsc.exe, I can stream the desktop, when I attempt to toggle "Use HDR" on the host, it untoggles itself momentarily after. The only time I've managed to have this toggle remain on is when using the moonlight_hdr_launcher which unfortunately sets the resolution to 720p @ 30fps. I'm not sure if this is a limitation of the DisplayPort to HDMI adapter I'm using (and I'm not sure how to debug). The stream to mstsc.exe works though, and registers as Codec Main 10. In case it helps with anything, I've attached a log of connecting to the host using mstsc.exe and attempting to toggle HDR on on the host.

Moonlight-1645160475.log

For testing a HDR game, decided to stick with Hellblade Senua's Sacrifice. When launching the game directly from moonlight, HDR does work, but the host resolution for some reason gets set to 720p, which results in really awful rendering; notice screenshot (sorry for the large image)

image

I ALT-Tabbed, up the resolution to match the moonlight setting (2560x1080) and everything looked good, looks like the HDR option was still enabled

Moonlight-1645160995.log

For context:

Host: Windows 10 - Quadro RTX 4000 GPU (running in a VM with 4 cores of E5-2680v2 CPU)
Client: Windows 11 - RTX 3080 GPU - AMD 5900x CPU

Without knowing the internals of how this works, I suspect what's happening is the toggle to enable HDR is forcing the connection to connect at 720p @ 30 fps; and I am suspicious of my display port to HDMI adapter (Quadro RTX 4000 only has 3x DisplayPort connections, no HDMI connections). The dummy HDMI device should be able to simulate a HDMI 2.0b connection.

Let me know if there is something else you would like me to test.

@j9ac9k
Copy link

j9ac9k commented Feb 18, 2022

Turns out I had a "good" DisplayPort to HDMI adapter, plugged it in...I can now stream the desktop (mstsc.exe) with HDR at my "full" resolution (3840x1600); unfortunately this adapter is in use elsewhere; so I'll order a second one right now

In case anyone comes across this issue here from the internets; this is the adapter I'm using: https://www.amazon.com/CAC-1080-DisplayPort-Adapter-displays-4096x2160/dp/B077JB28KM

Ok but for debug purposes; ... if I establish a "new" connection to mstsc.exe where HDR is already enabled, I get overly bright images like this:

image

Toggling HDR on/off fixes the issue (unfortunately there is a bug with windows screenshot tool with HDR selection that makes it look like the screenshot has an overly bright image, take my word for it, toggling HDR off/on fixes it)

Doing a quick disconnect/reconnect seems to preserve the "correct-ness" of the HDR image (so Ctrl + Shift + Alt + Q and then prompt reconnect, and we're good).

I'll do more testing later.

@j9ac9k
Copy link

j9ac9k commented Feb 18, 2022

One last note, I wouldn't post this except for safety concerns.

If you're sensitive to seizures from light sources, be very very careful when attempting to Launch Cyberpunk 2077 with OS HDR mode enabled.

@Athanaetos
Copy link

To enable HDR, you'll need to adjust the Video codec option to "HEVC HDR". If that option doesn't appear, then your PC probably doesn't meet the requirements here: https://docs.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range#system-requirements

Oh wow I had no idea that you need a fairly new PC to stream HDR. That is very unfortunate because it just doesn't make sense to upgrade my TV PC. I thought supporting HDR was enough. Thanks for letting me know though. Since thats probably the reason why.

@CarpetHead
Copy link

looks like the build links have expired, any chance for some fresh ones? is there any plan to merge these changes?

@cgutman
Copy link
Member

cgutman commented Mar 26, 2022

The changes are already merged but I left this open until the next official release comes out.

Here’s a new build: https://ci.appveyor.com/project/cgutman/moonlight-qt/builds/42952211/job/snk3x4cx4qw0p7jr/artifacts

@cgutman
Copy link
Member

cgutman commented Apr 2, 2022

Released in v4.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests