AniDocSampler
The node that actually does the colorizing — everything else in this pack is feeding it
- anidoc_pipeline
- controlnet_images
- reference_image
- cotracker
- video_frames
AniDocSampler is where the magic - and the waiting - happens. Everything else in the ComfyUI-AniDoc pack is prep work for this one node. LoadAniDoc hands it the pipeline, GetAniDocControlnetImages hands it the lineart condition, and you hand it a colored reference image. It runs the diffusion pass and returns your colorized video_frames, ready to be saved with VideoHelperSuite's VHS VideoCombine.
What it does under the hood
The mechanism is clever and worth understanding, because it explains why this thing costs so much VRAM. AniDoc doesn't just feed the lineart into a ControlNet and hope. It runs a SuperPoint keypoint extractor and a LightGlue matcher to find correspondences between your reference image and the first lineart frame, then builds "point maps" - spatial masks that tell the model which reference pixels map to which lineart pixels. Those point maps, plus the reference image itself, get concatenated into the ControlNet conditioning alongside your lineart. The reference is resized to match your lineart resolution before all this.
If you wired in a LoadCoTracker node, the tracker follows those matched points across every frame first, so the reference anchoring stays temporally consistent instead of only being anchored to frame 0. Without it, the sampler falls back to single-frame matching (or, with repeat_matching on, just repeats that one match).
Then the pipeline runs SVD img2vid-style inference for as many frames as you fed lineart frames. That last part matters: the number of output frames equals the number of lineart images you put in - there's no interpolation or frame-count parameter. The README says the model natively expects 14 frames, but the authors found it works well up to ~72.
The inputs that matter
- reference_image - your colored character art. This is the palette donor, so make it clean and on-model; what it lacks, the output lacks.
- controlnet_images - the
IMAGEbatch from GetAniDocControlnetImages. - cotracker (optional) - the
ANIDOC_COTRACKERobject from LoadCoTracker, if you're tracking. - steps (default 25) - diffusion steps; standard curve, more isn't always better.
- noise_aug (default 0.02) - SVD's img2vid denoise strength. Keep it low for faithful lineart colorization; raise it if the output looks flat or pasted-on, but the lines will start to bend.
- motion_bucket_id (default 127, max 300) - SVD's native motion-intensity dial. Higher = more aggressive motion in the result. 127 is mid-to-high.
- fps (7–100, default 7) - the assumed framerate; it feeds into the temporal encoding, not the actual output speed. Set it to match the source video's fps.
- seed - reproducibility. Change it when you want a different take on the same frames.
- decode_chunk_size (default 8) - the VRAM lever. If you're hitting out-of-memory on decode, drop this to 4 or 2.
- repeat_matching - cheap mode: repeats the single reference match across all frames instead of per-frame matching. Fast and light, visibly less temporally consistent.
Wiring it up
LoadImage (colored reference) ──► AniDocSampler.reference_image
GetAniDocControlnetImages ────────► AniDocSampler.controlnet_images
AniDocLoader ─────────────────────► AniDocSampler.anidoc_pipeline
LoadCoTracker (optional) ─────────► AniDocSampler.cotracker
AniDocSampler.video_frames ───────► VHS VideoCombine (to save)
Gotchas
- First run is brutal. You're running a full SVD-class pipeline in fp16; between the model load and the sampler's keypoint matching, expect a long queue and a warm room.
- Lineart quality is the real bottleneck, not the sampler. The original AniDoc release thread is full of people discovering that their own lineart extracts badly and the colorization follows - clean, consistent lineart beats every sampler parameter here.
- Reference resolution: your reference is resized to match the controlnet images, so feeding a tiny reference doesn't buy you speed, just loss.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| anidoc_pipeline | ANIDOC_PIPELINE | — | |
| controlnet_images | IMAGE | — | |
| reference_image | IMAGE | — | |
| repeat_matching | BOOLEAN | false | — |
| fps | INT | 77–100 | — |
| steps | INT | 251–10000 | — |
| noise_aug | FLOAT | 0.020–10 | — |
| seed | INT | 00–18446744073709550000 | — |
| motion_bucket_id | INT | 1271–300 | — |
| decode_chunk_size | INT | 81–256 | — |
| cotrackeropt | ANIDOC_COTRACKER | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| video_frames | IMAGE | Video Frames |