remotion-dev/remotion · error

videoBitrate is invalid.

Error message

videoBitrate is invalid.

What it means

Thrown when `input.videoBitrate` is neither an integer bitrate (number) nor one of the preset strings 'very-low' | 'low' | 'medium' | 'high' | 'very-high'. Floats, negative numbers, or unknown preset strings are rejected.

Source

Thrown at packages/studio/src/components/WebMcp.tsx:723

							audio !== 'foreground' &&
							audio !== 'both' &&
							audio !== 'none'
						) {
							throw new Error('audio must be base, foreground, both, or none.');
						}

						const videoBitrate = input.videoBitrate ?? 'very-high';
						if (
							(typeof videoBitrate !== 'number' ||
								!Number.isInteger(videoBitrate) ||
								videoBitrate <= 0) &&
							videoBitrate !== 'very-low' &&
							videoBitrate !== 'low' &&
							videoBitrate !== 'medium' &&
							videoBitrate !== 'high' &&
							videoBitrate !== 'very-high'
						) {
							throw new Error('videoBitrate is invalid.');
						}

						const src = staticFile(assetPath);
						const displayName = assetPath.split('/').at(-1) ?? assetPath;
						const baseName = getDefaultOutputBaseName(
							src,
							displayName,
							'video',
						);
						const baseOutputPath =
							input.baseOutputPath ?? `${baseName}-base.webm`;
						const foregroundOutputPath =
							input.foregroundOutputPath ?? `${baseName}-foreground.webm`;
						if (
							typeof baseOutputPath !== 'string' ||
							typeof foregroundOutputPath !== 'string'
						) {
							throw new Error('Output paths must be strings.');

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Use a preset string: 'very-low' | 'low' | 'medium' | 'high' | 'very-high'.
  2. Or pass an integer number of bits per second, e.g. 4_000_000.
  3. Omit the field to use the default 'very-high'.

Example fix

// before
{ videoBitrate: '5M' }
// after
{ videoBitrate: 5000000 }
Defensive patterns

Strategy: validation

Validate before calling

const PRESETS = ['very-low','low','medium','high','very-high'];
const ok = v == null || PRESETS.includes(v) || (typeof v === 'number' && Number.isInteger(v) && v > 0);
if (!ok) throw new Error('invalid videoBitrate');

Type guard

const isBitrate = (v: unknown): v is number | 'very-low'|'low'|'medium'|'high'|'very-high' => PRESETS.includes(v) || (typeof v === 'number' && Number.isInteger(v));

Prevention

When it happens

Trigger: Passing videoBitrate: '5M', videoBitrate: 1.5, videoBitrate: -100, or videoBitrate: 'ultra'.

Common situations: Using ffmpeg-style bitrate strings ('5M', '4000k') instead of an integer bits-per-second, or inventing preset names.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09). Data as JSON: /api/errors/f08a6f6ffbd3cf4f. Report an issue: GitHub.