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

๋น ๋ฅธ ์„ค์น˜ (๋ชจ๋“  ๊ธฐ๋Šฅ ํฌํ•จ)

๋ฐฉ๋ฒ• 1: pip install๋กœ ์„ค์น˜

# ๊ธฐ๋ณธ ์„ค์น˜ (whisper ํฌํ•จ)
pip install ch_srtgen

# ๋˜๋Š” ๊ฐœ๋ฐœ ๋ชจ๋“œ๋กœ ์„ค์น˜
pip install -e .

# ๊ฐœ๋ฐœ์šฉ ๋„๊ตฌ ํฌํ•จ
pip install -e .[dev]

๋ฐฉ๋ฒ• 1-1: Python ์Šคํฌ๋ฆฝํŠธ๋กœ ์ž๋™ ์„ค์น˜

python quick_install.py

๋ฐฉ๋ฒ• 2: ์„ค์น˜ ์Šคํฌ๋ฆฝํŠธ ์‚ฌ์šฉ

# Windows
install_all.bat

# Linux/macOS
./install_all.sh

Install from PyPI (์ž๋™ ์ข…์†์„ฑ ์„ค์น˜ ํฌํ•จ)

pip install ch-srtgen

๐ŸŽฏ ์„ค์น˜ ์™„๋ฃŒ ๋ฉ”์‹œ์ง€:

============================================================
๐ŸŽฏ SRT Generator ์„ค์น˜ ์™„๋ฃŒ!
============================================================

โœ… ๋ชจ๋“  ์ข…์†์„ฑ์ด ์„ค์น˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค!
๐ŸŽ‰ SRT Generator๋ฅผ ๋ฐ”๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“– ์‚ฌ์šฉ๋ฒ•:
  ch-srtgen-gui    # GUI ์‹คํ–‰
  ch-srtgen        # CLI ์‹คํ–‰

๐Ÿ“ ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ:
  input/     - ์ž…๋ ฅ ํŒŒ์ผ (๋น„๋””์˜ค/์˜ค๋””์˜ค)
  output/    - ์ถœ๋ ฅ ํŒŒ์ผ (SRT ์ž๋ง‰)

1. Run the integrated GUI (recommended)

ch-srtgen-gui

2. Run CLI

# Help
ch-srtgen --help

# Process video file
ch-srtgen input.mp4

๐Ÿ“‹ 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.9.tar.gz (22.3 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.9-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file ch_srtgen-1.0.9.tar.gz.

File metadata

  • Download URL: ch_srtgen-1.0.9.tar.gz
  • Upload date:
  • Size: 22.3 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.9.tar.gz
Algorithm Hash digest
SHA256 bd2057b9359d07dcd2e7496163a3f4d25e86d55471bb64f68470e01e8c3fe038
MD5 f02743f2f1a4ea2b7411b530bbf87a6a
BLAKE2b-256 2354806a2121a6f99cfbec834825c62c9a106962adee9f55d8d465855e2a67e2

See more details on using hashes here.

File details

Details for the file ch_srtgen-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: ch_srtgen-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ch_srtgen-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 780a77677ea9f99ed9f261a75acc84216aeb49cc582759e5c551e23129859572
MD5 d539e4383e8259e10d56548bcf066c2b
BLAKE2b-256 70be43f6ae954a8c73984ee353dc56f9c40657b34102408fcb4a570e7ea4a8e9

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