Skip to content

🎥 Make videos programmatically with React

make it a lot easier to build rust

Jonny Burger2a6b2de5dbac
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 0440f84f89..0715ae71d9 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -3,11 +3,5 @@
"editor.codeActionsOnSave": {
"source.organizeImports": false,
"source.fixAll": true
- },
- "rust-analyzer.cargo.extraEnv": {
- "REMOTION_FFMPEG_RUST_BINDINGS_OUT_DIR": "/Users/jonathanburger/remotion/packages/compositor-darwin-arm64/ffmpeg",
- "RUSTFLAGS": "-L /Users/jonathanburger/remotion/packages/compositor-darwin-arm64/ffmpeg/remotion/include",
- "CPATH": "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include",
- "FFMPEG_DIR": "/Users/jonathanburger/remotion/packages/compositor-darwin-arm64/ffmpeg/remotion"
}
}
diff --git a/packages/Cargo.lock b/packages/Cargo.lock
index 84f37f5a97..98e0fb4ec8 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=1c0581b7b1fb762c71ff7750324356c25ade9f1d#1c0581b7b1fb762c71ff7750324356c25ade9f1d"
+source = "git+https://github.com/JonnyBurger/rust-ffmpeg?rev=a3924db17d5da602b97a3202ba8e1d8f4d8a53f9#a3924db17d5da602b97a3202ba8e1d8f4d8a53f9"
dependencies = [
"bitflags",
"ffmpeg-sys-next",
@@ -143,16 +143,30 @@ dependencies = [
[[package]]
name = "ffmpeg-sys-next"
version = "6.0.1"
-source = "git+https://github.com/remotion-dev/rust-ffmpeg-sys?rev=eed7d621d5e1517471ca49daf70d7e00c6322ad7#eed7d621d5e1517471ca49daf70d7e00c6322ad7"
+source = "git+https://github.com/remotion-dev/rust-ffmpeg-sys?rev=ca1148d571c841e262cfd199f0fcb8bb1ddc3720#ca1148d571c841e262cfd199f0fcb8bb1ddc3720"
dependencies = [
"bindgen",
"cc",
+ "flate2",
"libc",
"num_cpus",
"pkg-config",
+ "tar",
"vcpkg",
]
+[[package]]
+name = "filetime"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "windows-sys",
+]
+
[[package]]
name = "flate2"
version = "1.0.25"
@@ -341,6 +355,15 @@ dependencies = [
"num_cpus",
]
+[[package]]
+name = "redox_syscall"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
+dependencies = [
+ "bitflags",
+]
+
[[package]]
name = "regex"
version = "1.7.3"
@@ -447,6 +470,17 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "tar"
+version = "0.4.38"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6"
+dependencies = [
+ "filetime",
+ "libc",
+ "xattr",
+]
+
[[package]]
name = "unicode-ident"
version = "1.0.8"
@@ -480,3 +514,78 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
+
+[[package]]
+name = "xattr"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc"
+dependencies = [
+ "libc",
+]
diff --git a/packages/Cargo.toml b/packages/Cargo.toml
index 70171da2de..1fc5203ba2 100644
--- a/packages/Cargo.toml
+++ b/packages/Cargo.toml
@@ -15,7 +15,7 @@ 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 ="1c0581b7b1fb762c71ff7750324356c25ade9f1d"}
+ffmpeg-next = {git = "https://github.com/JonnyBurger/rust-ffmpeg", rev ="a3924db17d5da602b97a3202ba8e1d8f4d8a53f9"}
[[bin]]
name = "compositor"
diff --git a/packages/compositor-darwin-arm64/compositor b/packages/compositor-darwin-arm64/compositor
index 59df19b14b..a694680de3 100755
Binary files a/packages/compositor-darwin-arm64/compositor and b/packages/compositor-darwin-arm64/compositor differ
diff --git a/packages/compositor-darwin-x64/compositor b/packages/compositor-darwin-x64/compositor
index 2dde88c2ab..e1d5f51ff1 100755
Binary files a/packages/compositor-darwin-x64/compositor and b/packages/compositor-darwin-x64/compositor differ
diff --git a/packages/compositor-linux-arm64-gnu/compositor b/packages/compositor-linux-arm64-gnu/compositor
index 8b822c5e8f..13fb95a4a9 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-arm64-musl/compositor b/packages/compositor-linux-arm64-musl/compositor
index 35a3ca490f..64ea9f1522 100755
Binary files a/packages/compositor-linux-arm64-musl/compositor and b/packages/compositor-linux-arm64-musl/compositor differ
diff --git a/packages/compositor-linux-x64-gnu/compositor b/packages/compositor-linux-x64-gnu/compositor
index fe174d6508..c8017118ad 100755
Binary files a/packages/compositor-linux-x64-gnu/compositor and b/packages/compositor-linux-x64-gnu/compositor differ
diff --git a/packages/compositor-linux-x64-musl/compositor b/packages/compositor-linux-x64-musl/compositor
index 613094ee4d..b4afd42cf7 100755
Binary files a/packages/compositor-linux-x64-musl/compositor and b/packages/compositor-linux-x64-musl/compositor differ
diff --git a/packages/compositor-win32-x64-msvc/compositor.exe b/packages/compositor-win32-x64-msvc/compositor.exe
index 80c1bc9849..25ad684a3d 100755
Binary files a/packages/compositor-win32-x64-msvc/compositor.exe and b/packages/compositor-win32-x64-msvc/compositor.exe differ
diff --git a/packages/renderer/build.mjs b/packages/renderer/build.mjs
index 43105c249a..31159a48d8 100644
--- a/packages/renderer/build.mjs
+++ b/packages/renderer/build.mjs
@@ -168,7 +168,6 @@ for (const arch of archs) {
execSync(
`tar xf ffmpeg/${copyDestinations[arch].ffmpeg_bin} -C ${ffmpegFolder}`
);
- const link = path.join(process.cwd(), ffmpegFolder, 'remotion', 'include');
const command = `cargo build ${debug ? '' : '--release'} --target=${arch}`;
console.log(command);
execSync(command, {
@@ -180,17 +179,6 @@ for (const arch of archs) {
copyDestinations[arch].dir,
'ffmpeg'
),
- CPATH:
- arch === 'aarch64-apple-darwin'
- ? '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include'
- : undefined,
- RUSTFLAGS: `-L ${link}`,
- FFMPEG_DIR: path.join(
- process.cwd(),
- copyDestinations[arch].dir,
- 'ffmpeg',
- 'remotion'
- ),
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER:
nativeArch === 'aarch64-unknown-linux-gnu'
? undefined
@@ -250,16 +238,12 @@ for (const arch of archs) {
}
}
- rmSync(path.join(libDir, 'pkgconfig'), {recursive: true});
rmSync(path.join(copyDestinations[arch].dir, 'ffmpeg', 'remotion', 'share'), {
recursive: true,
});
- rmSync(
- path.join(copyDestinations[arch].dir, 'ffmpeg', 'remotion', 'include'),
- {
- recursive: true,
- }
- );
+ rmSync(path.join(copyDestinations[arch].dir, 'ffmpeg', 'bindings.rs'), {
+ recursive: true,
+ });
copyFileSync(copyInstructions.from, copyInstructions.to);
const output = execSync('npm pack --json', {