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)
- GPU acceleration for faster transcription (CUDA and Apple Silicon MPS support)
- Beautiful progress bars and interactive experience
- Simple command-line interface
- Minimal dependencies
Installation
Setup Environment
-
Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install the package:
# Installation from PyPI (includes GPU support by default) pip install nakplae
For developers:
# Clone the repository git clone https://github.com/elimydlarz/nakplae.git cd nakplae # Install in development mode pip install -e ".[dev]"
Prerequisites
-
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
- On macOS:
-
For local LLM translation (optional):
- Install llama.cpp and ensure
llamais in your PATH
- Install llama.cpp and ensure
-
For Gemini translation:
- Set
GEMINI_API_KEYenvironment variable with your API key:export GEMINI_API_KEY=your_api_key_here
- Uses the Gemini 2.0 Flash model for translations
- Set
Usage
After installation, you can use the nakplae command directly:
# Basic usage (translates to Thai by default)
nakplae video_file.mp4
# Translate to a different language
nakplae video_file.mp4 --lang "Spanish"
# Only transcribe, don't translate
nakplae video_file.mp4 --transcribe-only
# Specify output directory
nakplae video_file.mp4 --lang "French" --output /path/to/output
If you installed in development mode, you can also run:
python -m nakplae video_file.mp4 --lang "Spanish"
The program will automatically use GPU acceleration if available (CUDA on NVIDIA GPUs or MPS on Apple Silicon).
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nakplae-0.4.0.tar.gz.
File metadata
- Download URL: nakplae-0.4.0.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a0c6adbeb366f92537b8f811317cdd84240706168ac251bf2a7c0af2e23f6a4
|
|
| MD5 |
3ef6092a1c1c222e124d065f7d4b75af
|
|
| BLAKE2b-256 |
90cabf8b954b62f196e1a7293f54972828ebb3af2f2b66bb327ef01f2dfde394
|
File details
Details for the file nakplae-0.4.0-py3-none-any.whl.
File metadata
- Download URL: nakplae-0.4.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
008c32986fd637764933797fcd67cc7f2201e320535bd29c518aa32df53010fa
|
|
| MD5 |
054adc4e628f2293a951f408cc4374b3
|
|
| BLAKE2b-256 |
2685142f20360c2be45509b453703ec6036ee61a67941fad84a606ff95bcf1a2
|