Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VidSubs: Automated Video Subtitle Generator for Termux

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.

Features

  • 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 ffmpeg to 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.

Deployment (Railway.app)

This repository is "Railway-ready." You can deploy it as a web service to have your own private subtitle API.

  1. One-Click Deploy:
    • Connect your GitHub account to Railway.
    • Create a "New Project" and select this repository.
  2. Set Environment Variables:
    • In the Railway dashboard, go to Variables.
    • Add GEMINI_API_KEY with your actual key from Google AI Studio.
  3. Usage:
    • Once deployed, Railway will provide a public URL.
    • You can send a video to https://your-app.up.railway.app/generate-subtitles via a POST request to get your SRT file.

Prerequisites

  1. FFmpeg, JQ, and Curl:
    pkg install ffmpeg jq curl
  2. Gemini API Key: Get a free API key from Google AI Studio.

Local Installation (Termux)

  1. Clone this repository:
    git clone https://github.com/anish-345/Vidsubs.git
    cd Vidsubs
  2. Make the script executable and move it to your path:
    chmod +x vidsubs
    # Optional: move to bin
    # cp vidsubs $PREFIX/bin/vidsubs

3. Set your API Key (One-time setup)

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 ~/.bashrc

Note: Replace YOUR_API_KEY_HERE with your actual key from Google AI Studio.

Usage

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.

License

MIT

About

generate subtitle from the videos

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages