platforms/hermes/skills/media/video-transcribe/SKILL.md
Video/audio transcription, visual frame analysis and summary. Download video from any URL (Twitter, YouTube, Bilibili, etc.), transcribe speech to text, extract keyframes for visual analysis, and summarize content. Keywords: video, transcribe, 转录, 视频, 音频, audio, subtitle, 字幕, summary, 总结, 视频内容, 画面分析, 视觉分析, visual analysis, 视频画面, keyframe, whisper, groq, yt-dlp
npx skillsauth add codingsamss/ai-dotfiles video-transcribeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
从任意视频/音频链接提取内容并分析。支持音频转录、视频画面分析、或两者综合。支持 Twitter/X、YouTube、Bilibili 等 1000+ 站点。
当用户提到以下内容时触发:
收到视频链接后,根据用户措辞判断分析模式。按优先级从高到低匹配:
用户明确要求处理语音/音频内容时使用。
用户明确要求分析视觉/画面内容时使用。
用户笼统地想了解视频内容,或意图不明确时使用。
brew install yt-dlpbrew install ffmpeg所有临时文件保存到: /tmp/video-transcribe/
处理完成后自动清理中间文件,仅保留最终文本输出。
收到视频链接后,先完成模式判断,再按以下步骤执行:
每次执行前,清理旧文件:
if [ -d /tmp/video-transcribe ]; then
# 删除超过 1 天的文件
find /tmp/video-transcribe -type f -mtime +1 -delete 2>/dev/null
# 删除上次残留的所有中间文件(用 find 避免特殊字符文件名 glob 失败)
find /tmp/video-transcribe -type f \( -name '*.mp3' -o -name '*.wav' -o -name '*.mp4' -o -name '*.webm' -o -name '*.jpg' \) -delete 2>/dev/null
fi
mkdir -p /tmp/video-transcribe
根据模式选择下载方式:
yt-dlp --cookies-from-browser chrome \
-x --audio-format mp3 --audio-quality 5 \
-o '/tmp/video-transcribe/%(title)s.%(ext)s' \
'$URL'
-x --audio-format mp3 - 只提取音频转 MP3--audio-quality 5 - 中等质量(语音转录足够,减小体积)yt-dlp --cookies-from-browser chrome \
-f "bestvideo[height<=720]+bestaudio/best[height<=720]" \
--merge-output-format mp4 \
-o '/tmp/video-transcribe/%(title)s.%(ext)s' \
'$URL'
--merge-output-format mp4 确保输出为 mp4 便于后续 ffmpeg 处理错误处理(通用):
--cookies-from-browser chrome 重试No video formats found / SABR 错误 → 提示 brew upgrade yt-dlp--max-filesize 500M 限制根据模式执行对应的处理流程。综合模式下 2A 和 2B 都要执行。
综合模式下,先从视频文件提取音频:
ffmpeg -i '/tmp/video-transcribe/INPUT.mp4' \
-vn -acodec libmp3lame -q:a 5 \
'/tmp/video-transcribe/audio.mp3' -y
后续用 audio.mp3 替代 INPUT.mp3。
检查文件大小:
FILE_SIZE=$(stat -f%z '/tmp/video-transcribe/INPUT.mp3')
若文件 <= 24MB,直接转录。若 > 24MB,切分:
ffmpeg -i '/tmp/video-transcribe/INPUT.mp3' \
-f segment -segment_time 1200 -c copy \
'/tmp/video-transcribe/segment_%03d.mp3' -y
调用 Groq Whisper API 转录:
若直连 Groq 返回 403 Forbidden,为转录命令临时加代理环境变量后重试:
HTTP_PROXY=http://127.0.0.1:7897 HTTPS_PROXY=http://127.0.0.1:7897 <转录命令>
单文件:
curl -s -X POST \
https://api.groq.com/openai/v1/audio/transcriptions \
-H "Authorization: Bearer $GROQ_API_KEY" \
-F "file=@/tmp/video-transcribe/INPUT.mp3" \
-F "model=whisper-large-v3" \
-F "response_format=text" \
-F "language=zh" \
-o '/tmp/video-transcribe/transcript.txt'
多段(切分后):
> /tmp/video-transcribe/transcript.txt
for f in /tmp/video-transcribe/segment_*.mp3; do
curl -s -X POST \
https://api.groq.com/openai/v1/audio/transcriptions \
-H "Authorization: Bearer $GROQ_API_KEY" \
-F "file=@$f" \
-F "model=whisper-large-v3" \
-F "response_format=text" \
>> '/tmp/video-transcribe/transcript.txt'
echo "" >> '/tmp/video-transcribe/transcript.txt'
done
参数说明:
model=whisper-large-v3 - 最高精度模型response_format=text - 返回纯文本language=zh - 指定中文。英文用 en,不确定语言时省略此参数让模型自动检测错误处理:
HTTP_PROXY 与 HTTPS_PROXY综合模式下判断转录结果:
提取关键帧:
# 获取视频时长(秒)
DURATION=$(ffprobe -v error -show_entries format=duration \
-of csv=p=0 '/tmp/video-transcribe/INPUT.mp4' | cut -d. -f1)
# 计算采样间隔(目标 8 帧,均匀分布)
INTERVAL=$((DURATION / 8))
[ "$INTERVAL" -lt 2 ] && INTERVAL=2
# 提取关键帧
ffmpeg -i '/tmp/video-transcribe/INPUT.mp4' \
-vf "fps=1/$INTERVAL,scale=1280:-2" \
-frames:v 8 \
-q:v 2 \
'/tmp/video-transcribe/frame_%03d.jpg' -y
参数说明:
fps=1/$INTERVAL - 根据视频时长动态调整采样率,确保帧均匀覆盖全片scale=1280:-2 - 宽度缩放到 1280px,高度自适应保持比例-frames:v 8 - 最多提取 8 帧-q:v 2 - JPEG 高质量(2),清晰度与文件大小平衡如果提取帧数不足 3 张(视频过短),降低间隔重试:
ffmpeg -i '/tmp/video-transcribe/INPUT.mp4' \
-vf "fps=2,scale=1280:-2" \
-frames:v 8 \
-q:v 2 \
'/tmp/video-transcribe/frame_%03d.jpg' -y
视觉分析:
使用 Claude 自身的多模态视觉能力,用 Read 工具依次读取提取的帧图片(/tmp/video-transcribe/frame_001.jpg ~ frame_008.jpg),综合所有帧分析视频画面内容。
分析时重点关注:
根据模式提供对应格式的总结:
处理完成后,清理所有中间文件:
# 删除视频、音频、帧图片等中间文件(用 find 避免特殊字符文件名 glob 失败)
find /tmp/video-transcribe -type f \( -name '*.mp4' -o -name '*.webm' -o -name '*.mp3' -o -name '*.wav' -o -name '*.jpg' \) -delete 2>/dev/null
保留 transcript.txt 供用户后续查阅。用户不再需要时:
rm -rf /tmp/video-transcribe/
yt-dlp 支持 1000+ 站点,常用的包括:
完整列表: yt-dlp --list-extractors
如果无网络或不想使用在线 API,可以使用本地 whisper-cpp 转录:
brew install whisper-cppcurl -L https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin -o ~/.cache/whisper-cpp/ggml-small.binffmpeg -i INPUT.mp3 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -ywhisper-cli -m ~/.cache/whisper-cpp/ggml-small.bin -f audio.wav -l auto --no-timestamps -otxt -of transcript本地模型精度低于 Groq whisper-large-v3,适合离线或隐私敏感场景。
language=zh 或 language=en)development
Query Midea MX / 美信 local message cache through the MX local HTTP query service from Codex. Use when the user asks to read MX sessions, search chat history, search messages globally or inside a group/session, list recent messages, or page message history. This is read-only and does not require send authorization. Never fall back to reading SQLite or app cache files directly.
development
Safely search MX users or groups and send Midea MX / 美信 IM messages from Codex. Use when the user asks to notify someone, send a message to a person or group, use a configured group alias, @ users, @ all, or send MX file/image messages. Read lookups need no extra authorization; every live send needs explicit user authorization for that exact target and message.
tools
MX channel output rules. Always active in MX conversations.
tools
Use the company WorkSpace `ws` CLI reliably as a delegated coding agent from Codex. Trigger when the user wants Codex to command `ws`, WorkSpace CLI, or the company opencode-derived coding tool to generate code, inspect a repo, run a bounded implementation task, or use a requested WorkSpace model while Codex reviews the output.