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

Certain videos appear more saturated than in normal media player apps #6402

Open
frenzibyte opened this issue Oct 27, 2024 · 7 comments · May be fixed by #6403
Open

Certain videos appear more saturated than in normal media player apps #6402

frenzibyte opened this issue Oct 27, 2024 · 7 comments · May be fixed by #6403
Assignees

Comments

@frenzibyte
Copy link
Member

On the right is o!f and on the left is QuickTime Player:

CleanShot 2024-10-27 at 12 24 05

Video: https://discord.com/channels/90072389919997952/892258907135836212/1297071581230530611 (to be replaced with a sharable video later).

@Joehuu
Copy link
Member

Joehuu commented Oct 27, 2024

Maybe related to ppy/osu#30399. That's talking about image alpha.

@frenzibyte
Copy link
Member Author

That does not seem to be relevant as far as I can see. In fact, I see zero difference between o!f and a media player on the existing test sample video h264.mp4.

@frenzibyte frenzibyte self-assigned this Oct 28, 2024
@frenzibyte
Copy link
Member Author

Investigations show that since the video is marked with AVCOL_SPC_UNSPECIFIED colorspace, it's looking odd in o!f because it's using these matrix coefficients, whereas forcing it to use the matrix coefficients for Rec. 709 renders the video closer? to correct colours:

CleanShot 2024-10-28 at 01 52 48

I'm still not entirely sure why this video in particular is faulty in o!f while its metadata almost exactly matches the sample video h264.mp4, which I can't notice anything wrong with it. The only thing I can find about this video is that it was exported with Premiere Pro.

@frenzibyte frenzibyte removed their assignment Oct 28, 2024
@peppy
Copy link
Member

peppy commented Oct 28, 2024

Just change it to use rec709 if unspecified and call it a day.

But where are you seeing the "video is marked with"? Are you saying that this differs from the other test video? Your description is unclear.

@frenzibyte
Copy link
Member Author

frenzibyte commented Oct 28, 2024

The other test video also has unspecified colorspace, and using the rec709 matrix for unspecified makes the test video look wrong (yellow/cyan/green colours looks more dimmed).

Test video with master's matrix coefficients:

CleanShot 2024-10-28 at 02 09 40

Test video with the BT709 matrix coefficients (above proposal):

CleanShot 2024-10-28 at 02 11 45

@peppy
Copy link
Member

peppy commented Oct 28, 2024

fwiw the owc video also looks different in quicktime vs iina (mpv/ffmpeg based):

IINA 2024-10-28 at 06 26 51

@frenzibyte frenzibyte self-assigned this Oct 29, 2024
@frenzibyte
Copy link
Member Author

frenzibyte commented Oct 29, 2024

The results are actually a bit weird, IINA is incorrect while bare mpv is correct;
CleanShot 2024-10-28 at 23 17 52

Furthermore, I was randomly searching through VLC's code and I stumbled across this:
https://github.com/videolan/vlc/blob/456d7c92575dd226c8b967d312d5a67b4fa8fb55/include/vlc_es.h#L458-L464

Then I compared it with QuickTime Player's behaviour by scaling the sample video to specific resolutions with ffmpeg while keeping the colorspace tag as unspecified, and it turns out QuickTime uses the Rec. 709 colorspace for any video with a width higher than 704 or height higher than 576. I'll push a PR inline with that behaviour seeing that both VLC and QuickTime Player do it (plus or minus implementation details).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants