πŸ€– AI/ML

Whisper

OpenAI Whisper

OpenAI's speech recognition model. Multilingual support, open source. Widely used for translation and subtitle generation.

πŸ“– Detailed Explanation

Whisper is an automatic speech recognition (ASR) model released by OpenAI in September 2022. Trained on 680,000 hours of multilingual speech data collected from the internet, it recognizes 99 languages, including English, and can translate several languages, including Korean, into English. It is released as open source under the MIT license, so anyone can use it for free.

Before Whisper, speech recognition required a separate model for each language and was vulnerable to accents, background noise, and technical terminology. Whisper operates robustly even in diverse acoustic environments thanks to large-scale Weakly Supervised Learning. It is widely used for podcasts, YouTube subtitles, meeting minutes generation, interpretation assistance, and more.

Technically, Whisper is an encoder-decoder Transformer architecture. It splits audio into 30-second chunks, converts them into 80-channel mel spectrograms, and feeds them into the encoder. The decoder predicts the next token together with the previously generated text, and supports various tasks such as language detection, timestamp generation, and translation.

In practice, Whisper is used in two ways: local execution (GPU/CPU) and the OpenAI API. Local execution is free but requires a GPU, while the API is convenient but billed per minute. Faster-Whisper (based on CTranslate2) is 4 times faster than the original and uses only half the memory, so it is often chosen in practice.

πŸ’» Code Example

# pip install openai-whisper (원본)
# pip install faster-whisper (μ΅œμ ν™” 버전, ꢌμž₯)

# === 방법 1: 원본 Whisper (둜컬) ===
import whisper

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

# μŒμ„± 파일 전사
result = model.transcribe("audio.mp3", language="ko")
print(result["text"])

# μ˜μ–΄λ‘œ λ²ˆμ—­
result_en = model.transcribe("audio.mp3", task="translate")
print(result_en["text"])

# νƒ€μž„μŠ€νƒ¬ν”„ 포함
for segment in result["segments"]:
    print(f"[{segment['start']:.2f}s - {segment['end']:.2f}s] {segment['text']}")


# === 방법 2: Faster-Whisper (4λ°° 빠름, ꢌμž₯) ===
from faster_whisper import WhisperModel

model = WhisperModel("large-v3", device="cuda", compute_type="float16")

segments, info = model.transcribe("audio.mp3", language="ko")

print(f"감지 μ–Έμ–΄: {info.language} (ν™•λ₯ : {info.language_probability:.2f})")

for segment in segments:
    print(f"[{segment.start:.2f}s -> {segment.end:.2f}s] {segment.text}")


# === 방법 3: OpenAI API ===
from openai import OpenAI

client = OpenAI(api_key="your-api-key")

# 전사 (Transcription)
audio_file = open("audio.mp3", "rb")
transcript = client.audio.transcriptions.create(
    model="whisper-1",
    file=audio_file,
    response_format="verbose_json",
    timestamp_granularities=["segment"]
)

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

# λ²ˆμ—­ (Translation to English)
translation = client.audio.translations.create(
    model="whisper-1",
    file=audio_file
)
print(translation.text)


# === 방법 4: 슀트리밍/μ‹€μ‹œκ°„ 전사 (RealtimeSTT) ===
# pip install RealtimeSTT
# from RealtimeSTT import AudioToTextRecorder
#
# recorder = AudioToTextRecorder(model="base")
#
# def process_text(text):
#     print(f"μΈμ‹λœ ν…μŠ€νŠΈ: {text}")
#
# recorder.text_callback = process_text
# recorder.start()

πŸ“Š Performance & Cost

OpenAI Whisper API pricing as of January 2025

Model Price Cost per hour Features
Whisper / GPT-4o Transcribe $0.006/min $0.36/hour Standard transcription
GPT-4o Transcribe + Diarization $0.006/min $0.36/hour Includes speaker diarization
GPT-4o Mini Transcribe $0.003/min $0.18/hour Low-cost option

Whisper model comparison by size

Model Parameter VRAM required Relative speed
tiny 39M ~1GB 32x
base 74M ~1GB 16x
small 244M ~2GB 6x
medium 769M ~5GB 2x
large-v3 1.55B ~10GB 1x

Cost comparison

  • API vs self-hosting break-even: self-hosting is more advantageous at 500 hours or more per month
  • $5 free credit for new accounts: about 833 minutes (Whisper) or 1,667 minutes (Mini) can be used
  • 75% cheaper than Google Speech-to-Text

πŸ—£οΈ Say It Like This in Practice

πŸ’¬ In a Meeting

"I think Whisper would be a good fit for automatically generating YouTube subtitles. If you run Faster-Whisper locally, you can use the large-v3 model without API costs, and its Korean recognition accuracy is quite high. With a GPU, real-time transcription is also possible."

πŸ’¬ In an Interview

"What are the advantages of Whisper?" - "Because it's open source, you can run it locally for free, and it supports 99 languages with a single model. It's especially robust to background noise and accents, so it works well in real-world environments. However, real-time streaming isn't supported out of the box, so separate handling is needed."

πŸ’¬ In a Technical Discussion

"If you use a Whisper + Diarization combination for a meeting minutes service, you can create subtitles separated by speaker. GPT-4o Transcribe with Diarization on the OpenAI API provides speaker diarization at no additional cost."

Take a mock interview on this topic β†’ WIA SOOM AI Interview Β· Start for free

⚠️ Common Mistakes & Cautions

❌
Relying on automatic language detection

For short audio under 30 seconds or mixed-language audio, language detection can be wrong. For Korean speech, explicitly specify language="ko". Incorrect language detection greatly degrades transcription quality.

❌
Out of memory with long audio

Whisper internally processes audio in 30-second chunks, but it loads the entire file into memory. For several hours of audio, split it into chunks for processing or use Faster-Whisper's batched inference.

βœ…
Using Faster-Whisper

Faster-Whisper is recommended for production. Optimized with CTranslate2, it is 4 times faster at the same accuracy and uses only half the memory. Using INT8 quantization makes it even lighter.

πŸ”— Related Terms

πŸ“š Learn More