Substituição de Céu
Um fluxo de trabalho ComfyUI para substituição rápida e pronta para produção de céus em vídeos usando modelos Wan.
Dentro do workflow
Uma prévia somente leitura do modelo de origem. Abra-o no Cloud para explorar os nós e fazer alterações.
Loading the graph
Open full-size workflow previewChame este modelo pelo seu código
A solicitação abaixo usa o mesmo grafo e as mesmas configurações preparadas no Playground. Cada envio pode iniciar uma execução paga; não tente novamente automaticamente um envio cujo resultado seja desconhecido.
What you need
- Runs on
- Comfy Cloud
- Chave
- COMFY_API_KEY
- Seus arquivos
- Enviados pelo código a partir de suas URLs
Requer um plano pago do Cloud e créditos.
# 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"
}
},
"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": [
"1295",
0
],
"ratio": 0.5,
"strength_1": 1,
"strength_2": 1,
"tiles": 0
},
"_meta": {
"title": "WanVideo ClipVision Encode"
}
},
"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": [
"1240",
0
],
"model": [
"979",
0
],
"riflex_freq_index": 0,
"rope_function": "comfy",
"scheduler": "dpm++_sde/beta",
"seed": 65346457346,
"shift": 6,
"start_step": 0,
"steps": 6,
"text_embeds": [
"982",
0
],
"uni3c_embeds": [
"1231",
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": [
"1201",
0
],
"precision": "bf16",
"quantization": "disabled",
"use_disk_cache": False
},
"_meta": {
"title": "WanVideo TextEncode Cached"
}
},
"1099": {
"class_type": "VHS_VideoInfoLoaded",
"inputs": {
"video_info": [
"1313",
3
]
},
"_meta": {
"title": "Video Info (Loaded) 🎥🅥🅗🅢"
}
},
"1181": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"1295",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"1201": {
"class_type": "AILab_QwenVL",
"inputs": {
"attention_mode": "sdpa",
"custom_prompt": "Create a video prompt for this image. AI video model Wan2.2. Only respond with the video prompt and nothing else.",
"image": [
"1295",
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"
}
},
"1231": {
"class_type": "WanVideoUni3C_embeds",
"inputs": {
"controlnet": [
"1232",
0
],
"end_percent": 1,
"offload": True,
"render_latent": [
"1233",
0
],
"start_percent": 0,
"strength": 1
},
"_meta": {
"title": "WanVideo Uni3C Embeds"
}
},
"1232": {
"class_type": "WanVideoUni3C_ControlnetLoader",
"inputs": {
"attention_mode": "sdpa",
"base_precision": "fp16",
"load_device": "main_device",
"model": "Wan21_Uni3C_controlnet_fp16.safetensors",
"quantization": "disabled"
},
"_meta": {
"title": "WanVideo Uni3C Controlnet Loader"
}
},
"1233": {
"class_type": "WanVideoEncode",
"inputs": {
"enable_vae_tiling": False,
"image": [
"1313",
0
],
"latent_strength": 1,
"noise_aug_strength": 0,
"tile_stride_x": 144,
"tile_stride_y": 128,
"tile_x": 272,
"tile_y": 272,
"vae": [
"38",
0
]
},
"_meta": {
"title": "WanVideo Encode"
}
},
"1240": {
"class_type": "WanVideoImageToVideoEncode",
"inputs": {
"augment_empty_frames": 0,
"clip_embeds": [
"936",
0
],
"end_latent_strength": 1,
"force_offload": True,
"fun_or_fl2v_model": False,
"height": [
"1300",
0
],
"noise_aug_strength": 0,
"num_frames": [
"1099",
1
],
"start_image": [
"1295",
0
],
"start_latent_strength": 1,
"tiled_vae": False,
"vae": [
"38",
0
],
"width": [
"1299",
0
]
},
"_meta": {
"title": "WanVideo ImageToVideo Encode"
}
},
"1281": {
"class_type": "GeminiImage2Node",
"inputs": {
"aspect_ratio": "auto",
"images": [
"1314",
0
],
"model": "gemini-3-pro-image-preview",
"prompt": "Replace only the flat, pale sky with a dramatic late-afternoon summer storm rolling in over the steppe. Towering anvil-shaped thunderheads in deep slate blue and bruised violet fill the upper half, their edges lit gold by a low sun breaking through a gap near the horizon. Long shafts of warm light fan down through the clouds, and a faint veil of distant rain hangs over the far left of the horizon. Relight the ground to match the new sky: warm golden light grazing across the cracked earth and grass tufts, with long soft shadows and a cooler, darker tone where cloud shadows fall. Keep the horizon line, the terrain, every pebble and every grass tuft exactly where they are. It must look like a natural photograph, not a composite.",
"resolution": "1K",
"response_modalities": "IMAGE",
"seed": 1085497317911772,
"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."
},
"_meta": {
"title": "Nano Banana Pro (Google Gemini Image)"
}
},
"1285": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"1281",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"1295": {
"class_type": "ImageScale",
"inputs": {
"crop": "disabled",
"height": [
"1300",
0
],
"image": [
"1281",
0
],
"upscale_method": "nearest-exact",
"width": [
"1299",
0
]
},
"_meta": {
"title": "Upscale Image"
}
},
"1299": {
"class_type": "INTConstant",
"inputs": {
"value": 1280
},
"_meta": {
"title": "width"
}
},
"1300": {
"class_type": "INTConstant",
"inputs": {
"value": 704
},
"_meta": {
"title": "height"
}
},
"1312": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"1201",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"1313": {
"class_type": "VHS_LoadVideoFFmpeg",
"inputs": {
"custom_height": [
"1300",
0
],
"custom_width": [
"1299",
0
],
"force_rate": 0,
"format": "Wan",
"frame_load_cap": 0,
"start_time": 0,
"video": "UPLOADED_video_FILENAME"
},
"_meta": {
"title": "Load Video FFmpeg (Upload) 🎥🅥🅗🅢"
}
},
"1314": {
"class_type": "ImageFromBatch",
"inputs": {
"batch_index": 0,
"image": [
"1313",
0
],
"length": 1
},
"_meta": {
"title": "Get Image from Batch"
}
},
"1316": {
"class_type": "VHS_VideoCombine",
"inputs": {
"audio": [
"1313",
2
],
"crf": 22,
"filename_prefix": "SkyReplacement",
"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 🎥🅥🅗🅢"
}
}
})
workflow.set_input("1313", "video", client.assets.from_url("https://comfy.org/catalog-media/237f4ae8-62d2-483b-a47b-10a35332ffb3/e47c4ffb-b061-4cde-bc56-fdaac2d38528"))
# 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("1316"):
output.to_file(output.name)Experimente um exemplo
Sobre este fluxo de trabalho
Este fluxo de trabalho ComfyUI foi projetado para substituição de céus em vídeos de forma fluida, utilizando modelos avançados de IA da Wan. Utilizando nós como WanVideoVAELoader e WanVideoModelLoader, o fluxo carrega e processa vídeos de forma eficiente. O núcleo da técnica envolve o uso dos nós WanVideoSampler e WanVideoDecode para sintetizar e integrar novos céus ao vídeo original. O diferencial deste fluxo é manter alta qualidade de produção, garantindo que os novos céus se misturem naturalmente ao conteúdo original. O fluxo também incorpora os nós CLIPVisionLoader e WanVideoClipVisionEncode para aprimorar a compreensão semântica do vídeo, garantindo que a substituição do céu seja contextualizada. Isso torna o fluxo especialmente útil para cineastas e criadores de conteúdo que desejam aprimorar seus vídeos com mudanças dinâmicas de céu sem perder qualidade.
Perguntas e respostas
O fluxo suporta formatos comuns como MP4 e MOV. Certifique-se de que seu vídeo seja compatível com o nó WanVideoVAELoader para melhores resultados.
Sim, você pode personalizar o céu usando o nó WanVideoTextEncodeCached para inserir prompts específicos ou selecionar modelos de céu pré-definidos.
O fluxo utiliza os nós CLIPVisionLoader e WanVideoClipVisionEncode para analisar o contexto do vídeo, garantindo que a substituição do céu seja semanticamente consistente com a cena.
Sim, o fluxo foi projetado para lidar com filmagens live-action de forma eficaz, mantendo alta qualidade mesmo em cenas complexas.