MaKTaiL/gemini-srt-translator

Python tool for translating subtitles using Google Gemini AI


Gemini SRT Translator – a Python package that lets you translate, transcribe, and extract subtitles using Google’s Gemini models.

What it does

  • Translate .srt or .ass subtitle files into any language Gemini supports, keeping timestamps intact.
  • Transcribe audio/video files directly to subtitle format.
  • Extract subtitles or audio from video (requires FFmpeg) and optionally feed the audio back to Gemini for better context.
  • CLI (gst …) for one‑liners and scripting, plus a Python API for programmatic use.
  • Supports Google’s standard Gemini API or the enterprise Agent Platform (Vertex AI) with ADC or API‑key auth.
  • Features like batch processing, resumable runs, custom model parameters (temperature, service tier, etc.), logging, and token‑usage reports.

How you use it

  1. Install: pip install -U gemini-srt-translator (prefer a virtualenv).
  2. Set GEMINI_API_KEY (or configure enterprise vars) – the tool will prompt if missing.
  3. Run a simple translation:
    export GEMINI_API_KEY=YOUR_KEY
    gst translate -i movie.srt -l French
    
    Add -v movie.mp4 --extract-audio to pull subtitles from a video and give Gemini the audio for context.
  4. For transcription:
    gst transcribe -v lecture.mp4 -o lecture.srt
    
  5. In Python you can do:
    import gemini_srt_translator as gst
    gst.gemini_api_key = "YOUR_KEY"
    gst.input_file = "movie.srt"
    gst.target_language = "French"
    gst.translate()
    
    or work with the richer SubtitleSession / TranscriptionSession classes for custom pipelines.

Who it’s for

  • Content creators who need quick, high‑quality subtitle translations.
  • Developers building automated video pipelines or AI agents that need subtitle handling.
  • Researchers experimenting with Gemini’s “thinking” mode for more context‑aware translations.

Limits & requirements

  • Requires a valid Gemini API key (or Google Cloud enterprise credentials).
  • FFmpeg must be installed for video‑based extraction.
  • Large files may need batch‑size tuning; the tool can auto‑reduce batch size on errors.

All details above are taken directly from the project’s README; no extra claims are added. ***

Key fields

  • Category: subtitle translation / transcription tool powered by Gemini LLM.
  • Installation: pip install -U gemini-srt-translator (virtualenv recommended).
  • Primary interfaces: gst CLI (translate, transcribe, extract, list-models, agent, skill), Python API (gst.translate(), SubtitleSession, TranscriptionSession).
  • Auth: GEMINI_API_KEY env var or enterprise vars (GOOGLE_GENAI_USE_ENTERPRISE, GOOGLE_CLOUD_PROJECT, etc.).
  • Dependencies: ffmpeg (system), Gemini client library, standard Python packages.
  • License / status: Not specified in the excerpt, but the package is published on PyPI and has contributors.


End of explanation.

Related

  • Project
  • Dispatch
  • Project
  • Project
  • Project