Subtitle translator CLI tool using ChatGPT or compatible LLM
Top 82.8% on sourcepulse
This project provides a tool for translating subtitle files (SRT) and plain text using OpenAI's ChatGPT API or compatible LLMs. It's designed for users who need to translate large volumes of text while maintaining subtitle timing and structure, offering both a Web UI and a CLI.
How It Works
The tool optimizes token usage and translation accuracy by batching subtitle lines. It strips SRT overhead, groups lines into batches (configurable via --batch-sizes
), and sends them to the LLM. This approach minimizes token waste and aims for a one-to-one mapping between input and output lines, even with complex instructions or non-standard text. It also includes optional moderation checks and supports streaming output.
Quick Start & Requirements
npm install
..env.example
to .env
and add your OpenAI API key. Make cli/translator.mjs
executable (chmod +x cli/translator.mjs
).cli/translator.mjs --input <your_subtitle_file.srt> --to <target_language>
Highlighted Details
Maintenance & Community
No specific contributor or community links (Discord/Slack) are provided in the README.
Licensing & Compatibility
The repository does not explicitly state a license.
Limitations & Caveats
The project is presented without a formal license, which may impact commercial use or redistribution. The README mentions that perfect input/output quantity matching depends on the model and subtitle quality, and suggests buffering token usage for retries. Experimental features are noted.
3 weeks ago
1 day