비디오 얼굴 바꾸기
최고의 오픈 소스 비디오 얼굴 교체 워크플로. 드라이빙 비디오와 캐릭터 얼굴 사진을 업로드하세요. 이 LTX 2.3 LoRA는 @Alissonerdx가 학습했습니다.
워크플로 내부
소스 템플릿의 읽기 전용 미리보기입니다. 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({
"269": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_face_image_FILENAME"
},
"_meta": {
"title": "Load Face Reference"
}
},
"341": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/LTX_2.3_ia2v",
"format": "auto",
"format.codec": "auto",
"video": [
"408",
0
]
},
"_meta": {
"title": "Final Video"
}
},
"345": {
"class_type": "VHS_LoadVideo",
"inputs": {
"custom_height": 0,
"custom_width": 0,
"force_rate": [
"358",
0
],
"format": "AnimateDiff",
"frame_load_cap": [
"627",
1
],
"select_every_nth": 1,
"skip_first_frames": 0,
"video": "UPLOADED_video_FILENAME"
},
"_meta": {
"title": "Load Video"
}
},
"358": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 24
},
"_meta": {
"title": "FPS"
}
},
"360": {
"class_type": "ReservedRegionFrameComposer",
"inputs": {
"chroma_b": 0,
"chroma_g": 255,
"chroma_r": 0,
"face_align_cross": "center",
"face_align_main": "center",
"face_distribution": "all_faces_every_frame",
"face_gap_px": 12,
"face_images": [
"269",
0
],
"face_padding_px": 12,
"face_scale_pct": 100,
"frames": [
"361",
0
],
"interval_frames": 12,
"overflow_mode": "loop",
"region_position": "left",
"region_size_px": 256,
"stack_direction": "auto"
},
"_meta": {
"title": "Reserved Region Frame Composer"
}
},
"361": {
"class_type": "ImageResizeKJv2",
"inputs": {
"crop_position": "center",
"device": "cpu",
"divisible_by": 32,
"height": [
"362",
0
],
"image": [
"345",
0
],
"keep_proportion": "resize",
"pad_color": "0, 0, 0",
"upscale_method": "lanczos",
"width": [
"362",
0
]
},
"_meta": {
"title": "Resize Image v2"
}
},
"362": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 1280
},
"_meta": {
"title": "Base Resolution (Largest Size)"
}
},
"365": {
"class_type": "VHS_VideoCombine",
"inputs": {
"audio": [
"345",
2
],
"crf": 19,
"filename_prefix": "comparison",
"format": "video/h264-mp4",
"frame_rate": [
"358",
0
],
"images": [
"360",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "Control Video Preview"
}
},
"408": {
"class_type": "CreateVideo",
"inputs": {
"audio": [
"345",
2
],
"bit_depth": 8,
"codec": "none",
"color_space": "sRGB",
"fps": [
"358",
0
],
"images": [
"641:545",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"427": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 5
},
"_meta": {
"title": "Duration (Seconds)"
}
},
"559": {
"class_type": "VHS_VideoCombine",
"inputs": {
"audio": [
"345",
2
],
"crf": 19,
"filename_prefix": "comparison",
"format": "video/h264-mp4",
"frame_rate": [
"358",
0
],
"images": [
"560",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "Video Combine Comparison"
}
},
"560": {
"class_type": "ImageConcanate",
"inputs": {
"direction": "right",
"image1": [
"360",
0
],
"image2": [
"641:545",
0
],
"match_image_size": True
},
"_meta": {
"title": "ImageConcanate"
}
},
"627": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "((a * b) // 8) * 8 + 1",
"values.a": [
"427",
0
],
"values.b": [
"358",
0
]
},
"_meta": {
"title": "Total Frames"
}
},
"641:377": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 48738923203162
},
"_meta": {
"title": "RandomNoise"
}
},
"641:382": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"641:396",
0
],
"latent_image": [
"641:416",
0
],
"noise": [
"641:377",
0
],
"sampler": [
"641:386",
0
],
"sigmas": [
"641:575",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"641:383": {
"class_type": "LTXVCropGuides",
"inputs": {
"latent": [
"641:392",
0
],
"negative": [
"641:440",
1
],
"positive": [
"641:440",
0
]
},
"_meta": {
"title": "LTXVCropGuides"
}
},
"641:386": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler_ancestral_cfg_pp"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"641:390": {
"class_type": "LTXVConditioning",
"inputs": {
"frame_rate": [
"358",
0
],
"negative": [
"641:395",
0
],
"positive": [
"641:481",
0
]
},
"_meta": {
"title": "LTXVConditioning"
}
},
"641:392": {
"class_type": "LTXVSeparateAVLatent",
"inputs": {
"av_latent": [
"641:382",
0
]
},
"_meta": {
"title": "Separate AV Latent"
}
},
"641:395": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"641:477",
0
],
"text": ""
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"641:396": {
"class_type": "CFGGuider",
"inputs": {
"cfg": 1,
"model": [
"641:573",
0
],
"negative": [
"641:440",
1
],
"positive": [
"641:440",
0
]
},
"_meta": {
"title": "CFG Guider"
}
},
"641:400": {
"class_type": "SolidMask",
"inputs": {
"height": [
"641:471",
1
],
"value": 0,
"width": [
"641:471",
0
]
},
"_meta": {
"title": "Create Solid Mask"
}
},
"641:414": {
"class_type": "TrimAudioDuration",
"inputs": {
"audio": [
"345",
2
],
"duration": [
"427",
0
],
"start_index": 0
},
"_meta": {
"title": "Trim Audio Duration"
}
},
"641:415": {
"class_type": "LTXVAudioVAEEncode",
"inputs": {
"audio": [
"641:414",
0
],
"audio_vae": [
"641:480",
0
]
},
"_meta": {
"title": "LTXV Audio VAE Encode"
}
},
"641:416": {
"class_type": "LTXVConcatAVLatent",
"inputs": {
"audio_latent": [
"641:417",
0
],
"video_latent": [
"641:440",
2
]
},
"_meta": {
"title": "Concat AV Latent"
}
},
"641:417": {
"class_type": "SetLatentNoiseMask",
"inputs": {
"mask": [
"641:400",
0
],
"samples": [
"641:415",
0
]
},
"_meta": {
"title": "Set Latent Noise Mask"
}
},
"641:418": {
"class_type": "LatentUpscaleModelLoader",
"inputs": {
"model_name": "ltx-2.3-spatial-upscaler-x2-1.1.safetensors"
},
"_meta": {
"title": "Load Latent Upscale Model"
}
},
"641:440": {
"class_type": "LTXVAddGuideMulti",
"inputs": {
"latent": [
"641:443",
0
],
"negative": [
"641:390",
1
],
"num_guides": "1",
"num_guides.frame_idx_1": 0,
"num_guides.image_1": [
"360",
0
],
"num_guides.strength_1": 1,
"positive": [
"641:390",
0
],
"vae": [
"641:479",
0
]
},
"_meta": {
"title": "LTXVAddGuideMulti"
}
},
"641:443": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"360",
0
],
"vae": [
"641:479",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"641:471": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"360",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"641:477": {
"class_type": "DualCLIPLoader",
"inputs": {
"clip_name1": "gemma_3_12B_it_fp8_scaled.safetensors",
"clip_name2": "ltx-2.3_text_projection_bf16.safetensors",
"device": "default",
"type": "ltxv"
},
"_meta": {
"title": "Load CLIP (Dual)"
}
},
"641:478": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "ltx-2.3-22b-distilled_transformer_only_fp8_input_scaled_v3.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"641:479": {
"class_type": "VAELoaderKJ",
"inputs": {
"device": "main_device",
"vae_name": "LTX23_video_vae_bf16.safetensors",
"weight_dtype": "bf16"
},
"_meta": {
"title": "VAELoader KJ"
}
},
"641:480": {
"class_type": "VAELoaderKJ",
"inputs": {
"device": "main_device",
"vae_name": "LTX23_audio_vae_bf16.safetensors",
"weight_dtype": "bf16"
},
"_meta": {
"title": "VAELoader KJ"
}
},
"641:481": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"641:477",
0
],
"text": [
"641:498",
0
]
},
"_meta": {
"title": "Encode Positive"
}
},
"641:498": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "The young woman with long, wavy ginger hair, a densely freckled face, blue-green eyes and pale, natural skin is standing on a sunlit golf fairway, looking into the camera. Her copper waves fall from under a deep purple leather bucket hat onto the shoulders of a white Swiss-dot high-collared blouse, and she wears brown leather gloves. She lifts the golf driver off her shoulders, swings it once in a relaxed half-arc, rests it on one shoulder, laughs and speaks while the camera arcs around her and pushes in to a close-up. Bright midday sun, deep-blue sky, pine trees softly blurred behind her. Her freckles and features stay sharp and consistent in every frame, with realistic lip movement. Photorealistic, natural skin texture."
},
"_meta": {
"title": "Positive Prompt"
}
},
"641:545": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"641:383",
2
],
"vae": [
"641:479",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"641:573": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "ltx23-head_swap_v3_rank_adaptive_fro_098.safetensors",
"model": [
"641:478",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"641:575": {
"class_type": "BasicScheduler",
"inputs": {
"denoise": 1,
"model": [
"641:573",
0
],
"scheduler": "bong_tangent",
"steps": 8
},
"_meta": {
"title": "BasicScheduler"
}
}
})
workflow.set_input("269", "image", client.assets.from_url("https://comfy.org/catalog-media/97f668e5-901f-42b2-961d-47039cfd6a2c/fa2b20ed-2ba6-4783-b676-ddc358244949"))
workflow.set_input("345", "video", client.assets.from_url("https://comfy.org/catalog-media/e5e95c05-0dbc-49f8-b6a6-b03e20a06e4a/9e76d5e9-b473-4d3b-98ec-4ac4c4249071"))
# 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("341"):
output.to_file(output.name)
for output in job.get_outputs("559"):
output.to_file(output.name)예시 사용해 보기
이 워크플로 정보
이 ComfyUI 워크플로는 드라이빙 비디오의 모든 프레임에 단일 참고 얼굴 이미지를 적용한 뒤, 프레임을 다시 결합해 최종 클립을 만드는 비디오 얼굴 교체를 수행합니다. 파이프라인은 VHS_LoadVideo로 소스 비디오를 프레임으로 디코딩하고 LoadImage로 참고 얼굴을 가져오는 것으로 시작합니다. 커스텀 얼굴 교체 노드(dc72113f-8276-4a5a-af12-85d6bec89ed5)가 @Alissonerdx가 학습한 LTX 2.3 LoRA를 사용해 실제 얼굴 전이를 수행합니다. PrimitiveFloat 및 PrimitiveInt 노드는 효과 강도, 영역 크기, 프레임 스텝 같은 핵심 컨트롤을 노출하며, ImageResizeKJv2는 참고 얼굴 스케일을 목표 영상에 맞춥니다.
결과를 안정화하고 배경을 유지하기 위해, 워크플로는 ReservedRegionFrameComposer로 생성된 얼굴을 각 원본 프레임에 다시 합성합니다. 이 노드는 얼굴에 대해 일관된 “reserved” 영역을 정의하고 페더링된 엣지로 블렌딩해 시간적 지터를 줄이고 머리카락, 조명, 장면 모션을 보존합니다. ComfyMathExpression은 동적 값(예: 비디오 해상도에서 영역 크기 계산)을 도출해 로드하는 입력에 맞춰 설정이 동기화되도록 합니다. 품질 점검을 위해 ImageConcanate로 원본 vs 교체 프레임을 나란히 미리보기로 구성할 수 있습니다. 마지막으로 처리된 프레임은 VHS_VideoCombine 또는 CreateVideo로 비디오로 인코딩되며, SaveVideo로 저장됩니다.
질문과 답변
Video Helper Suite(VHS_LoadVideo, VHS_VideoCombine)를 설치하고, @Alissonerdx의 LTX 2.3 LoRA를 ComfyUI/models/loras에 넣으세요. 커스텀 얼굴 교체 노드(dc72113f-8276-4a5a-af12-85d6bec89ed5)가 추론 중에 LoRA를 적용하므로, 이 템플릿에서는 샘플러를 수동으로 추가할 필요가 없습니다.
ReservedRegionFrameComposer의 영역을 대상 얼굴 주변에 안정적으로 고정하고, 더 부드러운 엣지를 위해 페더링을 늘리세요. 드라이빙 비디오와 비슷한 조명의 고품질 정면 참고 이미지를 사용하세요. 과도한 프레임 스킵은 피하고, 최상의 시간적 일관성을 위해 모든 프레임을 처리하세요.
네. 프레임을 VHS_VideoCombine으로 라우팅하고, 노드 설정이 지원한다면 원본 오디오를 활성화하거나 공급하세요. ComfyUI에서 오디오 mux가 되지 않는 구성이라면 비디오를 내보낸 뒤 비디오 편집기에서 오디오를 다시 추가하세요.
ReservedRegionFrameComposer에서 영역 크기/위치를 조정하고 ImageResizeKJv2로 참고 얼굴을 리스케일하세요. PrimitiveFloat/PrimitiveInt 컨트롤(및 제공되는 경우 ComfyMathExpression)을 사용해 영역이 비디오 해상도에 비례하도록 유지한 다음, 내보내기 전에 짧은 구간을 미리보기로 확인하세요.