video-face-anonymizer

video-face-anonymizer

Video face anonymizing Skill

Description

Street footage, vlogs and meeting recordings often need bystanders' and colleagues' faces hidden before they go out. Doing it by hand in an editor means dragging a mosaic box along frame by frame, and the moment someone turns their head the face slips out. video-face-anonymizer is a Skill for AI agents: hand it a video and it finds every face and follows it through the whole clip, covering it with mosaic, blur or a solid black box while keeping the audio intact.

It does more than per-frame detection. Face boxes are smoothed over time so the mask doesn't jitter when the camera shakes, and when a face is missed for a few frames the mask stays put for a while, so a quick turn or a glance down doesn't expose anyone. The output is always an H.264 + yuv420p MP4 that plays in Telegram and common players.

Features



Two detectors: InsightFace SCRFD by default, which handles distant small faces, side profiles, low light and crowds better but is slower on CPU; switch to YuNet for well-lit close and medium shots when speed matters.

Three masking styles: --mode mosaic (default), blur and black. Use black for sensitive material — mosaic and blur are visual obfuscation, not irreversible anonymization.

Smoothed tracking: Boxes are matched across frames by IoU and blended over time; --smooth sets how steady the mask follows.

Hold on misses: --hold keeps a mask in place for a set number of frames after a face drops out, covering brief turns and occlusions.

Tunable detection: Raise --det-size to catch smaller, farther faces, increase --margin to cover face edges, and adjust --score for detection confidence.

Audio and compatibility: FFmpeg muxes the original audio back in and encodes H.264, yuv420p with faststart so the file streams in a browser.

Built-in validation: The Skill tells the agent to check codec and audio with ffprobe and compare at least six timestamps — start, middle, end, side profiles, nearest and farthest faces — before delivering, and to reject the result if any face is still recognizable.

Setup: pip install opencv-python numpy insightface onnxruntime plus ffmpeg on the system; YuNet-only use needs just opencv-python and numpy. SCRFD downloads the roughly 275 MB buffalo_l model on first use. Run it with python scripts/face_mosaic.py input.mp4 output.mp4.