I created this GitHub repo mainly for my own reference, but decided to make it public in case it helps someone else.
The SDR variant of HDR videos uploaded to YouTube have raised near black tones and poor contrast because of incorrect gamma/tonemapping by default, however, YouTube allows you to change its tonemapping behavior if you attach an appropriate LUT file to your HDR video before uploading.
This repo contains some pre-configured LUTs which I generated using DaVinci Resolve. These can be attached to your final video export before upload to significantly improve the SDR variant's presentation, bringing it closer to the intended look.
The LUT files can be attached using mkvmerge.exe by running a command in Windows' command prompt/Terminal. This should work on Linux and Mac as well, but I haven't tested them.
- Download and install MKVToolNix.
- Download and extract the latest release from the releases page, or alternatively directly download it with this link.
- Move your final exported video to the folder you extracted the .zip's files to.
- Open mkvmerge_command.txt and find & replace all instances of
1000with the nits value of one of the available LUT files, if needed. For best results, this should correspond with the peak nits that your video was mastered at. - Rename
input.mkvin mkvmerge_command.txt to your video's file name. - Open command prompt/Windows Terminal with the path set to the current folder (Right click blank space in explorer -> Open in Windows Terminal)
- Copy and paste the mkvmerge command into the terminal and press enter. An
output.mkvfile will be created in the folder with the LUT file attached, as well as added HDR metadata.
You can use this script for an easier way to apply the LUTs. (Credit: Shadetail)
(You will need MKVToolNix and the latest release .zip file extracted beforehand.)
Below is a comparison of the SDR variant of two HDR videos uploaded to YouTube. One had the LUT attached while the other didn't. To my eyes, the one that has the LUT applied looks much closer to the overall look of the actual HDR video (Skip to 2:00).
![]() |
|---|
| Credit to Jacob + Katie Schwarz on YouTube for their amazing HDR videos. |
Ideally, you would want to create a custom LUT specifically for each video you upload to get the exact look you want, however, that is a time consuming process with a good chance of messing things up if you're a beginner. These LUTs are "one size fits all" and should create a good looking SDR version when used correctly, far better than what YouTube tries to do.
Color Space Transform filter settings:
- Input Color Space: Rec.2100
- Input Gamma: Rec.2100 ST2084
- Output Color Space: Rec.709
- Output Gamma: Gamma 2.4
- HDR 203 Nits Diffuse White: Enabled
- Tone Mapping Method: Saturation Preserving
- Custom Max. Input: Set to LUT specific nits
- Everything else: Default
- Using mkvmerge on some video formats (DNxHR) may strip the video's framerate metadata, resulting in a choppy looking video when uploaded to YouTube. Adding the parameter
--default-durationto the mkvmerge command will fix this issue. Example:--default-duration 0:60pfor a 60 fps video. Refer to mkvmerge's documentation for more information. - The mkvmerge command I've provided is based on the command found in YouTube's own HDR metadata tool repository. Unfortunately, that repository has not been updated in quite some time, and therefore contains outdated mkvmerge builds and broken links to MKVToolNix.
