Skip to main content

音声ファイルをテキストに変換するCLIツール

Project description

Transcriber Tool

音声ファイル(WAV, MP3など)をテキストに変換するPython製のCLIツールです。

特徴

  • 複数の音声・動画形式に対応(MP3, MP4, WAV, MOV, AVI)
  • faster-whisperを使用した高速な文字起こし(CPU)
  • openai-whisperによるGPUアクセラレーション対応
  • 複数のモデルサイズに対応(tiny, base, small, medium, large)
  • 言語指定オプション(--language)で誤検出を防止
  • 進捗表示オプション(--verbose)で長時間処理の状況を確認
  • シンプルで使いやすいコマンドラインインターフェース

インストール

前提条件

  • Python 3.11以上
  • uv(Pythonパッケージマネージャー)

インストール手順

uv tool install transcriber_tool

もしくは以下のようにuvxコマンドを使えばそのまま実行可能

uvx transcriber_tool
or
uv tool run transcriber_tool

GPU対応(オプション)

NVIDIA GPU環境でCUDAアクセラレーションを使う場合:

uv tool install "transcriber_tool[gpu]"

PyTorchのCUDA対応版が必要な場合は、--extra-index-url を指定してインストールしてください:

uv tool install "transcriber_tool[gpu]" --extra-index-url https://download.pytorch.org/whl/cu130

使い方

基本的な使い方

# 基本的な文字起こし(GPUがあれば自動で使用)
transcriber_tool transcribe audio.mp3

# 出力先を指定
transcriber_tool transcribe audio.mp3 --output result.txt

# モデルサイズを指定
transcriber_tool transcribe audio.mp3 --model-size medium

# 出力ディレクトリを指定
transcriber_tool transcribe audio.mp3 --output-dir ./results

デバイス指定

# 自動選択(デフォルト: GPUがあればGPU、なければCPU)
transcriber_tool transcribe audio.mp3 --device auto

# CPU強制
transcriber_tool transcribe audio.mp3 --device cpu

# GPU強制
transcriber_tool transcribe audio.mp3 --device cuda

タイムスタンプ付き出力

# タイムスタンプ付きテキスト
transcriber_tool transcribe audio.mp3 --timestamps

# TSV形式(タイムスタンプ分析用)
transcriber_tool transcribe audio.mp3 --format tsv

# SRT字幕形式
transcriber_tool transcribe audio.mp3 --format srt

# VTT字幕形式
transcriber_tool transcribe audio.mp3 --format vtt

言語指定(推奨)

言語を明示的に指定することで、誤検出を防止できます。特に日本語音声では --language ja を推奨します。

# 日本語音声
transcriber_tool transcribe audio.mp3 --language ja

# 英語音声
transcriber_tool transcribe audio.mp3 --language en

注意: 言語を指定しない場合、自動検出が行われますが、短い音声や特殊な音声では誤検出(例: ウェールズ語と判定)が発生し、処理がハングする場合があります。

進捗表示

--verbose オプションで、文字起こし中のセグメント単位の進捗を表示できます(openai-whisperバックエンド時)。

transcriber_tool transcribe audio.mp3 --verbose --language ja

コマンドラインオプション

transcribe [OPTIONS] FILE_PATH

  音声ファイルを文字起こしする

Options:
  -o, --output PATH         出力先のファイルパス(指定がない場合は自動生成)
  -m, --model-size [tiny|base|small|medium|large]
                            使用するモデルサイズ (デフォルト: base)
  -d, --output-dir PATH     出力ディレクトリ(指定がない場合はカレントディレクトリの下に
                            outputディレクトリを作成)
  -f, --format [txt|srt|vtt|tsv]
                            出力形式 (デフォルト: txt)
  -t, --timestamps          タイムスタンプを含める(txt形式の場合のみ有効)
  -v, --verbose             進捗ログを表示する
  -l, --language TEXT       言語コード(例: ja, en)。日本語は --language ja を推奨
  --device [cpu|cuda|auto]  使用するデバイス (デフォルト: auto)
  --help                    ヘルプメッセージを表示

バックエンド

--device cuda または auto 指定時、環境に応じてバックエンドを自動選択します:

  1. ctranslate2がCUDA対応 → faster-whisper (GPU)(x86_64環境)
  2. ctranslate2がCPU版のみ → openai-whisper / PyTorch (GPU) にフォールバック(aarch64環境等)
  3. GPU未検出 → faster-whisper (CPU)
デバイス 動作
cpu faster-whisper (CPU) を使用
cuda GPU利用。バックエンドは環境に応じて自動選択
auto (デフォルト) GPUがあればcuda、なければcpu

モデルサイズと性能

モデルサイズ メモリ使用量 処理速度 精度
tiny 最速
base 速い
small
medium 遅い
large 最高 最遅 最高

開発者向け

PyPIへの公開

新しいバージョンをリリースする際は、以下の手順で公開します。

  1. pyproject.toml のバージョンを更新
  2. ビルドして公開
# ビルド
uv build

# PyPIに公開(トークンが必要)
uv publish --token <YOUR_PYPI_TOKEN>

uvxで最新バージョンを使う

既にインストール済みの環境で最新バージョンを使うには:

# 方法1: ツールを再インストール
uv tool install transcriber_tool --force

# 方法2: @latestを指定して実行
uvx transcriber_tool@latest --version

ライセンス

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

transcriber_tool-0.3.1.tar.gz (128.0 kB view details)

Uploaded Source

Built Distribution

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

transcriber_tool-0.3.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file transcriber_tool-0.3.1.tar.gz.

File metadata

  • Download URL: transcriber_tool-0.3.1.tar.gz
  • Upload date:
  • Size: 128.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for transcriber_tool-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e83f57071f4f902f80603147a4b599bc9c07f087c9b6673dc0e5b12b93ee83ab
MD5 0a883eb371a0d4322a20d8187dd28472
BLAKE2b-256 0dd0455812a327bad50d236bfa71e59c8bf561376a678564aa86c623800f182e

See more details on using hashes here.

File details

Details for the file transcriber_tool-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for transcriber_tool-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3de10c4a45cf0e7c14cd5c93c59571c7510c510b46cbfa0cbb8536f239414b86
MD5 9c58f9150175d9386d1bf120684a8000
BLAKE2b-256 f00666c53dbcca85aa036dd0d6dcc4c10e961bd1736e49d89770a13ff72cd604

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