Skip to content

🎥 Make videos programmatically with React

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

let value: number | null = null;

export const getOffthreadVideoThreads = () => {
	return value;
};

const cliFlag = 'offthreadvideo-video-threads' as const;

export const offthreadVideoThreadsOption = {
	name: 'OffthreadVideo threads',
	addedIn: '4.0.261',
	cliFlag,
	description: () => (
		<>
			The number of threads that
			<a href="https://remotion.dev/docs/offthreadvideo">
				<code>&lt;OffthreadVideo&gt;</code>
			</a>{' '}
			can start to extract frames. The default is{' '}
			{DEFAULT_RENDER_FRAMES_OFFTHREAD_VIDEO_THREADS}. Increase carefully, as
			too many threads may cause instability.
		</>
	),
	ssrName: 'offthreadVideoThreads' as const,
	docLink: 'https://www.remotion.dev/docs/options/offthreadvideo-video-threads',
	type: 0 as number | null,
	getValue: ({commandLine}) => {
		if (commandLine[cliFlag] !== undefined) {
			return {
				source: 'cli',
				value: commandLine[cliFlag] as number,
			};
		}

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

		return {
			source: 'default',
			value: null,
		};
	},
	setConfig: (size: number | null) => {
		value = size ?? null;
	},
	id: cliFlag,
} satisfies AnyRemotionOption<number | null>;

export const DEFAULT_RENDER_FRAMES_OFFTHREAD_VIDEO_THREADS = 2;