Skip to content

Instantly share code, notes, and snippets.

@partrita
Last active February 20, 2024 08:46
Show Gist options
  • Select an option

  • Save partrita/0470f9cc2187eb96cec944f35be58a15 to your computer and use it in GitHub Desktop.

Select an option

Save partrita/0470f9cc2187eb96cec944f35be58a15 to your computer and use it in GitHub Desktop.
here's a concise guide on installing and using "whisper" locally for automatic subtitle generation from videos.

0. Requirements

  • video file
  • conda package manager(installed)
  • you

1. How to?

about whisper

check this github repo.

  1. make virtual env
conda create -n whisper python=3.9
  1. activate virtual env
conda activate whisper
  1. install pytorch If you want to do it faster. you need to install pytorch-gpu
conda install pytorch-gpu -y
  1. check cuda availablity
  • open the python interpreter.
python
  • in python interpreter.
import torch
torch.cuda.is_available()
exit()

it must print true

  1. then, install whisper
pip install git+https://github.com/openai/whisper.git
  1. in terminal
whisper [Wang.mp4] --model large
  • [Wang.mp4] is your path for video.
  • It take 7min 11sec for 40min video(I used RTX4090)
  • pretty cool

2. Result

when it is done. deactivate virtual env.

conda deactivate

In same directory of video, there is .srt, .txt files in it.

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