Wan Animate 2.2 캐릭터 교체 워크플로
Wan Animate 2.2 — 캐릭터 및 장면 교체 - Nano Banana 2를 사용하여 첫 프레임에서 레퍼런스 이미지를 생성한 후 전체 장면을 교체합니다. 인물 피사체에 최적화되었습니다.
워크플로 내부
소스 템플릿의 읽기 전용 미리보기입니다. Cloud에서 열어 노드를 살펴보고 변경할 수 있습니다.
Loading the graph
Open full-size workflow preview코드에서 이 모델 호출하기
아래 요청은 Playground와 동일하게 준비된 그래프와 설정을 사용합니다. 제출할 때마다 유료 실행이 시작될 수 있으므로 결과를 알 수 없는 제출을 자동으로 재시도하지 마세요.
What you need
- Runs on
- Comfy Cloud
- 키
- COMFY_API_KEY
- 내 파일
- 코드가 해당 URL에서 업로드
유료 Cloud 요금제와 크레딧이 필요합니다.
# 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({
"19": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/Wan2.2_animate",
"format": "auto",
"format.codec": "auto",
"video": [
"344:357",
0
]
},
"_meta": {
"title": "Final Video"
}
},
"159": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 1280
},
"_meta": {
"title": "Width"
}
},
"160": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 720
},
"_meta": {
"title": "Height"
}
},
"301": {
"class_type": "VHS_LoadVideo",
"inputs": {
"custom_height": 0,
"custom_width": 0,
"force_rate": 0,
"format": "AnimateDiff",
"frame_load_cap": 0,
"select_every_nth": 1,
"skip_first_frames": 0,
"video": "UPLOADED_video_FILENAME"
},
"_meta": {
"title": "Input Video"
}
},
"314": {
"class_type": "VHS_VideoInfo",
"inputs": {
"video_info": [
"301",
3
]
},
"_meta": {
"title": "Video Info 🎥🅥🅗🅢"
}
},
"346": {
"class_type": "ImageFromBatch",
"inputs": {
"batch_index": 0,
"image": [
"301",
0
],
"length": 1
},
"_meta": {
"title": "Get Image from Batch"
}
},
"348": {
"class_type": "GeminiNanoBanana2",
"inputs": {
"aspect_ratio": "auto",
"images": [
"346",
0
],
"model": "Nano Banana 2 (Gemini 3.1 Flash Image)",
"prompt": [
"351",
0
],
"resolution": "1K",
"response_modalities": "IMAGE",
"seed": 210658028400692,
"system_prompt": "You are an expert image-generation engine. You must ALWAYS produce an image.\nInterpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition.\nIf a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept.\nPrioritize generating the visual representation above any text, formatting, or conversational requests.",
"thinking_level": "MINIMAL"
},
"_meta": {
"title": "Nano Banana 2"
}
},
"349": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"348",
0
]
},
"_meta": {
"title": "Preview Reference Image"
}
},
"351": {
"class_type": "StringConcatenate",
"inputs": {
"delimiter": "",
"string_a": "retain the composition of this image but turn the character into ",
"string_b": "a woman sculpted entirely from translucent rose quartz veined with brushed copper, wearing the same loose open jacket, cropped top and wide trousers but carved from thin, glowing pink crystal with fine copper filigree along every seam and hem, her skin smooth polished quartz with soft light passing through it, her long hair formed from flowing strands of fine copper wire that swing and catch the sun, small copper rings on her fingers, crystal shoes, keeping her joyful expression, her pose, the cracked dry lakebed and the clear blue sky exactly as they are, photorealistic material detail with crisp reflections and light glowing inside the stone"
},
"_meta": {
"title": "Concatenate Text"
}
},
"344:1": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"344:2",
0
],
"text": "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走"
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"344:18": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "lightx2v_I2V_14B_480p_cfg_step_distill_rank64_bf16.safetensors",
"model": [
"344:20",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"344:2": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
"device": "default",
"type": "wan"
},
"_meta": {
"title": "Load CLIP"
}
},
"344:20": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "Wan2_2-Animate-14B_fp8_e4m3fn_scaled_KJ.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"344:21": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"344:2",
0
],
"text": "the person is dancing"
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"344:3": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "wan_2.1_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"344:324": {
"class_type": "DownloadAndLoadSAM2Model",
"inputs": {
"device": "cuda",
"model": "sam2.1_hiera_base_plus.safetensors",
"precision": "fp16",
"segmentor": "video"
},
"_meta": {
"title": "(Down)Load SAM2Model"
}
},
"344:325": {
"class_type": "BlockifyMask",
"inputs": {
"block_size": 32,
"device": "cpu",
"masks": [
"344:327",
0
]
},
"_meta": {
"title": "Blockify Mask"
}
},
"344:326": {
"class_type": "Sam2Segmentation",
"inputs": {
"bboxes": [
"344:334",
3
],
"image": [
"344:337",
0
],
"individual_objects": False,
"keep_model_loaded": False,
"sam2_model": [
"344:324",
0
]
},
"_meta": {
"title": "Sam2Segmentation"
}
},
"344:327": {
"class_type": "GrowMaskWithBlur",
"inputs": {
"blur_radius": 0,
"decay_factor": 1,
"expand": 10,
"fill_holes": False,
"flip_input": False,
"incremental_expandrate": 0,
"lerp_alpha": 1,
"mask": [
"344:326",
0
],
"tapered_corners": True
},
"_meta": {
"title": "Grow Mask With Blur"
}
},
"344:328": {
"class_type": "OnnxDetectionModelLoader",
"inputs": {
"onnx_device": "CUDAExecutionProvider",
"vitpose_model": "vitpose-l-wholebody.onnx",
"yolo_model": "yolov10m.onnx"
},
"_meta": {
"title": "ONNX Detection Model Loader"
}
},
"344:332": {
"class_type": "DrawMaskOnImage",
"inputs": {
"color": "0, 0, 0",
"device": "cpu",
"image": [
"344:338",
0
],
"mask": [
"344:325",
0
]
},
"_meta": {
"title": "Draw Mask On Image"
}
},
"344:334": {
"class_type": "PoseAndFaceDetection",
"inputs": {
"face_padding": 0,
"height": [
"344:337",
2
],
"images": [
"344:337",
0
],
"model": [
"344:328",
0
],
"width": [
"344:337",
1
]
},
"_meta": {
"title": "Pose and Face Detection"
}
},
"344:335": {
"class_type": "DrawViTPose",
"inputs": {
"body_stick_width": -1,
"draw_head": True,
"hand_stick_width": -1,
"height": [
"344:337",
2
],
"pose_data": [
"344:334",
0
],
"retarget_padding": 16,
"width": [
"344:337",
1
]
},
"_meta": {
"title": "Draw ViT Pose"
}
},
"344:337": {
"class_type": "GetImageSizeAndCount",
"inputs": {
"image": [
"344:338",
0
]
},
"_meta": {
"title": "Get Image Size & Count"
}
},
"344:338": {
"class_type": "ImageScale",
"inputs": {
"crop": "center",
"height": [
"160",
0
],
"image": [
"301",
0
],
"upscale_method": "lanczos",
"width": [
"159",
0
]
},
"_meta": {
"title": "Resize Input Video"
}
},
"344:342": {
"class_type": "ImageScale",
"inputs": {
"crop": "center",
"height": [
"160",
0
],
"image": [
"348",
0
],
"upscale_method": "lanczos",
"width": [
"159",
0
]
},
"_meta": {
"title": "Resize Reference Image"
}
},
"344:353": {
"class_type": "TrimVideoLatent",
"inputs": {
"samples": [
"344:355",
0
],
"trim_amount": [
"344:356",
3
]
},
"_meta": {
"title": "Trim Video Latent"
}
},
"344:354": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"344:353",
0
],
"vae": [
"344:3",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"344:355": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"344:356",
2
],
"model": [
"344:60",
0
],
"negative": [
"344:356",
1
],
"positive": [
"344:356",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 777171427287516,
"steps": 6
},
"_meta": {
"title": "KSampler"
}
},
"344:356": {
"class_type": "WanAnimateToVideo",
"inputs": {
"batch_size": 1,
"clip_vision_output": [
"344:9",
0
],
"continue_motion_max_frames": 5,
"face_video": [
"344:334",
1
],
"height": [
"160",
0
],
"length": [
"301",
1
],
"negative": [
"344:1",
0
],
"pose_video": [
"344:335",
0
],
"positive": [
"344:21",
0
],
"reference_image": [
"344:342",
0
],
"vae": [
"344:3",
0
],
"video_frame_offset": 0,
"width": [
"159",
0
]
},
"_meta": {
"title": "WanAnimateToVideo"
}
},
"344:357": {
"class_type": "CreateVideo",
"inputs": {
"audio": [
"301",
2
],
"bit_depth": "auto",
"codec": "none",
"color_space": "sRGB",
"fps": [
"314",
0
],
"images": [
"344:358",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"344:358": {
"class_type": "ImageFromBatch",
"inputs": {
"batch_index": [
"344:356",
4
],
"image": [
"344:354",
0
],
"length": 4096
},
"_meta": {
"title": "Get Image from Batch"
}
},
"344:4": {
"class_type": "CLIPVisionLoader",
"inputs": {
"clip_name": "clip_vision_h.safetensors"
},
"_meta": {
"title": "Load CLIP Vision"
}
},
"344:60": {
"class_type": "ModelSamplingSD3",
"inputs": {
"model": [
"344:99",
0
],
"shift": 8
},
"_meta": {
"title": "ModelSamplingSD3"
}
},
"344:9": {
"class_type": "CLIPVisionEncode",
"inputs": {
"clip_vision": [
"344:4",
0
],
"crop": "none",
"image": [
"344:342",
0
]
},
"_meta": {
"title": "CLIP Vision Encode"
}
},
"344:99": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "WanAnimate_relight_lora_fp16.safetensors",
"model": [
"344:18",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
}
})
workflow.set_input("301", "video", client.assets.from_url("https://comfy.org/catalog-media/eba278c1-1bb9-45c4-92c8-f62e649e5b44/4f4b49a9-d6b0-42d4-82a9-f405a7f309d8"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("19"):
output.to_file(output.name)
for output in job.get_outputs("349"):
output.to_file(output.name)예시 사용해 보기
이 워크플로 정보
Wan Animate 2.2 캐릭터 교체 워크플로는 고급 AI 모델을 사용해 비디오 콘텐츠의 캐릭터 및 장면을 교체하도록 설계되었습니다. 이 워크플로는 사람 피사체에 특히 최적화된 Wan 2.2 Animate 모델의 성능을 활용하여, 캐릭터 교체가 안정적이며 자연스럽게 보이도록 합니다. 프로세스는 Nano Banana 2 모델을 사용해 비디오의 첫 프레임에서 참조 이미지를 생성하는 것으로 시작합니다. 이 이미지는 전체 비디오 시퀀스에서 캐릭터를 교체하는 기준으로 사용됩니다. 또한 ComfyUI-WanAnimatePreprocess 및 ComfyUI-segment-anything-2를 포함한 여러 커스텀 노드를 사용해 비디오 프레임을 효율적으로 분할 및 처리합니다.
기술적으로 이 워크플로는 VHS_LoadVideo로 비디오를 로드하고, GeminiNanoBanana2로 참조 이미지를 기반으로 캐릭터 교체를 적용하는 등 여러 노드를 조합해 사용합니다. 이후 SaveVideo 노드로 최종 애니메이션 비디오를 출력합니다. 이 워크플로는 비디오 콘텐츠에서 고품질 캐릭터 애니메이션을 제작하려는 크리에이터에게 특히 유용하며, AI 기반 기법을 비디오 제작 파이프라인에 통합해 제작 역량을 확장할 수 있습니다. 사람 피사체에 초점을 맞추어 얼굴 및 신체 특징을 높은 충실도로 렌더링하므로, 사실적인 캐릭터 애니메이션이 필요한 프로젝트에 적합합니다.
질문과 답변
이 워크플로는 사람 피사체에 최적화되어 있지만, 기술적으로는 비인간 피사체에도 사용할 수 있습니다. 다만 결과가 덜 안정적이거나 설득력이 떨어질 수 있습니다.
워크플로에는 비디오 해상도 최적화를 돕는 Target Resolution 그룹이 포함되어 있습니다. 다만 최상의 결과를 위해서는 고해상도 비디오로 시작하는 것을 권장합니다.
처리 시간은 비디오 길이와 시스템 성능에 따라 달라지며, 일반적으로 표준 길이 비디오의 경우 수 분에서 1시간 정도 걸릴 수 있습니다.
특히 고해상도 비디오나 더 긴 시퀀스에서는 워크플로를 효율적으로 실행하기 위해 고성능 GPU를 권장합니다.