SkyaTura / gpt-subb

gpt-subb is a command-line tool to translate and convert subtitles using OpenAI's Chat-GPT language models
GNU General Public License v3.0
15 stars 3 forks source link
chat-gpt gpt-3 openai srt srt-subtitles subtitle subtitles webvtt

GPT Subb

gpt-subb is a command-line tool to translate and convert subtitles using OpenAI's Chat-GPT language model

First things first

I made this tool part as a joke and part as a experiment out of an idea given by a friend. Feel free to contact me if you want a more professional software to this purpose.

We also won't refuse a couple of beer donations if you find this useful somehow. 🍻

Installation

To install gpt-subb, you need to have Node.js and npm (Node Package Manager) installed on your system. Once you have these installed, you can run the following command in your terminal:

npm install -g gpt-subb

This will install the tool globally on your system, making it available for use in any directory.

Usage

Prerequisites

To use the tool, you will need an OpenAI API key, which can be obtained at https://platform.openai.com/account/api-keys.

Command

The gpt-subb command requires an input file to be translated as a mandatory argument and an output file as an optional argument. The tool will create the output file with the translated subtitles. If no output file is specified, the tool will create a new file in the same directory with the same name as the input file and the language code appended to the basename.

gpt-subb <input-file> [output-file]

Options

Environment variables

Any option of this tool can be defined through environment variable or a .env file placed in the directory from where you are running the command.

Example:

GPTSUBB_KEY="ABC-123-XYZ"
GPTSUBB_LANGUAGE="en-us"

Examples

Translate the input.srt file to Portuguese (pt-br) and save the result to output.srt file:

gpt-subb -k YOUR_API_KEY -l pt-br input.srt output.srt 

Translate the movie.srt file to French (fr) and save the result to movie.fr.vtt file:

gpt-subb -l fr -f WebVTT movie.srt