Technical fixes

LUTs and DCTLs to fix YCbCr to RGB conversion problems

What is this?

When you import video files containing YCbCr streams (e.g. H.264 or H.265) into your editor, they will be converted to RGB for display.
There are 3 standards for video files defining this conversion: ITU-R BT.601, ITU-R BT.709, and ITU-R BT.2020.
The one that's used is usually dictated by a flag in the metadata of the stream, it's called matrix coefficients. However, in some cases this flag is incorrect/missing or the editor is not reading it at all.
If this happens and the stream is decoded with the wrong matrix, the colors will be off, and you won't be able to correct them with RGB color space conversions. (This is a common misconception usually caused by the fact, that these standards also define RGB primaries.)
This technical pack provides fixes for these situations. I also included fixes for data range issues.
For a better understanding of this issue, you can watch my video about Fujifilm files:

Notice: The LUTs used in the video are now part of this package, they are the "bt.709_to_bt.601" conversions.
If you record internal HLG with the Fuji, the "bt.709_to_bt.2020" conversion should be used.

UPDATE 09/2019: Davinci Resolve v16 fixed the interpretation issue in Davinci YRGB mode, no need to transcode. RCM is still buggy.
UPDATE 08/2022: Adobe Premiere 2022 (v22.2.0) is still problematic. (that is on Windows 10, couldn't check it on Mac)

What's in the package?

bt.709_to_bt.601.dctlUse when your footage requires the BT.601 matrix but it's decoded with the BT.709 matrix. (Davinci CTL version)
bt.709_to_bt.601_premiere.cubeUse when your footage requires the BT.601 matrix but it's decoded with the BT.709 matrix. (3D LUT, Premiere version)
bt.709_to_bt.601_resolve.cubeUse when your footage requires the BT.601 matrix but it's decoded with the BT.709 matrix. (3D LUT, Resolve version)
bt.601_to_bt.709.dctlUse when your footage requires the BT.709 matrix but it's decoded with the BT.601 matrix. (Davinci CTL version)
bt.601_to_bt.709_premiere.cubeUse when your footage requires the BT.709 matrix but it's decoded with the BT.601 matrix. (3D LUT, Premiere version)
bt.601_to_bt.709_resolve.cubeUse when your footage requires the BT.709 matrix but it's decoded with the BT.601 matrix. (3D LUT, Resolve version)
bt.709_to_bt.2020.dctlUse when your footage requires the BT.2020 matrix but it's decoded with the BT.709 matrix. (Davinci CTL version)
bt.709_to_bt.2020_premiere.cubeUse when your footage requires the BT.2020 matrix but it's decoded with the BT.709 matrix. (3D LUT, Premiere version)
bt.709_to_bt.2020_resolve.cubeUse when your footage requires the BT.2020 matrix but it's decoded with the BT.709 matrix. (3D LUT, Resolve version)
bt.2020_to_bt.709.dctlUse when your footage requires the BT.709 matrix but it's decoded with the BT.2020 matrix. (Davinci CTL version)
bt.2020_to_bt.709_premiere.cubeUse when your footage requires the BT.709 matrix but it's decoded with the BT.2020 matrix. (3D LUT, Premiere version)
bt.2020_to_bt.709_resolve.cubeUse when your footage requires the BT.709 matrix but it's decoded with the BT.2020 matrix. (3D LUT, Resolve version)
full_to_legal_premiere.cubeFull to legal scaling, sub-blacks, super-whites preserved (1D LUT, Premiere version)
full_to_legal_resolve.cubeFull to legal scaling, sub-blacks, super-whites preserved (1D LUT, Resolve version)
legal_to_full_premiere.cubeLegal to full scaling (1D LUT, Premiere version)
legal_to_full_resolve.cubeLegal to full scaling (1D LUT, Resolve version)

Purchase

The purchase process is automated, you should receive your personalized download link to your PayPal email address within a few minutes.
If you don't receive your link, please contact me. Always make sure to check your spam folder!

Colorizer Technical Fixes $25

Fixing with FFMPEG

You can also fix this issue by transcoding your footage. I'll use FFMPEG, a free command line software to demonstrate the fix on internal Fujifilm recordings.
We want our final video to have the BT.709 matrix, because that will be interpreted correctly in all mainstream editors. Just changing the flag won't work, because the underlying data has to be converted as well.
I'll use the zscale video filter to do the magic:

ffmpeg -i INPUT.MOV -vf zscale=rin=full:r=full:pin=709:p=709:tin=601:t=709:min=170m:m=709 -c:v prores_ks -profile:v 2 -c:a copy OUTPUT.MOV

Explanation:
rin=full:r=full means that both the input and output use the full data range. It's better to not loose any precision.
Keep in mind that a full range ProRes file will be interpreted as video range in Resolve and in Premiere.
You can either use the "full_to_legal" LUT from my package, or in Resolve go to the Media pool, select your clips, right click, go to Clip attributes and select "Full" at Data levels.
In Premiere go to Effects, and choose Lumetri Presets -> Technical -> Full to Legal range, 10/12-bit.
pin=709:p=709 means that both the input and output use the color primaries defined by BT.709. This is how Fuji flags it's files, we won't change it.
tin=601:t=709 means that the input transfer characteristics are BT.601 and we will convert it to BT.709. It won't affect the image because BT.601 and BT.709 share the same transfer characteristics, but let's convert everything to BT.709.
min=170m:m=709 means that the input matrix coefficients are SMPTE170M (Fuji uses this tag and it equals to BT.601 in H.264/H.265) and the output matrix coefficients are BT.709. This is the most important part of our conversion.
-c:v prores_ks -profile:v 2 means that we'll convert to ProRes using profile no. 2. Possible values for the profile are:
0: ProRes422 (Proxy)
1: ProRes422 (LT)
2: ProRes422 (Normal)
3: ProRes422 (HQ)

If you're using Fuji's internal HLG for acquisition, you might want to convert the matrix coefficients to BT.709, because Resolve and Premiere seems to use that matrix instead of the BT.2020 one:
ffmpeg -i INPUT.MOV -vf zscale=rin=full:r=full:min=2020_ncl:m=bt709:pin=2020:p=2020:tin=arib-std-b67:t=arib-std-b67 -c:v prores_ks -profile:v 2 -c:a copy OUTPUT.MOV
Here I only convert the matrix coefficients tag. You could skip the color primaries and transfer characteristics options, but I like to specify everything by hand, just to be safe.

For Windows users only:
If you want to batch convert multiple MOV files, just put them in a folder, copy ffmpeg.exe in the same folder, and make a batch file with the following command in the same folder:
for %%a in ("*.mov") do ffmpeg -i "%%a" -vf zscale=rin=full:r=full:pin=709:p=709:tin=601:t=709:min=170m:m=709 -c:v prores_ks -profile:v 2 -c:a copy "%%~na_ProRes.mov"

You can download FFMPEG from here: https://ffmpeg.org/download.html