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

Provide a property that reports the mastering display metadata used by current video track #9620

Closed
CarterLi opened this issue Dec 20, 2021 · 13 comments

Comments

@CarterLi
Copy link

CarterLi commented Dec 20, 2021

We have video-params/primaries to test if the video source is HDR compatible. However it always reports bt.2020 despite the video suggests Display P3 in mastering display metadata.

It seems that video creators will only set Display P3 in mastering display metadata as suggested by Apple, while Color primaries is always set as BT.2020. Without a new property we can't know if the video suggests using Display P3 or not.

Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0000 cd/m2, max: 1000 cd/m2
Maximum Content Light Level              : 1000 cd/m2
Maximum Frame-Average Light Level        : 400 cd/m2
Codec configuration box                  : hvcC

Expected behavior of the wanted feature

Provide a new property video-params/mastering-display-metadata that reports the mastering display metadata used by current video track, or null if unavailable.

eg:

{
  "display_primaries": {
    "G": [Gx, Gy],
    "B": [Bx, By],
    "R": [Rx, Ry],
    "WP": [WPx, WPy],
  },
  "luminance": [Lmin, Lmax]
}

Alternative behavior of the wanted feature

N/A

Log file

N/A

CarterLi added a commit to CarterLi/iina that referenced this issue Dec 21, 2021
CarterLi added a commit to CarterLi/iina that referenced this issue Jan 19, 2022
CarterLi added a commit to CarterLi/iina that referenced this issue Jan 21, 2022
low-batt pushed a commit to CarterLi/iina that referenced this issue Jan 21, 2022
@CarterLi
Copy link
Author

CarterLi commented Jan 26, 2022

Mastering metadata is what display you were mastering on was

Since the video was mastered on Display P3, it should be played on Display P3 for best results, shouldn't it?

What's more, Mastering display luminance does suggest maximum luminance that the display should support. If not, a tone mapping algorithm must be enabled to display the brightness correctly

@CarterLi
Copy link
Author

I am sorry what?? No, it is always enabled, that is the whole point of HDR. And no only CLL meta is used for this.

I'm sorry I'm confused. If the video suggest max luminance 1000nits and my display support max luminance 1600nits ( eg. Apple XDR Display ), should I enable tone mapping algorithm for that?

@CarterLi
Copy link
Author

CarterLi commented Jan 26, 2022

You should look into what actually is in content (for only black picture there is obviously 0.0001 nits max) and then tone map per BT.2390 and later standards, yes. But if there is 1000 nits only, then tonemapping is not needed, of course some complex stuff still happens, PQ should be decoded, but whatever. Also tonemapping should work since it is LCD, so black point is far from 0.0001 nits.

I agree. So in this case, what value should I specify for --target-peak, since I can only specify one value instead of two (min and max)


EDIT: Strangely, the doc reads

--target-peak=<auto|nits>

In auto mode (the default), the chosen peak is an appropriate value based on the TRC in use. For SDR curves, it uses 203. For HDR curves, it uses 203 * the transfer function's nominal peak.

And

--tone-mapping=<value>

bt.2390
Perceptual tone mapping curve (EETF) specified in ITU-R Report BT.2390. This is the recommended curve to use for typical HDR-mastered content. (Default)

So everything should just work. However according to the issue, these options didn't seem to work without manually enabling.

@natural-harmonia-gropius
Copy link
Contributor

natural-harmonia-gropius commented Jan 26, 2022

Display P3 uses sRGB transfer.

Mastering display color primaries is color primaries only, doesn't matter what transfer function it is.
not color space display p3

@haasn
Copy link
Member

haasn commented Jan 26, 2022

I'm sorry I'm confused. If the video suggest max luminance 1000nits and my display support max luminance 1600nits ( eg. Apple XDR Display ), should I enable tone mapping algorithm for that?

No. In this case, mpv will also not enable tone-mapping either. We only tone-map if the source mastering luminance exceeds the display capabilities.

In practice, we clip the signal to the display mastering brightness, before tone mapping. If a video file contains image detail outside that brightness range, I consider it badly mastered.

@CarterLi
Copy link
Author

No. In this case, mpv will also not enable tone-mapping either. We only tone-map if the source mastering luminance exceeds the display capabilities.

Again according to the issue, tone mapping didn't seem to work without manually enabling.

hdr_test.mov

@haasn
Copy link
Member

haasn commented Jan 26, 2022

Provide a new property video-params/mastering-display-metadata that reports the mastering display metadata used by current video track, or null if unavailable.

In practice the first step will be to extend mpv to even include mastering metadata as part of video colorimetry. (And ideally, also allow overriding it using vf_format).

Right now mpv core ignores it. (vo_gpu_next looks it up from the ffmpeg side data, but this is not an optimal solution and also ignores e.g. mkv metadata)

CarterLi added a commit to CarterLi/iina that referenced this issue Feb 18, 2022
CarterLi added a commit to CarterLi/iina that referenced this issue Feb 21, 2022
CarterLi added a commit to CarterLi/iina that referenced this issue Feb 28, 2022
CarterLi added a commit to CarterLi/iina that referenced this issue Apr 23, 2022
low-batt pushed a commit to CarterLi/iina that referenced this issue Apr 23, 2022
CarterLi added a commit to CarterLi/iina that referenced this issue Apr 24, 2022
low-batt pushed a commit to CarterLi/iina that referenced this issue Apr 24, 2022
low-batt pushed a commit to CarterLi/iina that referenced this issue Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@haasn @CarterLi @natural-harmonia-gropius and others