Video transcription workflow
Decision process
1. 尝试获取字幕 → bilibili-youtube-watcher
↓
有字幕? ──是──→ 检查语言 ──需翻译?──是──→ LLM翻译
↓否 ↓否
2. 下载音频 → yt-dlp 直接使用
↓
3. 判断语言 → 中文?用--language Chinese : 用--language en
↓
4. 转写 → whisper.cpp tiny模型
Tools
bilibili-youtube-watcher (when subtitles are available)
# B站视频字幕
python3 ~/.openclaw/extensions/bilibili-youtube-watcher/scripts/get_transcript.py "URL" --lang zh-CN
# YouTube字幕(尝试en/zh-CN)
python3 ~/.openclaw/extensions/bilibili-youtube-watcher/scripts/get_transcript.py "URL" --lang en
yt-dlp + whisper.cpp (when subtitles are unavailable)
# 1. 获取视频时长
yt-dlp --dump-json --no-check-certificate "URL" | jq -r '.duration, .title'
# 2. 下载音频
yt-dlp -f bestaudio --no-check-certificate "URL" -o audio.m4a
# 3. 转码
ffmpeg -i audio.m4a -ar 16000 -ac 1 audio.wav
# 4. 转写
# 中文视频
whisper-cpp -m ggml-tiny.bin -f audio.wav -osrt --language Chinese
# 英文视频
whisper-cpp -m ggml-tiny.bin -f audio.wav -osrt --language English
Notes
- exec default timeout=1800 seconds (30 minutes), enough to process a 40-minute video
- Translation: use the LLM to directly process the subtitle content
- Subtitle library: my.feishu.cn/docx/I9P3dGDZioSJZlxfHwwclXcAnDe