renderStillOnCloudrun()
Cloud Run 处于 Alpha 状态,且尚未积极开发。
在 Remotion Cloud Run 上启动一个静态渲染过程。
🌐 Kicks off a still rendering process on Remotion Cloud Run.
需要已部署的服务才能执行渲染。
需要指定一个站点或Serve URL来确定将渲染的内容。
🌐 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
import {renderStillOnCloudrun } from '@remotion/cloudrun/client';
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 );
}从 @remotion/cloudrun/client 导入以避免加载整个渲染器,因为它无法被打包。
参数
🌐 Arguments
一个具有以下属性的对象:
🌐 An object with the following properties:
cloudRunUrl?
如果未提供 serviceName,则为必填。用于执行渲染的 Cloud Run 服务的 URL。你必须设置 cloudRunUrl 或 serviceName 中的一个,但不能同时设置两个。
🌐 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?
如果未提供 cloudRunUrl,则为必填项。用于执行渲染的 Cloud Run 服务的名称。此名称与区域结合使用以确定服务端点,因为同一服务名称可以存在于多个区域。
🌐 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.
metadata?v4.0.216
An object containing metadata to be embedded in the video. See here for which metadata is accepted.
region
你的 Cloud Run 服务部署在哪个 GCP 区域。强烈建议你的 Remotion 网站也位于同一地区。
🌐 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
指向 Remotion 项目的 URL。使用 deploySite() 来部署 Remotion 项目。
🌐 A URL pointing to a Remotion project. Use deploySite() to deploy a Remotion project.
composition
你想要呈现的作品的id。
🌐 The id of the composition you want to render.
inputProps?
传递给所选视频组合的输入属性。。
必须是一个 JSON 对象。
可以从根组件使用 getInputProps() 读取属性。
你可以使用 calculateMetadata() 转换输入属性。
privacy?
其中之一:
🌐 One of:
"public"(默认): 渲染的静态图可以通过云存储 URL 公开访问。"private":渲染的静止图片尚未公开,但在具有正确权限的人士可以在 GCP 项目内访问。
downloadBehavior?v4.0.176
当通过浏览器中的云存储输出链接访问输出文件时,该文件应如何表现。
🌐 How the output file should behave when accessed through the Cloud Storage output link in the browser.
{"type": "play-in-browser"}- 默认设置。视频将在浏览器中播放。{"type": "download", fileName: null}或{"type": "download", fileName: "download.mp4"}- 将添加一个Content-Disposition头,使浏览器下载文件。你可以选择覆盖文件名。
forceBucketName?
指定用于输出的特定存储桶名称。生成的 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.
jpegQuality?
参见 renderStill() -> jpegQuality。
🌐 See renderStill() -> jpegQuality.
imageFormat?
参见 renderStill() -> imageFormat。
🌐 See renderStill() -> imageFormat.
scale?
Scales the output dimensions by a factor. For example, a 1280x720px frame will become a 1920x1080px frame with a scale factor of 1.5. See Scaling for more details.
envVariables?
参见 renderStill() -> envVariables。
🌐 See renderStill() -> envVariables.
frame?
应该渲染作品的哪一帧。帧是从零开始索引的,可以使用负值,-1表示最后一帧。
🌐 Which frame of the composition should be rendered. Frames are zero-indexed, and negative values are allowed, with -1 being the last frame.
chromiumOptions?
允许你设置某些 Chromium / Google Chrome 标志。见:Chromium 标志。
🌐 Allows you to set certain Chromium / Google Chrome flags. See: Chromium flags.
disableWebSecurity
boolean - 默认 false
🌐 boolean - default false
这将尤其会禁用 CORS 以及其他安全功能。
🌐 This will most notably disable CORS among other security features.
ignoreCertificateErrors
boolean - 默认 false
🌐 boolean - default false
导致无效的 SSL 证书(例如自签名证书)被忽略。
🌐 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 isswangle(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?
覆盖默认的合成宽度。
🌐 Overrides default composition width.
forceHeight?
覆盖默认的合成高度。
🌐 Overrides default composition height.
forceFps?v4.0.424
覆盖默认的合成帧率。
🌐 Overrides the default composition FPS.
forceDurationInFrames?v4.0.424
覆盖默认的合成帧数持续时间。
🌐 Overrides the default composition duration in frames.
logLevel?
One of trace, verbose, info, warn, error.Determines how much info is being logged to the console.
Default
info.
outName?
静态输出的文件名。
🌐 The file name of the still output.
它可以是:
🌐 It can either be:
undefined- 它将默认为out加上适当的文件扩展名,例如:renders/${renderId}/out.mp4。- 一个
string- 它将被保存到与你的网站相同的云存储桶中,键为renders/{renderId}/{outName}。确保在字符串的末尾包含文件扩展名。
delayRenderTimeoutInMilliseconds?
一个数字,描述渲染可能花多长时间来解决所有 delayRender() 调用 在超时之前。默认值:30000
🌐 A number describing how long the render may take to resolve all delayRender() calls before it times out. Default: 30000
mediaCacheSizeInBytes?v4.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.
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
offthreadVideoThreadsv4.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.
返回值
🌐 Return value
返回一个 Promise,该 Promise 解析为包含以下内容的对象:
🌐 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" - 可通过云存储 URL 公共访问。
- “项目私有” - 不公开,但在 GCP 项目内对拥有正确权限的人可用。
publicUrl
如果隐私设置为公开,这将是渲染文件的公开可访问 URL。如果隐私设置不是公开,这将为空。
🌐 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
以 gs://{bucket-name} 开头的 Google 存储路径。可以与 gsutil 命令行工具一起使用。
🌐 Google Storage path, beginning with gs://{bucket-name}. Can be used with the gsutil CLI tool.
size
渲染后的静态图片大小(KB)。
🌐 Size of the rendered still in KB.
另请参阅
🌐 See also