Skip to content

🎥 Make videos programmatically with React

1.2 KB
Raw Blame
import type {AnyRemotionOption} from './option';

const cliFlag = 'image-sequence-pattern' as const;

let currentImageSequencePattern: string | null = null;

// Option for --image-sequence-pattern
export const imageSequencePatternOption = {
	name: 'Image Sequence Pattern',
	addedIn: '4.0.313',
	cliFlag,
	ssrName: 'imageSequencePattern',
	description: () => (
		<>
			Pattern for naming image sequence files. Supports <code>[frame]</code> for
			the zero-padded frame number and <code>[ext]</code> for the file
			extension.
		</>
	),
	docLink: 'https://www.remotion.dev/docs/options/image-sequence-pattern',
	type: 'string' as string | null,
	getValue: ({commandLine}) => {
		if (commandLine[cliFlag] !== undefined) {
			return {
				value: commandLine[cliFlag] as string,
				source: 'cli',
			};
		}

		if (currentImageSequencePattern !== null) {
			return {
				value: currentImageSequencePattern,
				source: 'config',
			};
		}

		return {
			value: null,
			source: 'default',
		};
	},
	setConfig: (pattern: string | null) => {
		currentImageSequencePattern = pattern;
	},
	reset: () => {
		currentImageSequencePattern = null;
	},
	id: cliFlag,
} satisfies AnyRemotionOption<string | null>;