Video subtitle snapshot
Skill CoderAha/video-subtitle-snapshot/skill/video-subtitle-snapshot
当用户提供本地视频、B站或抖音链接,并要求从指定时间点或短时间段生成字幕截图时使用;也适用于需要使用本人 B站登录状态获取可访问清晰度的请求。From its SKILL.md
npx -y skills add CoderAha/video-subtitle-snapshot --skill video-subtitle-snapshotAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 21 days oldThe repository was created 21 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.9 KB, ~1.6k tokens by cl100k_base, as published. Nobody here has run it
视频字幕截图
把本地、B站或抖音视频的指定片段制作成一张 PNG:顶部是开始时刻的完整画面,下方按时间顺序拼接去重后的字幕条。内置 CLI 负责确定性媒体处理,Agent 负责定位字幕和 OCR。支持 macOS、Windows,并兼容常见 Linux。
安全要求
处理网络链接、安装依赖、使用 Cookie 或读取不熟悉的本地文件前,先阅读 references/permissions.md。
- 只处理用户有权使用的内容。
- 本地视频模式保持离线,不得访问网络,也不得要求 yt-dlp 或浏览器。
- B站模式默认匿名访问。
- 抖音通过移动分享页解析临时播放地址;抖音不需要浏览器,不得保存或输出临时 CDN 地址。
- 向 yt-dlp 传递浏览器名称或 Cookie 文件前,必须获得用户单独的明确授权。不得查看、复制、打印、上传或保留 Cookie 值。
- Cookie 参数只适用于 B站;本地或抖音输入不得使用 Cookie 参数。
- 不得绕过会员、DRM、地域、登录、版权或其他访问限制。
处理流程
在本 Skill 目录中运行命令。下列 <PYTHON> 在 macOS/Linux 替换为 .venv/bin/python,在 Windows 替换为 .venv\Scripts\python。
-
按输入来源检查依赖:
<PYTHON> scripts/video_subtitle_snapshot.py doctor \ --input "VIDEO_PATH_OR_SHARE_TEXT_OR_URL" --jsondoctor --json检查全部依赖,doctor --input ... --json只检查当前来源。B站额外需要 yt-dlp,本地和抖音不需要。缺少依赖时阅读 references/environment.md,向用户说明安装内容、用途和命令;安装前必须获得用户同意。安装后重新检查。 -
只获取指定区间。省略
--work-dir以创建独立任务目录,并从 JSON 中读取work_dir:<PYTHON> scripts/video_subtitle_snapshot.py acquire \ --input "VIDEO_PATH_OR_SHARE_TEXT_OR_URL" --start "01:15:55" \ --duration 13 --json支持本地路径、B站完整链接或 b23 分享文本、抖音完整链接或 App 分享文本。只有 B站且获得单独授权后,才能添加
--cookies-from-browser chrome或--cookies-file PATH。不得猜测浏览器;认证失败不得静默降级;区间下载失败不得下载整部视频。 -
提取候选帧:
<PYTHON> scripts/video_subtitle_snapshot.py prepare \ --work-dir "TASK_DIR" --step 0.5 --pixel-threshold 10 --json -
读取
manifest.json。按diff从高到低选择两到三张完整候选帧,不要机械选择首、中、尾帧。让视觉模型返回字幕文字及文字像素的上下边缘 y 坐标,取有效结果中最小的上边缘和最大的下边缘:<PYTHON> scripts/video_subtitle_snapshot.py crop \ --work-dir "TASK_DIR" --text-top TOP --text-bottom BOTTOM \ --padding 24 --json -
对
main_sub.png和cropped/执行 OCR,每批最多五张。保持时间顺序,跳过空结果、“无字幕”、与主画面相同的文字及后续完全重复项;不得改写或翻译。只使用已知文件名:{"main_text":"","keep":[{"file":"strip_01_2.0s.png","text":"字幕"}]}保存为
TASK_DIR/ocr_results.json。 -
拼接图片,不得覆盖已有输出:
<PYTHON> scripts/video_subtitle_snapshot.py stitch \ --work-dir "TASK_DIR" --output "/path/result.png" --json
交付 PNG,并根据 manifest 报告实际分辨率、格式 ID 和认证模式。可以询问是否清理,但只能删除本次返回的精确任务目录。
错误处理
| 错误代码 | 处理方式 |
|---|---|
DEPENDENCY_MISSING | 说明缺少的依赖并请求安装许可。 |
AUTHORIZATION_REQUIRED | 询问用户等待后重试,或明确授权一种 Cookie 来源。 |
SECTION_DOWNLOAD_UNAVAILABLE | 报告失败,不得改为获取整部视频。 |
DOUYIN_PARSE_FAILED | 内置短重试后仍失败,报告抖音页面结构或作品类型不受支持,不得改用浏览器抓取。 |
DOUYIN_DOWNLOAD_FAILED | 内置短重试后仍失败,重新执行 acquire 以刷新临时地址;仍失败则报告,不得输出签名 URL。 |
INVALID_CROP | 重新识别文字边缘,不得猜测或手动钳制坐标。 |
INVALID_OCR_RESULTS | 修正 JSON 或文件名,不得静默跳过。 |
OUTPUT_EXISTS | 请用户提供新路径,或明确要求覆盖。 |
项目链接
开源许可
采用 Apache-2.0,发布 ZIP 内包含 LICENSE。
What ships with it: 15 files
47.7 KB alongside SKILL.md, 11 of them executable
agents/
- openai.yaml275 B
references/
- environment.md2.8 KB
- permissions.md2.2 KB
scripts/
- video_snapshot/cli.pyruns13.2 KB
- video_snapshot/core.pyruns1.2 KB
- video_snapshot/douyin.pyruns5.9 KB
- video_snapshot/environment.pyruns1.1 KB
- video_snapshot/errors.pyruns347 B
- video_snapshot/imaging.pyruns4.4 KB
- video_snapshot/__init__.pyruns74 B
- video_snapshot/media.pyruns7.3 KB
- video_snapshot/sources.pyruns6.7 KB
- video_snapshot/workspace.pyruns1.9 KB
- video_subtitle_snapshot.pyruns118 B
- requirements.txt25 B
Gives 0 of the 12 instructions most video audio skills give in ~1.6k tokens
Counted across 622 of the 795 authors here whose files we hold, read 2026-08-07
- Read individual rule files for detailed explanationsin 21 of 622, across 10 files
- Render final videoin 13 of 622, across 6 files
- Use WAV PCM 16kHz mono audio formatin 12 of 622, across 3 files
- Use this skill when dealing with Remotion codein 11 of 622, across 4 files
- Save generated audio to a WAV filein 11 of 622, across 4 files
- Handle conversion errors gracefullyin 10 of 622, across 6 files
- Add captions to videos alwaysin 10 of 622, across 4 files
- Generate music from text descriptions using MusicGenin 9 of 622, across 2 files
- Do not skip pipeline layersin 9 of 622, across 3 files
- Do not make one tool do everythingin 9 of 622, across 3 files
- Use Azure Document Intelligence for complex PDFsin 9 of 622, across 4 files
- Never ask the user to paste their full API keyin 9 of 622, across 3 files
Said here and by no other author read
- obtain user consent before installing dependencies
- acquire only the specified video interval
- request explicit authorization before passing cookies
- select candidate frames by diff score
- extract lowest top and highest bottom y coordinates
- save OCR results to json using known filenames
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.