Skip to main content

npx remotion cloudrun still

EXPERIMENTAL

Cloud Run 处于 Alpha 阶段,这意味着 API 可能会在任何版本中更改,文档尚未完成。请查看 更改日志 以了解最新的重大更改。

使用 npx remotion cloudrun still 命令,您可以在 GCP 上渲染图像。

命令的结构如下:

npx remotion cloudrun still <serve-url> [<still-id>] [<output-location>]
npx remotion cloudrun still <serve-url> [<still-id>] [<output-location>]
  • 通过使用 sites create 命令部署 Remotion 项目到 GCP 存储桶来获取服务 URL。
  • 静态 ID。如果未指定,将获取组合列表,您可以选择一个组合。
  • output-location 参数是可选的。如果不指定,图像将存储在您的 Cloud 存储桶中。如果指定位置,它将在额外步骤中下载到您的设备。

示例命令

渲染静态图像,传递服务名称:

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

使用站点名称而不是完整的服务 URL:

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

传递输入属性:

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

标志

--region

选择的 GCP 区域。为了获得最低延迟,服务、站点和输出存储桶应位于同一区域。

--props

传递给视频所选组合的输入属性。
必须是序列化的 JSON 字符串 (--props='{"hello": "world"}') 或 JSON 文件的路径 (./path/to/props.json)。
从根组件中,可以使用 getInputProps() 读取属性。
您可以使用 calculateMetadata() 转换输入属性。

note

在 Windows shells 上不支持内联 JSON 字符串,因为它会移除 " 字符,请改用文件名。

--privacy

其中之一:

  • "public"默认):渲染的静帧在 Cloud Storage URL 下是公开可访问的。
  • "private":渲染的静帧不是公开可用的,但对具有正确权限的 GCP 项目内的用户可用。

--force-bucket-name

指定用于输出的特定存储桶名称。生成的 Google Cloud Storage URL 将采用以下格式:gs://{bucket-name}/renders/{render-id}/{file-name}。如果未设置,Remotion 将根据区域选择正确的存储桶。

--jpeg-quality

JPEG 渲染质量的取值范围为 0 到 100。当渲染 PNG 时不起作用。

--image-format

jpegpng - JPEG 更快,但不支持透明度。 默认图像格式为 jpeg

--scale

按您传入的因子缩放输出帧。 例如,一个 1280x720px 的帧将以 1.5 的缩放因子变为 1920x1080px 的帧。字体和 HTML 标记等矢量元素将以更多细节呈现。

--env-file

指定 dotenv 文件的位置 - 默认为 .env了解 Remotion 中环境变量的工作原理。

--out-name

存储在 Cloud Storage 存储桶中的静帧输出文件名。默认情况下,它是 out 加上适当的文件扩展名,例如:out.png。必须匹配 /([0-9a-zA-Z-!_.*'()/]+)/g

--cloud-run-url

指定应用于执行渲染的服务的 URL。您必须设置 cloud-run-url service-name,但不能同时设置两者。

--service-name

指定应用于执行渲染的服务的名称。这与区域一起用于确定服务端点,因为相同的服务名称可以存在于多个区域。您必须设置 cloud-run-url service-name,但不能同时设置两者。

--offthreadvideo-cache-size-in-bytesv4.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