使用時機
當您在處理 Remotion 程式碼,需要取得特定領域的知識時,請使用此技能。
新專案設定
當您處於空資料夾或沒有現有 Remotion 專案的工作區時,請使用以下指令建立一個新專案:
npx create-video@latest --yes --blank --no-tailwind my-video
將 my-video 替換為合適的專案名稱。
啟動預覽
啟動 Remotion Studio 來預覽影片:
npx remotion studio
可選:單格影格渲染檢查
您可以使用 CLI 渲染單一影格,以快速檢查版面配置、顏色或時間點。 對於微小修改、純粹重構,或當您已從 Studio 或先前的渲染中獲得足夠信心時,請跳過此步驟。
npx remotion still [composition-id] --scale=0.25 --frame=30
在 30 fps 時,--frame=30 代表一秒鐘的位置(--frame 從零開始計算)。
字幕
處理字幕或隱藏式字幕時,請載入 ./rules/subtitles.md 檔案以取得更多資訊。
使用 FFmpeg
對於某些影片操作,例如剪輯影片或偵測靜音,應使用 FFmpeg。請載入 ./rules/ffmpeg.md 檔案以取得更多資訊。
靜音偵測
當需要從影片或音訊檔案中偵測並修剪掉靜音片段時,請載入 ./rules/silence-detection.md 檔案。
音訊視覺化
當需要將音訊視覺化(頻譜條、波形、低音反應效果等)時,請載入 ./rules/audio-visualization.md 檔案以取得更多資訊。
音效
當需要使用音效時,請載入 ./rules/sfx.md 檔案以取得更多資訊。
如何使用
請閱讀各個規則檔案以獲取詳細說明與程式碼範例:
- rules/3d.md - 使用 Three.js 和 React Three Fiber 在 Remotion 中建立 3D 內容
- rules/animations.md - Remotion 的基本動畫技巧
- rules/assets.md - 在 Remotion 中匯入圖片、影片、音訊與字型
- rules/audio.md - 在 Remotion 中使用音訊與聲音——匯入、剪輯、音量、速度、音高
- rules/calculate-metadata.md - 動態設定組合的持續時間、尺寸與屬性
- rules/can-decode.md - 使用 Mediabunny 檢查瀏覽器是否能解碼某個影片
- rules/charts.md - Remotion 的圖表與資料視覺化模式(長條圖、圓餅圖、折線圖、股票圖)
- rules/compositions.md - 定義組合、靜態圖片、資料夾、預設屬性與動態元資料
- rules/extract-frames.md - 使用 Mediabunny 從影片中擷取特定時間點的影格
- rules/fonts.md - 在 Remotion 中載入 Google Fonts 與本機字型
- rules/get-audio-duration.md - 使用 Mediabunny 取得音訊檔案的持續時間(秒)
- rules/get-video-dimensions.md - 使用 Mediabunny 取得影片檔案的寬度與高度
- rules/get-video-duration.md - 使用 Mediabunny 取得影片檔案的持續時間(秒)
- rules/gifs.md - 顯示與 Remotion 時間軸同步的 GIF
- rules/images.md - 使用 Img 元件在 Remotion 中嵌入圖片
- rules/light-leaks.md - 使用 @remotion/light-leaks 的光洩漏疊加效果
- rules/lottie.md - 在 Remotion 中嵌入 Lottie 動畫
- rules/measuring-dom-nodes.md - 在 Remotion 中測量 DOM 元素的尺寸
- rules/measuring-text.md - 測量文字尺寸、將文字放入容器中,以及檢查溢出
- rules/sequencing.md - Remotion 的排序模式——延遲、修剪、限制項目持續時間
- rules/tailwind.md - 在 Remotion 中使用 TailwindCSS
- rules/text-animations.md - Remotion 的排版與文字動畫模式
- rules/timing.md - 使用 interpolate 與貝茲曲線緩動、彈簧效果進行時間控制
- rules/transitions.md - Remotion 的場景轉場模式
- rules/transparent-videos.md - 渲染具有透明背景的影片
- rules/trimming.md - Remotion 的修剪模式——裁切動畫的開頭或結尾
- rules/videos.md - 在 Remotion 中嵌入影片——修剪、音量、速度、循環、音高
- rules/parameters.md - 透過新增 Zod 架構讓影片參數化
- rules/maps.md - 使用 Mapbox 加入地圖並製作動畫
- rules/silence-detection.md - 使用 FFmpeg loudnorm 與 silencedetect 進行自適應靜音偵測
- rules/voiceover.md - 使用 ElevenLabs TTS 為 Remotion 組合加入 AI 生成的旁白