Workaround for Buggy DNG Handling in macOS

Mar 04, 2018

Yesterday I released a new version of my video post processing tool Colorcast. Among other things this new version includes support for Cinema DNG. Cinema DNG is an industry standard to store RAW video. Sometimes there are tools that convert the vendor RAW format of the camera to Cinema DNG and other times Cinema DNG is directly produced in camera, examples for this is the Blackmagic Cinema Camera lineup and the DJI X5R camera that can be mounted on a DJI Osmo or under a DJI Inspire drone.

During development of that feature, I had to deal with a number of bugs in Apple's implementation of DNG. There are configurations of DNG files that simply to not render correctly in Finder, QuickLook, Preview and even Photos. The reason for that is a lack of correctly handling those configurations in the underlying Apple API. I wasn't able to pinpoint the number of bugs exactly, but I think there are basically 2 main issues:

  1. Problem with handling bitdepths other than 14 bit RAW
  2. Problem with tiled RAW buffers

Buggy Tiling

The first problem causes 10 or 12 bit images to draw very dark. 12 bit 2 stops and 10 bit 4 stops darker as normal. The second problem just produces weird drawing issues, I can't really explain. The solution however is quite simple. You need to convert the RAW buffers to 14 bit and untile it. Sounds easier than done. You basically need to decode the whole DNG image yourself, convert the RAW buffers, convert some metadata like linearization tables and write out a new DNG image. And that is exactly what I have done. Around 2000 lines of code, just to get the images properly displayed. I hope that with macOS 10.14 Apple comes around and fixes those issues (Radars: 37538394, 31032063, 30754552).

Nevertheless, I found this conversion method so useful, I also created a small batch conversion application called DNGDoctor and put it into the Mac App Store. Check it out. And if you have a graphics application that deals with DNG images, and like to ship this fix in your app, just let me know.

Aug 29, 2023
How Hollywood is Losing Ground to Silicon Valley's Big Tech Giants

Jun 05, 2023
Is Apple's Anticipated AR/VR Headset a Misplaced Bet in the Current AI-Driven Market?

Jun 03, 2023
Bose QuietComfort Earbuds II vs. Apple AirPods Pro: A Personal Experience

Jan 19, 2023
How I Ran My Own Mastodon Server in 10 Minutes

Apr 01, 2019
MacBook Pro (eGPU) vs Hackintosh GPU

Jan 12, 2019
My New Silent, Small Hackintosh for 600 EUR

Nov 22, 2018
Instacast is Now Free and Open Source

Sep 12, 2018
What makes a Mac Pro a Mac Pro

Jul 14, 2018
Why you Should Build a Hackintosh

Apr 16, 2018
Why the Blackmagic Pocket Cinema Camera Is Not a Good Vlogging Cam

Apr 09, 2018
ProRes RAW is Here

Apr 03, 2018
Is the Nokia Steel HR Smart Watch an Apple Watch Killer?

Mar 04, 2018
Workaround for Buggy DNG Handling in macOS

Mar 03, 2018
Colorcast 0.5 Adds Support for Cinema DNG, Anamorphic De-Squeeze and Slow Motion

Feb 06, 2018
Open-Source Objective-C API for Magic Lantern

Feb 06, 2018
Colorcast v0.4 Includes RAW Engine And Supports Magic Lantern

Jan 25, 2018
Thoughts on the DJI Mavic Air

Jan 24, 2018
Why I bought a Sony Alpha 7 Mark II in 2018

Jan 18, 2018
Using Metal Performance Shaders with Core Image

Jan 15, 2018
Night-Mode For Your iOS App

Jan 15, 2018
What’s Color Grading and Why You Want That

Jan 09, 2018
My Review of

Dec 27, 2017
Everything That's Wrong with Hackintosh

Dec 21, 2017
Colorcast Alpha v0.3 Available

Dec 19, 2017
RX Vega 64 Hackintosh for High-End Video Work

Sep 07, 2017
Colorcast Alpha v0.2 Available

Aug 31, 2017
First Alpha Version of Colorcast Available

Jun 01, 2015
Vemedio Product Development Has Been Discontinued

Apr 16, 2015
Audio Books vs. Podcasts

Mar 21, 2015
Rejected for Weak Linked Frameworks

Mar 19, 2015
Ideas for A Better App Store

Mar 05, 2015
Auto-Layout works