Sign In

Guide for Working with 4K HDR Blu-ray Rips in SDR

Author
Time
 (Edited)

Guide for Working with 4K HDR Blu-ray Rips in SDR

HDR footage is nothing new. We’ve been using it for well over a decade in SDR workflows, despite HDR delivery being relatively new. Think of Arri Log C, RED RWG/Log3G10, Sony S-log, or Panasonic V-log. These are all HDR color spaces that we’ve been grading inside of SDR environments for a very long time. So treating the HDR footage from a UHD disc is a very similar process. Here’s how to get your UHD Blu-ray discs to a point where you can properly add custom grades to them.

•Create a remux from your UHD disc, using MakeMKV. This will copy the entire HDR film into an MKV wrapper without transcoding. (There are lots of guides for this online already, so I won’t go through that here).

In my example, I’m using a 4K HDR remux of X-Men: Apocalypse (Sorry, I haven’t bought my Star Wars OT in 4K yet).

If you have the DaVinci Resolve Studio (the paid version of Resolve), keep reading. But if you only have the free version of DaVinci Resolve (the non-studio version), skip down to the “UPDATE 06/03/2020” section below.

•Use Hybrid (FFmpeg GUI) to rewrap the MKV file to MP4 (Not transcode. We want to preserve the original HEVC file). The reason we need our 4K HDR HEVC file to exist within an MP4 wrapper is so DaVinci Resolve can import it. To do this, set your Video setting in Hybrid to “passthrough” and ensure the container is set to “mp4.” Audio can be set to “ignore,” since we don’t need audio for this. Once you’re done, set your output folder and file name, and add it to the queue.

•In Hybrid, go to the “Jobs” tab, and hit the “Start” button to start processing your queue.

Once it’s done, you will have your original HEVC file, now as an MP4.

•Import the MP4 HEVC file into DaVinci Resolve Studio’s media pool, on the Media page. (Note: the free version of Resolve does not support importing HDR HEVC files, so this must be done in Resolve Studio. If you only have access to the free version, don’t worry! Skip down to the the “UPDATE 06/03/2020” section below)

•Ensure that the Resolve color management settings are set to the default: DaVinci YRGB, with timeline color space set to Rec. 709 Gamma 2.4.

•Make sure your project resolution and framerate are set to 4K UHD (3840x2160), 23.976fps.

•On the Edit page, pull the new MP4 file into a new timeline. It will look flat and ugly, with a slight green shift. This is what we want. We don’t want a tonemapped version. We want this log, flat, ugly version. This means it’s the HDR source. (Also, please note that the file will be a bit sluggish in Resolve because HEVC is a high-compression delivery codec and not really intended for editing/grading).

•On the delivery page, prepare a ProRes 422 HQ export of the film, in full resolution 3840x2160. (You may use ProRes 4444 if preferred, although it will use more storage space. ProRes 422 HQ is still 10bit, so it should suffice and save you a bit of storage). Once you’ve prepared the ProRes export, set an output location and add it to the render queue. Then on the render queue, hit “Start Render.”

This will give you the full 10-bit, wide gamut footage, without any of the HDR metadata. And since it’s ProRes (an intermediate codec intended for editing and grading), it will run much faster and be much less taxing on your CPU/GPU than the original HEVC version. The file size will be relatively large — approximately 220 GB / hour. You may think this is excessive, but that’s the price you have to pay to use proper intermediate codecs! (Using proper codecs will save you much time and frustration).

Note: If you’re on a Windows PC then you unfortunately won’t have the ProRes encoding options. You may use DNxHR HQX instead. It’s a fine alternative to ProRes HQ, although it is a bit more sluggish. Or you may also use any of your preferred image sequence formats: EXR, DPX, TIFF, etc. (although, in my opinion, those produce unnecessarily large file sizes, especially for footage sourced from HEVC).


UPDATE 06/03/2020 - If you only have the free version of DaVinci Resolve and not the paid Studio version, then you can convert to ProRes straight inside of FFmpeg (or the Hybrid FFmpeg GUI). Afterwards, you may follow the rest of this guide using the free version of Resolve. Below are some settings you can use in Hybrid. Or forum user oohteedee has kindly provided the command line for this in the comments below, if you prefer command line).


Once your ProRes export is complete, you now have your film ready to be graded and used in your fan restoration! This new ProRes clip is what you will now import into Resolve (or any other software) and use from now on.

The next step is knowing how to use this HDR footage and make it look pretty. Here’s one simple way to get a starting point in your color grade, using a Color Space Transform (CST) node in Resolve:

•Open your OpenFX palette and drag the “Color Space Transform” effect onto a new node.

•Set the Input Color Space to Rec.2020 and the Input Gamma to ST2084.
•Set the Output Color Space to Rec.709 and the Output Gamma to Gamma 2.4.
•Change Tone Mapping Method to Luminance Mapping, and Gamut Mapping to Saturation Mapping.

Now we have properly converted the color space from Rec.2020 to Rec.709, with tone mapping. This won’t look perfect, because every film is graded differently. It’s simply a color space conversion. But you’re now in the correct color space for SDR, and it should provide you with a really great starting point. You may add a node before or after the CST node, and tweak it to taste, using Lift/Gamma/Gain, YRGB Curves, and Contrast/Pivot/Hue/Saturation.

In my case, I added a node before the CST, and brought down the gamma/midtones as well as brought the temperature slightly cooler, and now it feels a bit more balanced.

If Resolve isn’t your preferred grading application, you may export your custom CST/grade as a Lookup Table (LUT) and bring it into any other software to use as a starting point for your grading. Here’s how:

•Right-click on a clip that has your CST/grade applied to it.
•Click “Generate 3D LUT (33 Point Cube).”
•Choose a directory where you want to export the LUT.

You can now use the .cube LUT file in any supported application.

You don’t need to grade the HDR footage with a CST like this; it’s just one way to get a quick starting point. You can do 100% custom grading on your HDR footage instead, if preferred. But I think this is a quick and effective way to get in the right ballpark.

I went ahead and created a LUT out of this, in case anyone wants it for their non-Resolve software applications. Just note that, in terms of grading hierarchy, you’ll want to make any large color adjustments in a layer/node before the LUT. There are two flavors of the LUT – one with just the default CST, and one with the CST + a few custom adjustments. Feel free to download them here.

And that’s it. Hope this helps.

-44

Author
Time

I do it a bit different.
After ripping and remuxing to a mkv, I use ffmpeg to convert the x265 .mkv to ProRes4444.
In Resolve I’ll then typically use a tonemapping LUT I created with DisplayCAL or another tonemapping LUT.
And finally still in Resolve I’ll do my final grade/edit.

Author
Time
 (Edited)

oohteedee said:

I do it a bit different.
After ripping and remuxing to a mkv, I use ffmpeg to convert the x265 .mkv to ProRes4444.
In Resolve I’ll then typically use a tonemapping LUT I created with DisplayCAL or another tonemapping LUT.
And finally still in Resolve I’ll do my final grade/edit.

Nice! That sounds like it would work really well too. Similar ideas. I like the idea of skipping a step and just going straight to ProRes in FFmpeg; however, I haven’t done that myself because FFmpeg’s ProRes implementation is unlicensed, and I’ve actually noticed a slight color shift with it. Maybe the issues have been fixed since I played around with it a couple of years back, and if so that would be awesome. That’s also a great way to get it into ProRes if you’re on Windows! Great thinking!

Author
Time

I’ve been converting to prores in FFMpeg and can confirm that it works really well. No color shift that I have seen.

Author
Time

Stotchy said:

I’ve been converting to prores in FFMpeg and can confirm that it works really well. No color shift that I have seen.

Nice. That’s great to hear!

Author
Time

I wonder if Adywan knows about this for his SW Revisited projects? He just picked up the 4K SW boxset this week!

Author
Time

Thanks a lot for this useful topic!

Author
Time

You could probably use an SDR encode as a proxy and replace the proxy footage with the full 4K HDR at the end.

a trolling bantha

Author
Time
 (Edited)

I was wondering if you guys could help me out with the HDR stuff - I’m working in Premiere and I don’t have DaVinci studio.
I remuxed the mkv to mp4, as per the guide and when I import that into Premiere, I do get the flat-looking image but when I try to make any adjustments to it, it brings out some really awful color-artifacts.

Interesting thing is that when I remux it to m2ts in tsmuxer, Premiere will read it as well and it displays the proper colors but it’s incredibly slow and buggy.

Could someone maybe provide me with a LUT that would work in Premiere or something like that?

EDIT: I just noticed 44rh1n already provided some LUTs in his post, so I’ll try those.

  • www.facebook.com/despecialized
  • IF YOU HAVE ANY QUESTIONS ABOUT THE DESPECIALIZED EDITIONS, PLEASE READ THE FIRST POSTS OF THESE THREADS, WHICH HAVE UP-TO-DATE INFORMATION: SW, ESB, ROTJ, 97SE RE-ED
    IF YOU DON’T FIND WHAT YOU’RE LOOKING FOR THERE, TRY ASKING IN THE APPROPRIATE THREADS - MOST REGULAR POSTERS KNOW ALL THE ANSWERS AND SOMEONE WILL LIKELY BE ABLE TO HELP YOU.
    IF I GET A PM WITH A QUESTION, WHICH COULD HAVE BEEN ANSWERED THROUGH THESE MEANS, IT WILL BE IGNORED. SORRY BUT I AM NOT THE LOCAL INFO BOOTH. THANK YOU.
Author
Time
 (Edited)

Harmy said:

I was wondering if you guys could help me out with the HDR stuff - I’m working in Premiere and I don’t have DaVinci studio.
I remuxed the mkv to mp4, as per the guide and when I import that into Premiere, I do get the flat-looking image but when I try to make any adjustments to it, it brings out some really awful color-artifacts.

In my guide I say to rewrap the mkv to mp4 in FFmpeg and then transcode to ProRes in Resolve Studio. But then oohteedee suggested that you can simply transcode straight to ProRes with FFmpeg and skip the mp4 step altogether. So that’s what I’d recommend, since it doesn’t require Resolve Studio! Then you’ll be able to pull the ProRes file into the free version of Resolve (or any other software). Working in ProRes will take up more storage space than the MP4, but it will run much faster and efficiently on your computer.

Author
Time

OK, 44rh1n’s LUTs make it look more or less correct but the artifacts are still there.

http://www.framecompare.com/image-compare/screenshotcomparison/990FJNNU#

When I look really closely, the artifacts are there even on the flat image and when I increase the saturation on the m2ts, they come out as well. Could there be something wrong with the file I have?

  • www.facebook.com/despecialized
  • IF YOU HAVE ANY QUESTIONS ABOUT THE DESPECIALIZED EDITIONS, PLEASE READ THE FIRST POSTS OF THESE THREADS, WHICH HAVE UP-TO-DATE INFORMATION: SW, ESB, ROTJ, 97SE RE-ED
    IF YOU DON’T FIND WHAT YOU’RE LOOKING FOR THERE, TRY ASKING IN THE APPROPRIATE THREADS - MOST REGULAR POSTERS KNOW ALL THE ANSWERS AND SOMEONE WILL LIKELY BE ABLE TO HELP YOU.
    IF I GET A PM WITH A QUESTION, WHICH COULD HAVE BEEN ANSWERED THROUGH THESE MEANS, IT WILL BE IGNORED. SORRY BUT I AM NOT THE LOCAL INFO BOOTH. THANK YOU.
Author
Time

I finally have a Star Wars 4K HDR copy now, so I’ll stress-test it on my end as soon as I get the chance, to see how it holds up. But from just glancing at oohteedee’s D+77 (sourced from the 4K HDR), his doesn’t have the artifacting. So there might be something in the workflow chain causing the artifacting to happen on your end.

https://i.imgur.com/o02DAv2.jpg

Have you tried converting to ProRes before applying any color adjustments? As crazy as it sounds, ProRes, for me, fixes loads of issues. I think because it’s a codec intended for intermmediate work (color grading, editing, etc.) Might not help, but just an idea!

Author
Time
 (Edited)

Yeah. I converted it to ProRes and I’m getting the same artifacts there. Though I did the conversion in Adobe Media Encoder, so that might be the problem. But when trying to do the conversion in ffmpeg, it always crashed after a few minutes. Or rather it said it had finished but the resulting file would be only like the first couple of minutes of the movie.

  • www.facebook.com/despecialized
  • IF YOU HAVE ANY QUESTIONS ABOUT THE DESPECIALIZED EDITIONS, PLEASE READ THE FIRST POSTS OF THESE THREADS, WHICH HAVE UP-TO-DATE INFORMATION: SW, ESB, ROTJ, 97SE RE-ED
    IF YOU DON’T FIND WHAT YOU’RE LOOKING FOR THERE, TRY ASKING IN THE APPROPRIATE THREADS - MOST REGULAR POSTERS KNOW ALL THE ANSWERS AND SOMEONE WILL LIKELY BE ABLE TO HELP YOU.
    IF I GET A PM WITH A QUESTION, WHICH COULD HAVE BEEN ANSWERED THROUGH THESE MEANS, IT WILL BE IGNORED. SORRY BUT I AM NOT THE LOCAL INFO BOOTH. THANK YOU.
Author
Time

Hmm, I’m seeing those same artifacts in the screenshot you posted.

  • www.facebook.com/despecialized
  • IF YOU HAVE ANY QUESTIONS ABOUT THE DESPECIALIZED EDITIONS, PLEASE READ THE FIRST POSTS OF THESE THREADS, WHICH HAVE UP-TO-DATE INFORMATION: SW, ESB, ROTJ, 97SE RE-ED
    IF YOU DON’T FIND WHAT YOU’RE LOOKING FOR THERE, TRY ASKING IN THE APPROPRIATE THREADS - MOST REGULAR POSTERS KNOW ALL THE ANSWERS AND SOMEONE WILL LIKELY BE ABLE TO HELP YOU.
    IF I GET A PM WITH A QUESTION, WHICH COULD HAVE BEEN ANSWERED THROUGH THESE MEANS, IT WILL BE IGNORED. SORRY BUT I AM NOT THE LOCAL INFO BOOTH. THANK YOU.
Author
Time

Harmy said:

Hmm, I’m seeing those same artifacts in the screenshot you posted.

Shoot, you’re right. I didn’t notice them at first glance, but once you add saturation they become very noticeable. Hmmm. Now I’m really curious how oohteedee treated his footage…

Author
Time
 (Edited)

Same.
I’m trying to download some alternative sources to see if they have the same problem.
Looking at the artifacts, they look like compression artifacts, so maybe it’s something to do with the h265 decoding.

  • www.facebook.com/despecialized
  • IF YOU HAVE ANY QUESTIONS ABOUT THE DESPECIALIZED EDITIONS, PLEASE READ THE FIRST POSTS OF THESE THREADS, WHICH HAVE UP-TO-DATE INFORMATION: SW, ESB, ROTJ, 97SE RE-ED
    IF YOU DON’T FIND WHAT YOU’RE LOOKING FOR THERE, TRY ASKING IN THE APPROPRIATE THREADS - MOST REGULAR POSTERS KNOW ALL THE ANSWERS AND SOMEONE WILL LIKELY BE ABLE TO HELP YOU.
    IF I GET A PM WITH A QUESTION, WHICH COULD HAVE BEEN ANSWERED THROUGH THESE MEANS, IT WILL BE IGNORED. SORRY BUT I AM NOT THE LOCAL INFO BOOTH. THANK YOU.
Author
Time
 (Edited)

I convert the mkv direct to ProRes4444 with ffmpeg. I’m not at home now so I can’t share my command line. I can do that when I get home.

It’s important that force 10bit when you do it. The default with ffmpeg is 8bit. That could be the issue you are having.

I never work direct with an x264 or x265 because it’s always very sluggish and it’ll often show the wrong frame when scrubbing back and forth. In ProRes every frame is a key frame so the frame displayed is always accurate.

Edit: what I use

ffmpeg -hide_banner -i /path/to/file/ESB-HDR.mkv -an -vf “format=yuv444p10le” -c:v prores_ks -pix_fmt yuv444p10le -profile:v 4 -vendor apl0 -r 24000/1001 -force_fps -movflags +write_colr -colorspace bt709 -color_primaries bt709 -color_trc bt709 -report ESB-HDR-ProRes.mov

The 10le in those two places tell ffmpeg to use 10bit instead of the default 8bit

Author
Time

Harmy said:

Yeah. I converted it to ProRes and I’m getting the same artifacts there. Though I did the conversion in Adobe Media Encoder, so that might be the problem.

Alright Harmy! I think I’ve figred it out! My ProRes 4444 sample conversion just finished, so I threw it into Resolve and it looks great! No artifacts anymore (at least, nowhere near the same as the previous stills). My suspicion is that MPV with its on-the-fly tonemapping, as well as Media Encoder, aren’t processing it in the highest quality possible. Because the slow ProRes 4444 conversion done in FFmpeg looks amazing.

  1. Flat HDR

  1. Tonemapping Applied

  1. Tonemapping & 200% Saturation

  1. Quick Custom Grade

Or here is a link to the images as TIFFs, instead of the compressed JPG versions above.

As far as creating the ProRes file in FFmpeg goes, here are the settings I used:


Author
Time
 (Edited)

oohteedee said:

It’s important that force 10bit when you do it. The default with ffmpeg is 8bit. That could be the issue you are having.

I bet that was it! Once I finished mine through FFmpeg, it looked perfect.

oohteedee said:

I never work direct with an x264 or x265 because it’s always very sluggish and it’ll often show the wrong frame when scrubbing back and forth. In ProRes every frame is a key frame so the frame displayed is always accurate.

I couldn’t agree more with this statement!

Author
Time

Yep, I’m using the same settings and it says:

Creating job for current source
-> Creating jobs for source: (1)
-> Generating calls for: S:\Star.Wars.Episode.IV.1977.2160p.BluRay.REMUX.mov
Enforcing cfr decoder output due to mov output.
Enforcing ffmpeg remove negative delay due to mov output.
Ignoring time codes for output since Vapoursynth frame interpolation is used.
adding ProRes calls for source: 1
createJobs for S:\Star.Wars.Episode.IV.1977.2160p.BluRay.REMUX.mov
creating attachment extraction subjobs
creating video subjobs
creating muxing subjobs
optimizing the subJobs
-> finished creating subjobs for current source
added new job with id 22_18_14_6810
-> should be there after processing: S:\Star.Wars.Episode.IV.1977.2160p.BluRay.REMUX_22_18_14_6810_02.mov
starting 22_18_14_6810_02_video@22:18:14.726 - S:\Star.Wars.Episode.IV.1977.2160p.BluRay.REMUX.mov

And then nothing happens.

  • www.facebook.com/despecialized
  • IF YOU HAVE ANY QUESTIONS ABOUT THE DESPECIALIZED EDITIONS, PLEASE READ THE FIRST POSTS OF THESE THREADS, WHICH HAVE UP-TO-DATE INFORMATION: SW, ESB, ROTJ, 97SE RE-ED
    IF YOU DON’T FIND WHAT YOU’RE LOOKING FOR THERE, TRY ASKING IN THE APPROPRIATE THREADS - MOST REGULAR POSTERS KNOW ALL THE ANSWERS AND SOMEONE WILL LIKELY BE ABLE TO HELP YOU.
    IF I GET A PM WITH A QUESTION, WHICH COULD HAVE BEEN ANSWERED THROUGH THESE MEANS, IT WILL BE IGNORED. SORRY BUT I AM NOT THE LOCAL INFO BOOTH. THANK YOU.
Author
Time

Try the command I posted instead of using hybrid. It works.

Doing the whole movie can take 8 or more hours depending on how fast your machine is.

Author
Time
 (Edited)

On the Jobs tab what does the progress percentage show? For me, even with a powerful computer it takes several hours to complete the entire conversion from HEVC to ProRes. Sometimes it might show that one task is finished, but the progress as a whole hasn’t totally finished.

oohteedee said:

Try the command I posted instead of using hybrid. It works.

Doing the whole movie can take 8 or more hours depending on how fast your machine is.

Or do this! I’m a GUI man myself, but command line can be more robust if you know how to use it, and it looks like oohteedee definitely knows how!