1.0.0 • Published 12 months ago

srt-ai v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

AI Subtitles

image
Translate text subtitles (including embedded subtitles) to any language using OpenAI's API.

Install

  1. Install ffmpeg: sudo apt install ffmpeg
  2. Clone the repo: git clone https://github.com/ilarramendi/srt-ai
  3. Install dependencies: npm install
  4. Install cli: npm install -g .
  5. Clone .env.example to .env and edit the values

Usage

ai-sub "path/to/movie.mkv"
or for all files in a directory
ai-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

KeyValueExample
TARGET_LANGUAGETarget language with first letter in upper caseSpanish
LANGUAGE_SHORTLanguage short namees
EXTRA_SPECIFICATIONExtra specification for the translationTranslation must be in Latin American Spanish, not Spain Spanish
MAX_TOKENSMax tokens to send to the model1000
OPENAI_API_KEYOpenAI API keysk-XXX
AI_MODELOpenAI 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

12 months ago