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.
Turn a collection of images into an animated video with Ken Burns
effects, text overlays, logos, and background music — using a fully
declarative Pixeltable pipeline.
Problem
You have a set of images and want to produce a polished video — an ad, a
product reel, a social media clip. Typically this means a video editor
or a complex ffmpeg scripting pipeline.
Solution
What’s in this recipe:
Convert still images into animated video clips with pan effects
Control pan direction per image from table data (no Python loops)
Add per-image captions and a logo overlay
Concatenate all clips and add background music
The key insight: store per-clip metadata (caption text, pan direction,
logo) as table columns. One chained computed column expression
handles the entire pipeline, and Pixeltable evaluates it per row.
Setup
%pip install -qU pixeltable
Note: you may need to restart the kernel to use updated packages.
import pixeltable as pxtfrom pixeltable.functions.video import concat_videos_agg, with_audiopxt.drop_dir('slideshow_demo', force=True)pxt.create_dir('slideshow_demo')
Connected to Pixeltable database at: postgresql+psycopg://postgres:@/pixeltable?host=/Users/pjlb/.pixeltable/pgdata
Pixeltable dashboard available at: http://localhost:22089
Created directory ‘slideshow_demo’.
<pixeltable.catalog.dir.Dir at 0x13fca3ac0>
Step 1: Define the data
Each row is one clip in the final video. Per-clip variation comes from
table columns:
caption: text overlay for each clip
pan_sign: +1.0 for pan-right, -1.0 for pan-left
logo: image to overlay in the corner
This is what makes the pipeline fully declarative — no Python loops, no
conditional logic.
Inserted 5 rows with 0 errors in 1.04 s (4.81 rows/s)
5 rows inserted.
Step 2: Build the video pipeline
One computed column chains the entire transformation:
image → static video → resize → pan effect → resize → logo overlay → text overlay
pan() is a convenience wrapper around scroll() that computes
viewport size, start position, and speed automatically. It accepts
column expressions for per-row direction:
pan_sign = +1 → pans right
pan_sign = -1 → pans left
For lower-level control (custom speed, diagonal pans, asymmetric crops),
use scroll() directly.
The entire pipeline is declarative — per-clip variation comes from
data, not code:One computed column expression handles the full transformation chain.
Pixeltable evaluates it per row, pulling caption, logo, and pan
direction from each row’s data.
Alternative effects
Swap the pan for other built-in effects:
# Zoom instead of pant.add_computed_column(clip=t.base.zoom(start_scale=1.0, end_scale=1.3))# Fade-through-black transitions (add to each clip before concat)t.add_computed_column(clip=t.base.fade_in(duration=0.5).fade_out(duration=0.5))# Combine: pan + fadet.add_computed_column( clip=t.base.pan(x_sign=1) .resize(width=1280, height=720) .fade_in(duration=0.5) .fade_out(duration=0.5))
Audio
This recipe uses with_audio() to replace the soundtrack. To blend
a second audio track into a video that already has audio (e.g. add
background music under narration), use mix_audio():