DJI D-Log-M Color Grading, Mini 4 Pro

Downloads

Goal

An accurate and neutral starting place for color grading DJI D-Log-M footage

Background

DJI has been offering a flat color profile in their drones and action cameras for years. The intent of these flat profiles is to provide the user a file that captures the most dynamic range possible and can then be better color graded later. This practice is very common in consumer cameras from Sony, Canon and others.

These files do require color grading and will not look very good straight out of camera (SOOC). For files from a Canon camera encoded with Clog, Canon has provided documentation on the math behind this color space and how to convert it to others. With this documentation Black Magic was able to build a Color Space Transform (CST) inside Davinchi Resolve to allow basically 1 click conversion to the Rec 709 color space we commonly want to export to.

DJI has refused to provide any documentation for D-Log-M (https://forum.dji.com/forum.php?mod=viewthread&tid=297669&extra=&page=1), so it is basically black box. They have provided Log to Rec709 LUTs, but as will be demonstrated later, these are damaging to the image and do not provide a good starting place for color grading.


Methodology

Linear tone curve means that an object at twice the brightness of another will have twice the value on the scope in our editing software. So if an object had a 50 IRE, at ISO 100, 1/50s, f2.8, if we changed to 1/100s shutter time we would expect the object to now be at 25 IRE. This principle was used to reverse engineer the tone curve used in the DJI Mini 4 Pro.

A color chart was brightly lit with constant light, and the drone placed to film the chart. At ISO 100 the chart was filmed from 1/25s to 1/16000s in one stop increments (1/25, 1/50, 1/100, etc). This clip was brought into resolve and layered so all 10 exposures are visible at once.


These 10 images are then converted from Rec709 to Linear with the Resolve CST. The exposure of each image is raise/lowered so that each chart should match #4, the 1/1600s shot. Eg #3 was shot at 1/3200s and raised 1 stop with the gain wheel, #6 was shot at 1/400s and lowered 2 stops.

If we had a perfect conversion from the camera space to linear we would expect all the values on the scope to basically identical now. But as seen here, this is not the case.


This is expected, we know the D-Log-M from the drone is not identical to REC709 that the Resolve CST has. Let us try the LUT provided by DJI (https://www.dji.com/kr/downloads/softwares/mini-4-pro-dlog-to-rec709)

This is significantly worse than straight out of camera, we see the darkest region is basically crushed to pure black. This is the same problem we have when applying the LUT to regular footage, shadows are crushed.

This is the same behavior we see with the DJI lut applied to a linear sweep, the bottom 5% of the tone curve is a flat line

With this information we can now build a tone curve that normalizes the SOOC numbers to be what they should be mathematically. And that is see here, the shadows are raised, mids dropped and high raised to make all the samples as close to #4 as possible.

#10 was hard clipped in camera, so it is not an accurate sample anyway. #1 and 9 are still low but I am concerned that artifact will be produced with further adjustments.

This custom tone curve should then cancel out the curve built into the camera, so that the Davinchi CST will produce an accurate Gamma 2.4 image. (Note this node and the color nodes below are applied with reduced key gain output, this makes the curve less sensitive and easier to draw fine adjustments.) This doesn’t however address the color primaries. It is also unknown what primaries DJI chose for this camera, it is obvious they chose something wider than Rec709 as the image still lacks saturation.

Reverse engineering the primaries is not as simple as the tone curve. My color chart only has samples for 75% saturation of the 6 main colors. So it isn’t possible to build a complete picture of what the camera is doing.

The test chart was shot and Hue-Hue, Hue-Sat curves were set to normalize the image as detailed by X-rite here https://youtu.be/2W2sRPqZRCs?si=9sbmEkUTqRxWwQwU&t=302 The chart was lit with sunlight from a cloudy day and camera set to 6000k. WB was fine tuned with eyedropper before the other adjustments, as you have no way to gray card WB in camera.

You will also note a ‘Sat Limit’ node. As my chart only has 75% Saturation targets, I was worried the saturation increase from the adjustments may produce artifacts for highly saturated object light car taillights. So a Sat-Sat curve was applied to reduce saturation of very high inputs saturations to not clip. Of course anything that clips in camera is not recoverable in edit.

All this combined is my best effort to produce a tool that will accurately convert D-log-m to Rec-709 Gamma 2.4.

I have exported this a a DPX file that can be imported into resolve as a power grade and placed at the head of your node tree. You can change the Rec709 CST at the end to output to DWG or whatever timeline working color space you prefer.

I have also provided this a LUT to work with any color grading software.

Results

Straight out of Camera is obviously very low contrast and saturation as it is supposed to be. The significant difference between my power grade and the DJI lut is the shadows, you will see significant more detail retained so you can then tweak as you wish.

Previous
Previous

Best Video Settings for Youtube, VMAF analysis