π¦ Code: github.com/USER/video-redact (replace before publishing)
TL;DR
We'll turn per-frame face detections into padded, time-held blur regions and render them with a single FFmpeg filter graph. You get: no flicker on missed frames, audio copied untouched, one re-encode. Python 3.10+, mediapipe 0.10.x, FFmpeg 6+.
π― The problem
A face detector gives you one box per face per frame. Blur exactly those boxes and the blur flickers whenever the detector misses a frame, which is when someone turns their head. In a redaction pipeline, the flicker frame is the leak.
So we do three things to the raw detections:
Pad each box so the hairline and jaw are covered.
Hold each detection for N frames so a missed frame is bridged.
Merge overlapping boxes in space and time into one wider region.
Then we render with FFmpeg: crop, blur, overlay, enabled only during each region's time window.
β οΈ Note: The detection step below was not run on real faces by me (no face footage or model download in my test environment).β¦