Skip to main content
Version: Next 🚧

Preview, rendering, and export

The render entry point​

render(import.meta.url, MyScene, {
output: "./output/scene.mp4",
fps: 60,
progress: true,
});

import.meta.url identifies the source entry so Veena can bundle it for Chromium.

Preview​

Run a scene with --preview:

npx tsx scene.ts --preview

Preview opens a real-time window and does not encode video. It uses the same virtual timeline but intentionally skips authored screenshot and GIF output.

MP4​

An .mp4 output captures every frame at the effective FPS and streams it to FFmpeg. The scene's FPS is used unless the render options override it.

MP4/H.264 remains Veena's normal video format. An opaque render never switches to WebM implicitly.

Transparent WebM​

render(import.meta.url, OverlayScene, {
output: "./output/overlay.webm",
transparent: true,
});

Transparent video is encoded as WebM with VP9 alpha. WebM is available only when transparent: true; a normal .webm export is rejected. Likewise, transparent .mp4 output is rejected because Veena's standard H.264 MP4 path has no alpha channel.

When no output path is supplied, transparent: true changes the default extension from .mp4 to .webm. From the CLI, use veena render scene.ts --transparent, or supply -o output/overlay.webm explicitly.

PNG and transparency​

render(import.meta.url, LogoScene, {
output: "./output/logo.png",
at: 1.5,
transparent: true,
});

PNG export samples exactly one scene time. The same transparent flag removes the authored scene background for still images.

veena.json and environment variables​

{
"render": {
"outputDir": "./output",
"fps": 60,
"progress": true,
"transparent": false
}
}

Supported overrides include VEENA_OUTPUT, VEENA_OUTPUT_DIR, VEENA_FPS, VEENA_PROGRESS, VEENA_TRANSPARENT, VEENA_AT, and VEENA_AUDIO. Explicit render() options take precedence.

Progress​

Set progress: false for quiet CI, or pass onProgress(completed, total) to integrate a custom reporter.