1.0.0 • Published 1 year ago
srt-ai v1.0.0
AI Subtitles
Translate text subtitles (including embedded subtitles) to any language using OpenAI's API.
Install
- Install ffmpeg:
sudo apt install ffmpeg - Clone the repo:
git clone https://github.com/ilarramendi/srt-ai - Install dependencies:
npm install - Install cli:
npm install -g . - Clone
.env.exampleto.envand edit the values
Usage
ai-sub "path/to/movie.mkv"
or for all files in a directoryai-sub "path/to/movies/**/*"
Parameters
--debug will print the original and translated text for each segment--ignore-existing-translation will translate even if a existing translation in the target language already exists--batch will batch translation requests in queue (extremely recommended, this also reduces the cost in half, takes more time but request are stored in cache)--wait will wait until all jobs are finished (only works with --batch, may take a while)
Options
| Key | Value | Example |
|---|---|---|
| TARGET_LANGUAGE | Target language with first letter in upper case | Spanish |
| LANGUAGE_SHORT | Language short name | es |
| EXTRA_SPECIFICATION | Extra specification for the translation | Translation must be in Latin American Spanish, not Spain Spanish |
| MAX_TOKENS | Max tokens to send to the model | 1000 |
| OPENAI_API_KEY | OpenAI API key | sk-XXX |
| AI_MODEL | OpenAI model to use (for better translations use gpt-4, but its 10x more expensive) | gpt-3.5-turbo |
Credits
This project was inspired by yazinsai/srt-ai
1.0.0
1 year ago