Skip to content

🎥 Make videos programmatically with React

scalable frame

Jonny Burgerdbaf95127cf7
diff --git a/packages/compositor-darwin-arm64/remotion b/packages/compositor-darwin-arm64/remotion
index be81a45024..0a418a8de6 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 756ad0c12b..d20eb8b1f5 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 d68cdc502e..f5dcf2cb83 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 82e7e0e830..55ec5feb7a 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 46c36cacf0..8a35eea41d 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 7f319c2317..010acd2304 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 e53fad5585..707293925b 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/renderer/rust/scalable_frame.rs b/packages/renderer/rust/scalable_frame.rs
index fa24a9c314..54fc7327ea 100644
--- a/packages/renderer/rust/scalable_frame.rs
+++ b/packages/renderer/rust/scalable_frame.rs
@@ -138,12 +138,7 @@ impl ScalableFrame {
}
}
-fn create_bmp_image_from_frame(
- rgb_frame: &[u8],
- width: u32,
- height: u32,
- stride: usize,
-) -> Vec<u8> {
+fn create_bmp_image_from_frame(rgb_frame: &[u8], width: u32, height: u32) -> Vec<u8> {
let row_size = (width * 3 + 3) & !3;
let row_padding = row_size - width * 3;
let image_size = row_size * height;
@@ -170,7 +165,7 @@ fn create_bmp_image_from_frame(
bmp_data.extend(&0u32.to_le_bytes());
for y in (0..height).rev() {
- let row_start = (y as usize) * stride;
+ let row_start = (y * width) as usize;
let row_end = row_start + (width * 3) as usize;
bmp_data.extend_from_slice(&rgb_frame[row_start..row_end]);
for _ in 0..row_padding {
@@ -231,7 +226,7 @@ pub fn scale_and_make_bitmap(
false => 3,
} as usize;
- let (rotated, rotated_width, rotated_height, stride) = match native_frame.rotate {
+ let (rotated, rotated_width, rotated_height) = match native_frame.rotate {
Rotate::Rotate90 => rotate_90(
scaled.data(0),
native_frame.scaled_width,
@@ -275,7 +270,6 @@ pub fn scale_and_make_bitmap(
&rotated,
rotated_width,
rotated_height,
- stride,
));
}
}
@@ -284,7 +278,6 @@ pub fn scale_and_make_bitmap(
&rotated,
rotated_width,
rotated_height,
- stride,
))
}
@@ -294,8 +287,9 @@ pub fn rotate_270(
height: u32,
stride: usize,
channels: usize,
-) -> (Vec<u8>, u32, u32, usize) {
- let new_stride = (height as usize * channels + channels) & !channels; // This ensures the new stride is a multiple of 4 for alignment
+) -> (Vec<u8>, u32, u32) {
+ let new_stride = height as usize * channels;
+ _print_verbose(&format!("stride {} {}", stride, data.len()));
let mut new_data: Vec<u8> = vec![0; new_stride * width as usize];
for y in 0..height {
@@ -309,7 +303,7 @@ pub fn rotate_270(
}
}
- (new_data, height, width, new_stride)
+ (new_data, height, width)
}
pub fn rotate_0(
@@ -318,10 +312,10 @@ pub fn rotate_0(
height: u32,
stride: usize,
channels: usize,
-) -> (Vec<u8>, u32, u32, usize) {
+) -> (Vec<u8>, u32, u32) {
let new_stride = width as usize * channels;
if new_stride == stride {
- return (data.to_vec(), width, height, stride);
+ return (data.to_vec(), width, height);
}
let mut new_data: Vec<u8> = vec![0; new_stride * height as usize];
@@ -335,7 +329,7 @@ pub fn rotate_0(
}
}
- (new_data, width, height, new_stride)
+ (new_data, width, height)
}
pub fn rotate_180(
@@ -344,7 +338,7 @@ pub fn rotate_180(
height: u32,
stride: usize,
channels: usize,
-) -> (Vec<u8>, u32, u32, usize) {
+) -> (Vec<u8>, u32, u32) {
let mut new_data: Vec<u8> = vec![0; stride * height as usize];
for y in 0..height {
@@ -358,7 +352,7 @@ pub fn rotate_180(
}
}
- (new_data, width, height, stride)
+ (new_data, width, height)
}
pub fn rotate_90(
@@ -367,7 +361,7 @@ pub fn rotate_90(
height: u32,
stride: usize,
channels: usize,
-) -> (Vec<u8>, u32, u32, usize) {
+) -> (Vec<u8>, u32, u32) {
let new_stride = height as usize * channels;
let mut new_data: Vec<u8> = vec![0; new_stride * width as usize];
@@ -382,5 +376,5 @@ pub fn rotate_90(
}
}
- (new_data, height, width, new_stride)
+ (new_data, height, width)
}