🎥 Make videos programmatically with React
Merge branch 'main' into pr/128
Jonny Burgerb402d0237081
diff --cc packages/core/src/internals.tsindex 788bfd535e,a545542b95..be8dadaac7--- a/packages/core/src/internals.ts+++ b/packages/core/src/internals.ts@@@ -92,8 -95,7 +93,9 @@@ export const Internals =validateSelectedPixelFormatAndCodecCombination,validateFrameRange,getWebpackCaching,+ truthy,+ isAudioCodec,+ INPUT_PROPS_KEY,};export type {diff --cc tests/rendering.test.tsindex a73d924308,9cbe71eec7..7065b80236--- a/tests/rendering.test.ts+++ b/tests/rendering.test.ts@@@ -258,18 -180,40 +259,56 @@@ test("Should render a video with GIFs"});});+test("Should fail to render an audio file that doesn't have any audio inputs", async () => {+ const out = outputPath.replace(".mp4", ".mp3");+ const task = await execa(+ "npx",+ ["remotion", "render", "src/index.tsx", "ten-frame-tester", out],+ {+ cwd: "packages/example",+ reject: false,+ }+ );+ expect(task.exitCode).toBe(process.platform === "win32" ? 0 : 1);+ expect(task.stderr).toContain(+ "Cannot render - you are trying to generate an audio file (mp3) but your composition doesn't contain any audio."+ );+});+++ test("Dynamic duration should work", async () => {+ const randomDuration = Math.round(+ interpolate(Math.random(), [0, 1], [2, 20])+ );+ const task = await execa(+ "npx",+ [+ "remotion",+ "render",+ "src/index.tsx",+ "dynamic-duration",+ `--props`,+ `{"duration": ${randomDuration}}`,+ outputPath,+ ],+ {+ cwd: "packages/example",+ reject: false,+ }+ );++ expect(task.exitCode).toBe(0);+ // FIXME: --props don't work well on windows, this is an edge case for example+ // In this case we should warn the user about it that they should pass a file path instead+ expect(fs.existsSync(outputPath)).toBe(process.platform !== "win32");++ if (process.platform !== "win32") {+ const info = await execa("ffprobe", [outputPath]);+ const data = info.stderr;+ expect(data).toContain("Video: h264");+ const expectedDuration = (randomDuration / 30).toFixed(2);+ expect(data).toContain(`Duration: 00:00:0${expectedDuration}`);+ fs.rmdirSync(outputPath, {+ recursive: true,+ });+ }+ });