Fix invalid crop region for rotated video samples (fixes #151)

This commit is contained in:
Vanilagy
2025-09-26 16:31:24 +02:00
parent be151d3494
commit a1008b8088
2 changed files with 7 additions and 6 deletions
+5 -4
View File
@@ -24,7 +24,7 @@
chunked: true,
chunkSize: 2**20
});
const outputFormat = new Mediabunny.Mp3OutputFormat({});
const outputFormat = new Mediabunny.Mp4OutputFormat({});
const button = document.createElement('button');
button.textContent = 'Cancel';
@@ -92,6 +92,7 @@
},
*/
video: () => ({
width: 300,
//alpha: 'keep',
//width: 320,
//discard: true,
@@ -128,7 +129,7 @@
//width: 200,
//height: 100,
}),
tags: {
tags: {} ?? {
title: 'Bigggy',
artist: 'Buck Bunny',
images: [{
@@ -146,8 +147,8 @@
}
},
trim: {
start: 10,
//end: 20
start: 0,
end: 10
},
});
console.log(conversion);
+2 -2
View File
@@ -620,8 +620,8 @@ export class VideoSample implements Disposable {
const { sx, sy, sWidth, sHeight } = this._rotateSourceRegion(
options.crop?.left ?? 0,
options.crop?.top ?? 0,
options.crop?.width ?? this.codedWidth,
options.crop?.height ?? this.codedHeight,
options.crop?.width ?? rotatedWidth,
options.crop?.height ?? rotatedHeight,
rotation,
);