Problem with opening sdr files in hdr display
mpv Information
mpv v0.40.0-116-g817372ac9 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
built on May 18 2025 00:05:55
libplacebo version: v7.351.0 (v7.349.0-79-g3188549-dirty)
FFmpeg version: N-119590-g95c43c6d0
FFmpeg library versions:
libavcodec 62.3.101
libavdevice 62.0.100
libavfilter 11.0.100
libavformat 62.0.102
libavutil 60.2.100
libswresample 6.0.100
libswscale 9.0.100
Other Information
- Windows version: 24H2
- GPU model, driver and version: RTX 4090, driver 576.40
- Source of mpv: shinchiro build
- Latest known working version: Idk
- Issue started after the following happened: A long time after using mpv without updating
Reproduction Steps
- Open an sdr file with hdr on
Expected Behavior
Opening an sdr file should not open mpv with hdr and play the sdr file inside an hdr container. I used to use this command "d3d11-output-csp=srgb" to open my files my files with working sdr (as suggested by https://github.com/mpv-player/mpv/issues/8936), but its not working anymore after updating.
I also tried the command "target-trc=srgb" (https://github.com/mpv-player/mpv/issues/14648), but it makes the image a lot darker.
Actual Behavior
Mpv should open in sdr format.
Log File
Sample Files
MPV side by side with VLC, using "d3d11-output-csp=srgb"
MPV side by side with VLC, using "target-trc=srgb"
I carefully read all instruction and confirm that I did the following:
- [x] I tested with the latest mpv version to validate that the issue is not already fixed.
- [x] I provided all required information including system and mpv version.
- [x] 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. - [x] I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
- [x] I attached the full, untruncated log file.
- [x] I attached the backtrace in the case of a crash.
[ 0.000][v][cplayer] Setting option 'target-colorspace-hint' = 'auto' (flags = 4)
Disable it.
Opening an sdr file should not open mpv with hdr and play the sdr file inside an hdr container.
It should. If your are sending HDR signal to the display, SDR video needs to be passed as HDR too. If not done by mpv, it will be done by compositor. You can adjust --target-peak for optimal SDR viewing to your liking.
If you want to play SDR on SDR, disable HDR in Windows settings.
I've noticed this recently and did some testing on it. Here's what the SDR video looks like on mpv's version of git-master:
| mpv --vo=gpu-next(SDR display mode) | mpv --vo=gpu-next --target-colorspace-hint=no(HDR display mode) | mpv --vo=gpu-next --target-colorspace-hint=no --target-peak=203(HDR display mode) | mpc-be(HDR display mode) |
|---|---|---|---|
Here are the statistics from the OSD:
| mpv --vo=gpu-next(SDR display mode) | mpv --vo=gpu-next --target-colorspace-hint=no(HDR display mode) | mpv --vo=gpu-next --target-colorspace-hint=no --target-peak=203(HDR display mode) |
|---|---|---|
This is the log file: target-colorspace-hint=no.log target-colorspace-hint=no, target-peak=203.log
It can be confirmed that this was introduced by pr https://github.com/mpv-player/mpv/pull/15279
@kasper93 The real issue here is that the peak brightness information of the display should not be applied for SDR content under --target-colorspace-hint=no, as this is not reliable in HDR display mode, the fact that it screwed up.
When we display SDR as SDR (--target-colorspace-hint=no), we should use the uniform --target-peak default (203) to provide a good display, which is exactly what other players are doing, e.g. vlc, mpc-hc, mpc-be etc. You can see a comparison photo of the mpc-be I provided.
My initial version was using only target peak, but it turns out it is also returned for SDR displays. Like I have one with 270 nits.
I can understand that this is a reasonable need, but if the user's SDR display does have a peak brightness higher than 203 they can set the parameters of the --target-peak option themselves, the player shouldn't have to make the decision for the user, perhaps by providing an attribute for the user to see the actual peak brightness of their display.
In any case the existing practice results in incorrect SDR display under --target-colorspace-hint=no (which is the mpv default) and it should be fixed.
Edit: Here are additional comparison tests
| mpv --vo=gpu-next --target-colorspace-hint=auto(HDR display mode) | mpv --vo=gpu-next --gpu-api=vulkan --target-colorspace-hint=no(HDR display mode) |
|---|---|
| mpv --vo=gpu-next --target-colorspace-hint=auto(HDR display mode) | mpv --vo=gpu-next --gpu-api=vulkan --target-colorspace-hint=no(HDR display mode) |
|---|---|
We can see that the SDR content is oversaturated with color under --target-colorspace-hint=auto, which is as expected.
The reason why the SDR content looks normal under --gpu-api=vulkan is because the monitor's peak brightness information is not correctly obtained under vulkan, which also seems to be a bug.
This is the log file for --no-config --vo=gpu-next --gpu-api=vulkan --target-colorspace-hint=no:
gpu-api=vulkan, target-colorspace-hint=no.log
Thanks guys! Using target-colorspace-hint=no + target-peak=203 fixed the issue.
Should work better now out of the box, will output PQ in HDR mode and not use reported peak in SDR mode. Let me know if there are more issues.