모든 객체 변경
간단한 프롬프트를 사용하여 비디오 내 특정 객체를 마스크하고, 프롬프트 또는 선택적 레퍼런스 이미지를 사용하여 객체를 교체합니다. 사용 모델: SAM3 + WAN 2.1 VACE 인페인팅
워크플로 내부
소스 템플릿의 읽기 전용 미리보기입니다. Cloud에서 열어 노드를 살펴보고 변경할 수 있습니다.
코드에서 이 모델 호출하기
아래 요청은 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({
"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)예시 사용해 보기
이 워크플로 정보
ComfyUI의 'Change Any Objects' 워크플로는 간단한 텍스트 프롬프트 또는 선택적 참조 이미지를 사용해 비디오 안의 오브젝트를 교체하거나 변경할 수 있도록 설계되었습니다. 이 워크플로는 SAM3 및 Wan2.1 VACE 같은 모델을 활용한 고급 인페인팅 기법으로, 정확한 오브젝트 마스킹과 교체를 수행합니다. 과정은 VHS_LoadVideo 및 WanVideoDecode 같은 노드를 사용해 비디오 입력을 로딩하고 필요한 설정을 구성하는 것에서 시작합니다. SAM3 모델은 비디오 세그먼테이션과 오브젝트 마스킹에서 핵심 역할을 하며, 사용자가 직관적인 프롬프트로 변경할 오브젝트를 지정할 수 있게 합니다. 오브젝트가 식별되면 Wan2.1 VACE 모델이 사용자의 프롬프트 또는 참조 이미지에서 유도된 새로운 콘텐츠로 해당 영역을 인페인팅하여 교체합니다. 이러한 모델 및 노드 조합은 광범위한 수동 편집 없이도 창의적인 변환을 가능하게 하는 비디오 편집 도구를 제공합니다.
질문과 답변
SAM3 모델이 명확하게 세그먼트할 수 있는 오브젝트라면 교체할 수 있습니다. 효과는 오브젝트의 선명도와 비디오 품질에 따라 달라집니다.
사전 경험은 필요하지 않습니다. 워크플로는 사용자 친화적으로 설계되어, 직관적인 노드와 프롬프트가 과정을 안내합니다.
이 워크플로는 후반 작업용입니다. 라이브 스트림이 아니라 사전 녹화된 비디오 파일을 처리합니다.
입력과 출력 모두 MP4, AVI 같은 일반적인 비디오 형식을 지원해 대부분의 비디오 편집 소프트웨어와 호환됩니다.
관련 워크플로
- SSAM3
SAM3 - 프롬프트로 배경 제거
- 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
- 파트너 노드
AI on the Lot 2026_LTX-2.3_IC LoRA (Union Control)
- Wan2.2, Z-Image-Turbo
AIrt MAchIne
- 파파트너 노드
Beeble SwitchX: 비디오 편집
- BRIA
Bria: 비디오 배경 제거
- CCapybara
Capybara:비디오 편집