Skip to main content

renderStillOnCloudrun()

EXPERIMENTAL

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

Kicks off a still rendering process on Remotion Cloud Run.

Requires a service 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 { renderStillOnCloudrun } from "@remotion/cloudrun";
 
const result = await renderStillOnCloudrun({
region: "us-east1",
serviceName: "remotion-render-bds9aab",
composition: "MyStill",
imageFormat: "png",
serveUrl:
"https://storage.googleapis.com/remotioncloudrun-123asd321/sites/abcdefgh",
});
 
if (result.type === "success") {
console.log(result.bucketName);
console.log(result.renderId);
}
tsx
import { renderStillOnCloudrun } from "@remotion/cloudrun";
 
const result = await renderStillOnCloudrun({
region: "us-east1",
serviceName: "remotion-render-bds9aab",
composition: "MyStill",
imageFormat: "png",
serveUrl:
"https://storage.googleapis.com/remotioncloudrun-123asd321/sites/abcdefgh",
});
 
if (result.type === "success") {
console.log(result.bucketName);
console.log(result.renderId);
}

Arguments

An object with the following properties:

cloudRunUrl?

optional. Required if serviceName not supplied

The url of the Cloud Run service which should be used to perform the render. You must set either cloudRunUrl or serviceName, but not both

serviceName?

optional. Required if cloudRunUrl not supplied

The name of the Cloud Run service which should be used to perform the render. This is used in conjunction with the region to determine the service endpoint, as the same service name can exist across multiple regions.

region

In which GCP region your Cloud Run service is deployed. It's highly recommended that your Remotion site is also in the same region.

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

React props that are passed to your composition. You define the shape of the props that the component accepts.

privacy?

optional

One of:

  • "public" (default): The rendered still is publicly accessible under the Cloud Storage URL.
  • "private": The rendered still is not publicly available, but is available within the GCP project to those with the correct permissions.

forceBucketName?

optional

Specify a specific bucket name to be used for the output. The resulting Google Cloud Storage URL will be in the format gs://{bucket-name}/renders/{render-id}/{file-name}. If not set, Remotion will choose the right bucket to use based on the region.

jpegQuality?

optional

See renderStill() -> jpegQuality.

imageFormat?

optional

See renderStill() -> imageFormat.

scale?

optional

Scales the output dimensions by a factor. See Scaling to learn more about this feature.

envVariables?

optional

See renderStill() -> envVariables.

frame?

optional

Which frame of the composition should be rendered. Frames are zero-indexed, and negative values are allowed, with -1 being the last frame.

chromiumOptions?

optional

Allows you to set certain Chromium / Google Chrome flags. See: Chromium flags.

disableWebSecurity

boolean - default false

This will most notably disable CORS among other security features.

ignoreCertificateErrors

boolean - default false

Results in invalid SSL certificates, such as self-signed ones, being ignored.

gl

Changelog
  • From Remotion v2.6.7 until v3.0.7, the default for Remotion Lambda was swiftshader, but from v3.0.8 the default is swangle (Swiftshader on Angle) since Chrome 101 added support for it.
  • From Remotion v2.4.3 until v2.6.6, the default was angle, however it turns out to have a small memory leak that could crash long Remotion renders.

Select the OpenGL renderer backend for Chromium.
Accepted values:

  • "angle"
  • "egl"
  • "swiftshader"
  • "swangle"
  • "vulkan" (from Remotion v4.0.41)
  • "angle-egl" (from Remotion v4.0.51)

The default is null, letting Chrome decide, except on Lambda where the default is "swangle"

forceWidth?

optional

Overrides default composition width.

forceHeight?

optional

Overrides default composition height.

logLevel?

optional

One of verbose, info, warn, error. Determines how much is being logged inside the Lambda function. Defaults to info.

outName?

optional

The file name of the still output.

It can either be:

  • undefined - it will default to out plus the appropriate file extension, for example: renders/${renderId}/out.mp4.
  • A string - it will get saved to the same Cloud Storage bucket as your site under the key renders/{renderId}/{outName}.

delayRenderTimeoutInMilliseconds?

optional

A number describing how long the render may take to resolve all delayRender() calls before it times out. Default: 30000

offthreadVideoCacheSizeInBytes?v4.0.23

From v4.0, Remotion has a cache for <OffthreadVideo> frames. The default is null, corresponding to half of the system memory available when the render starts.
This option allows to override the size of the cache. The higher it is, the faster the render will be, but the more memory will be used.
The used value will be printed when running in verbose mode.
Default: null

Return value

Returns a promise resolving to an object containing the following:

renderId

A unique alphanumeric identifier for this render. Useful for obtaining status and finding the relevant files in the Cloud Storage bucket.

bucketName

The Cloud Storage bucket name in which all files are being saved.

privacy

Privacy of the output file, either:

  • "public-read" - Publicly accessible under the Cloud Storage URL.
  • "project-private" - Not publicly available, but is available within the GCP project to those with the correct permissions.

publicUrl

If the privacy is set to public, this will be the publicly accessible URL of the rendered file. If the privacy is not public, this will be null.

cloudStorageUri

Google Storage path, beginning with gs://{bucket-name}. Can be used with the gsutil CLI tool.

size

Size of the rendered still in KB.

See also