Simple python wrapper around Mistral to translate .vtt
-subtitles into another language.
Python3 is required, install a venv
and the required dependencies:
python3 -m venv .venv
. .venv/bin/activate
pip3 install -r requirements.txt
Run the translation on a given VTT file:
python3 translate.py --lang de --key APIKEY subtitle-file.vtt
The translated subtitles are stored in the same directory of the import file (with a two-letter language added).
usage: translate.py [-h] [--lang LANG] [--key KEY] [input_file]
VTT translator
positional arguments:
input_file Filename of the english VTT file to translate, default `text.vtt`.
options:
-h, --help show this help message and exit
--lang LANG Two letter iso-code for the target language, default `de`.
--key KEY Mistral API key, if not given as environment variable `MISTRAL_API_KEY`.
MIT - 2025 Wolfgang Jung