Skip to main content

v2.0 迁移

以下是 Remotion 2.0 中的一些重大更改列表,供希望升级的项目参考。

🌐 The following is a list of breaking changes in Remotion 2.0, as a reference for projects wanting to upgrade.

序列比原来短 1 帧

🌐 Sequences are 1 frame shorter

由于 v1 中的一个错误,序列比实际多了 1 帧。新的行为是每个合成少 1 帧,但与合成的持续时间保持一致。

🌐 Because of a mistake in v1, sequences were 1 frame too long. The new behavior sees each composition be 1 frame shorter, but be consistent with the duration of compositions.

序列的行为现在如下所示,以下面的例子说明:如果 durationInFrames 是 60 而 from 是 0,则序列从第 0 帧到第 59 帧(总共 60 帧),与具有相同持续时间的合成相同。在 Remotion 1.x 版本中,具有相同属性的序列将从第 0 帧到第 60 帧(总共 61 帧)。

🌐 The behavior of sequences is now the following, as explained by an example: If durationInFrames is 60 and from is 0, the sequence goes from frame 0 to 59 (60 frames in total), same as a composition with the same duration. In versions 1.x of Remotion, a sequence with the same attributes would go from frame 0 to 60 (61 frames in total).

升级路径:检查你的序列长度,如果有必要,将持续时间增加1帧。

Node.JS API 变更

🌐 Node.JS API changes

  • renderFramesuserProps 选项已被重命名为 inputProps
  • 如果你希望你的视频有声音,现在需要将 assetsInfo 传递给 stitchFramesToVideoassetsInfo 对象将由 renderFrames() 返回。

升级路径:请参阅 SSR 页面 上的更新示例,并相应地更新你的程序。

--overwrite 现在是默认值

🌐 --overwrite is now default

如果输出已经存在,Remotion 现在会在不询问的情况下覆盖它,除非你禁用此行为

🌐 If an output already exists, Remotion will overwrite it without asking now, unless you disable this behavior.

升级路径:什么也不做,或者如果你愿意的话,可以在配置文件中调整设置。

Webpack 现在使用 ESBuild 而不是 Babel

🌐 Webpack now uses ESBuild instead of Babel

希望你不会注意到除了速度快得多之外的差别。有一种方法可以 回到 Babel,你可以在这里了解

🌐 Hopefully you will not notice a difference besides it being much faster. There is a way to go back to Babel, you can read about it here

升级路径:什么都不做——如果出现问题,使用旧版 Babel 插件并提交一个问题报告。

react-dom 是一个同辈依赖

🌐 react-dom is a peer dependency

react-dom 不再预装,如果你升级的话需要手动安装。

升级到版本 2.0

🌐 Upgrade to version 2.0

将你 package.json 中所有包含 “remotion” 的依赖升级到版本 ^2.0.0

🌐 Upgrade all dependencies containing "remotion" in your package.json to version ^2.0.0.

-"@remotion/bundler": "^1.5.4",
-"@remotion/cli": "^1.5.4",
-"@remotion/eslint-config": "^1.5.4",
-"@remotion/renderer": "^1.5.4",
+"@remotion/bundler": "^2.0.0",
+"@remotion/cli": "^2.0.0",
+"@remotion/eslint-config": "2.0.0",
+"@remotion/renderer": "^2.0.0",
"@types/express": "^4.17.9",
"@types/react": "^17.0.0",
"eslint": "^7.15.0",
"express": "^4.17.1",
"prettier": "^2.2.1",
"react": "^17.0.2",
+"react-dom": "^17.0.2",
-"remotion": "^1.5.4",
+"remotion": "^2.0.0",

之后运行 npm install

🌐 Run npm install afterwards.