CaptionAsset vs TextAsset
| Feature | TextAsset | CaptionAsset |
|---|---|---|
| Timeline Sync | No | Yes (word-level timestamps) |
| Data Source | Manual text input | Auto-generated from speech |
| Animation | Static only | reveal, karaoke, supersize, box_highlight |
| Format | Font/Border/Shadow objects | ASS (Advanced SubStation Alpha) |
CaptionAsset uses ASS format for subtitle rendering, which enables time-synchronized animations and professional subtitle styling.
Auto-Caption Generation
CaptionAsset can automatically generate subtitles from speech in your video. This means you don’t need to manually type out transcripts or time-stamp each word - the system listens to your audio and creates perfectly synchronized captions for you.
Required: Video Indexing
Before usingsrc="auto", you must index the video for spoken words:
Basic Usage
Animation Types
CaptionAsset supports six animation modes that make your subtitles more dynamic:
| Animation | Effect |
|---|---|
| reveal | Words appear one-by-one as they’re spoken |
| karaoke | Active word changes color (primary → secondary) while speaking |
| supersize | Active word scales up in size for emphasis |
| box_highlight | Active word is highlighted with a background box |
| impact | Only the active word appears on the screen |
| color_highlight | Active word highlights with a distinct color for emphasis |
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 channelGG= Green channelRR= Red channel
HTML to ASS Conversion
To convert HTML colors to ASS format:- HTML
#RRGGBB→ Extract RGB bytes - Reverse to BGR order
- Add prefix
&H00(opaque) or&HAA(with transparency)
#FF6600 (orange)
- RGB: Red=
FF, Green=66, Blue=00 - BGR:
00-66-FF - ASS:
&H000066FF
Common Colors
| HTML | ASS | Color |
|---|---|---|
#FFFFFF | &H00FFFFFF | White |
#000000 | &H00000000 | Black |
#FF0000 | &H000000FF | Red |
#FFFF00 | &H0000FFFF | Yellow |
#00FF00 | &H0000FF00 | Green |
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.
| Parameter | Type | Description |
|---|---|---|
| size | int | Font size in points (not pixels) |
| bold | bool | Bold weight (True) or normal (False) |
| italic | bool | Italic style |
| name | str | Font family name (must be available on server) |

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.
| Parameter | Type | Description |
|---|---|---|
| alignment | CaptionAlignment | Where on screen the captions appear (see alignment options below) |
| margin_v | int | Vertical margin in pixels from top or bottom edge |
| margin_l | int | Left margin in pixels from left edge |
| margin_r | int | Right margin in pixels from right edge |
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.
| Parameter | Type | Description |
|---|---|---|
| style | CaptionBorderStyle | How the border/background is rendered |
| outline | float | Outline width in pixels around each letter |
| shadow | float | Shadow depth in pixels for drop shadow effect |
| outline_color | str | Outline color in ASS format |
| shadow_color | str | Shadow color in ASS format |
CaptionBorderStyle Options:
CaptionBorderStyle.outline_and_shadow- Outline + drop shadowCaptionBorderStyle.opaque_box- Solid background box
Complete Example
From the notebook, here’s a completeCaptionAsset with all styling parameters:
Parameter Reference
| Parameter | Type | Description |
|---|---|---|
| src | str | Set to "auto" for auto-generation from speech or add manually in .srt or .ass format converted to base64 |
| animation | CaptionAnimation | Animation mode: reveal, karaoke, supersize, box_highlight, impact, color_highlight |
| primary_color | str | Main text color (ASS format: &H00BBGGRR) |
| secondary_color | str | Highlight color for animations (ASS format) |
| position | Positioning | Spatial placement and margins |
| font | FontStyling | Typography settings |
| border_and_shadow | BorderAndShadow | Outline and shadow styling |
Next Steps
Caption Asset & Auto Subtitles
Hands-on experimentation with styling options, animations, and color formatting.