Skip to main content

Video transcription and translation tool using Whisper and Gemini

Project description

Nakplae

A simple, elegant tool for transcribing videos to SRT subtitles and translating them with minimal dependencies.

Features

  • Transcribe video files to SRT subtitles using Whisper locally (small.en model)
  • Translate SRT subtitles using Google's Gemini 2.0 Flash model
  • Supports translation to any language (defaults to Thai)
  • Simple command-line interface
  • Minimal dependencies

Installation

Setup Environment

  1. Create a virtual environment:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  2. Install the package:

    # Basic installation
    pip install -e .
    
    # With all development tools
    pip install -e ".[dev,gemini]"
    
    # Or from requirements files
    pip install -r requirements.txt
    pip install -r requirements-dev.txt  # For development
    

Prerequisites

  1. Ensure you have FFmpeg installed (required by Whisper)

    • On macOS: brew install ffmpeg
    • On Ubuntu: sudo apt install ffmpeg
    • On Windows: Download from the official website or use chocolatey
  2. For local LLM translation (optional):

    • Install llama.cpp and ensure llama is in your PATH
  3. For Gemini translation:

    • Set GEMINI_API_KEY environment variable with your API key:
      export GEMINI_API_KEY=your_api_key_here
      
    • Uses the Gemini 2.0 Flash model for translations

Usage

# Basic usage (translates to Thai by default)
python -m nakplae video_file.mp4

# Translate to a different language
python -m nakplae video_file.mp4 --lang "Spanish"

# Only transcribe, don't translate
python -m nakplae video_file.mp4 --transcribe-only

# Specify output directory
python -m nakplae video_file.mp4 --lang "French" --output /path/to/output

Development

# Run tests
pytest

# Format code
black .

# Run linter
ruff check .

# Run type checker
mypy nakplae

Project Structure

nakplae/
├── nakplae/
│   ├── __init__.py
│   ├── __main__.py
│   ├── transcribe.py
│   └── translate.py
├── tests/
├── pyproject.toml
├── requirements.txt
└── requirements-dev.txt

License

MIT

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

nakplae-0.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

nakplae-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file nakplae-0.1.0.tar.gz.

File metadata

  • Download URL: nakplae-0.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for nakplae-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c536c9316d40a3533fa412f6ef109da8efa0101c66d9ab0c24b268eae56fd264
MD5 239799968130dd312ea704f4d56d9288
BLAKE2b-256 7595cc2d7241251cd9bb9413c75d600e0488d105e9abaaf07a5541e9aa62e1f6

See more details on using hashes here.

File details

Details for the file nakplae-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nakplae-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for nakplae-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7dd53ca8aa4148ede6584594cf3bafa3378c2d9c85dd6d7f2a1951495bdedfbe
MD5 44daf1a84da57924efcdd83eafa2ce56
BLAKE2b-256 d51e207e297db88c29b70ad39a7a75ebbc00e04c520dd8eb47253db4009260ca

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