Skip to main content

renderFramesOnLambdaAndStream()v4.0.542

Starts an image sequence render on AWS Lambda, streams progress, and waits for the render to finish. Requires a deployed function and site or Serve URL using the same Remotion version as the client.

render-sequence.ts
import {renderFramesOnLambdaAndStream} from '@remotion/lambda-client'; const result = await renderFramesOnLambdaAndStream({ region: 'eu-central-1', functionName: 'remotion-render-4-0-542-mem2048mb-disk2048mb-120sec', serveUrl: 'https://example.com/remotion/index.html', composition: 'MyComposition', imageFormat: 'png', frameRange: [0, 299], outputPrefix: 'exports/my-sequence/', onInit: ({renderId, bucketName}) => { console.log({renderId, bucketName}); }, onProgress: ({overallProgress}) => { console.log(`${Math.round(overallProgress * 100)}%`); }, }); console.log(result.outputSequence.manifestUrl);

Also exported from @remotion/lambda. To start an image sequence render without waiting, use renderFramesOnLambda(). For video or audio, use renderMediaOnLambdaAndStream().

Arguments​

Accepts the same render options as renderFramesOnLambda(), plus the callbacks below.

onInit?​

Called once with the startup metadata, including renderId, bucketName, and diagnostic links. Defaults to no callback. Save this identity to observe the render later with getRenderProgress().

onProgress?​

Called with the same progress object as getRenderProgress(). Defaults to no callback. Updates are coalesced; the callback does not run for every frame.

Both callbacks may return a promise and are awaited in order. Throwing or rejecting stops observation and rejects renderFramesOnLambdaAndStream(). It does not cancel the render.

Return value​

Resolves with the final progress object. done is true, and outputSequence is non-null and identifies the destination bucket, image prefix, manifest, image format, and frame count. The result also includes costs and artifacts.

outKey is null because the output contains multiple files.

The promise rejects if the render fails to start, or on a fatal render error, timeout, callback failure, or observation failure. A RenderFramesOnLambdaAndStreamError retains these diagnostic properties:

renderId​

The render ID, or null if startup metadata was not received.

bucketName​

The render bucket, or null if startup metadata was not received.

render​

The startup metadata, or null before initialization.

progress​

The last observed progress object, or null before progress was received. Its errors array includes render diagnostics.

cause​

The original observation or callback error, or the remote error stack when available.

Streaming and recovery​

Progress streams directly in standard AWS regions. In cn-north-1 and cn-northwest-1, the API starts asynchronously and polls for progress. If a stream breaks, stalls for 30 seconds, or ends before the render finishes, observation falls back to polling the same render. An ended stream alone does not indicate success.

If the connection closes before a render ID is received, the promise rejects. The render may still be running. The API never retries the start request automatically.

Progress continues to be saved in S3 during rendering, so getRenderProgress() remains available to independent observers. This API streams progress; it does not stream image bytes. Use downloadMedia() to download the output.

Disconnection and cancellation​

Closing the client or stopping observation leaves the render running. To cancel it, start with enableCancellation: true and call cancelRenderOnLambda().

The Lambda render CLI uses this lifecycle for media and image sequence renders. Ctrl+C stops waiting by default. With --enable-cancellation, Ctrl+C explicitly cancels the render.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​