Extracts and clips video segments from long videos using natural language descriptions. AI-powered smart video editing, video trimming, and video cutting powered by Volcengine LAS. Describe what you want — scenes, people, objects, actions, events — and get trimmed clips automatically. Video search and video content retrieval: find and locate specific people, objects, or scenes in footage. Supports reference images for person matching and object matching (search video by image). Two modes: simple (fast) and detail (thorough, optional ASR). Use this skill when the user wants to edit/clip/cut videos using natural language descriptions, extract highlights or key moments from videos, find specific people/objects/scenes in video footage (by text or reference image), compile highlight reels from long videos, trim video segments, or do AI-powered smart video editing.
根据自然语言描述从长视频中提取精彩片段,支持参考图像辅助识别特定人物/物体。两种模式:simple(快速)和 detail(精细分析)。
本 skill 主要采用:
lasutil CLI 调用las_video_editsubmit → poll)LAS_API_KEY (必填)详细参数与接口定义见 references/api.md。
output_tos_pathtos://simple 快速适用多数场景;detail 精细分析时间更长但效果更好。env.sh 并写入 export LAS_API_KEY="...",SDK 会自动读取。复制此清单并跟踪进度:
执行进度:
- [ ] Step 0: 前置检查
- [ ] Step 1: 初始化与准备
- [ ] Step 2: 预估价格
- [ ] Step 3: 提交任务
- [ ] Step 4: 异步查询
- [ ] Step 5: 结果呈现
在接受用户的任务后,不要立即开始执行,必须首先进行以下环境检查:
LAS_API_KEY 与 LAS_REGION:确认环境变量或 .env 中是否已配置。
LAS_REGION 常见为 cn-beijing)。LAS_REGION 必须与您的 API Key 及 TOS Bucket 所在的地域完全一致。如果用户中途切换了 Region,必须提醒用户其 TOS Bucket 也需对应更换,否则会导致权限异常或上传失败。LAS_API_KEY,无需额外 TOS 凭证)。VOLCENGINE_ACCESS_KEY 和 VOLCENGINE_SECRET_KEY。对于仅需要上传输入文件的场景,TOS 凭证不再必须。output_tos_path 为必填参数,必须由用户提供自己可写的 TOS 目录路径(格式:tos://bucket/output_dir/)。环境初始化(Agent 必做):
# 执行统一的环境初始化与更新脚本(会自动创建/激活虚拟环境,并检查更新)
source "$(dirname "$0")/scripts/env_init.sh" las_video_edit
workdir=$LAS_WORKDIR
如果网络问题导致更新失败,脚本会跳过检查,使用本地已安装的 SDK 继续执行。
LAS_API_KEY,无需 TOS 凭证和 Bucket):
lasutil file-upload <local_path>
上传成功后返回 JSON,取其中的 presigned_url(HTTPS 预签名下载链接,24 小时有效)传给算子作为输入 URL。lasutil media-duration <video_url>
构造基础 data.json:
{
"video_url": "<presigned_url>",
"output_tos_path": "tos://<your-bucket>/output_dir/",
"task_description": "提取戴帽子的小男孩的所有片段,包含台词",
"reference_images": [
{"target": "戴帽子的小男孩", "images": ["https://example.com/ref1.jpeg"]}
],
"mode": "simple"
}
重要提示:
output_tos_path必须由用户提供,需要填写用户自己账号下可写的 TOS 目录(服务端会将剪辑后的视频片段写入此目录)。
单文件提交:
data=$(cat "$workdir/data.json")
lasutil submit las_video_edit "$data" > "$workdir/submit.json"
⚠️ 强制反馈:任务提交成功后,必须立即向用户返回生成的 task_id,以便用户跟踪进度或在必要时手动查询。
⚠️ 异步任务与后台轮询约束:
sleep 循环会导致超时崩溃:绝对禁止在代码中执行死循环等待! 此时必须立即向用户输出 Task ID 并结束当前轮次,告知用户:"任务已提交,请稍后向我询问进度"。单任务查询:
lasutil poll las_video_edit {task_id}
COMPLETED → 返回剪辑片段列表 result.data.clips[]。RUNNING/PENDING → 稍后重试。处理结果:
# 保存片段列表到本地
mkdir -p "./output/{task_id}"
cat "./output/{task_id}/result.json" | jq '.data.clips' > "./output/{task_id}/clips.json"
# 生成 CSV 摘要
cat "./output/{task_id}/result.json" | jq -r '.data.clips[] |
"\(.clip_id),\(.start_time),\(.end_time),\(.duration)s,\(.description),\(.clip_url)"' > "./output/{task_id}/clips.csv"
视频片段:
向用户展示:
clip_url)./output/{task_id}/执行完成后,Agent 应自检: