Bug 480561

Summary: Screen Recordings with HDR Turned On are Washed Out
Product: [Plasma] kwin Reporter: Dashon <dashonwwIII>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: dashonwwIII, nate, xaver.hugl
Priority: NOR Keywords: qt6
Version First Reported In: 5.92.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screen recordign with hdr on
Screen recording with hdr off
Spectacle Screen Recording

Description Dashon 2024-01-30 20:05:17 UTC
SUMMARY
Hey, I have been testing out the new experimental HDR settings in plasma 6 wayland session. It appears to work fine, but recording the screen while hdr is turned on makes for really washed out looking recordings.

I'm no expert on HDR, so I don't know if this problem is supposed to be solved by plasma or if the screen recorders are supposed to take HDR into account or if the video player is supposed to take it into account or what. That is why I decided to open a bug report here just in case.


STEPS TO REPRODUCE
1. Turn on the experimental hdr settings in the system settings app under displays.
2. Record the screen using you method of choice. (I tested with both pipewire as well as gpu screen recorder).
3. Open the video you recorded.

OBSERVED RESULT
Video looks washed out.

EXPECTED RESULT
Video should not look washed out. 

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS 
KDE Plasma Version: 5.92.0
KDE Frameworks Version: 5.248.0
Qt Version: 6.7.0
Kernel Version: 6.7.2-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
Memory: 62.7 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3080/PCIe/SSE2
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C95
System Version: 1.0
Comment 1 Dashon 2024-01-30 20:05:43 UTC
Created attachment 165365 [details]
Screen recordign with hdr on
Comment 2 Dashon 2024-01-30 20:06:05 UTC
Created attachment 165366 [details]
Screen recording with hdr off
Comment 3 Nate Graham 2024-01-30 21:12:45 UTC
Does the same issue affect Task Manager window thumbnails?
Comment 4 Dashon 2024-01-30 21:37:51 UTC
(In reply to Nate Graham from comment #3)
> Does the same issue affect Task Manager window thumbnails?

Yes, they look to be effected too.
Comment 5 Zamundaaa 2024-01-30 21:40:48 UTC
> I don't know if this problem is supposed to be solved by plasma or if the screen recorders are supposed to take HDR into account or if the video player is supposed to take it into account or what
There's no API for screen capture with HDR yet, so KWin converts the frames to sRGB before sending it to the application to make the result be usable.

> I tested with both pipewire as well as gpu screen recorder
It's expected that this does not work with gpu screen recorder, as it does not use any of our APIs but instead abuses KMS for screen recording, which is not and cannot be supported by us. It should work correctly through the screen casting portal because KWin is doing the mentioned conversions there; and that does work correctly on my PC with OBS.

What app did you use to record the videos you attached?
Comment 6 Dashon 2024-01-30 21:56:07 UTC
(In reply to Zamundaaa from comment #5)
> > I don't know if this problem is supposed to be solved by plasma or if the screen recorders are supposed to take HDR into account or if the video player is supposed to take it into account or what
> There's no API for screen capture with HDR yet, so KWin converts the frames
> to sRGB before sending it to the application to make the result be usable.
> 
> > I tested with both pipewire as well as gpu screen recorder
> It's expected that this does not work with gpu screen recorder, as it does
> not use any of our APIs but instead abuses KMS for screen recording, which
> is not and cannot be supported by us. It should work correctly through the
> screen casting portal because KWin is doing the mentioned conversions there;
> and that does work correctly on my PC with OBS.
> 
> What app did you use to record the videos you attached?

The one's I uploaded were done with gpu screen recorder, but I also took some recordings with spectacle which too my knowledge use pipewire. I will upload that video now.
Comment 7 Dashon 2024-01-30 21:56:41 UTC
Created attachment 165371 [details]
Spectacle Screen Recording
Comment 8 Dashon 2024-01-30 21:57:45 UTC
(In reply to Zamundaaa from comment #5)
> > I don't know if this problem is supposed to be solved by plasma or if the screen recorders are supposed to take HDR into account or if the video player is supposed to take it into account or what
> There's no API for screen capture with HDR yet, so KWin converts the frames
> to sRGB before sending it to the application to make the result be usable.
> 
> > I tested with both pipewire as well as gpu screen recorder
> It's expected that this does not work with gpu screen recorder, as it does
> not use any of our APIs but instead abuses KMS for screen recording, which
> is not and cannot be supported by us. It should work correctly through the
> screen casting portal because KWin is doing the mentioned conversions there;
> and that does work correctly on my PC with OBS.
> 
> What app did you use to record the videos you attached?

I'll download obs and try with that now.
Comment 9 Zamundaaa 2024-01-30 22:10:33 UTC
Spectacle does go through at least mostly the same APIs as OBS, and it too works correctly on my PC.
Do screenshots look correct for you?
Comment 10 Dashon 2024-01-30 22:29:45 UTC
(In reply to Zamundaaa from comment #9)
> Spectacle does go through at least mostly the same APIs as OBS, and it too
> works correctly on my PC.
> Do screenshots look correct for you?

Alright, after playing around with both obs and spectacle for a while. Here is what works. Screenshots work fine. Screen recording with spectacle works fine if I choose rectangular region, but not if I choose full screen. If I choose window, the colors are right, but the video is upside down. That is what gives me the video I attached before. Obs has a similar issue. Trying to choose any specific monitor results in nothing but a black screen, but choosing full workspace works fine. This could be a packaging issue on the arch side though since I am using the kde-unstable repository for my testing.
Comment 11 Dashon 2024-02-01 15:20:48 UTC
This issue seems to have been resolved after updating to RC2, so I'll close it.
Comment 12 Zamundaaa 2024-02-01 17:04:46 UTC
That explains why I couldn't reproduce the problem (on git master). Thanks for following up on this!