Wan2.1 VACE 아웃페인팅
Wan VACE 아웃페인팅을 사용하여 비디오 크기를 확장하여 확장된 비디오를 생성합니다.
정보
이 ComfyUI 워크플로는 Wan 2.1 VACE를 사용해 비디오를 아웃페인팅(원본 콘텐츠는 유지하면서 캔버스를 확장)하는 방법을 안내합니다. LoadVideo로 소스 클립을 불러오고 GetVideoComponents 및 PreviewImage로 크기와 프레임 수를 추출합니다. 그런 다음 ImagePadForOutpaint와 ImageToMask/MaskToImage로 만든 마스크를 사용해 확장할 위치를 정의하고, RepeatImageBatch로 시간축 전체에 마스크를 복제합니다. 프롬프트는 CLIPTextEncode로 인코딩하고, 생성은 KSampler에서 ModelSamplingSD3 스케줄링을 통해 Wan 2.1 VACE UNet/Decoder 스택(UNETLoader, VAELoader)으로 실행되며, VAEDecode가 잠재 데이터를 프레임으로 변환합니다. WanVaceToVideo가 비디오 전용 조건화를 처리하고, TrimVideoLatent가 시간축 형태가 맞도록 보정합니다. 결과는 CreateVideo로 조립하고 SaveVideo로 저장합니다.
기술적으로 안정적인 추론을 위해 두 가지 정렬 규칙이 중요합니다. 아웃페인팅에 설정하는 공간 크기는 16으로 나누어떨어져야 하며(WanVaceToVideo 및 VAE 제약), 시퀀스 길이는 시간 제약(Length - 1이 4로 나누어떨어짐)을 만족해야 하는데 TrimVideoLatent가 이를 처리합니다. 핵심 Comfy 노드가 아직 비디오 크기/프레임 수 유틸리티를 노출하지 않기 때문에, 이 템플릿은 실용적인 우회로로 PreviewImage를 사용합니다. 사용 가능하다면 커스텀 유틸리티 노드로 교체할 수 있습니다. 워크플로에는 Wan2.1-VACE-1.3B(가벼움, 480p 권장) 및 Wan2.1-VACE-14B(더 높은 품질, 리소스가 허용되면 720p 같은 더 높은 해상도에 적합) 모델 그룹이 포함되어 있습니다. 기본 생성 설정은 steps: 20 및 cfg: 6.0이며, 선택적으로 CausVid LoRA 튜닝은 steps: 2–4 및 cfg: 1.0입니다.
제공할 항목
- 워크플로 읽는 중
ComfyUI에서 실행됩니다. 이 워크플로는 이 페이지에서 실행할 수 없습니다. 모든 항목이 로드된 Comfy Cloud에서 열거나, 자체 ComfyUI에서 사용하려면 다운로드하세요.
Cloud에서 사용해 보기워크플로 내부
노드 그래프의 읽기 전용 미리보기입니다. 노드를 편집하려면 Comfy Cloud에서 열거나 다운로드하세요.
Loading the graph
Open full-size workflow preview이 워크플로의 파일
- 작성자
- ComfyUI
사용자 지정 노드 필요
- 워크플로 읽는 중
코드에서 이 워크플로 사용하기
가능한 경우 워크플로 그래프와 입력을 기반으로 생성되며, 그렇지 않은 경우 저장된 예시가 표시됩니다. 비용이 발생할 수 있으므로 코드를 실행하기 전에 자격 증명과 엔드포인트를 검토하세요.
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({
"3": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"49",
2
],
"model": [
"48",
0
],
"negative": [
"49",
1
],
"positive": [
"49",
0
],
"sampler_name": "uni_pc",
"scheduler": "simple",
"seed": 776767434080331,
"steps": 3
},
"_meta": {
"title": "KSampler"
}
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"165",
1
],
"text": "A portrait of a woman with her eyes closed, her head surrounded by white transparent glass flowers, with only her face exposed. The camera slowly moves in, and the girl smiles. There are other transparent glass flowers in the style of Nicoletta Ceccoli around her. The detailed painting features natural light and soft lighting, creating a beautiful, surreal, and emotionally expressive movie scene.\n"
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"7": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"165",
1
],
"text": "bad quality, blurry, messy, chaotic"
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"58",
0
],
"vae": [
"152",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"48": {
"class_type": "ModelSamplingSD3",
"inputs": {
"model": [
"165",
0
],
"shift": 8.000000000000002
},
"_meta": {
"title": "ModelSamplingSD3"
}
},
"49": {
"class_type": "WanVaceToVideo",
"inputs": {
"batch_size": 1,
"control_masks": [
"130",
0
],
"control_video": [
"110",
0
],
"height": [
"139",
0
],
"length": [
"131",
0
],
"negative": [
"7",
0
],
"positive": [
"6",
0
],
"strength": 1,
"vae": [
"152",
0
],
"width": [
"137",
0
]
},
"_meta": {
"title": "WanVaceToVideo"
}
},
"58": {
"class_type": "TrimVideoLatent",
"inputs": {
"samples": [
"3",
0
],
"trim_amount": [
"49",
3
]
},
"_meta": {
"title": "Trim Video Latent"
}
},
"68": {
"class_type": "CreateVideo",
"inputs": {
"bit_depth": "auto",
"codec": "none",
"color_space": "sRGB",
"fps": 16,
"images": [
"8",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"69": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/ComfyUI",
"format": "auto",
"format.codec": "auto",
"video": [
"68",
0
]
},
"_meta": {
"title": "Save Video"
}
},
"71": {
"class_type": "LoadVideo",
"inputs": {
"file": "video_wan_vace_outpainting_input_video.mp4"
},
"_meta": {
"title": "Load Video"
}
},
"72": {
"class_type": "GetVideoComponents",
"inputs": {
"video": [
"71",
0
]
},
"_meta": {
"title": "Get Video Components"
}
},
"110": {
"class_type": "ImagePadForOutpaint",
"inputs": {
"bottom": 200,
"feathering": 0,
"image": [
"72",
0
],
"left": 120,
"right": 120,
"top": 120
},
"_meta": {
"title": "Pad Image for Outpainting"
}
},
"111": {
"class_type": "MaskToImage",
"inputs": {
"mask": [
"110",
1
]
},
"_meta": {
"title": "Convert Mask to Image"
}
},
"129": {
"class_type": "RepeatImageBatch",
"inputs": {
"amount": [
"131",
0
],
"image": [
"111",
0
]
},
"_meta": {
"title": "Repeat Image Batch"
}
},
"130": {
"class_type": "ImageToMask",
"inputs": {
"channel": "red",
"image": [
"129",
0
]
},
"_meta": {
"title": "Convert Image to Mask"
}
},
"131": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 81
},
"_meta": {
"title": "Length"
}
},
"135": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"110",
0
]
},
"_meta": {
"title": "Preview Image - Outpaint"
}
},
"137": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 960
},
"_meta": {
"title": "Width"
}
},
"139": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 960
},
"_meta": {
"title": "Height"
}
},
"143": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"72",
0
]
},
"_meta": {
"title": "Preview Image - original"
}
},
"151": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "wan2.1_vace_14B_fp16.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"152": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "wan_2.1_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"161": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "umt5_xxl_fp16.safetensors",
"device": "default",
"type": "wan"
},
"_meta": {
"title": "Load CLIP"
}
},
"165": {
"class_type": "LoraLoader",
"inputs": {
"clip": [
"161",
0
],
"lora_name": "Wan21_CausVid_14B_T2V_lora_rank32.safetensors",
"model": [
"151",
0
],
"strength_clip": 1,
"strength_model": 0.4000000000000001
},
"_meta": {
"title": "Load LoRA (Model and CLIP)"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)질문과 답변
WanVaceToVideo와 VAE가 2의 거듭제곱으로 다운샘플링하므로, 잠재 공간이 깨끗하게 맞으려면 16의 배수여야 합니다. 시간축은 (프레임-1) % 4 == 0을 만족해야 하며, TrimVideoLatent가 이를 보정합니다. 목표 해상도는 16의 배수로 설정하세요.
1.3B는 빠른 처리와 480p 출력에 적합합니다. 14B는 고품질 및 VRAM이 충분할 경우 720p 이상 고해상도에 적합합니다. 14B가 더 디테일하지만 느리고 메모리 소모가 큽니다.
ImagePadForOutpaint로 확장할 방향을 지정하고, ImageToMask/MaskToImage로 원본 영역을 보호하는 마스크를 만든 뒤 RepeatImageBatch로 프레임 수에 맞게 복제하세요. 모델은 마스크 바깥, 새로 확장된 영역만 합성합니다.
1) 출력 너비/높이가 16의 배수인지, 2) TrimVideoLatent가 적용되어 (프레임-1)이 4의 배수인지, 3) VAEDecode가 CreateVideo/SaveVideo 전에 연결되어 있는지 확인하세요. fps와 프레임 수, 마스크 배치 길이도 일치해야 합니다.