← 返回 Skills 市场
临时文件(
32
总下载
0
收藏
0
当前安装
5
版本数
在 OpenClaw 中安装
/install douyin-video-to-txt
功能描述
抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base.
使用说明 (SKILL.md)
抖音视频转文本知识库(douyin-video-to-txt)
下载抖音视频 → 提取音频 → faster-whisper 转写文字 → 输出双版本字幕 → 写入 Obsidian 知识库
纯本地运行,不需要任何外部 API Key。
Prerequisites
| 工具 | 用途 | 安装 |
|---|---|---|
| yt-dlp | 下载抖音视频 | brew install yt-dlp |
| FFmpeg | 提取音频 | brew install ffmpeg |
| faster-whisper | 语音转文字 | pip3 install faster-whisper |
环境变量(可选,用于 Obsidian 知识库路径):
OBSIDIAN_VAULT_PATH— Obsidian vault 根目录,默认~/Documents
Workflow
Step 1: 获取视频信息并下载
mkdir -p /tmp/douyin_analysis/{VIDEO_ID}
cd /tmp/douyin_analysis/{VIDEO_ID}
yt-dlp --print-json "{DOUYIN_URL}" 2>/dev/null | python3 -c "
import json, sys
d = json.load(sys.stdin)
print(f'ID={d[\"id\"]}')
print(f'Title={d[\"title\"]}')
print(f'Duration={d[\"duration\"]}')
print(f'Uploader={d.get(\"uploader\",\"\")}')
print(f'UploadDate={d.get(\"upload_date\",\"\")}')
"
yt-dlp -o "video.mp4" "{DOUYIN_URL}" 2>/dev/null
Step 2: 提取音频
ffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null
Step 3: 语音转文字(双版本输出)
from faster_whisper import WhisperModel
model = WhisperModel('small', device='auto', compute_type='auto')
segments, info = model.transcribe('/tmp/douyin_analysis/{VIDEO_ID}/audio.wav', language='zh')
all_segments = []
for seg in segments:
all_segments.append(seg)
# 输出 1: 带时间戳版本
with open('/tmp/douyin_analysis/{VIDEO_ID}/text.txt', 'w', encoding='utf-8') as f:
for seg in all_segments:
line = f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}'
f.write(line + '\
')
# 输出 2: 纯文字稿(无时间戳)
plain_lines = []
for seg in all_segments:
plain_lines.append(seg.text.strip())
plain_text = '\
'.join(plain_lines)
with open('/tmp/douyin_analysis/{VIDEO_ID}/text_plain.txt', 'w', encoding='utf-8') as f:
f.write(plain_text)
Step 4: 写入 Obsidian 知识库
把纯文字稿保存到知识库中合适的目录下。每条视频保存为一个独立的 markdown 文件,格式如下:
---
source: 抖音
url: {DOUYIN_URL}
author: {UPLOADER}
date: {UPLOAD_DATE}
duration: {DURATION}s
tags: [抖音转录, {AUTHOR}]
---
# {TITLE}
**来源:** 抖音 | **作者:** {UPLOADER} | **时长:** {DURATION}s
---
## 文字稿
{PLAIN_TEXT}
知识库路径规则:
- 优先写入
$OBSIDIAN_VAULT_PATH/douyin_text/{TITLE_SLUG}.md - 如果
OBSIDIAN_VAULT_PATH未设置,默认~/Documents/douyin_text/ - 自动创建目录(如果不存在)
VAULT="${OBSIDIAN_VAULT_PATH:-$HOME/Documents}"
TARGET_DIR="$VAULT/douyin_text"
mkdir -p "$TARGET_DIR"
# 用视频标题做文件名(清理特殊字符)
SAFE_TITLE=$(echo "$VIDEO_TITLE" | sed 's/[\/:*?"\x3C>|]/_/g' | cut -c1-60)
NOTE_PATH="$TARGET_DIR/${SAFE_TITLE}.md"
python3 \x3C\x3C 'PYEOF'
import os
url = "{DOUYIN_URL}"
title = """{TITLE}"""
uploader = "{UPLOADER}"
date = "{UPLOAD_DATE}"
duration = "{DURATION}"
with open('/tmp/douyin_analysis/{VIDEO_ID}/text_plain.txt', 'r', encoding='utf-8') as f:
plain_text = f.read()
note = f"""---
source: 抖音
url: {url}
author: {uploader}
date: {date}
duration: {duration}s
tags: [抖音转录, {uploader}]
---
# {title}
**来源:** [抖音]({url}) | **作者:** {uploader} | **时长:** {duration}s
---
## 文字稿
{plain_text}
"""
with open('{NOTE_PATH}', 'w', encoding='utf-8') as f:
f.write(note)
PYEOF
Step 5: 生成 AI 总结
读取 text.txt 和 text_plain.txt,用 AI 生成:
- AI 标题(不超过 30 字)
- AI 摘要(200-300 字)
- 核心要点(3-5 条结构化要点)
同时把 AI 总结追加写入 Obsidian 笔记文件(在文字稿下方追加 ## AI 总结 和 ### 核心要点 部分)。
完整示例(一镜到底)
# 装依赖(首次)
brew install yt-dlp ffmpeg 2>/dev/null
pip3 install faster-whisper 2>&1 | tail -3
URL="https://www.douyin.com/video/xxxxx"
VID="xxx"
mkdir -p /tmp/douyin_analysis/$VID
cd /tmp/douyin_analysis/$VID
# 下载
yt-dlp -o "video.mp4" "$URL"
# 提取音频
ffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null
# 转写(双版本)
python3 \x3C\x3C 'PYEOF'
from faster_whisper import WhisperModel
model = WhisperModel('small', device='auto', compute_type='auto')
segments, info = model.transcribe('audio.wav', language='zh')
segs = [seg for seg in segments]
with open('text.txt', 'w', encoding='utf-8') as f:
for seg in segs:
f.write(f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}\
')
plain = '\
'.join(s.text.strip() for s in segs)
with open('text_plain.txt', 'w', encoding='utf-8') as f:
f.write(plain)
PYEOF
# 写入知识库
VAULT="${OBSIDIAN_VAULT_PATH:-$HOME/Documents}"
TARGET="$VAULT/douyin_text"
mkdir -p "$TARGET"
cp text_plain.txt "$TARGET/video-title.txt"
Output
临时文件(/tmp/douyin_analysis/{VIDEO_ID}/)
| 文件 | 内容 |
|---|---|
video.mp4 |
下载的原视频 |
audio.wav |
提取的音频(16kHz 单声道) |
text.txt |
带时间戳的完整字幕文本 |
text_plain.txt |
纯文字稿(无时间戳,连续文本) |
知识库文件
| 路径 | 内容 |
|---|---|
$OBSIDIAN_VAULT/douyin_text/{标题}.md |
含元数据 + 完整文字稿 + AI 总结的笔记 |
注意事项
- 首次运行 faster-whisper 会从 HuggingFace 下载模型(small 约 466MB),需要网络连接
- Apple Silicon 上使用
device='auto'会自动用 MPS(Metal)加速,速度很快 - Proxy 问题:如果 yt-dlp 下载失败,检查是否有代理在跑
- 标题清理:文件名的特殊字符(
/ : * ? " \x3C > |)会自动替换为_ - AI 总结:由 AI 在转写后生成,会追加到 Obsidian 笔记的文字稿下方
已知问题
- 长视频(>30分钟)转写时间较长,small 模型大约 1:1 实时
- Obsidian vault 路径优先从环境变量
OBSIDIAN_VAULT_PATH读取,默认~/Documents
安全使用建议
Before installing, expect it to create local media, audio, transcript, and Markdown files, and set OBSIDIAN_VAULT_PATH if you do not want notes written under ~/Documents. Review the destination filename if you already have notes with similar Douyin titles.
能力标签
能力评估
Purpose & Capability
The stated purpose is Douyin video transcription into an Obsidian-style knowledge base, and the commands for yt-dlp, FFmpeg, faster-whisper, temporary files, and Markdown output all fit that purpose.
Instruction Scope
The workflow gives concrete shell and Python snippets that create files under /tmp and a vault directory, and it also appends an AI summary; these actions are disclosed, though users should notice that existing notes with the same sanitized title may be overwritten.
Install Mechanism
The skill is a Markdown instruction file, not an executable package. Its examples include installing yt-dlp, FFmpeg, and faster-whisper with brew and pip, which is purpose-aligned and visible to the user.
Credentials
Network access is used to download the Douyin video and the faster-whisper model on first run; no API key or credential/session-store use is required by the artifact.
Persistence & Privilege
The skill intentionally persists downloaded media, extracted audio, transcript files, and Markdown notes under documented local paths, including $OBSIDIAN_VAULT_PATH/douyin_text or ~/Documents/douyin_text by default.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install douyin-video-to-txt - 安装完成后,直接呼叫该 Skill 的名称或使用
/douyin-video-to-txt触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.0.3
清理:移除 Docker 相关描述(已不再依赖 Docker)
v2.0.2
名称改为中文:抖音视频转文本知识库
v2.0.1
修复:移除个人文件夹名,改为通用 douyin_text 目录
v2.0.0
新增:纯文字稿输出(text_plain.txt)、自动写入Obsidian知识库、AI总结追加到笔记
v1.0.0
Initial release: Local Douyin video-to-text pipeline
- Download any Douyin video by URL, extract its audio, and transcribe speech to text fully offline.
- Uses yt-dlp for video download, ffmpeg for audio extraction, and faster-whisper for transcription—no API keys required.
- Outputs complete timed subtitles (text.txt) along with source video and audio files.
- Workflow, prerequisites, and troubleshooting details included in documentation.
- Optimized for fast local use, especially on Apple Silicon Macs.
元数据
常见问题
Douyin Video To Txt 是什么?
抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 32 次。
如何安装 Douyin Video To Txt?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install douyin-video-to-txt」即可一键安装,无需额外配置。
Douyin Video To Txt 是免费的吗?
是的,Douyin Video To Txt 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Douyin Video To Txt 支持哪些平台?
Douyin Video To Txt 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Douyin Video To Txt?
由 afeicn(@afeicn)开发并维护,当前版本 v2.0.3。
推荐 Skills