Skip to content

🎥 Make videos programmatically with React

move optimization to build.mjs

Jonny Burger1ffb43ca19e7
diff --git a/packages/Cargo.lock b/packages/Cargo.lock
index 98e0fb4ec8..ed3a56b067 100644
--- a/packages/Cargo.lock
+++ b/packages/Cargo.lock
@@ -133,7 +133,7 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
[[package]]
name = "ffmpeg-next"
version = "6.0.0"
-source = "git+https://github.com/JonnyBurger/rust-ffmpeg?rev=a3924db17d5da602b97a3202ba8e1d8f4d8a53f9#a3924db17d5da602b97a3202ba8e1d8f4d8a53f9"
+source = "git+https://github.com/JonnyBurger/rust-ffmpeg?rev=dd948e48dbd96b2a9dd0c0dcba3743834a03865b#dd948e48dbd96b2a9dd0c0dcba3743834a03865b"
dependencies = [
"bitflags",
"ffmpeg-sys-next",
@@ -143,7 +143,7 @@ dependencies = [
[[package]]
name = "ffmpeg-sys-next"
version = "6.0.1"
-source = "git+https://github.com/remotion-dev/rust-ffmpeg-sys?rev=ca1148d571c841e262cfd199f0fcb8bb1ddc3720#ca1148d571c841e262cfd199f0fcb8bb1ddc3720"
+source = "git+https://github.com/remotion-dev/rust-ffmpeg-sys?rev=8a4a13b36cd048800d02bd9f7f5f108301fca8c9#8a4a13b36cd048800d02bd9f7f5f108301fca8c9"
dependencies = [
"bindgen",
"cc",
diff --git a/packages/Cargo.toml b/packages/Cargo.toml
index 1fc5203ba2..821a6b2b2e 100644
--- a/packages/Cargo.toml
+++ b/packages/Cargo.toml
@@ -15,15 +15,9 @@ jpeg-decoder = "0.3"
jpeg-encoder = "0.5.1"
lazy_static = "1.4"
rayon = "1.7.0"
-ffmpeg-next = {git = "https://github.com/JonnyBurger/rust-ffmpeg", rev ="a3924db17d5da602b97a3202ba8e1d8f4d8a53f9"}
+ffmpeg-next = {git = "https://github.com/JonnyBurger/rust-ffmpeg", rev ="dd948e48dbd96b2a9dd0c0dcba3743834a03865b"}
[[bin]]
name = "compositor"
path = "renderer/rust/main.rs"
-[profile.release]
-# debuginfo will keep symbols, which are used for backtrace.
-# symbols makes it a tiny bit smaller, but error messages will be hard to debug.
-strip="debuginfo"
-lto = "fat"
-opt-level = 'z'
diff --git a/packages/compositor-linux-arm64-gnu/compositor b/packages/compositor-linux-arm64-gnu/compositor
index 13fb95a4a9..5e35c862bf 100755
Binary files a/packages/compositor-linux-arm64-gnu/compositor and b/packages/compositor-linux-arm64-gnu/compositor differ
diff --git a/packages/compositor-linux-x64-gnu/compositor b/packages/compositor-linux-x64-gnu/compositor
index c8017118ad..b3b30a4262 100755
Binary files a/packages/compositor-linux-x64-gnu/compositor and b/packages/compositor-linux-x64-gnu/compositor differ
diff --git a/packages/renderer/build.mjs b/packages/renderer/build.mjs
index 63cf02893e..8f8079ff19 100644
--- a/packages/renderer/build.mjs
+++ b/packages/renderer/build.mjs
@@ -185,10 +185,19 @@ for (const arch of archs) {
);
const command = `cargo build ${debug ? '' : '--release'} --target=${arch}`;
console.log(command);
+
+ // debuginfo will keep symbols, which are used for backtrace.
+ // symbols makes it a tiny bit smaller, but error messages will be hard to debug.
+
+ const optimizations = all
+ ? '-C opt-level=3 -C lto=fat -C strip=debuginfo -C embed-bitcode=yes'
+ : '';
+
execSync(command, {
stdio: 'inherit',
env: {
...process.env,
+ RUSTFLAGS: optimizations,
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER:
nativeArch === 'aarch64-unknown-linux-gnu'
? undefined