Face Swap Workflow
VFX 사용을 위해 설계된 ComfyUI 워크플로로, AI 기반 마스킹, 레퍼런스 기반 정체성 전송, 인페인팅을 결합해 자연스럽고 시간적으로 일관된 결과를 만듭니다. 퍼포먼스, 조명, 원본 플레이트와의 합성을 유지하면서 얼굴 교체 또는 디에이징을 빠르게 수행할 수 있습니다.
정보
ComfyUI의 Face Swap Workflow는 비디오 푸티지에서 디에이징 또는 얼굴 교체를 수행해야 하는 VFX 아티스트를 위해 설계된 고급 도구입니다. 이 워크플로는 AI 기반 마스킹, 정체성 전송, 인페인팅 기법을 결합해 프레임 전반에서 자연스럽고 일관된 결과를 제공합니다. WanVideoVAELoader와 WanVideoModelLoader 같은 핵심 노드는 비디오 데이터를 로딩하고 관리하며, DrawMaskOnImage와 GrowMask 같은 노드는 페이스 스왑을 위한 정밀한 마스크를 만드는 데 사용됩니다. 또한 OnnxDetectionModelLoader와 CLIPVisionLoader를 통해 고급 감지 모델을 통합해 얼굴 특징을 정확하게 식별하고 조작합니다. 이러한 구성 요소를 결합함으로써, 워크플로는 새 얼굴이 원본 푸티지와 자연스럽게 블렌딩되도록 하며 조명과 연기(퍼포먼스)의 뉘앙스를 유지합니다.
제공할 항목
- 워크플로 읽는 중
ComfyUI에서 실행됩니다. 이 워크플로는 이 페이지에서 실행할 수 없습니다. 모든 항목이 로드된 Comfy Cloud에서 열거나, 자체 ComfyUI에서 사용하려면 다운로드하세요.
Cloud에서 사용해 보기예시 사용해 보기
워크플로 내부
노드 그래프의 읽기 전용 미리보기입니다. 노드를 편집하려면 Comfy Cloud에서 열거나 다운로드하세요.
Loading the graph
Open full-size workflow preview코드에서 이 워크플로 사용하기
가능한 경우 워크플로 그래프와 입력을 기반으로 생성되며, 그렇지 않은 경우 저장된 예시가 표시됩니다. 비용이 발생할 수 있으므로 코드를 실행하기 전에 자격 증명과 엔드포인트를 검토하세요.
What you need
- Runs on
- Comfy Cloud
- 키
- COMFY_API_KEY
유료 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({
"38": {
"class_type": "WanVideoVAELoader",
"inputs": {
"model_name": "Wan2_1_VAE_fp32.safetensors",
"precision": "fp32",
"use_cpu_cache": False,
"verbose": False
},
"_meta": {
"title": "WanVideo VAE Loader"
}
},
"195": {
"class_type": "WanVideoTorchCompileSettings",
"inputs": {
"allow_unmerged_lora_compile": False,
"backend": "inductor",
"compile_transformer_blocks_only": True,
"dynamic": False,
"dynamo_cache_size_limit": 64,
"dynamo_recompile_limit": 128,
"force_parameter_static_shapes": False,
"fullgraph": False,
"mode": "default"
},
"_meta": {
"title": "WanVideo Torch Compile Settings"
}
},
"891": {
"class_type": "WanVideoLoraSelectMulti",
"inputs": {
"lora_0": "WanAnimate_relight_lora_fp16.safetensors",
"lora_1": "lightx2v_I2V_14B_480p_cfg_step_distill_rank64_bf16.safetensors",
"lora_2": "none",
"lora_3": "none",
"lora_4": "none",
"low_mem_load": False,
"merge_loras": False,
"strength_0": 1,
"strength_1": 1,
"strength_2": 1,
"strength_3": 1,
"strength_4": 1
},
"_meta": {
"title": "WanVideo Lora Select Multi"
}
},
"899": {
"class_type": "LoadImage",
"inputs": {
"image": "27e8b5aa2f2631d728cbaca117fe57ae2297a085a2d356d1a3f1438a7e8dadea.png"
},
"_meta": {
"title": "Load Image"
}
},
"900": {
"class_type": "ImageResizeKJv2",
"inputs": {
"crop_position": "top",
"device": "cpu",
"divisible_by": 16,
"height": [
"1099",
4
],
"image": [
"899",
0
],
"keep_proportion": "crop",
"pad_color": "0, 0, 0",
"upscale_method": "lanczos",
"width": [
"1099",
3
]
},
"_meta": {
"title": "Resize Image v2"
}
},
"911": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 19,
"filename_prefix": "WanVideo2_1_T2V",
"format": "video/h264-mp4",
"frame_rate": [
"1099",
0
],
"images": [
"912",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": False,
"trim_to_audio": False
},
"_meta": {
"title": "Video Combine 🎥🅥🅗🅢"
}
},
"912": {
"class_type": "DrawMaskOnImage",
"inputs": {
"color": "0,0,0",
"device": "cpu",
"image": [
"1098",
0
],
"mask": [
"914",
0
]
},
"_meta": {
"title": "Draw Mask On Image"
}
},
"913": {
"class_type": "GrowMask",
"inputs": {
"expand": 300,
"mask": [
"1293",
0
],
"tapered_corners": False
},
"_meta": {
"title": "Grow Mask"
}
},
"914": {
"class_type": "BlockifyMask",
"inputs": {
"block_size": 8,
"device": "cpu",
"masks": [
"913",
0
]
},
"_meta": {
"title": "Blockify Mask"
}
},
"926": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 19,
"filename_prefix": "WanVideo2_1_T2V",
"format": "video/h264-mp4",
"frame_rate": [
"1099",
0
],
"images": [
"1036",
1
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": False,
"trim_to_audio": False
},
"_meta": {
"title": "Video Combine 🎥🅥🅗🅢"
}
},
"935": {
"class_type": "CLIPVisionLoader",
"inputs": {
"clip_name": "clip_vision_h.safetensors"
},
"_meta": {
"title": "Load CLIP Vision"
}
},
"936": {
"class_type": "WanVideoClipVisionEncode",
"inputs": {
"clip_vision": [
"935",
0
],
"combine_embeds": "average",
"crop": "center",
"force_offload": True,
"image_1": [
"900",
0
],
"ratio": 0.5,
"strength_1": 1,
"strength_2": 1,
"tiles": 0
},
"_meta": {
"title": "WanVideo ClipVision Encode"
}
},
"951": {
"class_type": "WanVideoAnimateEmbeds",
"inputs": {
"bg_images": [
"912",
0
],
"clip_embeds": [
"936",
0
],
"colormatch": "hm-mvgd-hm",
"face_images": [
"1036",
1
],
"face_strength": 1,
"force_offload": False,
"frame_window_size": [
"1099",
1
],
"height": [
"1099",
4
],
"mask": [
"914",
0
],
"num_frames": [
"1099",
1
],
"pose_images": [
"1035",
0
],
"pose_strength": 1,
"ref_images": [
"900",
0
],
"tiled_vae": False,
"vae": [
"38",
0
],
"width": [
"1099",
3
]
},
"_meta": {
"title": "WanVideo Animate Embeds"
}
},
"953": {
"class_type": "WanVideoSampler",
"inputs": {
"add_noise_to_samples": False,
"batched_cfg": False,
"cfg": 1,
"denoise_strength": 1,
"end_step": -1,
"force_offload": True,
"image_embeds": [
"951",
0
],
"model": [
"979",
0
],
"riflex_freq_index": 0,
"rope_function": "comfy",
"scheduler": "dpm++_sde/beta",
"seed": 65346457346,
"shift": 6,
"start_step": 0,
"steps": 8,
"text_embeds": [
"982",
0
]
},
"_meta": {
"title": "WanVideo Sampler"
}
},
"954": {
"class_type": "WanVideoDecode",
"inputs": {
"enable_vae_tiling": False,
"normalization": "default",
"samples": [
"953",
0
],
"tile_stride_x": 144,
"tile_stride_y": 128,
"tile_x": 272,
"tile_y": 272,
"vae": [
"38",
0
]
},
"_meta": {
"title": "WanVideo Decode"
}
},
"979": {
"class_type": "WanVideoModelLoader",
"inputs": {
"attention_mode": "sdpa",
"base_precision": "fp16_fast",
"compile_args": [
"195",
0
],
"load_device": "offload_device",
"lora": [
"891",
0
],
"model": "Wan2_2-Animate-14B_fp8_scaled_e4m3fn_KJ_v2.safetensors",
"quantization": "disabled",
"rms_norm_function": "default"
},
"_meta": {
"title": "WanVideo Model Loader"
}
},
"982": {
"class_type": "WanVideoTextEncodeCached",
"inputs": {
"device": "gpu",
"model_name": "umt5-xxl-enc-bf16.safetensors",
"negative_prompt": "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走",
"positive_prompt": "A young man with short, dark brown hair sits in a dimly lit room, his gaze steady on the camera. He is wearing an olive green button-up shirt that appears slightly worn but neat. His skin has a natural tan tone, and he looks calm yet thoughtful. He has no wrinkles and looks very youthful. Not old.",
"precision": "bf16",
"quantization": "disabled",
"use_disk_cache": False
},
"_meta": {
"title": "WanVideo TextEncode Cached"
}
},
"1034": {
"class_type": "OnnxDetectionModelLoader",
"inputs": {
"onnx_device": "CUDAExecutionProvider",
"vitpose_model": "vitpose-l-wholebody.onnx",
"yolo_model": "yolov10m.onnx"
},
"_meta": {
"title": "ONNX Detection Model Loader"
}
},
"1035": {
"class_type": "DrawViTPose",
"inputs": {
"body_stick_width": -1,
"draw_head": True,
"hand_stick_width": -1,
"height": [
"1099",
4
],
"pose_data": [
"1036",
0
],
"retarget_padding": 16,
"width": [
"1099",
3
]
},
"_meta": {
"title": "Draw ViT Pose"
}
},
"1036": {
"class_type": "PoseAndFaceDetection",
"inputs": {
"face_padding": 0,
"height": [
"1099",
4
],
"images": [
"1098",
0
],
"model": [
"1034",
0
],
"width": [
"1099",
3
]
},
"_meta": {
"title": "Pose and Face Detection"
}
},
"1037": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 19,
"filename_prefix": "WanVideo2_1_T2V",
"format": "video/h264-mp4",
"frame_rate": [
"1099",
0
],
"images": [
"1035",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": False,
"trim_to_audio": False
},
"_meta": {
"title": "Video Combine 🎥🅥🅗🅢"
}
},
"1098": {
"class_type": "VHS_LoadVideoFFmpeg",
"inputs": {
"custom_height": [
"1288",
0
],
"custom_width": [
"1287",
0
],
"force_rate": 0,
"format": "Wan",
"frame_load_cap": 0,
"start_time": 0,
"video": "dacaa9337be45cb55ba8e804af52574ff18a96c7e20e40757558d116b54fe1e6.mp4"
},
"_meta": {
"title": "Load Video FFmpeg (Upload) 🎥🅥🅗🅢"
}
},
"1099": {
"class_type": "VHS_VideoInfoLoaded",
"inputs": {
"video_info": [
"1098",
3
]
},
"_meta": {
"title": "Video Info (Loaded) 🎥🅥🅗🅢"
}
},
"1201": {
"class_type": "AILab_QwenVL",
"inputs": {
"attention_mode": "sdpa",
"custom_prompt": "describe this image as if its a 5 second long video. Include a detail description of the person and their features and hair and age. ",
"image": [
"900",
0
],
"keep_model_loaded": False,
"max_tokens": 512,
"model_name": "Qwen3-VL-2B-Instruct",
"preset_prompt": "🖼️ Detailed Description",
"quantization": "None (FP16)",
"seed": 2074003516
},
"_meta": {
"title": "QwenVL"
}
},
"1287": {
"class_type": "INTConstant",
"inputs": {
"value": 1920
},
"_meta": {
"title": "Width"
}
},
"1288": {
"class_type": "INTConstant",
"inputs": {
"value": 1088
},
"_meta": {
"title": "Height"
}
},
"1289": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"1201",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"1290": {
"class_type": "DownloadAndLoadFlorence2Model",
"inputs": {
"attention": "sdpa",
"convert_to_safetensors": False,
"model": "microsoft/Florence-2-large",
"precision": "fp16"
},
"_meta": {
"title": "DownloadAndLoadFlorence2Model"
}
},
"1291": {
"class_type": "Florence2Run",
"inputs": {
"do_sample": True,
"fill_mask": True,
"florence2_model": [
"1290",
0
],
"image": [
"1098",
0
],
"keep_model_loaded": False,
"max_new_tokens": 1024,
"num_beams": 3,
"output_mask_select": "",
"seed": 3228786869,
"task": "caption_to_phrase_grounding",
"text_input": "Face, Head"
},
"_meta": {
"title": "Florence2Run"
}
},
"1292": {
"class_type": "Florence2toCoordinates",
"inputs": {
"batch": True,
"data": [
"1291",
3
],
"index": "0"
},
"_meta": {
"title": "Florence2 Coordinates"
}
},
"1293": {
"class_type": "Sam2Segmentation",
"inputs": {
"bboxes": [
"1292",
1
],
"image": [
"1295",
0
],
"individual_objects": True,
"keep_model_loaded": True,
"sam2_model": [
"1294",
0
]
},
"_meta": {
"title": "Sam2Segmentation"
}
},
"1294": {
"class_type": "DownloadAndLoadSAM2Model",
"inputs": {
"device": "cuda",
"model": "sam2_hiera_base_plus.safetensors",
"precision": "bf16",
"segmentor": "single_image"
},
"_meta": {
"title": "(Down)Load SAM2Model"
}
},
"1295": {
"class_type": "GetImageSizeAndCount",
"inputs": {
"image": [
"1098",
0
]
},
"_meta": {
"title": "Get Image Size & Count"
}
},
"1298": {
"class_type": "VHS_VideoCombine",
"inputs": {
"audio": [
"1098",
2
],
"crf": 22,
"filename_prefix": "FaceSwap",
"format": "video/h265-mp4",
"frame_rate": [
"1099",
0
],
"images": [
"954",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p10le",
"save_metadata": True,
"save_output": True
},
"_meta": {
"title": "Video Combine 🎥🅥🅗🅢"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)질문과 답변
이 워크플로는 MP4, AVI 같은 일반적인 비디오 형식을 지원합니다. 푸티지가 WanVideoVAELoader 노드와 호환되는지 확인하세요.
고품질 레퍼런스 이미지를 사용하고 마스크 설정을 신중히 조정하세요. GrowMask 및 BlockifyMask 노드를 사용하면 마스크 가장자리를 다듬어 자연스럽게 블렌딩하는 데 도움이 됩니다.
네. 이 워크플로는 여러 얼굴을 처리할 수 있습니다. OnnxDetectionModelLoader를 사용해 각 얼굴을 개별적으로 감지하고 관리하세요.
Face Swap Workflow는 계산 요구 사항 때문에 실시간보다 후반 작업(포스트 프로덕션)에 최적화되어 있습니다.