Rust 开发
🌐 Rust development
随着我们迁移到new media tags,我们将不会添加任何新的 Rust 代码,只会维护现有代码。
要参与 Remotion 的 Rust 部分开发,你需要执行额外的步骤。如果你只涉及 TypeScript 部分,这些步骤完全是可选的。
🌐 To participate in the development of the Rust parts of Remotion, you need to do additional steps.
These are entirely optional if you only touch the TypeScript parts.
设置
🌐 Setup
首先,安装 Cargo,如果你还没有安装,或者升级到支持 edition-2021 的版本:
🌐 First, install Cargo, if you don't have it, or upgrade to a version that supports edition-2021:
curl https://sh.rustup.rs -sSf | sh架构
🌐 Building
要为你的操作系统构建 Rust 部分,请运行:
🌐 To build the Rust parts for your operating system, run:
cd packages/compositor
bun build.ts --debug适用于所有平台的构建
🌐 Building for all platforms
这些说明目前适用于 macOS。欢迎对其他平台的贡献。
🌐 These instructions currently are for macOS. Contributions for other platforms are appreciated.
要为所有支持的平台构建 Rust 二进制文件,你需要安装它们的工具链:
🌐 To build the Rust binaries for all supported platforms, you need to install their toolchains:
cd packages/compositor
node install-toolchain.ts然后你可以使用以下方式构建所有二进制文件:
🌐 You can then build all binaries with:
bun run build-all生成的工件应提交到Git中。
🌐 The resulting artifacts should be checked into Git.
架构
🌐 Architecture
开发工作流程
🌐 Development workflow
- Remotion 有针对特定平台的包,比如
compositor-darwin-arm64,用户只会安装与其操作系统相关的包。 - Rust 代码将默认编译成你本地的
compositor包,除非你为所有平台进行编译。 - 生成的二进制文件会被提交到 Git,这样没有安装 Rust 的人也可以进行开发。
FFmpeg 绑定
🌐 FFmpeg bindings
- Rust 二进制文件以及 FFmpeg 二进制文件都使用位于每个合成器包文件夹中的共享库。
- 这些共享库和 FFmpeg 二进制文件来自
rust-ffmpeg-splitter仓库。它们在 CircleCI 和 M1 Macbook 上构建,然后粘贴到rust-ffmpeg-sys项目中。rust-ffmpeg-sys项目是rust-ffmpeg的依赖,而rust-ffmpeg又是主 Remotion 项目的依赖。请参考这些仓库以了解如何构建它们。