Skip to content

Commit 3042a23

Browse files
committed
feat(bilibili-analyzer): enhance video analysis with audio extraction and frame similarity detection
- Add audio extraction module with FFmpeg integration for WAV/MP3 output - Implement audio transcription using Whisper with configurable model sizes - Add frame similarity detection using imagehash to reduce redundant frames - Implement incremental report generation with resume capability - Update main.py with new CLI parameters for audio and similarity control - Enhance SKILL.md documentation with detailed usage examples and output structure - Add Claude Code CLI analyzer for frame-by-frame video analysis - Update API endpoints to support new bilibili-analyzer features - Improve SkillsPage UI to display enhanced tool capabilities - Refactor models.py to support audio metadata and similarity scores - Add support for scene detection and customizable frame extraction intervals - Enable frame merging with configurable similarity threshold (0-1 range)
1 parent c9eb82f commit 3042a23

11 files changed

Lines changed: 2190 additions & 238 deletions

File tree

skills/tools/bilibili-analyzer/SKILL.md

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: bilibili-analyzer
3-
description: 自动分析B站视频内容,提取关键帧,使用AI分析并生成带截图的Markdown总结报告
3+
description: 自动分析B站视频内容,提取关键帧,使用Claude Code AI分析并生成带截图的Markdown总结报告
44
metadata:
55
short-description: B站视频AI分析工具
66
source:
@@ -12,7 +12,13 @@ source:
1212

1313
## Description
1414

15-
自动化B站视频内容分析工具。提供视频URL后,系统自动下载视频、提取关键帧、AI分析内容,生成带截图和时间戳的Markdown报告。
15+
自动化B站视频内容分析工具。提供视频URL后,系统自动:
16+
1. 下载视频
17+
2. 每秒提取1帧图片
18+
3. 智能合并相似帧,减少冗余
19+
4. 提取音频并转文字(可选)
20+
5. 使用 Claude Code CLI 逐帧分析
21+
6. 生成带截图和时间戳的 `视频分析报告.md`
1622

1723
## Trigger
1824

@@ -23,14 +29,20 @@ source:
2329
## Usage
2430

2531
```bash
26-
# 基本用法
32+
# 基本用法(每秒1帧,自动合并相似帧)
2733
python scripts/main.py "https://www.bilibili.com/video/BV1xx411c7mD"
2834

29-
# 自定义帧间隔和最大帧数
30-
python scripts/main.py "https://www.bilibili.com/video/BV1xx411c7mD" -i 60 -m 30
35+
# 自定义帧间隔(每2秒1帧)
36+
python scripts/main.py "https://www.bilibili.com/video/BV1xx411c7mD" -i 2
3137

32-
# 指定输出目录和分析焦点
33-
python scripts/main.py "https://www.bilibili.com/video/BV1xx411c7mD" -o ./output -f text,faces
38+
# 禁用音频分析(更快)
39+
python scripts/main.py "https://www.bilibili.com/video/BV1xx411c7mD" --no-audio
40+
41+
# 调整相似帧阈值(0.9 = 更激进的合并)
42+
python scripts/main.py "https://www.bilibili.com/video/BV1xx411c7mD" -s 0.9
43+
44+
# 指定输出目录
45+
python scripts/main.py "https://www.bilibili.com/video/BV1xx411c7mD" -o ./output
3446

3547
# 短链接
3648
python scripts/main.py "https://b23.tv/xxxxx"
@@ -41,31 +53,53 @@ python scripts/main.py "https://b23.tv/xxxxx"
4153
| 参数 | 说明 | 默认值 |
4254
|------|------|--------|
4355
| `url` | B站视频URL(必需) | - |
44-
| `-i, --interval` | 帧提取间隔(秒) | 30 |
45-
| `-m, --max-frames` | 最大帧数 | 50 |
56+
| `-i, --interval` | 帧提取间隔(秒) | 1 |
57+
| `-m, --max-frames` | 最大帧数(0=不限制) | 0 |
58+
| `-s, --similarity` | 相似帧检测阈值(0-1) | 0.95 |
4659
| `-o, --output` | 输出目录 | ./bilibili |
47-
| `-f, --focus` | 分析焦点 | text,objects,faces,actions,scene |
48-
| `-w, --workers` | 并行worker数 | 4 |
60+
| `--no-audio` | 禁用音频提取和转录 | false |
61+
| `--whisper-model` | Whisper模型大小 | base |
62+
| `--language` | 音频语言代码 | zh |
63+
| `--scene-detection` | 启用场景变化检测 | false |
64+
| `--resume` | 断点续传 | false |
65+
66+
## Output Structure
67+
68+
```
69+
bilibili/{video_title}/
70+
├── 视频分析报告.md # 主报告文件
71+
├── images/ # 帧图片目录
72+
│ ├── frame_000001.jpg
73+
│ ├── frame_000002.jpg
74+
│ └── ...
75+
├── audio/ # 音频文件目录
76+
│ └── audio.wav
77+
├── transcript.json # 音频转录结果
78+
└── manifest.json # 帧清单
79+
```
4980

5081
## Requirements
5182

52-
- **FFmpeg**: 帧提取必需
53-
- **Python**: requests, yt-dlp
83+
- **FFmpeg**: 帧提取和音频提取必需
84+
- **Python**: requests, yt-dlp, Pillow, imagehash
85+
- **Claude Code CLI**: AI分析必需(`claude` 命令)
86+
- **Whisper** (可选): 音频转文字(`pip install openai-whisper``pip install faster-whisper`
5487

5588
详细安装说明见 [references/installation.md](references/installation.md)
5689

5790
## References
5891

5992
- [安装指南](references/installation.md) - 系统依赖和Python包安装
6093
- [常见问题](references/faq.md) - FAQ和错误处理
94+
- [改进计划](docs/plans/improvement-plan.md) - 开发计划文档
6195

6296
## Examples
6397

6498
- [基本使用示例](examples/basic-usage.md) - 常用场景和命令示例
6599

66100
## Tags
67101

68-
`bilibili`, `video-analysis`, `ai`, `frame-extraction`, `markdown`
102+
`bilibili`, `video-analysis`, `ai`, `frame-extraction`, `markdown`, `claude-code`
69103

70104
## Compatibility
71105

0 commit comments

Comments
 (0)