Skip to main content

将 Remotion Studio 部署为静态网站

从 v4.0.97 起可用

🌐 available from v4.0.97

你可以将 Remotion Studio 部署为静态站点,例如部署到 Vercel 或 Netlify。
服务器端渲染将不可用,但如果你启用客户端渲染,你可以直接在浏览器中渲染视频。
部署后的 URL 也可以用作服务 URL,传递给渲染 API。
确保你的版本至少为 v4.0.97 才能使用此功能——使用 npx remotion upgrade 进行升级。

🌐 You can deploy the Remotion Studio as a static site, for example to Vercel or Netlify.
Server-side rendering will not be available, but if you enable client-side rendering, you can render videos directly in the browser.
The deployed URL may also be used as a Serve URL to pass to rendering APIs.
Make sure you are on at least v4.0.97 to use this feature - use npx remotion upgrade to upgrade.

将 Remotion Studio 导出为静态网站

🌐 Export the Remotion Studio as a static site

要将 Remotion Studio 导出为静态站点,请运行 remotion bundle 命令:

🌐 To export the Remotion Studio as a static site, run the remotion bundle command:

npx remotion bundle

输出将位于 build 文件夹中。 我们建议将 build 添加到你的 .gitignore 文件中。当你运行该命令时,它会提示你是否执行此操作。

🌐 The output will be in the build folder.
We recommend to add build to your .gitignore file. The command will offer to do it for you when you run it.

部署到 Vercel

🌐 Deploy to Vercel

要部署到 Vercel,请将你的代码仓库连接到 Vercel。

🌐 To deploy to Vercel, connect your repository to Vercel.

在“构建与输出”设置中,启用“覆盖”并设置以下内容:

🌐 In the "Build and Output" settings, enable "OVERRIDE" and set the following:

  • 构建命令bunx remotion bundle
  • 输出目录: build
  • 安装命令保持默认

Alt text

note

使用 bunx 作为脚本运行器比使用 npx 略快。

部署到 Netlify

🌐 Deploy to Netlify

将你的仓库连接到 Netlify。

🌐 Connect your repository to Netlify.

  • 基础目录保持默认
  • 构建命令npx remotion bundle
  • 发布目录: build
  • 函数目录保持默认

部署到 GitHub Pages

🌐 Deploy to GitHub Pages

在你的仓库中创建以下文件:

.github/workflows/deploy-studio.yml
name: Deploy Remotion studio on: workflow_dispatch: push: branches: - 'main' permissions: contents: write jobs: render: name: Render video runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@main - name: install packages run: npm i - name: Bundle Studio run: npx remotion bundle --public-path="./" - name: Deploy Studio uses: JamesIves/github-pages-deploy-action@v4 with: folder: build

上述代码将把打包的 Remotion Studio 部署到分支 gh-pages

🌐 The above code will deploy the bundled Remotion Studio to a branch gh-pages.

note

npx remotion bundle 的 --public-path 标志仅从 remotion 版本 4.0.127 开始可用

转到你的仓库设置 (github.com/[username]/[repo]/settings/pages)

在分支部分,选择gh-pages分支,然后点击保存。

从 URL 渲染

🌐 Rendering from a URL

已部署的 URL 是一个 Serve URL 也可以用来渲染视频:

🌐 The deployed URL is a Serve URL can also be used to render a video:

最小示例:

🌐 Minimal example:

npx remotion render https://remotion-helloworld.vercel.app

指定 "HelloWorld" 组合 ID输入属性

🌐 Specify "HelloWorld" composition ID and input props:

npx remotion render https://remotion-helloworld.vercel.app HelloWorld --props '{"titleText":"Hello World"}'