Skip to content

Deployment — Server-Side Render Pipeline

wity-scene provides a single public Lambda entry point (witySceneRender) that accepts a scene XML document and returns a rendered output URL. Internally it inspects the scene and routes to the appropriate specialized Lambda — callers never need to know about the internal pipeline.

For the full API reference of the gateway, see witySceneRender.


Public entry point — witySceneRender

caller → witySceneRender (gateway)
              │ outputFormat?
              ├─ "mp4"  → witySceneToVideo? → witySceneCompose? → final URL
              ├─ "pdf"  → witySceneToPdf  → S3 URL
              └─ "pptx" → witySceneToPptx → S3 URL

Input

json
{
  "sceneXml":      "<wity-scene>...</wity-scene>",
  "outputFormat":  "mp4",
  "options": {
    "fps":          30,
    "sceneWidth":   1920,
    "sceneHeight":  1080,
    "fontManifest": { "Inter": "https://cdn.example.com/Inter.ttf" }
  }
}

outputFormat defaults to "mp4". Supported values: "mp4", "pdf", "pptx".

PDF-specific options:

OptionTypeDefaultDescription
options.tsnumber0Scene time (seconds) to snapshot
options.timestampsnumber[]One page per timestamp (overrides ts)
options.variant"standard" | "print""standard"Screen (96 DPI) or high-res (300 DPI)
options.dpinumber96 / 300Override render DPI

PPTX-specific options:

OptionTypeDefaultDescription
options.tsnumber0Scene time (seconds) to snapshot
options.timestampsnumber[]One slide per timestamp (overrides ts)

Response

json
{ "url": "https://...", "fileSize": 9876543, "pipeline": ["witySceneToVideo", "witySceneCompose"] }

For "pdf": response also includes "pages": number. For "pptx": response also includes "slides": number.

pipeline lists which downstream Lambdas were invoked — useful for observability and cost attribution.

Lambda config

SettingValue
Function namewitySceneRender
Memory512 MB
Timeout660 s (11 min — accommodates two sequential 300 s downstream calls for mp4)
Ephemeral storage512 MB
RuntimeNode.js 20
No FFmpeg layer neededThis Lambda only parses and routes — no media processing

Environment variables

VariableDefaultDescription
SCENE_TO_VIDEO_FUNCTIONwitySceneToVideoGraphics compiler Lambda
SCENE_COMPOSE_FUNCTIONwitySceneComposeFull compositor Lambda
SCENE_TO_PDF_FUNCTIONwitySceneToPdfPDF renderer Lambda
SCENE_TO_PPTX_FUNCTIONwitySceneToPptxPPTX renderer Lambda

IAM note: The execution role must have lambda:InvokeFunction permission on all downstream Lambdas.


Routing logic

Routing is determined by outputFormat:

outputFormat: "mp4" (default)

The gateway additionally inspects element tags to pick the minimal pipeline:

Scene contentRoute
Only ws-rect / ws-text / ws-imagewitySceneToVideo only
Graphics + ws-video / ws-audiowitySceneToVideowitySceneCompose
Only ws-video / ws-audiowitySceneCompose only (graphicsMp4Url: null)

outputFormat: "pdf" or "pptx"

Single downstream Lambda call. No content inspection — all element types are accepted; ws-video and ws-audio are silently skipped in the snapshot renderer (graphics only).

All routing is entirely internal. The caller provides sceneXml + outputFormat and receives a URL.


Adding a new output format

The gateway uses a PIPELINE_REGISTRY keyed by outputFormat. To add a new format:

  1. Deploy a specialized Lambda.
  2. Add one entry to PIPELINE_REGISTRY in handler.js.
  3. Add the env var to the gateway config.

No changes to any existing Lambda.


Downstream Lambdas (internal)

These are internal infrastructure. Callers must not invoke them directly — use witySceneRender.

witySceneToVideo — graphics compiler

Renders ws-rect, ws-text, ws-image → PNG frame sequence → silent MP4.

Package: @wity/scene-to-video

SettingValue
Memory3008 MB · Timeout 300 s · Ephemeral 4096 MB
FFmpeg layerarn:aws:lambda:ap-south-1:175033217214:layer:ffmpeg:1

Input: { sceneXml, fontManifest?, fps? }{ url, fileSize }

witySceneCompose — full compositor

Blends ws-video + ws-audio + optional graphics overlay via FFmpeg filter_complex.

Package: @wity/scene-compose

SettingValue
Memory2048 MB · Timeout 300 s · Ephemeral 4096 MB
FFmpeg layerarn:aws:lambda:ap-south-1:175033217214:layer:ffmpeg:1

Input: { sceneXml, graphicsMp4Url?, fps?, sceneWidth?, sceneHeight? }{ url, fileSize }

witySceneToPdf — PDF renderer

Snapshots scene at one or more timestamps via node-canvas → pdf-lib → PDF.

Package: @wity/scene-to-pdf

SettingValue
Memory2048 MB · Timeout 120 s · Ephemeral 1024 MB
No FFmpeg layer needed

Input: { sceneXml, fontManifest?, ts?, timestamps?, variant?, dpi? }{ url, fileSize, pages }

witySceneToPptx — PPTX renderer

Snapshots scene at one or more timestamps via node-canvas → pptxgenjs → PowerPoint.

Package: @wity/scene-to-pptx

SettingValue
Memory1024 MB · Timeout 120 s · Ephemeral 1024 MB
No FFmpeg layer needed

Input: { sceneXml, fontManifest?, ts?, timestamps? }{ url, fileSize, slides }


Analysis services (separate from rendering)

Analysis services are standalone Lambdas — they are not routed through witySceneRender.

wityAudioProfile — audio loudness analysis

Downloads all ws-video and ws-audio media, decodes audio via FFmpeg, measures windowed RMS loudness per element, and returns per-element + power-mixed loudness profiles in dBFS.

Not an output format — callers invoke this Lambda directly.

See the wityAudioProfile reference for full input/output documentation.

SettingValue
Memory1024 MB · Timeout 120 s · Ephemeral 2048 MB
FFmpeg layerarn:aws:lambda:ap-south-1:175033217214:layer:ffmpeg:1

Input: { sceneXml, options?: { windowMs?, sampleRate? } }AudioProfileResult


S3 bucket setup

All downstream Lambdas write to wity-user-generated-content under separate prefixes:

LambdaPrefix
witySceneToVideoscene-compiled/
witySceneComposescene-composed/
witySceneToPdfscene-pdf/
witySceneToPptxscene-pptx/

The gateway Lambda does not write to S3 — it only orchestrates.