Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Video to Caption Tool

A web-based tool to extract captions from videos with timestamps. Supports Hindi, English, and auto-language detection.

Python Streamlit License

Features

  • Language support: Hindi, English, and Hinglish
  • Multiple output formats: SRT, VTT, JSON with timestamps
  • Drag and drop: Easy video upload interface
  • Flexible model selection: From tiny (fast) to large-v3 (most accurate)
  • Web UI: Easy-to-use browser interface
  • Local processing: No API costs, runs entirely on your machine

Screenshots

Upload a video → Configure settings → Generate captions → Download

Prerequisites

  • Python 3.9 or higher
  • FFmpeg installed on your system

Installing FFmpeg

macOS (Homebrew):

brew install ffmpeg

Ubuntu/Debian:

sudo apt update && sudo apt install ffmpeg

Windows: Download from https://ffmpeg.org/download.html and add to PATH.

Installation

  1. Clone the repository:
git clone https://github.com/PrasanBora/video-caption-tool.git
cd video-caption-tool
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the app:
streamlit run app.py
  1. Open http://localhost:8501 in your browser

Usage

  1. Upload a video file (MP4, MKV, AVI, MOV, WebM)
  2. Configure settings in the sidebar:
    • Choose a Whisper model (Medium recommended)
    • Select language or use auto-detect
    • Pick output format (SRT, VTT, or JSON)
  3. Click "Generate Captions"
  4. Preview the generated captions
  5. Download the caption file

Model Options

Model RAM Required Speed Accuracy
Tiny ~1 GB Fastest Basic
Base ~1 GB Fast Good
Small ~2 GB Medium Better
Medium ~5 GB Slower High (Recommended)
Large ~10 GB Slow Very High
Large-v3 ~10 GB Slowest Best

Output Formats

  • SRT: Standard subtitle format, works with most video players
  • VTT: WebVTT format, good for web applications
  • JSON: Raw data format with timestamps for custom processing

Project Structure

video-caption-tool/
├── app.py                    # Main Streamlit web app
├── config.py                 # Configuration & settings
├── requirements.txt          # Python dependencies
├── core/
│   ├── video_handler.py      # Video validation & metadata
│   ├── audio_extractor.py    # FFmpeg audio extraction
│   ├── transcriber.py        # Whisper transcription
│   └── caption_formatter.py  # SRT/VTT/JSON output
├── models/
│   ├── transcript.py         # Transcript data models
│   └── caption.py            # Caption segment models
└── utils/
    └── time_utils.py         # Timestamp utilities

Tech Stack

  • OpenAI Whisper: Speech-to-text transcription
  • FFmpeg: Audio extraction from videos
  • Streamlit: Web UI framework
  • Pydantic: Data validation

Tips

  • For Hindi/English videos, auto-detect works well
  • Use Medium model for best balance of speed and accuracy
  • GPU (CUDA or Apple Silicon) significantly speeds up transcription
  • SRT format is most widely supported by video players

License

MIT License - feel free to use and modify.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

A web-based tool to extract captions from videos with timestamps. Supports Hindi, English, and auto-language detection.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages