抖音视频口播转文字 (douyin-transcriber)
粘贴抖音链接或本地音视频文件,自动提取音频并转写为文字。
用途
- 抖音视频口播 → 文字/字幕
- 支持本地免费转写(FunASR,无 API Key)与云端 API(OpenAI / Groq)
- 输出
text / srt / json三种格式,指定输入即可
前提
- Python 3.x,系统装有
ffmpeg - 本地模式依赖:
pip install yt-dlp funasr modelscope torch(FunASR 本地转写,Free) - 云端模式依赖:
pip install yt-dlp openai(需 API Key)
依赖清单见 scripts/requirements.txt。
用法
主脚本位于本 skill 的 scripts/douyin_transcribe.py(相对本 SKILL.md 同级 scripts/ 目录)。<skill_dir> = 本 skill 安装后的目录。
# 本地免费转写(推荐,无需 API Key)
python3 <skill_dir>/scripts/douyin_transcribe.py "https://v.douyin.com/xxxx/" -t local
# 云端 API 转写
python3 <skill_dir>/scripts/douyin_transcribe.py "https://v.douyin.com/xxxx/" -t groq -k gsk_xxx
python3 <skill_dir>/scripts/douyin_transcribe.py "https://v.douyin.com/xxxx/" -t openai -k sk-xxx
# 输出字幕 srt
python3 <skill_dir>/scripts/douyin_transcribe.py "https://v.douyin.com/xxxx/" -t local -f srt -o 字幕.srt
# 本地音频/视频文件
python3 <skill_dir>/scripts/douyin_transcribe.py /path/to/audio.mp3 -t local
支持的链接 / 输入
- 抖音短链
https://v.douyin.com/xxx/、长链https://www.douyin.com/video/xxx - 本地音频/视频文件(mp3/wav/mp4 等)
- 自动提取音频(yt-dlp,需网络)
脚本目录
douyin-transcriber/
├── SKILL.md # 本说明
└── scripts/
├── douyin_transcribe.py # 主转写脚本
└── requirements.txt # Python 依赖
标注:本地模式需安装
funasr modelscope torch,首次运行会下载模型(需网络)。
Scan to join WeChat group