Back to Remotion

npx remotion cloudrun render

packages/docs/docs/cloudrun/cli/render.mdx

4.0.4576.0 KB
Original Source
<ExperimentalBadge> <p> Cloud Run is in <a href="/docs/cloudrun/status">Alpha status and not actively being developed.</a> </p> </ExperimentalBadge>

Using the npx remotion cloudrun render command, you can render a video on GCP.

The structure of a command is as follows:

npx remotion cloudrun render <serve-url> [<composition-id>] [<output-location>]
  • The serve URL is obtained by deploying a Remotion project to a GCP Storage Bucket using the sites create command or calling deployService().
  • The composition ID. If not specified, the list of compositions will be fetched and you can choose a composition.
  • The output-location parameter is optional. If you don't specify it, the video is stored in your Cloud Storage bucket. If you specify a location, it gets downloaded to your device in an additional step.

Example commands

Rendering a video, passing the service name:

npx remotion cloudrun render https://storage.googleapis.com/remotioncloudrun-123asd321/sites/abcdefgh/index.html tiles --service-name=remotion--3-3-82--mem512mi--cpu1-0--t-800

Using the site name as opposed to the full serve-url:

npx remotion cloudrun render test-site tiles --service-name=remotion--3-3-82--mem512mi--cpu1-0--t-800

Passing in input props:

npx remotion cloudrun render test-site tiles --service-name=remotion--3-3-82--mem512mi--cpu1-0--t-800 --props='{"hi": "there"}'

Flags

--region

The GCP region to select. For lowest latency, the service, site and output bucket should be in the same region.

--props

<Options id="props" />

:::note Inline JSON string isn't supported on Windows shells because it removes the " character, use a file name instead. :::

--privacy

One of:

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

--force-bucket-name

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.

--concurrency

<Options id="concurrency" />

:::note Before v4.0.76, this was "100%" by default. It is now aligned to the other server-side rendering APIs. :::

--jpeg-quality

Value between 0 and 100 for JPEG rendering quality. Doesn't work when PNG frames are rendered.

--image-format

<Options id="video-image-format" />

--scale

Scales the output frames by the factor you pass in. For example, a 1280x720px frame will become a 1920x1080px frame with a scale factor of 1.5. Vector elements like fonts and HTML markups will be rendered with extra details.

--env-file

<Options id="env-file" />

--out-name

The file name of the media output as stored in the Cloud Storage bucket. By default, it is out plus the appropriate file extension, for example: out.mp4. Must match /([0-9a-zA-Z-!_.*'()/]+)/g.

--cloud-run-url

Specify the url of the service which should be used to perform the render. You must set either cloud-run-url or service-name, but not both

--service-name

Specify the name of the 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. You must set either cloud-run-url or service-name, but not both

--codec

h264 or h265 or png or vp8 or mp3 or aac or wav or prores. If you don't supply --codec, it will use h264.

--audio-codec

<Options id="audio-codec" />

--audio-bitrate

<Options id="audio-bitrate" />

--video-bitrate

<Options id="video-bitrate" />

--webhook

Your webhook URL that will be called with the progress of the render. This will be sent using a POST request.

Example:

bash
--webhook=https://example.com/webhook

The webhook will receive a POST request with a JSON body containing:

json
{
  "progress": 0.1,
  "renderedFrames": 100,
  "encodedFrames": 100,
  "renderId": "1234567890",
  "projectId": "1234567890"
}

--render-id-override

Provide a specific render ID for the render. Otherwise a random one will be generated.

Example:

bash
--render-id-override=my-custom-render-id

:::note You will be responsible for ensuring that the render ID is unique, otherwise it will overwrite existing renders with the same configured Render ID. :::

--prores-profile

<Options id="prores-profile" />

--x264-preset

<Options id="x264-preset" />

--crf

To set Constant Rate Factor (CRF) of the output. Minimum 0. Use this rate control mode if you want to keep the best quality and care less about the file size.

--pixel-format

<Options id="pixel-format" />

--every-nth-frame

<Options id="every-nth-frame" />

For example only every second frame, every third frame and so on. Only works for rendering GIFs. See here for more details.

--number-of-gif-loops

<Options id="number-of-gif-loops" />

--frames

<Options id="frames" />

--media-cache-size-in-bytes<AvailableFrom v="4.0.352"/>

<Options id="media-cache-size-in-bytes" />

--offthreadvideo-cache-size-in-bytes<AvailableFrom v="4.0.23"/>

<Options id="offthreadvideo-cache-size-in-bytes" />

--offthreadvideo-video-threads<AvailableFrom v="4.0.261"/>

<Options id="offthreadvideo-video-threads" />

--color-space<AvailableFrom v="4.0.28"/>

<Options cli id="color-space" />

--metadata<AvailableFrom v="4.0.216" />

<Options cli id="metadata" />

--sample-rate<AvailableFrom v="4.0.448" />

<Options cli id="sample-rate" />