360 Secure SkillHub
360 安全技能中心

Subtitle Srt Export

读取指定任务文件夹里 input.json 的 subtitles[].words[] 逐词时间戳,按句子标点、约 3.5 秒或约 10 词为界合并成字幕条,写出 <job>/subtitles.srt 供上传平台使用;不调用 API,不修改 input.json,可重复运行,缺少时间戳时打印 ERROR 并以非零码退出。

pushpendrachauhan
pushpendrachauhan
热度 8.60
最近更新 2026-06-29 22:01:03
分类:效率依赖:代码执行 / 读写文件应用场景:文件转换 / 自动化脚本 / 视频编辑 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add subtitle-srt-export
Metadata
name
subtitle-srt-export
description
Export a standard .srt subtitle file from the MEASURED word timings in a job's input.json (written by elevenlabs-tts). Flattens the per-word timings into readable cues (max ~3.5s / ~10 words per cue, breaking on sentence punctuation) and writes <job>/subtitles.srt for upload to YouTube and other platforms. No API call. Re-runnable. Does not modify input.json.
metadata
{"openclaw":{"requires":{"bins":["jq","awk"]}}}

subtitle-srt-export

Turn the measured word-level timings into a ready-to-upload .srt file. No API call, never mutates input.json, safe to re-run.

Why this skill exists

elevenlabs-tts writes accurate per-word timings into input.json's subtitles[].words[]. Those word timings are perfect for an on-screen karaoke render but are too granular for a subtitle file — a platform wants a handful of readable cues, not one cue per word. This skill groups the words into cues and emits valid SRT.

Inputs

A job folder path whose input.json already contains measured word timings (run elevenlabs-tts first). Each word is {word, start, end} under subtitles[].words[].

Usage

bash skills/subtitle-srt-export/scripts/export_srt.sh <job-folder>

Example (the bundled demo job):

bash skills/subtitle-srt-export/scripts/export_srt.sh examples/demo-job

Cue grouping rules

A new cue starts when any of these is true:

  • the previous word ended a sentence (., ?, !)
  • the current cue would exceed ~3.5 seconds
  • the current cue would exceed ~10 words

Tune the $maxdur / $maxwords constants at the top of the jq block to taste.

Output

Writes <job>/subtitles.srt and prints:

Wrote <job>/subtitles.srt with <N> cues from <M> words

On a missing-timings precondition failure it prints an ERROR: line and exits non-zero — run elevenlabs-tts first.