Demo of using Whisper for video transcriptions.
Follow set up instructions at https://github.com/openai/whisper.
- Install OpenAI Whisper:
pip install -U openai-whisper
- Install
ffmpeginto your environment:
sudo apt update && sudo apt install ffmpeg
- Run using
python3
python3 transcribe.py
import whisper
import os
model = whisper.load_model("turbo")
for file in os.listdir("data"):
if file.endswith((".mp4", ".mkv", ".mov", ".mp3", ".wav")):
path = os.path.join("data", file)
result = model.transcribe(path)
with open(path + ".srt", "w") as f:
f.write(result["text"])
Transcripts were generated for two samples: