Skip to content

Instantly share code, notes, and snippets.

@yegor256
Last active April 22, 2025 09:19
Show Gist options
  • Save yegor256/180f0d300566efd6642928d81fe8946a to your computer and use it in GitHub Desktop.
Save yegor256/180f0d300566efd6642928d81fe8946a to your computer and use it in GitHub Desktop.
How to generate EN/RU subtitles for a video

Let's say you have video.mov file in English.

First, convert it to the WAV format, with the help of ffmpeg:

ffmpeg -i video.mov -ar 16000 -ac 1 -c:a pcm_s16le video.wav

Then, install whisper.cpp and download its medium model.

Then, get English subtitles:

cd /code/whisper.cpp
build/bin/whisper-cli --model models/ggml-medium.bin \
  --file video.wav --no-prints --best-of 7 \
  --output-srt --language en \
  --output-file english \
  --print-progress --processors 6

You will get english.srt file.

Then, install chatgpt-subtitle-translator, in the /code directory.

Then, generate Russian subtitles:

cd /code/chatgpt-subtitle-translator
cli/translator.mjs --from english --to russian \
  --stream --temperature 0 \
  --input english.srt --output russian.srt

Finally, you will get the russian.srt file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment