remotion-dev/remotion · error · Error
Expected MPEG Version 1 or 2
Error message
Expected MPEG Version 1 or 2
What it means
Thrown by `innerParseMp3PacketHeader` when the 2-bit audio version ID field equals `0b01`, which is marked 'reserved' in the MPEG specification. The parser accepts `0b00` (MPEG 2.5), `0b10` (MPEG 2), and `0b11` (MPEG 1), but not the reserved `0b01`.
Source
Thrown at packages/media-parser/src/containers/mp3/parse-packet-header.ts:193
const expectToBe1 = iterator.getBits(1);
if (expectToBe1 !== 1) {
throw new Error('Expected 1');
}
}
const audioVersionId = iterator.getBits(2);
/**
* 00 - MPEG Version 2.5 (later extension of MPEG 2)
01 - reserved
10 - MPEG Version 2 (ISO/IEC 13818-3)
11 - MPEG Version 1 (ISO/IEC 11172-3)
*/
if (
audioVersionId !== 0b11 &&
audioVersionId !== 0b10 &&
audioVersionId !== 0b00
) {
throw new Error('Expected MPEG Version 1 or 2');
}
const mpegVersion = audioVersionId === 0b11 ? 1 : (2 as MpegVersion);
const layerBits = iterator.getBits(2);
/**
* 00 - reserved
01 - Layer III
10 - Layer II
11 - Layer I
*/
if (layerBits === 0b00) {
throw new Error('Expected Layer I, II or III');
}
const layer = layerBits === 0b11 ? 1 : layerBits === 0b10 ? 2 : 3;
iterator.getBits(1); // 0b1 means that there is no CRC, 0b0 means there is. Not validating checksum thoughView on GitHub (pinned to 78fe4bb3fd)
Solutions
- Verify the file is a valid MP3 using `ffprobe`.
- Re-download or re-encode the file from a known-good source.
- Check for file corruption due to incomplete transfers.
- Report the file at remotion.dev/report if it appears to be a standard MP3.
Example fix
# verify file ffprobe -v error -i input.mp3 # re-encode ffmpeg -i input.mp3 -codec:a libmp3lame output.mp3
Defensive patterns
Strategy: try-catch
Try / catch
try {
await parseMedia({src, fields: {durationInSeconds: true}});
} catch (e) {
if (e instanceof Error && e.message === 'Expected MPEG Version 1 or 2') {
console.error('The MP3 frame header contains a reserved MPEG version ID.');
}
throw e;
} Prevention
- Validate MP3 files with ffprobe before parsing.
- Re-encode corrupt files with ffmpeg/LAME.
- Check for partial downloads or storage corruption.
- Use try-catch for untrusted user-uploaded audio files.
When it happens
Trigger: During frame header parsing (`parse-packet-header.ts:188-194`), `audioVersionId` read from the 2 bits after the sync word is `0b01`. No valid MPEG audio version maps to this value.
Common situations: Corrupt frame headers where the version bits are flipped. Non-MP3 data being parsed as MPEG audio. Files with byte-level corruption from bad transfers or disk errors. Misidentified file formats.
Related errors
- Reserved sampling frequency
- Expected Layer I, II or III
- Invalid bitrate
- Unknown MP3 header
- Invalid sampling frequency for MPEG version:
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/cf3e5b269b03c037.
Report an issue: GitHub.