VideoFlowcodeGitHubTry itCoreRenderersReact Video EditorPlaygroundExamplesDocscodeGitHubTry it
Getting started
InstallationQuick startCore conceptsYour first video
Builder
Builder APITime formatsParallel & wait
Layers
TextImageVideoAudioCaptionsShapeGroups
Animation
Animate & keyframesEasing functionsTransitionsEffects
Renderers
Browser rendererServer rendererDOM preview
React Video Editor
QuickstartThemingUploadsCustom panelsHooks & commandsKeyboard shortcuts
API reference
Overview@videoflow/core@videoflow/renderer-browser@videoflow/renderer-server@videoflow/renderer-dom@videoflow/react-video-editor
API reference

@videoflow/renderer-server

Render VideoJSON to an MP4 file or buffer from Node using Playwright + ffmpeg.

Classes

class

ServerRenderer

Methods

constructor
(videoJSON: VideoJSON): ServerRenderer
Parameters
NameTypeDescription
videoJSONVideoJSON
Returns
ServerRenderer
cleanup
(): Promise<void>

Release all resources: browser context, temporary files, and shared browser.

Returns
Promise<void>
listLayerTypes
(): string[]

Every external layer type registered on this instance.

Returns
string[]
registerLayerType
(type: string, descriptor: ServerLayerTypeModuleDescriptor): void

Register (or replace) an external layer type for this render. ```ts const renderer = new ServerRenderer(videoJSON); renderer.registerLayerType('custom', { modulePath: '/absolute/path/to/custom-layer-type.js', exportName: 'default', }); await renderer.renderVideo(options); ``` `modulePath` must be an **absolute** local filesystem path to a browser-compatible module exporting a `{ runtime, propertiesDefinition }` descriptor. The module is bundled into the renderer page script and registered on the in-page `BrowserRenderer` before its first frame — runtime classes are functions and cannot be passed through `page.evaluate` or Playwright's structured serialization, so bundling is the only way across the realm boundary. Lifecycle: register after construction and **before** `renderVideo()` / `renderFrame()` / `renderAudio()`, i.e. before the headless page is opened. Registering afterwards throws.

Parameters
NameTypeDescription
typestring
descriptorServerLayerTypeModuleDescriptor
renderAudio
(): Promise<Buffer<ArrayBufferLike> | null>

Render the full audio track and return it as a WAV Buffer. Opens the headless page on first call, then renders all audio layers into a single WAV buffer via the in-page BrowserRenderer.

Returns
Promise<Buffer<ArrayBufferLike> | null>
renderFrame
(frame: number): Promise<Buffer<ArrayBufferLike>>

Render a single frame and return it as a JPEG screenshot Buffer. Opens the headless page on first call, then renders the requested frame via the in-page BrowserRenderer.

Parameters
NameTypeDescription
framenumberThe frame number to render.
Returns
Promise<Buffer<ArrayBufferLike>>
renderVideo
(options: ServerRenderOptions): Promise<string | Buffer<ArrayBufferLike>>

Render the loaded project. Picks the encoding pipeline based on `options.ffmpeg`; defaults to the in-browser export path. This is the primary entry point when using external layer types — register them on the instance first, then call this: ```ts const renderer = new ServerRenderer(videoJSON); renderer.registerLayerType('custom', { modulePath: '/abs/path/custom.js' }); const out = await renderer.renderVideo({ outputType: 'file', output: './out.mp4' }); await renderer.cleanup(); ``` Callers own cleanup — call cleanup when done (the static render helper does this for you).

Parameters
NameTypeDescription
optionsServerRenderOptions
Returns
Promise<string | Buffer<ArrayBufferLike>>
render
(videoJSON: VideoJSON, options: ServerRenderOptions): Promise<string | Buffer<ArrayBufferLike>>

Render a VideoJSON to a Buffer or file. Convenience wrapper over the instance API. External layer types can be passed as `options.layerTypes` (each entry is forwarded to registerLayerType); for anything more involved, construct a `ServerRenderer` and drive it directly.

Parameters
NameTypeDescription
videoJSONVideoJSONThe compiled video JSON.
optionsServerRenderOptionsRendering options (outputType, output path, signal, layerTypes).
Returns
Promise<string | Buffer<ArrayBufferLike>>

Functions

function

closeSharedBrowser

(): Promise<void>

Close the shared browser instance. Call this when the server is shutting down to release resources.

Returns
Promise<void>

On this page

ClassesFunctions
VideoFlow

Open-source toolkit for composing videos from code.

Product

CoreRenderersReact Video EditorPlayground

Learn

DocsAPI referenceExamplesvs. Remotionvs. FFmpeg

Project

GitHubLicenseContactTermsPrivacy

From the blog

All posts →The 50-Line YouTube Shorts Factory: Programmatic Video with VideoFlowMastering Motion: How to Animate Effect Parameters in VideoFlowMastering Flow: How to Use $.wait, $.parallel, and $.group in VideoFlowParallel vs Sequential: Mastering the VideoFlow Timing ModelOne JSON, Three Renderers: Mastering the VideoFlow LifecycleGenerating Multi-Language Video at Scale: The Localization PlaybookBrowser-Side Video Export: Zero-Server Rendering with WebCodecsHow to Build a Dynamic Video Editor in React in 10 Minutes
© 2026 VideoFlow. Apache-2.0 core.