Whether you’re watching a local video on your computer or streaming content from a service, you can easily generate subtitles through MPV.

Dependencies

Using CUDA Cores with an Nvidia Graphics Card (For Arch)

You can increase subtitle generation speed by utilizing CUDA support. Follow these steps:

  1. Install CUDA:
    sudo pacman -S cuda
  2. Download Whisper.cpp
    git clone https://github.com/ggerganov/whisper.cpp.git
    cd whisper.cpp
    bash ./models/download-ggml-model.sh {desired_model*}
    make clean
    WHISPER_CUDA=1 make -j

Supported Model Names

tiny.en, tiny, tiny, base.en, base, small.en, small, medium.en, medium, large-v1, large-v2, large-v3

Running with CPU

To run without CUDA support, using CPU:

  1. Clone Whisper.cpp
    git clone https://github.com/ggerganov/whisper.cpp.git
    bash ./models/download-ggml-model.sh {desired_model*}
    make

Lua Script Setup

  1. Place the whispersubs.lua file in the ~/.config/mpv/scripts folder.
  2. Edit the WHISPER_CMD line in the script to reflect the installation path of Whisper.cpp:
local WHISPER_CMD = "/models/whisper.cpp/main -m /models/whisper-ggml-medium.bin --threads 6 --language en"

Open the video and press CTRL + . to generate subtitles.