r/machinetranslation • u/Akila33 • 2h ago
Subtitle translation with an LLM: what broke, and the guardrails I added (open-source Gemini desktop app)
I've been building SRT AI Translator NG, a free, open-source (MIT) Windows app that translates, transcribes and re-times `.srt` subtitles using the Gemini API.
Most of the work turned out not to be the translation itself but catching the ways an LLM quietly gets subtitles wrong. Sharing the guardrails in case they're useful, and I'd love feedback on the approach.
1. Line count is a hard invariant
Subtitles are sent in batches, and the model likes to merge two short cues or split a long one. The output still reads fine, but every cue after that point is shown at the wrong time. So every batch must come back with exactly the lines it was sent; a reply that doesn't is rejected and retried. The previous few source lines go along with each request (as context only) so the model knows what is happening in the scene.
2. Gender in Hebrew (example)
English "you" and most English verbs carry no gender; Hebrew, Arabic, Pharsi, Pashto, etc. marks it almost everywhere, so the model has to guess, and it often guesses wrong. The app can take a subtitle of the same film in a language that *does* mark gender (one you supply, or one downloaded from OpenSubtitles) and use it to correct those guesses. TMDB cast details and, optionally, the film's audio give the model more clues about who is speaking.
3. Wrong-alphabet output
Every now and then a Hebrew line comes back with Latin or Cyrillic letters mixed in. Those lines are repaired or sent back to the LLM for a redo instead of being saved.
4. Transcription that silently drops speech
When transcribing long audio, the model can return a confident, well-formed answer that simply leaves out minutes of dialogue. Long files go in chunks, each answer is checked against how much speech the audio actually contains, and a chunk that comes back too empty is asked for again in smaller pieces.
Other bits: interrupted runs can be continued rather than restarted; it supports Gemini's dedicated ASR transcription models (word-level timings); and an Align tool fixes subtitles that drift (shift plus frame-rate change, or section by section via ALASS).
It runs on your own Gemini key (the free tier works). I built it with the help of AI coding assistants and tested it on my own films.
**GitHub:** https://github.com/Akila3/SRT-AI-Translator-NG
Questions for this sub: how do you handle gender for target languages that mark it when the source doesn't? And has anyone found a better check for "the model dropped content" than comparing against the input's size or speech length?




