CLI tool to transcribe MP3 audio to SRT subtitles using OpenAI Whisper API
Project description
whisper-srt
MP3音声ファイルをOpenAI Whisper APIでSRT字幕形式に変換するCLIツール。
特徴
- OpenAI Whisper API (
whisper-1) による高精度な文字起こし - SRT形式での直接出力(変換不要)
- AI駆動開発用語の組み込み語彙でプロンプト認識精度を向上
- ローカルモデル不要で高速起動
料金
- $0.006/分(1時間あたり約50-60円)
- 新規OpenAIアカウントには無料クレジット付与あり
セットアップ
1. 仮想環境の作成
python -m venv venv
source venv/bin/activate # macOS/Linux
# venv\Scripts\activate # Windows
2. インストール
pip install -e ".[dev]" # 開発用
pip install -e . # 本番用
3. APIキーの設定
cp .env.example .env
# .env を編集して OPENAI_API_KEY を設定
.env ファイル:
OPENAI_API_KEY=sk-your-api-key-here
APIキーは OpenAI Platform で取得できます。
使い方
# 基本的な使い方(出力: input.srt)
python -m transcribe input.mp3
# 出力ファイルを指定
python -m transcribe input.mp3 -o output.srt
# 言語を指定(ISO-639-1コード)
python -m transcribe input.mp3 --language en
# 詳細ログを有効化
python -m transcribe input.mp3 -v
オプション
| オプション | 説明 | デフォルト |
|---|---|---|
-o, --output |
出力SRTファイルパス | {入力ファイル名}.srt |
--language |
言語コード(ISO-639-1) | ja |
-v, --verbose |
詳細ログ出力 | オフ |
組み込み語彙
以下のカテゴリのAI/技術用語が組み込まれており、認識精度を向上させます:
- AIサービス(Claude, ChatGPT, Gemini等)
- AIコーディングツール(Cursor, Windsurf, Cline等)
- MCP関連(Model Context Protocol, MCP Connector等)
- Claude Code機能(CLAUDE.md, サブエージェント, hooks等)
- 開発手法(DDD, Onion Architecture, AI駆動開発等)
開発
make help # ヘルプを表示
make ci # lint + type-check + test を実行
make test # テストを実行
make test-cov # カバレッジ付きでテストを実行
make lint # linterを実行
make format # コードをフォーマット
make type-check # 型チェックを実行
依存関係
- Python 3.9+
- openai
- python-dotenv
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
whisper_srt-0.2.0.tar.gz
(12.4 kB
view details)
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 whisper_srt-0.2.0.tar.gz.
File metadata
- Download URL: whisper_srt-0.2.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb01d54064b2ebdd7624124f4a454a12f31996b5c1e75d476cf7d15c2b807dd1
|
|
| MD5 |
9fa3271e27c5ae7ed725e392142155e5
|
|
| BLAKE2b-256 |
e0ca98985c6edbe77ef907e70541b089fdf9c8568651f73798a5e5a3226dc2ab
|
File details
Details for the file whisper_srt-0.2.0-py3-none-any.whl.
File metadata
- Download URL: whisper_srt-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
254195dd8c4cb4cd34a9355f63ad8078c81b93825d7605d786c1139ff4b169a0
|
|
| MD5 |
b909ff8930b12cd638b6040479adfee0
|
|
| BLAKE2b-256 |
0e278a20f6ec0ee2504d35d56c7cbda3420e15c4d372dc04a51e471136a005f3
|