bilibili-chapter-generator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

B站视频章节生成器

Bilibili Video Chapter Generator

根据字幕内容为 B站视频生成章节列表,用户可直接复制到 B站视频编辑页面。
Generate chapter lists for Bilibili videos based on subtitle content, which users can directly copy to the Bilibili video editing page.

B站章节格式规范

Bilibili Chapter Format Specifications

00:00 引言
01:23 第一部分标题
05:30 第二部分标题
格式要求(B站硬性限制):
  • 第一个章节必须从
    00:00
    开始
    (这是强制要求)
  • 章节数量:3-10 个(必须 > 2 且 ≤ 10)
  • 章节标题不能包含特殊符号(禁止使用
    :
    【】
    ()
    等)
  • 时间格式:
    MM:SS
    (分:秒)或
    HH:MM:SS
    (时:分:秒)
  • 每行一个章节:
    时间戳 章节标题
  • 章节间隔必须 ≥ 5 秒
00:00 Introduction
01:23 Part 1 Title
05:30 Part 2 Title
Format Requirements (Bilibili Mandatory Restrictions):
  • The first chapter must start at
    00:00
    (This is a mandatory requirement)
  • Number of chapters: 3-10 (Must be > 2 and ≤ 10)
  • Chapter titles cannot contain special characters (Prohibited characters include
    :
    【】
    ()
    etc.)
  • Time format:
    MM:SS
    (minutes:seconds) or
    HH:MM:SS
    (hours:minutes:seconds)
  • One chapter per line:
    Timestamp Chapter Title
  • Interval between chapters must be ≥ 5 seconds

工作流程

Workflow

Step 1: 获取 SRT 文件

Step 1: Obtain SRT File

询问用户 SRT 字幕文件路径,或从上下文中获取。
Ask the user for the SRT subtitle file path, or retrieve it from the context.

Step 2: 解析字幕内容

Step 2: Parse Subtitle Content

调用
srt-to-structured-data
skill 解析字幕:
bash
python3 ~/.claude/skills/srt-to-structured-data/scripts/parse_srt.py "<srt_file_path>" --stats
这会输出:
  • 字幕的 JSON 结构(包含时间码和文本)
  • 统计信息(总时长、字幕数量等)
Call the
srt-to-structured-data
skill to parse subtitles:
bash
python3 ~/.claude/skills/srt-to-structured-data/scripts/parse_srt.py "<srt_file_path>" --stats
This will output:
  • JSON structure of subtitles (including timestamps and text)
  • Statistical information (total duration, number of subtitles, etc.)

Step 3: 分析字幕内容

Step 3: Analyze Subtitle Content

阅读字幕内容,理解视频的:
  • 主题和结构
  • 内容转折点
  • 关键话题变化
Read the subtitle content to understand the video's:
  • Theme and structure
  • Content turning points
  • Key topic changes

Step 4: 生成章节列表

Step 4: Generate Chapter List

根据用户的描述意图(如果有)或自动分析,生成章节列表:
  1. 识别内容转折点:找出话题变化、新段落开始的位置
  2. 确定章节标题:简洁描述该段内容(建议 2-8 个字)
  3. 校验时间间隔:确保相邻章节间隔 ≥ 5 秒
  4. 格式化输出:使用
    MM:SS 标题
    格式
Generate the chapter list based on the user's described intent (if any) or automatic analysis:
  1. Identify content turning points: Locate positions where topics change or new paragraphs begin
  2. Determine chapter titles: Briefly describe the content of the segment (2-8 characters recommended)
  3. Verify time intervals: Ensure the interval between adjacent chapters is ≥ 5 seconds
  4. Format output: Use the
    MM:SS Title
    format

Step 5: 输出结果

Step 5: Output Results

输出纯文本格式的章节列表,用户可直接复制:
00:00 开场介绍
02:15 核心概念讲解
08:30 实战演示
15:00 总结回顾
Output the chapter list in plain text format, which users can directly copy:
00:00 Opening Introduction
02:15 Core Concept Explanation
08:30 Practical Demonstration
15:00 Summary and Review

使用示例

Usage Examples

用户输入:
帮我把 ./视频字幕.srt 转成B站章节
或更详细的需求:
帮我生成B站章节,要求:
- 字幕文件:./demo.srt
- 大概分成 5-6 个章节
- 重点突出实战部分
User Input:
Help me convert ./video-subtitles.srt to Bilibili chapters
Or more detailed requirements:
Help me generate Bilibili chapters with the following requirements:
- Subtitle file: ./demo.srt
- Approximately 5-6 chapters
- Highlight the practical section

章节划分建议

Chapter Division Recommendations

B站限制:3-10 个章节(必须 > 2 且 ≤ 10)
  • 短视频(< 5 分钟):3-4 个章节
  • 中等视频(5-15 分钟):4-7 个章节
  • 长视频(> 15 分钟):7-10 个章节
Bilibili Restriction: 3-10 chapters (Must be > 2 and ≤ 10)
  • Short videos (< 5 minutes): 3-4 chapters
  • Medium-length videos (5-15 minutes): 4-7 chapters
  • Long videos (> 15 minutes): 7-10 chapters

注意事项

Notes

  1. 第一个章节必须是
    00:00
    ,命名为"开场"、"引言"或直接点题
  2. 章节标题禁止特殊符号:不能使用冒号、顿号、逗号、括号等,只用纯中文/英文/数字
  3. 章节标题要简洁有力,便于观众快速定位(建议 2-8 个字,纯文字)
  4. 最后一个章节可以是"总结"、"结语"或"彩蛋"
  5. 避免章节过于密集(间隔太短会显得杂乱)
  6. 时间戳取字幕段落开始时间,向下取整到秒
  7. 章节总数必须 > 2 且 ≤ 10,否则B站会拒绝
  1. The first chapter must start at
    00:00
    , named "Opening", "Introduction" or directly state the topic
  2. Chapter titles are prohibited from containing special characters: Colons, commas, brackets, etc. are not allowed; only use Chinese/English/numbers
  3. Chapter titles should be concise and powerful, allowing viewers to quickly locate content (2-8 characters recommended, plain text only)
  4. The last chapter can be "Summary", "Conclusion" or "Easter Egg"
  5. Avoid overly dense chapters (too short intervals will look cluttered)
  6. Timestamps should take the start time of subtitle paragraphs, rounded down to the nearest second
  7. The total number of chapters must be > 2 and ≤ 10, otherwise Bilibili will reject it

章节标题示例

Chapter Title Examples

正确示例:
  • 00:00 开场介绍
  • 03:35 Agent演示加载skill流程
  • 05:39 环境配置
  • 08:38 源码解析
错误示例(包含特殊符号):
  • 03:35 Agent演示:加载skill的流程
    (包含冒号)
  • 05:39 环境准备、安装依赖
    (包含顿号)
  • 08:38 代码解析(核心逻辑)
    (包含括号)
Correct Examples:
  • 00:00 Opening Introduction
  • 03:35 Agent Demo: Skill Loading Process
  • 05:39 Environment Configuration
  • 08:38 Source Code Analysis
Incorrect Examples (Contain Special Characters):
  • 03:35 Agent Demo: Loading Skill Process
    (Contains colon)
  • 05:39 Environment Preparation, Install Dependencies
    (Contains comma)
  • 08:38 Code Analysis (Core Logic)
    (Contains brackets)