{"record":{"id":"cf3e5b269b03c037","repo":"remotion-dev/remotion","slug":"expected-mpeg-version-1-or-2","errorCode":null,"errorMessage":"Expected MPEG Version 1 or 2","messagePattern":"Expected MPEG Version 1 or 2","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/mp3/parse-packet-header.ts","lineNumber":193,"sourceCode":"\t\tconst expectToBe1 = iterator.getBits(1);\n\t\tif (expectToBe1 !== 1) {\n\t\t\tthrow new Error('Expected 1');\n\t\t}\n\t}\n\n\tconst audioVersionId = iterator.getBits(2);\n\t/**\n   * 00 - MPEG Version 2.5 (later extension of MPEG 2)\n     01 - reserved\n     10 - MPEG Version 2 (ISO/IEC 13818-3)\n     11 - MPEG Version 1 (ISO/IEC 11172-3)\n   */\n\tif (\n\t\taudioVersionId !== 0b11 &&\n\t\taudioVersionId !== 0b10 &&\n\t\taudioVersionId !== 0b00\n\t) {\n\t\tthrow new Error('Expected MPEG Version 1 or 2');\n\t}\n\n\tconst mpegVersion = audioVersionId === 0b11 ? 1 : (2 as MpegVersion);\n\n\tconst layerBits = iterator.getBits(2);\n\t/**\n   * 00 - reserved\n     01 - Layer III\n     10 - Layer II\n     11 - Layer I\n   */\n\tif (layerBits === 0b00) {\n\t\tthrow new Error('Expected Layer I, II or III');\n\t}\n\n\tconst layer = layerBits === 0b11 ? 1 : layerBits === 0b10 ? 2 : 3;\n\n\titerator.getBits(1); // 0b1 means that there is no CRC, 0b0 means there is. Not validating checksum though","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/mp3/parse-packet-header.ts#L175-L211","documentation":"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`.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# verify file\nffprobe -v error -i input.mp3\n\n# re-encode\nffmpeg -i input.mp3 -codec:a libmp3lame output.mp3","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({src, fields: {durationInSeconds: true}});\n} catch (e) {\n  if (e instanceof Error && e.message === 'Expected MPEG Version 1 or 2') {\n    console.error('The MP3 frame header contains a reserved MPEG version ID.');\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["mp3","corrupt-file","invalid-header","mpeg-version","mpeg-spec"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}