Working with DJI Ronin 4D-8K ProRes RAW on a Mac

The DJI Ronin 4D shoots ProRes RAW at up to 8K. The files are enormous, the standard tools choke on them, and the internet has almost nothing useful about getting them into a deliverable format without DaVinci Resolve. I spent a lot of time figuring this out on a MacBook Air, so here is what actually works.

Every command below has been tested with ffmpeg 8.x and Swift 6.x on Apple Silicon. No plugins, no paid software, no beefy workstation required.

What you are dealing with

  • ProRes RAW HQ .MOV files (sample entry aprh) from the Zenmuse X9 head. 60 fps, 17:9 DCI aspect (4096x2160 at 4K, 8192x4320 at 8K), 48 kHz 24-bit PCM stereo, plus an embedded 1920x1012 MJPEG thumbnail stream.
  • About 13 GB per minute at 4K. About 30 GB per minute at 8K. A single 9-minute take is 120 GB. A short 8K take was 190 GB.
  • The Ronin's clock is often unset. Filenames carry 691231 and modification times say 1969 or 1979. These dates are meaningless.
  • The card mounts at /Volumes/DJI on macOS, clips sit in AXXX_5HRDXX/ folders, and a Thunderbolt reader pushes about 1 GB/s. Decode is the bottleneck, not I/O.
  • Clip numbering restarts between shoots. Two different days on the same card can produce identical filenames one directory apart. Always disambiguate by path and duration, not by name alone.
  • Clips can be silently truncated. If a recording is interrupted, the container header can claim more frames than actually exist on the video track, while the audio track may be full length. Always verify decodable length before relying on a clip's tail.

Rule one: never decode with ffmpeg

ffmpeg's ProRes RAW support is broken on Ronin 4D files - at least in versions 6.x through 8.1.2. The mov demuxer returns roughly one sample out of every 536, which works out to about one decoded frame per 2 GB of file. The decoder holds that frame and repeats it. The sample tables in the file are complete and valid, so the bug is on ffmpeg's side.

This is insidious because every diagnostic looks fine. ffprobe reports the correct frame count, duration, and codec. The output file is the right size. On playback, the picture is frozen while the audio moves normally. Nothing in the toolchain flags it until you actually watch or frame-check the output.

Other dead ends:

  • avconvert (Apple's AVFoundation CLI) decodes every frame but applies generic RAW processing with no DJI camera plugin, so blown highlights wrap into neon pink. The file's proresraw.whitebalancefactors and colormatrices tags are empty, giving it nothing to calibrate against.
  • DJI's published codec download is only a D-Log to Rec.709 LUT for non-RAW footage. It does nothing for ProRes RAW.
  • Carving the MOV container into small valid slices to dodge the demuxer bug produced slices that decoded zero frames.
  • OpenCV blur and resize corrupted frame buffers nondeterministically. If you need post-processing, keep it in pure numpy.

What ffmpeg can safely do with these files: pull the audio track, and grab a single frame with -ss seek. Every frame is a keyframe so seeks are fast, but each RAW grab takes about 13 seconds and positioning is slightly imprecise. Seeks past about 97% of a clip's duration can fail outright - use -ss both before and after -i as a workaround.

What works: AVAssetReader through a Swift pipe

The trick is to use macOS against itself. AVFoundation's AVAssetReader is the same decode path that QuickTime Player uses, so color comes out correct by construction. The tool below reads frames through that API and writes raw BGRA pixels to stdout so ffmpeg can encode from the pipe.

import AVFoundation  
import Foundation

// avf_pipe <src.mov> <start_sec> <dur_sec> [30]
// Decodes via AVFoundation and writes BGRA rawvideo to stdout.
// Pass 30 as the 4th arg to keep every other frame (60 -> 30 fps).
let args = CommandLine.arguments  
let url = URL(fileURLWithPath: args[1])  
let start = Double(args[2])!  
let dur = Double(args[3])!  
let thin30 = args.count > 4 && args[4] == "30"

let asset = AVURLAsset(url: url)  
guard let track = asset.tracks(withMediaType: .video).first else {  
    fatalError("no video track")
}
let reader = try! AVAssetReader(asset: asset)  
reader.timeRange = CMTimeRange(start: CMTime(seconds: start, preferredTimescale: 600),  
                               duration: CMTime(seconds: dur, preferredTimescale: 600))
let out = AVAssetReaderTrackOutput(track: track, outputSettings: [  
    kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_32BGRA
])
reader.add(out)  
reader.startReading()

let stdout = FileHandle.standardOutput  
var n = 0, kept = 0, w = 0, h = 0  
while let sb = out.copyNextSampleBuffer() {  
    guard let pb = CMSampleBufferGetImageBuffer(sb) else { continue }
    CVPixelBufferLockBaseAddress(pb, .readOnly)
    w = CVPixelBufferGetWidth(pb)
    h = CVPixelBufferGetHeight(pb)
    let stride = CVPixelBufferGetBytesPerRow(pb)
    let base = CVPixelBufferGetBaseAddress(pb)!
    if !thin30 || (n % 2 == 0) {
        var row = 0
        while row < h {
            stdout.write(Data(bytes: base.advanced(by: row * stride), count: w * 4))
            row += 1
        }
        kept += 1
    }
    n += 1
    CVPixelBufferUnlockBaseAddress(pb, .readOnly)
}
FileHandle.standardError.write("avf_pipe: read \(n) wrote \(kept) \(w)x\(h)\n".data(using: .utf8)!)  

Save that as avf_pipe.swift and compile once. You will get a deprecation warning about tracks(withMediaType:) - it is harmless.

swiftc -O avf_pipe.swift -o avf_pipe  

The stderr line at the end is your first QC gate. The read count should match the frame count ffprobe reports for the time range you asked for. If it is short, the clip is truncated.

Two gotchas:

  • The pixels come out in linear light. You must apply the sRGB transfer curve during encoding (see the LUT below) or the picture comes out double-darkened. This wasted an entire render before I figured it out.
  • Always redirect </dev/null into avf_pipe inside shell loops. It eats stdin and the loop silently stops after the first item.

The LUT

The AVAssetReader output is linear-light BGRA. You need a 1D LUT to apply the sRGB EOTF or everything looks way too dark. Generate it with this:

#!/usr/bin/env python3
N = 4096  
print('TITLE "linear->sRGB EOTF"')  
print(f"LUT_1D_SIZE {N}")  
for i in range(N):  
    x = i / (N - 1)
    y = 12.92 * x if x <= 0.0031308 else 1.055 * x ** (1 / 2.4) - 0.055
    print(f"{y:.6f} {y:.6f} {y:.6f}")

Run it and save the output as srgb-eotf-1d.cube. That file goes into the ffmpeg filtergraph as lut1d=file=srgb-eotf-1d.cube.

Always prove it on 10 seconds first

Do not start a full render. These files are so big that a bad encode wastes an hour. Render a 10-second slice, open it, confirm motion and color, then commit to the full clip.

./avf_pipe /Volumes/DJI/your-clip.MOV 30 10 30 </dev/null 2>proof.log | \
  ffmpeg -y -v error -f rawvideo -pix_fmt bgra -s 4096x2160 -r 30 -i - \
    -vf "lut1d=file=srgb-eotf-1d.cube,format=yuv420p" \
    -c:v h264_videotoolbox -b:v 30M -profile:v high \
    -color_primaries bt709 -color_trc iec61966-2-1 -colorspace bt709 -r 30 proof.mp4
grep avf_pipe proof.log  
# expect: avf_pipe: read 600 wrote 300 4096x2160

The -s value must match what the pipe emits, which is the clip's native resolution. Get it wrong and ffmpeg will happily encode scrambled rows without complaining.

For 8K clips, the pipe reports 8192x4320, so use -s 8192x4320 and add scale=4096:2160 before the LUT to downsample exactly 2:1. Same 17:9 aspect, no crop needed. Expect higher memory use and slower throughput.

QC: check frame uniqueness, not ffprobe

ffprobe will not catch the frozen-frame bug. The only reliable test is hashing decoded frames and confirming consecutive ones differ. The -an flag matters - without it, framemd5 hashes audio frames too and the count is inflated.

# Count unique video frames in a 4 s window. Expect 120/120 at 30 fps.
ffmpeg -v error -ss 120 -t 4 -an -i output.mp4 -f framemd5 - | \  
  awk '!/^#/ {n++; if (!($NF in u)) {u[$NF]=1; k++}} END {print k "/" n " unique frames"}'

Run this on at least three windows - near the start, middle, and end. Also check near any cuts or overlays. Pick windows with visible motion: a locked-off shot of a static scene can legitimately produce identical frames and give you a false alarm.

A good render scores 120/120. A frozen render from the ffmpeg bug scores 1/60.

Then verify the streams line up:

ffprobe -v error -select_streams v:0 -count_frames \  
  -show_entries stream=nb_read_frames,width,height,r_frame_rate:format=duration \
  -of compact output.mp4
ffprobe -v error -select_streams a:0 \  
  -show_entries stream=codec_name,sample_rate,channels,duration -of compact output.mp4
ffmpeg -v info -i output.mp4 -af volumedetect -f null - 2>&1 | grep -E "mean_volume|max_volume"  

Encoder settings

These held up across multiple renders on a MacBook Air:

-c:v h264_videotoolbox -b:v 30M -profile:v high -pix_fmt yuv420p
-color_primaries bt709 -color_trc iec61966-2-1 -colorspace bt709 -r 30

What I learned:

  • 30 Mbps at 4096x2160. 20 Mbps showed visible grain in bright areas. At 30 Mbps expect roughly 225 MB per minute of output.
  • VideoToolbox can silently ignore the bitrate cap on complex filtergraphs (overlays, multi-input chains). One segment came out at 23 GB instead of the expected size. If that happens, check segment sizes against that 225 MB/min figure. The fallback is libx264 -crf 19 -preset slow - predictable bitrate, just slower.
  • Throughput on a MacBook Air: about 1.4x realtime on an idle machine (a 4:37 clip rendered in 3:12). Under CPU load it dropped to 0.3-0.5x. Budget an hour for a 7-minute deliverable.
  • Audio: -c:a aac -b:a 256k with loudnorm=I=-18:TP=-1.5:LRA=11. Always follow loudnorm with aresample=48000 - loudnorm resamples internally and quietly hands the encoder 192 kHz, so without the explicit resample your AAC track ships at 96 kHz. It plays everywhere but it is not what you want.

Full build: segments, concat, mux

The pattern that works for multi-clip composites: render each clip as its own segment, skip segments that already exist so a crash is resumable, concat with stream copy, then mux separately-built audio. Adapt the paths and durations to your footage.

#!/bin/bash
set -u  
LUT=./srgb-eotf-1d.cube  
CLIP_A=/Volumes/DJI/your-card/first-clip.MOV  
CLIP_B=/Volumes/DJI/your-card/second-clip.MOV  
DUR_A=276.565    # seconds - get from ffprobe  
DUR_B=101.12  
mkdir -p segs

enc() {  
  ffmpeg -y -v error -f rawvideo -pix_fmt bgra -s 4096x2160 -r 30 -i - "${@:2}" \
    -c:v h264_videotoolbox -b:v 30M -profile:v high -pix_fmt yuv420p \
    -color_primaries bt709 -color_trc iec61966-2-1 -colorspace bt709 -r 30 "$1"
}

# Segment A with fade in/out
[ -s segs/a.mp4 ] || ./avf_pipe "$CLIP_A" 0 $DUR_A 30 </dev/null 2>segs/a.log | \
  enc segs/a.mp4 -vf "lut1d=file=$LUT,format=rgb24,\
    fade=t=in:st=0:d=0.5,\
    fade=t=out:st=$(python3 -c "print($DUR_A-0.5)"):d=0.5,\
    format=yuv420p"

# Segment B with fade in/out
[ -s segs/b.mp4 ] || ./avf_pipe "$CLIP_B" 0 $DUR_B 30 </dev/null 2>segs/b.log | \
  enc segs/b.mp4 -vf "lut1d=file=$LUT,\
    fade=t=in:st=0:d=0.5,\
    fade=t=out:st=$(python3 -c "print($DUR_B-0.8)"):d=0.8,\
    format=yuv420p"

# Audio from the originals (ffmpeg audio decode works fine on these)
ffmpeg -y -v error -i "$CLIP_A" -i "$CLIP_B" -filter_complex \  
  "[0:a:0]afade=t=in:st=0:d=0.5,afade=t=out:st=$(python3 -c "print($DUR_A-0.5)"):d=0.5[a0];\
   [1:a:0]afade=t=in:st=0:d=0.5,afade=t=out:st=$(python3 -c "print($DUR_B-0.8)"):d=0.8[a1];\
   [a0][a1]concat=n=2:v=0:a=1,loudnorm=I=-18:TP=-1.5:LRA=11,aresample=48000[a]" \
  -map "[a]" -c:a aac -b:a 256k segs/audio.m4a </dev/null

# Concat video segments, then mux with audio
printf "file 'a.mp4'\nfile 'b.mp4'\n" > segs/concat.txt  
ffmpeg -y -v error -f concat -safe 0 -i segs/concat.txt -c copy segs/video.mp4 </dev/null  
ffmpeg -y -v error -i segs/video.mp4 -i segs/audio.m4a -map 0:v -map 1:a -c copy \  
  -movflags +faststart output.mp4 </dev/null

Adding a PNG overlay

If you need to fade in an image (a logo, a data readout, whatever) at a specific timestamp, replace the simple -vf line with a -filter_complex:

./avf_pipe "$CLIP" 0 $DUR 30 </dev/null 2>seg.log | \
  enc seg.mp4 -loop 1 -i overlay.png -filter_complex \
    "[0:v]lut1d=file=$LUT,format=rgb24[base];\
     [1:v]scale=1000:800,format=rgba,fade=t=in:st=240:d=0.6:alpha=1[ov];\
     [base][ov]overlay=60:60:enable='gte(t,240)':eof_action=pass,format=yuv420p" -shortest

Filtergraph gotchas:

  • lut1d=/path.cube[label] glues the label onto the filename. Write lut1d=file=/path.cube,format=rgb24[label] instead.
  • -loop 1 on a PNG input never ends. Pass -shortest or the encode runs forever after the video pipe closes.
  • The overlay fade needs alpha=1 on the fade filter, and enable='gte(t,START)' on overlay, so the PNG is not drawn before its fade-in.
  • eof_action=pass keeps the base video going if the overlay input ends first.

Indexing a new card

Before cutting anything, build a clip map. Audio extraction and single-frame screenshots work fine through ffmpeg. The green cast on the screenshots is expected - it is the raw ffmpeg preview with no DJI color science, good enough for identifying content.

SRC=/Volumes/DJI/your-card-folder  
mkdir -p audio screenshots transcripts  
for f in "$SRC"/*.MOV; do  
  base=$(basename "$f" | cut -c1-9)
  dur=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$f")
  # 16 kHz mono WAV for whisper
  ffmpeg -y -v error -i "$f" -vn -ac 1 -ar 16000 -c:a pcm_s16le "audio/$base.wav" </dev/null
  # 5 frames at 5/25/50/75/95 percent
  for p in 5 25 50 75 95; do
    t=$(python3 -c "print($dur*$p/100)")
    ffmpeg -y -v error -ss "$t" -i "$f" -frames:v 1 -vf scale=1920:-2 \
      "screenshots/$base-p$p.jpg" </dev/null
  done
  # Transcribe with whisper - let it auto-detect language
  whisper "audio/$base.wav" --model small --device cpu \
    --output_dir transcripts --output_format txt </dev/null
done  

Do not force whisper's language flag. Auto-detect catches mixed-language footage that a hardcoded --language English will silently mistranscribe.

Write the results into a simple INDEX.md with clip name, resolution, duration, file size, and a one-line content description. Three months later when someone asks "which take was the good one," you will be glad you did.

Card hygiene

  • Never write to the card. Every script reads from /Volumes/DJI and writes elsewhere. After a build, verify the source files are byte-for-byte untouched.
  • Finder deletes are fake. Deleting files from the card in Finder moves them into a hidden .Trashes folder on the card itself. No space is actually freed until you empty the Trash with the card still mounted. exFAT needs no reformat or camera-side cleanup after that - the Ronin sees the space on the next mount.
  • Leave the camera's system folders alone. Index, thumbnail, and sensor database directories are the camera's own bookkeeping.

When to use Resolve instead

DaVinci Resolve has native Ronin 4D ProRes RAW support with proper DJI color science. For client deliverables, HDR, or anything where highlight roll-off and color accuracy really matter, that is the right tool. Everything above is for when you need a fast, scriptable, resumable build on whatever Mac you have handy, and QuickTime-equivalent color is good enough.