renderMediaOnLambda()
Kicks off a render process on Remotion Lambda. The progress can be tracked using getRenderProgress().
Requires a function to already be deployed to execute the render.
A site or a Serve URL needs to be specified to determine what will be rendered.
Example
tsx
import {renderMediaOnLambda } from "@remotion/lambda/client";const {bucketName ,renderId } = awaitrenderMediaOnLambda ({region : "us-east-1",functionName : "remotion-render-bds9aab",composition : "MyVideo",serveUrl :"https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",codec : "h264",});
tsx
import {renderMediaOnLambda } from "@remotion/lambda/client";const {bucketName ,renderId } = awaitrenderMediaOnLambda ({region : "us-east-1",functionName : "remotion-render-bds9aab",composition : "MyVideo",serveUrl :"https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",codec : "h264",});
Preferrably import this function from @remotion/lambda/client
to avoid problems inside serverless functions.
Arguments
An object with the following properties:
region
In which region your Lambda function is deployed. It's highly recommended that your Remotion site is also in the same region.
privacy
optional since v3.2.27
One of:
"public"
(default): The rendered media is publicly accessible under the S3 URL."private"
: The rendered media is not publicly available, but signed links can be created using presignUrl()."no-acl"
(available from v.3.1.7): The ACL option is not being set at all, this option is useful if you are writing to another bucket that does not support ACL usingoutName
.
functionName
The name of the deployed Lambda function.
Use deployFunction()
to create a new function and getFunctions()
to obtain currently deployed Lambdas.
framesPerLambda?
optional
The video rendering process gets distributed across multiple Lambda functions. This setting controls how many frames are rendered per Lambda invocation. The lower the number you pass, the more Lambdas get spawned.
Default value: Dependant on video length
Minimum value: 4
The framesPerLambda
parameter cannot result in more than 200 functions being spawned. See: Concurrency
frameRange?
number | [number, number] - optional
Specify a single frame (passing a number
) or a range of frames (passing a tuple [number, number]
) to render a subset of a video. Example: [0, 9]
to select the first 10 frames. By passing null
(default) all frames of a composition get rendered. To render a still, use renderStillOnLambda()
.
serveUrl
A URL pointing to a Remotion project. Use deploySite()
to deploy a Remotion project.
composition
The id
of the composition you want to render.
inputProps
optional since v3.2.27
Input Props to pass to the selected composition of your video..
Must be a JSON object.
From the root component the props can be read using getInputProps()
.
You may transform input props using calculateMetadata()
.
codec
Which codec should be used to encode the video.
Video codecs h264
, and vp8
are supported, prores
is supported since v3.2.0
. h265
support has been added in v4.0.32
.
Audio codecs mp3
, aac
and wav
are also supported.
The option h264-mkv
has been renamed to just h264
since v3.3.34
. Use h264
to get the same behavior.
See also renderMedia() -> codec
.
audioCodec?
optional "pcm-16" | "aac" | "mp3" | "opus", available from v3.3.41
Choose the encoding of your audio.
- Each Lambda chunk might actually choose an uncompressed codec and convert it in the final encoding stage to prevent audio artifacts.
- The default is dependent on the chosen
codec
. - Choose
pcm-16
if you need uncompressed audio. - Not all video containers support all audio codecs.
- This option takes precedence if the
codec
option also specifies an audio codec.
Refer to the Encoding guide to see defaults and supported combinations.
forceHeight?
optional, available from v3.2.40
Overrides default composition height.
forceWidth?
optional, available from v3.2.40
Overrides default composition width.
muted?
optional
Disables audio output. See also renderMedia() -> muted
.
imageFormat
optional since v3.2.27
See renderMedia() -> imageFormat
.