Description
Bilibili video content analysis tool. After providing a video URL, it automatically downloads the video, breaks it down into frame images, then uses AI to analyze the content, ultimately generatinghigh-quality feature documents or hands-on tutorials。
Core Features:
- It is not a simple timeline record, but ratherreorganizes and arrangesinto a complete document
- Hands-on videos → generatedirectly usable operation tutorials
- Knowledge videos → generatestructured feature documents
- Insert key screenshots into the report, using the
format
Source & Documentation
| Tool | Purpose | Documentation |
|---|---|---|
| FFmpeg | Video frame extraction | Official Website / Documentation |
| Bilibili API | Video download | API Documentation |
Installation
1. Install .NET 10 SDK
The script uses the .NET 10 single-file execution feature, so the .NET 10 SDK needs to be installed.
Download address: https://dotnet.microsoft.com/download/dotnet/10.0
Verify installation:
dotnet --version
2. Install FFmpeg
Windows:
# Chocolatey
choco install ffmpeg
# 或 Scoop
scoop install ffmpeg
# 或手动下载: https://ffmpeg.org/download.html
macOS:
brew install ffmpeg
Linux:
# Ubuntu/Debian
sudo apt install ffmpeg
# CentOS/RHEL
sudo yum install ffmpeg
Verify installation:
ffmpeg -version
Trigger
/bilibili-analyzercommand- The user requests analysis of a Bilibili video
- The user provides a Bilibili video link and requests analysis
Provided Script
This skill provides the scripts/prepare.cs script for downloading videos and extracting frame images.
Script location: skills/tools/bilibili-analyzer/scripts/prepare.cs
How to run: Use the .NET 10 single-file execution feature
Usage
# 基本用法
dotnet run scripts/prepare.cs "<视频URL>" -o <输出目录>
# 示例
dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./output
# 长视频(降低帧率)
dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./output --fps 0.5
Parameter description
| Parameter | Description | Default value |
|---|---|---|
url |
Bilibili video URL (required) | - |
-o, --output |
Output directory | Current directory |
--fps |
Number of frames extracted per second | 1.0 |
--similarity |
Similarity threshold (0-1); adjacent frames exceeding this value will be deduplicated | 0.80 |
--no-dedup |
Disable similar frame deduplication | false |
--video-only |
Only download the video, do not extract frames | false |
--frames-only |
Only extract frames (video.mp4 must already exist) | false |
Similar frame deduplication
The script automatically performsadjacent framessimilarity detection and removes duplicate frames whose similarity exceeds the threshold (80% by default):
- Use ffmpeg's SSIM/PSNR algorithm to calculate similarity
- Only compare adjacent frames, no cross-frame comparison
- After deduplication, automatically renumber (frame_0001.jpg, frame_0002.jpg, ...)
- Can be adjusted via
--similarity 0.85to adjust the threshold - Can be disabled via
--no-dedupto disable deduplication
Output structure
<输出目录>/
├── video.mp4 # 下载的视频文件
└── images/ # 帧图片目录
├── frame_0001.jpg
├── frame_0002.jpg
├── frame_0003.jpg
└── ...
Workflow (Prompt)
You are a video content analysis assistant. When the user provides a Bilibili video link, execute the following steps:
Step 1: Download the video and extract frames
Use the provided script to download the video and break it down into frame images:
dotnet run skills/tools/bilibili-analyzer/scripts/prepare.cs "<视频URL>" -o <输出目录>
Notes:
- Short videos (<10 minutes): use the default
--fps 1 - Medium videos (10-30 minutes): use
--fps 0.5 - Long videos (>30 minutes): use
--fps 0.2
Step 2: Analyze the frame images
Use the Task toolto analyze the images in the images/ directory in batches in parallel.
Batching strategy(calculated dynamically based on the total number of images):
| Total number of images | Number of batches | Images per batch |
|---|---|---|
| 1-30 | 1 batch | All |
| 31-60 | 2 batches | About 15-30 images/batch |
| 61-120 | 3 batches | About 20-40 images/batch |
| 121-200 | 4 batches | About 30-50 images/batch |
| 200+ | 5 batches | Evenly distributed |
Calculation formula:
总图片数 <= 30: 1 批
总图片数 <= 60: 2 批
总图片数 <= 120: 3 批
总图片数 <= 200: 4 批
总图片数 > 200: 5 批
每批图片数 = 总图片数 / 分批数量(向上取整)
Example: Suppose there are 85 images → split into 3 batches
Task 1: 分析 frame_0001.jpg ~ frame_0029.jpg(29张)
Task 2: 分析 frame_0030.jpg ~ frame_0058.jpg(29张)
Task 3: 分析 frame_0059.jpg ~ frame_0085.jpg(27张)
Task Prompt template:
读取并分析 <输出目录>/images/ 目录下的 frame_0001.jpg 到 frame_0020.jpg(共20张图片)。
【重要要求】
你的响应必须是这些图片内容的【完整详细报告】,不要省略任何信息。
对每张图片,详细记录:
1. **帧号**: frame_xxxx.jpg
2. **场景类型**: 代码编辑器/终端/浏览器/PPT/对话/其他
3. **界面内容**:
- 窗口标题、菜单、按钮等UI元素
- 当前打开的文件/页面
4. **文字内容**:
- 完整转录屏幕上的所有文字
- 代码内容(完整复制,保留格式)
- 终端命令和输出
- 注释和说明文字
5. **操作动作**:
- 鼠标位置、点击目标
- 正在进行的操作
6. **关键信息**:
- 重要的配置项
- 关键步骤说明
- 错误信息或警告
【输出格式】
## frame_0001.jpg
- 场景: [场景类型]
- 内容: [详细描述]
- 文字/代码:
[complete text or code content]
- 操作: [正在进行的操作]
- 要点: [关键信息]
## frame_0002.jpg
...
【注意】
- 不要省略任何图片
- 代码和文字必须完整转录
- 信息越详细越好
Analysis points:
- Fully transcribe all text and code content
- Describe UI elements and operation steps in detail
- Record the key information of each image
- Mark important screenshot frame numbers (such as frame_0042.jpg)
Step 3: Generate document
According to the video type, reorganize and arrange the analysis resultsreorganize and arrangeinto 视频分析.md:
Determine the video type:
- Practical type: programming tutorials, software operations, configuration demonstrations, etc.
- Knowledge type: concept explanations, principle analysis, experience sharing, etc.
[Key] Images and content must strictly correspond:
错误示例 ❌:
### 安装 Node.js
首先下载 Node.js...
 ← 图片可能是其他内容
正确示例 ✅:
### 安装 Node.js
首先下载 Node.js...
 ← 图片确实是下载页面
Correct process for generating documents:
-
First organize the analysis results returned by all Tasks
- Summarize the analysis content of all frames
- Establish the correspondence between "frame number → content"
-
Reorganize the content by theme(not in chronological order)
- Classify related content into the same chapter
- Determine which frames' information each chapter needs
-
Must verify when inserting images
- Only insert images that are directly related to the current contentdirectly relatedimages
- Image descriptions must accurately reflect the actual content of the image
- Use format:

-
Code must come from the actual code in the image
- Do not make up code yourself
- Code block source annotation:
<!-- 来自 frame_0025 -->
Important principles:
- Image-text correspondence - Each image must match its contextual content
- Do not write a chronological running account - Reorganize the content, like writing an article
- Clear structure - Has chapter divisions and logical order
- Authentic code - Only use code that appears in the images, do not fabricate
- Independently readable - Can be fully understood without watching the video
Output Format
Practical tutorial type
# {教程主题}
## 简介
{教程目标}
{前置条件和要求}
## 环境准备
{需要安装的软件}
{配置要求}
## 操作步骤
### 1. {步骤标题}
{详细说明,内容必须与下方图片对应}

<!-- 代码来自 frame_xxxx -->
```代码块```
### 2. {步骤标题}
{详细说明}

...
## 完整代码
<!-- 汇总自 frame_xxxx, frame_xxxx, frame_xxxx -->
{汇总所有代码片段,标注来源帧号}
## 常见问题
{可能遇到的问题和解决方案}
## 总结
{核心要点回顾}
{延伸学习建议}
Knowledge document type
# {主题}
## 概述
{主题背景介绍}
{为什么重要}
## {章节1标题}
{内容,必须与配图对应}

## {章节2标题}
{内容}

## 核心要点
- 要点1
- 要点2
- 要点3
## 延伸阅读
{相关资源和建议}
Image insertion specifications
| Rule | Description |
|---|---|
| Frame number must be marked |  |
| Description must be accurate | Describe the actual content of the image, not the expected content |
| Content must match | The text above/below the image must be related to the image content |
| Code source labeling | <!-- 代码来自 frame_0025 --> |
| Do not insert images randomly | If there is no suitable image, do not insert one; do not force an image into the text |
API Reference
Bilibili API
The script uses Bilibili's official API to download videos:
# 获取视频信息
GET https://api.bilibili.com/x/web-interface/view?bvid=BV1xx411c7mD
# 获取播放地址
GET https://api.bilibili.com/x/player/playurl?bvid=BV1xx411c7mD&cid={cid}&qn=80&fnval=1
API documentation: https://github.com/SocialSisterYi/bilibili-API-collect
FFmpeg frame extraction command
# 每秒1帧
ffmpeg -i video.mp4 -vf "fps=1" -q:v 2 images/frame_%04d.jpg
# 每秒0.5帧(每2秒1帧)
ffmpeg -i video.mp4 -vf "fps=0.5" -q:v 2 images/frame_%04d.jpg
# 指定时间范围
ffmpeg -i video.mp4 -ss 00:01:00 -to 00:05:00 -vf "fps=1" -q:v 2 images/frame_%04d.jpg
# 提取关键帧(场景变化)
ffmpeg -i video.mp4 -vf "select='gt(scene,0.3)'" -vsync vfr -q:v 2 images/frame_%04d.jpg
More options: https://ffmpeg.org/ffmpeg.html
Examples
Example 1: Analyze a programming tutorial
# 1. 下载并拆帧
dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./react-tutorial
# 2. 分析图片(使用 Task 工具)
# 3. 生成 react-tutorial/视频分析.md
Example 2: Analyze a long video
# 降低帧率,减少图片数量
dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./long-video --fps 0.2
Example 3: Download only the video
dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./output --video-only
Quality Checklist
Before generating the document,check item by itemthe following requirements:
Content quality
- Content is reorganized, not a chronological running account
- Chapter structure is clear and has a logical order
- All content can be understood without watching the video
- Includes environment preparation/prerequisite explanations
- Includes a summary and key points
Image-text correspondence (important!)
- Each image is labeled with its frame number:
 - Image descriptions accurately reflect the imageactual content
- The text in the context of an image isdirectly related
- No unrelated images are inserted arbitrarily
- Code blocks are labeled with the source frame number:
<!-- 来自 frame_xxxx -->
Code quality
- Code comes from the actual code in the images, not fabricated
- Code snippets are complete and can be copied and used directly
- The complete code chapter summarizes all code and labels its source
Tags
bilibili, video-analysis, ai, frame-extraction, markdown, tutorial, ffmpeg, dotnet
Compatibility
- Codex: Yes
- Claude Code: Yes