输出缩放
如果你希望以相同的长宽比渲染多个分辨率的视频,输出缩放是有用的。
🌐 Output scaling is useful if you would like to render the video in multiple resolutions in the same aspect ratio.
示例:你的视频画布是全高清(1920x1080),但希望将视频渲染为4k(3840x2160 或 2x)。
Remotion 可以通过以下方式支持这种更高的分辨率:
🌐 Remotion can support this higher resolution by:
- 在服务器端渲染中设置无头浏览器的
deviceScaleFactor。 - 在客户端渲染中放大画布上的项目。
如何扩展
🌐 How to scale
-
在命令行接口(CLI)中,在渲染视频或静态图片时,传递
--scale标志。例如:--scale=2 -
在 Node.JS 函数
renderStill()、renderFrames()、renderStillOnLambda()和renderMediaOnLambda()、renderMediaOnVercel()和renderStillOnVercel()、renderMediaOnCloudRun()、renderStillOnCloudRun()中,你可以传递一个scale选项。 -
在客户端渲染函数
renderMediaOnWeb()、renderStillOnWeb()中,你可以传递一个scale选项。 -
在 配置文件 中,你可以使用以下语句传递比例:
Config .setScale (2);
允许的值
🌐 Allowed values
可能的最高级别是 16(每个尺寸的维度提高十六倍,或像素增加 256 倍)。
🌐 The highest scale possible is 16 (sixteen times higher dimensions on each size or 256 times more pixels).
允许小于 1 的正值。例如,0.5 将每个维度减半。
🌐 Positive values below 1 are allowed. For example, 0.5 will half each dimension.
在 4.0.328 之前,还有进一步的限制:
🌐 Before 4.0.328, there were further limitations:
- 不允许导致非整数像素的缩放值。
- 在使用编解码器
h264渲染时,不允许缩放值导致非偶数。
自 4.0.328 起,四舍五入会自动进行。
🌐 Since 4.0.328, rounding is performed automatically.
可扩展元素
🌐 Scalable elements
可以放大并增强分辨率的元素有:
🌐 Elements that can be upscaled and that will enhance increased resolution are:
- 文本元素
- SVG元素
- 图片(如果它们的分辨率足以以更高分辨率显示)
无法通过提升分辨率来放大的元素有:
🌐 Elements that cannot be upscaled for increased resolution are:
- 视频
- 画布和 WebGL 元素