{"record":{"id":"74b2fc997ad40537","repo":"remotion-dev/remotion","slug":"unexpected-sample-rate-samplerate","errorCode":null,"errorMessage":"Unexpected sample rate ${sampleRate}","messagePattern":"Unexpected sample rate (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/aac-codecprivate.ts","lineNumber":106,"sourceCode":"\t}\n\n\tif (sampleRate === 12000) {\n\t\treturn 9;\n\t}\n\n\tif (sampleRate === 11025) {\n\t\treturn 10;\n\t}\n\n\tif (sampleRate === 8000) {\n\t\treturn 11;\n\t}\n\n\tif (sampleRate === 7350) {\n\t\treturn 12;\n\t}\n\n\tthrow new Error(`Unexpected sample rate ${sampleRate}`);\n};\n\nexport const createAacCodecPrivate = ({\n\taudioObjectType,\n\tsampleRate,\n\tchannelConfiguration,\n\tcodecPrivate,\n}: {\n\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;","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/aac-codecprivate.ts#L88-L124","documentation":"Thrown by getConfigForSampleRate in @remotion/media-parser when constructing AAC codec private data from a sample rate that is not one of the 13 standard MPEG-4 AAC frequencies (96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350). The encoder cannot map the rate to a valid 4-bit frequency index.","triggerScenarios":"Calling createAacCodecPrivate with a sampleRate outside the supported set (e.g. 44101, 22049, or any non-standard frequency). Encountered when the media pipeline hands the AAC codec-private builder a non-standard rate.","commonSituations":"An audio source with an unusual sample rate (e.g. 11024 Hz, or a rate altered by incorrect resampling), or a corrupt file reporting an odd rate. Most common when ingesting audio that bypassed proper resampling.","solutions":["Resample the audio to a standard rate before encoding: ffmpeg -i in.wav -ar 48000 -c:a aac out.m4a.","Use a source file authored at a standard sample rate.","Verify the source's sample rate with ffprobe and correct the upstream pipeline."],"exampleFix":"# before: source at a non-standard rate\nremotion render --props='{\"src\":\"odd.wav\"}'\n\n# after: resample to 48000 Hz\nffmpeg -i odd.wav -ar 48000 -c:a aac standard.m4a\nremotion render --props='{\"src\":\"standard.m4a\"}'","handlingStrategy":"validation","validationCode":"const STANDARD_RATES = [96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350];\nconst isStandardRate = (r: number) => STANDARD_RATES.includes(r);","typeGuard":"const STANDARD_AAC_RATES = new Set([96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350]);\nconst isStandardAacRate = (r: number): boolean => STANDARD_AAC_RATES.has(r);","tryCatchPattern":null,"preventionTips":["Resample audio to 48000 or 44100 Hz before encoding to AAC.","Validate source sample rates with ffprobe and reject non-standard rates.","Standardize your encoding pipeline to a known-good rate."],"tags":["aac","audio","sample-rate","media-parser","codec"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}