Wan2.1 VACE 區域性重繪
在保留周圍內容的同時編輯影片中的特定區域。非常適合物件移除或替換。
關於
Wan2.1 VACE Inpainting 工作流程用於自然地編輯影片內容中的特定區域,同時保留周邊區域的完整性。這特別適合用於影片序列中的物件移除或替換等任務。此工作流程使用 Wan2.1 模型,並結合多個節點,例如用於取樣的 KSampler、用於文字編碼的 CLIPTextEncode,以及用於解碼影片影格的 VAEDecode。工作流程分成多個步驟,從載入模型與影片檔案開始,到建立遮罩,再到合成最終影片輸出。
在技術面上,工作流程使用 WanVaceToVideo 節點將局部修補後的影格轉回影片格式,並透過 TrimVideoLatent 與 CreateVideo 節點管理影片長度與格式。ImageCompositeMasked 節點則負責把局部修補區域與原始影片融合,讓結果更自然。由於使用核心節點,此工作流程不需要額外安裝自訂套件,易於使用與導入。對需要在不影響整體影片品質的前提下進行精準編輯的內容創作者與影片剪輯者而言,這是一個實用選擇。
您提供的內容
- 正在讀取工作流程
在 ComfyUI 中執行。 此工作流程無法在此頁面上執行。請在已載入所有內容的 Comfy Cloud 中開啟,或下載到您自己的 ComfyUI。
在 Cloud 中試用工作流程內部
節點圖的唯讀預覽。請在 Comfy Cloud 中開啟,或下載後編輯節點。
從程式碼使用此工作流程
可行時會根據工作流程圖和輸入內容產生;否則會顯示儲存的範例。執行可能產生費用的程式碼前,請檢查認證資訊和端點。
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": 584027519362099,
"steps": 4
},
"_meta": {
"title": "KSampler"
}
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"38",
0
],
"text": "A little boy and a dog are hiking in the forest. The puppy runs around the boy cheerfully.\n"
},
"_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": [
"58",
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": [
"154",
0
],
"shift": 5
},
"_meta": {
"title": "ModelSamplingSD3"
}
},
"49": {
"class_type": "WanVaceToVideo",
"inputs": {
"batch_size": 1,
"control_masks": [
"130",
0
],
"control_video": [
"208",
0
],
"height": 720,
"length": 81,
"negative": [
"7",
0
],
"positive": [
"6",
0
],
"reference_image": [
"162",
0
],
"strength": 1,
"vae": [
"39",
0
],
"width": 720
},
"_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": [
"210",
2
],
"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"
}
},
"111": {
"class_type": "MaskToImage",
"inputs": {
"mask": [
"215",
1
]
},
"_meta": {
"title": "Convert Mask to Image"
}
},
"129": {
"class_type": "RepeatImageBatch",
"inputs": {
"amount": [
"211",
2
],
"image": [
"111",
0
]
},
"_meta": {
"title": "Repeat Image Batch"
}
},
"130": {
"class_type": "ImageToMask",
"inputs": {
"channel": "red",
"image": [
"129",
0
]
},
"_meta": {
"title": "Convert Image to Mask"
}
},
"140": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "wan2.1_vace_14B_fp16.safetensors",
"weight_dtype": "fp8_e4m3fn_fast"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"154": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "Wan21_CausVid_14B_T2V_lora_rank32.safetensors",
"model": [
"140",
0
],
"strength_model": 0.30000000000000004
},
"_meta": {
"title": "Load LoRA"
}
},
"162": {
"class_type": "LoadImage",
"inputs": {
"image": "api_bfl_flux_1_kontext_multiple_images_input_dog.jpg"
},
"_meta": {
"title": "Load Image"
}
},
"208": {
"class_type": "ImageCompositeMasked",
"inputs": {
"destination": [
"213",
0
],
"mask": [
"215",
1
],
"resize_source": True,
"source": [
"216",
0
],
"x": 0,
"y": 0
},
"_meta": {
"title": "Image Composite Masked"
}
},
"209": {
"class_type": "LoadVideo",
"inputs": {
"file": "video_wan_vace_inpainting_input_video.mp4"
},
"_meta": {
"title": "Load Video"
}
},
"210": {
"class_type": "GetVideoComponents",
"inputs": {
"video": [
"209",
0
]
},
"_meta": {
"title": "Get Video Components"
}
},
"211": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"210",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"213": {
"class_type": "RebatchImages",
"inputs": {
"batch_size": [
"211",
2
],
"images": [
"210",
0
]
},
"_meta": {
"title": "Rebatch Images"
}
},
"214": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"208",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"215": {
"class_type": "LoadImage",
"inputs": {
"image": "video_wan_vace_inpainting_1st_frame_and_mask.png"
},
"_meta": {
"title": "Load Image"
}
},
"216": {
"class_type": "MaskToImage",
"inputs": {
"mask": [
"219",
0
]
},
"_meta": {
"title": "Convert Mask to Image"
}
},
"219": {
"class_type": "InvertMask",
"inputs": {
"mask": [
"215",
1
]
},
"_meta": {
"title": "Invert Mask"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)問答
The workflow uses the Wan2.1 model, specifically the VACE-1.3B and VACE-14B models, for video inpainting tasks.
Yes, the VACE-1.3B model supports 480P resolution, while the VACE-14B model supports up to 720P resolution.
No, the workflow is designed using core nodes, so no additional custom nodes are required.
You can use the ImageToMask node to define the region you want to inpaint in the video.
相關工作流程
- Wan2.1, ChronoEdit, Nvidia
ChronoEdit 14B:圖像編輯
- Wan2.1, ChronoEdit, Nvidia
ChronoEdit 14B:圖像編輯
- Wan2.1, Wan
Wan 2.1 ControlNet
- Wan2.1, Wan
Wan 2.1 Fun Camera 1.3B
- Wan2.1, Wan
Wan 2.1 Fun Camera 14B
- Wan2.1, Wan
Wan 2.1 首尾幀影片 720p F16
- Wan2.1, Wan
Wan ATI
- Wan2.1, Wan
Wan VACE控制影片
- Wan2.1, Wan
Wan2.1 Alpha 文生影片
- Wan2.1, Wan
Wan2.1 VACE 參考生影片
- Wan2.1, Wan
Wan2.1 VACE 擴圖
- Wan2.1, Wan
Wan2.1 VACE 文生影片