@stagecaptions/srt-to-txt
v0.0.3
Published
A command line tool and JavaScript library that extracts plain text from SubRip (.srt) subtitle files and creates draft SRT files from text.
Maintainers
Readme
SRT to TXT Converter
A command line tool and JavaScript library that extracts plain text from
SubRip (.srt) subtitle files and creates draft SRT files from text.
Built by StageCaptions, browser-based live captioning software for live events, conferences, and broadcasts.
Usage
Convert SRT to TXT:
npx @stagecaptions/srt-to-txt input.srt output.txtCreate an SRT file from text:
npx @stagecaptions/srt-to-txt input.txt output.srtTXT to SRT creates generated timestamps. It does not sync text to audio.
Control generated cue timing and length:
npx @stagecaptions/srt-to-txt input.txt output.srt --cue-duration 4 --max-chars-per-cue 90Defaults:
--cue-duration 3--max-chars-per-cue 80
TXT to SRT treats each non-empty line as cue text. Long lines are split into
smaller cues using --max-chars-per-cue.
Install
npm install @stagecaptions/srt-to-txtJavaScript API
import { srtToTxt, txtToSrt } from "@stagecaptions/srt-to-txt";
const text = srtToTxt(`1
00:00:01,000 --> 00:00:03,500
Hello world.`);
const srt = txtToSrt("Hello world.", { cueDuration: 3 });Validation
import { validateSrt } from "@stagecaptions/srt-to-txt";
const warnings = validateSrt(srtText);License
MIT
