Skip to content

This Group of Script Help you Generate SRT Script with Timestamp and also Translate into Multiple Language and in the End it will Create Mp4 File as a output to test the SRT output and Mp3 output.

Notifications You must be signed in to change notification settings

yogendra-singh-rathore/youtube_SRT_AI

Repository files navigation


YouTube SRT AI

YouTube SRT Generator, Translation and Compilation

By- Yogendra Singh Rathore

This project automates the generation and translation of SRT (SubRip Subtitle) files using Assembly AI, followed by translating these subtitles into multiple languages. Finally, it compiles the translated SRT files into MP3 and MP4 formats to ensure they match the timeline of the original video.

Updates Table

Update Status Version
Web App v3.0 Done V3.0
Docker App Done m3evil/flsk-srt-genai:3.0

Features

  • Generate Mp3 To Subtitle
  • Edit Subtitals with Demo Video (Create Demo MP4 with Generated Subtitles )
  • Translate Subtitles in Multiple Languages
  • Download Fonts as per Languages
  • Download Files
  • Manage All of Your YouTube Videos and Keep up-to-date YouTube videos Data (in YouTube Manager)

Prerequisites

  • Python 3.11.4
  • Assembly AI API key
  • Required Python packages (can be installed via requirements.txt)

Installation Python File

File Structure

  • srtAi.py: Script to generate SRT files in Hindi using Assembly AI.
  • translate.py: Script to translate Hindi SRT files into English and other languages.
  • srt_mp3.py: Script to compile translated SRT files into MP3 and generate MP4 for timeline verification.
  1. Clone the repository:

    git clone [email protected]:yogendra-singh-rathore/youtube_SRT_AI.git
    cd youtube_SRT_AI
  2. Install the required packages:

    pip install -r requirements.txt
  3. Set up your Assembly AI API key in the main.py:

    aai.settings.api_key = "API KEY"

Usage

Generating and Translating SRT Files

  1. CLI Generate SRT in Hindi:

    Run the srtAi.py script to generate SRT files in Hindi using Assembly AI.

    python srtAi.py

    Assembly AI supports various languages. For a complete list of supported languages and their corresponding language codes, refer to the Assembly AI Supported Languages documentation.

  2. CLI Translate SRT Files:

    Use the translate.py script to translate the Hindi SRT files into English and then into other languages (German, Chinese, Japanese, etc.).

    python translate.py

Compiling SRT to MP3 and MP4

  1. CLI Compile SRT to MP3:

    Run the srt_mp3.py script to compile the translated SRT files into MP3.

    python srt_mp3.py
  2. CLI Generate MP4 with SRT:

    The srt_mp3.py script also generates an MP4 file to check if the SRT matches the timeline of the original video.

    python srt_mp3.py

Install Flask Web Application (GUI)

Home Image

SRT Generator Image

Editor Image

Manager Image

Translate Image

Download Image

  1. Run App: Easy To Use
    python main.py

Install Docker Image

Pull Docker Image

  docker pull m3evil/flsk-srt-genai:3.0

Create a New Folder In the Local Machine

  mkdir youtubeManager

Copy Files From Docker to the Local Machine

  docker container run -d --name temp-container m3evil/flsk-srt-genai:3.0
  docker cp temp-container:app/output/. "./output"
  docker container stop temp-container
  docker container rm temp-container 

Run Web App And Store Data in the Local Machine

  docker container run -d -p 3000:3000 -v ".\output:/output" m3evil/flsk-srt-genai:3.0

Dependencies

The following versions are required:

  • assemblyai==0.28.1
  • deep-translator==1.11.4
  • moviepy==1.0.3
  • pysrt==1.1.2

License

This project is licensed under the MIT License.

Acknowledgments

  • Thanks to Assembly AI for providing the transcription service.
  • Me (Yogendra Singh Rathore)

About

This Group of Script Help you Generate SRT Script with Timestamp and also Translate into Multiple Language and in the End it will Create Mp4 File as a output to test the SRT output and Mp3 output.

Resources

Stars

Watchers

Forks

Packages

No packages published