🚀 快速安装
复制以下命令并运行,立即安装此 Skill:
npx skills add https://skills.sh/heygen-com/skills/video-understand
💡 提示:需要 Node.js 和 NPM
video-understand
使用 ffmpeg 提取帧和 Whisper 进行转录,在本地理解视频内容。完全离线运行,无需 API 密钥。
先决条件
ffmpeg+ffprobe(必需):brew install ffmpegopenai-whisper(可选,用于转录):pip install openai-whisper
命令
# 场景检测 + 转录(默认)
python3 skills/video-understand/scripts/understand_video.py video.mp4
# 关键帧提取
python3 skills/video-understand/scripts/understand_video.py video.mp4 -m keyframe
# 固定间隔提取
python3 skills/video-understand/scripts/understand_video.py video.mp4 -m interval
# 限制提取帧数
python3 skills/video-understand/scripts/understand_video.py video.mp4 --max-frames 10
# 使用更大的 Whisper 模型
python3 skills/video-understand/scripts/understand_video.py video.mp4 --whisper-model small
# 仅提取帧,跳过转录
python3 skills/video-understand/scripts/understand_video.py video.mp4 --no-transcribe
# 静默模式(仅输出 JSON,无进度信息)
python3 skills/video-understand/scripts/understand_video.py video.mp4 -q
# 输出到文件
python3 skills/video-understand/scripts/understand_video.py video.mp4 -o result.json
CLI 选项
| 标志 | 描述 |
|---|---|
video |
输入视频文件(位置参数,必需) |
-m, --mode |
提取模式:scene(默认)、keyframe、interval |
--max-frames |
保留的最大帧数(默认:20) |
--whisper-model |
Whisper 模型大小:tiny、base、small、medium、large(默认:base) |
--no-transcribe |
跳过音频转录,仅提取帧 |
-o, --output |
将结果 JSON 写入文件而非标准输出 |
-q, --quiet |
抑制进度消息,仅输出 JSON |
提取模式
| 模式 | 工作原理 | 最佳用途 |
|---|---|---|
scene |
通过 ffmpeg select='gt(scene,0.3)' 检测场景变化 |
大多数视频,内容多样 |
keyframe |
提取 I 帧(编解码关键帧) | 具有自然关键帧放置的编码视频 |
interval |
根据持续时间和最大帧数均匀间隔提取帧 | 固定采样,输出可预测 |
如果 scene 模式未检测到场景变化,会自动回退到 interval 模式。
输出
脚本将 JSON 输出到标准输出(或使用 -o 输出到文件)。完整架构参见 references/output-format.md。
{
"video": "video.mp4",
"duration": 18.076,
"resolution": {"width": 1224, "height": 1080},
"mode": "scene",
"frames": [
{"path": "/abs/path/frame_0001.jpg", "timestamp": 0.0, "timestamp_formatted": "00:00"}
],
"frame_count": 12,
"transcript": [
{"start": 0.0, "end": 2.5, "text": "Hello and welcome..."}
],
"text": "Full transcript...",
"note": "Use the Read tool to view frame images for visual understanding."
}
使用 Read 工具读取帧图像路径,以便直观查看提取的帧。
参考资料
references/output-format.md— 完整的 JSON 输出架构文档
📄 原始文档
完整文档(英文):
https://skills.sh/heygen-com/skills/video-understand
💡 提示:点击上方链接查看 skills.sh 原始英文文档,方便对照翻译。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

评论(0)