Wan2.1 ATI
Trajectory-controlled Video Generation.
About
This ComfyUI workflow generates short, prompt-driven videos from a single image while precisely following a user-defined camera or subject path. It uses the Wan 2.1 I2V ATI model to blend text guidance, a reference image, and a trajectory JSON so the camera move or object motion is not left to chance. Core nodes include UNETLoader (Wan2_1-I2V-ATI-14B_fp8_e4m3fn.safetensors) and VAELoader (wan_2.1_vae.safetensors) for the diffusion backbone, CLIPLoader and CLIPTextEncode for prompt conditioning, CLIPVisionLoader and CLIPVisionEncode for image conditioning, and WanTrackToVideo to apply trajectory control.
KSampler (driven by ModelSamplingSD3) performs the denoising, VAEDecode turns latents into frames, and CreateVideo + SaveVideo packages the result.
Technically, the workflow encodes your positive/negative prompts via CLIPTextEncode and extracts vision features from the input image with CLIPVisionEncode. The PrimitiveStringMultiline node holds the trajectory JSON exported from the Trajectory-Annotation-Tool; WanTrackToVideo consumes that JSON and injects per-frame motion control into the sampling process. ModelSamplingSD3 configures the scheduler so KSampler denoises in a way compatible with Wan 2.1’s training setup.
After sampling, VAEDecode reconstructs frames, and CreateVideo assembles them at your chosen resolution and FPS. On a 4090D 24GB at 720x480, expect roughly 500 seconds on a cold first run and around 463 seconds on subsequent runs once weights are cached (actual times vary with settings).
What you provide
- Reading the workflow
Runs in ComfyUI. This workflow can't run on this page. Open it in Comfy Cloud with everything loaded, or download it for your own ComfyUI.
Try in CloudInside the workflow
A read-only preview of the node graph. Open it in Comfy Cloud or download it to edit the nodes.
Loading the graph
Open full-size workflow preview- Author
- ComfyUI
Requires custom nodes
- Reading the workflow
Use this workflow from code
Generated from the workflow graph and inputs when possible; stored examples are shown otherwise. Review credentials and endpoints before running code, which may incur charges.
What you need
- Runs on
- Comfy Cloud
- Key
- COMFY_API_KEY
Needs a paid Cloud plan and credits.
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"3": {
"class_type": "KSampler",
"inputs": {
"cfg": 3,
"denoise": 1,
"latent_image": [
"248",
2
],
"model": [
"48",
0
],
"negative": [
"248",
1
],
"positive": [
"248",
0
],
"sampler_name": "uni_pc",
"scheduler": "simple",
"seed": 48,
"steps": 20
},
"_meta": {
"title": "KSampler"
}
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"38",
0
],
"text": "The white dragon warrior stands still, eyes full of determination and strength. The camera slowly moves closer or circles around the warrior, highlighting the powerful presence and heroic spirit of the character."
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"7": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"38",
0
],
"text": "过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走,过曝,"
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"3",
0
],
"vae": [
"39",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"38": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
"device": "default",
"type": "wan"
},
"_meta": {
"title": "Load CLIP"
}
},
"39": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "wan_2.1_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"48": {
"class_type": "ModelSamplingSD3",
"inputs": {
"model": [
"140",
0
],
"shift": 8.000000000000002
},
"_meta": {
"title": "ModelSamplingSD3"
}
},
"140": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "Wan2_1-I2V-ATI-14B_fp8_e4m3fn.safetensors",
"weight_dtype": "fp8_e4m3fn"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"240": {
"class_type": "LoadImage",
"inputs": {
"image": "video_wan_ati_input_image.jpg"
},
"_meta": {
"title": "Load Image"
}
},
"244": {
"class_type": "CLIPVisionLoader",
"inputs": {
"clip_name": "clip_vision_h.safetensors"
},
"_meta": {
"title": "Load CLIP Vision"
}
},
"247": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "[\n [\n {\n \"x\": 393,\n \"y\": 126\n },\n {\n \"x\": 393,\n \"y\": 126\n },\n {\n \"x\": 393,\n \"y\": 126\n },\n {\n \"x\": 393,\n \"y\": 125\n },\n {\n \"x\": 388,\n \"y\": 123\n },\n {\n \"x\": 380,\n \"y\": 123\n },\n {\n \"x\": 372,\n \"y\": 122\n },\n {\n \"x\": 338,\n \"y\": 122\n },\n {\n \"x\": 312,\n \"y\": 121\n },\n {\n \"x\": 294,\n \"y\": 121\n },\n {\n \"x\": 281,\n \"y\": 122\n },\n {\n \"x\": 263,\n \"y\": 123\n },\n {\n \"x\": 254,\n \"y\": 125\n },\n {\n \"x\": 245,\n \"y\": 126\n },\n {\n \"x\": 241,\n \"y\": 127\n },\n {\n \"x\": 240,\n \"y\": 127\n },\n {\n \"x\": 240,\n \"y\": 128\n },\n {\n \"x\": 239,\n \"y\": 128\n },\n {\n \"x\": 238,\n \"y\": 130\n },\n {\n \"x\": 236,\n \"y\": 131\n },\n {\n \"x\": 233,\n \"y\": 133\n },\n {\n \"x\": 230,\n \"y\": 135\n },\n {\n \"x\": 226,\n \"y\": 137\n },\n {\n \"x\": 226,\n \"y\": 137\n },\n {\n \"x\": 226,\n \"y\": 137\n },\n {\n \"x\": 226,\n \"y\": 138\n },\n {\n \"x\": 226,\n \"y\": 138\n },\n {\n \"x\": 226,\n \"y\": 138\n },\n {\n \"x\": 226,\n \"y\": 139\n },\n {\n \"x\": 226,\n \"y\": 139\n },\n {\n \"x\": 226,\n \"y\": 141\n },\n {\n \"x\": 226,\n \"y\": 142\n },\n {\n \"x\": 226,\n \"y\": 142\n },\n {\n \"x\": 228,\n \"y\": 143\n },\n {\n \"x\": 229,\n \"y\": 143\n },\n {\n \"x\": 230,\n \"y\": 144\n },\n {\n \"x\": 232,\n \"y\": 145\n },\n {\n \"x\": 237,\n \"y\": 146\n },\n {\n \"x\": 238,\n \"y\": 146\n },\n {\n \"x\": 246,\n \"y\": 147\n },\n {\n \"x\": 252,\n \"y\": 149\n },\n {\n \"x\": 260,\n \"y\": 150\n },\n {\n \"x\": 262,\n \"y\": 150\n },\n {\n \"x\": 265,\n \"y\": 150\n },\n {\n \"x\": 271,\n \"y\": 151\n },\n {\n \"x\": 276,\n \"y\": 151\n },\n {\n \"x\": 278,\n \"y\": 151\n },\n {\n \"x\": 281,\n \"y\": 151\n },\n {\n \"x\": 286,\n \"y\": 152\n },\n {\n \"x\": 289,\n \"y\": 152\n },\n {\n \"x\": 292,\n \"y\": 152\n },\n {\n \"x\": 296,\n \"y\": 152\n },\n {\n \"x\": 299,\n \"y\": 152\n },\n {\n \"x\": 307,\n \"y\": 153\n },\n {\n \"x\": 311,\n \"y\": 153\n },\n {\n \"x\": 315,\n \"y\": 154\n },\n {\n \"x\": 317,\n \"y\": 154\n },\n {\n \"x\": 320,\n \"y\": 155\n },\n {\n \"x\": 324,\n \"y\": 155\n },\n {\n \"x\": 326,\n \"y\": 157\n },\n {\n \"x\": 327,\n \"y\": 157\n },\n {\n \"x\": 328,\n \"y\": 157\n },\n {\n \"x\": 331,\n \"y\": 158\n },\n {\n \"x\": 332,\n \"y\": 158\n },\n {\n \"x\": 333,\n \"y\": 158\n },\n {\n \"x\": 335,\n \"y\": 159\n },\n {\n \"x\": 340,\n \"y\": 159\n },\n {\n \"x\": 345,\n \"y\": 160\n },\n {\n \"x\": 353,\n \"y\": 161\n },\n {\n \"x\": 357,\n \"y\": 162\n },\n {\n \"x\": 362,\n \"y\": 163\n },\n {\n \"x\": 367,\n \"y\": 165\n },\n {\n \"x\": 369,\n \"y\": 165\n },\n {\n \"x\": 372,\n \"y\": 166\n },\n {\n \"x\": 375,\n \"y\": 166\n },\n {\n \"x\": 378,\n \"y\": 166\n },\n {\n \"x\": 379,\n \"y\": 167\n },\n {\n \"x\": 381,\n \"y\": 167\n },\n {\n \"x\": 384,\n \"y\": 167\n },\n {\n \"x\": 387,\n \"y\": 168\n },\n {\n \"x\": 392,\n \"y\": 169\n },\n {\n \"x\": 400,\n \"y\": 170\n },\n {\n \"x\": 405,\n \"y\": 170\n },\n {\n \"x\": 410,\n \"y\": 170\n },\n {\n \"x\": 417,\n \"y\": 171\n },\n {\n \"x\": 425,\n \"y\": 174\n },\n {\n \"x\": 434,\n \"y\": 174\n },\n {\n \"x\": 441,\n \"y\": 175\n },\n {\n \"x\": 448,\n \"y\": 175\n },\n {\n \"x\": 456,\n \"y\": 176\n },\n {\n \"x\": 465,\n \"y\": 177\n },\n {\n \"x\": 472,\n \"y\": 177\n },\n {\n \"x\": 479,\n \"y\": 177\n },\n {\n \"x\": 484,\n \"y\": 177\n },\n {\n \"x\": 491,\n \"y\": 178\n },\n {\n \"x\": 498,\n \"y\": 179\n },\n {\n \"x\": 502,\n \"y\": 179\n },\n {\n \"x\": 505,\n \"y\": 179\n },\n {\n \"x\": 514,\n \"y\": 179\n },\n {\n \"x\": 520,\n \"y\": 179\n },\n {\n \"x\": 523,\n \"y\": 181\n },\n {\n \"x\": 530,\n \"y\": 181\n },\n {\n \"x\": 537,\n \"y\": 182\n },\n {\n \"x\": 544,\n \"y\": 183\n },\n {\n \"x\": 551,\n \"y\": 183\n },\n {\n \"x\": 554,\n \"y\": 183\n },\n {\n \"x\": 561,\n \"y\": 184\n },\n {\n \"x\": 569,\n \"y\": 185\n },\n {\n \"x\": 577,\n \"y\": 186\n },\n {\n \"x\": 581,\n \"y\": 186\n },\n {\n \"x\": 586,\n \"y\": 186\n },\n {\n \"x\": 590,\n \"y\": 187\n },\n {\n \"x\": 596,\n \"y\": 187\n },\n {\n \"x\": 600,\n \"y\": 189\n },\n {\n \"x\": 602,\n \"y\": 189\n },\n {\n \"x\": 607,\n \"y\": 189\n },\n {\n \"x\": 612,\n \"y\": 190\n },\n {\n \"x\": 614,\n \"y\": 190\n },\n {\n \"x\": 616,\n \"y\": 190\n },\n {\n \"x\": 617,\n \"y\": 190\n },\n {\n \"x\": 617,\n \"y\": 190\n },\n {\n \"x\": 619,\n \"y\": 191\n },\n {\n \"x\": 619,\n \"y\": 191\n },\n {\n \"x\": 620,\n \"y\": 191\n },\n {\n \"x\": 620,\n \"y\": 191\n },\n {\n \"x\": 621,\n \"y\": 191\n },\n {\n \"x\": 623,\n \"y\": 191\n },\n {\n \"x\": 624,\n \"y\": 191\n },\n {\n \"x\": 625,\n \"y\": 191\n },\n {\n \"x\": 625,\n \"y\": 192\n },\n {\n \"x\": 625,\n \"y\": 192\n },\n {\n \"x\": 625,\n \"y\": 192\n },\n {\n \"x\": 628,\n \"y\": 197\n },\n {\n \"x\": 628,\n \"y\": 199\n },\n {\n \"x\": 629,\n \"y\": 200\n },\n {\n \"x\": 629,\n \"y\": 201\n },\n {\n \"x\": 629,\n \"y\": 202\n },\n {\n \"x\": 629,\n \"y\": 202\n },\n {\n \"x\": 629,\n \"y\": 203\n },\n {\n \"x\": 629,\n \"y\": 203\n },\n {\n \"x\": 629,\n \"y\": 203\n },\n {\n \"x\": 629,\n \"y\": 203\n },\n {\n \"x\": 629,\n \"y\": 203\n },\n {\n \"x\": 630,\n \"y\": 205\n },\n {\n \"x\": 630,\n \"y\": 205\n },\n {\n \"x\": 630,\n \"y\": 206\n },\n {\n \"x\": 630,\n \"y\": 207\n },\n {\n \"x\": 630,\n \"y\": 207\n },\n {\n \"x\": 630,\n \"y\": 208\n },\n {\n \"x\": 630,\n \"y\": 208\n },\n {\n \"x\": 631,\n \"y\": 211\n },\n {\n \"x\": 631,\n \"y\": 211\n },\n {\n \"x\": 631,\n \"y\": 213\n },\n {\n \"x\": 631,\n \"y\": 215\n },\n {\n \"x\": 632,\n \"y\": 215\n },\n {\n \"x\": 632,\n \"y\": 216\n },\n {\n \"x\": 632,\n \"y\": 216\n },\n {\n \"x\": 632,\n \"y\": 216\n },\n {\n \"x\": 632,\n \"y\": 217\n },\n {\n \"x\": 632,\n \"y\": 217\n },\n {\n \"x\": 632,\n \"y\": 218\n },\n {\n \"x\": 632,\n \"y\": 218\n }\n ]\n]"
},
"_meta": {
"title": "Trajectory JSON"
}
},
"248": {
"class_type": "WanTrackToVideo",
"inputs": {
"batch_size": 1,
"clip_vision_output": [
"251",
0
],
"height": 480,
"length": 81,
"negative": [
"7",
0
],
"positive": [
"6",
0
],
"start_image": [
"240",
0
],
"temperature": 220,
"topk": 10,
"tracks": [
"247",
0
],
"vae": [
"39",
0
],
"width": 720
},
"_meta": {
"title": "WanTrackToVideo"
}
},
"251": {
"class_type": "CLIPVisionEncode",
"inputs": {
"clip_vision": [
"244",
0
],
"crop": "none",
"image": [
"240",
0
]
},
"_meta": {
"title": "CLIP Vision Encode"
}
},
"257": {
"class_type": "CreateVideo",
"inputs": {
"bit_depth": "auto",
"codec": "none",
"color_space": "sRGB",
"fps": 16,
"images": [
"8",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"258": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/ComfyUI",
"format": "auto",
"format.codec": "auto",
"video": [
"257",
0
]
},
"_meta": {
"title": "Save Video"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)Questions & answers
The ATI variant accepts trajectory conditioning so the model follows a user-defined motion path. In this workflow, WanTrackToVideo reads the trajectory JSON and injects that control into sampling, giving you reproducible, path-driven camera or subject movement.
Keep the trajectory smooth in the annotation tool, match aspect ratio and frame count between the tool and the workflow, fix the seed for repeatability, and start with moderate CFG (e.g., 4–7) and sufficient steps. If motion still wobbles, simplify or smooth the path and reduce conflicting style prompts.
A 24 GB VRAM GPU (e.g., 4090-class) comfortably handles 720x480 with typical frame counts; first runs often take around 500 seconds, with later runs faster as weights are cached. With less VRAM, lower resolution or reduce frames. Watch usage in ComfyUI and adjust size/FPS accordingly.
Yes. Keep the same trajectory JSON and reference image if you want consistent motion and composition, then vary the text prompt, CFG, or steps to change style. For major layout or scale changes, update the trajectory to match the new intent.