Nodes/KJNodes for ComfyUI/Latent Inpaint TTM
ComfyUI Node Runs on cloud

Latent Inpaint TTM

Turn a rough cut-and-drag edit into believable motion

By kijai·Created 3 years ago·Updated a day ago· 3,011
Latent Inpaint TTM
  • model
  • mask
  • MODEL
steps7

The node's own description is just a link - github.com/time-to-move/TTM - and that link points at one of the techniques that genuinely surprised r/StableDiffusion this year. Latent Inpaint TTM is Kijai's implementation of Time-to-Move: patch your model with it, feed in a crude motion edit, and it cleans that rough edit up into motion that actually looks physically plausible.

What Time-to-Move actually is

The technique starts from a deliberately crude video: you take a still (or a driving clip) and manually move an object around in it - cut it out, drag it to where you want it to end up, done badly on purpose, no attention to realism. TTM then uses that rough edit as guidance rather than as a finished input: during the early denoising steps, the model is steered by the crude motion so it respects the rough trajectory, then it's left to sample freely for the rest, filling in physically correct detail - shadows shifting, limbs bending naturally, the object interacting with its surroundings the way it actually would. The community reaction on release was blunt: people ran side-by-sides and dared others to tell which clip was the AI generation. This same technique is what Kijai also ships as a Wan-specific node inside ComfyUI-WanVideoWrapper - this KJNodes version applies the same idea as a general model patch.

The rough "cut and move it" input video is exactly what a sibling node in this same pack, CutAndDragOnPath, is built to produce - cutting a masked object out of an image and dragging it along a path, right inside ComfyUI, instead of doing that step in After Effects like the earliest TTM demos did.

The inputs and outputs that matter

  • model (MODEL) in, patched model (MODEL) out - wire it into your sampling chain like any other model-patching node.
  • steps (default 7, range 0–888) - how many of the early denoising steps get anchored to your crude motion edit before the model is left to sample freely. This is the guidance-strength knob in disguise: more anchored steps means the output sticks closer to your rough edit's exact positioning; fewer gives the model more freedom to reinterpret and can produce smoother results if your crude edit was rough enough to fight the model.
  • mask (optional, MASK) - constrains where the TTM guidance applies, so you can limit the effect to just the region you actually moved rather than influencing the whole frame. Pairs naturally with the mask output from CutAndDragOnPath, which tracks exactly where the moved object sits per frame.

Installing it

Ships with the pack:

  • ComfyUI Manager - search KJNodes for ComfyUI, install, restart.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, then pip install -r ComfyUI-KJNodes/requirements.txt, restart.

You'll still need whatever video model you're driving with it (Wan being the model this technique made its name on) - this node patches that model, it doesn't replace it.

Common issues & troubleshooting

It's filed under KJNodes/experimental, and the node's own docs are just a link. Take that seriously - this is a fresh implementation of a technique that only recently made it into the ecosystem at all, not a mature, extensively-tuned node. Expect to experiment rather than expect a settled "best settings" answer.

Output doesn't respect my crude edit's positioning at all. Raise steps - too few anchored steps and the model has enough freedom to essentially ignore your rough motion and generate something closer to its own default behavior instead.

Output looks too rigid, or drags visible artifacts from the crude cut-and-drag edit into the final result. That's the opposite problem - too many anchored steps holding too tightly to an intentionally rough input. Bring steps down so the model gets more room to smooth things over, and check whether a mask would help by keeping the guidance confined to just the moved region instead of the whole frame.

Confusing this with the plain "inpaint the vacated background" step. That's a separate concern, handled upstream - TELEA-based inpainting (as used in CutAndDragOnPath) fills the hole left by the cutout; this node is about making the motion believable, not about patching the background hole.

CategoryKJNodes/experimental

Inputs (3)

NameTypeDefaultDescription
modelMODEL
stepsINT70–888Number of steps to apply TTM inpainting for.
maskoptMASKLatent mask where white (1.0) is the area to inpaint and black (0.0) is the area to keep unchanged.

Outputs (1)

NameTypeDescription
MODELMODEL