SUMMARY Window recording produces a video with resolution of actual resolution divided by scaling factor (logical geometry?), rather than actual resolution, resulting a blurry and small content. While full screen recording produces correct actual physical resolution. It is also reproducible in obs-studio (https://github.com/obsproject/obs-studio) via "Screen Capture (Pipewire)": with the same full screen game, capturing the full screen gives a 2560x1440 clear source, while capturing the game window itself gives a 2048x1152 blurry source. (My display is 2560x1440 with 125% scale) STEPS TO REPRODUCE 1. Have a 2560x1440 display, and set scale to 125% 2. Open "dolphin" and maximize it to occupy (almost) the full screen. 3. Open "spectacle", click "Recording" - "Window" - select the dolphin window. Wait for one second and stop recording. 4. Repeat 3 but record with "Full Screen". OBSERVED RESULT The video from step 3 (window recording) is 2048x1104 for me, which is approximately (2560/1.25)x(1440/1.25), minus the plasma panel on the top. The text in video is also blurry and hard to read. The video from step 4 (full screen recording) is exactly 2560x1440, the text inside is clear and easy to read. EXPECTED RESULT The resolution of video from step 3 should be 2560x(1440 - top panel height) on maximized dolphin window. And the text should be as clear as in full screen recorded video. SOFTWARE/OS VERSIONS Operating System: NixOS 25.05 KDE Plasma Version: 6.2.4 KDE Frameworks Version: 6.8.0 Qt Version: 6.8.0 Kernel Version: 6.6.63 (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 5700G with Radeon Graphics Memory: 31.0 GiB of RAM Graphics Processor: Mesa Intel® Arc ADDITIONAL INFORMATION Also reproduced in obs-studio 30.2.3
After some debugging, I made it work with the following patch on top of kwin v6.2.4. With it, both spectacle and obs-studio record the non-scaled correct resolution and the content looks clear. I hope it helps, but I'm not sure if it's ideal and it's not applicable on kwin master due to some non-trivial code change. ``` diff --git a/src/plugins/screencast/windowscreencastsource.cpp b/src/plugins/screencast/windowscreencastsource.cpp index f2a1432e4d..2b2c6ed36d 100644 --- a/src/plugins/screencast/windowscreencastsource.cpp +++ b/src/plugins/screencast/windowscreencastsource.cpp @@ -49,12 +49,12 @@ quint32 WindowScreenCastSource::drmFormat() const QSize WindowScreenCastSource::textureSize() const { - return m_window->clientGeometry().size().toSize(); + return m_window->clientGeometry().size().toSize() * devicePixelRatio(); } qreal WindowScreenCastSource::devicePixelRatio() const { - return 1.0; + return m_window->preferredBufferScale(); } void WindowScreenCastSource::render(QImage *target) -- ```
You can make that work on git master by replacing preferredBufferScale() with targetScale(). Would you like to make a merge request with that change?
(In reply to Zamundaaa from comment #2) > You can make that work on git master by replacing preferredBufferScale() > with targetScale(). Would you like to make a merge request with that change? Thanks for the advice, but I don't have a kwin dev&test environment. I'm currently hot-patching kwin's Nix package in my production system. The master branch contains many dependency changes (kdecoration3 and all its dependents) which are incompatible with build scripts from released version. I'm unfamiliar with fixing it. If it's more convenient for you to test the 2-line-change, feel free to adopt it in upstream. Thanks!
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6906
Git commit b6e6000d9729f740f9a17cf4d4517703a8da09fa by Xaver Hugl. Committed on 17/12/2024 at 13:29. Pushed by zamundaaa into branch 'master'. plugins/screencast: take scaling into account for window sources Otherwise the textures will be too small, and the result blurry M +2 -2 src/plugins/screencast/windowscreencastsource.cpp https://invent.kde.org/plasma/kwin/-/commit/b6e6000d9729f740f9a17cf4d4517703a8da09fa
Git commit 4048d208f72b74f2393e6f129a1802ae447f228b by Xaver Hugl. Committed on 17/12/2024 at 15:18. Pushed by zamundaaa into branch 'Plasma/6.2'. plugins/screencast: take scaling into account for window sources Otherwise the textures will be too small, and the result blurry (cherry picked from commit b6e6000d9729f740f9a17cf4d4517703a8da09fa) Co-authored-by: Xaver Hugl <xaver.hugl@gmail.com> M +2 -2 src/plugins/screencast/windowscreencastsource.cpp https://invent.kde.org/plasma/kwin/-/commit/4048d208f72b74f2393e6f129a1802ae447f228b