{"record":{"id":"351df0e3d27461aa","repo":"remotion-dev/remotion","slug":"unexpected-audio-object-type-audioobjecttype","errorCode":null,"errorMessage":"Unexpected audio object type ${audioObjectType}","messagePattern":"Unexpected audio object type (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/aac-codecprivate.ts","lineNumber":223,"sourceCode":"\tswitch (audioObjectType) {\n\t\tcase 1:\n\t\t\treturn 'mp4a.40.2';\n\t\tcase 2:\n\t\t\treturn 'mp4a.40.5';\n\t\tcase 3:\n\t\t\treturn 'mp4a.40.29';\n\t\tcase 4:\n\t\t\treturn 'mp4a.40.1';\n\t\tcase 5:\n\t\t\treturn 'mp4a.40.3';\n\t\tcase 6:\n\t\t\treturn 'mp4a.40.4';\n\t\tcase 17:\n\t\t\treturn 'mp4a.40.17';\n\t\tcase 23:\n\t\t\treturn 'mp4a.40.23';\n\t\tdefault:\n\t\t\tthrow new Error(`Unexpected audio object type ${audioObjectType}`);\n\t}\n};\n","sourceCodeStart":205,"sourceCodeEnd":226,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/aac-codecprivate.ts#L205-L226","documentation":"Thrown by mapAudioObjectTypeToCodecString() when the AAC audioObjectType falls outside the set {1, 2, 3, 4, 5, 6, 17, 23}. These are the only MPEG-4 Audio Object Types the parser can map to an mp4a codec string (AAC-LC, HE-AAC, HEv2, Main, SSR, LTP, LD, ELD). Any other value means the file uses an AAC profile the parser does not recognize or support.","triggerScenarios":"A media file whose AAC AudioSpecificConfig encodes an audioObjectType not in the supported set (e.g. type 7 = AAC SBR-explicit, type 8, type 15 in HE-AACv2 signaling, or reserved values). The function is called internally during parseMedia when registering an AAC audio track and deriving its codec string.","commonSituations":"Files using uncommon or newly defined MPEG-4 Audio Object Types. Files with HE-AACv2 (parametric stereo) where the SBR extension audio object type is not 2 or 5. Corrupted codec private data that parses to a garbage audioObjectType. Edge cases with type 0 (null) when the muxer wrote a zeroed config.","solutions":["Re-encode the audio to a widely-supported AAC profile (AAC-LC, audioObjectType 2): `ffmpeg -i input -c:a aac -profile:a aac_low output.mp4`.","Migrate to Mediabunny (https://www.remotion.dev/docs/mediabunny/metadata) which has broader codec coverage.","If you call mapAudioObjectTypeToCodecString directly, add a fallback: default to 'mp4a.40.2' for unknown types or skip the track.","File a bug report with the reproducing media file so the supported set can be extended."],"exampleFix":"// before\nconst codec = mapAudioObjectTypeToCodecString(audioObjectType);\n\n// after (caller-side guard)\nconst SUPPORTED = new Set([1, 2, 3, 4, 5, 6, 17, 23]);\nconst codec = SUPPORTED.has(audioObjectType)\n  ? mapAudioObjectTypeToCodecString(audioObjectType)\n  : 'mp4a.40.2'; // fallback to AAC-LC","handlingStrategy":"validation","validationCode":"const SUPPORTED_AAC_OBJECT_TYPES = new Set([1, 2, 3, 4, 5, 6, 17, 23]);\n\nfunction isSupportedAacObjectType(t: number): boolean {\n  return SUPPORTED_AAC_OBJECT_TYPES.has(t);\n}\n\n// Usage:\nif (isSupportedAacObjectType(audioObjectType)) {\n  const codec = mapAudioObjectTypeToCodecString(audioObjectType);\n} else {\n  console.warn(`Unsupported AAC object type ${audioObjectType}, defaulting to AAC-LC`);\n}","typeGuard":"function isSupportedAacObjectType(type: number): boolean {\n  return new Set([1, 2, 3, 4, 5, 6, 17, 23]).has(type);\n}","tryCatchPattern":"try {\n  const codec = mapAudioObjectTypeToCodecString(audioObjectType);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unexpected audio object type')) {\n    // Fall back to AAC-LC for unsupported profiles\n    codec = 'mp4a.40.2';\n  } else {\n    throw e;\n  }\n}","preventionTips":["Re-encode audio to AAC-LC (the most widely supported profile) before parsing.","Use ffprobe to check the audio object type of files before processing.","Migrate to Mediabunny for broader codec support.","Build a pre-validation step that checks codec compatibility for batch processing."],"tags":["aac","media-parser","audio-object-type","codec","unsupported-format"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}