Add text overlays to videos

Burn text, captions, or watermarks directly into video files.

Video · Notebook · Updated

Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.

How it works

Use video.overlay_text() to burn text into videos with full control over styling and position, and video.crop() to extract a rectangular region.

What it covers

  • Add simple text overlays
  • Create styled captions with backgrounds
  • Position text with alignment options
  • Crop a rectangular region from a video

What it uses

Install
terminal
pip install pixeltable
Pixeltable calls
pxt.create_table()insert()add_computed_column()

A look at the code

video-add-text-overlay.ipynb
# Add a simple watermark in the corner
videos.add_computed_column(
watermarked=videos.video.overlay_text(
'My Brand',
font_size=24,
color='white',
opacity=0.7,
horizontal_align='right',
horizontal_margin=20,
vertical_align='top',
vertical_margin=20,
)
)

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103