remotion-dev/remotion · error · Error
The "${name}" prop ${location} must be one of ${validCodecs.
Error message
The "${name}" prop ${location} must be one of ${validCodecs.join(', ')}, but you passed ${defaultCodec}. What it means
`validateCodec` rejects a codec string that is not in `validCodecs` (`h264, h265, vp8, vp9, av1, mp3, aac, wav, prores, h264-mkv, h264-ts, gif`). The match is case-sensitive. This guards both the `defaultCodec` from `calculateMetadata` and the `codec` argument to serverless render APIs.
Source
Thrown at packages/core/src/validation/validate-default-codec.ts:20
import {validCodecs} from '../codec';
export function validateCodec(
defaultCodec: unknown,
location: string,
name: string,
): asserts defaultCodec is CodecOrUndefined {
if (typeof defaultCodec === 'undefined') {
return;
}
if (typeof defaultCodec !== 'string') {
throw new TypeError(
`The "${name}" prop ${location} must be a string, but you passed a value of type ${typeof defaultCodec}.`,
);
}
if (!validCodecs.includes(defaultCodec as Codec)) {
throw new Error(
`The "${name}" prop ${location} must be one of ${validCodecs.join(
', ',
)}, but you passed ${defaultCodec}.`,
);
}
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Use one of the exact lowercase values listed in the error.
- For MP4 video use `'h264'` (or `'h265'`); for audio-only use `'mp3'`/`'aac'`/`'wav'`.
- Import the `Codec` type so the editor autocompletes valid values.
- Check `validCodecs` from `@remotion/renderer`/core if unsure.
Example fix
// before
renderMediaOnLambda({codec: 'H.264', ...})
// after
renderMediaOnLambda({codec: 'h264', ...}) Defensive patterns
Strategy: validation
Validate before calling
import {validCodecs} from '@remotion/core/codec';
if (!validCodecs.includes(codec)) {
throw new Error('Unsupported codec: ' + codec + '. Use one of ' + validCodecs.join(', '));
} Type guard
const isValidCodec = (c) => validCodecs.includes(c);
Prevention
- Codec matching is case-sensitive — always lowercase.
- Differentiate container (mp4/mkv/webm) from codec (h264/vp9).
- Let TypeScript's `Codec` union catch typos at compile time.
When it happens
Trigger: Passing a codec string that is misspelled, differently cased (`'H264'`, `'H.264'`, `'x264'`), uses a dot/dash variant (`'h.264'`, `'h-264'`), or names a codec Remotion does not support (`'webm'`, `'mkv'`, `'mp4'`).
Common situations: Typos; assuming case-insensitivity; using a container name instead of a codec; copying a codec name from another tool's vocabulary; version change where a codec was renamed or removed.
Related errors
- The "${name}" prop ${location} must be a string, but you pas
- "${name}" must be one of ${variants.join(', ')}
- "codec" must be a string
- '${codec}' is not a valid codec for GCP Cloud Run. The follo
- Value for ${JSON.stringify(key)} must be one of ${Object.key
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/88e11c059923dbd9.
Report an issue: GitHub.