mpv-player / mpv

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

HDR brightness incorrect at mac built-in screen #14786

Open waiwaib opened 1 month ago

waiwaib commented 1 month ago

mpv Information

mpv 0.38.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
libplacebo version: v7.349.0
FFmpeg version: 7.0.2
FFmpeg library versions:
   libavutil       59.8.100
   libavcodec      61.3.100
   libavformat     61.1.100
   libswscale      8.1.100
   libavfilter     10.1.100
   libswresample   5.1.100

Other Information

- macOS version: 14.4.1
- Source of mpv: homebrew
- Introduced in version: NA

Reproduction Steps

  1. A Macbook with XDR(1600 nit) (eg: Macbook Air M2 build-in )

  2. brew install mpv

mpv --no-config --hwdec=hevc-videotoolbox --vo=gpu-next --target-colorspace-hint=yes example_p5.ts now can see the mpv shows about 60%-70% peak-white: shot_mpv

  1. below is the full brightness case with infuse play:

infuse

Expected Behavior

mpv play the Dolby p5 file with peak-white

Actual Behavior

mpv shows about 60%-70% peak-white

Log File

output.txt

Sample Files

https://www.dropbox.com/scl/fi/1c0acxv19qwcey6xqx1k4/sample_p5.ts?rlkey=ix530a9ngum1x0rjxe7fpzuq0&st=uosf8bgm&dl=0

I carefully read all instruction and confirm that I did the following:

Akemi commented 6 days ago

i am not quite sure why you expect this, though you might need to play with target-peak and hdr-compute-peak options. the latter is most likely activated in your case and PQ(Y) max is calculated as ~645cd/m^2 in that case. so you won't get 1600nits output.

Screenshot 2024-10-13 at 15 17 44
waiwaib commented 6 days ago

i am not quite sure why you expect this, though you might need to play with target-peak and hdr-compute-peak options. the latter is most likely activated in your case and PQ(Y) max is calculated as ~645cd/m^2 in that case. so you won't get 1600nits output.

Screenshot 2024-10-13 at 15 17 44

I found that in many cases, even though mpv has implemented the edrmetadata setting according to Apple's documentation, the maximum brightness is still incorrect. so I want to know the root cause and expect to get the correct brightness. so, as you said, I can understand that mpv&libplacebo don't know the mastering display's peak white in nits, if I know the buildin screen is XDR(1600nit), I need to set the target-peak=1600&hdr-compute-peak=yes to let the mpv/libplacebo knows PQ(Y) max should be calculated as 1600cd/m^2 in that case. I will try your suggestion, thanks. byw, can you kindly tell me how to display the playing debug info~ I think that will help me a lot!

Akemi commented 6 days ago

just to make things clear. the maximum PX(Y) is the max brightness of the video, not the display. mpv knows the peak brightness of the display if the colour profile set has the appropriate fields set. though the standard macOS profiles might not have that field set. in that case target-peak needs to be set to the appropriate value.

hdr-compute-peak calculates the peak and average brightness per frame. from the docs

Compute the HDR peak and frame average brightness per-frame instead of relying on tagged metadata.

so since the calculated values is ~645cd/m^2 (and ~70% of max, at least that how understand the number in the screenshot), it's expected that peak brightness in your case is 70% of you display's 1600nits.

though i could be completely wrong too. i didn't look into all the HDR stuff myself and still try to find the appropriate settings myself.

you can show the stats with i or shift+i (toggle), see also https://github.com/mpv-player/mpv/blob/master/DOCS/man/stats.rst

waiwaib commented 6 days ago

just to make things clear. the maximum PX(Y) is the max brightness of the video, not the display. mpv knows the peak brightness of the display if the colour profile set has the appropriate fields set. though the standard macOS profiles might not have that field set. in that case target-peak needs to be set to the appropriate value.

hdr-compute-peak calculates the peak and average brightness per frame. from the docs

Compute the HDR peak and frame average brightness per-frame instead of relying on tagged metadata.

so since the calculated values is ~645cd/m^2 (and ~70% of max, at least that how understand the number in the screenshot), it's expected that peak brightness in your case is 70% of you display's 1600nits.

though i could be completely wrong too. i didn't look into all the HDR stuff myself and still try to find the appropriate settings myself.

you can show the stats with i or shift+i (toggle), see also https://github.com/mpv-player/mpv/blob/master/DOCS/man/stats.rst

Got it. I will try to find the appropriate settings for my Mac. appreciate your help.