srt-from-script

Generate SRT subtitle files from structured short-drama scripts with cumulative timestamps.

6.8k|540|Updated May 6, 2026
One-click install
npx skills add https://github.com/opensquilla/opensquilla --skill srt-from-script
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: srt-from-script
Source: https://github.com/opensquilla/opensquilla/tree/main/src/opensquilla/skills/bundled/srt-from-script
Command: npx skills add https://github.com/opensquilla/opensquilla --skill srt-from-script

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Manually timing subtitle cues for short-form video is tedious and error-prone. This Skill converts a structured 3-shot drama script (with per-shot durations and voiceover lines) into a ready-to-burn SRT subtitle file with correctly accumulated timestamps, without any LLM calls or network access.

Core Features & Use Cases

  • Script-to-SRT Conversion: Parses === SHOT_N === blocks, reads each shot's DURATION_S and VOICEOVER, and emits cumulative-timestamped SRT cues.
  • Timing Controls: Supports a configurable end-gap (gap_ms) so subtitles vanish before shot cuts, and a leading_offset_ms to shift cues past a prepended cover clip.
  • CJK-Safe Output: Writes UTF-8 encoded files so Chinese voiceover lines survive ffmpeg's subtitles= filter.
  • Use Case: In a short-drama video pipeline, after merging shot clips, pipe the final script into this Skill to produce drama.srt, then burn it into the video with ffmpeg.

Quick Start

Ask the agent to build an SRT subtitle file from your ai-video-script formatted script, specifying the output path and optionally the gap and leading offset in milliseconds.

Frequently Asked Questions about srt-from-script

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate an SRT subtitle file from a video script?

Run the build_srt.py script with your script text piped via stdin and an --output path. It parses each SHOT_N block's DURATION_S and VOICEOVER fields and writes cumulative-timestamped SRT cues to the output file.

How to offset subtitles when a video has an intro clip?

Use the --leading-offset-ms argument to shift every cue forward by the intro clip's duration in milliseconds. This keeps subtitles aligned when a cover or title card precedes the first shot in the merged video.

Does the SRT output support Chinese subtitles with ffmpeg?

Yes, the output file is written as UTF-8, so CJK voiceover lines survive when ffmpeg reads them via the subtitles= filter. The script also decodes stdin as raw UTF-8 bytes to avoid Windows console code page corruption.

Why does the script produce zero subtitle cues?

Zero cues occur when the input does not follow the expected SHOT_N block format with DURATION_S fields, causing the parser to exit with an error. Shots with VOICEOVER set to none or empty also produce no cue, though their duration still advances the timeline.

What are the limitations of script-based SRT generation?

It assumes the script strictly follows the ai-video-script OUTPUT FORMAT; format drift yields zero cues and exit code 1. It is tested with 3-5 shots, and each cue's minimum display length is clamped to 800 ms regardless of shot duration.