Skip to content

🎥 Make videos programmatically with React

aha

Jonny Burger1829325738ad
diff --git a/packages/cli/src/get-composition-with-dimension-override.ts b/packages/cli/src/get-composition-with-dimension-override.ts
index 6099f07693..9a62e493a4 100644
--- a/packages/cli/src/get-composition-with-dimension-override.ts
+++ b/packages/cli/src/get-composition-with-dimension-override.ts
@@ -29,12 +29,12 @@ export const getCompositionWithDimensionOverride = async ({
args: string[];
compositionIdFromUi: string | null;
timeoutInMilliseconds: number;
- puppeteerInstance: HeadlessBrowser;
+ puppeteerInstance: HeadlessBrowser | undefined;
envVariables: Record<string, string>;
chromiumOptions: ChromiumOptions;
port: number | null;
browserExecutable: BrowserExecutable | null;
- downloadMap: DownloadMap;
+ downloadMap: DownloadMap | undefined;
serveUrlOrWebpackUrl: string;
indent: boolean;
verbose: boolean;
diff --git a/packages/cli/src/index.tsx b/packages/cli/src/index.tsx
index 7db878590e..038f92c4fe 100644
--- a/packages/cli/src/index.tsx
+++ b/packages/cli/src/index.tsx
@@ -11,6 +11,7 @@ import {findEntryPoint} from './entry-point';
import {ffmpegCommand, ffprobeCommand} from './ffmpeg';
import {formatBytes} from './format-bytes';
import {getCliOptions} from './get-cli-options';
+import {getCompositionWithDimensionOverride} from './get-composition-with-dimension-override';
import {loadConfig} from './get-config-file-name';
import {getFinalOutputCodec} from './get-final-output-codec';
import {handleCommonError} from './handle-common-errors';
@@ -27,7 +28,6 @@ import {printHelp} from './print-help';
import {createOverwriteableCliOutput} from './progress-bar';
import {render} from './render';
import {shouldUseNonOverlayingLogger} from './should-use-non-overlaying-logger';
-import {showSingleCompositionsPicker} from './show-compositions-picker';
import {still} from './still';
import {upgrade} from './upgrade';
import {
@@ -120,11 +120,11 @@ export const CliInternals = {
getFileSizeDownloadBar,
determineFinalStillImageFormat,
minimist,
- showSingleCompositionsPicker,
findEntryPoint,
getVideoImageFormat,
printCompositions,
getFinalOutputCodec,
listOfRemotionPackages,
shouldUseNonOverlayingLogger,
+ getCompositionWithDimensionOverride,
};
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index 7d6b9e6268..d3df42cecf 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -1,6 +1,6 @@
import {CliInternals} from '@remotion/cli';
import {ConfigInternals} from '@remotion/cli/config';
-import {getCompositions, RenderInternals} from '@remotion/renderer';
+import {RenderInternals} from '@remotion/renderer';
import {downloadMedia} from '../../../api/download-media';
import {getRenderProgress} from '../../../api/get-render-progress';
import {renderMediaOnLambda} from '../../../api/render-media-on-lambda';
@@ -42,29 +42,6 @@ export const renderCommand = async (args: string[], remotionRoot: string) => {
const region = getAwsRegion();
- let composition: string = args[1];
- if (!composition) {
- Log.info('No compositions passed. Fetching compositions...');
-
- validateServeUrl(serveUrl);
- const comps = await getCompositions(serveUrl);
- const {compositionId} = await CliInternals.showSingleCompositionsPicker(
- comps
- );
- composition = compositionId;
- }
-
- const outName = parsedLambdaCli['out-name'];
- const downloadName = args[2] ?? null;
-
- const {codec, reason} = CliInternals.getFinalOutputCodec({
- cliFlag: CliInternals.parsedCli.codec,
- downloadName,
- outName: outName ?? null,
- configFile: ConfigInternals.getOutputCodecOrUndefined() ?? null,
- uiCodec: null,
- });
-
const {
chromiumOptions,
crf,
@@ -85,12 +62,51 @@ export const renderCommand = async (args: string[], remotionRoot: string) => {
videoBitrate,
height,
width,
+ browserExecutable,
+ port,
} = await CliInternals.getCliOptions({
type: 'series',
isLambda: true,
remotionRoot,
});
+ let composition: string = args[1];
+ if (!composition) {
+ Log.info('No compositions passed. Fetching compositions...');
+
+ validateServeUrl(serveUrl);
+ const {compositionId} =
+ await CliInternals.getCompositionWithDimensionOverride({
+ args,
+ compositionIdFromUi: null,
+ browserExecutable,
+ chromiumOptions,
+ downloadMap: undefined,
+ envVariables,
+ height,
+ indent: false,
+ inputProps,
+ port,
+ puppeteerInstance: undefined,
+ serveUrlOrWebpackUrl: serveUrl,
+ timeoutInMilliseconds: puppeteerTimeout,
+ verbose: RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
+ width,
+ });
+ composition = compositionId;
+ }
+
+ const outName = parsedLambdaCli['out-name'];
+ const downloadName = args[2] ?? null;
+
+ const {codec, reason} = CliInternals.getFinalOutputCodec({
+ cliFlag: CliInternals.parsedCli.codec,
+ downloadName,
+ outName: outName ?? null,
+ configFile: ConfigInternals.getOutputCodecOrUndefined() ?? null,
+ uiCodec: null,
+ });
+
const imageFormat = CliInternals.getVideoImageFormat({
codec,
uiImageFormat: null,
diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.ts
index 8cba7f768b..a1a2ca10fc 100644
--- a/packages/lambda/src/cli/commands/still.ts
+++ b/packages/lambda/src/cli/commands/still.ts
@@ -1,6 +1,6 @@
import {CliInternals} from '@remotion/cli';
import {ConfigInternals} from '@remotion/cli/config';
-import {getCompositions, RenderInternals} from '@remotion/renderer';
+import {RenderInternals} from '@remotion/renderer';
import {downloadMedia} from '../../api/download-media';
import {renderStillOnLambda} from '../../api/render-still-on-lambda';
import {
@@ -34,22 +34,6 @@ export const stillCommand = async (args: string[], remotionRoot: string) => {
quit(1);
}
- const region = getAwsRegion();
- let composition = args[1];
- if (!composition) {
- Log.info('No compositions passed. Fetching compositions...');
-
- validateServeUrl(serveUrl);
- const comps = await getCompositions(serveUrl);
- const {compositionId} = await CliInternals.showSingleCompositionsPicker(
- comps
- );
- composition = compositionId;
- }
-
- const downloadName = args[2] ?? null;
- const outName = parsedLambdaCli['out-name'];
-
const {
chromiumOptions,
envVariables,
@@ -61,12 +45,44 @@ export const stillCommand = async (args: string[], remotionRoot: string) => {
scale,
height,
width,
+ browserExecutable,
+ port,
} = await CliInternals.getCliOptions({
type: 'still',
isLambda: true,
remotionRoot,
});
+ const region = getAwsRegion();
+ let composition = args[1];
+ if (!composition) {
+ Log.info('No compositions passed. Fetching compositions...');
+
+ validateServeUrl(serveUrl);
+ const {compositionId} =
+ await CliInternals.getCompositionWithDimensionOverride({
+ args,
+ compositionIdFromUi: null,
+ indent: false,
+ serveUrlOrWebpackUrl: serveUrl,
+ verbose: RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose'),
+ browserExecutable,
+ chromiumOptions,
+ downloadMap: undefined,
+ envVariables,
+ inputProps,
+ port,
+ puppeteerInstance: undefined,
+ timeoutInMilliseconds: puppeteerTimeout,
+ height,
+ width,
+ });
+ composition = compositionId;
+ }
+
+ const downloadName = args[2] ?? null;
+ const outName = parsedLambdaCli['out-name'];
+
const functionName = await findFunctionName();
const maxRetries = parsedLambdaCli['max-retries'] ?? DEFAULT_MAX_RETRIES;