Skip to content
cccskills
FreePublished on GitHub

srt-to-structured-data

将 SRT 字幕文件转换为结构化 JSON 数据。触发场景: (1) 需要解析 SRT 字幕文件 (2) 需要将字幕转为 JSON/结构化格式 (3) 需要提取字幕时间码和文本 (4) 视频字幕数据处理和分析 (5) 生成字幕纯文本或统计信息

The English summary is being prepared. Showing the original description.

See how to install

Files included (2)

  • SKILL.md3.1 KB
  • scripts/parse_srt.py4.9 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

SRT 字幕转结构化数据

将 SRT 字幕文件解析为结构化 JSON 格式,支持提取时间码、计算时长、生成统计信息。

快速开始

基础用法

# 解析 SRT 文件,输出到终端
python <skill_path>/scripts/parse_srt.py input.srt

# 输出到文件
python <skill_path>/scripts/parse_srt.py input.srt -o output.json

# 包含统计信息
python <skill_path>/scripts/parse_srt.py input.srt --stats

# 仅输出纯文本(去除时间码)
python <skill_path>/scripts/parse_srt.py input.srt --text-only

注意: <skill_path> 是此 skill 的安装路径,通常为 ~/.claude/plugins/srt-to-structured-data@claude-code-skills/skills/srt-to-structured-data

输出格式

JSON 结构化数据

{
  "subtitles": [
    {
      "index": 1,
      "start_time": "00:00:00,000",
      "end_time": "00:00:02,566",
      "start_ms": 0,
      "end_ms": 2566,
      "duration_ms": 2566,
      "text": "Clawdbot真的太火太火太火了"
    },
    {
      "index": 2,
      "start_time": "00:00:02,633",
      "end_time": "00:00:04,766",
      "start_ms": 2633,
      "end_ms": 4766,
      "duration_ms": 2133,
      "text": "Github一天直接涨了5万星"
    }
  ],
  "statistics": {
    "total_count": 2,
    "total_duration_ms": 4699,
    "total_duration_formatted": "00:04",
    "avg_duration_ms": 2349
  }
}

纯文本输出

使用 --text-only 参数时,仅输出字幕文本,每条一行:

Clawdbot真的太火太火太火了
Github一天直接涨了5万星

命令行参数

参数说明
input.srt输入的 SRT 字幕文件路径
-o, --output输出文件路径(默认输出到终端)
--stats在 JSON 输出中包含统计信息
--text-only仅输出纯文本,去除时间码和序号

字段说明

字段类型说明
indexint字幕序号
start_timestring开始时间(原始格式)
end_timestring结束时间(原始格式)
start_msint开始时间(毫秒)
end_msint结束时间(毫秒)
duration_msint持续时长(毫秒)
textstring字幕文本内容

使用示例

场景 1:分析字幕文件

python <skill_path>/scripts/parse_srt.py video.srt --stats -o analysis.json

场景 2:提取纯文本用于翻译

python <skill_path>/scripts/parse_srt.py video.srt --text-only -o transcript.txt

场景 3:在 Python 中直接使用

import subprocess
import json

result = subprocess.run(
    ['python', '<skill_path>/scripts/parse_srt.py',
     'input.srt', '--stats'],
    capture_output=True, text=True
)
data = json.loads(result.stdout)

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Agent Teams 智能编排决策引擎。自动分析任务复杂度,判断使用 Subagent 还是 Agent Teams。 触发场景: (1) 任务涉及多角度并行分析(如代码审查、竞争假说调试) (2) 需要成员之间互相通信、质疑、协作 (3) 跨层开发(前端/后端/测试各自负责) (4) 用户明确要求"创建团队"、"用 agent teams" (5) 任务描述包含"并行"、"同时"、"多人"、"协作"等关键词 (6) 使用 /team 命令

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

为 B站视频生成章节列表。 触发场景: (1) 需要为视频创建 B站章节 (2) 用户说"转成B站格式"、"生成章节"、"生成B站章节" (3) 需要从字幕生成视频分段 (4) 处理视频进度条分段标记

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

Manage Feishu channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Feishu channel.

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

Set up the Feishu channel — save the bot credentials and check connection status. Use when the user pastes Feishu app credentials, asks to configure Feishu, or wants to check channel status.

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

LangChain 1.0 使用指南。提供 Agent、Tool、Memory、Middleware 等核心概念的快速参考。当用户需要创建 AI Agent、集成 LangChain、或解决 LangChain 相关问题时激活。

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

新闻站点内容提取。支持微信公众号、今日头条、网易新闻、搜狐新闻、腾讯新闻。当用户需要提取新闻内容、抓取公众号文章、爬取新闻、或获取新闻JSON/Markdown时激活。

The English summary is being prepared. Showing the original description.

NanmiCoder/claude-code-skills60Updated Apr 3, 2026

See all skills by NanmiCoder

Report a problem with this skill