Open-source subtitle generation for seamless content translation.
Key Features:
- Open-source: Freely available for use, modification, and distribution.
- Self-hosted: Run the tool on your own servers for enhanced control and privacy.
- AI-powered: Leverage advanced machine learning for accurate and natural-sounding subtitles.
- Multilingual support: Generate subtitles for videos in a wide range of languages.
- Easy integration: Seamlessly integrates into your existing workflow.
I made this project for fun, but I think it could also be useful for other people.
Ensure you have the following installed:
gitmakecmakeffmpeg(Required for video processing)conda(Anaconda or Miniconda)
We use whisper.cpp for high-performance inference. Run the setup script to clone, compile, and configure it automatically:
./setup_whisper.shThis script will:
- Clone the
whisper.cpprepository. - Detect your platform (macOS/Linux) and configure the build (Metal/CUDA support).
- Compile the
whisper-clibinary. - Install the binary to
./binary/whisper-cli. - Download the default
basemodel to./models/.
We use Conda to manage dependencies and the environment.
-
Create the environment:
conda env create -f environment.yml
-
Activate the environment:
conda activate subtitle
-
Verify installation:
python --version
Run the subtitle generation script:
python subtitle.py <path_to_video_file> [--model <model_name>]Basic usage (uses 'base' model by default):
python subtitle.py example/story.mp4Specify a model:
python subtitle.py example/story.mp4 --model baseUsing a URL (downloads and processes):
python subtitle.py https://example.com/video.mp4The script will generate a .vtt subtitle file in the data/ directory and merge it with the video (if supported container) or output the path.
The following models are supported (will be downloaded automatically if not present):
- tiny, tiny.en
- base, base.en
- small, small.en
- medium, medium.en
- large-v1, large-v2, large-v3
Note: Use .en models for English-only content for better accuracy.
- https://github.com/openai/whisper
- https://openai.com/blog/whisper/
- https://github.com/ggerganov/whisper.cpp
- https://github.com/innovatorved/whisper.api
Just try to being a Developer!
For support, email vedgupta@protonmail.com