This project is a video subtitle generator built using Streamlit, Whisper, and FFmpeg. It extracts audio from a video, transcribes the audio using Whisper, generates subtitles in .srt format, and adds them back to the original video. It supports both soft and hard subtitles.
- Audio Extraction: Extracts audio from video files (supports
.mp4format). - Transcription: Uses the Whisper model to transcribe the extracted audio into text.
- Subtitle Generation: Creates
.srtsubtitle files with timestamps for the transcribed text. - Subtitle Embedding: Adds the generated subtitles to the video either as soft subtitles (text tracks) or hard subtitles (burned into the video).
- Streamlit Interface: Easy-to-use web interface for uploading videos and downloading the processed video with subtitles.
This project requires several dependencies. Below are the steps to install them:
https://github.com/balrajegorad/Video-Subtitle-Generator.git
cd Video-Subtitle-GeneratorCreate a virtual environment :
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`Install the required Python packages from the requirements.txt file:
pip install -r requirements.txtThis project uses FFmpeg for video processing. Ensure FFmpeg is installed and available in your system’s PATH.
macOS (Homebrew):
brew install ffmpegUbuntu:
sudo apt update
sudo apt install ffmpegWindows:
Download FFmpeg from here and follow the instructions to add it to your PATH.
The project uses the faster-whisper library to handle audio transcription. Install it by running:
pip install faster-whisper==1.0.3Once you’ve installed all dependencies, you can run the Streamlit app :
- Start the Streamlit app with the command:
streamlit run main.py