Herhangi bir Nesneyi Değiştir
Bir VİDEO içindeki belirli nesneleri maskelemek için basit bir istem kullanın ve nesneyi istem veya isteğe bağlı referans görüntü kullanarak değiştirin. Kullanılan model: SAM3 + WAN 2.1 VACE inpainting
İş akışının içinde
Kaynak şablonun salt okunur önizlemesi. Düğümleri incelemek ve değişiklik yapmak için Cloud'da açın.
Loading the graph
Open full-size workflow previewBu iş akışındaki dosyalar
- Çıktı
- Video
- Yazar
- ComfyUI
Bu modeli kodunuzdan çağırın
Aşağıdaki istek, Playground ile aynı hazırlanmış grafiği ve ayarları kullanır. Her gönderim ücretli bir çalıştırma başlatabilir; sonucu bilinmeyen bir gönderimi otomatik olarak yeniden denemeyin.
What you need
- Runs on
- Comfy Cloud
- Anahtar
- COMFY_API_KEY
- Dosyalarınız
- Kod tarafından URL'lerinden yüklenir
Ücretli bir Cloud planı ve kredi gerektirir.
# 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({
"162": {
"class_type": "INTConstant",
"inputs": {
"value": 1280
},
"_meta": {
"title": "Width"
}
},
"163": {
"class_type": "INTConstant",
"inputs": {
"value": 720
},
"_meta": {
"title": "Height"
}
},
"164": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 19,
"filename_prefix": "VaceControl",
"format": "video/h264-mp4",
"frame_rate": 30,
"images": [
"197",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "Video Combine 🎥🅥🅗🅢"
}
},
"165": {
"class_type": "INTConstant",
"inputs": {
"value": 89
},
"_meta": {
"title": "Length"
}
},
"166": {
"class_type": "WanVideoDecode",
"inputs": {
"enable_vae_tiling": False,
"normalization": "default",
"samples": [
"173",
0
],
"tile_stride_x": 144,
"tile_stride_y": 128,
"tile_x": 272,
"tile_y": 272,
"vae": [
"171",
0
]
},
"_meta": {
"title": "WanVideo Decode"
}
},
"167": {
"class_type": "WanVideoTextEncode",
"inputs": {
"device": "gpu",
"force_offload": True,
"model_to_offload": [
"169",
0
],
"negative_prompt": "bad quality, blurry, messy, chaotic",
"positive_prompt": "A chef in a dark industrial kitchen holds a single ripe pomegranate up at chest height toward the camera, slowly turning it in his fingers to show it off. The pomegranate is deep crimson with russet and gold patches on its leathery rind and a small dry crown on top, sitting naturally in his hand with his fingers wrapped around it. He smiles and talks about it while rain streams down the tall steel-framed windows behind him. Cool blue window light falls across the stainless steel counters, and the red fruit glows as the one warm colour in the frame. Natural shadows and reflections on the fruit, consistent size and shape in every frame, realistic texture, smooth natural motion.",
"t5": [
"172",
0
],
"use_disk_cache": False
},
"_meta": {
"title": "WanVideo TextEncode"
}
},
"168": {
"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"
}
},
"169": {
"class_type": "WanVideoModelLoader",
"inputs": {
"attention_mode": "sdpa",
"base_precision": "bf16",
"compile_args": [
"168",
0
],
"load_device": "offload_device",
"lora": [
"181",
0
],
"model": "wan2.1_vace_14B_fp16.safetensors",
"quantization": "disabled",
"rms_norm_function": "default"
},
"_meta": {
"title": "WanVideo Model Loader"
}
},
"171": {
"class_type": "WanVideoVAELoader",
"inputs": {
"model_name": "Wan2_1_VAE_bf16.safetensors",
"precision": "bf16",
"use_cpu_cache": False,
"verbose": False
},
"_meta": {
"title": "WanVideo VAE Loader"
}
},
"172": {
"class_type": "LoadWanVideoT5TextEncoder",
"inputs": {
"load_device": "offload_device",
"model_name": "umt5-xxl-enc-bf16.safetensors",
"precision": "bf16",
"quantization": "disabled"
},
"_meta": {
"title": "WanVideo T5 Text Encoder Loader"
}
},
"173": {
"class_type": "WanVideoSampler",
"inputs": {
"add_noise_to_samples": False,
"batched_cfg": False,
"cfg": 1.0000000000000002,
"denoise_strength": 1,
"end_step": -1,
"experimental_args": [
"174",
0
],
"force_offload": True,
"image_embeds": [
"176",
0
],
"model": [
"169",
0
],
"riflex_freq_index": 0,
"rope_function": "comfy",
"scheduler": "unipc",
"seed": 18,
"shift": 3.0000000000000004,
"slg_args": [
"175",
0
],
"start_step": 0,
"steps": 8,
"text_embeds": [
"167",
0
]
},
"_meta": {
"title": "WanVideo Sampler"
}
},
"174": {
"class_type": "WanVideoExperimentalArgs",
"inputs": {
"bidirectional_sampling": False,
"cfg_zero_star": True,
"fresca_freq_cutoff": 20,
"fresca_scale_high": 1.25,
"fresca_scale_low": 1,
"raag_alpha": 0,
"temporal_score_rescaling": False,
"tsr_k": 0.95,
"tsr_sigma": 1,
"use_fresca": False,
"use_tcfg": False,
"use_zero_init": False,
"video_attention_split_steps": "",
"zero_star_steps": 0
},
"_meta": {
"title": "WanVideo Experimental Args"
}
},
"175": {
"class_type": "WanVideoSLG",
"inputs": {
"blocks": "8",
"end_percent": 0.7000000000000002,
"start_percent": 0.30000000000000004
},
"_meta": {
"title": "WanVideo SLG"
}
},
"176": {
"class_type": "WanVideoVACEEncode",
"inputs": {
"height": [
"163",
0
],
"input_frames": [
"196",
0
],
"input_masks": [
"199",
0
],
"num_frames": [
"165",
0
],
"ref_images": [
"204",
0
],
"strength": 1,
"tiled_vae": False,
"vace_end_percent": 1,
"vace_start_percent": 0,
"vae": [
"171",
0
],
"width": [
"162",
0
]
},
"_meta": {
"title": "WanVideo VACE Encode"
}
},
"181": {
"class_type": "WanVideoLoraSelect",
"inputs": {
"lora": "Wan21_CausVid_14B_T2V_lora_rank32_v2.safetensors",
"low_mem_load": False,
"merge_loras": True,
"strength": 0.7
},
"_meta": {
"title": "WanVideo Lora Select"
}
},
"183": {
"class_type": "SAM3Propagate",
"inputs": {
"direction": "both",
"end_frame": -1,
"offload_model": False,
"sam3_model": [
"192",
0
],
"start_frame": 0,
"video_state": [
"191",
0
]
},
"_meta": {
"title": "SAM3 Propagate"
}
},
"184": {
"class_type": "SAM3VideoOutput",
"inputs": {
"masks": [
"183",
0
],
"obj_id": -1,
"plot_all_masks": True,
"scores": [
"183",
1
],
"video_state": [
"183",
2
]
},
"_meta": {
"title": "SAM3 Video Output"
}
},
"186": {
"class_type": "ImageResize+",
"inputs": {
"condition": "always",
"height": [
"163",
0
],
"image": [
"187",
0
],
"interpolation": "nearest",
"method": "stretch",
"multiple_of": 0,
"width": [
"162",
0
]
},
"_meta": {
"title": "🔧 Image Resize"
}
},
"187": {
"class_type": "VHS_LoadVideo",
"inputs": {
"custom_height": 0,
"custom_width": 0,
"force_rate": 0,
"format": "AnimateDiff",
"frame_load_cap": [
"165",
0
],
"select_every_nth": 1,
"skip_first_frames": 0,
"video": "UPLOADED_video_FILENAME"
},
"_meta": {
"title": "Input Video"
}
},
"191": {
"class_type": "SAM3VideoSegmentation",
"inputs": {
"frame_idx": 0,
"prompt_mode": "text",
"score_threshold": 0.3,
"text_prompt": [
"194",
0
],
"video_frames": [
"186",
0
]
},
"_meta": {
"title": "SAM3 Video Segmentation"
}
},
"192": {
"class_type": "LoadSAM3Model",
"inputs": {
"model_path": "models/sam3/sam3.pt"
},
"_meta": {
"title": "(down)Load SAM3 Model"
}
},
"194": {
"class_type": "TextBox1",
"inputs": {
"text1": "lemon"
},
"_meta": {
"title": "Object Prompt"
}
},
"195": {
"class_type": "ImageConstant",
"inputs": {
"batch_size": [
"165",
0
],
"blue": 1,
"green": 1,
"height": [
"163",
0
],
"red": 1,
"width": [
"162",
0
]
},
"_meta": {
"title": "Image Constant Color (RGB)"
}
},
"196": {
"class_type": "ImageCompositeMasked",
"inputs": {
"destination": [
"186",
0
],
"mask": [
"199",
0
],
"resize_source": False,
"source": [
"195",
0
],
"x": 0,
"y": 0
},
"_meta": {
"title": "Image Composite Masked"
}
},
"197": {
"class_type": "ImageCompositeMasked",
"inputs": {
"destination": [
"186",
0
],
"mask": [
"198",
0
],
"resize_source": False,
"source": [
"166",
0
],
"x": 0,
"y": 0
},
"_meta": {
"title": "Image Composite Masked"
}
},
"198": {
"class_type": "MaskBlur+",
"inputs": {
"amount": 3,
"device": "auto",
"mask": [
"203",
0
]
},
"_meta": {
"title": "🔧 Mask Blur"
}
},
"199": {
"class_type": "MaskBlur+",
"inputs": {
"amount": 3,
"device": "auto",
"mask": [
"203",
0
]
},
"_meta": {
"title": "🔧 Mask Blur"
}
},
"201": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 19,
"filename_prefix": "RotoPreview",
"format": "video/h264-mp4",
"frame_rate": 30,
"images": [
"196",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": False,
"trim_to_audio": False
},
"_meta": {
"title": "Output Visualization2"
}
},
"203": {
"class_type": "GrowMaskWithBlur",
"inputs": {
"blur_radius": 0,
"decay_factor": 1,
"expand": 10,
"fill_holes": False,
"flip_input": False,
"incremental_expandrate": 0,
"lerp_alpha": 1,
"mask": [
"184",
0
],
"tapered_corners": True
},
"_meta": {
"title": "Grow Mask With Blur"
}
},
"204": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_reference_FILENAME"
},
"_meta": {
"title": "Load Image"
}
}
})
workflow.set_input("204", "image", client.assets.from_url("https://comfy.org/catalog-media/7284411e-bc60-426f-83a4-401af0db04c6/cc74a266-933e-4da1-aa2e-55f384c955c8"))
workflow.set_input("187", "video", client.assets.from_url("https://comfy.org/catalog-media/d02af599-bed5-4f46-ba0f-e7e1a59270cd/86b7c191-e0f6-42e1-bf85-d0faecb4130f"))
# 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("164"):
output.to_file(output.name)Bir örnek deneyin
Bu iş akışı hakkında
'Herhangi Bir Nesneyi Değiştir' iş akışı, ComfyUI'de kullanıcıların basit metin komutları veya isteğe bağlı referans görselleriyle bir videodaki nesneleri sorunsuzca değiştirmesini sağlar. Bu iş akışı, SAM3 ve Wan2.1 VACE gibi gelişmiş inpainting tekniklerini kullanarak hassas nesne maskeleme ve değiştirme işlemleri gerçekleştirir. Süreç, VHS_LoadVideo ve WanVideoDecode gibi düğümlerle video girişlerinin yüklenmesi ve gerekli yapılandırmaların yapılmasıyla başlar. SAM3 modeli, video segmentasyonu ve nesne maskeleme için kritik öneme sahiptir; kullanıcılar, hangi nesnelerin değiştirileceğini sezgisel komutlarla belirtebilir. Nesneler belirlendikten sonra, Wan2.1 VACE modeli devreye girerek bu nesneleri kullanıcının komutlarından veya referans görsellerinden türetilen yeni içerikle değiştirir. Bu model ve düğüm kombinasyonu, manuel düzenleme gerektirmeden yaratıcı video düzenlemeleri için güçlü bir araç sunar.
Sorular ve yanıtlar
SAM3 modeliyle net şekilde segmentlenebilen herhangi bir nesne değiştirilebilir. Etkinlik, nesnenin netliğine ve videonun kalitesine bağlıdır.
Hayır, önceden deneyim gerekmez. İş akışı kullanıcı dostu olacak şekilde tasarlanmıştır; sezgisel düğümler ve komutlar süreci yönlendirir.
Bu iş akışı, önceden kaydedilmiş video dosyaları için post-prodüksiyon düzenlemeleri içindir; canlı video akışlarını işlemez.
İş akışı, hem giriş hem de çıkış için MP4 ve AVI gibi yaygın video formatlarını destekler; bu da çoğu video düzenleme yazılımıyla uyumluluk sağlar.
İlgili iş akışları
- SSAM3
SAM3 - Prompt ile Arka Plan Kaldırma
- Seedance 2.5
Change a video’s background
- LTX-2.3
Remove an object from a video
- LTX-2.3
Expand a video’s frame
- SSCAIL-2
Replace a character in a video
- SSeedVR2
Upscale a video
- LTX-2.3
Restore archival footage
- İş ortağı düğümü
AI on the Lot 2026_LTX-2.3_IC LoRA (Union Control)
- Wan2.2, Z-Image-Turbo
AIrt MAchIne
- İş ortağı düğümü
Arşiv Görüntüsünü Onar - LTX 2.3 Dearchive LoRA
- İİş ortağı düğümü
Beeble SwitchX: Video Düzenleme
- BRIA
Bria: Video Arka Planı Kaldır