Skip to main content

参数化视频

Remotion 允许摄取验证可视化编辑和转换可用于视频参数化的数据。

🌐 Remotion allows for ingesting, validating, visually editing, and transforming data that may be used to parametrize a video.

数据可能会影响视频的内容,或影响诸如宽度、高度、时长或帧率之类的元数据

🌐 Data may influence the content of the video, or the metadata such as width, height, duration or framerate.

高级概述

🌐 High-level overview

Remotion 允许将 props 传递给 React 组件。 Props 是 React 的一个概念,其形式为 JavaScript 对象。

🌐 Remotion allows the passing of props to a React component.
Props are a React concept and take the shape of a JavaScript object.

为了确定传递给视频的数据,采取以下步骤:

🌐 To determine the data which gets passed to the video, the following steps are taken:

默认属性 是静态定义的,因此视频可以在工作室中在没有任何数据的情况下设计。

  • 默认属性定义了数据的结构。

  • 可以定义并验证一个模式。

  • 在缺少数据的情况下,可以在 Remotion Studio 中编辑默认属性。

输入属性 在渲染视频时可以指定,以覆盖默认属性。

  • 输入属性将与默认属性合并,输入属性优先。

使用 calculateMetadata(),可以对属性进行后处理,并动态计算元数据。

  • 例如,如果 URL 被作为 prop 传入,它可以被获取,内容也可以添加到 props 中。

  • 这里也可以进行视频时长和其他元数据的异步计算。

最终的 props 会传递给 React 组件。

  • 组件可以根据 props 动态渲染内容。

请参见 这里 了解解决过程如何工作的可视化说明和更多细节。

🌐 See here for a visual explanation and more details of how the resolution process works.

目录

🌐 Table of contents

另请参阅

🌐 See also

你可以使用 Remotion Player 在 React 应用中显示 Remotion 组件,并在不渲染视频的情况下动态更改内容,以创建内容实时更新的体验。

🌐 You can use the Remotion Player to display a Remotion component in a React app and dynamically change the content without rendering the video, to create experiences where the content updates in real-time.