Nodes/ComfyUI-AniDoc/AniDocSampler
ComfyUI Node

AniDocSampler

The node that actually does the colorizing — everything else in this pack is feeding it

By LucipherDev·Created 2 years ago·Updated about a year ago· 56
AniDocSampler
  • anidoc_pipeline
  • controlnet_images
  • reference_image
  • cotracker
  • video_frames
repeat_matchingfalse
fps7
steps25
noise_aug0.02
seed0
motion_bucket_id127
decode_chunk_size8

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 IMAGE batch from GetAniDocControlnetImages.
  • cotracker (optional) - the ANIDOC_COTRACKER object 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.
CategoryAniDoc

Inputs (11)

NameTypeDefaultDescription
anidoc_pipelineANIDOC_PIPELINE
controlnet_imagesIMAGE
reference_imageIMAGE
repeat_matchingBOOLEANfalse
fpsINT77–100
stepsINT251–10000
noise_augFLOAT0.020–10
seedINT00–18446744073709550000
motion_bucket_idINT1271–300
decode_chunk_sizeINT81–256
cotrackeroptANIDOC_COTRACKER

Outputs (1)

NameTypeDescription
video_framesIMAGEVideo Frames