Skip to content

🎥 Make videos programmatically with React

updated all tests with ffprobe

Patric Salvisbergb034b48e9e42
diff --git a/packages/it-tests/src/rendering/base64-audio.test.ts b/packages/it-tests/src/rendering/base64-audio.test.ts
index a051385c52..8e82d8a518 100644
--- a/packages/it-tests/src/rendering/base64-audio.test.ts
+++ b/packages/it-tests/src/rendering/base64-audio.test.ts
@@ -2,6 +2,7 @@ import { beforeEach, expect, test } from "vitest";
import path from "path";
import fs from "fs";
import execa from "execa";
+import { getExecutableFfprobe } from "@remotion/renderer/dist/ffmpeg-flags";
const outputPath = path.join(process.cwd(), "packages/example/out.mp3");
@@ -31,7 +32,9 @@ test("Should be able to render a MP3 audio file", async () => {
const exists = fs.existsSync(outputPath);
expect(exists).toBe(true);
- const info = await execa("ffprobe", [outputPath]);
+ const info = await execa(await getExecutableFfprobe(null, process.cwd()), [
+ outputPath,
+ ]);
const data = info.stderr;
expect(data).toContain("mp3");
expect(data).toContain("stereo");
diff --git a/packages/it-tests/src/rendering/render-scale.test.ts b/packages/it-tests/src/rendering/render-scale.test.ts
index 0f469dacc0..ef688b94e7 100644
--- a/packages/it-tests/src/rendering/render-scale.test.ts
+++ b/packages/it-tests/src/rendering/render-scale.test.ts
@@ -2,6 +2,7 @@ import fs from "fs";
import execa from "execa";
import path from "path";
import { beforeEach, expect, test } from "vitest";
+import { RenderInternals } from "@remotion/renderer";
const outputPath = path.join(process.cwd(), "packages/example/out.mp4");
@@ -37,7 +38,10 @@ test("Should be able to render video with scale 2", async () => {
const exists = fs.existsSync(outputPath);
expect(exists).toBe(true);
- const info = await execa("ffprobe", [outputPath]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [outputPath]
+ );
const data = info.stderr;
expect(data).toContain("Video: h264");
expect(data).toContain("yuv420p");
@@ -71,7 +75,10 @@ test("Should be able to render video with scale 0.1", async () => {
const exists = fs.existsSync(outputPath);
expect(exists).toBe(true);
- const info = await execa("ffprobe", [outputPath]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [outputPath]
+ );
const data = info.stderr;
expect(data).toContain("Video: h264");
expect(data).toContain("yuv420p");
diff --git a/packages/it-tests/src/rendering/rendering.test.ts b/packages/it-tests/src/rendering/rendering.test.ts
index a2dd2b23cd..0a9eaecb30 100644
--- a/packages/it-tests/src/rendering/rendering.test.ts
+++ b/packages/it-tests/src/rendering/rendering.test.ts
@@ -34,7 +34,10 @@ test("Should be able to render video", async () => {
const exists = fs.existsSync(outputPath);
expect(exists).toBe(true);
- const info = await execa("ffprobe", [outputPath]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [outputPath]
+ );
const data = info.stderr;
expect(data).toContain("Video: h264");
expect(data).toContain("yuv420p");
@@ -138,7 +141,10 @@ test("Should render a ProRes video", async () => {
const exists = fs.existsSync(out);
expect(exists).toBe(true);
- const info = await execa("ffprobe", [out]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [out]
+ );
const data = info.stderr;
expect(data.includes("prores (4444)") || data.includes("prores (ap4h")).toBe(
true
@@ -168,7 +174,10 @@ test("Should render a still image if single frame specified", async () => {
expect(task.exitCode).toBe(0);
expect(fs.existsSync(outImg)).toBe(true);
- const info = await execa("ffprobe", [outImg]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [outImg]
+ );
const data = info.stderr;
expect(data).toContain("Video: png");
expect(data).toContain("png_pipe");
@@ -191,7 +200,10 @@ test("Should be able to render a WAV audio file", async () => {
const exists = fs.existsSync(out);
expect(exists).toBe(true);
- const info = await execa("ffprobe", [out]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [out]
+ );
const data = info.stderr;
expect(data).toContain("pcm_s16le");
expect(data).toContain("2 channels");
@@ -216,7 +228,10 @@ test("Should be able to render a MP3 audio file", async () => {
const exists = fs.existsSync(out);
expect(exists).toBe(true);
- const info = await execa("ffprobe", [out]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [out]
+ );
const data = info.stderr;
expect(data).toContain("mp3");
expect(data).toContain("stereo");
@@ -242,7 +257,10 @@ test("Should be able to render a AAC audio file", async () => {
const exists = fs.existsSync(out);
expect(exists).toBe(true);
- const info = await execa("ffprobe", [out]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [out]
+ );
const data = info.stderr;
expect(data).toContain("aac");
expect(data).toContain("stereo");
@@ -274,7 +292,10 @@ test("Should render a video with GIFs", async () => {
expect(task.exitCode).toBe(0);
expect(fs.existsSync(outputPath)).toBe(true);
- const info = await execa("ffprobe", [outputPath]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [outputPath]
+ );
const data = info.stderr;
expect(data).toContain("Video: h264");
@@ -304,7 +325,10 @@ test("Should render a video with Offline Audio-context", async () => {
expect(task.exitCode).toBe(0);
expect(fs.existsSync(out)).toBe(true);
- const info = await execa("ffprobe", [out]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [out]
+ );
const data = info.stderr;
expect(data).toContain("Stream #0:0: Audio: mp3");
expect(data).toContain("48000 Hz, stereo");
@@ -322,7 +346,10 @@ test("Should succeed to render an audio file that doesn't have any audio inputs"
}
);
expect(task.exitCode).toBe(0);
- const info = await execa("ffprobe", [out]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [out]
+ );
const data = info.stderr;
expect(data).toContain("Duration: 00:00:00.36");
expect(data).toContain("Audio: mp3, 48000 Hz");
@@ -379,7 +406,10 @@ test("Dynamic duration should work, and render from inside src/", async () => {
expect(task.exitCode).toBe(0);
expect(fs.existsSync(outputPath)).toBe(true);
- const info = await execa("ffprobe", [outputPath]);
+ const info = await execa(
+ await RenderInternals.getExecutableFfprobe(null, process.cwd()),
+ [outputPath]
+ );
const data = info.stderr;
expect(data).toContain("Video: h264");
const expectedDuration = (randomDuration / 30).toFixed(2);
diff --git a/packages/it-tests/src/ssr/render-frames.test.ts b/packages/it-tests/src/ssr/render-frames.test.ts
index bb9ddd3d96..571803e96a 100644
--- a/packages/it-tests/src/ssr/render-frames.test.ts
+++ b/packages/it-tests/src/ssr/render-frames.test.ts
@@ -9,6 +9,7 @@ import {
} from "@remotion/renderer";
import execa from "execa";
import { expect, test } from "vitest";
+import { getExecutableFfprobe } from "@remotion/renderer/dist/ffmpeg-flags";
test("Legacy SSR way of rendering videos should still work", async () => {
const puppeteerInstance = await openBrowser("chrome");
@@ -57,7 +58,9 @@ test("Legacy SSR way of rendering videos should still work", async () => {
codec: "h264",
});
expect(fs.existsSync(outPath)).toBe(true);
- const probe = await execa("ffprobe", [outPath]);
+ const probe = await execa(await getExecutableFfprobe(null, process.cwd()), [
+ outPath,
+ ]);
expect(probe.stderr).toMatch(/Video: h264/);
await puppeteerInstance.close();
});