Skip to content

ruby script that takes a video file with subtitles, extracts the subtitles, translates it to another language + saves the translated subtitles

License

Notifications You must be signed in to change notification settings

dgmdan/ruby-translate-subtitles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruby-translate-subtitles

ruby script that takes a video file with subtitles, extracts the subtitles, translates it to another language + saves the translated subtitles

How to use

  1. Clone this repo
  2. Create a Google Cloud account. Then make a new project, download API credentials, add a billing method, and activate the Cloud Translation API.
  3. Set a local environment variable GOOGLE_APPLICATION_CREDENTIALS with the path to your Google Cloud credentials. It's a JSON file you downloaded from Google Cloud.
  4. Run the script:
./translate.rb --input input_video.mkv --output translated_subtitles.srt --language es --stream 0:s:0

--input: Path to the .mkv video file.

--output: Path to save the translated .srt file (containing the translated subtitles)

--stream: which stream to use as source language (for example '0:s:0' for first subtitle track)

--language: target language for the translation (for example 'es' for Spanish)

About

ruby script that takes a video file with subtitles, extracts the subtitles, translates it to another language + saves the translated subtitles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages