Skip to main content

AI-powered SRT subtitle generator with Whisper and OpenAI translation

Project description

Integrated SRT Subtitle Generator

A tool that uses Whisper speech recognition and OpenAI GPT to generate Korean SRT subtitles.

โš ๏ธ Requirements (read first)

  • Python >= 3.10
  • OpenAI API key set to OPENAI_API_KEY
  • FFmpeg installed and available on PATH (for transcription/whisper features)
  • Optional: install extras for whisper/torch

FFmpeg installation (per OS)

  • Windows (one of)
    • Chocolatey: choco install ffmpeg
    • Scoop: scoop install ffmpeg
    • Winget: winget install --id=Gyan.FFmpeg -e
  • macOS: brew install ffmpeg
  • Ubuntu/Debian: sudo apt update && sudo apt install -y ffmpeg
  • Fedora: sudo dnf install -y ffmpeg
  • Arch: sudo pacman -S ffmpeg

Verify: ffmpeg -version should print version info.

๐Ÿš€ Features

  • Integrated workflow: Speech-to-text โ†’ Korean translation โ†’ SRT generation
  • Flexible execution: Run full process or individual steps
  • User-friendly GUI: Intuitive interface
  • Simplified structure: Minimal dependencies

๐Ÿ“ Project Structure

SRT_Generator/
โ”œโ”€โ”€ src/                           # Integrated GUI
โ”‚   โ”œโ”€โ”€ integrated_srt_generator.py
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ””โ”€โ”€ run_integrated.bat
โ”œโ”€โ”€ translator/                    # Translation tools
โ”‚   โ””โ”€โ”€ src/local_whisper_korean_subtitle_generator/
โ”‚       โ””โ”€โ”€ tools/
โ”‚           โ”œโ”€โ”€ korean_translation_tool.py
โ”‚           โ””โ”€โ”€ srt_formatter_tool.py
โ”œโ”€โ”€ input/                         # Input files
โ”œโ”€โ”€ output/                        # Output files
โ””โ”€โ”€ README.md

๐Ÿ› ๏ธ Installation and Run

Install from PyPI

pip install ch-srtgen

1. Run the integrated GUI (recommended)

cd src
run_integrated.bat

2. Run individual steps (from source)

# Transcription only
cd src
python integrated_srt_generator.py

# Translation only (when JSON file already exists)
cd src
python integrated_srt_generator.py

๐Ÿ“‹ Usage

Using the integrated GUI

  1. Settings

    • Select Whisper model (tiny ~ large-v3)
    • Select language (auto, ko, en, ja, etc.)
    • Enter OpenAI API key
  2. File selection

    • Input file: target video/audio file
    • Output folder: where to save result files
  3. Actions

    • Start full process: Transcription โ†’ Translation โ†’ SRT generation
    • Transcription only: Generate JSON file
    • Translation only: Convert existing JSON to Korean SRT

Workflow

  1. Transcription (Whisper)

    • Video/Audio โ†’ JSON (timestamp + text)
  2. Korean translation (OpenAI GPT)

    • English text โ†’ Korean translation
  3. SRT generation (Formatter)

    • Translated text โ†’ SRT subtitle file

๐Ÿ”ง Configuration

API key setup

Method 1: Environment file (.env) [recommended]

  1. Copy env.template to .env
  2. Put your real API key in .env:
    OPENAI_API_KEY=your_actual_api_key_here
    

Method 2: Enter via GUI

  • Enter the API key in the GUI after launching the app

Method 3: System environment variable

# Windows
set OPENAI_API_KEY=your_actual_api_key_here

# Linux/Mac
export OPENAI_API_KEY=your_actual_api_key_here

โš ๏ธ Security notes:

  • Never commit .env to Git
  • Do not hardcode API keys in code
  • Do not upload API keys to public repos

Model selection

  • tiny: Fastest, lower accuracy
  • base: Balanced (recommended)
  • small: Good accuracy
  • medium: Higher accuracy
  • large: Highest accuracy, slowest

๐Ÿ“ Output files

  • JSON file: filename.json (Whisper result)
  • SRT file: filename.srt (final subtitles)

๐Ÿ› Troubleshooting

Common issues

  1. FFmpeg error: Install FFmpeg
  2. API key error: Check OpenAI API key
  3. Out of memory: Use a smaller Whisper model

Logs

You can check detailed progress and errors in the GUI log panel.

๐Ÿ“„ License

This project is distributed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ch_srtgen-1.0.7.post1.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ch_srtgen-1.0.7.post1-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file ch_srtgen-1.0.7.post1.tar.gz.

File metadata

  • Download URL: ch_srtgen-1.0.7.post1.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ch_srtgen-1.0.7.post1.tar.gz
Algorithm Hash digest
SHA256 9f581a598deefcb2638a5fba05991d8ae11efd41587e6a6b68bf5fd3ebf94b53
MD5 c5d75a151cd86955f1746caaa3c4f2ec
BLAKE2b-256 57a91f01fd29f74117d1f5b6c05260376d60a261ebb24b5855d83d6092fbac3d

See more details on using hashes here.

File details

Details for the file ch_srtgen-1.0.7.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for ch_srtgen-1.0.7.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ed8c8dd70d637cfd62a3b86530cd6f3714531f46e90df0be9fb4995498131d4
MD5 b0ae5874671c40531dec37038602f181
BLAKE2b-256 a0fce6069bcc462835ba2f52f3cd18daee97d3f3e0663b2b6b0caa93e99e9d6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page