{"record":{"id":"09c2175d51d24a9c","repo":"remotion-dev/remotion","slug":"invalid-channel-configuration-channelconfigurati","errorCode":null,"errorMessage":"Invalid channel configuration ${channelConfiguration}","messagePattern":"Invalid channel configuration (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/aac-codecprivate.ts","lineNumber":133,"sourceCode":"\taudioObjectType: number;\n\tsampleRate: number;\n\tchannelConfiguration: number;\n\tcodecPrivate: Uint8Array | null;\n}) => {\n\tif (codecPrivate !== null && codecPrivate.length > 2) {\n\t\t// Video submitted\n\t\t// submitted by Yossi Elkrief\n\t\t// TOOD: Check if we are now parsing correctly\n\t\treturn codecPrivate;\n\t}\n\n\tconst bits = `${audioObjectType.toString(2).padStart(5, '0')}${getConfigForSampleRate(sampleRate).toString(2).padStart(4, '0')}${channelConfiguration.toString(2).padStart(4, '0')}000`;\n\tif (bits.length !== 16) {\n\t\tthrow new Error('Invalid AAC codec private ' + bits.length);\n\t}\n\n\tif (channelConfiguration === 0 || channelConfiguration > 7) {\n\t\tthrow new Error('Invalid channel configuration ' + channelConfiguration);\n\t}\n\n\tconst firstByte = parseInt(bits.slice(0, 8), 2);\n\tconst secondByte = parseInt(bits.slice(8, 16), 2);\n\n\treturn new Uint8Array([firstByte, secondByte]);\n};\n\nexport const parseAacCodecPrivate = (bytes: Uint8Array) => {\n\tif (bytes.length < 2) {\n\t\tthrow new Error('Invalid AAC codec private length');\n\t}\n\n\tconst bits = [...bytes].map((b) => b.toString(2).padStart(8, '0')).join('');\n\n\tlet offset = 0;\n\tconst audioObjectType = parseInt(bits.slice(offset, offset + 5), 2);\n\toffset += 5;","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/aac-codecprivate.ts#L115-L151","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"# before: file with malformed channel config\nremotion render --props='{\"src\":\"bad.mp4\"}'\n\n# after: re-encode to standard stereo\nffmpeg -i bad.mp4 -ac 2 -c:a aac -b:a 128k good.mp4\nremotion render --props='{\"src\":\"good.mp4\"}'","handlingStrategy":"validation","validationCode":"const isValidChannelConfig = (c: number) => c >= 1 && c <= 7;","typeGuard":"const isValidAacChannelConfig = (c: number): boolean => c >= 1 && c <= 7;","tryCatchPattern":null,"preventionTips":["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."],"tags":["aac","audio","channels","media-parser","corrupt-file"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}