generate translated subtitle of a bunch of videos
The purpose of this project is to create automatically translated subtitles for several videos in succession.
Ideal for follow a courses in another language
Python 3.9
Add you vidéo file in to "videofile" directory
If you use DEEPL, you have to get api key
Otherwise You need to have install the project libretanslate (open source translation). And makesure you can acces it in terminal
Download the repo
git clone https://github.com/Liaze-v/GenerateSRT.git
Then create a venv
python -m venv venv
Activate it
.venv\Scripts\activate
Dependencies
pip install deepl
pip install requests
pip install time
pip install textwrap
pip install json
Then paste your videos in the zae directory.
Translation with Libtranslate Launch
Libtranslate.bat
Then in another terminal Run
python genrerateSrt.py
Translation with DEEPL: Go to "translate.py" Comment between ----libretranslate API---- And uncomment between ----Deepl API----
Finally add your api key auth_key = "" Then run
python genrerateSrt.py
The code is currently written to translate and generate French subtitles from English.
If your videos are not in English, go to the file "genrerateSrt.py" Then modify the "generateSrtdef" function
model.transcribe(name,fp16=False,language='en')
For a target language other than French, Go to the file and change "target_lang" to DEEPL or "target" to Libtranslate