npx remotion cloudrun still
Cloud Run 处于 Alpha 状态,且尚未积极开发。
使用 npx remotion cloudrun still 命令,你可以在 GCP 上渲染图片。
🌐 Using the npx remotion cloudrun still command, you can render an image on GCP.
一个命令的结构如下:
🌐 The structure of a command is as follows:
npx remotion cloudrun still <serve-url> [<still-id>] [<output-location>]- 通过使用
sites create命令将 Remotion 项目部署到 GCP 存储桶或调用deployService()来获取服务 URL。 - 静态ID(/docs/terminology/composition#composition-id)。如果未指定,将获取作品列表,你可以选择一个作品。
output-location参数是可选的。如果你不指定它,图片将存储在你的云存储桶中。如果你指定了位置,它会在额外的步骤中下载到你的设备上。
示例命令
🌐 Example commands
呈现静态画面,传递服务名称:
🌐 Rendering a still, passing the service name:
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:
🌐 Using the site name as opposed to the full serve-url:
npx remotion cloudrun still test-site tiles --service-name=remotion--3-3-82--mem512mi--cpu1-0--t-800传入输入属性:
🌐 Passing in input props:
npx remotion cloudrun still test-site tiles --service-name=remotion--3-3-82--mem512mi--cpu1-0--t-800 --props='{"hi": "there"}'标志
🌐 Flags
--region
要选择的 GCP 区域。为了降低延迟,服务、站点和输出存储桶应位于同一地区。
🌐 The GCP region to select. For lowest latency, the service, site and output bucket should be in the same region.
--props
Input Props to pass to the selected composition of your video. Must be a serialized JSON string (--props='{"hello": "world"}') or a path to a JSON file (./path/to/props.json).
Windows 终端不支持内联 JSON 字符串,因为它会移除 " 字符,请改用文件名。
--privacy
其中之一:
🌐 One of:
"public"(默认): 渲染的静态图可以通过云存储 URL 公开访问。"private":渲染的静止图片尚未公开,但在具有正确权限的人士可以在 GCP 项目内访问。
--force-bucket-name
指定用于输出的特定存储桶名称。生成的 Google Cloud Storage URL 将采用 gs://{bucket-name}/renders/{render-id}/{file-name} 格式。如果未设置,Remotion 将根据区域选择合适的存储桶使用。
🌐 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.
--jpeg-quality
用于 JPEG 渲染质量的 0 到 100 之间的值 (/docs/config#setjpegquality)。在渲染 PNG 时不起作用。
--image-format
The image format to use when rendering a still. Must be one of "png", "jpeg", "pdf", "webp". Default: "png".
--scale
按你传入的因子缩放输出帧。 例如,一个 1280x720 像素的帧在缩放因子为 1.5 时将变为 1920x1080 像素。矢量元素如字体和 HTML 标记将以更多细节呈现。
--env-file
Specify a location for a dotenv file. Default .env.
--out-name
静态输出在云存储桶中存储的文件名。默认情况下,它是 out 加上适当的文件扩展名,例如:out.png。必须匹配 /([0-9a-zA-Z-!_.*'()/]+)/g。
🌐 The file name of the still output as stored in the Cloud Storage bucket. By default, it is out plus the appropriate file extension, for example: out.png. Must match /([0-9a-zA-Z-!_.*'()/]+)/g.
--cloud-run-url
指定用于执行渲染的服务的 URL。你必须设置 cloud-run-url 或 service-name,但不能同时设置两者。
🌐 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
指定用于执行渲染的服务名称。此名称与区域结合使用以确定服务端点,因为相同的服务名称可能存在于多个区域。你必须设置 cloud-run-url 或 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.
--media-cache-size-in-bytesv4.0.352
Specify the maximum size of the cache that <Video> and <Audio> from @remotion/media may use combined, in bytes. The default is half of the available system memory when the render starts.
--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
--offthreadvideo-video-threadsv4.0.261
The number of threads that<OffthreadVideo> can start to extract frames. The default is 2. Increase carefully, as too many threads may cause instability.