技能圖譜SKILLSGROVE
技能圖譜/影片製作/trae-community/trae-skills/video-to-keyframes

video-to-keyframes

安裝

$npx skills add https://github.com/trae-community/trae-skills --skill video-to-keyframes
$git clone --depth 1 https://github.com/trae-community/trae-skills.git /tmp/trae-skills && mkdir -p ~/.claude/skills && cp -r /tmp/trae-skills/skills/video-to-keyframes ~/.claude/skills/video-to-keyframes
請幫我安裝這個 Agent Skill:https://github.com/trae-community/trae-skills/tree/45499535e3278498400fb28b7179498d2df5bcb0/skills/video-to-keyframes ,先閱讀它的 SKILL.md 和指令碼,確認安全後再安裝到我的技能目錄。

簡介

原文描述 · MITExtracts video frames, detects cuts/segments, selects candidate keyframes, and generates review HTML galleries. Invoke when users ask for keyframes/cuts/segmentation/storyboard screening.
以下 SKILL.md 內容轉載自 trae-community/trae-skills(提交 4549953),依據 MIT 許可證轉載正文(文字未改動;僅省略檔案頭後設資料、將圖片顯示為連結,超長內容會截斷);版權歸 2026 trae-community-org 所有。許可證:LICENSE。僅展示說明檔案,附帶指令碼請在原倉庫檢視。

视频转关键帧(video-to-keyframes)

把用户提供的视频转成“候选帧池 → 转场/分段 → 候选关键帧集 → 复筛画廊页”,并把产物落盘到当天文件夹,方便后续分镜与生成。

何时调用

  • 用户提供视频并说:抽帧/拆帧/关键帧/候选关键帧/镜头拆分/转场点/分段/分镜初筛
  • 用户希望按固定工作流落盘,需要可复现的目录与文件(frames.json、cuts.json、segments.json、gallery.html 等)

依赖

  • Python 3.10+
  • numpy
  • opencv-python

输入

  • 视频文件路径(必填)
  • 当天文件夹路径(可选,默认用视频所在目录;推荐 YYYY-MM-DD)
  • 抽帧间隔(建议:30s≈1fps;变化快≈2fps)

输出(固定规范)

在 <当天文件夹> 下生成:

  • <当天文件夹>\_frames_<视频名>_<间隔>\:候选帧池目录
    • f_*.jpg:抽帧图片
    • frames.csv / frames.json / top_keep.json / meta.json
    • \_keyframe_candidates\:候选关键帧集目录
      • cuts.json:转场点
      • segments.json:分段与每段代表帧
      • segments_gallery.html:分段可视化(每段1张代表帧)
      • gallery.html:候选关键帧画廊(逐个复筛)
      • candidates.csv / candidates.json
      • selected.txt:人工/AI复筛后的最终候选ID(每行一个 cand_id)
      • prompt_pack.html:复筛+提示词协作页(夜间模式,一键复制)
  • <当天文件夹>\<视频名>_拆分.txt:汇总(转场点、分段、每段代表帧文件名)

一键运行(推荐)

python .\skills\video-to-keyframes\resources\scripts\run_video_workflow.py "<视频路径>" --day-folder "<当天文件夹>" --every-seconds 0.5 --max-frames 600

注意:一键运行只负责产出文件,不等于完成复筛;必须打开 gallery.html 做人工/AI语义复筛,并把最终选择写入 selected.txt。

复筛要点(简版)

  • 先看 segments_gallery.html:确认每段代表帧是否合理、分段是否过碎
  • 再看 gallery.html:挑 6-12 张最“代表内容且可复现”的帧(不要只挑清晰但信息弱的帧)
  • 将 cand_id 写入 selected.txt(每行一个三位数字或逗号分隔均可)
檢視許可證全文(MIT)
MIT License

Copyright (c) 2026 trae-community-org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.