remotion-dev/remotion · error
Invalid channel configuration ${channelConfiguration}
Error message
Invalid channel configuration ${channelConfiguration} What it means
Thrown by createAacCodecPrivate in @remotion/media-parser when channelConfiguration is 0 or greater than 7. MPEG-4 AAC channel configurations 1-7 are defined (mono, stereo, 2.1, etc.); 0 is invalid and values above 7 are not standard preset configurations. The codec-private byte sequence cannot be built for such values.
Source
Thrown at packages/media-parser/src/aac-codecprivate.ts:133
audioObjectType: number;
sampleRate: number;
channelConfiguration: number;
codecPrivate: Uint8Array | null;
}) => {
if (codecPrivate !== null && codecPrivate.length > 2) {
// Video submitted
// submitted by Yossi Elkrief
// TOOD: Check if we are now parsing correctly
return codecPrivate;
}
const bits = `${audioObjectType.toString(2).padStart(5, '0')}${getConfigForSampleRate(sampleRate).toString(2).padStart(4, '0')}${channelConfiguration.toString(2).padStart(4, '0')}000`;
if (bits.length !== 16) {
throw new Error('Invalid AAC codec private ' + bits.length);
}
if (channelConfiguration === 0 || channelConfiguration > 7) {
throw new Error('Invalid channel configuration ' + channelConfiguration);
}
const firstByte = parseInt(bits.slice(0, 8), 2);
const secondByte = parseInt(bits.slice(8, 16), 2);
return new Uint8Array([firstByte, secondByte]);
};
export const parseAacCodecPrivate = (bytes: Uint8Array) => {
if (bytes.length < 2) {
throw new Error('Invalid AAC codec private length');
}
const bits = [...bytes].map((b) => b.toString(2).padStart(8, '0')).join('');
let offset = 0;
const audioObjectType = parseInt(bits.slice(offset, offset + 5), 2);
offset += 5;View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Re-encode the audio with a standard channel layout: ffmpeg -i in.mp4 -ac 2 -c:a aac out.mp4 (stereo) or -ac 1 (mono).
- Use a well-formed source file.
- If authoring programmatically, restrict channelConfiguration to 1-7.
Example fix
# before: file with malformed channel config
remotion render --props='{"src":"bad.mp4"}'
# after: re-encode to standard stereo
ffmpeg -i bad.mp4 -ac 2 -c:a aac -b:a 128k good.mp4
remotion render --props='{"src":"good.mp4"}' Defensive patterns
Strategy: validation
Validate before calling
const isValidChannelConfig = (c: number) => c >= 1 && c <= 7;
Type guard
const isValidAacChannelConfig = (c: number): boolean => c >= 1 && c <= 7;
Prevention
- Re-encode audio with a standard channel layout (mono or stereo) before use.
- Validate channel configuration in your encoding pipeline.
- Reject corrupt audio files at ingestion via ffprobe.
When it happens
Trigger: Calling createAacCodecPrivate with channelConfiguration set to 0, 8, or higher. Typically arises from parsing a corrupt or non-standard AAC stream where the channel_configuration field is out of range.
Common situations: A corrupt MP4/M4A file with a malformed audio sample descriptor, a non-standard encoder, or damaged codec-private atoms. Well-authored files use channel configs 1 (mono) or 2 (stereo).
Related errors
- Unexpected sampling frequency index ${samplingFrequencyIndex
- Unexpected sample rate ${sampleRate}
- Invalid syncword: ${syncWord}
- Only supporting layer 0 for .aac
- Expected AAC codec private data
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/09c2175d51d24a9c.
Report an issue: GitHub.