Audio SRT Workflow
Use this skill for end-to-end subtitle work.
This package is self-contained for runtime entrypoints:
- - INLINECODE0
- INLINECODE1
- INLINECODE2
- INLINECODE3
- INLINECODE4
Scope
- - Mode A: audio + reference text -> aligned SRT
- Mode B: audio only -> auto subtitle SRT
- Timing QA with INLINECODE5
- Burned preview generation with INLINECODE6
Inputs To Collect First
- 1. Audio path (
wav, mp3, m4a, ...) - Whether a reference transcript is available
- Output SRT path (or output directory)
- Language hint (
zh, en, ...) - Preferred run style: CLI, GUI, or Python API
Decision Rule
- - If transcript exists, run Mode A (
align_to_srt.py --text ...). - If transcript does not exist, run Mode B via GUI or Python API (
run_auto_subtitle_pipeline).
Workflow
- 1. Validate environment and paths.
- Choose Mode A or Mode B by transcript availability.
- Run subtitle generation from packaged scripts.
- Run timing diagnostics (
srt_stats.py). - If needed, render a preview mp4 with burned subtitles.
Resolve Skill Script Path
Set a local variable to your installed skill directory.
Codex default path:
CODEBLOCK0
OpenClaw/ClawHub install path example:
CODEBLOCK1
Environment Checks
Run these checks before execution:
CODEBLOCK2
If faster-whisper import fails:
CODEBLOCK3
Mode A Command Template (Audio + Transcript)
CODEBLOCK4
Mode B Command Template (Audio Only)
GUI:
CODEBLOCK5
Or use Python API in scripts:
- - Build config with INLINECODE16
- Run INLINECODE17
See command details in references/command-templates.md.
QA And Preview
Timing stats:
CODEBLOCK6
Preview video:
CODEBLOCK7
Output Conventions
- - Default output uses
.srt extension. - Prefer dated naming for batch runs (for example
output_YYYYMMDD.srt). - Keep intermediate checks in a separate folder from final delivery files.
Notes
- - For Chinese output (
zh), the pipeline strips commas/periods only. - If timings look off, inspect waveform snap related arguments before changing model size.
- This skill requires explicit invocation (
allow_implicit_invocation: false).
音频字幕工作流
使用此技能进行端到端的字幕处理。
本包为运行时入口点提供自包含内容:
- - scripts/aligntosrt.py
- scripts/guiapp.py
- scripts/srtstats.py
- scripts/makepreviewmp4.py
- scripts/requirements.txt
适用范围
- - 模式A:音频 + 参考文本 → 对齐后的SRT字幕
- 模式B:仅音频 → 自动生成SRT字幕
- 使用 srtstats.py 进行时间轴质量检查
- 使用 makepreview_mp4.py 生成带字幕的预览视频
需首先收集的输入
- 1. 音频路径(wav、mp3、m4a 等)
- 是否有参考转录文本
- 输出SRT路径(或输出目录)
- 语言提示(zh、en 等)
- 首选运行方式:CLI、GUI 或 Python API
决策规则
- - 如果有转录文本,运行模式A(aligntosrt.py --text ...)。
- 如果没有转录文本,通过GUI或Python API运行模式B(runautosubtitle_pipeline)。
工作流程
- 1. 验证环境和路径。
- 根据转录文本可用性选择模式A或模式B。
- 通过打包脚本运行字幕生成。
- 运行时间轴诊断(srt_stats.py)。
- 如果需要,渲染带烧录字幕的预览mp4文件。
解析技能脚本路径
设置一个本地变量指向已安装的技能目录。
Codex默认路径:
bash
SKILLDIR=${CODEXHOME:-$HOME/.codex}/skills/audio-srt-workflow
OpenClaw/ClawHub安装路径示例:
bash
SKILL_DIR=<你的工作目录>/skills/audio-srt-workflow
环境检查
执行前运行以下检查:
bash
python3 --version
ffmpeg -version
python3 -c import faster_whisper; print(ok)
如果 faster-whisper 导入失败:
bash
安装前检查依赖:
cat $SKILL_DIR/scripts/requirements.txt
pip install -r $SKILL_DIR/scripts/requirements.txt
模式A命令模板(音频 + 转录文本)
bash
python3 $SKILLDIR/scripts/alignto_srt.py \
--audio <输入音频> \
--text <转录文本> \
--output <输出SRT> \
--model small \
--language zh
模式B命令模板(仅音频)
GUI:
bash
python3 $SKILLDIR/scripts/guiapp.py
或在脚本中使用Python API:
- - 使用 buildalignmentconfig(...) 构建配置
- 运行 runautosubtitle_pipeline(...)
详见 references/command-templates.md 中的命令详情。
质量检查与预览
时间轴统计:
bash
python3 $SKILLDIR/scripts/srtstats.py --srt <输出SRT>
预览视频:
bash
python3 $SKILLDIR/scripts/makepreview_mp4.py \
--audio <输入音频> \
--srt <输出SRT> \
--output <预览MP4>
输出规范
- - 默认输出使用 .srt 扩展名。
- 批量运行时建议使用带日期的命名(例如 output_YYYYMMDD.srt)。
- 中间检查文件与最终交付文件分开存放。
注意事项
- - 对于中文输出(zh),流程仅去除逗号和句号。
- 如果时间轴不准确,在更改模型大小前先检查波形快照相关参数。
- 此技能需要显式调用(allowimplicitinvocation: false)。