技能 效率工具 从视频脚本生成SRT字幕

从视频脚本生成SRT字幕

v20260803
srt-from-script
该工具专门用于解析结构化的短剧脚本文本(AI-video-script格式),生成带有精确时间戳的SRT字幕文件。它能够计算每个镜头的累计时长,并将台词文本进行精准时间编码,适用于自动化视频制作流程,特别是在脚本合并和最终字幕烧录的环节。
获取技能
161 次下载
概览

srt-from-script

Parses an ai-video-script 3-shot script and writes an SRT subtitle file whose cues track the script's VOICEOVER per shot, time-coded with cumulative shot durations.

Inputs (with:)

key required default notes
script yes Full script text (the entire OUTPUT FORMAT block, including OVERVIEW + SHOT_1..N). Passed via stdin so the orchestrator does not need to write a temp file.
output_path yes Output .srt path. Parent dir created if missing.
gap_ms no 200 Tail pad subtracted from each cue's end so the subtitle vanishes ~200 ms before the next shot starts — avoids cuts clipping mid-character.
leading_offset_ms no 0 Shifts every cue forward by this many ms. Set to the cover/intro clip duration when the merged video prepends a title card before SHOT_1.

Parsing rules

  • A shot with VOICEOVER: none or empty contributes no SRT cue but its DURATION_S still advances the timeline cursor.
  • Cue language follows the script verbatim. Chinese stays Chinese, English stays English — no translation.
  • Cumulative timestamps: SHOT_1 starts at 00:00:00,000; SHOT_2 starts at SHOT_1.duration; etc.
  • End time of each cue = next-shot start − gap_ms, clamped to ≥ 800 ms after start so very short voiceover lines remain readable.

Output

Prints the absolute path of the written .srt on stdout. The file is UTF-8 encoded so CJK voiceover lines survive when ffmpeg reads them via the subtitles= filter.

Limits

  • Assumes the script follows ai-video-script's strict OUTPUT FORMAT (=== SHOT_N === blocks with DURATION_S: and VOICEOVER: fields). Drift away from that format → zero cues, exit 1.
  • 3-5 shots tested. Larger shot counts work but timestamps grow.
信息
Category 效率工具
Name srt-from-script
版本 v20260803
大小 4.14KB
更新时间 2026-08-04
语言