bilibili-analyzer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Bilibili Video Analyzer

Bilibili Video Analyzer

Description

Description

B站视频内容分析工具。提供视频URL后,自动下载视频、拆解成帧图片,然后使用AI分析内容,最终生成高质量的专题文档或实操教程
核心特点:
  • 不是简单的时间线记录,而是重新组织整理成一篇完整的文档
  • 实操类视频 → 生成可直接使用的操作教程
  • 知识类视频 → 生成结构化的专题文档
  • 报告中插入关键截图,使用
    ![描述](./images/frame_xxxx.jpg)
    格式
A Bilibili video content analysis tool. After providing a video URL, it automatically downloads the video, splits it into frame images, then uses AI to analyze the content, and finally generates high-quality thematic documents or practical tutorials.
Core Features:
  • Instead of simple timeline recording, it reorganizes and restructures the content into a complete document
  • Practical videos → Generate ready-to-use operation tutorials
  • Knowledge-based videos → Generate structured thematic documents
  • Insert key screenshots in the report using the format
    ![Description](./images/frame_xxxx.jpg)

Source & Documentation

Source & Documentation

工具用途文档
FFmpeg视频拆帧官网 / 文档
Bilibili API视频下载API文档
ToolPurposeDocumentation
FFmpegVideo frame extractionOfficial Website / Documentation
Bilibili APIVideo downloadAPI Docs

Installation

Installation

1. 安装 .NET 10 SDK

1. Install .NET 10 SDK

脚本使用 .NET 10 单文件执行功能,需要安装 .NET 10 SDK。
验证安装:
bash
dotnet --version
The script uses .NET 10 single-file execution feature, so .NET 10 SDK is required.
Verify installation:
bash
dotnet --version

2. 安装 FFmpeg

2. Install FFmpeg

Windows:
powershell
undefined
Windows:
powershell
undefined

Chocolatey

Chocolatey

choco install ffmpeg
choco install ffmpeg

或 Scoop

Or Scoop

scoop install ffmpeg
scoop install ffmpeg

**macOS:**
```bash
brew install ffmpeg
Linux:
bash
undefined

**macOS:**
```bash
brew install ffmpeg
Linux:
bash
undefined

Ubuntu/Debian

Ubuntu/Debian

sudo apt install ffmpeg
sudo apt install ffmpeg

CentOS/RHEL

CentOS/RHEL

sudo yum install ffmpeg

验证安装:
```bash
ffmpeg -version
sudo yum install ffmpeg

Verify installation:
```bash
ffmpeg -version

Trigger

Trigger

  • /bilibili-analyzer
    命令
  • 用户请求分析B站视频
  • 用户提供B站视频链接并要求分析
  • /bilibili-analyzer
    command
  • User requests to analyze Bilibili videos
  • User provides a Bilibili video link and requests analysis

Provided Script

Provided Script

本 skill 提供了
scripts/prepare.cs
脚本用于下载视频和提取帧图片。
脚本位置:
skills/tools/bilibili-analyzer/scripts/prepare.cs
运行方式: 使用 .NET 10 单文件执行功能
This skill provides the
scripts/prepare.cs
script for downloading videos and extracting frame images.
Script Location:
skills/tools/bilibili-analyzer/scripts/prepare.cs
Execution Method: Use .NET 10 single-file execution feature

使用方法

Usage

bash
undefined
bash
undefined

基本用法

Basic usage

dotnet run scripts/prepare.cs "<视频URL>" -o <输出目录>
dotnet run scripts/prepare.cs "<Video URL>" -o <Output Directory>

示例

Example

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

长视频(降低帧率)

Long video (reduce frame rate)

dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./output --fps 0.5
undefined
dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./output --fps 0.5
undefined

参数说明

Parameter Description

参数说明默认值
url
B站视频URL(必需)-
-o, --output
输出目录当前目录
--fps
每秒提取帧数1.0
--similarity
相似度阈值(0-1),超过此值的相邻帧会被去重0.80
--no-dedup
禁用相似帧去重false
--video-only
只下载视频,不提取帧false
--frames-only
只提取帧(需已有video.mp4)false
ParameterDescriptionDefault Value
url
Bilibili video URL (required)-
-o, --output
Output directoryCurrent directory
--fps
Frames extracted per second1.0
--similarity
Similarity threshold (0-1), adjacent frames exceeding this value will be deduplicated0.80
--no-dedup
Disable similar frame deduplicationfalse
--video-only
Only download video, do not extract framesfalse
--frames-only
Only extract frames (requires existing video.mp4)false

相似帧去重

Similar Frame Deduplication

脚本会自动对相邻帧进行相似度检测,去除相似度超过阈值(默认80%)的重复帧:
  • 使用 ffmpeg 的 SSIM/PSNR 算法计算相似度
  • 只比较相邻帧,不会跨帧比较
  • 去重后自动重新编号(frame_0001.jpg, frame_0002.jpg, ...)
  • 可通过
    --similarity 0.85
    调整阈值
  • 可通过
    --no-dedup
    禁用去重
The script automatically performs similarity detection on adjacent frames and removes duplicate frames with similarity exceeding the threshold (default 80%):
  • Uses FFmpeg's SSIM/PSNR algorithm to calculate similarity
  • Only compares adjacent frames, no cross-frame comparison
  • Automatically renumbers after deduplication (frame_0001.jpg, frame_0002.jpg, ...)
  • Threshold can be adjusted via
    --similarity 0.85
  • Deduplication can be disabled via
    --no-dedup

输出结构

Output Structure

<输出目录>/
├── video.mp4           # 下载的视频文件
└── images/             # 帧图片目录
    ├── frame_0001.jpg
    ├── frame_0002.jpg
    ├── frame_0003.jpg
    └── ...
<Output Directory>/
├── video.mp4           # Downloaded video file
└── images/             # Frame image directory
    ├── frame_0001.jpg
    ├── frame_0002.jpg
    ├── frame_0003.jpg
    └── ...

Workflow (Prompt)

Workflow (Prompt)

你是一个视频内容分析助手。当用户提供B站视频链接时,按以下步骤执行:
You are a video content analysis assistant. When a user provides a Bilibili video link, follow these steps:

Step 1: 下载视频并拆帧

Step 1: Download Video and Split into Frames

使用提供的脚本下载视频并拆解成帧图片:
bash
dotnet run skills/tools/bilibili-analyzer/scripts/prepare.cs "<视频URL>" -o <输出目录>
注意事项:
  • 短视频(<10分钟): 使用默认
    --fps 1
  • 中等视频(10-30分钟): 使用
    --fps 0.5
  • 长视频(>30分钟): 使用
    --fps 0.2
Use the provided script to download the video and split it into frame images:
bash
dotnet run skills/tools/bilibili-analyzer/scripts/prepare.cs "<Video URL>" -o <Output Directory>
Notes:
  • Short videos (<10 minutes): Use default
    --fps 1
  • Medium videos (10-30 minutes): Use
    --fps 0.5
  • Long videos (>30 minutes): Use
    --fps 0.2

Step 2: 分析帧图片

Step 2: Analyze Frame Images

使用 Task 工具分批并行分析
images/
目录中的图片。
分批策略(根据总图片数动态计算):
总图片数分批数量每批图片数
1-301 批全部
31-602 批约 15-30 张/批
61-1203 批约 20-40 张/批
121-2004 批约 30-50 张/批
200+5 批平均分配
计算公式:
总图片数 <= 30: 1 批
总图片数 <= 60: 2 批
总图片数 <= 120: 3 批
总图片数 <= 200: 4 批
总图片数 > 200: 5 批

每批图片数 = 总图片数 / 分批数量(向上取整)
示例:假设有 85 张图片 → 分 3 批
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 模板:
读取并分析 <输出目录>/images/ 目录下的 frame_0001.jpg 到 frame_0020.jpg(共20张图片)。

【重要要求】
你的响应必须是这些图片内容的【完整详细报告】,不要省略任何信息。

对每张图片,详细记录:

1. **帧号**: frame_xxxx.jpg
2. **场景类型**: 代码编辑器/终端/浏览器/PPT/对话/其他
3. **界面内容**:
   - 窗口标题、菜单、按钮等UI元素
   - 当前打开的文件/页面
4. **文字内容**:
   - 完整转录屏幕上的所有文字
   - 代码内容(完整复制,保留格式)
   - 终端命令和输出
   - 注释和说明文字
5. **操作动作**:
   - 鼠标位置、点击目标
   - 正在进行的操作
6. **关键信息**:
   - 重要的配置项
   - 关键步骤说明
   - 错误信息或警告

【输出格式】
Use the Task tool to analyze images in the
images/
directory in batches and in parallel.
Batching Strategy (dynamically calculated based on total number of images):
Total ImagesNumber of BatchesImages per Batch
1-301 batchAll
31-602 batches~15-30 images/batch
61-1203 batches~20-40 images/batch
121-2004 batches~30-50 images/batch
200+5 batchesEvenly distributed
Calculation Formula:
Total Images <= 30: 1 batch
Total Images <= 60: 2 batches
Total Images <= 120: 3 batches
Total Images <= 200: 4 batches
Total Images > 200: 5 batches

Images per Batch = Total Images / Number of Batches (rounded up)
Example: If there are 85 images → split into 3 batches
Task 1: Analyze frame_0001.jpg ~ frame_0029.jpg (29 images)
Task 2: Analyze frame_0030.jpg ~ frame_0058.jpg (29 images)
Task 3: Analyze frame_0059.jpg ~ frame_0085.jpg (27 images)
Task Prompt Template:
Read and analyze frame_0001.jpg to frame_0020.jpg (total 20 images) in the <Output Directory>/images/ directory.

【Important Requirements】
Your response must be a **complete and detailed report** of these images' content, do not omit any information.

For each image, record in detail:

1. **Frame Number**: frame_xxxx.jpg
2. **Scene Type**: Code Editor/Terminal/Browser/PPT/Dialog/Other
3. **Interface Content**:
   - UI elements like window titles, menus, buttons
   - Currently open files/pages
4. **Text Content**:
   - Full transcription of all text on the screen
   - Code content (fully copied, retain format)
   - Terminal commands and output
   - Comments and explanatory text
5. **Operation Actions**:
   - Mouse position, click target
   - Ongoing operation
6. **Key Information**:
   - Important configuration items
   - Key step explanations
   - Error messages or warnings

【Output Format】

frame_0001.jpg

frame_0001.jpg

  • 场景: [场景类型]
  • 内容: [详细描述]
  • 文字/代码:
    [完整的文字或代码内容]
  • 操作: [正在进行的操作]
  • 要点: [关键信息]
  • Scene: [Scene Type]
  • Content: [Detailed Description]
  • Text/Code:
    [Complete text or code content]
  • Operation: [Ongoing Operation]
  • Key Points: [Key Information]

frame_0002.jpg

frame_0002.jpg

...
【注意】
  • 不要省略任何图片
  • 代码和文字必须完整转录
  • 信息越详细越好

**分析要点**:
1. 完整转录所有文字和代码内容
2. 详细描述界面元素和操作步骤
3. 记录每张图片的关键信息
4. 标注重要的截图帧号(如 frame_0042.jpg)
...
【Notes】
  • Do not omit any images
  • Code and text must be fully transcribed
  • The more detailed the information, the better

**Analysis Key Points**:
1. Fully transcribe all text and code content
2. Describe interface elements and operation steps in detail
3. Record key information of each image
4. Mark important screenshot frame numbers (e.g., frame_0042.jpg)

Step 3: 生成文档

Step 3: Generate Document

根据视频类型,将分析结果重新组织整理
视频分析.md
判断视频类型:
  • 实操类: 编程教程、软件操作、配置演示等
  • 知识类: 概念讲解、原理分析、经验分享等
【关键】图片与内容必须严格对应:
错误示例 ❌:
Reorganize and restructure the analysis results into
Video Analysis.md
based on video type:
Judge 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 Corresponding:
Wrong Example ❌:

安装 Node.js

Install Node.js

首先下载 Node.js... 截图 ← 图片可能是其他内容
正确示例 ✅:
First download Node.js... Screenshot ← The image may be other content
Correct Example ✅:

安装 Node.js

Install Node.js

首先下载 Node.js... frame_0015: Node.js官网下载页面 ← 图片确实是下载页面

**生成文档的正确流程**:

1. **先整理所有 Task 返回的分析结果**
   - 汇总所有帧的分析内容
   - 建立「帧号 → 内容」的对应关系

2. **按主题重新组织内容**(不是按时间顺序)
   - 将相关内容归类到同一章节
   - 确定每个章节需要哪些帧的信息

3. **插入图片时必须核对**
   - 只插入与当前内容**直接相关**的图片
   - 图片描述要准确反映图片实际内容
   - 使用格式: `![frame_xxxx: 图片实际内容描述](./images/frame_xxxx.jpg)`

4. **代码必须来自图片中的实际代码**
   - 不要自己编造代码
   - 代码块标注来源: `<!-- 来自 frame_0025 -->`

**重要原则**:
1. **图文对应** - 每张图片必须与其上下文内容匹配
2. **不要时间线流水账** - 重新组织内容,像写文章一样
3. **结构清晰** - 有章节划分和逻辑顺序
4. **代码真实** - 只使用图片中出现的代码,不要编造
5. **独立可读** - 不看视频也能完全理解
First download Node.js... frame_0015: Node.js Official Website Download Page ← The image is indeed the download page

**Correct Document Generation Process**:

1. **First organize all analysis results returned by Tasks**
   - Summarize analysis content of all frames
   - Establish the correspondence between "frame number → content"

2. **Reorganize content by topic** (not in chronological order)
   - Categorize related content into the same chapter
   - Determine which frames' information are needed for each chapter

3. **Verify carefully when inserting images**
   - Only insert images **directly related** to the current content
   - Image descriptions must accurately reflect the actual content of the image
   - Use format: `![frame_xxxx: Accurate description of image content](./images/frame_xxxx.jpg)`

4. **Code must come from actual code in images**
   - Do not fabricate code yourself
   - Mark code source: `<!-- From frame_0025 -->`

**Important Principles**:
1. **Image-Text Correspondence** - Each image must match the content of its context
2. **No Chronological流水账** - Reorganize content like writing an article
3. **Clear Structure** - Have chapter divisions and logical order
4. **Authentic Code** - Only use code that appears in images, do not fabricate
5. **Independent Readability** - Fully understandable without watching the video

Output Format

Output Format

实操教程类

Practical Tutorial Type

markdown
undefined
markdown
undefined

{教程主题}

{Tutorial Topic}

简介

Introduction

{教程目标} {前置条件和要求}
{Tutorial Objectives} {Prerequisites and Requirements}

环境准备

Environment Preparation

{需要安装的软件} {配置要求}
{Software to be Installed} {Configuration Requirements}

操作步骤

Operation Steps

1. {步骤标题}

1. {Step Title}

{详细说明,内容必须与下方图片对应}
frame_xxxx: 图片实际内容的准确描述
<!-- 代码来自 frame_xxxx -->
代码块
{Detailed description, content must correspond to the image below}
frame_xxxx: Accurate description of image content
<!-- Code from frame_xxxx -->
code block

2. {步骤标题}

2. {Step Title}

{详细说明}
frame_xxxx: 准确描述
...
{Detailed description}
frame_xxxx: Accurate description
...

完整代码

Complete Code

<!-- 汇总自 frame_xxxx, frame_xxxx, frame_xxxx -->
{汇总所有代码片段,标注来源帧号}
<!-- Summarized from frame_xxxx, frame_xxxx, frame_xxxx -->
{Summarize all code snippets, mark source frame numbers}

常见问题

Common Issues

{可能遇到的问题和解决方案}
{Possible issues and solutions}

总结

Summary

{核心要点回顾} {延伸学习建议}
undefined
{Review of core points} {Extended learning suggestions}
undefined

知识文档类

Knowledge Document Type

markdown
undefined
markdown
undefined

{主题}

{Topic}

概述

Overview

{主题背景介绍} {为什么重要}
{Topic background introduction} {Why it's important}

{章节1标题}

{Chapter 1 Title}

{内容,必须与配图对应}
frame_xxxx: 图片实际内容描述
{Content, must correspond to the accompanying image}
frame_xxxx: Description of image content

{章节2标题}

{Chapter 2 Title}

{内容}
frame_xxxx: 图片实际内容描述
{Content}
frame_xxxx: Description of image content

核心要点

Core Points

  • 要点1
  • 要点2
  • 要点3
  • Point 1
  • Point 2
  • Point 3

延伸阅读

Extended Reading

{相关资源和建议}
undefined
{Related resources and suggestions}
undefined

图片插入规范

Image Insertion Specifications

规则说明
帧号必须标注
![frame_0015: 描述](./images/frame_0015.jpg)
描述必须准确描述图片的实际内容,不是期望内容
内容必须匹配图片上方/下方的文字必须与图片内容相关
代码标注来源
<!-- 代码来自 frame_0025 -->
不要乱插图没有合适的图就不插,不要强行配图
RuleDescription
Frame Number Must Be Marked
![frame_0015: Description](./images/frame_0015.jpg)
Description Must Be AccurateDescribe the actual content of the image, not expected content
Content Must MatchText above/below the image must be directly related to the image content
Code Source Marked
<!-- From frame_0025 -->
No Random ImagesDo not insert images if there is no suitable one, do not force matching

API Reference

API Reference

Bilibili API

Bilibili API

脚本使用 Bilibili 官方 API 下载视频:
undefined
The script uses Bilibili official API to download videos:
undefined

获取视频信息

Get video information

获取播放地址

Get playback address


API 文档: https://github.com/SocialSisterYi/bilibili-API-collect

API Documentation: https://github.com/SocialSisterYi/bilibili-API-collect

FFmpeg 拆帧命令

FFmpeg Frame Extraction Commands

bash
undefined
bash
undefined

每秒1帧

1 frame per second

ffmpeg -i video.mp4 -vf "fps=1" -q:v 2 images/frame_%04d.jpg
ffmpeg -i video.mp4 -vf "fps=1" -q:v 2 images/frame_%04d.jpg

每秒0.5帧(每2秒1帧)

0.5 frames per second (1 frame every 2 seconds)

ffmpeg -i video.mp4 -vf "fps=0.5" -q:v 2 images/frame_%04d.jpg
ffmpeg -i video.mp4 -vf "fps=0.5" -q:v 2 images/frame_%04d.jpg

指定时间范围

Specify time range

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 -ss 00:01:00 -to 00:05:00 -vf "fps=1" -q:v 2 images/frame_%04d.jpg

提取关键帧(场景变化)

Extract keyframes (scene changes)

ffmpeg -i video.mp4 -vf "select='gt(scene,0.3)'" -vsync vfr -q:v 2 images/frame_%04d.jpg

更多选项: https://ffmpeg.org/ffmpeg.html
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

Examples

示例1: 分析编程教程

Example 1: Analyze Programming Tutorial

bash
undefined
bash
undefined

1. 下载并拆帧

1. Download and split into frames

dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./react-tutorial
dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./react-tutorial

2. 分析图片(使用 Task 工具)

2. Analyze images (use Task tool)

3. 生成 react-tutorial/视频分析.md

3. Generate react-tutorial/Video Analysis.md

undefined
undefined

示例2: 分析长视频

Example 2: Analyze Long Video

bash
undefined
bash
undefined

降低帧率,减少图片数量

Reduce frame rate to reduce number of images

dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./long-video --fps 0.2
undefined
dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./long-video --fps 0.2
undefined

示例3: 只下载视频

Example 3: Only Download Video

bash
dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./output --video-only
bash
dotnet run scripts/prepare.cs "https://www.bilibili.com/video/BV1xx411c7mD" -o ./output --video-only

Quality Checklist

Quality Checklist

生成文档前,逐项检查以下要求:
Before generating the document, check each item of the following requirements:

内容质量

Content Quality

  • 内容重新组织,不是时间线流水账
  • 章节结构清晰,有逻辑顺序
  • 不看视频也能理解全部内容
  • 包含环境准备/前置条件说明
  • 包含总结和核心要点
  • Content is reorganized, not a chronological流水账
  • Chapter structure is clear with logical order
  • All content is understandable without watching the video
  • Includes environment preparation/prerequisite explanations
  • Includes summary and core points

图文对应(重要!)

Image-Text Correspondence (Important!)

  • 每张图片都标注了帧号:
    ![frame_xxxx: 描述](...)
  • 图片描述准确反映图片实际内容
  • 图片上下文的文字与图片内容直接相关
  • 没有随意插入不相关的图片
  • 代码块标注了来源帧号:
    <!-- 来自 frame_xxxx -->
  • Each image is marked with frame number:
    ![frame_xxxx: Description](...)
  • Image descriptions accurately reflect the actual content of the image
  • Text around the image is directly related to the image content
  • No irrelevant images are inserted randomly
  • Code blocks are marked with source frame number:
    <!-- From frame_xxxx -->

代码质量

Code Quality

  • 代码来自图片中的实际代码,不是编造的
  • 代码片段完整,可直接复制使用
  • 完整代码章节汇总了所有代码并标注来源
  • Code comes from actual code in images, not fabricated
  • Code snippets are complete and can be copied and used directly
  • Complete code chapter summarizes all code and marks sources

Tags

Tags

bilibili
,
video-analysis
,
ai
,
frame-extraction
,
markdown
,
tutorial
,
ffmpeg
,
dotnet
bilibili
,
video-analysis
,
ai
,
frame-extraction
,
markdown
,
tutorial
,
ffmpeg
,
dotnet

Compatibility

Compatibility

  • Codex: Yes
  • Claude Code: Yes
  • Codex: Yes
  • Claude Code: Yes