Skip to main content
Open In Colab

CaptionAsset vs TextAsset

CaptionAsset uses ASS format for subtitle rendering, which enables time-synchronized animations and professional subtitle styling.

Timed Caption Assets

Create current caption assets from a base64-encoded SRT payload with the timings you want to render. The Track Layering guide shows how to build timed SRT from a spoken-words artifact.

Auto-Caption Compatibility

CaptionAsset(src="auto") and its index_spoken_words() prerequisite below are a current compatibility path. They do not make an Understand artifact alone a source for src="auto".

Compatibility Usage

Example: The caption clip duration should match or exceed the video duration to ensure all words display.
The animation examples below continue the src="auto" compatibility path. Use the timed SRT source above for current caption assets.

Animation Types

CaptionAsset supports six animation modes that make your subtitles more dynamic: Code Example
Example with CaptionAnimation.karaoke

ASS Color Format

ASS (Advanced SubStation Alpha) is a professional subtitle format that’s been used in video production for years. It uses BGR (Blue-Green-Red) byte order with an alpha channel - which is backwards from the RGB format you might be used to from web colors. This quirk exists for historical reasons in subtitle rendering systems.

Format Structure

&HAABBGGRR or &H00BBGGRR
  • AA = Alpha (00 = opaque, FF = transparent)
  • BB = Blue channel
  • GG = Green channel
  • RR = Red channel

HTML to ASS Conversion

To convert HTML colors to ASS format:
  1. HTML #RRGGBB → Extract RGB bytes
  2. Reverse to BGR order
  3. Add prefix &H00 (opaque) or &HAA (with transparency)
Example: HTML #FF6600 (orange)
  • RGB: Red=FF, Green=66, Blue=00
  • BGR: 00-66-FF
  • ASS: &H000066FF

Common Colors

Styling Parameters

CaptionAsset styling is organized into three parameter groups: FontStyling, Positioning, and BorderAndShadow.

FontStyling

Controls how your subtitle text looks - the font face, size, and whether it’s bold or italic. Think of this as the basic typography settings for making your captions readable and on-brand.
Chart showing all supported fonts for text and caption assets

Positioning

Controls where on the screen your captions appear and how much spacing you want from the edges. You can place captions at the bottom like traditional subtitles, or anywhere else on screen with precise margin control.
Example:

BorderAndShadow

Controls outlines and shadows that make your text readable over any background. These parameters are crucial because subtitles need to be legible whether they’re over bright skies, dark scenes, or complex imagery - borders and shadows ensure the text always stands out.
CaptionBorderStyle Options:
  • CaptionBorderStyle.outline_and_shadow - Outline + drop shadow
  • CaptionBorderStyle.opaque_box - Solid background box
Example:

Complete Example

From the notebook, here’s a complete CaptionAsset with all styling parameters:

Parameter Reference

Next Steps

Caption Asset & Auto Subtitles

Hands-on experimentation with styling options, animations, and color formatting.