import-srt-captions — Claude Code rule: parse SRT into Remotion
import-srt-captions — a Claude Code rule for importing .srt subtitle files into Remotion video projects. Uses parseSrt() from @remotion/captions to extract subtitles and integrate them into components.
no license ★ 849 updated 2026-01-24
.claude/rules/import-srt-captions.mdWhat import-srt-captions does
The rule demonstrates how to load an .srt file from the public folder or a remote URL, parse it with parseSrt(), and work with Caption objects. It uses staticFile() for local files and fetch() with useDelayRender() to ensure the component waits for parsing to complete. The example includes error handling via cancelRender().
Before using it, install @remotion/captions with the appropriate command for your package manager (npm, yarn, pnpm, or bun). Once parsed, Caption objects work with all utilities from @remotion/captions.
What it helps with
- Load and parse an SRT file within a Remotion React component
- Extract timecodes and subtitle text from an existing file
- Sync imported subtitles with video composition
- Handle async subtitle loading before rendering begins
Example prompts for the agent
- Parse SRT and use subtitles in your Remotion video composition
- Fetch
subtitles.srtfrompublicand retrieve the Caption array - Import remote subtitles via URL instead of a local file
How to install import-srt-captions
Manually: put the files in place
.claude/rules/import-srt-captions.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/import-srt-captions.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/import-srt-captions.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/import-srt-captions.mdManually: put the files in place
.clinerules/import-srt-captions.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about import-srt-captions
How do I install the import-srt-captions rule in Claude Code?
Copy the file to .claude/rules/import-srt-captions.md in your project. Claude Code will load it automatically on the next start.
What does the import-srt-captions rule do?
It provides a pattern for parsing .srt files using parseSrt() from @remotion/captions. The example shows local file loading via staticFile(), error handling, and how to use parsed captions in a component.
What dependencies are required?
You need the @remotion/captions package. Install it with npx remotion add @remotion/captions (npm) or the equivalent command for your package manager (yarn, pnpm, bun).