This Chrome extension performs real-time transcription of YouTube videos using whisper.cpp, processing everything locally on your device. It automatically injects the resulting subtitles into the YouTube video player.
-
Setup Whisper.cpp
If you have not cloned the repository with the --recursive flag (
git clone --recursive https://github.com/rushilbhat/YTSubtitleGen.git), run the following two commands at the root of the repositorygit submodule init git submodule updateNavigate to
whisper.cpp, download the Whisper small model converted in ggml format (small model currently harcorded inserver.js. See below for instructions on downloading and running other Whisper models) and make the main example.cd whisper.cpp bash ./models/download-ggml-model.sh small make -
Install Server Dependencies:
Navigate to the
serverdirectorynpm install -
Set up the Chrome Extension:
- Open Chrome.
- Navigate to
chrome://extensions/. - Ensure "Developer mode" is toggled on.
- Click on "Load unpacked" and select the
extensiondirectory from this repository.
-
Run the Server: From the
serverdirectory, run:npm startEnsure the server is running on
http://127.0.0.1:3000/. -
Usage
Open any YouTube video in Chrome.
Click on the CC button on the YouTube video player controls to start real-time transcription. The subtitles will automatically be injected into the YouTube video player.
Use the download-ggml-model.sh script to download one of the Whisper models already converted in ggml format. See available models at whisper.cpp/models/README.md
cd whisper.cpp
# Replace [MODEL_NAME] with the desired model, for example, base, base.en, small, small.en, medium etc.
./models/download-ggml-model.sh [MODEL_NAME] After downloading, update the relative path stored under model in server/server.js. For example, if you downloaded the medium model:
const model = "../whisper.cpp/models/ggml-medium.bin";
If you want to create a quantized model from one of Whisper ggml models, in the root directory run:
./quantize models/ggml-medium.bin models/ggml-medium-q5_0.bin q5_0Update the relative path stored under model in server/server.js accordingly. Further details on quantization here