Files
lesson-highlights/README.md
T
hmo aad1548348 refactor: extract config.py, add burn_only, fix title_segments and font size
- Extract all path/API config to config.py (single source of truth)
- Add run.py / burn_only.py / run.bat / burn.bat entry points
- burn_only: skip transcription/subtitle gen, fast reburn existing SRTs
- Fix title_segments: use transcript keyword time for split point
- Fix subtitle: each overlapping title shows max title_duration (not full clip)
- Fix burn_only font size: default from 90 to 60
- Delete old run_lesson1.bat/py, temp debug scripts
- Update README, ARCHITECTURE, CHANGELOG, add USAGE.md
2026-05-03 23:22:10 +08:00

117 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Lesson Highlights Generator
教学视频精华片段生成工具。输入课程视频 + PPT,自动提取精华片段,转录、纠错、生成字幕,批量烧录到视频中。
## 功能特点
- **PPT 驱动提取**:根据 PPT 知识点定位视频中的讲解片段
- **语音转录 + 纠错**Whisper 转录 + LLM 批量校正
- **双轨字幕**:标题轨 + 内容轨
- **CLI / GUI 双入口**:共享同一套底层逻辑
## 快速开始
### 1. 配置 API
复制配置文件并填入 API Key
```bash
cp config.ini.example config.ini
# 编辑 config.ini,填入 api_key
```
### 2. 安装依赖
```bash
pip install -r requirements.txt
```
### 3. 配置
编辑 `config.py` 中的视频路径、PPT路径、API Key 等。所有配置集中在一个文件。
### 4. 运行
**完整流程(首次运行):**
```bash
.\run.bat
```
**快速烧录(仅修改字幕后重烧):**
```bash
.\burn.bat
```
**GUI(推荐):**
```bash
.\start.bat
```
## 项目结构
```
lesson-highlights/
├── config.py # 统一配置(修改这里)
├── run.py # 完整流水线
├── burn_only.py # 快速烧录(跳过转录/字幕生成)
├── run.bat # 运行完整流程
├── burn.bat # 快速重烧字幕
├── src/
│ ├── main.py # GUI 入口
│ ├── gui.py # GUI(参数输入,调用底层)
│ ├── cli.py # CLI 入口
│ └── core/ # 共享底层
│ ├── ppt_parser.py # PPT 解析 + clips 生成
│ ├── pipeline.py # 视频处理流水线
│ ├── subtitle.py # 字幕生成
│ └── ...
├── config.ini # API 配置(不提交 git
├── config.ini.example # 配置模板
└── docs/
├── USAGE.md # 使用指南
└── ...
```
## 工作流程
1. **PPT 解析**:提取 PPT 文本和知识点
2. **Whisper 转录**:将视频语音转成文本
3. **LLM 校正**:批量校正转录错误
4. **片段提取**:根据 PPT 知识点定位视频片段
5. **字幕烧录**:生成双轨字幕并烧入视频
6. **合并输出**:拼接所有片段为最终视频
## API 配置
编辑 `config.ini`
```ini
[api]
api_host = "https://ark.cn-beijing.volces.com/api/coding/v3"
api_key = your_api_key_here
```
支持火山方舟(doubao-seed-2.0-lite)或兼容 OpenAI API 的后端。
## 输出
```
output/
├── generated_config.yaml # clips 配置(可手动修改后重新运行)
├── intermediates/ # 中间文件
│ ├── clip*.json # Whisper 转录结果
│ └── clip*.mp4 # 提取的视频片段
├── subs/ # 字幕文件
│ ├── v1_title.srt # 标题轨(可手动修改)
│ └── v1_content.srt # 正文字幕
├── concat_merged.mp4 # 合并视频
└── final.mp4 # 最终输出
```
## 系统要求
- Python 3.10+
- FFmpeg(已打包在 `ffmpeg/` 目录)
- PySide6GUI
- faster-whisper(转录,可选)