ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

subtitle-generator

当用户需要生成字幕、制作字幕、字幕对齐、ASR识别、语音转文字时使用此技能。触发词:生成字幕, 字幕生成, 制作字幕, 视频字幕, 语音识别, ASR字幕, Whisper字幕, 字幕制作, 视频转字幕, 字幕对齐, 音频转字幕, 语音转文字, 自动字幕, ASR识别, faster-whisper, subtitle, subtitles, caption, transcription, speech to text

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/aqbjqtd/subtitle-generator
Or

Subtitle Generator / 字幕生成器

基于可插拔 ASR 引擎的多语言字幕生成技能,支持 Faster-Whisper(优先)和 OpenAI Whisper(兜底),自动检测 GPU 加速,支持 99+ 语言。

⚠️ 执行规则(强制,AI 必须遵守)

1. 必须后台直接执行,禁止委托子代理

字幕生成是纯执行任务,禁止使用 sessions_spawn 或子代理来执行命令,原因:

  • 子代理消耗额外 tokens,纯属浪费
  • 直接 exec background:true 效率最高

2. 执行模板

exec background:true command:"python3 ~/.openclaw/workspace/skills/subtitle-generator/scripts/main.py <视频文件> [srt|vtt] [语言] --notify"

⚠️ 必须使用 background:true,禁止前台执行阻塞主窗口。

3. 执行流程(强制顺序)

步骤 0(首次自动): engines/init.py 在首次导入时自动检测 ~/.whisper-venv 是否存在,不存在时自动创建 venv 并安装依赖(faster-whisper 优先,openai-whisper 兜底),GPU 可用时自动启用 CUDA 加速。AI 无需手动干预。

  1. 收到任务后立即回复用户:「🎬 字幕生成已启动(后台),完成后我会通知你。」
  2. 使用 exec background:true 启动任务
  3. 任务完成后(进程退出码为 0 或出错)必须 kill 相关进程
  4. 通过 openclaw system event --mode now 唤醒 AI,再由 AI 使用 message 工具发送完成通知给用户
    • ⚠️ openclaw system event 只唤醒 AI,不发送 Telegram/Discord 等消息
    • ✅ 必须用 message 工具才能触达用户
  5. 将字幕文件复制到视频同目录
  6. 清理 /tmp 中的临时文件

4. 禁止行为

  • sessions_spawn / 子代理执行此任务
  • ❌ 前台执行 exec command:"..."(无 background:true
  • ❌ 不发送通知就结束会话
  • ❌ 任务完成后不 kill 相关进程

5. AI 回复模板

任务启动时:

🎬 字幕生成已启动(后台),完成后我会通知你。
文件:xxx.mp4 | 格式:SRT | 语言:中文

Python 脚本输出 【字幕生成完成】【字幕生成失败】 标记后,AI 被唤醒时使用 message 工具发送:

message(
    action="send",
    # 不传 channel 参数,自动路由到用户当前所在的聊天平台
    message="✅ 字幕生成完成\n文件:xxx.srt | 条数:356\n路径:C:\\Users\\xxx\\Videos\\temp\\xxx.srt"
)

⚠️ 必须省略 channel 参数,这样才能兼容所有 OpenClaw 支持的聊天工具(Telegram / Discord / WhatsApp / Slack 等)。

使用方法 / Usage

python ~/.openclaw/workspace/skills/subtitle-generator/scripts/main.py <video> [srt|vtt] [language] [--notify]

示例 / Examples

# English video, SRT subtitles
python ~/.openclaw/workspace/skills/subtitle-generator/scripts/main.py video.mp4 srt en --notify

# Japanese video, VTT subtitles
python ~/.openclaw/workspace/skills/subtitle-generator/scripts/main.py video.mp4 vtt ja --notify

# Chinese video, auto language detection
python ~/.openclaw/workspace/skills/subtitle-generator/scripts/main.py video.mp4 srt zh --notify

# Auto-detect any Whisper-supported language
python ~/.openclaw/workspace/skills/subtitle-generator/scripts/main.py video.mp4 srt --notify

支持语言 / Supported Languages

Whisper 支持 99+ 语言。常用语言代码:

CodeLanguage
enEnglish
zh中文 (Chinese)
ja日本語 (Japanese)
ko한국어 (Korean)
frFrançais
deDeutsch
esEspañol
ruРусский

不传语言参数 = 自动检测。

GPU 加速 / GPU Acceleration

faster-whisper 使用 CTranslate2 作为推理引擎,运行时自动检测并启用 GPU:

系统GPU加速方式说明
Windows + NVIDIACUDAcuDNN + CUDACTranslate2 自动加载
macOS M1/M2/M3/M4MetalApple GPU需安装 Metal 版 CTranslate2(见下)
macOS IntelCPU慢但可用
Linux + NVIDIACUDAcuDNN + CUDACTranslate2 自动加载
CPU-only降级运行所有平台均支持

Apple Silicon (M系列) 安装 Metal 加速版

Metadata

Author@aqbjqtd
Stars4473
Views0
Updated2026-05-01
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-aqbjqtd-subtitle-generator": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.

Related Skills

code-simplifier

当用户要求简化代码、重构代码、优化代码、改进代码质量时使用此技能。提供代码简化原则和最佳实践指导,确保代码符合质量标准。

aqbjqtd 4473

ffmpeg-master-pro

FFmpeg Master Pro - 全能视频处理技能。当用户需要视频处理时使用,支持视频转换、视频压缩、视频编辑等。当用户要求视频处理, 视频转换, 视频压缩, FFmpeg, 视频编辑, 视频转码, 视频剪辑, 字幕处理, 视频优化, 批量视频处理, GIF转换, 视频翻转, 速度调节, 音频提取, 视频合并, 宽高比, 水印, 截图, 抽帧时使用此技能。

aqbjqtd 4473

excel-data-import

Import, merge, and transform data from Excel (.xlsx/.csv) files using YAML-driven configuration. Use when the user asks to: (1) import data from Excel/CSV into a template, (2) batch-process multiple files in a directory, (3) merge/consolidate data from multiple sources, (4) map and transform columns with validation rules, (5) do incremental data updates on existing spreadsheets. 当用户要求导入Excel、CSV导入、表格数据导入、Excel数据合并、批量处理Excel、字段映射、数据校验、 表头自动检测、增量更新Excel、多sheet合并时使用此技能。 Supports Chinese field names, multi-layer merged cell headers, auto header detection, CSV (auto-encoding), custom validators, and multi-source imports.

aqbjqtd 4473

web-fixing

修复网页和前端界面问题。当用户要求修复网页、调试前端、解决UI问题、修复样式、响应式布局错误、移动端显示异常、CSS问题、JavaScript报错、交互功能失效、生成网页后检查并修复时使用此技能。

aqbjqtd 4473

openclaw-config-master

Edit and validate OpenClaw Gateway config (openclaw.json / JSON5). Covers all config areas — gateway, agents, channels, models, auth, tools, commands, session, hooks, secrets, acp, messages, plugins, skills, $include. Use when adding/changing config keys or diagnosing openclaw doctor/config validation errors, to avoid schema mismatches that prevent the Gateway from starting or weaken security policies.

aqbjqtd 4473