What happened?

I always shoot my Osmo Action 6 in D-Log M. After a shoot, the routine goes like this: import the clips into DJI Mimo on my phone, apply “color restore”, turn on HDR (the export is HLG with Dolby Vision), add an official filter, and finally switch on the beauty filter.

It looks great, but there’s one problem: exporting on the phone is painfully slow!

Mimo has a Mac version too, but after poking around, it doesn’t seem to have the beauty filter. So I thought: isn’t this exactly what a Mac GPU is good at? Why not move the whole Mimo routine onto the computer?

Mostly I just didn’t want to wait.

Is there anything out there already?

I searched around first. Plenty of people complain about Mimo’s slow export, but nobody really solves it:

  • DJI’s official D-Log M LUT converts to Rec.709, while I want HLG HDR, and the colors it produces don’t match what Mimo actually exports;
  • Commercial beauty SDKs such as ByteDance’s (Volcano Engine) are built for embedding in phone apps and need a business license, so they’re no use for batch-processing video on a computer;
  • Academia has plenty of beauty models, but they’re a long way from “just use it and it looks good”.

So I had to build it myself. Claude Code did most of the work this time; my job was to describe what I wanted, check the results and nitpick.

Reverse-engineering “color restore + HDR”

Where do Mimo’s colors come from? The approach was blunt: line up the original clips with Mimo’s exports frame by frame, and fit the mapping directly.

Concretely, we fit a 33×33×33 3D LUT in D-Log M RGB space whose output is HLG / BT.2020 code values. The fit uses DJI’s generic LUT as a prior plus a smoothness constraint, and leaves out every skin pixel, because Mimo’s beauty filter changes skin color and would otherwise drag the LUT off.

The result was pretty satisfying: on frames that weren’t part of the fit, it lands within 2.4–4.9 code values of Mimo, while DJI’s generic LUT is off by 41–55 code values.

HDR turned out to be the easiest part. Encode HLG HEVC Main 10 with Apple’s VideoToolbox, and the system automatically attaches Dolby Vision 8.4 metadata to every frame, exactly the same format as Mimo’s export.

Beauty: writing my own

The beauty filter was harder to fake. Here’s what we ended up with:

  1. Apple’s Vision framework does person segmentation and face landmark detection;
  2. The landmarks outline the face, with the eyes, brows, lips and nose cut out, because smoothing those just makes them mushy;
  3. Each clip learns its own skin color model, so only pixels that “look like skin” get touched;
  4. Smoothing is an edge-preserving guided filter, plus a little brightening.

There were plenty of pitfalls along the way: at first the skin actually got darker after smoothing, and white stripes on clothes were mistaken for skin… we fixed them one by one. The parameters were calibrated against Mimo’s output and compared with three sets of numbers: skin brightness change, chroma change, and how much detail survives at three scales:

SceneVersionSkin brightnessChromaDetail kept (three scales)
Outdoorosmohdr+15.4−3.50.796 / 0.852 / 0.891
OutdoorMimo+18.9−3.10.799 / 0.846 / 0.900
Indoorosmohdr+20.0−0.70.774 / 0.845 / 0.905
IndoorMimo+16.2−0.30.830 / 0.884 / 0.932

Not identical, but very close. Here’s a still from the outdoor clip. Top left is Mimo’s phone export, top right is my tool, and the bottom two are DaVinci Resolve, which comes up below:

Outdoor comparison: Mimo phone export, osmohdr, Resolve with the LUT only, Resolve with the LUT plus Beauty

A closer look at the face, from left to right: the original, Resolve with the LUT only, Resolve with Beauty, Mimo, and osmohdr:

Face close-up: original D-Log M, Resolve with the LUT only, Resolve with Beauty, Mimo phone export, osmohdr

These stills show the HLG signal as SDR, so the colors look paler than on an HDR screen. In motion, it looks like this:

Can the paid DaVinci Resolve be automated?

Halfway through, it hit me: DaVinci Resolve Studio has a built-in Beauty effect. If a script could automate “import → grade → export”, wouldn’t that be much easier?

The first pitfall came right away: the free version of Resolve doesn’t allow external scripting at all, only Studio does. So I uninstalled the free version completely (after backing up projects and LUTs) and switched to Studio.

Under Studio the script really does work: it launches Resolve, imports the clips, sets the project to Rec.2100 HLG, applies the LUT and exports H.265. Two clips took 19 seconds, and the colors were only about 3 code values off the reference. There were a few small traps, too. When the frame rate doesn’t match, Resolve pops up a dialog and the script just hangs, so the frame rate has to be read with ffprobe and set beforehand. And the render settings have no switch for Dolby Vision.

But the part that mattered most, beauty, just can’t be automated. Changing Beauty’s parameters from a script does nothing to the image, even at the most extreme values, while a Gaussian blur in the same chain works fine. So Resolve can apply the colors for me automatically, but it can’t do the beauty.

So beauty stays with the version I wrote myself.

Is the GPU maxed out?

When Resolve exports, the GPU is pinned the whole time, while my tool started at only about 45 frames per second, which annoyed me.

So we rebuilt the whole thing as a pipeline: decoding, analysis, rendering and encoding each do their own job, with three frames on the GPU at once. Face analysis runs every other frame, and only on a 768-pixel-wide copy. After that, a single file runs at 89–95 frames per second, and the output is bit-identical to before.

That’s about the ceiling: with only the LUT and nothing else, it still tops out at 96 frames per second, the limit of the Mac’s hardware video engine. So the bottleneck is no longer the GPU but the hardware encoder and decoder. Several files can run side by side with --jobs. In the end, 8 clips with 30,652 frames in total (about eight and a half minutes of 4K60) took 315 seconds on an M1 Max.

At one point I saw the CPU pinned and panicked; it turned out to be the verification scripts decoding video in software with ffmpeg, nothing to do with the tool itself.

Wide-angle distortion: a failed experiment

After processing, I noticed the wide-angle edge stretch was pretty strong: people and things near the sides of the frame looked too wide.

First I checked: footage shot with RockSteady on has already been turned into a rectilinear projection inside the camera, so straight lines are straight, and a classic “lens distortion correction” has nothing to fix. The real problem is wide-angle perspective stretch. DJI writes a 15 mm equivalent focal length into every frame’s metadata, which works out to a horizontal field of view of about 103°.

So I tried the Pannini projection: keep vertical lines straight and squeeze the sides inward. It runs as a GPU kernel, reads the focal length from the metadata automatically, and leaves no black borders. Here’s the result:

Edge stretch correction before and after: uncorrected on the left, Pannini strength 1 on the right

The red car and the railing on the right really do look normal again. To be safe, I also had Claude Code launch four independent AI agents to check the math, the output files, visual artifacts and the code. They really did find problems: a deliberately crafted broken MP4 could crash the parser outright; --focal 0 produced solid-color frames; when the crop cut the eyes out of the frame, the beauty filter could no longer find the lips and smoothed them along with the skin; and timestamps were only precise to 1/600 of a second. All of these are fixed.

But when I watched it myself, something felt off: did the image quality just drop?

It did. To squeeze the sides back in and still keep the whole field of view within the same 3840 pixels of width, the centre has to be enlarged: about 1.3x at strength 1 and about 1.2x at strength 0.5. It’s basically a digital zoom in the middle. Switching interpolation from bilinear to bicubic recovered 12–18% of the detail with no speed loss, but detail lost to the enlargement doesn’t come back:

The same spot at 200%: uncorrected, strength 1, strength 0.5

So is there a smarter way online that doesn’t lose quality? I had it do another round of research, and the answer was blunt: not for footage the camera has already straightened. It’s a matter of geometry, not software: ffmpeg, Hugin, PTGui, Resolve, After Effects and Gyroflow all hit the same limit. The approaches that actually help are all on the capture side:

  • The camera’s Natural Wide field of view: a new mode on the Action 6 that, in DJI’s words, keeps an ultra-wide view while correcting vertical distortion. The camera warps once, straight from sensor data, so there’s no second resampling in post. Next time I shoot, I’ll compare it on a tripod;
  • Shoot 8K and downscale to 4K: with enough pixels, the correction doesn’t need to enlarge the centre, at the cost of only 24/25/30 fps;
  • Fix only the faces: Google has a method that corrects faces near the frame edges back to normal while leaving the background untouched, and there’s even a paper for video, but no public video code.

Everything else was ruled out too: Gyroflow needs stabilization turned off while shooting, Topaz takes over half an hour to process one minute of 4K60 on an M4 Max, and Apple’s built-in super-resolution only accepts input up to 1080p.

So I gave up. The feature stays in the tool but is off by default; add --pannini 1 if you want it.

Open source

The tool is called osmohdr, and it’s open source at bdim404/osmohdr under Apache-2.0. Using it is simple:

git clone https://github.com/bdim404/osmohdr.git
cd osmohdr
swift build -c release
.build/release/osmohdr --jobs 2 ~/Downloads/Action6

You need an Apple Silicon Mac with macOS 15 or later. The DaVinci Resolve batch script is in the repository’s resolve/ folder too. The LUT was fitted only on a few of my own clips, so other scenes may drift a bit; issues are welcome.

Side note

Over this one day, reverse-engineering the colors, fitting the LUT, writing Metal kernels, wiring up Vision, scripting Resolve, and even launching several agents to check each other, nearly all of it was done by Claude Code, while I mostly checked results and made the calls. Honestly, I probably wouldn’t have found the bugs it caught on my own.

But in the end it was my own eyes that noticed “the image got worse”. Some problems aren’t software problems at all, they’re physics: pixels don’t appear out of thin air, and no matter how well a tool is written, it can’t get around geometry.

A tool is still a tool; judgment is still yours.

References