How to "Properly" Render as SDR for a project in HDR?

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

eviluess

  • Posts: 91
  • Joined: Sun Jul 23, 2023 9:34 am
  • Real Name: Suiyu Feng

How to "Properly" Render as SDR for a project in HDR?

PostFri Jul 28, 2023 3:40 am

Hello guys.

I know this is a very common question, but I'm still a bit confused on the best approach.
My confusion stems from the different results using various methods.

Prepare:
1. An HDR video, exported by DaVinci in Rec.2020 color space and ST2084 EOTF or downloaded from elsewhere.
2. Windows 11 set to SDR (HDR turned off).

Methods:

A. Play in MPV, VLC and Windows Movie Player.

B. Convert using ffmpeg command suggested on StackOverflow:
Code: Select all
ffmpeg -vsync 0 -hwaccel cuda -init_hw_device opencl=ocl -filter_hw_device ocl -extra_hw_frames 3 -threads 16 -c:v hevc_cuvid -i inputhdr.mp4 -vf "format=p010,hwupload,tonemap_opencl=tonemap=mobius:param=0.01:desat=0:r=tv:p=bt709:t=bt709:m=bt709:format=nv12,hwdownload,format=nv12" -c:a copy -c:s copy -c:v hevc_nvenc -max_muxing_queue_size 8192 outputsdr.mp4
.

C. Import HDR into DaVinci Resolve, deliver with default settings or Twitter 1080p preset.

D. Start a new Project, configure to HDR just like every does. That is:
1. Color science :DaVinci YRGB Color Managed
2. Color processing mode: HDR
3. Output color space: HDR PQ
Then import 1, deliver settings:
1. H264 Master
2. Color Space Tag: Rec.709
3. Gamma Tag: Gamma 2.4

E. Similar to D, but insert a "Color Space Transform" after timeline:
1. Switch to Color Tab
2. Switch to Timeline from Clip
3. insert the "Color Space Transform" and make basic connection
Setting up the FX:
1. Output Color Space: Rec.709
2. Output Gamma: Gamma 2.4

F. Like E but adjust Color Space Transform parameters.

G. Apply a LUT like "ST2084 2000/1000 nits to Gamma 2.4" in C-F.

I prefer A & B, as Resolve methods lead to issues like clipped highlights, excess darkness/brightness, under/over-saturation, fogginess, etc.

For reference, I'm using "The.Usual.Suspects.1995.2160p.UHD.BluRay.x265.10bit.HDR.DTS-HD.MA.5.1-RARBG".
The example scene is 1:00:24 ~ 1:00:28, the dialog there is "So they let him know they meant business.".
Look at:
1. Skin tone of the man.
2. Sweater color of the girl.
3. Brightness of the 3 faces.

Thanks in advance.
I Hope DR can support MIDI Clips, VST3i, TTS even DR is already so great to create 4K HDR 60FPS Dolby Atmos on my 13900K + RTX 4090 + 32GB*2 DDR5 6666MHz + 2T*2 7GB R/W SSD + PA32UCG.
Online

shebbe

  • Posts: 1391
  • Joined: Tue Mar 06, 2018 11:48 am
  • Location: Amsterdam
  • Real Name: Shebanjah Klaasen

Re: How to "Properly" Render as SDR for a project in HDR?

PostFri Jul 28, 2023 8:14 am

eviluess wrote:For reference, I'm using "a movie downloaded from a funny site...".
I don't think it's a good idea to mention such things in a forum like this.
Home System Resolve 20b2: Z790 / i9 13900K / 64GB DDR5 / RTX4090 / Win 11 / ASUS PA32UGC 1600 nits
Office System Resolve 20b2: X570 / Ryzen 9 5900X / 128GB DDR4 / RTX3090Ti / Win 11 / EIZO CG248-K
Offline

Mads Johansen

  • Posts: 1371
  • Joined: Mon Dec 19, 2016 10:51 am

Re: How to "Properly" Render as SDR for a project in HDR?

PostFri Jul 28, 2023 10:02 am

eviluess wrote:Hello guys.

I know this is a very common question, but I'm still a bit confused on the best approach.
My confusion stems from the different results using various methods.

Prepare:
1. An HDR video, exported by DaVinci in Rec.2020 color space and ST2084 EOTF or downloaded from elsewhere.
2. Windows 11 set to SDR (HDR turned off).

Methods:

A. Play in MPV, VLC and Windows Movie Player.

B. Convert using ffmpeg command suggested on StackOverflow:
Code: Select all
ffmpeg -vsync 0 -hwaccel cuda -init_hw_device opencl=ocl -filter_hw_device ocl -extra_hw_frames 3 -threads 16 -c:v hevc_cuvid -i inputhdr.mp4 -vf "format=p010,hwupload,tonemap_opencl=tonemap=mobius:param=0.01:desat=0:r=tv:p=bt709:t=bt709:m=bt709:format=nv12,hwdownload,format=nv12" -c:a copy -c:s copy -c:v hevc_nvenc -max_muxing_queue_size 8192 outputsdr.mp4
.

C. Import HDR into DaVinci Resolve, deliver with default settings or Twitter 1080p preset.

D. Start a new Project, configure to HDR just like every does. That is:
1. Color science :DaVinci YRGB Color Managed
2. Color processing mode: HDR
3. Output color space: HDR PQ
Then import 1, deliver settings:
1. H264 Master
2. Color Space Tag: Rec.709
3. Gamma Tag: Gamma 2.4

E. Similar to D, but insert a "Color Space Transform" after timeline:
1. Switch to Color Tab
2. Switch to Timeline from Clip
3. insert the "Color Space Transform" and make basic connection
Setting up the FX:
1. Output Color Space: Rec.709
2. Output Gamma: Gamma 2.4

F. Like E but adjust Color Space Transform parameters.

G. Apply a LUT like "ST2084 2000/1000 nits to Gamma 2.4" in C-F.

I prefer A & B, as Resolve methods lead to issues like clipped highlights, excess darkness/brightness, under/over-saturation, fogginess, etc.

For reference, I'm using "The.Usual.Suspects.1995.2160p.UHD.BluRay.x265.10bit.HDR.DTS-HD.MA.5.1-RARBG".
The example scene is 1:00:24 ~ 1:00:28, the dialog there is "So they let him know they meant business.".
Look at:
1. Skin tone of the man.
2. Sweater color of the girl.
3. Brightness of the 3 faces.

Thanks in advance.

My comments on the approaches:

A: Not an edit, thus irrelevant.
You can argue that the video looks good on a SDR monitor, but that's because MPV/VLC/WMP does the tonemapping for you as a black box you don't know the contents of. If it looks fine there, no need to do anything more to the video.

B: Let's break that command down into it's components:
Upload P010 to gfx, tonemap_opencl with mobius, no desaturate, output to tv colors (eg data level vieo), primaries bt709, transfer 709, matrix 709, output format nv12, download to encoder in format nv12.
Which all makes sense.
In terms of how it's tonemapped, mobius is "Smoothly map out-of-range values, while retaining contrast and colors for in-range material as much as possible. Use it when color accuracy is more important than detail preservation." (ref http://underpop.online.fr/f/ffmpeg/help/tonemap.htm.gz )

C: Assuming it's a new project and thusly YRGB, Rec.709. That means there's no tonemapping and the image will look dull.
As expected.

D: There is no way to do "Deliver settings:
1. H264 Master
2. Color Space Tag: Rec.709
3. Gamma Tag: Gamma 2.4"
So I don't know what you're doing.

E: You're taking Rec.709 data and translating it as Rec.2020 back to Rec.709. That gives you way more contrast than you need.

F: Adjust to ?

G: A LUT is a static 'Pixel value 129,27,68 should be 169,64,201' type system, sometimes it gives good results but not always.

I'm not surprised you get "clipped highlights, excess darkness/brightness, under/over-saturation, fogginess, etc." as you have not done it correctly.

The easiest correct way is to have:
Color science: Davinci Color Management
Automatic Color Management
Timeline: HDR
Output Color Space: SDR Rec.709
Davinci Resolve Studio 20 Beta 4 build 48, Windows 11, 13400F, Nvidia 3060 TI, 576.52 Studio
Offline

eviluess

  • Posts: 91
  • Joined: Sun Jul 23, 2023 9:34 am
  • Real Name: Suiyu Feng

Re: How to "Properly" Render as SDR for a project in HDR?

PostMon Jul 31, 2023 12:02 pm

Thank you for analyzing line by line, I really appreciate it.
I don't have access to my computer over the next couple of weeks, but I will try out your suggested method as soon as I can.
Looking forward to implementing your solution and learning from your expertise!


Mads Johansen wrote:
eviluess wrote:Hello guys.

I know this is a very common question, but I'm still a bit confused on the best approach.
My confusion stems from the different results using various methods.

Prepare:
1. An HDR video, exported by DaVinci in Rec.2020 color space and ST2084 EOTF or downloaded from elsewhere.
2. Windows 11 set to SDR (HDR turned off).

Methods:

A. Play in MPV, VLC and Windows Movie Player.

B. Convert using ffmpeg command suggested on StackOverflow:
Code: Select all
ffmpeg -vsync 0 -hwaccel cuda -init_hw_device opencl=ocl -filter_hw_device ocl -extra_hw_frames 3 -threads 16 -c:v hevc_cuvid -i inputhdr.mp4 -vf "format=p010,hwupload,tonemap_opencl=tonemap=mobius:param=0.01:desat=0:r=tv:p=bt709:t=bt709:m=bt709:format=nv12,hwdownload,format=nv12" -c:a copy -c:s copy -c:v hevc_nvenc -max_muxing_queue_size 8192 outputsdr.mp4
.

C. Import HDR into DaVinci Resolve, deliver with default settings or Twitter 1080p preset.

D. Start a new Project, configure to HDR just like every does. That is:
1. Color science :DaVinci YRGB Color Managed
2. Color processing mode: HDR
3. Output color space: HDR PQ
Then import 1, deliver settings:
1. H264 Master
2. Color Space Tag: Rec.709
3. Gamma Tag: Gamma 2.4

E. Similar to D, but insert a "Color Space Transform" after timeline:
1. Switch to Color Tab
2. Switch to Timeline from Clip
3. insert the "Color Space Transform" and make basic connection
Setting up the FX:
1. Output Color Space: Rec.709
2. Output Gamma: Gamma 2.4

F. Like E but adjust Color Space Transform parameters.

G. Apply a LUT like "ST2084 2000/1000 nits to Gamma 2.4" in C-F.

I prefer A & B, as Resolve methods lead to issues like clipped highlights, excess darkness/brightness, under/over-saturation, fogginess, etc.

For reference, I'm using "The.Usual.Suspects.1995.2160p.UHD.BluRay.x265.10bit.HDR.DTS-HD.MA.5.1-RARBG".
The example scene is 1:00:24 ~ 1:00:28, the dialog there is "So they let him know they meant business.".
Look at:
1. Skin tone of the man.
2. Sweater color of the girl.
3. Brightness of the 3 faces.

Thanks in advance.

My comments on the approaches:

A: Not an edit, thus irrelevant.
You can argue that the video looks good on a SDR monitor, but that's because MPV/VLC/WMP does the tonemapping for you as a black box you don't know the contents of. If it looks fine there, no need to do anything more to the video.

B: Let's break that command down into it's components:
Upload P010 to gfx, tonemap_opencl with mobius, no desaturate, output to tv colors (eg data level vieo), primaries bt709, transfer 709, matrix 709, output format nv12, download to encoder in format nv12.
Which all makes sense.
In terms of how it's tonemapped, mobius is "Smoothly map out-of-range values, while retaining contrast and colors for in-range material as much as possible. Use it when color accuracy is more important than detail preservation." (ref http://underpop.online.fr/f/ffmpeg/help/tonemap.htm.gz )

C: Assuming it's a new project and thusly YRGB, Rec.709. That means there's no tonemapping and the image will look dull.
As expected.

D: There is no way to do "Deliver settings:
1. H264 Master
2. Color Space Tag: Rec.709
3. Gamma Tag: Gamma 2.4"
So I don't know what you're doing.

E: You're taking Rec.709 data and translating it as Rec.2020 back to Rec.709. That gives you way more contrast than you need.

F: Adjust to ?

G: A LUT is a static 'Pixel value 129,27,68 should be 169,64,201' type system, sometimes it gives good results but not always.

I'm not surprised you get "clipped highlights, excess darkness/brightness, under/over-saturation, fogginess, etc." as you have not done it correctly.

The easiest correct way is to have:
Color science: Davinci Color Management
Automatic Color Management
Timeline: HDR
Output Color Space: SDR Rec.709
I Hope DR can support MIDI Clips, VST3i, TTS even DR is already so great to create 4K HDR 60FPS Dolby Atmos on my 13900K + RTX 4090 + 32GB*2 DDR5 6666MHz + 2T*2 7GB R/W SSD + PA32UCG.

Return to DaVinci Resolve

Who is online

Users browsing this forum: panos_mts, shebbe and 433 guests