Register | Log-in

How to generate subtitles with Whisper

 

This tutorial is kindly provided by Lionfacial. All credits to him.
Notes:
   - To proceed, you will need a Google account.
   - A dedicated post is available in the forum
  1. Introduction
  2. Upload files to your Google drive
  3. Using colab, follow the steps
  4. Parameters to transcribe with Whisper
  5. A friendly code to change parameters
  6. Translate with...
  7. Tips

Introduction

You're dreaming to make your own subtitles of videos, you have the programs to edit srt file but you're not good to learn a new language. OpenAI Whisper is what you need, it's accurate with some languages, and it's free !
Now let's start on how you can do it !

Upload files to your Google drive

First of all, login to your google account and go to your google drive. Drag and drop your files or right click on your Google drive. (I choose to upload only the audio of the video, it will take less time).
Now two choices:

  1. Go to the original page : https://colab.research.google.com/drive/1WLYoBvA3YNKQ0X2lC9udUOmjK7rZgAwr?usp=sharing
  2. Or you can do the same with my modified page of the original, with an interactive interface to change the parameters more easily, go to : A friendly Code to change parameters

Then, follow the instructions of the page, it's a tutorial for using whisper but I will add some useful informations next, so only do the introduction before « Step One ». Open your colab page, you can do it with Google Chrome or Firefox or else, choose your favorite web browser.

Using colab, follow the steps

To begin use whisper follow the instructions of your page (step one and two) : Now you need to mount your google drive. First add the code (at step Three) by clicking [+Code] on the upper page or after a cell and enter :

from google.colab import drive
drive.mount('/content/gdrive')
You can see a new folder named « gdrive » to the left (it take a little time), your files are in. (You can move the cell with their arrows buttons)

Parameters to transcribe with Whisper

You can modify all the cells of your page, just click on it or the button « Modify » of the cell. So change the command line of the step Four, put the path of your file and add parameters if you want. To see what sort of parameters Whisper have, add the code :

!whisper --help
And now a description of the most useful parameters :

A friendly code to change parameters

Too difficult for you to change the line every time? don't worry, I create an interface to simplify all the work. And i give you the link of my modified Google Colab page : https://colab.research.google.com/drive/18F1brP9fn-P0HEJtQAHH946AUlF46y-0?usp=drive_link

And this is my google colab page of insanely-fast-whisper, i've got great results with it: https://colab.research.google.com/drive/1wj6f0pljYz_Srst_HfJlkWuF_6Ma7Zck?usp=drive_link

Next, follow the instructions of the page and...
Enjoy the interface now :

Translate with...

Step 5 of the page is useless without a google colab pro, so i never try it to translate a file.
Just download the text file Whisper have created at the left of the page. It's a srt file if you choose only this output format.

Now translate with your favorite translator : Google translate, DeepL translator, Reverso, yourself because you're very smart or masochist, or a dictionary because it's still exist and you are really a masochist. Or anything else...

All of this takes time, you can spend 2 hours for 5 to 10 minutes of video/audio to make a good subtitle file.

Tips