srt-to-structured-data_skill

This skill converts SRT subtitles into structured JSON, extracting timing, duration, and text for analysis and downstream processing.
  • Python

36

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill nanmicoder/claude-code-skills --skill srt-to-structured-data

  • SKILL.md3.1 KB

Overview

This skill converts SRT subtitle files into structured JSON data for programmatic use. It extracts timecodes, computes millisecond durations, and can emit pure text transcripts or summary statistics. The tool is designed for quick command-line use and easy integration into pipelines.

How this skill works

The script parses standard SRT blocks (index, time range, text), normalizes start and end times, and computes start_ms, end_ms, and duration_ms for each subtitle. It can output a JSON object containing an array of subtitle entries and optional statistics, or output a plain text transcript when requested. Command-line flags control output location, inclusion of statistics, and text-only mode.

When to use it

  • You need to transform SRT captions into JSON for analysis or storage.
  • You want subtitle timestamps converted into millisecond offsets for synchronization.
  • You need a plain transcript extracted from subtitles for translation or NLP.
  • You are building video-processing pipelines that require structured subtitle data.
  • You want quick statistics like total subtitle count and total duration.

Best practices

  • Validate SRT encoding (UTF-8 recommended) before parsing to avoid character issues.
  • Use --stats for analytics workflows and omit it for minimal JSON output.
  • Use --text-only when feeding text to translation or speech models to avoid timecodes.
  • Trim or normalize long subtitle texts if you plan to index or store them in smaller DB fields.
  • Run the parser as a preprocessing step in automated video pipelines to keep downstream steps simple.

Example use cases

  • Convert a video's SRT to JSON for feeding into a subtitle search index.
  • Extract transcript lines with --text-only to send to a translation API.
  • Generate subtitle statistics (total_count, total_duration_ms, avg_duration_ms) for QA reports.
  • Compute precise start_ms and end_ms for subtitle-driven clip extraction.
  • Integrate into a batch job to normalize many SRT files into a consistent JSON schema.

FAQ

Standard SRT files are supported. Ensure the file follows SRT block formatting (index, time range, text).

How do I get only the transcript without timestamps?

Run the script with the --text-only flag to output each subtitle text on a separate line.

Can I include statistics in the JSON output?

Yes. Use the --stats flag to add total_count, total_duration_ms, total_duration_formatted, and avg_duration_ms.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational