Introducing yt-whisper: Automatic Subtitle Generation for YouTube Videos
yt-whisper is an innovative tool designed to generate subtitle files effortlessly for any YouTube video. By harnessing the power of yt-dlp
and OpenAI's sophisticated Whisper technology, it allows users to create subtitles quickly and efficiently. Here is what you need to know about this tool:
Installation
To begin using yt-whisper, there are a few prerequisites. Users need to have Python 3.7 or a newer version installed. The next step involves installing yt-whisper itself via the terminal with the following command:
pip install git+https://github.com/m1guelpf/yt-whisper.git
Additionally, ffmpeg
is required, which is a multimedia framework available through various package managers. Here's how you can install it:
-
On Ubuntu or Debian:
sudo apt update && sudo apt install ffmpeg
-
On MacOS via Homebrew:
brew install ffmpeg
-
On Windows using Chocolatey:
choco install ffmpeg
Usage
Once all installations are complete, yt-whisper can be used to generate subtitle files. The command below creates a VTT file (a subtitle format) from the desired YouTube video:
yt_whisper "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
By default, yt-whisper uses the small
model, which is highly effective for English transcription. For enhanced performance, especially with other languages, bigger models are available, such as medium
and large
. Here's how you can use a larger model:
yt_whisper "https://www.youtube.com/watch?v=dQw4w9WgXcQ" --model medium
Furthermore, yt-whisper has the capability to translate subtitles into English with the --task translate
option:
yt_whisper "https://www.youtube.com/watch?v=dQw4w9WgXcQ" --task translate
For a complete overview of features and options available in yt-whisper, you can execute the following command:
yt_whisper --help
License
yt-whisper is proudly an open-source script, which makes it freely available under the MIT License. For further details, users can refer to the LICENSE document included in the project.
With its simplicity and robust functionality, yt-whisper serves as a valuable tool for generating subtitles, accommodating both transcriptions and translations with a range of options to best suit different needs.