2024-03-21, 11:06 PM
I found a pretty cool tool recently when looking foe some HDR analysis stuff called DoVi_Scripts. Not sure how well known this is but it can do some cool stuff with DV so I thought I’d share. (also the YT vid the github links to for this looks to be outdated)
I’m by no means an expert, but, from my understanding, Dolby Vision has these things called trim passes, which basically are data on how to tonemap the image for certain brightness values. One of the passes is for 100nits, which is effectively SDR, so this is data on how to tonemap the HDR image to SDR.
Motivations are hopefully obvious: high quality SDR versions of 4KBDs, especially interesting for titles which the 4KBD differs from the 2KBD in terms of, say, the transfer, or even something more significant like Gemini Man (2019)’s 60fps presentation. The tonemap also can retain 4K 10bit which may be a plus for projects and such.
The main limitation is, of course, that this only applies to Dolby Vision, and that the DV titles need to have the 100nit trim pass. Basically all the titles I’ve tested so far (8) do have it, but I did run into the curious example of The Last of Us (2023) only having it for episode 1, with the other episodes being absent it, so its possible to not be there.
Anyway, enough rambling, how can it be done?
DoVi_Scripts is basically a collection of tools focused around processing and analysing DV and HDR videos, looks to be mostly focused on DV hybrid stuff.
But it can do some other stuff; Under video encoding settings [8 MIXED: Audio/Remover/Encoder/Playlist/Sample → 2 VIDEO Encoding → 4 PRORES DV to SDR], there is a DV to SDR 100nit trim pass delivery option, which is what we’re looking for.
However, a couple of notes first. It doesn’t seem to work properly in v2.0.3 (current), instead just falling back to the standard tonemapping option. v2.0.2 works fine however. Next, you’ll need to download Dolby’s DV tools; you need to sign up but its free so not too much of an issue. DoVi_Scripts is actually using an official Dolby tool for this conversion which is interesting to see.
An optional step is checking to see if your file has a 100nit trim pass. In DoVi_Scripts, option [2 DoVi Fix/Edit/Extract/Verify/Info → 2 RPU Extractor/Reader] you can get a summary of the DV metadata, and youre looking for the line “L2 trims”, and see if 100nits is there. Alternatively just throw your file into the DV to SDR converter and it’ll tell you if there isn’t one, but it does some pre-processing so checking first saves a bit of time.
Finally, note that the conversion results in a ProRes output file. Which is huge. In the 100s of Mbps range, which adds up very quickly. Personally, I have processed everything so far in chunks then compressing each one with x265 to keep the storage usage manageable for me. So far this doesn’t seem to result in any issues.
Ok! so I have tested so far with Gemini Man (2019), and Belle (2021) to see how the results stack up. Gemini Man is 60fps so id like a SDR version, and Belle I remember having some brightness issues with tonemap testing I did a while ago.
As well as comparing against the SDR Blu-ray, I’ve compared against Handbrake’s colourspace filter, and DoVi_Script’s own standard tonemapping (uses DoViBaker/libplacebo). I know there are other (potentially better) methods out there, but I’m not overly familiar, plus all these options are around the same effort level, there’s no tweaking.
Gemini Man:
Belle:
(there are more comparisons on my Gdrive, all of which are full res PNGs)
So, overall, its clear handbrake notably undershoots brightness in all of my testing. Belle seems to be graded not super bright so perhaps that’s not entirely unexpected but regardless its not what I would consider to be a good result.
DoVi_Scripts own tonemapping (again, DoViBaker/libplacebo under the hood, which tbh I know nothing about) fairs a bit better. Belle is once again undershot, but Gemini Man is a lot closer and even overshoots in some shots.
The 100nit trim pass basically nails the required brightness. It looks to be slightly more off with Gemini Man than Belle, but its close enough that most of the time even side-by-side its a bit hard to tell.
There are some slight differences in colour temp and contrast (again, more notably in Gemini Man), but small. Super bright elements in Gemini Man (fire/explosions) look to be a bit oversaturated at times where the SDR grade blows them out to white, but again overall I’m quite happy with the results.
I’m by no means an expert, but, from my understanding, Dolby Vision has these things called trim passes, which basically are data on how to tonemap the image for certain brightness values. One of the passes is for 100nits, which is effectively SDR, so this is data on how to tonemap the HDR image to SDR.
Motivations are hopefully obvious: high quality SDR versions of 4KBDs, especially interesting for titles which the 4KBD differs from the 2KBD in terms of, say, the transfer, or even something more significant like Gemini Man (2019)’s 60fps presentation. The tonemap also can retain 4K 10bit which may be a plus for projects and such.
The main limitation is, of course, that this only applies to Dolby Vision, and that the DV titles need to have the 100nit trim pass. Basically all the titles I’ve tested so far (8) do have it, but I did run into the curious example of The Last of Us (2023) only having it for episode 1, with the other episodes being absent it, so its possible to not be there.
Anyway, enough rambling, how can it be done?
DoVi_Scripts is basically a collection of tools focused around processing and analysing DV and HDR videos, looks to be mostly focused on DV hybrid stuff.
But it can do some other stuff; Under video encoding settings [8 MIXED: Audio/Remover/Encoder/Playlist/Sample → 2 VIDEO Encoding → 4 PRORES DV to SDR], there is a DV to SDR 100nit trim pass delivery option, which is what we’re looking for.
However, a couple of notes first. It doesn’t seem to work properly in v2.0.3 (current), instead just falling back to the standard tonemapping option. v2.0.2 works fine however. Next, you’ll need to download Dolby’s DV tools; you need to sign up but its free so not too much of an issue. DoVi_Scripts is actually using an official Dolby tool for this conversion which is interesting to see.
An optional step is checking to see if your file has a 100nit trim pass. In DoVi_Scripts, option [2 DoVi Fix/Edit/Extract/Verify/Info → 2 RPU Extractor/Reader] you can get a summary of the DV metadata, and youre looking for the line “L2 trims”, and see if 100nits is there. Alternatively just throw your file into the DV to SDR converter and it’ll tell you if there isn’t one, but it does some pre-processing so checking first saves a bit of time.
Finally, note that the conversion results in a ProRes output file. Which is huge. In the 100s of Mbps range, which adds up very quickly. Personally, I have processed everything so far in chunks then compressing each one with x265 to keep the storage usage manageable for me. So far this doesn’t seem to result in any issues.
Ok! so I have tested so far with Gemini Man (2019), and Belle (2021) to see how the results stack up. Gemini Man is 60fps so id like a SDR version, and Belle I remember having some brightness issues with tonemap testing I did a while ago.
As well as comparing against the SDR Blu-ray, I’ve compared against Handbrake’s colourspace filter, and DoVi_Script’s own standard tonemapping (uses DoViBaker/libplacebo). I know there are other (potentially better) methods out there, but I’m not overly familiar, plus all these options are around the same effort level, there’s no tweaking.
Gemini Man:
Belle:
(there are more comparisons on my Gdrive, all of which are full res PNGs)
So, overall, its clear handbrake notably undershoots brightness in all of my testing. Belle seems to be graded not super bright so perhaps that’s not entirely unexpected but regardless its not what I would consider to be a good result.
DoVi_Scripts own tonemapping (again, DoViBaker/libplacebo under the hood, which tbh I know nothing about) fairs a bit better. Belle is once again undershot, but Gemini Man is a lot closer and even overshoots in some shots.
The 100nit trim pass basically nails the required brightness. It looks to be slightly more off with Gemini Man than Belle, but its close enough that most of the time even side-by-side its a bit hard to tell.
There are some slight differences in colour temp and contrast (again, more notably in Gemini Man), but small. Super bright elements in Gemini Man (fire/explosions) look to be a bit oversaturated at times where the SDR grade blows them out to white, but again overall I’m quite happy with the results.