Analyze HDR videos like a pro
Have you ever wondered how many nits an HDR movie reaches in a specific scene? How bright the sun or that tiny specular reflection is? Or if the movie is using the BT.2020 or P3 color space?
Or you may haved played an HDR game in your console and you wonder what’s the average CLL or how the game tonemaps after you perform the HDR calibration in PS5 and Xbox Series.
I’m going to show you a way that’s far better than importing the video in DaVinci Resolve and using its scopes. You will be able to play the video normally, seek as fast you want and even use your mouse to get the nits wherever you want. Ready for it???
Setting everything up
Here it goes! We are going to use a tool that was meant to be used in video games, but we will apply it to a video player: that’s ReShade. We will also add EndlesslyFlowering’s HDR shaders. These tools have everything I would ever want in terms of scopes, functionality etc. The UI is also really easy and powerful. And don’t forget that it runs under ReShade, inside an app that was not meant for that.
Even though ReShade was build to be injected in DirectX games, we will use it on a video player and more specifically in its renderer!
You will have to download mpc-hc. We will use the word’s best renderer: madVR. You can either install it by itself or from a codec pack such as K-Lite.
Make sure that mpc-hc is configured to use madVR. We will now have to inject ReShare to it. Run ReShade’s setup, pick the mpc-hc executable and select DX9. Download the HDR Shaders and copy the shaders and textures directories to mpc-hc\reshade-shaders.
Open mpc-hc and change the “start from beginning” shortcut to be something different than “home key”, as this is the key that shows the ReShade GUI.
Open madVR settings from the Windows start up menu. Go to “user interface->keyboard shortcuts” and uncheck “use only if media player has keyboard focus”. This will allow its keyboard shortcuts to continue to work properly with ReShade.
Time for testing! Enable HDR in Windows. This step requires that you have an HDR screen. You can also try the following shortcut: “Windows+Alt+B”. Open an HDR video with mpc-hc. You will see ReShade on top. Press the home key to have the ReShade GUI appear. Enable “Lilium’s HDR analysis”. If everything worked properly you will now be able to see something similar as the top photo of the post. You can now play with the shader’s settings.
Here are some tips to increase accuracy:
- madVR’s filters for upscaling/downscaling (under “Scaling algorithms” menu) can affect the HDR histogram, as interpolating between pixel values will result to different ones. This is not ideal when analyzing a video. Nearest neighbor is the best option for not affecting the pixel values. You can also right click select “Video Frame->Normal Size” to avoid resizing the video.
- you may want to disable madVR’s dithering as it will make the cursorCLL value to change rapidly. You can use a keyboard shortcut to toggle it.
And here are some limitations:
- if you use the madVR shortcut key to change bit levels between “10,9,8,7,6”, it won’t go back to 10 bit
- when resizing mpc-hc, the ReShade shaders are compiled from scratch and this can take some time. You can uninstall all shaders except “Lilium’s HDR analysis” for faster recompiling
- even though madVR can use an Nvidia API to switch your display to HDR, when paying an HDR video, even when Windows are in SDR mode, “Lilium’s HDR analysis” requires Windows HDR to work
- sometimes the madVR keyboard shortcuts stop working
Playing with it
After I got everything working, I wanted to experiment with some HDR calibration patters I had.
There was an 10-bit pattern clip, from Mehanic test patterns set, that showed different shades of grey in 10 bit precision. madVR supports 10-bit and I wanted to verify via the “Lilium’s HDR analysis” tool that it does send different values at 10-bit precision to the screen.
In fact, it does as you can see in the following gif:
Another thing I wanted to test was to compare how “God of War Ragnarok” changes the image according to PS5’s system level calibration.
The game uses the full BT.2020 color gamut. This is more apparent in some other scenes of the game.
The uncalibrated image, shows that God of War is mastered for 4.000 nits. maxCLL shows 9134 but this is due to some pixel overshoots. The calibrated image was captured after performing 14 clicks in the PS5 system calibration, which results to 853 nits. Indeed, the game adheres to the restriction. I measured the brightest part in the image to be 841 nits. It’s the left part of the cave. The calibrated image, lifts the near black a bit.
In my opinion, the game tonemaps the highlights too aggressively in order to keep the details in some super bright areas. Even the SDR range up to 100 nits is affected, which normally should be kept as is.
“Lilium’s HDR analysis” allows you to crop a region and only analyze this one. In the following comparison, I have cropped the region around the fire.
In the calibrated image, you can see that some red tones have moved towards the center of the CIE diagram (check out the blue circle), which means that they are less saturated. It seems that the game’s tonemapping does not only tonemap the luminance levels but also reduces the game’s saturation.
I am only scratching the surface of what’s possible to analyze here and I should be making a full post or even an HDR video about this if I find the willpower to go down that road