{"record":{"id":"0e821c0b4d96cb36","repo":"remotion-dev/remotion","slug":"mpeg-layer-i-is-not-supported","errorCode":null,"errorMessage":"MPEG Layer I is not supported","messagePattern":"MPEG Layer I is not supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/mp3/get-frame-length.ts","lineNumber":15,"sourceCode":"const getUnroundedMpegFrameLength = ({\n\tsamplesPerFrame,\n\tbitrateKbit,\n\tsamplingFrequency,\n\tpadding,\n\tlayer,\n}: {\n\tsamplesPerFrame: number;\n\tbitrateKbit: number;\n\tsamplingFrequency: number;\n\tpadding: boolean;\n\tlayer: number;\n}) => {\n\tif (layer === 1) {\n\t\tthrow new Error('MPEG Layer I is not supported');\n\t}\n\n\treturn (\n\t\t(((samplesPerFrame / 8) * bitrateKbit) / samplingFrequency) * 1000 +\n\t\t(padding ? (layer === 1 ? 4 : 1) : 0)\n\t);\n};\n\nexport const getAverageMpegFrameLength = ({\n\tsamplesPerFrame,\n\tbitrateKbit,\n\tsamplingFrequency,\n\tlayer,\n}: {\n\tsamplesPerFrame: number;\n\tbitrateKbit: number;\n\tsamplingFrequency: number;\n\tlayer: number;","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/mp3/get-frame-length.ts#L1-L33","documentation":"Thrown by `getMpegFrameLength` / `getUnroundedMpegFrameLength` when the MPEG audio layer is `1` (MPEG Layer I). The library explicitly supports only Layer II and Layer III (the common MP3 layers); Layer I uses a different frame structure and is unsupported.","triggerScenarios":"Parsing an MPEG audio file whose frame header indicates Layer I (`layerBits === 0b11`). This can be reached during frame-length calculation in `get-frame-length.ts:14-16` or `parse-packet-header.ts` via `getMpegFrameLength`.","commonSituations":"Files with the `.mp1` extension or MPEG Layer I audio. Old `.mpa` or `.mpg` files from legacy MPEG-1 systems. Misidentified files that are labeled `.mp3` but are actually Layer I encoded.","solutions":["Convert the audio file to MP3 (MPEG Layer III) using a tool like `ffmpeg`: `ffmpeg -i input.mp1 -codec:a libmp3lame output.mp3`.","Use a different audio format (AAC/M4A, WAV, Ogg) that `@remotion/media-parser` fully supports.","Verify the file is genuinely Layer III MP3 and not mislabeled.","If Layer I support is critical, report the file at remotion.dev/report."],"exampleFix":"# convert Layer I to MP3 Layer III\nffmpeg -i input.mp1 -codec:a libmp3lame -qscale:a 2 output.mp3","handlingStrategy":"validation","validationCode":"// Check file type before parsing\nimport {parseFile} from 'music-metadata'; // or ffprobe\n\nasync function isLayer3Mp3(file: File): Promise<boolean> {\n  // Use ffprobe or a metadata library to check the MPEG layer\n  // If layer is I, reject before calling parseMedia\n  return true; // implement with your preferred tool\n}","typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({src, fields: {durationInSeconds: true}});\n} catch (e) {\n  if (e instanceof Error && e.message === 'MPEG Layer I is not supported') {\n    console.error('This is an MPEG Layer I file. Convert to Layer III MP3 or AAC.');\n  }\n  throw e;\n}","preventionTips":["Ensure audio files are MPEG Layer III (MP3), not Layer I or II.","Convert Layer I files with ffmpeg: ffmpeg -i input -codec:a libmp3lame output.mp3.","Prefer AAC/M4A or WAV formats if you don't need MP3 specifically.","Validate file codecs with ffprobe before parsing."],"tags":["mp3","mpeg-layer-1","unsupported-format","audio-codec"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}