Skip to main content

v5.0 迁移

note

Remotion 5.0 尚未发布。以下是计划在此次发布中引入的一些重大变更的不完整列表。

如何升级

🌐 How to upgrade

查看 changelog 以找到最新版本。 将 remotion 和所有以 @remotion 开头的包升级到最新版本,例如 5.0.0

🌐 See the changelog to find the latest version. Upgrade remotion and all packages starting with @remotion to the latest version, e.g. 5.0.0:

- "remotion": "4.0.141"
- "@remotion/bundler": "4.0.141"
- "@remotion/eslint-config": "4.0.141"
- "@remotion/eslint-plugin": "4.0.141"
- "@remotion/cli": "4.0.141"
- "@remotion/renderer": "4.0.141"
+ "remotion": "5.0.0"
+ "@remotion/bundler": "5.0.0"
+ "@remotion/eslint-config": "5.0.0"
+ "@remotion/eslint-plugin": "5.0.0"
+ "@remotion/cli": "5.0.0"
+ "@remotion/renderer": "5.0.0"

随后分别运行 npm i yarnpnpm ibun i

🌐 Run npm i , yarn, pnpm i or bun i respectively afterwards.

运行时要求

🌐 Runtime requirements

最低 Node 版本现在是 18.0.0。最低 Bun 版本是 1.1.3。

🌐 The minimum Node version is now 18.0.0. The minimum Bun version is 1.1.3.

selectComposition()getCompositions() 现在需要 inputProps

🌐 selectComposition() and getCompositions() now require inputProps

inputProps 现在在 selectComposition()getCompositions() 中是必需的。
一个常见的问题是渲染没有按预期工作,因为输入属性没有传递。

必需操作:如果你没有任何输入属性,请传递一个空对象 {}

visualizeAudio()产生不同的结果

🌐 visualizeAudio() yields different result

optimizeFor: "speed" 现在是默认设置。这将产生略有不同的结果。

必需的操作:查看你的音频可视化效果。如果不满意,通过设置 optimizeFor: "accuracy" 恢复到旧的行为。

TransitionSeries 不再支持 layout="none"

🌐 TransitionSeries does not support layout="none" anymore

拥有带有 layout="none"TransitionSeries 已经不再支持。
将此属性用于过渡元素从来都没有意义,因为过渡元素需要绝对定位。

🌐 Having a TransitionSeries with layout="none" is not supported anymore.
It never made sense to have this prop as transitioned elements need to be positioned absolutely.

必需的操作:移除 layout 属性。

measureSpring() 不再接受 fromto 选项

🌐 measureSpring() does not accept from and to options anymore

传入的值根本没有影响计算。因此我们删除了这些选项。

🌐 The values passed in there did not influence the calculation at all. Therefore we removed those options.

必需的操作:从你的代码中移除 fromto 选项。

overwrite 现在在 renderMediaOnLambda() 中默认是 true

🌐 overwrite is now true by default in renderMediaOnLambda()

renderMediaOnLambda()overwrite 的默认值已更改为 true。这会跳过检查文件是否已存在于 S3 存储桶中的步骤,从而使渲染启动更快。

🌐 The default value of overwrite has been changed to true in renderMediaOnLambda(). This skips a check that the file already exists in the S3 bucket, which makes the render start faster.

必需的操作:如果你想保留旧的行为,请明确设置 overwrite: false

openBrowser() 现在接受 logLevel 而不是 shouldDumpIo

🌐 openBrowser() now takes a logLevel instead of shouldDumpIo

shouldDumpIo 选项已在 5.0 中被移除。
请改用 logLevel: "verbose"

🌐 The shouldDumpIo option has been be removed in 5.0.
Use logLevel: "verbose" instead.

diskSizeInMb 现在默认是 10240

🌐 diskSizeInMb is now 10240 by default

对于 Remotion Lambda,默认的磁盘大小现在是 10240 MB。
从技术上讲,这会在渲染时增加极小的成本,但会使渲染更可靠、更快速,因为 Chrome 不太可能耗尽磁盘缓存。

🌐 For Remotion Lambda, the default disk size is now 10240 MB.
This will add a miniscule cost to your renders technically, but will lead to more reliable and faster renders, since Chrome is less likely to run out of disk cache.

必需的操作

  • 如果你想保持旧的行为,请显式设置 diskSizeInMb: 2048
  • 如果你的 Lambda 函数名称被硬编码为包含 disk2048mb,请取消硬编码并使用 speculateFunctionName() 来获取正确的名称。

有些 API 应该从 @remotion/lambda/client 导入

🌐 Some APIs should be imported from @remotion/lambda/client

renderMediaOnLambda()getRenderProgress()renderStillOnLambda()presignUrl()getSites() 已从 @remotion/lambda 中移除。
它们现在可以在 @remotion/lambda/client 中使用。

@remotion/google-fonts 需要指定权重和子集

🌐 @remotion/google-fonts requires specifying weights and subsets

在从 @remotion/google-fonts 使用 loadFonts() 时,你现在必须指定要加载的字体粗细和子集。默认加载所有的粗细和子集不再受支持,因为这可能导致超时。

🌐 When using loadFonts() from @remotion/google-fonts, you must now specify which font weights and subsets you want to load. Loading all weights and subsets by default is no longer supported as it can lead to timeouts.

必需的操作:明确指定你需要的权重和子集:

import {loadFont} from '@remotion/google-fonts/Roboto';

loadFont('normal', {
	weights: ['400', '700'],
	subsets: ['latin'],
});

序列会自动预挂载

🌐 Sequences are automatically premounted

<Sequence><Series.Sequence><TransitionSeries.Sequence> 组件现在会在出现前自动预加载 premount 1 秒(fps 帧)。 这可以防止在包含大量内容(例如视频、图片)的 <Sequence> 出现时常见的黑屏帧。

必要操作:如果你不希望某个特定序列出现此行为,请通过传递 premountFor={0} 来选择退出。

许可证变更

🌐 License changes

Remotion 5.0 有一个更新的许可证。在此查看 许可证 或比较 更改

🌐 Remotion 5.0 has an updated license. View the license here or compare the changes.

此许可证有两个有效的变更:

🌐 There are two effective changes in this license:

  • 承包商现在也计入团队规模。 以前,公司可以只与承包商合作,而无需获得公司许可。
  • 对于客户,许可现在与我们更新的条款和条件绑定。之前,我们的条款是通过条款和条件生成器生成的,并且没有意义。我们已更新它们,以便在 Remotion 的背景下有意义。