mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.84k stars 2.87k forks source link

Wrong colorspace in Dolby Vision video (expect HDR, actual SDR) #9761

Closed riverscn closed 1 year ago

riverscn commented 2 years ago

Important Information

Provide following Information:

If you're not using git master or the latest release, update. Releases are listed here: https://github.com/mpv-player/mpv/releases

Reproduction steps

--vo=gpu-next --gpu-api=vulkan enable DoVi and play a dolby vision video

Expected behavior

Primaries: bt.2020 Colormatrix: ?? Gamma: ??

Actual behavior

image

Log file

Make a log file made with -v -v or --log-file=output.txt, paste it to https://0x0.st/ or attach it to the github issue, and replace this text with a link to it.

Sample files

Sample files needed to reproduce this issue can be uploaded to https://0x0.st/ or similar sites. (Only needed if the issue cannot be reproduced without it.) Do not use garbage like "cloud storage", especially not Google Drive.

quietvoid commented 2 years ago

The default target is SDR, so I'm not sure how this is an actual issue?

If you want HDR + 2020, specify it in your config:

target-trc=pq
target-prim=bt.2020
haasn commented 2 years ago

Maybe we should have separate properties for "tagged primaries" and "effective primaries". The latter notably also depends on the VO in use. At the moment only --vo=gpu-next will actually apply dolby vision.

What do you suggest should happen for something like profile 8.1?

natural-harmonia-gropius commented 2 years ago

What do you suggest should happen for something like profile 8.1?

shows base layer's info, add somethings like a tag of dolbyvision, like when playing hdr it would shows peak after gamma

Doofussy2 commented 2 years ago

The default target is SDR, so I'm not sure how this is an actual issue?

If you want HDR + 2020, specify it in your config:

target-trc=pq
target-prim=bt.2020

That changes nothing. It still reads as SDR primaries.

quietvoid commented 2 years ago

Right I hadn't understood that the issue refers to the OSD information.

Doofussy2 commented 2 years ago

Also, using pq ruins the picture. I run windows in HDR and the picture degrades when increasing the gamut and/or using pq transfer.

Doofussy2 commented 2 years ago

using pq ruins the picture

I suppose tonemapper should be turned off. And you need to force HDR context d3d11-output-csp=pq

I don't think so. If I'm correct, there is no mechanism to hook the metadata to the windows swapchain, like the Dolby addon for windows. And no way to send the metadata to a DV enabled display. So tone mapping is all we have.

Doofussy2 commented 2 years ago

no mechanism to hook the metadata to the windows swapchain, like the Dolby addon for windows

Yes, dynamic metadata is not supported, but still you should force hdr to force 10 bit color and force absense of SDR--> HDR inverse tonemapping of windows 11 and force absence of 709 --> 2020 primaries conversion windows does.

Agreed. That would be a good thing.

I haven't upgraded to Win 11, yet. I don't have enough time to fix any breakages that might occur. So I'm waiting for a while.

Doofussy2 commented 2 years ago

I currently have everything running with bt.2020 and pq, and I'm mostly satisfied with it. But with gpu-next, it isn't useable. I'm waiting to see what happens with the d3d11 PR. Hopefully it will sync up with Windows, like vo=gpu does. I can't really use DV tone mapping until that gets resolved, as there isn't a specific property for DV that allows me to create a profile to switch vo.

diannaojiang commented 2 years ago

as there isn't a specific property for DV that allows me to create a profile to switch vo.

@Doofussy2 try this profile-cond=(p["video-dec-params/gamma"] == "auto")

AstralStorm commented 2 years ago

On mpv 0.34.0-221-g1c49d5735d still the same issue. Also found that it interacts with inverse-tone-mapping option, which is incorrectly applied to the video that's definitely not SDR. (Update: no it does not.)

Tonemapping also fails when target-trc=pq is not provided, clipping hard, despite output being set in HDR which should set it to that value by default. (regardless of d3d11-output-csp setting) The picture does not degrade when using PQ TRC. The picture hard clips without that. Additionally, not providing target-prim=bt.2020 oversaturates and clips the colors. Not providing target-peak at correct peak value will wash everything out, most likely.

tone-mapping setting is applied.

Please really verify against true DV output when saying "degrades the colors". It produces output comparable with "Cinema Home" (calibrated) settings on LG CX 48" in (calibrated) Game PC HGIG mode if:

tone-mapping=bt.2446a
target-trc=pq
target-prim=bt.2020
target-peak=570

(the peak is the calibrated peak value for my PC Game mode)

Obviously the DV is tonemapped back to HDR10 with the target settings, and the tonemap is slightly different from whatever dynamic thing DV chip is doing. Besides the settings issues, it looks pretty decent.

AstralStorm commented 2 years ago

For reference, the check used Containers video from Demolandia, directly downloaded. NASA is better at uncovering wrong gamut - which it is, since there's no way to provide the display gamut to mpv just yet, maybe except target-lut... soon. Using static tonemap in the TV works correctly though.

AstralStorm commented 2 years ago

Of course mpv does not do 12-bit PQ, because it uses d3d11 rgb10_a2 mode. That gives 10-bit output. It'd need a rgb16f scRGB output which it does not have yet.

There was no game mode peak bug, there was a case of someone not checking that the settings are vastly different. Rtings sucks. (I've measured the peaks, they're exactly the same. Getting some 600 nit before - at 10% D65 white point, calibrated. LG CX 48" is a bit darker than bigger ones. It does some 650 nit uncalibrated with warm setting.)

Of course in some content what mpv does now won't work best - especially if metadata is used to touch up the video a lot. mpv does not use any metadata from DV so far I think. (Also do tell which example.)

Hrxn commented 2 years ago

Of course mpv does not do 12-bit PQ, because it uses d3d11 rgb10_a2 mode. That gives 10-bit output. It'd need a rgb16f scRGB output which it does not have yet.

Not necessarily, I think. I guess you need rgb16f half-floats on the side of mpv, yes, but you don't need another colorspace conversion, because, as far as I know, Windows' compositor does the conversion from any colorspace provided by the app to scRGB automatically?

Hrxn commented 2 years ago

Nah, I'm pretty sure that this applies to Windows.. well, a somewhat recent Windows 10, like 1903, or never, obviously

When "advanced color mode" is properly supported, the Windows compositor (DWM) does the conversion to scRGB before it then gets to the display color space..

Haven't tried this myself though, but if I remember correctly, that what's the Windows docs say..

Hrxn commented 2 years ago

Found it... cause I like to back up what I'm saying... https://docs.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range

mnisius commented 2 years ago

I played with a lot of different config values and I think I have found the "correct" way to display Dolby Vision with MPV in HDR. Here is my config

profile=gpu-hq
vo=gpu-next
hwdec=auto-copy
target-colorspace-hint=yes
hdr-compute-peak=no
target-trc=pq
target-prim=bt.2020
target-peak=1500

Please set target-peak according to your display. I guess for something like the LG CX 800 should be good.

AstralStorm commented 2 years ago

I'd recommend setting target-peak not to true peak but to sustained 5% value or you will get noticeable dimming in enough bright scenes just due to total area of specular reflections. The newer screens are a bit better at it but will dim nonetheless.

The OLED being a true black screen is the real important piece anyway. In new mpv the tone mapping is set to something quite reasonable for bright conditions by default. The real problem is ABL but one fixable with a service remote. Aggressive enough ABL will ruin the DV mapping.

For example the QD-OLED Alienware can only do ~480 nit reliably, so target-peak is probably best set to that for DV mapping. Samsung QD-OLED needs to be in Filmmaker mode with maybe 1000 nits as peak.

Asinin3 commented 1 year ago

Dobly Vision doesn't work for me. My LG C2 shows the HDR icon instead of Dobly Vision. I tried using a config file with only:


profile=gpu-hq
vo=gpu-next
hwdec=auto-copy
target-colorspace-hint=yes```
And nothing else. But it just goes to normal HDR mode
quietvoid commented 1 year ago

Dobly Vision doesn't work for me. My LG C2 shows the HDR icon instead of Dobly Vision.

That's the expected behaviour.

kasper93 commented 1 year ago

I think everything is working as intended now? Can we close this issue?