Skip to content

🎥 Make videos programmatically with React

Add frame validation back to stillFrameOption

Jonny Burgera39988142791
diff --git a/packages/renderer/src/options/still-frame.tsx b/packages/renderer/src/options/still-frame.tsx
index 1e4b332c18..172c315820 100644
--- a/packages/renderer/src/options/still-frame.tsx
+++ b/packages/renderer/src/options/still-frame.tsx
@@ -1,9 +1,18 @@
+import {NoReactInternals} from 'remotion/no-react';
import type {AnyRemotionOption} from './option';
const cliFlag = 'frame' as const;
let currentFrame: number | null = null;
+const validate = (frame: number) => {
+ NoReactInternals.validateFrame({
+ frame,
+ durationInFrames: Infinity,
+ allowFloats: false,
+ });
+};
+
export const stillFrameOption = {
name: 'Frame',
cliFlag,
@@ -18,9 +27,11 @@ export const stillFrameOption = {
docLink: 'https://www.remotion.dev/docs/cli/still#--frame',
getValue: ({commandLine}) => {
if (commandLine[cliFlag] !== undefined) {
+ const frame = Number(commandLine[cliFlag]);
+ validate(frame);
return {
source: 'cli',
- value: Number(commandLine[cliFlag]),
+ value: frame,
};
}
@@ -37,6 +48,10 @@ export const stillFrameOption = {
};
},
setConfig: (value: number | null) => {
+ if (value !== null) {
+ validate(value);
+ }
+
currentFrame = value;
},
type: 0 as number | null,