Skip to content

🎥 Make videos programmatically with React

add timeout

Jonny Burger05d7e7f9b5d5
diff --git a/packages/it-tests/src/rendering/render-scale.test.ts b/packages/it-tests/src/rendering/render-scale.test.ts
index a1e068e6c6..35c7ee3e2e 100644
--- a/packages/it-tests/src/rendering/render-scale.test.ts
+++ b/packages/it-tests/src/rendering/render-scale.test.ts
@@ -12,84 +12,96 @@ beforeEach(() => {
}
});
-test("Should be able to render video with scale 2", async () => {
- const task = execa(
- "pnpm",
- [
- "exec",
- "remotion",
- "render",
- "src/index.ts",
- "ten-frame-tester",
- "--frames",
- "0-1",
- "--codec",
- "h264",
- "--scale",
- "2",
- outputPath,
- ],
- {
- cwd: path.join(process.cwd(), "..", "example"),
- }
- );
- task.stderr?.pipe(process.stderr);
- await task;
- const exists = fs.existsSync(outputPath);
- expect(exists).toBe(true);
+test(
+ "Should be able to render video with scale 2",
+ async () => {
+ const task = execa(
+ "pnpm",
+ [
+ "exec",
+ "remotion",
+ "render",
+ "src/index.ts",
+ "ten-frame-tester",
+ "--frames",
+ "0-1",
+ "--codec",
+ "h264",
+ "--scale",
+ "2",
+ outputPath,
+ ],
+ {
+ cwd: path.join(process.cwd(), "..", "example"),
+ }
+ );
+ task.stderr?.pipe(process.stderr);
+ await task;
+ const exists = fs.existsSync(outputPath);
+ expect(exists).toBe(true);
- const info = await RenderInternals.callFf({
- bin: "ffprobe",
- args: [outputPath],
- indent: false,
- logLevel: "info",
- binariesDirectory: null,
- cancelSignal: undefined,
- });
- const data = info.stderr;
- expect(data).toContain("Video: h264");
- expect(data).toContain("yuv420p");
- expect(data).toContain("2160x2160");
- expect(data).toContain("30 fps");
-});
+ const info = await RenderInternals.callFf({
+ bin: "ffprobe",
+ args: [outputPath],
+ indent: false,
+ logLevel: "info",
+ binariesDirectory: null,
+ cancelSignal: undefined,
+ });
+ const data = info.stderr;
+ expect(data).toContain("Video: h264");
+ expect(data).toContain("yuv420p");
+ expect(data).toContain("2160x2160");
+ expect(data).toContain("30 fps");
+ },
+ {
+ timeout: 30000,
+ }
+);
-test("Should be able to render video with scale 0.1", async () => {
- const task = execa(
- "pnpm",
- [
- "exec",
- "remotion",
- "render",
- "src/index.ts",
- "ten-frame-tester",
- "--frames",
- "0-1",
- "--codec",
- "h264",
- "--scale",
- "0.1",
- outputPath,
- ],
- {
- cwd: path.join(process.cwd(), "..", "example"),
- }
- );
- task.stderr?.pipe(process.stderr);
- await task;
- const exists = fs.existsSync(outputPath);
- expect(exists).toBe(true);
+test(
+ "Should be able to render video with scale 0.1",
+ async () => {
+ const task = execa(
+ "pnpm",
+ [
+ "exec",
+ "remotion",
+ "render",
+ "src/index.ts",
+ "ten-frame-tester",
+ "--frames",
+ "0-1",
+ "--codec",
+ "h264",
+ "--scale",
+ "0.1",
+ outputPath,
+ ],
+ {
+ cwd: path.join(process.cwd(), "..", "example"),
+ }
+ );
+ task.stderr?.pipe(process.stderr);
+ await task;
+ const exists = fs.existsSync(outputPath);
+ expect(exists).toBe(true);
- const info = await RenderInternals.callFf({
- bin: "ffprobe",
- args: [outputPath],
- indent: false,
- logLevel: "info",
- binariesDirectory: null,
- cancelSignal: undefined,
- });
- const data = info.stderr;
- expect(data).toContain("Video: h264");
- expect(data).toContain("yuv420p");
- expect(data).toContain("108x108");
- expect(data).toContain("30 fps");
-});
+ const info = await RenderInternals.callFf({
+ bin: "ffprobe",
+ args: [outputPath],
+ indent: false,
+ logLevel: "info",
+ binariesDirectory: null,
+ cancelSignal: undefined,
+ });
+ const data = info.stderr;
+ expect(data).toContain("Video: h264");
+ expect(data).toContain("yuv420p");
+ expect(data).toContain("108x108");
+ expect(data).toContain("30 fps");
+ },
+ {
+ timeout: 30000,
+ }
+);
diff --git a/packages/it-tests/src/rendering/rendering.test.ts b/packages/it-tests/src/rendering/rendering.test.ts
index b408a420b5..29be959f24 100644
--- a/packages/it-tests/src/rendering/rendering.test.ts
+++ b/packages/it-tests/src/rendering/rendering.test.ts
@@ -233,37 +233,43 @@ test("Should render a still image if single frame specified", async () => {
});
});
-test("Should be able to render a WAV audio file", async () => {
- const out = outputPath.replace("mp4", "wav");
- const task = execa(
- "pnpm",
- ["exec", "remotion", "render", "build", "audio-testing", out],
- {
- cwd: path.join(process.cwd(), "..", "example"),
- }
- );
- task.stderr?.pipe(process.stderr);
- await task;
- const exists = fs.existsSync(out);
- expect(exists).toBe(true);
+test(
+ "Should be able to render a WAV audio file",
+ async () => {
+ const out = outputPath.replace("mp4", "wav");
+ const task = execa(
+ "pnpm",
+ ["exec", "remotion", "render", "build", "audio-testing", out],
+ {
+ cwd: path.join(process.cwd(), "..", "example"),
+ }
+ );
+ task.stderr?.pipe(process.stderr);
+ await task;
+ const exists = fs.existsSync(out);
+ expect(exists).toBe(true);
- const info = await RenderInternals.callFf({
- bin: "ffprobe",
- args: [out],
- indent: false,
- logLevel: "info",
- binariesDirectory: null,
- cancelSignal: undefined,
- });
- const data = info.stderr;
- expect(data).toContain("pcm_s16le");
- expect(data).toContain("2 channels");
- expect(data).toContain("Kevin MacLeod");
- expect(data).toMatch(/bitrate: 15\d\d kb/);
- expect(data).toContain("Stream #0");
- expect(data).not.toContain("Stream #1");
- fs.unlinkSync(out);
-});
+ const info = await RenderInternals.callFf({
+ bin: "ffprobe",
+ args: [out],
+ indent: false,
+ logLevel: "info",
+ binariesDirectory: null,
+ cancelSignal: undefined,
+ });
+ const data = info.stderr;
+ expect(data).toContain("pcm_s16le");
+ expect(data).toContain("2 channels");
+ expect(data).toContain("Kevin MacLeod");
+ expect(data).toMatch(/bitrate: 15\d\d kb/);
+ expect(data).toContain("Stream #0");
+ expect(data).not.toContain("Stream #1");
+ fs.unlinkSync(out);
+ },
+ {
+ timeout: 30000,
+ }
+);
test(
"Should be able to render a MP3 audio file",
@@ -301,91 +307,117 @@ test(
{ timeout: 30000 }
);
-test("Should be able to render a AAC audio file", async () => {
- const out = outputPath.replace("mp4", "aac");
- const task = execa(
- "pnpm",
- ["exec", "remotion", "render", "build", "audio-testing", out],
- {
- cwd: path.join(process.cwd(), "..", "example"),
- }
- );
- task.stderr?.pipe(process.stderr);
- await task;
- const exists = fs.existsSync(out);
- expect(exists).toBe(true);
+test(
+ "Should be able to render a AAC audio file",
+ async () => {
+ const out = outputPath.replace("mp4", "aac");
+ const task = execa(
+ "pnpm",
+ ["exec", "remotion", "render", "build", "audio-testing", out],
+ {
+ cwd: path.join(process.cwd(), "..", "example"),
+ }
+ );
+ task.stderr?.pipe(process.stderr);
+ await task;
+ const exists = fs.existsSync(out);
+ expect(exists).toBe(true);
- const info = await RenderInternals.callFf({
- bin: "ffprobe",
- args: [out],
- indent: false,
- logLevel: "info",
- binariesDirectory: null,
- cancelSignal: undefined,
- });
- const data = info.stderr;
- expect(data).toContain("aac");
- expect(data).toContain("stereo");
- expect(data).not.toContain("Kevin MacLeod");
- expect(data).toMatch(/\d?\d kb\/s/);
- expect(data).toContain("Stream #0");
- expect(data).not.toContain("Stream #1");
- fs.unlinkSync(out);
-});
+ const info = await RenderInternals.callFf({
+ bin: "ffprobe",
+ args: [out],
+ indent: false,
+ logLevel: "info",
+ binariesDirectory: null,
+ cancelSignal: undefined,
+ });
+ const data = info.stderr;
+ expect(data).toContain("aac");
+ expect(data).toContain("stereo");
+ expect(data).not.toContain("Kevin MacLeod");
+ expect(data).toMatch(/\d?\d kb\/s/);
+ expect(data).toContain("Stream #0");
+ expect(data).not.toContain("Stream #1");
+ fs.unlinkSync(out);
+ },
+ {
+ timeout: 30000,
+ }
+);
-test("Should render a video with GIFs", async () => {
- const task = await execa(
- "pnpm",
- ["exec", "remotion", "render", "build", "gif", "--frames=0-47", outputPath],
- {
- cwd: path.join(process.cwd(), "..", "example"),
- }
- );
- expect(task.exitCode).toBe(0);
- expect(fs.existsSync(outputPath)).toBe(true);
+test(
+ "Should render a video with GIFs",
+ async () => {
+ const task = await execa(
+ "pnpm",
+ [
+ "exec",
+ "remotion",
+ "render",
+ "build",
+ "gif",
+ "--frames=0-47",
+ outputPath,
+ ],
+ {
+ cwd: path.join(process.cwd(), "..", "example"),
+ }
+ );
+ expect(task.exitCode).toBe(0);
+ expect(fs.existsSync(outputPath)).toBe(true);
- const info = await RenderInternals.callFf({
- bin: "ffprobe",
- args: [outputPath],
- indent: false,
- logLevel: "info",
- binariesDirectory: null,
- cancelSignal: undefined,
- });
- const data = info.stderr;
- expect(data).toContain("Video: h264");
- expect(data).not.toContain("bt709");
- expect(data).toContain("Duration: 00:00:01.64");
+ const info = await RenderInternals.callFf({
+ bin: "ffprobe",
+ args: [outputPath],
+ indent: false,
+ logLevel: "info",
+ binariesDirectory: null,
+ cancelSignal: undefined,
+ });
+ const data = info.stderr;
+ expect(data).toContain("Video: h264");
+ expect(data).not.toContain("bt709");
+ expect(data).toContain("Duration: 00:00:01.64");
- fs.unlinkSync(outputPath);
-});
+ fs.unlinkSync(outputPath);
+ },
+ {
+ timeout: 30000,
+ }
+);
-test("Should render a video with Offline Audio-context", async () => {
- const out = outputPath.replace(".mp4", ".mp3");
+test(
+ "Should render a video with Offline Audio-context",
+ async () => {
+ const out = outputPath.replace(".mp4", ".mp3");
- const task = await execa(
- "pnpm",
- ["exec", "remotion", "render", "build", "offline-audio-buffer", out],
- {
- cwd: path.join(process.cwd(), "..", "example"),
- }
- );
- expect(task.exitCode).toBe(0);
- expect(fs.existsSync(out)).toBe(true);
+ const task = await execa(
+ "pnpm",
+ ["exec", "remotion", "render", "build", "offline-audio-buffer", out],
+ {
+ cwd: path.join(process.cwd(), "..", "example"),
+ }
+ );
+ expect(task.exitCode).toBe(0);
+ expect(fs.existsSync(out)).toBe(true);
- const info = await RenderInternals.callFf({
- bin: "ffprobe",
- args: [out],
- indent: false,
- logLevel: "info",
- binariesDirectory: null,
- cancelSignal: undefined,
- });
- const data = info.stderr;
- expect(data).toContain("Stream #0:0: Audio: mp3");
- expect(data).toContain("48000 Hz, stereo");
- fs.unlinkSync(out);
-});
+ const info = await RenderInternals.callFf({
+ bin: "ffprobe",
+ args: [out],
+ indent: false,
+ logLevel: "info",
+ binariesDirectory: null,
+ cancelSignal: undefined,
+ });
+ const data = info.stderr;
+ expect(data).toContain("Stream #0:0: Audio: mp3");
+ expect(data).toContain("48000 Hz, stereo");
+ fs.unlinkSync(out);
+ },
+ {
+ timeout: 30000,
+ }
+);
test("Should succeed to render an audio file that doesn't have any audio inputs", async () => {
const out = outputPath.replace(".mp4", ".mp3");