Communitygithub.com

bubble202603/video-subtitle-skill

OpenClaw skill — auto Chinese captions on video (JianYing-like). JS pipeline.

What is video-subtitle-skill?

video-subtitle-skill is a Claude Code agent skill that openClaw skill — auto Chinese captions on video (JianYing-like). JS pipeline.

Works with~Claude Code~Codex CLI~Cursor
npx skills add bubble202603/video-subtitle-skill

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Video Subtitle Skill

给视频自动添加中文字幕,类似于剪映的自动字幕功能。

功能

  • 使用 Whisper AI 识别视频语音并生成英文字幕
  • 自动翻译成中文字幕
  • 使用 FFmpeg 将字幕烧录进视频

使用方法

# 基本用法
clawhub install video-subtitle

# 或直接告诉 agent
"给这个视频加上中文字幕"

前置要求

  1. ffmpeg - 必须安装

    apt-get install -y ffmpeg
    
  2. Python 环境 - 需要以下包:

    pip install faster-whisper translators
    

命令行用法

# 给视频加字幕
node /root/.openclaw/workspace/skills/video-subtitle/add-subtitle.js <视频路径> [目标语言]

# 示例
node add-subtitle.js /path/to/video.mp4 zh

完整流程

  1. 语音识别 - 使用 faster-whisper 提取英文字幕
  2. 翻译 - 使用 Google 翻译 API 转中文
  3. 烧录 - FFmpeg 将字幕硬编码进视频

输出

  • 原视频 + 中文字幕的新视频文件
  • 同名的 .srt 字幕文件(可选)

注意事项

  • 视频时长会影响处理时间(语音识别是瓶颈)
  • 支持 MP4, MOV, AVI 等常见视频格式
  • 默认使用 "base" Whisper 模型(CPU友好)
  • 如需更准确可使用 "large" 模型(需要更多内存)

字幕修正

如果生成的字幕有误(如专有名词识别错误),可以:

  1. 手动编辑生成的 .srt 文件
  2. 重新运行烧录步骤
# 只重新烧录字幕(不重新识别)
ffmpeg -i input.mp4 -vf "subtitles=corrected.srt" -c:a copy output.mp4

作者: Bubble 🫧
版本: 1.0.0
更新: 2026-03-05

Related Skills