by chengyi-ai
保留视频内嵌字幕,精确取帧并生成 3:4 社交长图的 Agent Skill
# Add to your Claude Code skills
git clone https://github.com/chengyi-ai/native-subtitle-quote-imageGuides for using ai agents skills like native-subtitle-quote-image.
native-subtitle-quote-image is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by chengyi-ai. 保留视频内嵌字幕,精确取帧并生成 3:4 社交长图的 Agent Skill. It has 3,025 GitHub stars.
native-subtitle-quote-image's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/chengyi-ai/native-subtitle-quote-image" and add it to your Claude Code skills directory (see the Installation section above).
native-subtitle-quote-image is primarily written in Python. It is open-source under chengyi-ai on GitHub, so you can review or fork the full source.
Yes. AgentsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh native-subtitle-quote-image against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
本页只展示中文字幕作品,均为 3:4、5 句。英文和韩文作品分别在 English 与 한국어 README 中。点击图片查看原图。
1. 安装 Skill
git clone https://github.com/chengyi-ai/native-subtitle-quote-image.git
cd native-subtitle-quote-image
mkdir -p ~/.codex/skills && cp -R skills/native-subtitle-quote-image ~/.codex/skills/
Windows PowerShell:
New-Item -ItemType Directory -Force "$HOME\.codex\skills" | Out-Null
Copy-Item -Recurse skills\native-subtitle-quote-image "$HOME\.codex\skills\"
升级时请先删除旧目录再复制,否则新版本已删除的旧文件会残留(Claude Code 把
.codex换成.claude):rm -rf ~/.codex/skills/native-subtitle-quote-imageRemove-Item -Recurse -Force "$HOME\.codex\skills\native-subtitle-quote-image"
Claude Code:复制到 Claude Code 的 Skills 目录。
mkdir -p ~/.claude/skills && cp -R skills/native-subtitle-quote-image ~/.claude/skills/
Windows PowerShell:
New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null
Copy-Item -Recurse skills\native-subtitle-quote-image "$HOME\.claude\skills\"
Codex Skill Installer:在 Codex 中调用 $skill-installer,让它安装这个目录:
https://github.com/chengyi-ai/native-subtitle-quote-image/tree/main/skills/native-subtitle-quote-image
其他 Agent:本项目使用开放的 Agent Skills 目录格式。把 skills/native-subtitle-quote-image/ 复制到目标 Agent 的 Skills 目录即可,具体位置以该 Agent 的文档为准。
2. 安装依赖并自检
python3 -m pip install -r skills/native-subtitle-quote-image/requirements.txt
python3 skills/native-subtitle-quote-image/scripts/check_environment.py
要处理 YouTube 链接,再装 yt-dlp:
python3 -m pip install -U "yt-dlp[default]"
python3 skills/native-subtitle-quote-image/scripts/check_environment.py --url-mode
要画中日韩台词,用 --script-mode 检查字体。环境自检是只读的,不会自动安装或修改任何软件;缺组件时,Agent 会先说明用途,征得你同意再装。
3. 重开一个 Agent 任务,说一句话
使用 $native-subtitle-quote-image,把这个带内嵌中文字幕的视频做成原生字幕拼图。
如果你没有指定模式,Agent 会先问“您当前是选择原生字幕还是脚本字幕?”,并用一句话解释两者区别,再按你的选择处理。
| 原生字幕 | 脚本字幕 | |
|---|---|---|
| 什么时候用 | 关掉播放器的 CC 后,字幕仍然烧在画面里 | 要把已核对的台词、翻译或观点画到真实画面上 |
| 图里的字从哪来 | 视频像素本身,不 OCR 重绘,不翻译改写 | 你审核过的 lines[].text,明确属于后期字幕 |
| 命令 | render |
render-script |
[!IMPORTANT] 原生模式的字只能来自视频像素;脚本模式的字只能来自已审核的 JSON,不能冒充原字幕。 如果你要原生字幕,但视频只有可开关的字幕轨,Agent 会先说明限制,经你同意后才改用脚本模式。
flowchart LR
A[本地视频<br>或 YouTube 链接] --> B[获取视频<br>与字幕轨]
B --> C[检查真实帧<br>区分烧录字幕]
C --> D[按文字稿<br>选题选句]
D --> E{锁定模式}
E -->|原生| F[裁切画面<br>里的字幕条]
E -->|脚本| G[绘制已<br>审核台词]
F --> H[按模式渲染<br>逐张质检]
G --> H
Skill 支持三种工作方式:
yt-dlp。yt-dlp 获取你有权处理的视频、元数据和辅助字幕轨,再决定字幕模式。| 场景 | 对 Agent 说 |
|---|---|
| 视频自带烧录字幕 | 使用 $native-subtitle-quote-image,把这个带内嵌中文字幕的视频做成原生字幕拼图。 |
| 给的是链接 | 使用 $native-subtitle-quote-image,读取这个 YouTube 链接,先检查下载权限和烧录字幕,再选 3 个适合传播的主题,做成原生字幕拼图并逐张质检。 |
| 写稿配图一起做 | 先根据视频文字稿提炼选题并写文章,再用 $native-subtitle-quote-image 为每个核心观点选真实视频帧并出图;先判断原生或脚本字幕模式,不要混用。 |
| 用自己核对过的台词 | 使用 $native-subtitle-quote-image 的脚本字幕模式,把这份带时间点的中文台词画到真实视频帧上,做成紧凑 3:4 长图并逐张质检。 |
[!TIP]
$native-subtitle-quote-image是 Codex 的写法。在 Claude Code 里可以用/native-subtitle-quote-image,或者直接描述需求。
Agent 会先检查来源、字幕类型和候选帧,确定模式后再生成:
原生字幕时间点.json,或脚本模式的 lines JSON;final_contact_sheet.jpg 总览图。不经过 Agent 也可以直接跑脚本。下面的 VIDEO 换成你的视频路径。
自检来源:下载后先检查分辨率并解码前 10 秒,坏流或低清在抽帧前就失败(不传 --min-height 时低于 720p 只警告)。
python3 skills/native-subtitle-quote-image/scripts/native_subtitle_stitch.py check-source VIDEO --min-height 720
挑帧:生成带时间点的候选帧总览,不用反复试时间点。
python3 skills/native-subtitle-quote-image/scripts/native_subtitle_stitch.py sample VIDEO \
--start 30 --end 120 --interval 5 --out candidate-contact-sheet.jpg
不传 --start、--end 和 --interval 时,会在整段视频里均匀抽取最多 24 帧。已经知道大概时间点时,可以围绕每个点取前、中、后三帧,避开字幕切换的瞬间:
python3 skills/native-subtitle-quote-image/scripts/native_subtitle_stitch.py sample VIDEO \
-t 61.2 -t 68.9 -t 74.5 -t 82.0 -t 88.4 \
--around 0.8 --out focused-candidates.jpg
原生字幕:先用 band 确认字幕的裁切区域,再按 manifest 渲染一组成品。
python3 skills/native-subtitle-quote-image/scripts/native_subtitle_stitch.py band VIDEO \
-t 61.2 --band-top 0.78 --band-bottom 0.96 --out band-preview.jpg
python3 skills/native-subtitle-quote-image/scripts/native_subtitle_stitch.py render VIDEO \
--manifest manifest.json --out-dir output-v1 \
--band-top 0.78 --band-bottom 0.96
脚本字幕:准备 script.json,然后渲染。
python3 skills/native-subtitle-quote-image/scripts/native_subtitle_stitch.py render-script VIDEO \
--script script.json --out output.jpg --aspect 3:4 --width 1440
可选六句卡:script.json 中放 6 句已核对、时间点严格递增的台词。此预设在 1080×1440 画布上使用 870px 主画面和下方 5 条各 114px 的连续字幕条,首句与后五句等距;默认脚本布局不变。
python3 skills/native-subtitle-quote-image/scripts/native_subtitle_stitch.py render-script VIDEO \
--script script.json --out six-line.jpg --six-line-card --aspect 3:4 --width 1080
--six-line-card 仅用于后期绘制的脚本字幕,不接受 --layout natural 或 --hero-fraction。字幕条默认从源画面高度的 60% 处取样,可用 --band-center 调整;仍须逐句核对来源和逐张检查画面。
固定机位源与 --hero-zoom:优先选多机位、景别有变化的视频;固定机位视频(大师课、网课式录制)是高风险素材,六张主图容易几乎一样。render 与 render-script 支持可选的 --hero-zoom 1.0,0.9,0.95:逗号分隔的每卡主图缩放系数,范围 0.8–1.0,按卡循环,默认不启用且输出不变。它只裁掉更多主图画面再放大,字幕条、文字、条间距和六句卡几何不变,原生模式的裁切窗口不会进入字幕条。因为是裁切后放大,源视频清晰度不足时主图会更模糊,不等于真实清晰度提升。render-script 只输出一张图,取第一个系数。
呼吸缝 --strip-gap 与分隔线 --hero-divider:render 与 render-script 支持可选的 --strip-gap N(字幕条之间插入 N 像素黑色缝隙,0–8,默认 0)和 --hero-divider line(主图与字幕条之间插入 2px 细分隔线,默认 none)。二者只新增背景像素,不覆盖、不重绘原画面,原生字幕仍只经历整图统一缩放;固定画布总尺寸不变,字幕条相应变矮;与 --six-line-card 不兼容。
可选说话人前缀:问答、对谈类脚本字幕图,可以在 script.json 每句加 "speaker": "主持人",再加 --speaker-prefix on-change,只在换人时画出「主持人:」这类前缀;every 每句都画,none(默认)不画。前缀比台词小一号、用强调色,台词字号不会因为前缀而变小。说话人写在 speaker 字段里,不写进 text。
python3 skills/native-subtitle-quote-image/scripts/native_subtitle_stitch.py render-script VIDEO \
--script script.json --out qa.jpg --speaker-prefix on-change
可选金句强调:脚本字幕图可用 --emphasize-line last(最后一句)或 --emphasize-line 3(第 3 句,从 1 起算)给一句台词加暖色、加粗描边和轻微半透明底衬,方便截图搬走;也可在 script.json 的某句写 "emphasis": true。默认不启用,输出不变;行号越界会报错。只用于脚本模式,原生字幕模式不会重绘任何字幕。
保留人物原比例与横屏构图(v2.2.0):两种字幕模式都支持 --layout natural。不指定宽度时保留源宽度,图片高度按实际内容计算,不强制 3:4;指定 --width 也只做等比缩放。
# 原生字幕:保留画面像素,不重绘文字
python3 skills/native-subtitle-quote-image/scripts/native_subtitle_stitch.py render VIDEO \
--manifest manifest.json --out-dir output-natural --layout natural
#