Skip to content

HDR screenshots are unimplemented (gpu/gpu-next) #15107

@low-batt

Description

@low-batt

mpv Information

mpv v0.39.0-129-g4c24eae220 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on Oct 15 2024 20:49:12
libplacebo version: v7.349.0 (v7.349.0-18-g9e16c86f)
FFmpeg version: n7.1
FFmpeg library versions:
   libavcodec      61.19.100
   libavdevice     61.3.100
   libavfilter     10.4.100
   libavformat     61.7.100
   libavutil       59.39.100
   libswresample   5.3.100
   libswscale      8.3.100

Other Information

- macOS version: macOS 13.6.9 (22G830)
- Source of mpv: My own build of master using mpv-build
- Introduced in version: Unknown

Reproduction Steps

The version of IINA under development used to generate JPEG XL screenshots that used HDR color spaces. I recently tested it and found the screenshots looked muddy.

Running mpv on a Mac that supports EDR with --vo=libmpv and setting other options similar to what IINA does causes the video to be displayed with EDR enabled:

mpv/build/mpv --no-config --gpu-debug --log-file=output.txt --autofit=100% --cocoa-cb-output-csp=bt.2100-pq  --pause --screenshot-format=jxl --start=6 --target-prim=bt.2020 --target-trc=pq --vo=libmpv ~/Movies/The\ World\ in\ HDR\ in\ 4K\ \(ULTRA\ HD\).mp4

Take a screenshot.
Use jxlinfo to inspect the resulting JPEG XL screenshot.
Notice the screenshot uses sRGB.

Expected Behavior

A HDR screenshot would be generated.

Actual Behavior

The resulting JPEG XL screenshot:
mpv-shot0001

low-batt@gag mpv-build (master %=)$ jxlinfo mpv-shot0001.jxl 
JPEG XL file format container (ISO/IEC 18181-2)
JPEG XL image, 3840x2160, lossy, 16-bit RGB+Alpha
Color space: RGB, D65, sRGB primaries, sRGB transfer function, rendering intent: Relative
low-batt@gag mpv-build (master %=)$ 
From log file:
[   6.457][v][cplayer] Starting screenshot: 'mpv-shot0001.jxl'
[   6.457][v][screenshot] input: 3840x2160 [0:0] rgba64 rgb/bt.709/srgb/full/display CL=mpeg1/jpeg
[   6.457][d][cplayer] Run command: script-binding, flags=73, args=[name="osc/__keybinding4"]
[   6.458][v][screenshot] will convert image to rgba64
[   6.458][v][screenshot] using 8 threads for scaling
[   6.461][v][screenshot] Using zimg.
[   6.475][d][screenshot] mapped color params:
[   6.475][d][screenshot]   trc = iec61966-2-1
[   6.475][d][screenshot]   primaries = bt709
[   6.475][d][screenshot]   range = pc
[   6.475][d][screenshot]   colorspace = gbr
[   6.475][d][screenshot]   chroma_location = center
[   7.137][i][cplayer] Screenshot: 'mpv-shot0001.jxl'

Adding --screenshot-sw=yes and repeating the test (looks better than this when viewed with a JPEG XL viewer):
mpv-shot0002

low-batt@gag mpv-build (master %=)$ jxlinfo mpv-shot0002.jxl 
JPEG XL image, 3840x2160, lossy, 16-bit RGB
intensity_target: 10000.000000 nits
min_nits: 0.000000
relative_to_max_display: 0
linear_below: 0.000000
Color space: RGB, D65, Rec.2100 primaries, PQ transfer function, rendering intent: Relative
low-batt@gag mpv-build (master %=)$ 

For completeness, with gpu-next:

mpv/build/mpv --no-config --autofit=100% --pause --screenshot-format=jxl --start=6 --target-colorspace-hint --vo=gpu-next ~/Movies/The\ World\ in\ HDR\ in\ 4K\ \(ULTRA\ HD\).mp4

EDR is activated and the resulting screenshot is similar to libmpv with screenshot-sw, but slightly different:

low-batt@gag mpv-build (master %=)$ jxlinfo mpv-shot0003.jxl 
JPEG XL file format container (ISO/IEC 18181-2)
JPEG XL image, 3840x2160, lossy, 16-bit RGB+Alpha
intensity_target: 10000.000000 nits
min_nits: 0.000000
relative_to_max_display: 0
linear_below: 0.000000
Color space: RGB, D65, Rec.2100 primaries, PQ transfer function, rendering intent: Relative

Log File

output.txt
Screenshots.zip

Sample Files

I used a downloaded copy of this YouTube video: The World in HDR in 4K (ULTRA HD)

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

  • I tested with the latest mpv version to validate that the issue is not already fixed.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions