Video Face Blurring
Automatically detects, tracks and obscures faces in video, keeping the original motion and sound, and outputs an MP4 compatible with Telegram and common players. Everything runs locally; no video is uploaded.
What It Does
- Automatically detects and tracks faces in the frame, masking them frame by frame.
- Three mask types: mosaic (default), blur, and solid black mask (strongest privacy protection).
- Preserves the original video's motion and audio.
- Outputs H.264 + yuv420p for good compatibility.
Two Detection Modes
- SCRFD (default): suited to distant, small, profile, low-light and multi-person frames; more accurate, but slower on CPU.
- YuNet: suited to well-lit close-up or medium shots; faster.
Installation
pip install opencv-python numpy insightface onnxruntime
You also need to install ffmpeg. The core of this skill is the author-provided script scripts/face_mosaic.py; run it as is, and do not write your own version.
Basic Usage
python scripts/face_mosaic.py input.mp4 output.mp4
Common Options
--mode mosaic: mosaic (default)--mode blur: blur--mode black: solid black mask, strongest privacy protection--detector yunet: switch to fast detection--det-size 1600: improve detection of small distant faces--score: detection confidence threshold--margin: enlarge the mask area--hold: keep the mask in place during brief missed detections
Notes
- The first use of SCRFD automatically downloads the InsightFace
buffalo_lmodel, about 275 MB. - Very small, heavily blurred or fully occluded faces may still go undetected.
- For high-privacy scenarios, use
--mode black: mosaic and blur are only visual obscuring, not irreversible anonymization. Leave 20%–35% margin around the mask boxes. - Always spot-check before delivery: at the beginning, middle and end, and in profile, varying-distance, occluded and transition shots, check at least six time points. If any recognizable face remains, redo it.
Source
This skill was packaged by the user. The author's script uses open-source components: InsightFace SCRFD / buffalo_l for detection, OpenCV Zoo's YuNet for fast detection, OpenCV for frame processing, and FFmpeg/libx264 for encoding. Please verify the blurred output yourself; the tool does not guarantee that it catches 100% of faces.

Comments (0)
No comments yet. Start the conversation.