Skip to content

🎥 Make videos programmatically with React

fix still using default output name

Jonny Burger39ab08c57f14
diff --git a/packages/cli/src/get-filename.ts b/packages/cli/src/get-filename.ts
index d7d83df5f7..691210b9cb 100644
--- a/packages/cli/src/get-filename.ts
+++ b/packages/cli/src/get-filename.ts
@@ -29,6 +29,7 @@ export const getOutputFilename = ({
defaultExtension,
args,
type: imageSequence ? 'sequence' : 'asset',
+ outputLocationFromUi: null,
});
const extension = RenderInternals.getExtensionOfFilename(filename);
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 0dffc00d21..0d97b288a9 100644
--- a/packages/cli/src/preview-server/render-queue/process-still.ts
+++ b/packages/cli/src/preview-server/render-queue/process-still.ts
@@ -55,5 +55,6 @@ export const processStill = async ({
indentOutput: true,
addCleanupCallback,
cancelSignal: job.cancelToken.cancelSignal,
+ outputLocationFromUi: job.outName,
});
};
diff --git a/packages/cli/src/render-flows/render.ts b/packages/cli/src/render-flows/render.ts
index 1501e5438b..dc71d7d9f9 100644
--- a/packages/cli/src/render-flows/render.ts
+++ b/packages/cli/src/render-flows/render.ts
@@ -274,7 +274,10 @@ export const renderVideoFlow = async ({
cliFlag: parsedCli.codec,
configFile: ConfigInternals.getOutputCodecOrUndefined() ?? null,
downloadName: null,
- outName: getUserPassedOutputLocation(argsAfterComposition),
+ outName: getUserPassedOutputLocation(
+ argsAfterComposition,
+ outputLocationFromUI
+ ),
uiCodec,
});
diff --git a/packages/cli/src/render-flows/still.ts b/packages/cli/src/render-flows/still.ts
index 3318fb769b..305ae6065f 100644
--- a/packages/cli/src/render-flows/still.ts
+++ b/packages/cli/src/render-flows/still.ts
@@ -66,6 +66,7 @@ export const renderStillFlow = async ({
indentOutput,
addCleanupCallback,
cancelSignal,
+ outputLocationFromUi,
}: {
remotionRoot: string;
fullEntryPoint: string;
@@ -92,6 +93,7 @@ export const renderStillFlow = async ({
indentOutput: boolean;
addCleanupCallback: (cb: () => void) => void;
cancelSignal: CancelSignal | null;
+ outputLocationFromUi: string | null;
}) => {
const downloads: DownloadProgress[] = [];
@@ -192,7 +194,10 @@ export const renderStillFlow = async ({
configImageFormat:
ConfigInternals.getUserPreferredStillImageFormat() ?? null,
downloadName: null,
- outName: getUserPassedOutputLocation(argsAfterComposition),
+ outName: getUserPassedOutputLocation(
+ argsAfterComposition,
+ outputLocationFromUi
+ ),
isLambda: false,
fromUi: imageFormatFromUi,
});
@@ -202,6 +207,7 @@ export const renderStillFlow = async ({
defaultExtension: imageFormat,
args: argsAfterComposition,
type: 'asset',
+ outputLocationFromUi,
});
const absoluteOutputLocation = getAndValidateAbsoluteOutputFile(
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index 9174befec5..92018d1d21 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -81,5 +81,6 @@ export const still = async (remotionRoot: string, args: string[]) => {
registerCleanupJob(c);
},
cancelSignal: null,
+ outputLocationFromUi: null,
});
};
diff --git a/packages/cli/src/user-passed-output-location.ts b/packages/cli/src/user-passed-output-location.ts
index 5a8eed6c77..b37ca88332 100644
--- a/packages/cli/src/user-passed-output-location.ts
+++ b/packages/cli/src/user-passed-output-location.ts
@@ -2,9 +2,15 @@ import {ConfigInternals} from './config';
import {getDefaultOutLocation} from './get-default-out-name';
import {parsedCli} from './parse-command-line';
-export const getUserPassedOutputLocation = (args: string[]) => {
+export const getUserPassedOutputLocation = (
+ args: string[],
+ uiPassedOutName: string | null
+) => {
const filename =
- args[0] ?? parsedCli.output ?? ConfigInternals.getOutputLocation();
+ uiPassedOutName ??
+ args[0] ??
+ parsedCli.output ??
+ ConfigInternals.getOutputLocation();
return filename;
};
@@ -14,8 +20,10 @@ export const getOutputLocation = ({
defaultExtension,
args,
type,
+ outputLocationFromUi,
}: {
compositionId: string;
+ outputLocationFromUi: string | null;
defaultExtension: string;
args: string[];
type: 'asset' | 'sequence';
@@ -30,7 +38,7 @@ export const getOutputLocation = ({
}
return (
- getUserPassedOutputLocation(args) ??
+ getUserPassedOutputLocation(args, outputLocationFromUi) ??
getDefaultOutLocation({
compositionName: compositionId,
defaultExtension,