FFmpeg and DJI D-Log on the Mavic 2 Pro

To properly see a video recorded with a DJI Mavic 2 Pro in D-log colours, it needs conversion. This can be done with the cube file provided by DJI. Such cube files contain the lookup table (LUT) to turn the bland colours into proper ones when viewing with a run-of-the-mill viewer like MPlayer, VLC, Windows Media Player, etc.

Unfortunately, DJI’s cube file is incompatibe with FFmpeg. It should work with this command, but doesn’t:

ffmpeg -i input_file.mp4 -c:v h264 -crf 21 \
    -vf lut3d='dlog-to-rec709.cube' output_file.mp4

This results in an error “3D LUT is empty” from FFmpeg. Fortunately, this is easily fixed. Just open the .cube file in any text editor, and find the line LUT_3D_SIZE 33. There is a tab character between the LUT_3D_SIZE and 33, and even though this is fine according to the specifications, FFmpeg doesn’t like it. Just replace it with a space, so change:

LUT_3D_SIZE<tab>33

into:

LUT_3D_SIZE<space>33

Save the file, and you’re done. The above ffmpeg command will now just work.

Update: this incompatibility has been fixed in FFmpeg, and will be part of a future release (current release is 4.1).

dr. Sybren A. Stüvel
dr. Sybren A. Stüvel
Open Source software developer, photographer, drummer, and electronics tinkerer

Related