Skip to content

🎥 Make videos programmatically with React

almost there

Jonny Burger0aa695666d1a
diff --git a/packages/compositor-darwin-arm64/remotion b/packages/compositor-darwin-arm64/remotion
index cb619ba957..fe27aa646b 100755
Binary files a/packages/compositor-darwin-arm64/remotion and b/packages/compositor-darwin-arm64/remotion differ
diff --git a/packages/compositor-darwin-x64/remotion b/packages/compositor-darwin-x64/remotion
index 0aa496b8c5..1162ba6d56 100755
Binary files a/packages/compositor-darwin-x64/remotion and b/packages/compositor-darwin-x64/remotion differ
diff --git a/packages/compositor-linux-arm64-gnu/remotion b/packages/compositor-linux-arm64-gnu/remotion
index b2ab0bccfc..9d3c077d2a 100755
Binary files a/packages/compositor-linux-arm64-gnu/remotion and b/packages/compositor-linux-arm64-gnu/remotion differ
diff --git a/packages/compositor-linux-arm64-musl/remotion b/packages/compositor-linux-arm64-musl/remotion
index c688036c02..77b6bb98bf 100755
Binary files a/packages/compositor-linux-arm64-musl/remotion and b/packages/compositor-linux-arm64-musl/remotion differ
diff --git a/packages/compositor-linux-x64-gnu/remotion b/packages/compositor-linux-x64-gnu/remotion
index 47d1d99cb2..c486397bf8 100755
Binary files a/packages/compositor-linux-x64-gnu/remotion and b/packages/compositor-linux-x64-gnu/remotion differ
diff --git a/packages/compositor-linux-x64-musl/remotion b/packages/compositor-linux-x64-musl/remotion
index 041248dd27..a781d95325 100755
Binary files a/packages/compositor-linux-x64-musl/remotion and b/packages/compositor-linux-x64-musl/remotion differ
diff --git a/packages/compositor-win32-x64-msvc/remotion.exe b/packages/compositor-win32-x64-msvc/remotion.exe
index ac3ae30116..d0fb5b455e 100755
Binary files a/packages/compositor-win32-x64-msvc/remotion.exe and b/packages/compositor-win32-x64-msvc/remotion.exe differ
diff --git a/packages/compositor/rust/cache_references.rs b/packages/compositor/rust/cache_references.rs
index 493ca65d19..f7acc9e64e 100644
--- a/packages/compositor/rust/cache_references.rs
+++ b/packages/compositor/rust/cache_references.rs
@@ -1,6 +1,9 @@
use std::sync::Mutex;
-use crate::{errors::ErrorWithBacktrace, frame_cache::FrameCacheReference, max_cache_size};
+use crate::{
+ errors::ErrorWithBacktrace, frame_cache::FrameCacheReference, global_printer::_print_verbose,
+ max_cache_size,
+};
use lazy_static::lazy_static;
pub struct CacheReferences {
@@ -47,9 +50,15 @@ impl CacheReferences {
.lock()
.unwrap()
.get_current_cache_size();
- let bytes_to_free =
- (current_cache_size_in_bytes - maximum_frame_cache_size_in_bytes).max(0);
+ let bytes_to_free = match current_cache_size_in_bytes > maximum_frame_cache_size_in_bytes {
+ true => current_cache_size_in_bytes - maximum_frame_cache_size_in_bytes,
+ false => {
+ return Ok(Vec::new());
+ }
+ };
+
let mut removed = 0;
+ let mut removed_count = 0;
let mut to_remove: Vec<Vec<FrameCacheReference>> = vec![Vec::new(); self.map.len()];
@@ -60,12 +69,20 @@ impl CacheReferences {
continue;
}
removed += removal.size;
+ removed_count += 1;
to_remove[removal.thread_index].push(removal.clone());
if removed >= bytes_to_free {
break;
}
}
+ _print_verbose(&format!(
+ "Need to free {}MB, Selected {} frames ({}MB) for removal",
+ bytes_to_free / 1024 / 1024,
+ removed_count,
+ removed / 1024 / 1024
+ ))?;
+
Ok(to_remove)
}
}
diff --git a/packages/compositor/rust/long_running_process.rs b/packages/compositor/rust/long_running_process.rs
index 5b12dd28fd..580e84e352 100644
--- a/packages/compositor/rust/long_running_process.rs
+++ b/packages/compositor/rust/long_running_process.rs
@@ -162,8 +162,14 @@ impl LongRunningProcess {
Ok(())
}
- fn free_up_memory_command(&mut self, opts: FreeUpMemory) -> Result<(), ErrorWithBacktrace> {
+ fn free_up_memory_command(
+ &mut self,
+ opts: FreeUpMemory,
+ nonce: String,
+ ) -> Result<(), ErrorWithBacktrace> {
self.prune(opts.remaining_bytes)?;
+ global_printer::synchronized_write_buf(0, &nonce, format!("Done").as_bytes())?;
+
Ok(())
}
@@ -232,7 +238,9 @@ impl LongRunningProcess {
CliInputCommandPayload::GetOpenVideoStats(_) => {
self.get_open_video_stats_command(opts, nonce.clone())
}
- CliInputCommandPayload::FreeUpMemory(payload) => self.free_up_memory_command(payload),
+ CliInputCommandPayload::FreeUpMemory(payload) => {
+ self.free_up_memory_command(payload, nonce.clone())
+ }
CliInputCommandPayload::CloseAllVideos(_) => {
self.close_all_videos_command(opts, nonce.clone())
}
diff --git a/packages/compositor/rust/opened_stream.rs b/packages/compositor/rust/opened_stream.rs
index 256dfdfd93..df5698d8ec 100644
--- a/packages/compositor/rust/opened_stream.rs
+++ b/packages/compositor/rust/opened_stream.rs
@@ -276,7 +276,9 @@ impl OpenedStream {
}
_print_verbose(&format!(
- "Got packet dts = {:?} pts = {:?} key = {}",
+ "Thread {}, stream {} - got packet, dts = {:?} pts = {:?} key = {}",
+ thread_index,
+ stream_index,
packet.dts(),
packet.pts(),
packet.is_key()