Files
live-caption/README.md
T
blumia 18dbc9c8d3 feat: add real-time caption CLI prototype with Qwen3-ASR
Add a C++/Qt6/CMake CLI prototype that captures the default sink
monitor through libpulse and transcribes it in-process with Qwen3-ASR
via libllama/libmtmd. Add phase 0/1 verification docs.

新增实时字幕命令行原型:libpulse 采集默认输出 monitor,进程内用
libllama/libmtmd 跑 Qwen3-ASR 推理。附阶段 0/1 验证文档。
2026-10-12 11:40:59 +08:00

57 lines
2.5 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.
# live-caption
Linux 桌面实时字幕:采集系统正在播放的声音,实时转写成字幕显示(类似 Chrome 实时字幕)。
技术栈:C++ / Qt6 / CMake / Qwen3-ASR(llama.cpp,纯 C++,无 Python 依赖)。
## 当前进度
| 阶段 | 内容 | 状态 |
|---|---|---|
| Phase 0 | 可行性验证(采集 / 模型 / CPU 实时性) | ✅ 见 [docs/phase0-verification.md](docs/phase0-verification.md) |
| Phase 1 | 命令行原型(进程内推理 + monitor 采集 + 滑窗 + 稳定前缀) | ✅ 见 [experiments/phase1/README.md](experiments/phase1/README.md) |
| Phase 2 | 原生流式解码(前缀回滚 + 滑窗,去掉 VAD) | 待做,见 [docs/phase2-streaming.md](docs/phase2-streaming.md) |
| Phase 3 | Qt 悬浮字幕窗(折叠/展开、语言标签、置顶) | 待做 |
| Phase 4 | 设置界面(模型切换、语言、字体、位置) | 待做 |
| Phase 5 | Wayland 支持、打包、模型分发 | 待做 |
## 关键结论(Phase 0 实测)
- 系统播放音频可从默认输出的 monitor 源采集(PipeWire + pipewire-pulse,走 libpulse,兼容 PulseAudio)。
- `Qwen3-ASR-0.6B` 在本机(i5-13420H,无独显)纯推理 RTF ≈ **0.19**,实时有充足余量。
- 模型与推理运行时**必须锁版本**:只有 ggml-org 官方 GGUF(`general.architecture = qwen3vl`)与系统 llama.cpp 兼容;社区的 Q4 量化用的是 `qwen3asr` / `qwen3_asr`,装不进去。
- 转写原始输出为 `language <LANG><asr_text><正文>`,语言名正好用于 UI 的语言标签。
## 快速开始
```bash
# 1. 准备模型(只需一次;网络可达 hf-mirror.com)
B=https://hf-mirror.com/ggml-org/Qwen3-ASR-0.6B-GGUF/resolve/main
aria2c -x16 -s16 -k4M -o Qwen3-ASR-0.6B-Q8_0.gguf "$B/Qwen3-ASR-0.6B-Q8_0.gguf"
aria2c -x16 -s16 -k4M -o mmproj-Qwen3-ASR-0.6B-Q8_0.gguf "$B/mmproj-Qwen3-ASR-0.6B-Q8_0.gguf"
# 2. 构建
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
# 3. 单文件转写
./build/live-caption-cli \
--model Qwen3-ASR-0.6B-Q8_0.gguf \
--mmproj mmproj-Qwen3-ASR-0.6B-Q8_0.gguf \
--file some_16k_mono.wav
# 4. 实时字幕
./build/live-caption-cli \
--model Qwen3-ASR-0.6B-Q8_0.gguf \
--mmproj mmproj-Qwen3-ASR-0.6B-Q8_0.gguf
```
## 目录
```
├─ src/ # 原型源码
├─ docs/ # 各阶段验证报告
└─ experiments/
├─ phase0/ # 可行性验证脚本(采集/RTF/模型元数据)
└─ phase1/ # 命令行原型说明与实机测试脚本
```