批量视频人脸马赛克
Mosaic every video in a folder in one run
- output_directory
- processing_summary
The single-video mosaic nodes in this pack are fine, but the moment you have a folder of clips to clean up - say, a weekend's worth of meeting recordings - running them one at a time is a special kind of tedium. This node exists for exactly that: point it at a directory, and it walks the whole tree, mosaics every video it finds, and gives you a summary. Menu name: 批量视频人脸马赛克 (batch video face mosaic) under YZZ_Face_Mosaic.
How it works
Same Haar-cascade engine as the plain FaceMosaicNode - OpenCV's haarcascade_frontalface_default.xml, detectMultiScale per frame, then pixelate / blur / black_box over each face box. The batch logic is straightforward: os.walk through input_directory, match files against your file_extensions list, and process each one sequentially (no parallelism - it's one video at a time, CPU only). Every output lands in ComfyUI/output/batch_face_mosaic/ with a _mosaic suffix.
When it finishes you get two outputs: output_directory (the folder where results went) and processing_summary - a JSON string with per-video success/failure, total faces detected across the whole run, and the settings used. That summary is the node's quiet MVP: after a 40-file run you can see at a glance which files failed and why, without grepping console logs.
Inputs that matter
- input_directory - the folder to scan. It recurses into subfolders, which is handy if your clips are organized by date.
- file_extensions - comma-separated, default
mp4,avi,mov,mkv. Add your odd formats here; files that don't match are skipped silently. - detection_scale / min_neighbors - the Haar knobs, same trade-offs as the rest of the pack. On a batch you're locked into one setting for everything, so pick the value that works on your worst clip, not your best.
- mosaic_size, mosaic_type, output_format - the usual trio.
Installing it
Part of the yzz_face_mosaic pack, so: ComfyUI Manager → search yzz_face_mosaic, or
cd ComfyUI/custom_nodes
git clone https://github.com/yzzky/yzz_face_mosaic
pip install -r requirements.txt
Restart and it's under YZZ_Face_Mosaic. Pure OpenCV - no extra backends, no model downloads.
Where it bites
A batch multiplies every weakness of Haar by the number of files. Profile shots, odd lighting, or small faces that get missed in one clip are going to get missed in the whole folder, and the summary will cheerfully report success anyway because "processed" isn't "correctly mosaicked." Spot-check a few outputs. Also, if a directory has no matching files, the node returns an empty path and a Chinese "未找到视频文件" ("no video files found") summary - which reads as a bug if you don't know what it means. And be careful pointing it at a hot folder that's still receiving files mid-run; it grabs whatever's there at walk time.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| input_directory | STRING | — | |
| mosaic_size | INT | 205–100 | — |
| detection_scale | FLOAT | 1.101.01–2 | — |
| min_neighbors | INT | 51–20 | — |
| mosaic_type | COMBO | 3 options: pixelate, blur, black_box | |
| output_format | COMBO | 3 options: mp4, avi, mov | |
| file_extensions | STRING | mp4,avi,mov,mkv | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| output_directory | STRING | — |
| processing_summary | STRING | — |