Automatic subtitles translation with a local neural machine translation model. No third-party service required: the translation is done locally with small but efficient neural network models.
Github repository: https://github.com/tdhm/subtitles-translator/
Documentation https://tdhm.github.io/Subtitles-Translator/
Original movie in French | Output of automatic translation |
---|---|
Note Screenshots are taken from Bon voyage, a short French language propaganda film made by Alfred Hitchcock for the British Ministry of Information. This film is now in the Public Domain.
Subtitles Translator is available as subtitles_translator
on PyPI:
pip install subtitles_translator
You'll also need to install ffmpeg
, which is available from most package managers:
# on macOS using Homebrew (https://brew.sh/)
brew install ffmpeg
# on Windows using Chocolatey (https://chocolatey.org/)
choco install ffmpeg
# on Ubuntu or Debian
sudo apt update && sudo apt install ffmpeg
Note Please note that the current version only supports MP4 video files (MKV support coming soon). Your MP4 must contain only one subtitles track, which will be translated and replaced in a new MP4 file. You can also translates SRT subtitles files, or extract and translate SRT files from a MP4 (look at the doc!).
With the following command, subtitles from 'video.mp4' will be extracted and translated from 'french' to 'english'. The video containing translated subtitles will be saved as 'translated_video.mp4':
subtitles_translator -i video.mp4 -o translated_video.mp4 -s fr -t en