chatgpt-subtitle-translator  by Cerlancism

Subtitle translator CLI tool using ChatGPT or compatible LLM

created 2 years ago
337 stars

Top 82.8% on sourcepulse

GitHubView on GitHub
Project Summary

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

  • Install: Clone the repository, run npm install.
  • Prerequisites: Node.js version >= 16.13.0.
  • Setup: Copy .env.example to .env and add your OpenAI API key. Make cli/translator.mjs executable (chmod +x cli/translator.mjs).
  • Usage: cli/translator.mjs --input <your_subtitle_file.srt> --to <target_language>
  • Docs: Setup Reference

Highlighted Details

  • Supports any OpenAI API compatible providers (e.g., Ollama).
  • Features experimental structured output and prompt caching.
  • Includes OpenAI Moderation API integration to prevent refusals.
  • Token usage analysis shows significant reduction compared to naive batching.

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.

Health Check
Last commit

3 weeks ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
17 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.