audio2sub — 音频转字幕工具
基于 OpenAI Whisper 的命令行工具,将音频文件批量转写为 VTT / SRT 格式字幕。
| 依赖 | 说明 |
|---|---|
| Python | ≥ 3.8 |
| PyTorch | Whisper 的运行时依赖,自动安装 |
| openai-whisper | 语音识别引擎 |
| ffmpeg | 音频解码,系统级安装 |
- macOS:
brew install ffmpeg
- Ubuntu / Debian:
sudo apt update && sudo apt install ffmpeg
pip install openai-whisper
该命令会自动拉取
torch等依赖。首次运行时 Whisper 模型文件会下载到~/.cache/whisper/。
使用系统 Python 或 miniconda 安装 whisper:
# miniconda(推荐,已预装 torch)
/opt/miniconda/bin/pip install openai-whisper
# 或系统 Python
/usr/bin/python3 -m pip install openai-whisper
编写文件:audio2sub.py



