VidSubs is a lightweight Termux tool that extracts audio from video files and uses the Google Gemini API to generate high-quality English subtitles in SRT format.
- Latest AI Models: Uses Gemini 2.0 Flash for state-of-the-art transcription speed and accuracy.
- Smart Fallback: Automatically falls back to Gemini 1.5 Flash if the primary model is unavailable.
- Local Audio Extraction: Uses
ffmpegto extract audio in WAV format (16kHz, Mono) for optimal AI recognition. - Auto-Cleanup: Automatically removes temporary audio files and deletes uploaded files from the Gemini server after processing.
- Global Access: Once installed, run it from any directory in Termux.
This repository is "Railway-ready." You can deploy it as a web service to have your own private subtitle API.
- One-Click Deploy:
- Connect your GitHub account to Railway.
- Create a "New Project" and select this repository.
- Set Environment Variables:
- In the Railway dashboard, go to Variables.
- Add
GEMINI_API_KEYwith your actual key from Google AI Studio.
- Usage:
- Once deployed, Railway will provide a public URL.
- You can send a video to
https://your-app.up.railway.app/generate-subtitlesvia a POST request to get your SRT file.
- FFmpeg, JQ, and Curl:
pkg install ffmpeg jq curl
- Gemini API Key: Get a free API key from Google AI Studio.
- Clone this repository:
git clone https://github.com/anish-345/Vidsubs.git cd Vidsubs - Make the script executable and move it to your path:
chmod +x vidsubs # Optional: move to bin # cp vidsubs $PREFIX/bin/vidsubs
To make the tool work automatically every time you open Termux, run these commands:
echo "export GEMINI_API_KEY='YOUR_API_KEY_HERE'" >> ~/.bashrc
source ~/.bashrcNote: Replace YOUR_API_KEY_HERE with your actual key from Google AI Studio.
Run the command followed by the path to your video file:
./vidsubs "my_video.mp4"The .srt file will be generated in the same directory as the video.
MIT