Bernini-R: Video Edit
Re-light and restage a clip without changing its motion: Bernini-R edits the footage frame by frame from a written instruction.
ワークフローの内部
ソーステンプレートの読み取り専用プレビューです。Cloud で開くと、ノードを確認して変更できます。
Loading the graph
Open full-size workflow previewコードからこのモデルを呼び出す
以下のリクエストでは、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({
"46": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/Bernini_r",
"format": "auto",
"format.codec": "auto",
"video": [
"298:274",
0
]
},
"_meta": {
"title": "Save Video"
}
},
"47": {
"class_type": "LoadVideo",
"inputs": {
"file": "UPLOADED_video_FILENAME"
},
"_meta": {
"title": "Load Video"
}
},
"100": {
"class_type": "BatchImagesNode",
"inputs": {
"images.image0": [
"104",
0
]
},
"_meta": {
"title": "Batch Images"
}
},
"104": {
"class_type": "LoadImage",
"inputs": {
"image": "example.png"
},
"_meta": {
"title": "Load Image"
}
},
"109": {
"class_type": "Video Slice",
"inputs": {
"duration": 5,
"start_time": 0,
"strict_duration": False,
"video": [
"47",
0
]
},
"_meta": {
"title": "Trim Video"
}
},
"110": {
"class_type": "GetVideoComponents",
"inputs": {
"video": [
"109",
0
]
},
"_meta": {
"title": "Get Video Components"
}
},
"111": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"110",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"112": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"111",
2
]
},
"_meta": {
"title": "Preview as Text (Frame Count)"
}
},
"298:264": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
"device": "default",
"type": "wan"
},
"_meta": {
"title": "Load CLIP"
}
},
"298:265": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "Wan2_1_VAE_bf16.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"298:266": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank64_bf16.safetensors",
"model": [
"298:272",
0
],
"strength_model": 1.5
},
"_meta": {
"title": "Load LoRA"
}
},
"298:267": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"298:264",
0
],
"text": "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走"
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"298:268": {
"class_type": "SplitSigmas",
"inputs": {
"sigmas": [
"298:276",
0
],
"step": [
"298:290",
0
]
},
"_meta": {
"title": "SplitSigmas"
}
},
"298:269": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "res_multistep"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"298:270": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "wan2.2_bernini_r_high_noise_fp8_scaled.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"298:271": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank64_bf16.safetensors",
"model": [
"298:270",
0
],
"strength_model": 3
},
"_meta": {
"title": "Load LoRA"
}
},
"298:272": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "wan2.2_bernini_r_low_noise_fp8_scaled.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"298:273": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"298:277",
0
],
"vae": [
"298:265",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"298:274": {
"class_type": "CreateVideo",
"inputs": {
"audio": [
"298:279",
1
],
"bit_depth": 8,
"chroma_subsampling": "auto",
"codec": "none",
"color_space": "sRGB",
"fps": [
"298:279",
2
],
"images": [
"298:273",
0
]
},
"_meta": {
"title": "Create Video"
}
},
"298:275": {
"class_type": "SamplerCustom",
"inputs": {
"add_noise": True,
"cfg": [
"298:291",
0
],
"latent_image": [
"298:278",
2
],
"model": [
"298:295",
0
],
"negative": [
"298:278",
1
],
"noise_seed": 852303761886160,
"positive": [
"298:278",
0
],
"sampler": [
"298:269",
0
],
"sigmas": [
"298:268",
0
]
},
"_meta": {
"title": "SamplerCustom"
}
},
"298:276": {
"class_type": "BasicScheduler",
"inputs": {
"denoise": 1,
"model": [
"298:272",
0
],
"scheduler": "simple",
"steps": [
"298:287",
0
]
},
"_meta": {
"title": "BasicScheduler"
}
},
"298:277": {
"class_type": "SamplerCustom",
"inputs": {
"add_noise": False,
"cfg": [
"298:291",
0
],
"latent_image": [
"298:275",
0
],
"model": [
"298:281",
0
],
"negative": [
"298:278",
1
],
"noise_seed": 0,
"positive": [
"298:278",
0
],
"sampler": [
"298:269",
0
],
"sigmas": [
"298:268",
1
]
},
"_meta": {
"title": "SamplerCustom"
}
},
"298:278": {
"class_type": "BerniniConditioning",
"inputs": {
"batch_size": 1,
"height": 832,
"length": [
"111",
2
],
"negative": [
"298:267",
0
],
"positive": [
"298:280",
0
],
"ref_max_size": 848,
"source_video": [
"298:279",
0
],
"vae": [
"298:265",
0
],
"width": 480
},
"_meta": {
"title": "Bernini Conditioning"
}
},
"298:279": {
"class_type": "GetVideoComponents",
"inputs": {
"video": [
"109",
0
]
},
"_meta": {
"title": "Get Video Components"
}
},
"298:280": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"298:264",
0
],
"text": [
"298:284",
0
]
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"298:281": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"298:272",
0
],
"on_true": [
"298:266",
0
],
"switch": [
"298:294",
0
]
},
"_meta": {
"title": "Switch (Low Noise)"
}
},
"298:282": {
"class_type": "CustomCombo",
"inputs": {
"choice": "Video Editing (Content Propagation)"
},
"_meta": {
"title": "Custom Combo"
}
},
"298:283:1": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"298:283:56",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"298:283:2": {
"class_type": "RegexExtract",
"inputs": {
"case_insensitive": False,
"dotall": False,
"group_index": 1,
"mode": "First Group",
"multiline": False,
"regex_pattern": [
"298:283:8",
0
],
"string": "You are a helpful assistant.\nYou are a helpful assistant specialized in text-to-image generation.\nYou are a helpful assistant specialized in text-to-video generation.\nYou are a helpful assistant specialized in image editing.\nYou are a helpful assistant specialized in subject-to-image generation.\nYou are a helpful assistant specialized in image-to-video generation.\nYou are a helpful assistant specialized in video editing.\nYou are a helpful assistant specialized in video editing on content propagation.\nYou are a helpful assistant specialized in video editing with reference.\nYou are a helpful assistant specialized in ads insertion.\nYou are a helpful assistant for editing. You may need to adjust the subject's action or position.\nYou are a helpful assistant for editing. You might need to adjust the video's style, lighting, colors, textures, and the subject's pose or action."
},
"_meta": {
"title": "Extract Text"
}
},
"298:283:56": {
"class_type": "PrimitiveInt",
"inputs": {
"value": [
"298:282",
1
]
},
"_meta": {
"title": "Int (line index)"
}
},
"298:283:8": {
"class_type": "StringReplace",
"inputs": {
"find": "index",
"replace": [
"298:283:1",
0
],
"string": "^(?:[^\\n]*\\n){index}([^\\n]*)(?:\\n|$)"
},
"_meta": {
"title": "Replace Text"
}
},
"298:284": {
"class_type": "StringConcatenate",
"inputs": {
"delimiter": "",
"string_a": [
"298:283:2",
0
],
"string_b": [
"298:297",
0
]
},
"_meta": {
"title": "Concatenate Text"
}
},
"298:285": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 40
},
"_meta": {
"title": "Int (Steps)"
}
},
"298:286": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 6
},
"_meta": {
"title": "Int (Steps)"
}
},
"298:287": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"298:285",
0
],
"on_true": [
"298:286",
0
],
"switch": [
"298:294",
0
]
},
"_meta": {
"title": "Switch (Steps)"
}
},
"298:288": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 20
},
"_meta": {
"title": "Int (Split Steps)"
}
},
"298:289": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 3
},
"_meta": {
"title": "Int (Split Steps)"
}
},
"298:290": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"298:288",
0
],
"on_true": [
"298:289",
0
],
"switch": [
"298:294",
0
]
},
"_meta": {
"title": "Switch (Low Steps)"
}
},
"298:291": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"298:293",
0
],
"on_true": [
"298:292",
0
],
"switch": [
"298:294",
0
]
},
"_meta": {
"title": "Switch (CFG)"
}
},
"298:292": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 1
},
"_meta": {
"title": "Float (CFG)"
}
},
"298:293": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 5
},
"_meta": {
"title": "Float (CFG)"
}
},
"298:294": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": True
},
"_meta": {
"title": "Boolean (Enable Turbo LoRA?)"
}
},
"298:295": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"298:270",
0
],
"on_true": [
"298:271",
0
],
"switch": [
"298:294",
0
]
},
"_meta": {
"title": "Switch (High Noise)"
}
},
"298:297": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "Replace the gray studio backdrop with a daytime urban street: brick buildings, shop windows, sidewalk, and soft overcast light. Keep the model's outfit, accessories, body pose, motion, and full-body framing unchanged. Only the environment behind the subject should change."
},
"_meta": {
"title": "Text (Multiline)"
}
}
})
workflow.set_input("47", "file", client.assets.from_url("https://comfy.org/catalog-media/60559cc3-b784-4e3f-867d-cd7dc9ff4c61/37533ceb-eb4f-4196-8dd7-cc098ca750a8"))
# 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("46"):
output.to_file(output.name)例を試す
このワークフローについて
Bernini-R edits footage instead of regenerating it: the source clip is carried into the conditioning as the motion and structure reference, and the prompt changes what fills it — a grey studio backdrop becomes a daytime street, an interior becomes night. Because the timing comes from the source, people keep walking the way they walked and the camera keeps its move; only the scene around them is re-rendered, with the new light falling consistently on the subject. The template slices the first 5 seconds, runs a distilled two-stage sampler at 3 steps, and writes an mp4 with the source audio. Width and height are fixed at 480x832 in the graph rather than inherited from the clip, so a source in another shape is fitted rather than cropped.
Graph: LoadVideo -> Video Slice (0-5 s) -> GetVideoComponents -> BerniniConditioning (source video, length from the slice) -> two-stage SamplerCustom (3 steps, res_multistep) -> VAEDecode -> CreateVideo -> SaveVideo (mp4).