renderStillOnVercel()v4.0.426
实验性包:我们保留在本通知取消之前,为了纠正糟糕的设计决策而进行重大更改的权利。
在 Vercel 沙盒中渲染静态图片。
🌐 Renders a still image inside a Vercel Sandbox.
渲染后的文件保存在沙箱内。使用 uploadToVercelBlob() 将其上传到 Vercel Blob。
🌐 The rendered file stays inside the sandbox. Use uploadToVercelBlob() to upload it to Vercel Blob.
示例
🌐 Example
route.tsconst {sandboxFilePath } = awaitrenderStillOnVercel ({sandbox ,compositionId : 'MyComp',inputProps : {title : 'Hello World'},imageFormat : 'png', });
参数
🌐 Arguments
一个具有以下属性的对象:
🌐 An object with the following properties:
sandbox
一个 Sandbox 实例。
🌐 A Sandbox instance.
compositionId
要渲染的 Remotion 组合的 ID。
🌐 The ID of the Remotion composition to render.
inputProps
传递给作文的属性。
🌐 Props to pass to the composition.
imageFormat?
The image format to use when rendering a still. Must be one of "png", "jpeg", "pdf", "webp". Default: "png".
outputFile?
沙箱内的输出文件路径。默认值:"/tmp/still.png"。
🌐 The output file path inside the sandbox. Default: "/tmp/still.png".
frame?
Which frame should be rendered when rendering a still. Default 0. From v3.2.27, negative values are allowed, with -1 being the last frame.
jpegQuality?
Sets the quality of the generated JPEG images. Must be an integer between 0 and 100. Default: 80.
envVariables?
一个包含环境变量的键值对的对象,这些环境变量将被注入到你的 Remotion 项目中,并且可以通过读取全局 process.env 对象来访问。默认值:{}。
🌐 An object containing key-value pairs of environment variables which will be injected into your Remotion project and which can be accessed by reading the global process.env object. Default: {}.
chromiumOptions?
允许你设置某些 Chromium / Google Chrome 标志。见:Chromium 标志。
🌐 Allows you to set certain Chromium / Google Chrome flags. See: Chromium flags.
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.
logLevel?
One of trace, verbose, info, warn, error.Determines how much info is being logged to the console.
Default
info.
timeoutInMilliseconds?
A number describing how long the render may take to resolve all delayRender() calls before it times out. Default: 30000
offthreadVideoCacheSizeInBytes?
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
mediaCacheSizeInBytes?
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.
offthreadVideoThreads?
The number of threads that<OffthreadVideo> can start to extract frames. The default is 2. Increase carefully, as too many threads may cause instability.
licenseKey?
License key for sending a usage event using @remotion/licensing.
onProgress?
函数 RenderStillOnVercelProgress
🌐 function RenderStillOnVercelProgress
一个接收渲染进度更新的回调。每个变体都包括 overallProgress(0–1)。
🌐 A callback that receives render progress updates. Every variant includes overallProgress (0–1).
返回值
🌐 Return value
包含以下内容的对象:
🌐 An object containing:
sandboxFilePath
沙盒中渲染的静态图片的路径。
🌐 The path to the rendered still image inside the sandbox.
contentType
渲染输出的 MIME 类型(例如 "image/png"、"image/jpeg"、"image/webp")。
🌐 The MIME type of the rendered output (e.g. "image/png", "image/jpeg", "image/webp").
另请参阅
🌐 See also