Expand a video’s frame
Extend footage into a wider or taller frame while preserving the original action.
下载工作流在 Cloud 中试用 API 文档
00:00
查看工作流内部
源模板的只读预览。在 Cloud 中打开,即可查看节点并进行修改。
Loading the graph
Open full-size workflow preview- 作者
- Purz
从代码中调用该模型
以下请求使用与体验区相同的预设图和设置。每次提交都可能开始一次付费运行;如果提交结果未知,请勿自动重试。
1 获取 API 密钥 ↗
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({
"5060": {
"class_type": "VHS_LoadVideo",
"inputs": {
"custom_height": 0,
"custom_width": 0,
"force_rate": 0,
"format": "AnimateDiff",
"frame_load_cap": 0,
"select_every_nth": 1,
"skip_first_frames": 0,
"video": "UPLOADED_video_FILENAME"
},
"_meta": {
"title": "Load Video (Upload) 🎥🅥🅗🅢"
}
},
"5069": {
"class_type": "VHS_VideoCombine",
"inputs": {
"audio": [
"5060",
2
],
"crf": 13,
"filename_prefix": "outpaint_comparison",
"format": "video/h264-mp4",
"frame_rate": [
"5151:5137",
5
],
"images": [
"5151:5125",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "video_compare"
}
},
"5152": {
"class_type": "VHS_VideoCombine",
"inputs": {
"audio": [
"5060",
2
],
"crf": 13,
"filename_prefix": "outpaint_output",
"format": "video/h264-mp4",
"frame_rate": [
"5151:5137",
5
],
"images": [
"5151:5143",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "video_output"
}
},
"5151:5097": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 9
},
"_meta": {
"title": "target_aspect_w"
}
},
"5151:5098": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 16
},
"_meta": {
"title": "target_aspect_h"
}
},
"5151:5110": {
"class_type": "LTXVConditioning",
"inputs": {
"frame_rate": [
"5151:5137",
5
],
"negative": [
"5151:5131",
0
],
"positive": [
"5151:5138",
0
]
},
"_meta": {
"title": "LTXVConditioning"
}
},
"5151:5111": {
"class_type": "LTXVConcatAVLatent",
"inputs": {
"audio_latent": [
"5151:5121",
0
],
"video_latent": [
"5151:5142",
2
]
},
"_meta": {
"title": "Concat AV Latent"
}
},
"5151:5112": {
"class_type": "EmptyLTXVLatentVideo",
"inputs": {
"batch_size": 1,
"height": [
"5151:5126",
1
],
"length": [
"5151:5126",
2
],
"width": [
"5151:5126",
0
]
},
"_meta": {
"title": "Empty LTXV Latent Video"
}
},
"5151:5113": {
"class_type": "LTXVCropGuides",
"inputs": {
"latent": [
"5151:5114",
0
],
"negative": [
"5151:5142",
1
],
"positive": [
"5151:5142",
0
]
},
"_meta": {
"title": "LTXVCropGuides"
}
},
"5151:5114": {
"class_type": "LTXVSeparateAVLatent",
"inputs": {
"av_latent": [
"5151:5122",
0
]
},
"_meta": {
"title": "Separate AV Latent"
}
},
"5151:5115": {
"class_type": "CM_FloatToInt",
"inputs": {
"a": [
"5151:5137",
5
]
},
"_meta": {
"title": "FloatToInt"
}
},
"5151:5116": {
"class_type": "CFGGuider",
"inputs": {
"cfg": 1,
"model": [
"5151:5146",
0
],
"negative": [
"5151:5142",
1
],
"positive": [
"5151:5142",
0
]
},
"_meta": {
"title": "CFG Guider"
}
},
"5151:5117": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 617176731516609
},
"_meta": {
"title": "RandomNoise"
}
},
"5151:5118": {
"class_type": "ManualSigmas",
"inputs": {
"sigmas": "1.0, 0.99375, 0.9875, 0.98125, 0.975, 0.909375, 0.725, 0.421875, 0.0"
},
"_meta": {
"title": "ManualSigmas"
}
},
"5151:5119": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler_ancestral"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"5151:5121": {
"class_type": "LTXVEmptyLatentAudio",
"inputs": {
"audio_vae": [
"5151:5132",
0
],
"batch_size": 1,
"frame_rate": [
"5151:5115",
0
],
"frames_number": [
"5060",
1
]
},
"_meta": {
"title": "Empty LTXV Latent Audio"
}
},
"5151:5122": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"5151:5116",
0
],
"latent_image": [
"5151:5111",
0
],
"noise": [
"5151:5117",
0
],
"sampler": [
"5151:5119",
0
],
"sigmas": [
"5151:5118",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"5151:5124": {
"class_type": "LTXVAudioVAEDecode",
"inputs": {
"audio_vae": [
"5151:5132",
0
],
"samples": [
"5151:5114",
1
]
},
"_meta": {
"title": "LTXV Audio VAE Decode"
}
},
"5151:5125": {
"class_type": "ImageConcanate",
"inputs": {
"direction": "left",
"image1": [
"5151:5143",
0
],
"image2": [
"5151:5130",
0
],
"match_image_size": True
},
"_meta": {
"title": "ImageConcanate"
}
},
"5151:5126": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"5151:5130",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"5151:5129": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"5151:5139",
0
],
"resize_type": "scale by multiplier",
"resize_type.multiplier": 0.5,
"scale_method": "lanczos"
},
"_meta": {
"title": "Resize Image/Mask"
}
},
"5151:5130": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"5151:5129",
0
],
"resize_type": "scale to multiple",
"resize_type.multiple": 32,
"scale_method": "area"
},
"_meta": {
"title": "Resize Image/Mask"
}
},
"5151:5131": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"5151:5135",
0
],
"text": "pc game, console game, video game, ugly, 3d render, photo, still, static, slow"
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"5151:5132": {
"class_type": "LTXVAudioVAELoader",
"inputs": {
"ckpt_name": "ltx-2.3-22b-dev-fp8.safetensors"
},
"_meta": {
"title": "Load LTXV Audio VAE"
}
},
"5151:5133": {
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "ltx-2.3-22b-dev-fp8.safetensors"
},
"_meta": {
"title": "Load Checkpoint"
}
},
"5151:5134": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "ltx-2.3-22b-distilled-lora-384.safetensors",
"model": [
"5151:5133",
0
],
"strength_model": 0.5
},
"_meta": {
"title": "Load LoRA"
}
},
"5151:5135": {
"class_type": "LTXAVTextEncoderLoader",
"inputs": {
"ckpt_name": "ltx-2.3-22b-dev-fp8.safetensors",
"device": "default",
"text_encoder": "gemma_3_12B_it.safetensors"
},
"_meta": {
"title": "Load LTXV Audio Text Encoder"
}
},
"5151:5137": {
"class_type": "VHS_VideoInfo",
"inputs": {
"video_info": [
"5060",
3
]
},
"_meta": {
"title": "Video Info 🎥🅥🅗🅢"
}
},
"5151:5138": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"5151:5135",
0
],
"text": ""
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"5151:5139": {
"class_type": "ImagePadKJ",
"inputs": {
"bottom": 0,
"color": "0, 0, 0",
"extra_padding": 0,
"image": [
"5060",
0
],
"left": 0,
"pad_mode": "color",
"right": 0,
"target_height": [
"5151:5150",
1
],
"target_width": [
"5151:5149",
1
],
"top": 0
},
"_meta": {
"title": "ImagePad KJ"
}
},
"5151:5140": {
"class_type": "VHS_VideoCombine",
"inputs": {
"audio": [
"5060",
2
],
"crf": 12,
"filename_prefix": "AnimateDiff",
"format": "video/h264-mp4",
"frame_rate": [
"5151:5137",
5
],
"images": [
"5151:5144",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": False,
"trim_to_audio": False
},
"_meta": {
"title": "Video Combine 🎥🅥🅗🅢"
}
},
"5151:5142": {
"class_type": "LTXAddVideoICLoRAGuide",
"inputs": {
"crop": "disabled",
"frame_idx": 0,
"image": [
"5151:5144",
0
],
"latent": [
"5151:5112",
0
],
"latent_downscale_factor": 1,
"negative": [
"5151:5110",
1
],
"positive": [
"5151:5110",
0
],
"strength": 1,
"tile_overlap": 64,
"tile_size": 256,
"use_tiled_encode": False,
"vae": [
"5151:5133",
2
]
},
"_meta": {
"title": "🅛🅣🅧 Add Video IC-LoRA Guide"
}
},
"5151:5143": {
"class_type": "Float32ColorCorrect",
"inputs": {
"brightness": 0,
"clamp_output": False,
"contrast": 1,
"exposure": 0,
"gain_b": 1,
"gain_g": 1,
"gain_r": 1,
"gamma": 0.5,
"image": [
"5151:5154",
0
],
"lift_b": 0,
"lift_g": 0,
"lift_r": 0,
"luma_space": "Rec.709 / sRGB",
"saturation": 1
},
"_meta": {
"title": "◎ Radiance Float32 Color Correct"
}
},
"5151:5144": {
"class_type": "Float32ColorCorrect",
"inputs": {
"brightness": 0,
"clamp_output": False,
"contrast": 1,
"exposure": 0,
"gain_b": 1,
"gain_g": 1,
"gain_r": 1,
"gamma": 2,
"image": [
"5151:5130",
0
],
"lift_b": 0,
"lift_g": 0,
"lift_r": 0,
"luma_space": "Rec.709 / sRGB",
"saturation": 1
},
"_meta": {
"title": "◎ Radiance Float32 Color Correct"
}
},
"5151:5146": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "ltx-2.3-22b-ic-lora-outpaint.safetensors",
"model": [
"5151:5134",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"5151:5148": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "a / b",
"values.a": [
"5151:5097",
0
],
"values.b": [
"5151:5098",
0
]
},
"_meta": {
"title": "ratio"
}
},
"5151:5149": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "max(a, b * c)",
"values.a": [
"5151:5137",
3
],
"values.b": [
"5151:5137",
4
],
"values.c": [
"5151:5148",
0
]
},
"_meta": {
"title": "target_w"
}
},
"5151:5150": {
"class_type": "ComfyMathExpression",
"inputs": {
"expression": "max(b, a / c)",
"values.a": [
"5151:5137",
3
],
"values.b": [
"5151:5137",
4
],
"values.c": [
"5151:5148",
0
]
},
"_meta": {
"title": "target_h"
}
},
"5151:5154": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"5151:5113",
2
],
"vae": [
"5151:5133",
2
]
},
"_meta": {
"title": "VAE Decode"
}
}
})
workflow.set_input("5060", "video", client.assets.from_url("https://cdn.jsdelivr.net/gh/Comfy-Org/workflow_templates@90c71fb78b3726392d010ff62a8e79e92d7296ad/input/ltx2.3_video_outpainting_input.mp4"))
# 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("5152"):
output.to_file(output.name)
for output in job.get_outputs("5069"):
output.to_file(output.name)