Bug 477318 - preview of video after screencapture has blue-yellow inverted
Summary: preview of video after screencapture has blue-yellow inverted
Status: RESOLVED UPSTREAM
Alias: None
Product: Spectacle
Classification: Applications
Component: General (other bugs)
Version First Reported In: 23.08.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-21 08:58 UTC by Robert Riemann
Modified: 2023-11-24 14:17 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screenshot of koko – wrong colors (429.21 KB, image/png)
2023-11-23 13:24 UTC, Robert Riemann
Details
qtmultimedia-mediaplayer-video_color_bug.qml (1.65 KB, text/x-qml)
2023-11-23 19:59 UTC, Noah Davis
Details
screenshot of koko and qt6 qml player side-by-side (1.01 MB, image/png)
2023-11-24 09:34 UTC, Robert Riemann
Details
test video recorded with spectacle (mp4) (455.92 KB, video/mp4)
2023-11-24 09:35 UTC, Robert Riemann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Riemann 2023-11-21 08:58:58 UTC
SUMMARY

The colors in the preview video after recording a video from a window are wrong. I believe blue and yellow are inverted or so.


STEPS TO REPRODUCE
1. record a webm video from firefox with e.g. an image of ukraine flag
2. check the preview video shown after the end of the recording
3. notice that the colors are off

OBSERVED RESULT

colors are wrong

EXPECTED RESULT

colors should be like on screen (and as they are in the recorded file)

I am running openSUSE Tumbleweed 20231108 (x86_64)
Comment 1 Noah Davis 2023-11-22 05:24:03 UTC
I am on the unreleased 24.02 version, but I cannot reproduce this. What is your system info and what video format are you using? I need to know things like your GPU and CPU in case GPU encoding is affecting the colors.

I am using an AMD Ryzen 7 4800H CPU with integrated AMD Radeon graphics (Renoir), Mesa graphics drivers 23.2.1 and Linux kernel 6.6.1. The video formats I tried are WebM (VP9, CPU encoding) and MP4 (H.264, GPU encoding). Since you're on Spectacle 23.08.2, you should have WebM (VP8) and MP4 (H.264) as your options. Whether or not they encode with the GPU or CPU depends on what your GPU supports. You can find out by running `vainfo | grep Enc` if you have libva-utils installed.
Comment 2 Noah Davis 2023-11-22 05:27:02 UTC
Never mind about the format, I missed the part where you said you are using webm, but I'd still like to see the output of `vainfo`
Comment 3 Robert Riemann 2023-11-22 08:59:14 UTC
My output of `vainfo | grep Enc` :

libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_19
libva info: va_openDriver() returns 0
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointEncSlice


My graphics card: Mesa Intel® UHD Graphics 620

Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) UHD Graphics 620 (KBL GT2) (0x5917)
    Version: 23.2.1
    Accelerated: yes
    Video memory: 15874MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics 620 (KBL GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.2.1
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
Comment 4 Noah Davis 2023-11-22 10:03:21 UTC
It looks like you could be using GPU encoding for VP8. Does the bug go away if you run `KPIPEWIRE_FORCE_ENCODER=libvpx spectacle -i` and do a recording?

I can't test GPU encoding with VP8 since my GPU only supports encoding with H.264 and H.265 (HEVC).
Comment 5 Robert Riemann 2023-11-22 10:08:55 UTC
(In reply to Noah Davis from comment #4)
> It looks like you could be using GPU encoding for VP8. Does the bug go away
> if you run `KPIPEWIRE_FORCE_ENCODER=libvpx spectacle -i` and do a recording?
> 
> I can't test GPU encoding with VP8 since my GPU only supports encoding with
> H.264 and H.265 (HEVC).

Not sure if this is clear already: The recorded video has accurate colors. The problem with wrong colors occurs during video playback inside Spectacle.

Starting the app with `KPIPEWIRE_FORCE_ENCODER=libvpx spectacle -i` does not help. The wrong colors in playback also occur when I choose mp4.
Comment 6 Noah Davis 2023-11-22 10:35:40 UTC
(In reply to Robert Riemann from comment #5)
> Not sure if this is clear already: The recorded video has accurate colors.
> The problem with wrong colors occurs during video playback inside Spectacle.
> 
> Starting the app with `KPIPEWIRE_FORCE_ENCODER=libvpx spectacle -i` does not
> help. The wrong colors in playback also occur when I choose mp4.

So only Spectacle's video player looks wrong? All other video players look fine? That is a strange bug. I can only assume it's a bug with Qt Multimedia or whatever backend Qt uses since our video player just uses Qt Multimedia's MediaPlayer and VideoOutput. Qt Multimedia might be using ffmpeg or gstreamer in the backend, but those should normally be fine.

Can you try playing the video with Koko (`sudo zypper in koko`)? That's the only other KDE app I know of that uses Qt Multimedia to play videos. Does it also have the bug?
Comment 7 Robert Riemann 2023-11-23 13:24:20 UTC
Created attachment 163393 [details]
screenshot of koko – wrong colors

So I installed koko (koko-23.08.3-1.1.x86_64) and indeed: Koko suffers from the same color issue.
Comment 8 Noah Davis 2023-11-23 19:59:32 UTC
Created attachment 163405 [details]
qtmultimedia-mediaplayer-video_color_bug.qml

(In reply to Robert Riemann from comment #7)
> Created attachment 163393 [details]
> screenshot of koko – wrong colors
> 
> So I installed koko (koko-23.08.3-1.1.x86_64) and indeed: Koko suffers from
> the same color issue.

Thanks. It looks like Qt Multimedia is where the bug is, but I just remembered Qt Multimedia had some big changes in Qt 6. I wrote a basic Qt 6 QML UI that we can test with. Could you try the same video with this QML file? You can run it with `qml6 the_qml_file.qml your_video.mp4`. You'll need to set the path to the QML file and the video yourself since this is just an example command. `qml6` comes from the qt6-declarative-tools package and you may need to install the qt6-multimedia-imports package as well.

If you can still reproduce the bug with Qt 6, can you file a Qt bug? Since I cannot reproduce the bug, I will not be able to help Qt devs do it either. In the "Component/s" field, put "Multimedia". In the "Environment" field, put your system info. Be sure to attach the QML file I gave you as well so that the Qt devs can reproduce the bug using the same code as us.
https://bugreports.qt.io/secure/CreateIssue!default.jspa
Comment 9 Robert Riemann 2023-11-24 09:33:32 UTC
I shared your expectation that this could be a Qt6 bug, but in fact your qml player shows the colors accurately.

I attach my test video and a screenshot with both apps playing the video (paused for the screenshot)
Comment 10 Robert Riemann 2023-11-24 09:34:48 UTC
Created attachment 163419 [details]
screenshot of koko and qt6 qml player side-by-side
Comment 11 Robert Riemann 2023-11-24 09:35:39 UTC
Created attachment 163420 [details]
test video recorded with spectacle (mp4)
Comment 12 Noah Davis 2023-11-24 14:17:48 UTC
I suppose that means the problem is already fixed in Qt 6 and the solution is to wait for Spectacle 24.02 (Qt6-only). Spectacle 23.08 is a Qt 5 app.