Skip to content

🎥 Make videos programmatically with React

derive image format

Jonny Burger62a6f316cda5
diff --git a/packages/cli/src/determine-image-format.ts b/packages/cli/src/determine-image-format.ts
index 63877a1c69..4015233808 100644
--- a/packages/cli/src/determine-image-format.ts
+++ b/packages/cli/src/determine-image-format.ts
@@ -24,13 +24,19 @@ export const determineFinalImageFormat = ({
configImageFormat,
cliFlag,
isLambda,
+ fromUi,
}: {
downloadName: string | null;
outName: string | null;
configImageFormat: ImageFormat | null;
cliFlag: ImageFormat | null;
isLambda: boolean;
+ fromUi: StillImageFormat | null;
}): {format: StillImageFormat; source: string} => {
+ if (fromUi) {
+ return {format: fromUi, source: 'Specified via UI'};
+ }
+
const outNameExtension = deriveExtensionFromFilename(outName);
const downloadNameExtension = deriveExtensionFromFilename(downloadName);
diff --git a/packages/cli/src/preview-server/render-queue/process-still.ts b/packages/cli/src/preview-server/render-queue/process-still.ts
index 12699da4ff..5c094c1e8a 100644
--- a/packages/cli/src/preview-server/render-queue/process-still.ts
+++ b/packages/cli/src/preview-server/render-queue/process-still.ts
@@ -41,7 +41,6 @@ export const processStill = async ({
browserExecutable,
chromiumOptions,
entryPointReason: 'from preview',
- entryPoint,
envVariables,
ffmpegExecutable,
ffprobeExecutable,
@@ -58,6 +57,7 @@ export const processStill = async ({
stillFrame: job.frame,
width: null,
compositionIdFromUi: job.compositionId,
+ imageFormatFromUi: job.imageFormat,
});
// TODO: Write download progress to CLI
// TODO: Allow cancel signal
diff --git a/packages/cli/src/render-flows/still.ts b/packages/cli/src/render-flows/still.ts
index fdabda76b7..9cb599b74b 100644
--- a/packages/cli/src/render-flows/still.ts
+++ b/packages/cli/src/render-flows/still.ts
@@ -6,6 +6,7 @@ import type {
ChromiumOptions,
FfmpegExecutable,
RenderMediaOnDownload,
+ StillImageFormat,
} from '@remotion/renderer';
import {
getCompositions,
@@ -57,10 +58,10 @@ export const renderStillFlow = async ({
stillFrame,
width,
compositionIdFromUi,
+ imageFormatFromUi,
}: {
remotionRoot: string;
fullEntryPoint: string;
- entryPoint: string | null;
entryPointReason: string;
remainingArgs: string[];
inputProps: object;
@@ -80,6 +81,7 @@ export const renderStillFlow = async ({
height: number | null;
width: number | null;
compositionIdFromUi: string | null;
+ imageFormatFromUi: StillImageFormat | null;
}) => {
const startTime = Date.now();
@@ -130,12 +132,12 @@ export const renderStillFlow = async ({
compositionIdFromUi,
});
const {format: imageFormat, source} = determineFinalImageFormat({
- // TODO: Should factor in browser
cliFlag: parsedCli['image-format'] ?? null,
configImageFormat: ConfigInternals.getUserPreferredImageFormat() ?? null,
downloadName: null,
outName: getUserPassedOutputLocation(argsAfterComposition),
isLambda: false,
+ fromUi: imageFormatFromUi,
});
const relativeOutputLocation = getOutputLocation({
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index b21bb9802b..7ee3db1595 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -57,7 +57,6 @@ export const still = async (remotionRoot: string, args: string[]) => {
remotionRoot,
entryPointReason,
fullEntryPoint: fullPath,
- entryPoint: file,
remainingArgs,
browser,
browserExecutable,
@@ -76,5 +75,6 @@ export const still = async (remotionRoot: string, args: string[]) => {
stillFrame,
width,
compositionIdFromUi: null,
+ imageFormatFromUi: null,
});
};