Skip to main content

Customizing Lambda output destination

By default a render artifact is saved into the same S3 bucket as where the site is located under the key renders/${renderId}/out.{extension} (for example: renders/hy0k2siao8/out.mp4)

You can modify the output destination by passing a different filename, writing it into a different bucket or even upload it to a different S3-compatible provider.

Customizing the output name

To customize the output filename, pass outName: "my-filename.mp4" to renderMediaOnLambda() or renderStillOnLambda().

On the CLI, use the --out-name flag.

The output name must match /^([0-9a-zA-Z-!_.*'()/]+)$/g.

Customizing the output bucket

To render into a different bucket, specify the outName option to renderMediaOnLambda() or renderStillOnLambda() and pass an object with the key and bucketName values:

tsx
const { bucketName, renderId } = await renderMediaOnLambda({
region: "us-east-1",
functionName: "remotion-render-bds9aab",
composition: "MyVideo",
serveUrl:
"https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
inputProps: {},
codec: "h264",
imageFormat: "jpeg",
maxRetries: 1,
privacy: "public",
outName: {
key: "my-output",
bucketName: "output-bucket",
},
});
tsx
const { bucketName, renderId } = await renderMediaOnLambda({
region: "us-east-1",
functionName: "remotion-render-bds9aab",
composition: "MyVideo",
serveUrl:
"https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
inputProps: {},
codec: "h264",
imageFormat: "jpeg",
maxRetries: 1,
privacy: "public",
outName: {
key: "my-output",
bucketName: "output-bucket",
},
});

If you like to use this feature:

  • You must extend the default Remotion policy to allow read and write access to that bucket.
  • The bucket must be in the same region.
  • When calling APIs such as downloadMedia() or getRenderProgress(), you must pass the bucketName where the site resides in, not the bucket where the video gets saved.
  • The key must match /^([0-9a-zA-Z-!_.*'()/]+)$/g
  • The bucketName must match /^(?=^.{3,63}$)(?!^(\d+\.)+\d+$)(^(([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])$)/.

This feature is not supported from the CLI.

Saving to another cloud

Available from v3.2.23

You can upload the file to another S3-compatible provider.

  • List of supported providers (non-exhaustive): Cloudflare, DigitalOcean Spaces
  • List of unsupported providers (non-exhaustive): Azure Blob Storage (not S3 compatible)

You must pass an outName as specified above and also provide an s3OutputProvider like in the example below.

tsx
const { bucketName, renderId } = await renderMediaOnLambda({
region: "us-east-1",
functionName: "remotion-render-bds9aab",
composition: "MyVideo",
serveUrl:
"https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
inputProps: {},
codec: "h264",
imageFormat: "jpeg",
maxRetries: 1,
privacy: "no-acl",
outName: {
key: "my-output",
bucketName: "output-bucket",
s3OutputProvider: {
endpoint: "https://fra1.digitaloceanspaces.com",
accessKeyId: "<DIGITAL_OCEAN_ACCESS_KEY_ID>",
secretAccessKey: "<DIGITAL_OCEAN_SECRET_ACCESS_KEY>",
},
},
});
tsx
const { bucketName, renderId } = await renderMediaOnLambda({
region: "us-east-1",
functionName: "remotion-render-bds9aab",
composition: "MyVideo",
serveUrl:
"https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
inputProps: {},
codec: "h264",
imageFormat: "jpeg",
maxRetries: 1,
privacy: "no-acl",
outName: {
key: "my-output",
bucketName: "output-bucket",
s3OutputProvider: {
endpoint: "https://fra1.digitaloceanspaces.com",
accessKeyId: "<DIGITAL_OCEAN_ACCESS_KEY_ID>",
secretAccessKey: "<DIGITAL_OCEAN_SECRET_ACCESS_KEY>",
},
},
});

In this example, the output file will be uploaded to DigitalOcean Spaces. The cloud provider will give you the endpoint and credentials.

If you want to use this feature, note the following:

This feature is not supported from the CLI.

See also