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.
Twelve Labs provides multimodal embeddings that project text, images,
audio, and video into the same semantic space. This enables true
cross-modal search - the most powerful feature of this integration.
What makes this special? You can search a video index using any
modality:
This notebook demonstrates this cross-modal capability with video, then
shows how to apply the same embeddings to other modalities.
Prerequisites
Setup
Connected to Pixeltable database at: postgresql+psycopg://postgres:@/pixeltable?host=/Users/pjlb/.pixeltable/pgdata
Created directory ‘twelvelabs_demo’.
<pixeltable.catalog.dir.Dir at 0x138c2c150>
Cross-Modal Video Search
Let’s index a video and search it using text, images, audio, and other
videos - all against the same index.
Create Video Table and Index
Created table ‘videos’.
Inserted 1 row with 0 errors in 1.60 s (0.63 rows/s)
1 row inserted.
Let’s look at the index we just added in the table metadata:
The iterator created a larger table from our single video:
51
Text to Video Search
Find video segments matching a text description.
Image to Video Search
Find video segments similar to an image.
Video to Video Search
Find video segments similar to another video clip.
Audio to Video Search
Find video segments with similar audio/speech content.
Embedding Options
For video embeddings, you can focus on specific aspects:
'visual' - Focus on what you see
'audio' - Focus on what you hear
'transcription' - Focus on what is said
Added 51 column values with 0 errors in 19.81 s (2.57 rows/s)
Other Modalities: Text, Images, and Documents
Twelve Labs embeddings also work for text, images, and documents. Here’s
a compact example showing multiple embedding indexes on a single
table.
Created table ‘content’.
Added 0 column values with 0 errors in 0.01 s
Inserted 4 rows with 0 errors in 1.97 s (2.03 rows/s)
4 rows inserted.
We can see the two indexes we added in the schema:
Summary
Twelve Labs + Pixeltable enables:
- Cross-modal search: Query video with text, images, audio, or other
videos
- Multiple indexes per table: Add embedding indexes on different
columns
- Embedding options: Focus on visual, audio, or transcription
aspects
- All modalities: Text, images, audio, video, and documents
Learn More