remotion-dev/remotion · error
Unexpected sample rate ${sampleRate}
Error message
Unexpected sample rate ${sampleRate} What it means
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.
Source
Thrown at packages/media-parser/src/aac-codecprivate.ts:106
}
if (sampleRate === 12000) {
return 9;
}
if (sampleRate === 11025) {
return 10;
}
if (sampleRate === 8000) {
return 11;
}
if (sampleRate === 7350) {
return 12;
}
throw new Error(`Unexpected sample rate ${sampleRate}`);
};
export const createAacCodecPrivate = ({
audioObjectType,
sampleRate,
channelConfiguration,
codecPrivate,
}: {
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;View on GitHub (pinned to 78fe4bb3fd)
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.
Example fix
# before: source at a non-standard rate
remotion render --props='{"src":"odd.wav"}'
# after: resample to 48000 Hz
ffmpeg -i odd.wav -ar 48000 -c:a aac standard.m4a
remotion render --props='{"src":"standard.m4a"}' Defensive patterns
Strategy: validation
Validate before calling
const STANDARD_RATES = [96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350]; const isStandardRate = (r: number) => STANDARD_RATES.includes(r);
Type guard
const STANDARD_AAC_RATES = new Set([96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000,7350]); const isStandardAacRate = (r: number): boolean => STANDARD_AAC_RATES.has(r);
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unexpected sampling frequency index ${samplingFrequencyIndex
- Invalid channel configuration ${channelConfiguration}
- Unexpected audio object type ${audioObjectType}
- Expected AAC codec private data
- Could not find number of channels
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/74b2fc997ad40537.
Report an issue: GitHub.