使用 Kling(通过 ComfyDeploy)生成 5 秒电影级 AI 视频。输入一张角色图像、一张物品图像和一张场景图像,即可生成角色设定图……
Kling.是一项面向实际任务的技能,主要用于Generates a 5秒影视视频, 结合: :.;A 字符( 人物/ 模型). 物品( 产品、 对象、 道具).;
使用时应结合输入条件选择合适的执行方式,核对必要参数、依赖环境与输出内容,并按原始要求处理异常情况。该技能适合需要稳定复用相关能力的场景,可作为自动化工作流的一部分,也便于后续检查、调整和扩展。从功能定位来看,该技能强调把分散的操作要求整理成清晰、可复用的处理流程,使用户能够围绕既定目标快速准备输入、选择执行方式并获得结构化结果。
实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。
通过组合以下三要素,生成一段 5 秒钟的电影级视频:
系统内部会先分别生成角色设定表(Character Sheet)和物品设定表(Item Sheet),再将二者输入 Kling 进行视频合成。
e5258667-dec2-438f-84d0-f22049692483POST https://api.comfydeploy.com/api/run/deployment/queueAuthorization: Bearer $COMFY_DEPLOY_API_KEY| 字段 | 类型 | 说明 |
|---|---|---|
character_base |
URL | 角色/人物图像的公开可访问 URL |
item_base |
URL | 物品/产品图像的公开可访问 URL |
location_base |
URL | 地点/环境图像的公开可访问 URL |
character_sheet_prompt |
字符串 | 角色设定表提示词 — 仅可修改方括号 [brackets] 内容 |
video_prompt |
字符串 | 对 5 秒场景的简明描述 |
input_seed |
整数 | -1 表示随机种子;指定固定整数可复现结果 |
该提示词分为 两部分 —— 仅 [brackets] 部分可变:
Create a photorealistic character sheet. Include a closeup portrait which is left aligned (the outfit must be visible in the portrait), no borders, with a neutral expression and then also include a full view shot that shows the front, right side view, left side view and back of the character. The character is placed on a white background. Don't include any text. No borders, no soft gradients. [CLOTHING DESCRIPTION HERE]
规则: 将 [CLOTHING DESCRIPTION HERE] 替换为符合当前场景的服装描述;方括号前的所有内容必须严格保持原样不变。
示例:
[They are wearing a tailored black suit with a white shirt, no tie, luxury editorial style.][They are wearing dirty damaged clothes in the style of The Last Of Us, dystopic aesthetic.][They are wearing a red Nike tracksuit and white sneakers, athletic style.]优质示例:
"Short cinematic sequence of the character dunking a basketball in the ring while wearing the green Shaq shoes.""Character walks into the desert location, picks up the item from the sand, holds it toward camera. Quick cut to close-up of the item.""Product reveal: character turns around in the urban location, tosses the item to camera in slow motion."不良示例(过于详细):
"Camera starts at f/1.8 aperture, golden hour light at 47 degrees, character moves exactly 3 steps forward..."务必使用 image 工具预先识别每张图像类型,严禁按文件顺序主观假设。
image(images=[file1, file2, file3], prompt="Para cada imagen, decí brevemente si es: persona, producto/objeto, o lugar/ambiente")
随后按如下规则分配:
character_base = 人物/模特item_base = 其所交互的 产品/物体location_base = 场所/环境/背景务必先将本地文件上传至 ComfyDeploy 自有存储空间。禁止使用外部或自定义域名。
source ~/clawd/.env
upload_to_comfy() {
curl -s -X POST "https://api.comfydeploy.com/api/file/upload"
-H "Authorization: Bearer $COMFY_DEPLOY_API_KEY"
-F "file=@$1" | jq -r '.file_url'
}
URL_CHAR=$(upload_to_comfy /path/to/character.jpg)
URL_ITEM=$(upload_to_comfy /path/to/item.jpg)
URL_LOC=$(upload_to_comfy /path/to/location.jpg)
# 返回示例:https://comfy-deploy-output.s3.us-east-2.amazonaws.com/inputs/img_XXXX.jpg
RUN_ID=$(curl -s -X POST "https://api.comfydeploy.com/api/run/deployment/queue"
-H "Content-Type: application/json"
-H "Authorization: Bearer $COMFY_DEPLOY_API_KEY"
-d "{
"deployment_id": "e5258667-dec2-438f-84d0-f22049692483",
"inputs": {
"character_base": "$URL_CHAR",
"item_base": "$URL_ITEM",
"location_base": "$URL_LOC",
"character_sheet_prompt": "Create a photorealistic character sheet. Include a closeup portrait which is left aligned (the outfit must be visible in the portrait), no borders, with a neutral expression and then also include a full view shot that shows the front, right side view, left side view and back of the character. The character is placed on a white background. Don't include any text. No borders, no soft gradients. [CLOTHING DESCRIPTION]",
"video_prompt": "VIDEO_SCENE_DESCRIPTION",
"input_seed": -1
}
}" | jq -r '.run_id')
echo "Run ID: $RUN_ID"
while true; do
RESULT=$(curl -s "https://api.comfydeploy.com/api/run/$RUN_ID"
-H "Authorization: Bearer $COMFY_DEPLOY_API_KEY")
STATUS=$(echo $RESULT | jq -r '.status')
echo "Status: $STATUS"
if [ "$STATUS" = "success" ]; then
echo $RESULT | jq '.outputs'
break
elif [ "$STATUS" = "failed" ]; then
echo "Failed!"
break
fi
sleep 10
done
# 持续轮询直至成功
while true; do
RESULT=$(curl -s "https://api.comfydeploy.com/api/run/$RUN_ID"
-H "Authorization: Bearer $COMFY_DEPLOY_API_KEY")
STATUS=$(echo $RESULT | jq -r '.status')
[ "$STATUS" = "success" ] && break
[ "$STATUS" = "failed" ] && echo "FAILED" && break
sleep 15
done
# 下载输出至允许目录
mkdir -p ~/clawd/output/cinematic-kling
BASE_URL="https://comfy-deploy-output.s3.us-east-2.amazonaws.com/outputs/runs/$RUN_ID"
curl -sL "$BASE_URL/CS_2_00001_.png" -o ~/clawd/output/cinematic-kling/character-sheet.png
curl -sL "$BASE_URL/ITEM_00001_.png" -o ~/clawd/output/cinematic-kling/item-sheet.png
curl -sL "$BASE_URL/LOCATION_00001_.png" -o ~/clawd/output/cinematic-kling/location-sheet.png
curl -sL "$BASE_URL/ComfyUI_00001_.mp4" -o ~/clawd/output/cinematic-kling/video.mp4
务必通过 filePath 发送文件附件 — 禁止直接发送原始 URL。
message(action=send, channel=telegram, target=USER_ID, filePath=~/clawd/output/cinematic-kling/character-sheet.png, message="Character Sheet") message(action=send, channel=telegram, target=USER_ID, filePath=~/clawd/output/cinematic-kling/item-sheet.png, message="Item Sheet") message(action=send, channel=telegram, target=USER_ID, filePath=~/clawd/output/cinematic-kling/location-sheet.png, message="Location Sheet") message(action=send, channel=telegram, target=USER_ID, filePath=~/clawd/output/cinematic-kling/video.mp4, message="🎬 Video")
| 节点编号 | 文件名 | 操作说明 |
|---|---|---|
| 4 | CS_2_00001_.png |
作为文件发送(角色设定表) |
| 14 | ITEM_00001_.png |
作为文件发送(物品设定表) |
| 25 | LOCATION_00001_.png |
作为文件发送(地点设定表) |
| 22 | ComfyUI_00001_.mp4 |
作为文件发送 — 主要输出 |
| 38 | text | Kling 实际使用的视频提示词(仅供内部参考,可忽略) |
import requests, os, time
def cinematic_kling(character_url, item_url, location_url, clothing_desc, video_prompt, seed=-1):
"""
character_url: 角色图像的公开 URL
item_url: 物品图像的公开 URL
location_url: 地点图像的公开 URL
clothing_desc: 角色设定表提示词中 [brackets] 内的服装描述
video_prompt: 简洁的场景描述
返回值: 包含 'images' 列表与 'video' URL 的字典
"""
API_KEY = os.environ['COMFY_DEPLOY_API_KEY']
character_sheet_prompt = (
"Create a photorealistic character sheet. Include a closeup portrait which is left aligned "
"(the outfit must be visible in the portrait), no borders, with a neutral expression and then "
"also include a full view shot that shows the front, right side view, left side view and back "
"of the character. The character is placed on a white background. Don't include any text. "
f"No borders, no soft gradients. [{clothing_desc}]"
)
# 提交任务
r = requests.post(
"https://api.comfydeploy.com/api/run/deployment/queue",
headers={"Content-Type": "application/json", "Authorization": f"Bearer {API_KEY}"},
json={
"deployment_id": "e5258667-dec2-438f-84d0-f22049692483",
"inputs": {
"character_base": character_url,
"item_base": item_url,
"location_base": location_url,
"character_sheet_prompt": character_sheet_prompt,
"video_prompt": video_prompt,
"input_seed": seed
}
}
)
run_id = r.json()['run_id']
print(f"Run ID: {run_id}")
# 轮询状态
while True:
result = requests.get(
f"https://api.comfydeploy.com/api/run/{run_id}",
headers={"Authorization": f"Bearer {API_KEY}"}
).json()
status = result.get('status')
print(f"Status: {status}")
if status == 'success':
return result.get('outputs', {})
elif status == 'failed':
raise Exception(f"Run failed: {result}")
time.sleep(10)
约 3–5 分钟(含角色设定表生成 + Kling 视频生成)
character_sheet_prompt 的固定部分严禁修改 —— 仅允许调整 [brackets] 中的内容input_seed: -1 表示每次运行使用随机种子;设置固定整数可确保结果可复现相关专题
热门下载
相关下载
精品课程
共6课时 | 54.7万人学习
共89课时 | 134.1万人学习
共49课时 | 82.6万人学习
最新文章