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
HDR Tone Mapping Is Still Causing Clipping in 2021 #8849
Comments
You might be interested in https://code.videolan.org/videolan/libplacebo/-/merge_requests/155 Or rather, if you can help test it, it'd be a great way to fast-track those changes into libplacebo (and then mpv, via #8799) |
Apologies but I'm a code illiterate. I'm a designer and figuring out how to write the config files and how to change between various options in MPV were about the most difficult thing I had to do in years. I wouldn't know how to read what you've linked, let alone figuring out what to do with it. |
I can put in the effort and spend time testing whatever is needed but I don't think I understand the technicality all that much. Is there something easier that I can follow? |
He's (presumably) asking whether your version of mpv contains this piece of code. The precise version of your mpv binary would allow to deduce this. |
Oh. I just added my MPV build information on the top of the opening post. |
According to this info your mpv contains the mentioned commit and you could try with |
https://mpv.io/manual/master/#options-gamut-clipping might be the problem in this case, I have found that along with bt.2390/hdr-compute-peak chroma can get verrry clipped. |
@NSQY oh yes indeed, I just discovered that same bug in libplacebo but haven't fixed it for vo_gpu yet, 1 sec |
Fixed the issue I mentioned but on second though I'm not convinced it's actually relevant for you, since it only triggered with HDR outputs (not SDR outputs). |
FWIW, |
This is from two years ago but may still be relevant. May be. |
I may have been conflating problems. With sources that have a strong chrominance component, gamut clipping can get a little bizarre https://slow.pics/c/8Mvmb77e Edit: It is, however, much worse with hdr-compute-peak + BT.2390 - but not only with just gamut-clipping https://slow.pics/c/aKSEbw6n |
Oh, you're on apple. I don't think that's supported. |
I wonder if lowering the Try |
Yes, that's why I suggested lowering it. I should have been clear in intending you to try the default and not reinhard. bt.2390 is the default and the default peak is 203. So try bt.2390 with a lower target peak. And remember that bt.2390 isn't tunable so it doesn't have a mapping parameter. So all you need to do to test, is use one line: |
Now you'll have to test haasn's new commit addressing the gamut clipping. |
@sovon What you might actually want is to add this
|
Like #6405 (comment) tone-mapping-desaturate is blowing the highlights.
MPV: Only with tone-mapping-desaturate-exponent=0.0 the results look just a bit better, less highlight data is lost and the shift in the purple isn't as drastic as the one above. These are all of course done in my existing mpv version that comes from |
So here's something out of left field. With:
I get this: That's pretty damn close to the Infuse shot, except for the increased flaring in the center. I have noticed there is darkening in all things HDR. Whether I tone-map or passthrough, the image is always slightly darker than it should be. For all content, I have a general correction of @haasn it looks to me like that what you're working on with the blackpoint and not setting a gamma curve, would correct this? |
I may be wrong but in my personal experience I have NEVER been able to get a satisfied result by tweaking brightness or contrast. It may work on a movie I'm watching at that moment but it will definitely ruin other films for me later on. With brightness increased by even just 1 unit, I can clearly tell where the letterbox starts, and I dark scenes never come out as good. Same thing happens for contrast as well, +/- whatever that is. |
Don't adjust the contrast. |
I don't do either. I leave brightness, contrast, gamma & saturation untouched and advise others to do the same. To me these settings may help in unique circumstances such as where the display panel itself isn't as good or where the ICC color profile isn't great or has a limited LAB plot (enhancing the look and feel by bumping up the saturation a bit etc. is only temporary) But that is VERY rare and I never meddle with superficial tweaks to keep it as close as to the filmmaker's vision as possible. In order to get a reference to the "filmmaker's vision", I take screenshots from bluray.com and compare my image to those for that exact frame. Sadly these OTT platforms like netflix or apple TV doesn't allow me to take screenshots so I have to compare windows but I've found that the effort is worth it. For brightness and contrast, I found out the issue the hard way. I was watching Mandalorian; when Mando was in that spider cave, MPV looked so dim compared to the safari version of disneyplus even though reinhard, param-0.65 was there. I modified the brightness contrast and gamma of MPV to match the safari window and it was great for the rest of the season but a week later I was watching Riddick and omg I've never seen a washed out pitch black scene like that before. Because I have seen the film in theatre and remember it was actually pitch black, at first I thought my monitor broke but then I saw the mpv config and figured out why it was like that. |
Yes, that's where blackpoint/gamma/trc comes in. Which is the PR that haasn linked to and why I made reference to it. https://code.videolan.org/videolan/libplacebo/-/merge_requests/155 Unfortunately, my build environment doesn't allow me to apply patches, or I would be testing the work with libplacebo. Hopefully haasn will complete it in the not too distant future. I'm very much looking forward to putting it through it's paces. |
I think it's hard to judge whether a tone-mapped screenshot is dim or not without knowing each others' screen brightness. If you care about brightness precision, you might want to measure peak brightness of your screen and set |
All you have to do is put both images next to each other on the same display. Which ostensibly, posting them on here, does. What I found was, when I juxtaposed the video using passthrough to my Samsung Q80R with how mpv tone-maps with the default settings, was that it was very similar (clipping not withstanding). The 'darkness' was comparative, which is what I would want. Why obtain HDR media if you just want to strip it and remake it the same as the SDR mastering? Just use the SDR version, and you'll have exactly what you want. I want the deep color and the expanded light range. If you don't want HDR, don't use HDR. So once the blackpoint is correctly applied with haasn's PR, I think we'll be golden. |
You are right. Independently across different devices that comparison would definitely be weird. But if you open two images of the exact same frame and toggle between them with your keyboard maybe, the differences would be drastically pronounced. From there it's only a matter of choice - which one you prefer to the other. As a reference we can compare frames from established forums or from sources that we know are sure to produce accurate results (such as bluray.com screenshot/video quality review section or maybe from a web OTT service such as Apple TV or DIsneyPlus or HBO Max etc.). So you can compare your rendered image with theirs and easily find out what is different in your media consumption device.
Well, I for one would gladly rent an SDR master for sure because I don't have a HDR TV. I, like many others, do all my media consumption on my desktop computer which although has a 4K HDR monitor, that hdr functionality remains mostly unused. Implementation of HDR in macOS or Windows is abysmal to say the least and no one can work on hdr mode because the gamut gets destructively compressed (at least for designers who export sRGB for web). That would be madness. So many people would just use the SDR mode of their monitor. Also they don't make 4K UHD blurays SDR mastered. Every single UHD bluray I ever saw is HDR mastered. And I personally am lazy to rip it myself and store the 90GB data on my storage, so from time to time, I might obtain a small 4K encode from a popular release group in the internet, which 99.9% of the time is an HDR HEVC encode. So it's not very practical or easy to get SDR version of a 4K HDR mastered release and as such people need to convert HDR to SDR on their own. But I should to make the point again that I didn't raise this issue here in github for my personal use. Infuse is doing wonderfully although it costs a little too much but I am happy with what I have. My intention was to show it to the community, so that the same quality / features can be more publicly and openly available. An ideal media player should be able to handle the weirdness of the media file, irrespective of source. An end user who might not be aware of all these nitty gritties, should ideally still be able to consume a piece of content in its full glory (or as close to the filmmaker's vision as possible). |
Aside from the clipping, mpv does tone-map the way I believe it should. It should closely mimic HDR, as best it can, and not try to reproduce SDR. That was my point. |
Do not do this if you watch HDR videos and use icc profile at the same time. Just to ruin the color.
This option will be overrided by icc. |
Thanks, I gotcha I read a reference from here |
Set the 3D-LUT size
I see reference in here;
|
Is there anything else I can test out? (any new development to this perhaps) |
@sovon You could help test out libplacebo master, which got a complete overhaul of the HDR code very recently. Those changes will make their way into mpv itself with #8799. |
How do I test it with mpv? |
We need a kind person to make a test build for us 😁 Sadly, until it's merged, I can't build with it. |
With my previous configuration, every time I played a SDR film in mpv, I used to get a warning, something like - "icc profile... too high... sanity.. etc". With the current |
Did something happen yet? |
This is a pre |
MacOS Big Sur 11.3.1 (20E241) - Apple Silicon Mac Mini M1 - LG 4K HDR 27UK850
I've talked about this issue in the past. Not going to waste everyone's time by doing this same thing again. Just wanted to let the community know about a recent discovery of mine. I purchased a license of Infuse today after I saw what that app can do with HDR content. I want to support this mpv open source community and so I'm posting these discoveries of mine after hours of testing in case they can be implemented in MPV as well.
It's a well known fact that displaying HDR content on a SDR monitor is never a straightforward conversion. I have played around A LOT with the 6 algorithms - hable, clim, gamma, linear, mobius and reinhard. And for the past 5 years my mpv config has consistently looked something like this:
These settings have changed here and there over time but never have I ever seen ANY player that handled this scene from Avengers:IW this good like Infuse does here. That out of the way, here are the comparisons between Infuse and MPV. Take a look:
MPV: Obvious clipping aside you'll notice that the overall image is too orange-ish/yellow-ish
Infuse: No clipping anywhere that I could find and more impressively the image is very natural looking. I've matched it with OTT stream of disneyplus and the stream looked almost identical to this, so I think whatever Infuse is doing here, whatever magic algorithm/tweak they have concocted, it's doing the job right. Please compare all these images side by side to see the orangish hue.
MPV
Infuse
MPV
Infuse
MPV: On dark scenes, you'll notice that the image from mpv looks a little less sharp, bit washed out and less contrasty compared to Infuse.
Infuse
Instead of Infuse, I'll continue to use MPV as my primary player cause it's lightweight, way faster and customisable. If anyone can help me achieve the same level of HDR results as my Infuse app, I'd be very grateful.
The text was updated successfully, but these errors were encountered: