简介
抖音视频语音转文字工具,基于Whisper模型实现高精度中文/英文语音识别,需浏览器配合绕过反爬机制
原始描述
Douyin video transcription suite. Extract audio from Douyin/TikTok China videos, transcribe with Whisper, and analyze content. Supports video links, local fi...
通过你的 Agent 添加
安装目录:douyin-transcribe/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
Douyin Transcribe 是一款专为抖音(TikTok 中国版)视频设计的音频提取与语音转文字工具。其核心工作流程包括五个步骤:首先解析抖音短链接(v.douyin.com)获取完整视频 URL;然后通过浏览器执行 JavaScript 提取真实 CDN 视频流地址;接着使用 curl 下载视频(必须携带 Referer 头规避 403 限制);再利用 ffmpeg 将音频转换为 16kHz 单声道 WAV 格式;最后调用 OpenAI Whisper 模型进行语音识别,输出纯文本、SRT 字幕或 JSON 格式的转录结果。用户可根据精度需求选择 tiny 到 medium 五种模型规格,其中 small 模型(466MB)在准确性与速度间达到最佳平衡。
显著优点
该 Skill 的最大优势在于完整解决了抖音的反爬机制难题。文档详细提供了应对各种技术障碍的实战方案,包括处理 uuu_265 占位视频、blob 流式加载、CDN 地址过期等场景的具体解决策略。跨平台支持出色,覆盖 Windows、macOS 和 Linux 三大系统,并针对不同操作系统提供了对应的命令行示例。输出格式规范,按视频 ID 命名文件并支持保留原始视频、音频、文本和字幕多种形态,便于后续编辑和存档。此外,该工具完全本地化运行,转录过程无需联网调用第三方 API,有效保护用户隐私。
潜在缺点与局限性
该 Skill 存在明显的技术门槛和依赖负担。用户必须自行安装 ffmpeg、whisper 等外部工具,配置过程对非技术用户不够友好。由于抖音反爬机制严格,获取真实视频 URL 需要浏览器环境配合 JavaScript 执行,无法纯后台自动化完成,流程较为繁琐。Whisper 模型首次运行需下载数百 MB 的模型文件,在低速网络环境下体验不佳。CPU 转录速度较慢,5 分钟视频使用 small 模型需约 3 分钟处理时间,对大批量处理场景效率受限。此外,该工具仅针对抖音平台设计,不支持 YouTube、Bilibili 等其他平台,通用性不足。
适合的目标群体
该工具最适合三类用户:一是自媒体内容创作者,需要批量提取抖音热门视频的文案进行二次创作或竞品分析;二是研究人员和市场分析师,需要获取特定领域视频的发言内容建立语料库;三是听障人士或有字幕需求的用户,希望为无字幕视频生成可编辑的字幕文件。由于技术配置要求较高,建议具备基础命令行操作能力的用户使用,普通用户可能需要技术人员的协助部署。
使用风险
该 Skill 存在中等程度的命令注入风险,因使用 subprocess 调用 curl、ffmpeg 等系统命令且部分采用字符串拼接方式构造命令行。虽然视频 URL 来自用户输入,但缺乏严格的输入验证和过滤机制。网络访问仅限于抖音官方 CDN 域名,未发现数据外泄行为,但依赖外部工具链增加了攻击面。文件系统操作限于用户指定的输出目录,但路径验证不够严格,存在潜在的路径遍历风险。来源为 T3 级别个人开发者,无开源社区背书,代码未经第三方审计,长期维护和质量保障存疑。此外,ffmpeg 和 whisper 的版本兼容性可能引发运行时错误,建议用户锁定依赖版本。
技能正文
name: douyin-transcribe
description: Extract audio from Douyin (抖音/TikTok China) videos and transcribe to text using Whisper. Trigger when user sends a Douyin link (v.douyin.com or www.douyin.com/video/) and asks for transcription, extract text, analyze video content, or summarize.
Douyin Video Transcribe
Extract speech from Douyin videos and convert to text. Supports Chinese/English, cross-platform (Windows/macOS/Linux).
Core Principle
Douyin has strict anti-scraping. Must:
- Load page in browser, wait for video stream
- Extract real CDN URL from DOM or network requests
- Download with
Referer: https://www.douyin.com/header (403 without it) - Convert audio to 16kHz mono WAV for Whisper
Prerequisites
Tool
Purpose
Install
ffmpeg
Audio extraction
brew install ffmpeg / winget install ffmpeg / apt install ffmpeg
whisper
Speech-to-text
pip install openai-whisper
curl
Download video
Built-in (Windows: curl.exe)
Workflow
1. Resolve Short URL
| Tool | Purpose | Install |
|---|---|---|
| ffmpeg | Audio extraction | brew install ffmpeg / winget install ffmpeg / apt install ffmpeg |
| whisper | Speech-to-text | pip install openai-whisper |
| curl | Download video | Built-in (Windows: curl.exe) |
1. Resolve Short URL
Douyin share links are usually v.douyin.com/xxx, resolve to full URL:
# macOS/Linux
curl -sL -o /dev/null -w '%{url_effective}' "https://v.douyin.com/xxx/"
# Windows PowerShell
curl.exe -sL -o NUL -w "%{url_effective}" "https://v.douyin.com/xxx/"
Output: https://www.douyin.com/video/7616020798351871284
Video ID is the 19-digit number in URL.
2. Get Video URL
Open video page in browser, wait 3-5 seconds, execute JS:
(() => {
const videos = document.querySelectorAll('video');
for (const v of videos) {
const src = v.currentSrc || v.src;
if (src && src.startsWith('http') && !src.includes('uuu_265')) {
return src;
}
}
return null;
})()
Key points:
- Returns
null: Page not loaded, retry after waiting - Contains
uuu_265: Placeholder video, retry after waiting - Starts with
blob:: Streaming, wait for real URL - CDN URLs expire (~2 hours), re-fetch if needed
3. Download Video
# macOS/Linux
curl -L -H "Referer: https://www.douyin.com/" -o video.mp4 "<CDN_URL>"
# Windows
curl.exe -L -H "Referer: https://www.douyin.com/" -o video.mp4 "<CDN_URL>"
# macOS/Linux
curl -L -H "Referer: https://www.douyin.com/" -o video.mp4 "<CDN_URL>"
# Windows
curl.exe -L -H "Referer: https://www.douyin.com/" -o video.mp4 "<CDN_URL>"
Referer header is required, otherwise 403.
4. Extract Audio
ffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y
ffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y
Parameters:
-ar 16000: 16kHz sample rate (Whisper requirement)-ac 1: Mono channel-c:a pcm_s16le: 16-bit PCM
5. Transcribe
python -m whisper audio.wav --model small --language zh
python -m whisper audio.wav --model small --language zh
Model selection:
| Model | Size | 5-min video (CPU) | Accuracy | Use case |
|---|---|---|---|---|
| tiny | 75MB | ~30s | Fair | Quick preview |
| base | 142MB | ~1min | Good | Daily use |
| small | 466MB | ~3min | Better | Recommended |
| medium | 1.5GB | ~8min | Best | High accuracy |
Language:
- Chinese:
--language zh - English:
--language en - Auto-detect: omit flag (slower)
Output files in current directory: audio.txt, audio.srt, audio.json
Troubleshooting
Issue
Detection
Solution
Short URL fails
Returns non-douyin.com
Check link completeness, remove share text noise
Video URL not found
JS returns null
Wait 3-5s and retry, max 3 times
Placeholder video
URL contains uuu_265
Page not loaded, wait and retry
Download 403
curl returns 403
Check Referer header; URL may be expired
Whisper hangs
No output for long time
First run downloads model (~460MB for small)
Garbled output
Terminal shows gibberish
Normal, read .txt file directly
Out of memory
Process killed
Use smaller model (base/tiny)
Output Convention
| Issue | Detection | Solution |
|---|---|---|
| Short URL fails | Returns non-douyin.com | Check link completeness, remove share text noise |
| Video URL not found | JS returns null | Wait 3-5s and retry, max 3 times |
| Placeholder video | URL contains uuu_265 |
Page not loaded, wait and retry |
| Download 403 | curl returns 403 | Check Referer header; URL may be expired |
| Whisper hangs | No output for long time | First run downloads model (~460MB for small) |
| Garbled output | Terminal shows gibberish | Normal, read .txt file directly |
| Out of memory | Process killed | Use smaller model (base/tiny) |
Name files by video ID, save to user-specified directory:
output/
├── 7616020798351871284.mp4 # Original video (optional)
├── 7616020798351871284.wav # Audio (delete after)
├── 7616020798351871284.txt # Transcript
└── 7616020798351871284.srt # Subtitles (optional)
Scripts (Optional)
Helper scripts in skill directory:
scripts/get_video_url.js: Browser-side video URL extraction with multiple methodsscripts/transcribe.py: CLI one-click transcription (requires video URL)
Scripts are accelerators, not required. Implement yourself after understanding the workflow.
Notes
- Article links (/article/): Use browser snapshot directly, no transcription needed
- Douyin AI summary: Some video pages have AI-generated chapter summaries, extract from snapshot as supplement
- Other platforms: This skill is for Douyin only. Use yt-dlp for YouTube/Bilibili
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。