A Gradio web application in Python for automatically generating and embedding subtitles in videos, with customization options.
auto_subs_demo_1_git.mp4
auto_subs_demo_2_git.mp4
- Python 3.10 (Might work with lower/higher versions as well).
- NVIDIA CUDA for faster processing.
- VRAM requirements: Atleast 6GB VRAM for
medium
and 11 GB forlarge-v2
models of whisper. - Also, works on CPU only but is awfully slow.
- Developed on Debian 12, please make the required changes for other OS or distros.
- Clone the repo and move to the root dir.
git clone https://github.com/prashkrans/auto_subs.git
cd auto_subs/
- Create a python virtual environment.
python3 -m venv env_auto_subs
source env_auto_subs/bin/activate
- Install the requirements (Might take some time).
pip install -r requirements.txt
- Source
env_auto_subs
source env_auto_subs/bin/activate
- Run
main_gradio_app.py
python3 main_gradio_app.py
- Open the local host link in a web browser by either
Ctrl + Left Click
on the link provided in the terminal or copying and pasting the same in the browser. - Upload the video to be subbed.
- Click on
Generate Subtitles
and wait for the subtitles to be generated. - Review and edit the generated subtitles if required.
- Customize subtitles as required and then click on
Embed Subtitles
to hard burn the subtitles in the provided video. - Download the video by clicking in the top right corner of the video preview.
- Download .vtt and .srt subtitles if required.
- Change model name
model_name = "large-v2"
tomedium
orlarge-v3
in line 23 of _2_generate_transcript_matrix.py to use different available models of open-ai whisper. - Ignore the error:
/tmp/tmpnbw41k68/main.c:4:10: fatal error: Python.h: No such file or directory 4 | #include <Python.h>
- When running for the first time, it downloads the whisper models which takes some time as its about 2GBs in size.
- The fonts used are open source fonts.
- A few fonts are in upper case by default.
This app and OpenAI whisper model weights are released under the MIT License. See LICENSE for further details.