How do I convert audio into subtitles with Whisper?
Asked on Sep 25, 2025
Answer
Whisper is an open-source AI model developed by OpenAI for automatic speech recognition (ASR), which can be used to convert audio into text subtitles. To use Whisper for generating subtitles, you'll typically run the model on your audio file to produce a text transcript.
<!-- BEGIN COPY / PASTE -->
import whisper
model = whisper.load_model("base")
result = model.transcribe("audio_file.mp3")
print(result["text"])
<!-- END COPY / PASTE -->Additional Comment:
- Ensure you have the Whisper library installed in your Python environment.
- The "base" model is a good starting point, but Whisper offers larger models for more accuracy.
- The output "text" can be formatted into subtitles using tools that convert plain text to SRT or VTT formats.
- Consider using additional libraries to handle subtitle formatting if needed.
Recommended Links: