Transcribe speech and identify speakers with WhisperX

Transcribe speech with WhisperX in Python, identify speakers, and search the transcript with word-level timestamps.

Audio · Recipe · Updated

How it works

You have recorded conversations and need a transcript with word timestamps and speaker labels. You want to find relevant speech and return to the point in the recording where it was said.

You use WhisperX to transcribe speech locally and align each word to a time and a speaker. pixeltable.functions.whisperx.transcribe() does that as a computed column on audio, or on audio taken from a video with extract_audio().

What it covers

  • Preview WhisperX transcription and save it for each clip
  • Extract word timestamps and speaker labels
  • Search speech segments with an embedding index

What it uses

Install
terminal
pip install pixeltable 'whisperx>=3.8' sentence-transformers
Environment variables it names
HF_TOKEN
Pixeltable calls
whisperx.transcribe()json.list_iterator()pxt.create_table()pxt.create_view()insert()add_computed_column()add_embedding_index()similarity()

A look at the code

whisperx-transcription.mdx
segments.add_embedding_index(
'text',
string_embed=sentence_transformer.using(model_id='all-MiniLM-L6-v2'),
)

One block of the recipe, copied as it is. The rest is on the docs page.

Browse all 103