This documentation page is also available as an interactive notebook. You can launch the notebook in
Kaggle or Colab, or download it for use with an IDE or local Jupyter installation, by clicking one of the
above links.
Convert speech to text locally using OpenAI’s open-source Whisper
model—no API key needed.
Problem
You have audio or video files that need transcription. Long files are
memory-intensive to process at once, so you need to split them into
manageable segments.
Solution
What’s in this recipe:
- Transcribe audio files locally with Whisper (no API key)
- Automatically segment long files
- Extract and transcribe audio from videos
You create a view with audio_splitter to break long files into
segments, then add a computed column for transcription. Whisper runs
locally on your machine—no API calls needed.
Setup
Load audio files
Connected to Pixeltable database at: postgresql+psycopg://postgres:@/pixeltable?host=/Users/asiegel/.pixeltable/pgdata
Converting metadata from version 45 to 46
Created directory ‘audio_demo’.
<pixeltable.catalog.dir.Dir at 0x169ab36a0>
Created table ‘files’.
Inserted 1 row with 0 errors in 1.05 s (0.95 rows/s)
1 row inserted.
Split into segments
Create a view that splits audio into 30-second segments with overlap:
Transcribe with Whisper
Add a computed column that transcribes each segment:
Added 2 column values with 0 errors in 3.35 s (0.60 rows/s)
2 rows updated.
Added 2 column values with 0 errors in 0.06 s (31.82 rows/s)
2 rows updated.
Explanation
Whisper models:
Models ending in .en are English-only and faster. Remove .en for
multilingual support.
audio_splitter parameters:
Exactly one of duration or max_size must be specified.
Tips:
Full API:
audio_splitter.
Video files work too:
When you insert a video file, Pixeltable automatically extracts the
audio track.
See also