Remotion LabRemotion Lab
疑難排解偵測到 Apple Silicon

偵測到 Apple Silicon

在搭載 Apple Silicon(M 系列晶片)的 Mac 上使用 Remotion 時遇到的相容性問題與解決方案。

偵測到 Apple Silicon

搭載 Apple Silicon(M1、M2、M3 系列)的 Mac 使用 ARM64 架構,與傳統 Intel Mac 的 x86_64 架構不同。Remotion 在某些版本或設定下可能會偵測到 Apple Silicon 並觸發相容性警告,或在執行時遇到問題。

常見錯誤訊息

你可能會看到類似以下的訊息:

Apple Silicon detected. Some features may not work as expected.

或是在安裝或執行 Chromium / FFmpeg 相關元件時出現:

Error: Could not find a suitable binary for your platform (darwin arm64)
The chromium binary is not compatible with your system architecture.

原因分析

Chromium 的架構問題

Remotion 在渲染時依賴 Chromium 進行截圖。舊版的 Remotion 或 @remotion/renderer 套件可能附帶的是 x86_64 版本的 Chromium 可執行檔,在 Apple Silicon 上需要透過 Rosetta 2 模擬執行,雖然通常可以運作,但偶爾會造成問題。

新版的 Remotion(v4.0 以後)已提供原生 ARM64 支援,建議升級至最新版本。

FFmpeg 二進位檔案

Remotion 內建的 FFmpeg 二進位檔也需要對應架構版本。若使用的版本不對,可能導致渲染失敗或效能低落。

Rosetta 2 衝突

如果你的終端機(Terminal.app 或 iTerm)設定為透過 Rosetta 2 執行,nodenpm 可能會被識別為 x86_64 程式,導致安裝的原生模組架構錯誤。

解決方案

方案一:升級 Remotion 至最新版本

最直接的解決方式是升級所有 Remotion 相關套件:

npx remotion upgrade

或手動指定版本:

npm install remotion@latest @remotion/cli@latest @remotion/renderer@latest @remotion/player@latest

新版 Remotion 對 Apple Silicon 的支援更加完善。

方案二:確認終端機架構

確認你的終端機以原生 ARM64 模式執行,而非 Rosetta 模式:

# 檢查目前 shell 的架構
uname -m
# 應輸出 arm64
 
# 確認 node 的架構
node -e "console.log(process.arch)"
# 應輸出 arm64

若輸出為 x86_64,代表你的終端機正在使用 Rosetta 模式。

要切換至原生 ARM64 終端機:

  1. 在 Finder 中找到 Terminal 或 iTerm 應用程式
  2. 右鍵點擊 → 「取得資訊」
  3. 取消勾選「使用 Rosetta 開啟」選項
  4. 重新啟動終端機

方案三:重新安裝 Node.js(ARM64 版本)

如果 Node.js 是以 x86_64 版本安裝,請改用 ARM64 版本:

# 使用 nvm 安裝原生 ARM64 版本的 Node.js
nvm install --lts
nvm use --lts
 
# 驗證架構
node -e "console.log(process.arch)"  # 應為 arm64

或從 Node.js 官方網站 下載 macOS ARM64 安裝包。

方案四:清除快取並重新安裝依賴

架構不符的舊有快取可能造成問題,建議清除後重新安裝:

# 刪除 node_modules 與 lock 檔
rm -rf node_modules package-lock.json
 
# 清除 npm 快取
npm cache clean --force
 
# 重新安裝
npm install

方案五:使用 Homebrew 安裝 FFmpeg(可選)

若 Remotion 內建的 FFmpeg 有問題,可安裝系統層級的原生 ARM64 版本作為備援:

# 確認使用 ARM64 版本的 Homebrew
/opt/homebrew/bin/brew install ffmpeg

注意:Intel Mac 的 Homebrew 安裝在 /usr/local/,而 ARM64 Mac 的 Homebrew 安裝在 /opt/homebrew/。若兩個版本都存在,可能造成路徑衝突。

驗證修復結果

修復後,可以執行以下指令確認環境正常:

# 啟動 Remotion Studio 並確認無錯誤
npx remotion studio
 
# 執行一次簡單的渲染測試
npx remotion render MyComposition out/test.mp4 --frames=0-10

在 Apple Silicon 上的效能表現

正確設定後,Apple Silicon 上的 Remotion 渲染效能通常優於 Intel Mac,因為 M 系列晶片有更強的單核心效能與 GPU 加速能力。

相關資源