packages/docs/docs/lambda/renderstillonlambda.mdx
Renders a still image inside a lambda function and writes it to the specified output location.
If you want to render a video or audio instead, use renderMediaOnLambda() instead.
If you want to render a still locally instead, use renderStill() instead.
// @module: esnext
// @target: es2017
import {renderStillOnLambda} from '@remotion/lambda/client';
const {estimatedPrice, url, sizeInBytes} = await renderStillOnLambda({
region: 'us-east-1',
functionName: 'remotion-render-bds9aab',
serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
composition: 'MyVideo',
inputProps: {},
imageFormat: 'png',
maxRetries: 1,
privacy: 'public',
envVariables: {},
frame: 10,
});
:::note
Preferrably import this function from @remotion/lambda/client to avoid problems inside serverless functions.
:::
An object with the following properties:
regionIn which region your Lambda function is deployed. It's highly recommended that your Remotion site is also in the same region.
functionNameThe name of the deployed Lambda function.
Use deployFunction() to create a new function and getFunctions() to obtain currently deployed Lambdas.
serveUrlA URL pointing to a Remotion project. Use deploySite() to deploy a Remotion project.
compositionThe id of the composition you want to render..
inputPropsInput 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().
privacyOne of:
"public" (default): The rendered still is publicly accessible under the S3 URL."private": The rendered still 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 using outName.frame?Which frame of the composition should be rendered. Default: 0. Frames are zero-indexed.
From v3.2.27, negative values are allowed, with -1 being the last frame.
imageFormat?See renderStill() -> imageFormat. Default: "png".
pdf is not supported on Remotion Lambda due to function size constraints.
onInit?<AvailableFrom v="4.0.6" />A callback function that gets called when the render starts, useful to obtain the link to the logs even if the render fails.
It receives an object with the following properties:
renderId: The ID of the render.cloudWatchLogs: A link to the CloudWatch logs of the Lambda function, if you did not disable it.lambdaInsightsUrl<AvailableFrom v="4.0.61" />: A link to the Lambda insights, if you enabled it.Example usage:
// @module: esnext
// @target: es2022
import {renderStillOnLambda, RenderStillOnLambdaInput} from '@remotion/lambda/client';
const otherParameters: RenderStillOnLambdaInput = {
region: 'us-east-1',
functionName: 'remotion-render-bds9aab',
serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
composition: 'MyVideo',
inputProps: {},
imageFormat: 'png',
maxRetries: 1,
privacy: 'public',
envVariables: {},
frame: 10,
};
await renderStillOnLambda({
...otherParameters,
onInit: ({cloudWatchLogs, renderId, lambdaInsightsUrl}) => {
console.log(console.log(`Render invoked with ID = ${renderId}`));
console.log(`CloudWatch logs (if enabled): ${cloudWatchLogs}`);
console.log(`Lambda Insights (if enabled): ${lambdaInsightsUrl}`);
},
});
jpegQuality?Sets the quality of the generated JPEG images. Must be an integer between 0 and 100. Default is to leave it up to the browser, current default is 80.
Only applies if imageFormat is "jpeg", otherwise this option is invalid.
quality?Renamed to jpegQuality in v4.0.0.
maxRetries?How often a frame render may be retried until it fails. Default: 1.
:::note A retry only gets executed if a the error is in the list of flaky errors. :::
envVariables?See renderStill() -> envVariables. Default: {}.
forceHeight?<AvailableFrom v="3.2.40" />Overrides the default composition height.
forceWidth?<AvailableFrom v="3.2.40" />Overrides the default composition width.
forceFps?<AvailableFrom v="4.0.424" />Overrides the default composition FPS.
forceDurationInFrames?<AvailableFrom v="4.0.424" />Overrides the default composition duration in frames.
scale?outName?It can either be:
undefined - it will default to out plus the appropriate file extension, for example: renders/${renderId}/out.mp4.string - it will get saved to the same S3 bucket as your site under the key renders/{renderId}/{outName}. Make sure to include the file extension at the end of the string.timeoutInMilliseconds?A number describing how long the render may take to resolve all delayRender() calls before it times out. Default: 30000
downloadBehavior?<AvailableFrom v="3.1.5" />How the output file should behave when accessed through the S3 output link in the browser.
Either:
{"type": "play-in-browser"} - the default. The video will play in the browser.{"type": "download", fileName: null} or {"type": "download", fileName: "download.mp4"} - a Content-Disposition header will be added which makes the browser download the file. You can optionally override the filename.mediaCacheSizeInBytes?<AvailableFrom v="4.0.352"/>offthreadVideoCacheSizeInBytes?<AvailableFrom v="4.0.23"/>offthreadVideoThreads?<AvailableFrom v="4.0.261"/>deleteAfter?<AvailableFrom v="4.0.32"/>chromiumOptions?Allows you to set certain Chromium / Google Chrome flags. See: Chromium flags.
disableWebSecurityboolean - default false
This will most notably disable CORS among other security features.
ignoreCertificateErrorsboolean - default false
Results in invalid SSL certificates, such as self-signed ones, being ignored.
gluserAgent<AvailableFrom v="3.3.83"/>Lets you set a custom user agent that the headless Chrome browser assumes.
darkMode?<AvailableFrom v="4.0.381"/>forceBucketName?Specify a specific bucket name to be used. This is not recommended, instead let Remotion discover the right bucket automatically.
logLevel?Logs can be read through the CloudWatch URL that this function returns.
forcePathStyle?<AvailableFrom v="4.0.202" />Passes forcePathStyle to the AWS S3 client. If you don't know what this is, you probably don't need it.
storageClass?<AvailableFrom v="4.0.305"/>An identifier for the S3 storage class of the rendered media. Default: undefined (which is STANDARD).
licenseKey?<AvailableFrom v="4.0.409"/>isProduction?<AvailableFrom v="4.0.409"/>default true
dumpBrowserLogs?Deprecated in v4.0 in favor of logLevel.
Returns a promise resolving to an object with the following properties:
bucketNameThe S3 bucket in which the video was saved.
urlAn AWS S3 URL where the output is available.
outKey<AvailableFrom v="4.0.141" />The S3 key where the output is saved.
estimatedPriceObject containing roughly estimated information about how expensive this operation was.
sizeInBytesThe size of the output image in bytes.
renderIdA unique alphanumeric identifier for this render. Useful for obtaining status and finding the relevant files in the S3 bucket.
cloudWatchLogs<AvailableFrom v="3.2.10" />A link to CloudWatch (if you haven't disabled it) that you can visit to see the logs for the render.
artifacts<AvailableFrom v="4.0.176"/>Artifacts that were created so far during the render. See here for an example of dealing with field.