{"record":{"id":"41d998835fabd68f","repo":"remotion-dev/remotion","slug":"only-supporting-wave-with-22-extra-bytes-but-got","errorCode":null,"errorMessage":"Only supporting WAVE with 22 extra bytes, but got ${extraSize} bytes extra size","messagePattern":"Only supporting WAVE with 22 extra bytes, but got (.+?) bytes extra size","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/wav/parse-fmt.ts","lineNumber":93,"sourceCode":"\tif (format === null) {\n\t\tthrow new Error(`Unsupported bits per sample: ${bitsPerSample}`);\n\t}\n\n\tconst wavHeader: WavFmt = {\n\t\tbitsPerSample,\n\t\tblockAlign,\n\t\tbyteRate,\n\t\tnumberOfChannels,\n\t\tsampleRate,\n\t\ttype: 'wav-fmt',\n\t};\n\n\tstate.structure.getWavStructure().boxes.push(wavHeader);\n\n\tif (audioFormat === 65534) {\n\t\tconst extraSize = iterator.getUint16Le();\n\t\tif (extraSize !== 22) {\n\t\t\tthrow new Error(\n\t\t\t\t`Only supporting WAVE with 22 extra bytes, but got ${extraSize} bytes extra size`,\n\t\t\t);\n\t\t}\n\n\t\titerator.getUint16Le(); // valid bits per sample\n\t\tconst channelMask = iterator.getUint32Le();\n\t\tconst subFormat = iterator.getSlice(16);\n\t\t// check if same as [ 1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 ]\n\t\tif (subFormat.length !== 16) {\n\t\t\tthrow new Error(\n\t\t\t\t`Only supporting WAVE with PCM audio format, but got ${subFormat.length}`,\n\t\t\t);\n\t\t}\n\n\t\tif (subformatIsPcm(subFormat)) {\n\t\t\t// is pcm\n\t\t} else if (subformatIsIeeeFloat(subFormat)) {\n\t\t\t// is ieee float","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/wav/parse-fmt.ts#L75-L111","documentation":"For wFormatTag 65534 (WAVE_FORMAT_EXTENSIBLE), parseFmt reads the 2-byte cbSize and requires exactly 22 — the size of the standard extensible header (valid-bits-per-sample uint16 + channel-mask uint32 + 16-byte subFormat GUID). A different cbSize means a non-standard or truncated extensible header, which the parser refuses to guess.","triggerScenarios":"An EXTENSIBLE WAV whose cbSize is not 22: a truncated extension, an encoder that writes a short/long subFormat, or file corruption in the fmt chunk.","commonSituations":"Buggy encoders; files truncated mid-fmt; uncommon EXTENSIBLE variants; partially-overwritten headers.","solutions":["Inspect the fmt chunk layout in a hex editor or ffprobe.","Re-export as plain PCM: ffmpeg -i in.wav -c:a pcm_s16le out.wav.","Use Mediabunny; wrap parseMedia() in try/catch."],"exampleFix":"# collapse EXTENSIBLE -> plain PCM\nffmpeg -i in.wav -c:a pcm_s16le out.wav\n\nawait parseMedia({ src: 'out.wav' });","handlingStrategy":"try-catch","validationCode":"// ffprobe will reject or warn on a malformed EXTENSIBLE fmt chunk\n// ffprobe -v warning in.wav","typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({ src: 'in.wav' });\n} catch (err) {\n  if (err instanceof Error && /22 extra bytes/i.test(err.message)) {\n    // re-encode to plain PCM\n  } else throw err;\n}","preventionTips":["Collapse EXTENSIBLE WAVs to plain PCM with ffmpeg upstream.","Treat untrusted WAVs as suspect and re-encode.","Use Mediabunny."],"tags":["wav","media-parser","corrupt-file","audio","pcm"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}