$npx -y skills add AlexAI-MCP/hermes-CCC --skill whisperOpenAI Whisper for speech recognition and transcription — local inference, multiple model sizes, language detection, and subtitle generation.
| 1 | # Whisper |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Use this skill for local speech-to-text transcription and subtitle generation. |
| 6 | - Prefer it when privacy, offline processing, or batch audio workflows matter. |
| 7 | - Whisper works well for meetings, podcasts, interviews, voice notes, and extracted video audio. |
| 8 | - It supports multilingual transcription and language detection. |
| 9 | |
| 10 | ## Install |
| 11 | |
| 12 | - Standard Whisper package: |
| 13 | |
| 14 | ```bash |
| 15 | pip install openai-whisper |
| 16 | ``` |
| 17 | |
| 18 | - Faster inference alternative: |
| 19 | |
| 20 | ```bash |
| 21 | pip install faster-whisper |
| 22 | ``` |
| 23 | |
| 24 | - `faster-whisper` is often the better default for production batch jobs because it is typically faster at similar accuracy. |
| 25 | |
| 26 | ## Command Line Usage |
| 27 | |
| 28 | - Basic CLI transcription: |
| 29 | |
| 30 | ```bash |
| 31 | whisper audio.mp3 --model medium --language en |
| 32 | ``` |
| 33 | |
| 34 | - Use GPU explicitly: |
| 35 | |
| 36 | ```bash |
| 37 | whisper audio.mp3 --model medium --language en --device cuda |
| 38 | ``` |
| 39 | |
| 40 | - Generate subtitles in SRT format: |
| 41 | |
| 42 | ```bash |
| 43 | whisper audio.mp3 --model medium --language en --output_format srt |
| 44 | ``` |
| 45 | |
| 46 | - The CLI is a good fit for one-off transcription, shell scripts, and media preprocessing jobs. |
| 47 | |
| 48 | ## Python API |
| 49 | |
| 50 | ```python |
| 51 | import whisper |
| 52 | |
| 53 | model = whisper.load_model("medium") |
| 54 | result = model.transcribe("audio.mp3") |
| 55 | |
| 56 | print(result["text"]) |
| 57 | print(result["language"]) |
| 58 | print(result["segments"][:2]) |
| 59 | ``` |
| 60 | |
| 61 | - Standard load pattern: |
| 62 | - `import whisper` |
| 63 | - `model = whisper.load_model('medium')` |
| 64 | |
| 65 | ## What `transcribe()` Returns |
| 66 | |
| 67 | - `text`: the full transcript |
| 68 | - `segments`: timestamped segment-level outputs |
| 69 | - `language`: detected or selected language code |
| 70 | |
| 71 | - Example shape: |
| 72 | |
| 73 | ```python |
| 74 | { |
| 75 | "text": "Full transcript text", |
| 76 | "language": "en", |
| 77 | "segments": [ |
| 78 | {"id": 0, "start": 0.0, "end": 4.5, "text": "Hello everyone"}, |
| 79 | ], |
| 80 | } |
| 81 | ``` |
| 82 | |
| 83 | ## Model Sizes |
| 84 | |
| 85 | - `tiny` |
| 86 | - `base` |
| 87 | - `small` |
| 88 | - `medium` |
| 89 | - `large-v3` |
| 90 | |
| 91 | - The tradeoff is simple: |
| 92 | - smaller models are faster and cheaper |
| 93 | - larger models are slower but more accurate |
| 94 | |
| 95 | ## Model Selection Guidance |
| 96 | |
| 97 | - `tiny`: fast experiments and low-resource CPU runs |
| 98 | - `base`: simple automation on clean audio |
| 99 | - `small`: balanced for lightweight production tasks |
| 100 | - `medium`: common quality default for serious transcription |
| 101 | - `large-v3`: best accuracy when latency and VRAM are acceptable |
| 102 | |
| 103 | ## Language Selection |
| 104 | |
| 105 | - Set the language when you know it: |
| 106 | |
| 107 | ```bash |
| 108 | whisper audio.mp3 --model medium --language en |
| 109 | ``` |
| 110 | |
| 111 | - Explicit language hints usually improve speed and stability. |
| 112 | - If the language is unknown, let the model detect it. |
| 113 | |
| 114 | ## Language Detection |
| 115 | |
| 116 | - Whisper can estimate the spoken language from audio features. |
| 117 | - Example pattern: |
| 118 | |
| 119 | ```python |
| 120 | import whisper |
| 121 | |
| 122 | model = whisper.load_model("medium") |
| 123 | audio = whisper.load_audio("audio.mp3") |
| 124 | audio = whisper.pad_or_trim(audio) |
| 125 | mel = whisper.log_mel_spectrogram(audio).to(model.device) |
| 126 | |
| 127 | _, probs = model.detect_language(mel) |
| 128 | language = max(probs, key=probs.get) |
| 129 | print(language) |
| 130 | ``` |
| 131 | |
| 132 | - `model.detect_language(audio)` is the key workflow concept, though in practice you pass the processed spectrogram tensor. |
| 133 | |
| 134 | ## Subtitle Generation |
| 135 | |
| 136 | - Generate `.srt` subtitles from the CLI: |
| 137 | |
| 138 | ```bash |
| 139 | whisper audio.mp3 --model medium --language en --output_format srt |
| 140 | ``` |
| 141 | |
| 142 | - Subtitle outputs are useful for: |
| 143 | - video captions |
| 144 | - podcast transcripts |
| 145 | - lecture indexing |
| 146 | - searchable archives |
| 147 | |
| 148 | ## Batch Processing Multiple Files |
| 149 | |
| 150 | - Simple shell loop: |
| 151 | |
| 152 | ```bash |
| 153 | Get-ChildItem *.mp3 | ForEach-Object { |
| 154 | whisper $_.FullName --model medium --language en --output_format srt |
| 155 | } |
| 156 | ``` |
| 157 | |
| 158 | - Python batch example: |
| 159 | |
| 160 | ```python |
| 161 | from pathlib import Path |
| 162 | |
| 163 | import whisper |
| 164 | |
| 165 | model = whisper.load_model("medium") |
| 166 | |
| 167 | for path in Path("audio").glob("*.mp3"): |
| 168 | result = model.transcribe(str(path)) |
| 169 | out_path = path.with_suffix(".txt") |
| 170 | out_path.write_text(result["text"], encoding="utf-8") |
| 171 | ``` |
| 172 | |
| 173 | - Batch processing is a common pattern for meeting folders, call archives, and downloaded media collections. |
| 174 | |
| 175 | ## GPU vs CPU |
| 176 | |
| 177 | - GPU example from the CLI: |
| 178 | |
| 179 | ```bash |
| 180 | whisper audio.mp3 --model medium --device cuda |
| 181 | ``` |
| 182 | |
| 183 | - GPU is strongly preferred for: |
| 184 | - `medium` |
| 185 | - `large-v3` |
| 186 | - multi-file batch jobs |
| 187 | |
| 188 | - CPU is acceptable for: |
| 189 | - `tiny` |
| 190 | - `base` |
| 191 | - occasional short clips |
| 192 | |
| 193 | ## Common Use Cases |
| 194 | |
| 195 | - YouTube audio transcription after extracting audio from video |
| 196 | - meeting notes from Zoom or Teams recordings |
| 197 | - podcast transcription for search and republishing |
| 198 | - lecture indexing and subtitle generation |
| 199 | - multilingual voice note transcription |
| 200 | |
| 201 | ## `faster-whisper` |
| 202 | |
| 203 | - Install with: |
| 204 | |
| 205 | ```bash |
| 206 | pip install faster-whisper |
| 207 | ``` |
| 208 | |
| 209 | - It is often around 4x faster while maintaining comparable accuracy. |
| 210 | - It is a strong choice for MLOps pipelines where throughput matters. |
| 211 | |
| 212 | ## `faster-whisper` Example |
| 213 | |
| 214 | ```python |
| 215 | from faster_whisper import WhisperModel |
| 216 | |
| 217 | m |