Grok: 參考生影片
上傳一張參考圖並使用Grok API產生影片,最多支援6張參考圖以增強一致性。
下載工作流程在 Cloud 中試用 API 文件
00:00
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
Loading the graph
Open full-size workflow preview- 輸出
- 影片
- 作者
- ComfyUI
從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
1 取得 API 金鑰 ↗
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
- 您的檔案
- 由程式碼透過其 URL 上傳
需要付費 Cloud 方案與點數。
下載 API JSONAPI 文件 ↗
# 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({
"4": {
"class_type": "SaveVideo",
"inputs": {
"filename_prefix": "video/Grok",
"format": "auto",
"format.codec": "auto",
"video": [
"19",
0
]
},
"_meta": {
"title": "Save Video"
}
},
"5": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_reference_2_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"6": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_reference_1_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"19": {
"class_type": "GrokVideoReferenceNode",
"inputs": {
"model": "grok-imagine-video",
"model.aspect_ratio": "16:9",
"model.duration": 6,
"model.reference_images.reference_0": [
"6",
0
],
"model.reference_images.reference_1": [
"5",
0
],
"model.resolution": "720p",
"prompt": "A cinematic studio piece on a seamless slate-grey cyclorama with cool, low, misty light. The blackened cast-iron storm lantern and the oxblood leather flask with its brass cap from the first reference sit apart on the floor, frost on the metal. The man from the second reference, in the long glossy midnight-blue vinyl coat, charcoal tunic, grey wool trousers and burgundy boots, walks in from the left, kneels, lifts the lantern and strikes it alight; a warm amber flame blooms behind the seeded glass and throws moving shadows across the floor. He tucks the flask into his coat, stands and holds the lantern up, looking into the distance as fog rolls in around his boots. The camera starts low and wide, then arcs smoothly around him and pushes in to a medium shot as the light catches the vinyl coat. Same people and objects as the references, no text.",
"seed": 0
},
"_meta": {
"title": "Grok Reference-to-Video"
}
}
})
workflow.set_input("6", "image", client.assets.from_url("https://comfy.org/catalog-media/f93e0d63-dad0-4dc3-a231-157f660c3a95/0dc166eb-b85f-4d09-97c6-9eea87bd173a"))
workflow.set_input("5", "image", client.assets.from_url("https://comfy.org/catalog-media/7d3ab090-01db-4f92-b00c-467412fe2e1c/37660f07-a749-42f8-919f-f5a45633231e"))
# 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("4"):
output.to_file(output.name)試試範例
關於此工作流程
「Grok:參考圖轉影片」工作流程於 ComfyUI 可將靜態參考圖像轉為動態影片內容。流程運用 Grok API,讓影片畫格即使使用多達六張參考圖也能維持高度視覺一致性。流程從 LoadImage 節點上傳參考圖開始,這些圖像會由 GrokVideoReferenceNode 處理,Grok 模型將靜態圖像轉為連貫的影片序列。最後,SaveVideo 節點可將生成影片匯出,方便多元應用。
本流程最大特色是可處理多張參考圖,確保影片風格與角色呈現一致。特別適合需角色動畫或風格統一影片的專案。Grok 模型進階能力可細緻詮釋輸入圖像,是將靜態藝術轉為吸引人影片內容的強大工具。
問答
最多可用六張參考圖,以提升生成影片的一致性。
Grok 模型將靜態參考圖像轉為連貫的影片序列,並維持視覺一致性。
可以,可於流程內調整 Grok 模型參數,依需求自訂影片輸出。
SaveVideo 節點可匯出標準格式如 MP4,適用大多數應用。