Skip to content

🎥 Make videos programmatically with React

follow in other CLI's footsteps

Akshit Tyagidc5b465989bf
diff --git a/packages/cli/src/get-cli-options.ts b/packages/cli/src/get-cli-options.ts
index 4cac017972..8f32885e0c 100644
--- a/packages/cli/src/get-cli-options.ts
+++ b/packages/cli/src/get-cli-options.ts
@@ -243,6 +243,9 @@ export const getCliOptions = async (options: {
const concurrency = ConfigInternals.getConcurrency();
+ const height = ConfigInternals.getHeight();
+ const width = ConfigInternals.getWidth();
+
RenderInternals.validateConcurrency(concurrency, 'concurrency');
return {
@@ -274,8 +277,8 @@ export const getCliOptions = async (options: {
publicDir: ConfigInternals.getPublicDir(),
ffmpegOverride: ConfigInternals.getFfmpegOverrideFunction(),
audioBitrate: ConfigInternals.getAudioBitrate(),
- height: ConfigInternals.getHeight(),
- width: ConfigInternals.getWidth(),
+ height,
+ width,
videoBitrate,
};
};
diff --git a/packages/cli/src/get-render-media-options.ts b/packages/cli/src/get-render-media-options.ts
index 60a59193ac..c41739402b 100644
--- a/packages/cli/src/get-render-media-options.ts
+++ b/packages/cli/src/get-render-media-options.ts
@@ -38,6 +38,8 @@ export const getRenderMediaOptions = async ({
ffmpegOverride,
audioBitrate,
videoBitrate,
+ height,
+ width,
} = await getCliOptions({
isLambda: false,
type: 'series',
@@ -81,5 +83,7 @@ export const getRenderMediaOptions = async ({
codec,
audioBitrate,
videoBitrate,
+ height,
+ width,
};
};
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index fc552a2c69..08ab8fb94e 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -86,6 +86,8 @@ export const render = async (remotionRoot: string) => {
everyNthFrame,
puppeteerTimeout,
publicDir,
+ height,
+ width,
} = await getCliOptions({
isLambda: false,
type: 'series',
@@ -184,6 +186,8 @@ export const render = async (remotionRoot: string) => {
throw new Error(`Cannot find composition with ID ${compositionId}`);
}
+
+
RenderInternals.validateEvenDimensionsWithCodec({
width: config.width,
height: config.height,
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index e9e5ae2d92..90ea92b754 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -74,6 +74,8 @@ export const renderCommand = async (args: string[]) => {
overwrite,
audioBitrate,
videoBitrate,
+ height,
+ width,
} = await CliInternals.getCliOptions({
type: 'series',
isLambda: true,
@@ -121,6 +123,8 @@ export const renderCommand = async (args: string[]) => {
overwrite,
audioBitrate,
videoBitrate,
+ height,
+ width,
webhook: parsedLambdaCli.webhook
? {
url: parsedLambdaCli.webhook,
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index 7bc86d7e82..855960f3ed 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -233,6 +233,8 @@ export type LambdaPayloads = {
overwrite: boolean;
audioBitrate: string | null;
videoBitrate: string | null;
+ height: number | undefined;
+ width: number | undefined;
webhook: WebhookOption;
};
launch: {
diff --git a/packages/lambda/src/test/integration/renders/gif.test.ts b/packages/lambda/src/test/integration/renders/gif.test.ts
index d65ce09abe..cfce72b653 100644
--- a/packages/lambda/src/test/integration/renders/gif.test.ts
+++ b/packages/lambda/src/test/integration/renders/gif.test.ts
@@ -61,6 +61,8 @@ test('Should make a distributed GIF', async () => {
webhook: null,
audioBitrate: null,
videoBitrate: null,
+ height: undefined,
+ width: undefined,
},
extraContext
);
diff --git a/packages/lambda/src/test/integration/renders/old-version.test.ts b/packages/lambda/src/test/integration/renders/old-version.test.ts
index c725bb5fac..2c87bf56f6 100644
--- a/packages/lambda/src/test/integration/renders/old-version.test.ts
+++ b/packages/lambda/src/test/integration/renders/old-version.test.ts
@@ -58,6 +58,8 @@ test('Should fail when using an incompatible version', async () => {
webhook: null,
audioBitrate: null,
videoBitrate: null,
+ height: undefined,
+ width: undefined,
},
extraContext
)
diff --git a/packages/lambda/src/test/integration/renders/other-bucket.test.ts b/packages/lambda/src/test/integration/renders/other-bucket.test.ts
index 0128bfc22f..81592ab698 100644
--- a/packages/lambda/src/test/integration/renders/other-bucket.test.ts
+++ b/packages/lambda/src/test/integration/renders/other-bucket.test.ts
@@ -64,6 +64,8 @@ test('Should be able to render to another bucket', async () => {
webhook: null,
audioBitrate: null,
videoBitrate: null,
+ height: undefined,
+ width: undefined,
},
extraContext
);
diff --git a/packages/lambda/src/test/integration/renders/silent-audio.test.ts b/packages/lambda/src/test/integration/renders/silent-audio.test.ts
index d30b755825..71d0da52a6 100644
--- a/packages/lambda/src/test/integration/renders/silent-audio.test.ts
+++ b/packages/lambda/src/test/integration/renders/silent-audio.test.ts
@@ -61,6 +61,8 @@ test('Should add silent audio if there is no audio', async () => {
webhook: null,
audioBitrate: null,
videoBitrate: null,
+ height: undefined,
+ width: undefined,
},
extraContext
);
diff --git a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
index bf6fe3ffcd..9779163382 100644
--- a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
+++ b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
@@ -64,6 +64,8 @@ test('Should make a transparent video', async () => {
webhook: null,
audioBitrate: null,
videoBitrate: null,
+ height: undefined,
+ width: undefined,
},
extraContext
);
diff --git a/packages/lambda/src/test/integration/webhooks.test.ts b/packages/lambda/src/test/integration/webhooks.test.ts
index 9574d3c552..1a26e7aa5c 100644
--- a/packages/lambda/src/test/integration/webhooks.test.ts
+++ b/packages/lambda/src/test/integration/webhooks.test.ts
@@ -100,6 +100,8 @@ describe('Webhooks', () => {
},
audioBitrate: null,
videoBitrate: null,
+ height: undefined,
+ width: undefined,
},
extraContext
);
@@ -170,6 +172,8 @@ describe('Webhooks', () => {
webhook: {url: TEST_URL, secret: 'TEST_SECRET'},
audioBitrate: null,
videoBitrate: null,
+ height: undefined,
+ width: undefined,
},
extraContext
);
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index 36863efa35..6612e81308 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -104,6 +104,8 @@ export type RenderMediaOptions = {
ffmpegOverride?: FfmpegOverrideFn;
audioBitrate?: string | null;
videoBitrate?: string | null;
+ height: number | null;
+ width: number | null;
onSlowestFrames?: OnSlowestFrames;
disallowParallelEncoding?: boolean;
} & ServeUrlOrWebpackBundle &