Skip to content

🎥 Make videos programmatically with React

add failing test

Jonny Burgerb8f8f511958f
diff --git a/packages/example/public/custom-dar.mp4 b/packages/example/public/custom-dar.mp4
new file mode 100644
index 0000000000..49ce6a16a7
Binary files /dev/null and b/packages/example/public/custom-dar.mp4 differ
diff --git a/packages/renderer/src/test/extract-frame-rust.test.ts b/packages/renderer/src/test/extract-frame-rust.test.ts
index 7f202e6a76..fc70549023 100644
--- a/packages/renderer/src/test/extract-frame-rust.test.ts
+++ b/packages/renderer/src/test/extract-frame-rust.test.ts
@@ -120,7 +120,7 @@ test(
{timeout: 10000}
);
-test.only(
+test(
'Should get the last frame of a corrupted video',
async () => {
const compositor = startCompositor('StartLongRunningProcess', {});
@@ -150,6 +150,36 @@ test.only(
{timeout: 5000}
);
+test.only('Should be able to extract a frame with abnormal DAR', async () => {
+ const compositor = startCompositor('StartLongRunningProcess', {});
+
+ const input = path.join(
+ __dirname,
+ '..',
+ '..',
+ '..',
+ 'example',
+ 'public',
+ 'custom-dar.mp4'
+ );
+
+ const data = await compositor.executeCommand('ExtractFrame', {
+ input,
+ time: 3.33,
+ });
+
+ const header = data.slice(0, BMP_HEADER_SIZE);
+
+ const width = header.readInt32LE(18); // Read the width from position 18
+ const height = header.readInt32LE(22); // Read the height from position 22
+
+ expect(width).toBe(720);
+ expect(height).toBe(1280);
+
+ compositor.finishCommands();
+ await compositor.waitForDone();
+});
+
test('Last frame should be fast', async () => {
const compositor = startCompositor('StartLongRunningProcess', {});