This tool is designed to help users translate srt file into a different language using the OpenAI API (model="gpt-3.5-turbo"). Support bilingual subtitles output.
To use this tool, you will need to have Python 3 installed on your system, as well as the following packages:
You can install these packages by running the following command:
pip install -r requirements.txt
git clone
git clone https://github.com/jesselau76/srt-gpt-translator.git
Update to new version
cd srt-gpt-translator
git pull
pip install -r requirements.txt
To use this tool, you need rename settings.cfg.example to settings.cfg at first.
cd srt-gpt-translator
mv settings.cfg.example settings.cfg
nano settings.cfg
openai-apikey = sk-xxxxxxx
replace sk-xxxxxxx to your OpenAI api key. Change others options then press CTRL-X to save.
run the command:
python3 srt_translation.py [-h] [--test] filename
positional arguments:
filename Name of the input file
options:
-h, --help show this help message and exit
--test Only translate the first 3 short texts
Simply run the srt_translation.py
script with the file you want to translate or convert as an argument. For example, to translate a srt file named example.srt
, you would run the following command:
python3 srt_translation.py example.srt
By default, the script will attempt to translate the text into the language specified in the settings.cfg
file under the target-language
option.
The settings.cfg
file contains several options that can be used to configure the behavior of the script:
openai-apikey
: Your API key for the OpenAI API.target-language
: The language you want to translate the text into (e.g. "English", "Chinese", "Japanese").The output of the script will be two files:
_translated
added to the end. For example, if the input file is example.srt
, the output file will be example_translated.srt
. _translated_bilingual
is added at the end. For example, if the input file is example.srt
, the output file will be example_translated_bilingual.srt
.This tool is released under the MIT License.
The SRT Translator tool is provided for educational and informational purposes only. The accuracy, reliability, and completeness of the translations generated by the OpenAI API model ("gpt-3.5-turbo") used in this tool cannot be guaranteed. Users of the SRT Translator tool are solely responsible for verifying the accuracy and usefulness of the translations obtained, and should not rely solely on them without further verification. The use of the SRT Translator tool is at the user's own risk, and the tool's developers and contributors shall not be liable for any damages or losses arising from its use. By using the SRT Translator tool, you agree to these terms and conditions.
If you have any concerns or suggestions about the use of this project, please contact us through the issues section.