Skip to content

AutoCaption is a complete, fully automated tool for generating video subtitles. Simply upload your video and let the software handle the rest using its powerful backend and advanced user interface. Within minutes, you’ll receive accurate, synchronized subtitles without any complex setup. Enjoy a fast, simple, and professional subtitling experience.

License

Notifications You must be signed in to change notification settings

AUX-441/AutoCaption

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

🎬 Persian Video Subtitle Translator

Python Flask OpenAI Whisper FFmpeg License

A powerful Python web application that automatically translates English video subtitles to Persian (Farsi) and burns them directly into your videos with precise timing and formatting. Perfect for content creators, educators, and video enthusiasts who want Persian subtitles in a snap.


🌟 Features

  • Automatic Speech Recognition: Uses OpenAI's Whisper model (medium) for high-accuracy transcription.
  • English β†’ Persian Translation: Powered by Google Translate API.
  • SRT Subtitle Generation: Proper timing and formatting guaranteed.
  • Subtitle Burning: Embed subtitles into videos via FFmpeg.
  • User-Friendly Web Interface: Upload, manage, and track your videos easily.
  • Queue System: Handle multiple video translations efficiently.
  • Real-Time Status Updates: Monitor processing status live.
  • Automatic Cleanup: Temporary files removed to save storage.
  • Formal-to-Casual Persian Conversion: Natural and fluent translations.
  • Custom Persian Text Normalization: Improves readability and accuracy.

πŸ› οΈ Technical Stack

Component Technology
Backend Flask (Python)
Speech-to-Text OpenAI Whisper (medium)
Translation Google Translator API
Video Processing FFmpeg
Text Processing Custom Persian text normalizer
Concurrency Python Threading

πŸ“¦ Installation

Prerequisites

  • Python 3.8+
  • FFmpeg (must be in system PATH)
  • Whisper dependencies (openai/whisper)

Setup

# Clone the repository
git clone https://github.com/yourusername/persian-video-translator.git
cd persian-video-translator

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Create necessary directories
mkdir -p Videos output process_status config Converted_Videos logs SRT black_list fonts

# Create config file
echo '{}' > config/config.json

πŸš€ Usage

# Start the application
python app.py
  1. Access the web interface at http://localhost:5000
  2. Upload your video files (MP4 recommended)
  3. Click Start Processing
  4. Download processed videos when ready

πŸ—οΈ Project Structure

persian-video-translator/
β”œβ”€β”€ app.py                # Main Flask application
β”œβ”€β”€ main.py               # Core processing pipeline
β”œβ”€β”€ extract_from_video.py # Audio extraction and transcription
β”œβ”€β”€ Translator.py         # Translation module
β”œβ”€β”€ Generate_srt.py       # SRT file generation
β”œβ”€β”€ burn_srt.py           # Subtitle burning with FFmpeg
β”œβ”€β”€ Regex.py              # Persian text normalization
β”œβ”€β”€ config/               # Configuration files
β”œβ”€β”€ Videos/               # Uploaded videos storage
β”œβ”€β”€ output/               # Processed videos output
β”œβ”€β”€ process_status/       # Processing status files
β”œβ”€β”€ templates/            # Flask templates
└── requirements.txt      # Python dependencies

πŸ”§ Configuration

Edit config/config.json to customize paths and behavior:

{
  "video_path": "path/to/input/video",
  "converted_audio_dir": "Converted_Videos",
  "logs_dir": "logs",
  "logs_filename": "logs.json",
  "translated_segments_filename": "translated_segments.json",
  "blacklist_dir": "black_list",
  "blacklist_filename": "black_list.json",
  "srt_output_dir": "SRT",
  "srt_suffix": "_translated.srt",
  "srt_path": "SRT/output_translated.srt",
  "output_video_path": "output/output_translated.mp4",
  "formal_2_casual": "formal2casual_dataset/formal_to_casual_dict.json"
}

βš™οΈ Processing Pipeline

  1. Video Upload: User uploads video via web interface
  2. Audio Extraction: Extract audio track using MoviePy
  3. Speech Recognition: Transcribe audio using Whisper
  4. Translation: Translate English text to Persian
  5. Text Normalization: Apply Persian formatting rules
  6. SRT Generation: Create subtitle file with proper timing
  7. Subtitle Burning: Burn subtitles into video with FFmpeg
  8. Cleanup: Remove temporary files
  9. Download: Processed video available for download

🌐 API Endpoints

Method Endpoint Description
POST / Upload video files
POST /start_processing Start processing queue
GET /status Get processing status
GET /check_file/<filename> Check if file is ready
GET /download/<filename> Download processed video
POST /delete/<filename> Delete uploaded file

πŸ“Š Performance Notes

  • Processing time depends on video length and hardware
  • Medium Whisper model balances accuracy & speed
  • Recommended max video length: 30 minutes
  • Queue system prevents resource overutilization

πŸ› Known Issues

  • Long videos may timeout during processing
  • Some special characters may not render perfectly
  • Complex English sentences may not translate ideally

πŸ“œ License

MIT License Β© 2025


πŸ™ Acknowledgments

  • OpenAI for Whisper model
  • Google for translation services
  • FFmpeg for video processing
  • Persian NLP community for text normalization rules

About

AutoCaption is a complete, fully automated tool for generating video subtitles. Simply upload your video and let the software handle the rest using its powerful backend and advanced user interface. Within minutes, you’ll receive accurate, synchronized subtitles without any complex setup. Enjoy a fast, simple, and professional subtitling experience.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •