Translate subtitles with LLMs.
- Strips the timestamps from the subtitles before translating, to reduce input tokens.
- Runs multiple chunks in parallel to speed up the translation process.
- Tries to ensure model does not skip or merge subtitles while translating.
- Supports Claude, OpenAI, Gemini models.
Install the dependencies:
pip install -r requirements.txt
Create an environment file:
- Rename the
.env.example
at the root of your project to.env
- In the new
.env
file, add your API key(s)
python translate.py path/to/subtitles.srt -l english -t 2
-l Language to translate to (default: English)
-t Number of threads to use (default: 1)
-s Number of tokens per chunk (default: 2500)
-m Model to use (default: claude-3-haiku)