Skip to main content

渲染 GIF

自 v3.1 版本起可用

🌐 Available since v3.1

你可以通过以下方式将视频渲染为 GIF:

🌐 You can render a video as a GIF by:

减少帧率

🌐 Reducing frame rate

通常,GIF 的帧率低于视频。为此,我们支持一个参数 everyNthFrame,其作用如下:

🌐 Commonly a GIF has a lower frame rate than a video. For this, we support a parameter everyNthFrame that works as follows:

  • 默认情况下,everyNthFrame 设置为 1:帧 01234 等被渲染。
  • 假设 everyNthFrame2,则每隔一帧才渲染一次:1357,依此类推。一个30FPS的视频现在将变成15FPS的GIF。
  • 如果 everyNthFrame3,则只渲染每第三帧:25811,并且该模式继续。

everyNthFrame 被支持:

更改循环次数

🌐 Changing the number of loops

numberOfGifLoops 选项允许你按如下方式设置循环次数:

🌐 The numberOfGifLoops option allows you to set the number of loops as follows:

  • null(或在命令行中省略)表示无限循环播放 GIF。
  • 0 禁用循环。
  • 1 循环 GIF 一次(总共播放两次)
  • 2 循环播放 GIF 两次(总共播放三次)
  • 等等。

numberOfGifLoops 选项可以设置为:

🌐 The numberOfGifLoops option can be set:

导入 GIF

🌐 Importing GIFs

想知道如何将其他 GIF 导入到 Remotion 项目中吗?点击这里。

🌐 Wondering how to import other GIFs into a Remotion project? See here.

透明 GIF

🌐 Transparent GIFs

要渲染透明 GIF,必须将 imageFormat 选项设置为 "png"。在 Remotion Studio 中,可以在“图片”选项卡中设置此选项。

🌐 To render a transparent GIF, the imageFormat option must be set to "png". In the Remotion Studio, this can be set in the "Picture" tab.

另请参阅

🌐 See also