Node / Video Ffmpeg · guide
Text overlays on video
Current Apexify.js 6.0.0 documentation for Text overlays on video.
Burn captions and titles onto video on a timeline. Apexify offers two tiers:
| API | Styling | When to use |
|---|---|---|
addTextOverlay (recommended) | Full TextProperties — same as createText | Product UI, brand type, gradients, glow, wrap, curved text |
addText / addAnimatedText (legacy) | FFmpeg drawtext only | Quick labels; deprecated |
Pipeline: videoPipeline().text(...) uses the same overlay types as addTextOverlay — best when combined with trim/splice/audio (Advanced → Video pipeline).
addTextOverlay — createText on video
What it does:
- Renders each overlay with the canvas text engine (identical styling path to
painter.createText). - Composites transparent PNGs over the video with FFmpeg
overlay. - Applies enter/exit motion via filter expressions (
fade, slide, zoom, …).
When to use: Any time subtitle/caption look must match generated images, cards, or scenes.
Per-overlay fields
Besides normal TextProperties (text, x, y, font, fill, effects, decorations, layout, placement, stroke, textOnCurve, …):
| Field | Required | Effect |
|---|---|---|
startTime | ✓ | Seconds when overlay appears. |
endTime | ✓ | Seconds when overlay hides. |
transitionIn | — | Enter preset or custom expressions. |
transitionOut | — | Exit preset or custom expressions. |
overlayOpacity | — | Master 0–1 (default 1), multiplied with transition fades. |
Transitions
Presets: fade, fadeIn, fadeOut, slideLeft, slideRight, slideUp, slideDown, slideIn, slideOut, zoomIn, zoomOut, bounce.
transitionIn.custom / transitionOut.custom (advanced):
| Key | FFmpeg role |
|---|---|
x, y | Position expressions (t = seconds). |
alpha | Layer opacity 0–1. |
scale | Layer scale multiplier. |
typewriter is listed for forward compatibility; true per-glyph typing needs a frame pipeline — today it behaves like a timed fade unless you customize.
Multiple overlays at once
Pass several objects in overlays[]. Overlapping startTime–endTime windows are allowed — use different x / y. Later array entries stack above earlier ones.
Example — styled caption
Example — gradient + two lines same window
Note: addTextOverlay re-encodes video (H.264). Plan for CPU time on long 4K clips.
Legacy: addText (deprecated)
Uses FFmpeg drawtext only — preset positions, solid fontColor, boxed background. No gradients, glow, or wrap parity.
When (if ever): Tiny server without canvas text deps — prefer addTextOverlay in current releases.
| Field | Default | Effect |
|---|---|---|
text | ✓ | Caption string. |
position | bottom-center | Named anchors only — not free x,y. |
fontSize, fontColor, backgroundColor | basic | FFmpeg styling. |
startTime, endTime | always on | Visibility window. |
Legacy: addAnimatedText (deprecated)
drawtext with optional fade or slide expression motion. TypeScript lists many animation names; only fade and slide add motion filters today.
{ x, y } position is supported. fontPath fields are reserved (not wired).
Prefer addTextOverlay with transitionIn / transitionOut.