Skip to content

NeuralFalconYT/Auto-Subtitle-Generator-Free

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎬 Auto Subtitle Generator (Free)

Run on Colab:
Open In Colab

Try the HuggingFace Demo:
HuggingFace Space Demo

Generate subtitles automatically from your videos or audio files using the Whisper-Large-V3-Turbo-CT2 model.

Reason to make this:
When you try to generate captions for free, most editing software either charges money or imposes strict limitations, such as daily/monthly usage limits or short-duration restrictions.
Even if they allow free use, they often add watermarks or downgrade videos to 720p doing every trick to force you to buy their software.

This tool isn’t 100% perfect, but it completes about 80% of the work reliably, providing a free and simple solution for subtitle generation.


🚀 Features

  • 🎤 Automatic Speech-to-Text: Generate .srt subtitles from video or audio using Whisper AI.
  • 🌍 Subtitle Translation: Translate subtitles into multiple languages while keeping them dubbing-friendly.
  • ✍️ Grammar Fixing: Clean up bad English subtitles (e.g., spoken English) into polished, natural English.
  • Colab Ready: Run instantly on Google Colab without setup.
  • 📂 JSON → SRT Converter: Convert AI-generated JSON back into .srt files.

🛠️ Installation (For Local Use)

git clone https://github.com/NeuralFalconYT/Auto-Subtitle-Generator-Free.git
cd Auto-Subtitle-Generator-Free
pip install -r requirements.txt
python app.py

📸 Screenshots

🎬 Generate Subtitles

app_1

🔎 How Subtitle Generation Works

Upload an audio or video file → generate word-level subtitles using Whisper-Large-V3-Turbo-CT2,
then process the word-level timestamps to create different subtitle formats.

By default, you get the Whisper subtitles, and after processing you get multiple variations:

from subtitle import subtitle_maker

media_file = "video.mp4"
source_lang = "English"
target_lang = "English"

default_srt, translated_srt, custom_srt, word_srt, shorts_srt, txt_path, transcript = subtitle_maker(
    media_file, source_lang, target_lang
)

# If source_lang and target_lang are the same, translation will be skipped.
# ⚠️ Note: Translation uses Google Translator, which may not always give accurate results.  
# If you don’t need translation, set `source_lang` and `target_lang` to the same value.  
# This will skip translation and keep the original subtitles.
  • default_srt → Original subtitles generated directly by Whisper-Large-V3-Turbo-CT2
  • translated_srt → Translated subtitles (only if source_lang ≠ target_lang, e.g., English → Hindi)
  • custom_srt → Modified version of default subtitles with shorter segments (max 38 characters per line, better readability for horizontal videos)
  • word_srt → Word-level timestamps (useful for Shorts/Reels karaoke-style captions)
  • shorts_srt → Optimized for vertical videos (3–4 words at a time, max 17 characters per segment)
  • txt_path → Full transcript as plain text (useful for summarization or LLM-based Q&A)
  • transcript → Transcript text returned directly by the function

✅ All functionality is contained in a single file, making it portable and reusable across projects.


🌍 Translate Subtitles into Different Languages using LLM

app_2

Feature 1: Subtitle Translation

📖 How Subtitle Translation Works

  1. Upload the .srt file generated by Whisper.

  2. Choose the Translation task in the app.

  3. Generate Prompt Copy the generated prompt and paste it into Google AI Studio or your preferred LLM tool. Do not change the JSON output structure:

    {
      "subtitle sequence number": {
        "timestamp": "original timestamp",
        "actual subtitle text": "original subtitle line",
        "dubbing": <result>
      }
    }
  4. Copy the JSON Prompt Output Paste the JSON prompt into AI Studio and copy the LLM result.

  5. Generate the Translated SRT File Paste the JSON output back into the app → download the translated .srt file.


Feature 2: Romanization

Convert subtitles from any non-Latin script into Roman letters.

  • Example: "नमस्ते, आप कैसे हैं ?""Namaste, aap kaise hain ?"
  • Useful for creating dubbing-friendly subtitles for audiences who don’t read the original language but can read English..

Feature 3: Fix Grammar

The main goal is English-to-English dubbing: change the voice and fix grammar. After obtaining the corrected subtitles, you can use the SRT-to-audio conversion to generate audio, allowing you to dub the video or audio in English. This is especially useful for those who are weak in English or don’t have a strong voice.

Optional: Generate Audio from SRT If you want to generate audio from the .srt file while preserving timestamps, you can try:

This allows basic video dubbing.

🌐 Use Cases

  • 🎥 YouTubers → Auto-generate and translate subtitles.
  • 🧑‍🏫 Teachers → Create multilingual educational content.
  • 📱 Social Media Influencers → Dub videos for different audiences.
  • 🌏 Movie/Anime Fans → Watch content in different languages with subtitles or dubbing.

📜 License

This project is released under the MIT License free to use and modify.


About

A free and open-source tool that automatically generates subtitles from any audio or video file using Whisper . Supports multiple languages, word-level timestamps, and exports in SRT/TXT format for easy editing. Perfect for creators, educators, and anyone who wants accurate subtitles without paying for premium tools.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors