Communitygithub.com

ComeOnOliver/skillshub

OpenAI Whisper を使用した音声文字起こしスキル。ローカルの Whisper (Python)、高速版 faster-whisper、CPU最適化版 whisper.cpp、OpenAI API を含みます。字幕生成 (SRT/VTT/JSON)、多言語対応、英語翻訳、話者分離、単語レベルのタイムスタンプ、ポッドキャスト・会議・動画字幕の本番パイプラインパターンに対応。

skillshub とは?

このスキルは、OpenAI Whisper の複数の実装(オリジナルの Python 版、最大4倍高速な faster-whisper、CPU 向けに最適化された whisper.cpp、OpenAI API)を統一的に扱うためのガイドです。音声ファイルから高精度な文字起こしを生成し、SRT・VTT・JSON 形式の字幕ファイル出力、多言語対応、英語への翻訳、話者分離(pyannote-audio 連携)、単語レベルのタイムスタンプなどの高度な機能を提供します。各ランタイムのセットアップ手順やモデル選択ガイド、バッチ処理パターン、本番パイプラインの実装例が含まれており、開発者は自身の環境や要件に最適な方式を選べます。特に CPU 環境では faster-whisper(INT8量子化)の推奨や、GPU 搭載環境では large-v3 モデルの使用など、実践的なアドバイスが豊富です。

対応~Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/TerminalSkills/skills/whisper

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Whisper

概要

OpenAI Whisper(最先端の音声認識モデル)を使用して音声を文字起こしします。このスキルは、ローカルの Whisper(Python)、faster-whisper(CTranslate2、4倍高速)、whisper.cpp(CPU最適化C++)、OpenAI Whisper API を網羅しています。字幕生成(SRT/VTT/JSON)、多言語文字起こし、英語への翻訳、話者分離、単語レベルのタイムスタンプ、そしてポッドキャスト、会議、動画字幕向けの本番パイプラインパターンを含みます。

使用方法

ステップ1:ランタイムを選ぶ

オプションA — OpenAI Whisper(オリジナルPython版):

pip install openai-whisper
# モデル: tiny (39M), base (74M), small (244M), medium (769M), large-v3 (1.5G)

オプションB — faster-whisper(ローカル推奨、4倍高速):

pip install faster-whisper
# CTranslate2使用 — INT8量子化、CPUでも良好に動作

オプションC — whisper.cpp(CPUに最適、最小依存):

git clone https://github.com/ggerganov/whisper.cpp
cd whisper.cpp && make
# モデルをダウンロード
bash models/download-ggml-model.sh base.en

オプションD — OpenAI API(ローカルGPU不要):

pip install openai
export OPENAI_API_KEY="sk-..."

ステップ2:基本的な文字起こし

faster-whisper(推奨):

from faster_whisper import WhisperModel

model = WhisperModel("base", device="cpu", compute_type="int8")
# GPUの場合: model = WhisperModel("large-v3", device="cuda", compute_type="float16")

segments, info = model.transcribe("episode.mp3", beam_size=5)
print(f"言語: {info.language} (確率: {info.language_probability:.2f})")

for segment in segments:
    print(f"[{segment.start:.2f}秒 → {segment.end:.2f}秒] {segment.text}")

OpenAI Whisper(オリジナル):

import whisper

model = whisper.load_model("base")  # tiny, base, small, medium, large-v3
result = model.transcribe("episode.mp3")

print(result["text"])
for segment in result["segments"]:
    print(f"[{segment['start']:.1f}秒 - {segment['end']:.1f}秒] {segment['text']}")

whisper.cpp(CLI):

./main -m models/ggml-base.en.bin -f episode.wav -otxt -osrt -ovtt
# 出力: episode.txt, episode.srt, episode.vtt

OpenAI API:

from openai import OpenAI
client = OpenAI()

with open("episode.mp3", "rb") as f:
    transcript = client.audio.transcriptions.create(
        model="whisper-1",
        file=f,
        response_format="verbose_json",
        timestamp_granularities=["segment", "word"],
    )

print(transcript.text)
for segment in transcript.segments:
    print(f"[{segment.start:.1f}秒] {segment.text}")

ステップ3:字幕生成(SRT/VTT)

faster-whisperでSRTを生成:

from faster_whisper import WhisperModel

model = WhisperModel("small", device="cpu", compute_type="int8")
segments, info = model.transcribe("episode.mp3", beam_size=5)

def format_timestamp(seconds):
    h = int(seconds // 3600)
    m = int((seconds % 3600) // 60)
    s = int(seconds % 60)
    ms = int((seconds % 1) * 1000)
    return f"{h:02d}:{m:02d}:{s:02d},{ms:03d}"

with open("episode.srt", "w") as f:
    for i, seg in enumerate(segments, 1):
        f.write(f"{i}\n")
        f.write(f"{format_timestamp(seg.start)} --> {format_timestamp(seg.end)}\n")
        f.write(f"{seg.text.strip()}\n\n")

print("episode.srt を生成しました")

VTTを生成(HTML5動画向け):

with open("episode.vtt", "w") as f:
    f.write("WEBVTT\n\n")
    for i, seg in enumerate(segments, 1):
        start = format_timestamp(seg.start).replace(",", ".")
        end = format_timestamp(seg.end).replace(",", ".")
        f.write(f"{start} --> {end}\n")
        f.write(f"{seg.text.strip()}\n\n")

単語レベルのタイムスタンプ(カラオケ風字幕向け):

segments, info = model.transcribe("episode.mp3", word_timestamps=True)
for segment in segments:
    for word in segment.words:
        print(f"  [{word.start:.2f}秒 → {word.end:.2f}秒] {word.word}")

ステップ4:言語検出と翻訳

# 自動言語検出
segments, info = model.transcribe("foreign_audio.mp3")
print(f"検出: {info.language} ({info.language_probability:.0%})")

# 特定の言語を強制
segments, info = model.transcribe("german.mp3", language="de")

# 英語に翻訳(任意の言語 → 英語)
segments, info = model.transcribe("german.mp3", task="translate")
for seg in segments:
    print(seg.text)  # 英語翻訳

対応言語: en, zh, de, es, ru, ko, fr, ja, pt, tr, pl, nl, ar, sv, it, hi など99言語。

ステップ5:話者分離

Whisperとpyannote-audioを組み合わせて「誰が話したか」を特定:

from faster_whisper import WhisperModel
from pyannote.audio import Pipeline
import torch

# 文字起こし
model = WhisperModel("small", device="cpu", compute_type="int8")
segments, info = model.transcribe("meeting.wav", beam_size=5)
whisper_segments = list(segments)

# 話者分離(pyannoteアクセス用のHuggingFaceトークンが必要)
diarization = Pipeline.from_pretrained(
    "pyannote/speaker-diarization-3.1",
    use_auth_token="hf_YOUR_TOKEN"
)
diarization_result = diarization("meeting.wav")

# 統合:各whisperセグメントに話者を割り当て
def get_speaker(start, end, diarization_result):
    """時間範囲内の支配的な話者を特定"""
    speakers = {}
    for turn, _, speaker in diarization_result.itertracks(yield_label=True):
        overlap_start = max(start, turn.start)
        overlap_end = min(end, turn.end)
        if overlap_start < overlap_end:
            duration = overlap_end - overlap_start
            speakers[speaker] = speakers.get(speaker, 0) + duration
    return max(speakers, key=speakers.get) if speakers else "不明"

for seg in whisper_segments:
    speaker = get_speaker(seg.start, seg.end, diarization_result)
    print(f"[{speaker}] [{seg.start:.1f}秒 → {seg.end:.1f}秒] {seg.text}")

ステップ6:バッチ処理とパイプライン

ディレクトリ内の全エピソードを文字起こし:

import os
from pathlib import Path
from faster_whisper import WhisperModel

model = WhisperModel("small", device="cpu", compute_type="int8")
episodes_dir = Path("episodes")
output_dir = Path("transcripts")
output_dir.mkdir(exist_ok=True)

for audio_file in sorted(episodes_dir.glob("*.mp3")):
    print(f"文字起こし中: {audio_file.name}")
    segments, info = model.transcribe(str(audio_file), beam_size=5)
    
    # プレーンテキスト
    txt_path = output_dir / f"{audio_file.stem}.txt"
    with open(txt_path, "w") as f:
        for seg in segments:
            f.write(seg.text.strip() + "\n")
    
    # SRT
    srt_path = output_dir / f"{audio_file.stem}.srt"
    segments2, _ = model.transcribe(str(audio_file), beam_size=5)  # 再イテレート
    with open(srt_path, "w") as f:
        for i, seg in enumerate(segments2, 1):
            h, m = divmod(int(seg.start), 3600)
            m, s = divmod(m, 60)
            ms = int((seg.start % 1) * 1000)
            start_ts = f"{h:02d}:{m:02d}:{s:02d},{ms:03d}"
            h2, m2 = divmod(int(seg.end), 3600)
            m2, s2 = divmod(m2, 60)
            ms2 = int((seg.end % 1) * 1000)
            end_ts = f"{h2:02d}:{m2:02d}:{s2:02d},{ms2:03d}"
            f.write(f"{i}\n{start_ts} --> {end_ts}\n{seg.text.strip()}\n\n")
    
    print(f"  → {txt_path}, {srt_path}")

ステップ7:モデル選択ガイド

モデルサイズVRAM速度 (CPU)精度最適用途
tiny39M~1GB非常に速い低いクイックドラフト、リアルタイム
base74M~1GB速い中程度CPUでのバランス良好
small244M~2GB普通良いポッドキャスト、明瞭な音声
medium769M~5GB遅い非常に良いノイズのある音声、アクセント
large-v31.5G~10GB非常に遅い最高プロダクション品質

推奨事項:

  • CPUのみ、速度重視:tiny または base(faster-whisper使用)
  • CPUのみ、精度重視:small(faster-whisper使用)
  • GPU利用可能:large-v3(faster-whisper、float16)
  • ローカル計算不要:OpenAI API(whisper-1)

使用例

例1:ポッドキャストシーズンの文字起こしとSRT字幕の生成

ユーザープロンプト: "./episodes/ 内の全20個のMP3エピソードを文字起こしし、プレーンテキストのトランスクリプトとSRT字幕ファイルの両方を生成してください。10GBのVRAMを搭載したGPUがあります。"

エージェントは:

  1. pip install faster-whisper でfaster-whisperをインストール。
  2. device="cuda" と compute_type="float16" で large-v3 モデルをロードし、GPUを活用。
  3. ./transcripts/ 出力ディレクトリを作成。
  4. ./episodes/ 内のすべての .mp3 ファイルをループ処理し、各ファイルを beam_size=5 で文字起こし。
  5. 各エピソードについて、.txt ファイル(プレーンテキスト)と .srt ファイル(適切なタイムスタンプ形式)の両方を書き出し。
  6. 検出された言語とエピソードごとの処理時間を報告。

例2:ドイツ語インタビューを英語に翻訳し、話者ラベルを付ける

ユーザープロンプト: 「45分のドイツ語インタビュー録音(meeting.wav)があります。2人の話者がいます。英語で文字起こしし、誰が何を言ったかをラベル付けしてください。」

エージェントは:

  1. faster-whisperとpyannote-audioをインストール(pip install faster-whisper pyannote.audio)。
  2. meeting.wav を task="translate" で文字起こしし、ドイツ語音声から英語テキストを取得。
  3. pyannoteの話者分離を実行し、話者セグメントを特定(pyannoteモデルアクセス用のHuggingFaceトークンが必要)。
  4. Whisperセグメントと話者分離結果を時間範囲でマッチングして話者ラベルを割り当て。
  5. 各セグメントの前に [Speaker 1] と [Speaker 2] ラベルが付いた整形済みトランスクリプトを出力。

ガイドライン

  • ローカルでの文字起こしには、オリジナルのOpenAI Whisperよりもfaster-whisperを使用してください。CTranslate2によるINT8量子化により、4倍高速でメモリ使用量も少なくなります。
  • ハードウェアに応じてモデルサイズを選択してください:CPU速度重視なら tiny/base、CPU精度重視なら small、GPUプロダクション品質なら large-v3。
  • MP3/M4A入力を扱う場合は、必ず音声をWAVに変換するか、ffmpegがインストールされていることを確認してください。Whisperは非WAVフォーマットのデコードにffmpegに依存しています。
  • 話者分離には、pyannoteパイプラインがHuggingFaceのアクセストークンとモデル利用規約への同意を必要とします。複数話者の文字起こしを試みる前に設定してください。
  • SRTファイルを生成する際は、beam_size=5 を使用してセグメント境界の精度を高めてください。デフォルトの貪欲(greedy)デコードでは、タイミングの悪い字幕区切りが生じる可能性があります。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

関連スキル