mcpField
C
cli-anything-videocaptioner

cli-anything-videocaptioner

github.com/hkuds创意与媒体57.6k510 次安装5 周前更新
代码仓库

关于 cli-anything-videocaptioner

用于视频字幕处理的命令行工具,涵盖语音转写、字幕翻译和视频合成,适合自动化字幕任务。它提供审查工具,可在导出前检查字幕与脚本的偏差。

主要功能

  1. 01将语音转写为字幕
  2. 02优化并翻译字幕
  3. 03将字幕烧录进视频
  4. 04检查字幕与脚本一致性
  5. 05机器可读的 JSON 输出

适用场景

  1. 01从视频生成字幕文件
  2. 02将字幕翻译为目标语言
  3. 03硬字幕导出前检查字幕偏差
  4. 04一并执行转写、翻译和合成

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/hkuds/cli-anything --skill cli-anything-videocaptioner

安装后在 Claude Code 中输入/cli-anything-videocaptioner确认已加载。

详细介绍

cli-anything-videocaptioner

AI 驱动的视频字幕工具。转写语音 → 优化字幕 → 翻译 → 烧录到视频中。

安装

pip install cli-anything-videocaptioner

前置要求:

  • Python 3.10-3.12(videocaptioner 1.4.1 要求 >=3.10,<3.13)
  • 必须已安装 videocaptioner(pip install videocaptioner)
  • 视频合成需要 FFmpeg

用法

基本命令
# Show help
cli-anything-videocaptioner --help

# Start interactive REPL mode
cli-anything-videocaptioner

# Transcribe a video (free, no setup)
cli-anything-videocaptioner transcribe video.mp4 --asr bijian

# Translate subtitles (free Bing translator)
cli-anything-videocaptioner subtitle input.srt --translator bing --target-language en

# Full pipeline: transcribe → translate → burn subtitles
cli-anything-videocaptioner process video.mp4 --asr bijian --translator bing --target-language en --subtitle-mode hard

# Review subtitle/script consistency before a final hard-burn
cli-anything-videocaptioner synthesize video.mp4 -s subtitles.srt \
  --subtitle-mode hard \
  --review-script approved_script.txt

# Render a one-frame subtitle preview for review
cli-anything-videocaptioner review subtitles.srt \
  --script approved_script.txt \
  --preview-video video.mp4 \
  --preview-output review_5s.png

# JSON output (for agent consumption)
cli-anything-videocaptioner --json transcribe video.mp4 --asr bijian
REPL 模式

不带子命令调用时,CLI 会进入交互式 REPL 会话:

cli-anything-videocaptioner
# Enter commands interactively with tab-completion and history

命令组

transcribe — 语音转字幕
transcribe <input> [--asr bijian|jianying|whisper-api|whisper-cpp] [--language CODE] [--format srt|ass|txt|json] [-o PATH]
  • bijian(默认):免费,支持中文和英文,无需配置
  • whisper-api:支持所有语言,需要 --whisper-api-key
subtitle — 优化和翻译
subtitle <input.srt> [--translator llm|bing|google] [--target-language CODE] [--layout target-above|source-above|target-only|source-only] [--no-optimize] [--no-translate] [-o PATH]
  • 三个步骤:分割 → 优化 → 翻译
  • Bing/Google 翻译器免费
  • 支持 38 种目标语言(BCP 47 代码)
synthesize — 将字幕烧录到视频中
synthesize <video> -s <subtitle> [--subtitle-mode soft|hard] [--quality ultra|high|medium|low] [-o PATH] [--review-script PATH] [--max-script-diff-ratio FLOAT]
  • 对应稳定的后端 synthesize 接口
  • 字幕外观由字幕资源/后端版本控制,而非额外的 harness 标志
  • --review-script 在最终导出前检查字幕/脚本漂移
  • 当文案准确性比容错性更重要时,降低 --max-script-diff-ratio
process — 完整流水线
process <input> [--asr ...] [--translator ...] [--target-language ...] [--subtitle-mode ...] [--layout ...] [--no-optimize] [--no-translate] [--no-synthesize] [-o PATH]
review — 一致性检查和预览
review <input.srt|input.ass> [--script PATH] [--max-diff-ratio FLOAT] [--preview-video PATH] [--preview-at TC] [--preview-output PATH]
  • 在硬烧录前检测字幕/脚本漂移
  • 可以渲染单个审核帧,而不是生成完整的最终视频
styles — 列出样式预设
styles
  • 报告已安装的后端是否暴露预设样式支持
config — 管理设置
config show
config set <key> <value>
download — 下载在线视频
download <URL> [-o DIR]

JSON 输出

所有命令都支持 --json 以输出机器可读的结果:

cli-anything-videocaptioner --json transcribe video.mp4 --asr bijian
# {"output_path": "/path/to/output.srt"}

后端说明

  • 上游后端目前要求 Python >=3.10,<3.13;矩阵运行建议使用 Python 3.12。
  • 高级 synthesize 时样式标志取决于后端版本。使用 styles 检查已安装的后端是否暴露这些标志。
  • 除非 styles 和已安装的后端确认支持,否则 layout、render_mode、style、style_override 和 font_file 等兼容性标志应视为非稳定。

目标语言

BCP 47 代码:zh-Hans zh-Hant en ja ko fr de es ru pt it ar th vi id 以及另外 23 种。

评论

支持 Markdown