Anime video censoring in ComfyUI
Apply mosaic to detected intimate regions in short 2D anime videos. This download includes a file-picker workflow for one video and a folder workflow for batch processing. Audio is preserved, and results are saved separately from the originals.
This workflow is intended for 2D anime videos. For real-person / live-action videos, try replacing the anime NTD11 model with a compatible NTD11 segmentation model suitable for that footage, and test the results yourself. Live-action results have not been validated. The replacement model must provide segmentation masks, and target_classes must match its labels.
Designed around short clips, usually about 10 seconds and under 30 seconds. It uses segmentation masks, a fixed mosaic grid, and short-gap tracking to reduce flicker. Extra checks help recover male targets after occlusion. Automatic detection can still miss targets or cover the wrong region, so review the finished video before sharing it.
Install the required nodes and model
Install or update MoonNe_Nodes in ComfyUI Manager. Search for
MoonNe_Nodes(MoonNe), install/update it, then restart ComfyUI and refresh your browser. Repository: Moon-NE/MoonNe_Nodes.Install ComfyUI Impact Subpack through Manager. It provides
UltralyticsDetectorProvider.Place
ntd11_anime_nsfw_segm_v4_all.ptinComfyUI/models/ultralytics/segm/. Restart or refresh the model list, then selectsegm/ntd11_anime_nsfw_segm_v4_all.ptin the detector node. Model weights are not included.Install FFmpeg as described below. Detection requires an NVIDIA GPU with a working CUDA-enabled PyTorch installation in ComfyUI. CPU-only detection is not supported by this version.
If dependencies are missing, use the Python environment that runs ComfyUI. From the ComfyUI directory:
python -m pip install -r custom_nodes/MoonNe_Nodes/requirements.txtFor Windows portable, run this from the folder containing python_embeded:
python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\MoonNe_Nodes\requirements.txtInstall FFmpeg on Windows
Option A: WinGet. Open PowerShell or Windows Terminal and run:
winget install --id Gyan.FFmpeg --exactOption B: manual installation. Open the FFmpeg download page, choose Windows, and follow the link to Gyan's builds. Download a release ZIP and extract it. For example, arrange the files so that C:\ffmpeg\bin\ffmpeg.exe exists.
Search Windows for Edit environment variables for your account.
Under User variables, select Path > Edit > New, add
C:\ffmpeg\bin(or your actual bin folder), and save. Add the folder, not the exe file. Keep the existing Path entries.Close and reopen your terminal and fully restart ComfyUI, including its launcher. In the new terminal, check:
ffmpeg -version
where.exe ffmpegThe first command should print version information; the second should show the executable location. If the command is still not found, check the bin path and restart the launcher. For NVENC encoding, the FFmpeg build must include h264_nvenc and the NVIDIA driver must support it. If encoding fails, set encoder to libx264; detection still needs CUDA.
For other operating systems, install FFmpeg through your system package manager and make sure ffmpeg -version works in the environment used to start ComfyUI. The CUDA requirement still applies.
Use one video
Extract the download and drag
MoonNe_NTD11_Video_File.jsoninto ComfyUI.Check the selected segmentation model in Load NTD11 Segmentation Model. The workflow uses its
BBOX_DETECTORoutput; the loaded model must still be a segmentation model.On NTD11 Video File, click Choose video file.... Wait until the filename appears.
Set
output_folderif needed, keep the other defaults for the first test, and click Run.
The picker copies the selected file to ComfyUI/input/ntd11_videos. By default, results go to a new run folder under ComfyUI/output/ntd11_mosaic. Relative paths assume ComfyUI starts from its own directory; use absolute paths if your launcher uses a different working directory.
Process a folder
Drag
MoonNe_NTD11_Folder_Batch.jsoninto ComfyUI.Set
input_folderto your video folder and choose a separateoutput_folder.Leave
file_patternas*for all supported videos, or use patterns such as*.mp4;*.webm. Enablerecursiveto include subfolders.Check the detector model and click Run.
Supported inputs: MP4, MKV, WebM, MOV, M4V and AVI. Output: MP4 with audio preserved, plus processing reports. A needs_review report means some intervals need checking, not that the job failed. If the entire clip has no detections, the node writes a report without exporting a video.
Processing time
One local test took about 33 seconds to process a 20-second video (640 x 640, 24 fps, 481 frames, audio included) on an NVIDIA GeForce RTX 5090 / Intel Core Ultra 9 285K PC, using the supplied settings and NVENC output. This is a single measured example, not a speed guarantee or a comparison across GPUs.
For similar footage and settings on the same machine, a rough linear estimate is about 16-17 seconds for a 10-second clip or 50 seconds for a 30-second clip. These two figures are estimates, not separate tests. Initial model loading, video resolution and frame rate, available VRAM, the number of uncertain frames and recovery passes, and encoding all affect the actual time. First-run setup and model downloads are not included. For batch jobs, time one representative clip and multiply by the number of similar clips.
Parameters
The defaults below are already set in both workflows. Change one setting at a time and check a short result.
Files and detection
input_folder(batch only): folder containing your videos.output_folder: destination for new run folders; defaultoutput/ntd11_mosaic.file_pattern/recursive(batch only): filename filter and whether to search subfolders. Defaults:*/ off.target_classes=pussy,penis,testicles: comma-separated model labels to censor. Addanusornipplesif needed and supported by the model.detect_size= 640: detection resolution. Larger values can help with small details but cost more time and memory.batch_size= 16: frames processed together. Lower to 8 or 4 if VRAM runs out; larger batches are not always faster.confidence= 0.60: confirmation threshold for a track. Raising it reduces some false positives but can increase misses.tracking_confidence= 0.30: lower-confidence detections can extend a target that has already been confirmed.retry_uncertain= on /retry_size= 960: recheck uncertain frames at a higher resolution. Disabling the retry saves time but may miss more targets.min_track_frames= 2: minimum detection count to confirm a target. Setting 1 can catch brief appearances but also keeps more isolated false positives.
Mosaic shape and temporal stability
block_pixels= 16: mosaic block size in source pixels. Larger values produce coarser blocks; the grid stays fixed to reduce flicker.padding_percent= 3 /padding_pixels= 2: expand mask edges. Increase slightly if edges remain visible; excessive padding covers unrelated areas.bridge_ms= 400: maximum short detection gap to bridge between confirmed masks.hold_ms= 42: brief mask hold around detection gaps, in milliseconds.smooth_radius= 1: neighbouring-frame radius used to smooth masks. More smoothing can leave longer trails.scene_threshold= 0.30: scene-change sensitivity. Scene cuts reset temporal propagation. Start with the default.
Male target recovery
male_recheck= on: extra checks at 320 and 416 pixels, with motion tracking between detections. Keep this on for brief or partly hidden male targets.male_confidence= 0.80: male target confirmation score. Brief single-frame detections scoring at least 0.90 are also kept.male_flow_ms= 600: maximum gap for following a confirmed target with optical flow.male_hold_ms= 84: short hold when a male target disappears; about two frames at 24 fps.male_reacquire_ms= 6000: how long to look for a target returning near its last confirmed position in the same shot. Set 0 to disable.male_reacquire_confidence= 0.50: score for reappearance near a confirmed position. At least two candidate frames are required.
Encoding
encoder=h264_nvenc: NVIDIA hardware encoding. Uselibx264for CPU encoding if NVENC fails; this does not enable CPU-only detection.quality= 18: CQ for NVENC or CRF for x264. Lower values give better quality and larger files.
Quick adjustments
Missed edges: slightly increase padding.
Misses after occlusion: keep
male_recheckon; check the recovery settings before lowering all confidence thresholds.Too much unwanted mosaic: confirm the selected model and class labels, then raise the relevant confidence threshold slightly. Avoid large padding or long hold times.
Flicker: start with the supplied bridge, hold and smoothing defaults. Longer holds can leave mosaic after the target moves away.
Need more speed: use NVENC and a batch size that fits your VRAM. Reducing detection resolution or disabling retries can be faster, but check for new misses.
Missing nodes or picker button: update MoonNe_Nodes and Impact Subpack, install dependencies in ComfyUI's Python, restart ComfyUI and refresh the browser.
This download contains two workflows and this guide. It does not include models, Python, FFmpeg or example videos. Source code and updates: MoonNe_Nodes on GitHub. The video processing module is AGPL-3.0-or-later; third-party models and dependencies retain their own licenses.
Description
Includes two English ComfyUI workflows: a video file picker and folder batch processing.
Segmentation-based mosaic with fixed blocks and temporal smoothing.
Additional male-target checks, motion tracking, and same-shot reacquisition after occlusion.
Separate output folders with audio preserved and processing reports.
English installation, FFmpeg setup, usage, and parameter guide included.
Install or update MoonNe_Nodes and ComfyUI Impact Subpack in Manager before importing. Requires the NTD11 anime segmentation weights, FFmpeg, and an NVIDIA CUDA GPU. Model weights are not included. Intended for 2D anime video; for live-action footage, replace the model with a compatible NTD11 segmentation model and test it yourself.
