Skip to content
Apexify.jsDocs
Apexify.js version v5.4.5

Node / Video Ffmpeg · guide

Text overlays on video

Current Apexify.js 6.0.0 documentation for Text overlays on video.

apexify.jsRuntime: nodeCURRENTSince 6.0.0

Burn captions and titles onto video on a timeline. Apexify offers two tiers:

APIStylingWhen to use
addTextOverlay (recommended)Full TextProperties — same as createTextProduct UI, brand type, gradients, glow, wrap, curved text
addText / addAnimatedText (legacy)FFmpeg drawtext onlyQuick 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:

  1. Renders each overlay with the canvas text engine (identical styling path to painter.createText).
  2. Composites transparent PNGs over the video with FFmpeg overlay.
  3. 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, …):

FieldRequiredEffect
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):

KeyFFmpeg role
x, yPosition expressions (t = seconds).
alphaLayer opacity 0–1.
scaleLayer 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

SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './talk.mp4',  addTextOverlay: {    outputPath: './talk-captioned.mp4',    overlays: [      {        text: 'Key takeaway',        x: 64,        y: 900,        startTime: 4,        endTime: 12,        font: { size: 40, family: 'Arial' },        decorations: { bold: true },        fill: { color: '#ffffff' },        effects: {          shadow: {            color: 'rgba(0,0,0,0.55)',            offsetX: 0,            offsetY: 4,            blur: 14,          },        },        layout: { maxWidth: 920 },        transitionIn: { type: 'slideLeft', duration: 0.35 },        transitionOut: { type: 'fade', duration: 0.25 },      },    ],  },});

Example — gradient + two lines same window

SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './promo.mp4',  addTextOverlay: {    outputPath: './promo-titled.mp4',    overlays: [      {        text: 'NEW',        x: 48,        y: 120,        startTime: 0.5,        endTime: 5,        font: { size: 28, family: 'Arial' },        fill: { color: '#fbbf24' },      },      {        text: 'Summer drop',        x: 48,        y: 170,        startTime: 0.5,        endTime: 5,        font: { size: 56, family: 'Arial' },        decorations: { bold: true },        fill: {          gradient: {            type: 'linear',            colors: [              { stop: 0, color: '#ffffff' },              { stop: 1, color: '#e2e8f0' },            ],          },        },        transitionIn: { type: 'fade', duration: 0.4 },      },    ],  },});

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.

FieldDefaultEffect
text✓Caption string.
positionbottom-centerNamed anchors only — not free x,y.
fontSize, fontColor, backgroundColorbasicFFmpeg styling.
startTime, endTimealways onVisibility window.
SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './demo.mp4',  addText: {    text: 'DRAFT',    position: 'top-right',    fontSize: 20,    startTime: 0,    endTime: 999,    outputPath: './demo-draft.mp4',  },});

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.


Choose an API (summary)

SOURCEtypescript
typescript
Studio
// ✅ Editor / brand / multi-captionawait painter.videoPipeline(src).text([...]).render({ outputPath }); // ✅ Single-pass captions on existing fileawait painter.createVideo({ source: src, addTextOverlay: { overlays: [...], outputPath } }); // ⚠️ Legacy simple burned text onlyawait painter.createVideo({ source: src, addText: { ... } });

Next steps