import pixeltable as pxt
from pixeltable.functions.huggingface import clip
from pixeltable.iterators import FrameIterator
import PIL.Image

video_table = pxt.create_table('videos', {'video': pxt.Video})

video_table.insert([{'video': '/video.mp4'}])

frames_view = pxt.create_view(
    'frames', video_table, iterator=FrameIterator.create(video=video_table.video))

# Create an index on the 'frame' column that allows text and image search
frames_view.add_embedding_index('frame', embed=clip.using('openai/clip-vit-base-patch32'))

# Now we will retrieve images based on a sample image
sample_image = '/image.jpeg'
sim = frames_view.frame.similarity(sample_image)
frames_view.order_by(sim, asc=False).limit(5).select(frames_view.frame, sim=sim).collect()

# Now we will retrieve images based on a string
sample_text = 'red truck'
sim = frames_view.frame.similarity(sample_text)
frames_view.order_by(sim, asc=False).limit(5).select(frames_view.frame, sim=sim).collect()

Use Pixeltable directly in Google Colab: Pixeltable Basics Tutorial.

Choose your preferred installation method below. We recommend using a virtual environment to avoid package conflicts.

System Requirements

Before installing, ensure your system meets these requirements:

  • Python 3.9 or higher
  • Linux, MacOs, or Windows
1

Create virtual environment

python -m venv venv

This creates an isolated Python environment for your Pixeltable installation.

2

Activate environment

venv\Scripts\activate
3

Install Pixeltable

pip install pixeltable

Notebooks

1

Install Jupyter

If not already installed:

pip install jupyter
2

Start Jupyter server

jupyter notebook
3

Create notebook

Select “Python 3 (ipykernel)” as the kernel via File / New / Notebook

4

Test installation

import pixeltable as pxt
pxt.init()

Wait a minute for Pixeltable to load. You should see a message once connected to the database.


Troubleshooting

Common installation issues and solutions:

Next Steps

Getting Help

import pixeltable as pxt
from pixeltable.functions.huggingface import clip
from pixeltable.iterators import FrameIterator
import PIL.Image

video_table = pxt.create_table('videos', {'video': pxt.Video})

video_table.insert([{'video': '/video.mp4'}])

frames_view = pxt.create_view(
    'frames', video_table, iterator=FrameIterator.create(video=video_table.video))

# Create an index on the 'frame' column that allows text and image search
frames_view.add_embedding_index('frame', embed=clip.using('openai/clip-vit-base-patch32'))

# Now we will retrieve images based on a sample image
sample_image = '/image.jpeg'
sim = frames_view.frame.similarity(sample_image)
frames_view.order_by(sim, asc=False).limit(5).select(frames_view.frame, sim=sim).collect()

# Now we will retrieve images based on a string
sample_text = 'red truck'
sim = frames_view.frame.similarity(sample_text)
frames_view.order_by(sim, asc=False).limit(5).select(frames_view.frame, sim=sim).collect()