術語表
Remotion 核心術語的中英對照與解釋。
核心術語
Composition(組合)
定義一支影片的容器。包含影片的 id、元件、長度、fps 和解析度。
<Composition id="MyVideo" component={MyVideo} durationInFrames={90} fps={30} width={1920} height={1080} />Sequence(序列)
控制子元件出場時間的容器。內部的 useCurrentFrame() 會從 0 開始計算。
<Sequence from={30} durationInFrames={60}>
<MyScene />
</Sequence>Frame(幀)
影片的最小時間單位。一支 30fps 的影片,每秒有 30 幀。
FPS(每秒幀數)
影片每秒顯示的幀數。常見值:24(電影)、30(網路影片)、60(高幀率)。
Bundle(打包檔)
將 Remotion 專案打包後的產物,可以被渲染器使用。用 bundle() 函數產生。
Serve URL
Bundle 被託管後的 URL。渲染器需要一個 Serve URL 才能存取打包後的專案。
Entry Point(進入點)
Remotion 專案的主要檔案,通常是 src/index.ts,負責匯出 RemotionRoot。
Remotion Root
最頂層的元件,包含所有的 <Composition> 定義。
export const RemotionRoot = () => (
<>
<Composition id="Video1" ... />
<Composition id="Video2" ... />
</>
);Public Directory(公開目錄)
public/ 資料夾,用來存放靜態資源。用 staticFile() 引用。
Input Props(輸入屬性)
從外部傳入 Composition 的 Props,用於參數化影片。可從 CLI、Studio 或 API 傳入。
Default Props(預設屬性)
在 Composition 定義中設定的 Props 預設值。
calculateMetadata
在渲染前計算影片規格和 Props 的函數。可以用來擷取外部資料或動態決定影片長度。
delayRender / continueRender
暫停/恢復渲染的機制。用於等待非同步資料(API、圖片、字型)載入完成。
Studio
Remotion 的開發環境,在瀏覽器中即時預覽和渲染影片。
Player
@remotion/player 套件提供的元件,用於在 React 應用中嵌入可播放的影片。
Concurrency(並行數)
渲染時同時處理的幀數。數字越高渲染越快,但會消耗更多記憶體和 CPU。
常用 API 速查
| API | 用途 |
|---|---|
useCurrentFrame() | 取得目前幀數 |
useVideoConfig() | 取得影片設定(fps、寬高等) |
interpolate() | 將幀數映射到任意值 |
spring() | 產生彈簧動畫值 |
random() | 確定性隨機數 |
staticFile() | 引用 public/ 資料夾的檔案 |
delayRender() | 暫停渲染等待資料 |
continueRender() | 恢復渲染 |
小結
這份術語表涵蓋了使用 Remotion 時會遇到的核心概念。建議收藏這個頁面,在閱讀其他文件時隨時查閱。