remotion-dev/remotion · error · Error

Only supporting WAVE with 22 extra bytes, but got ${extraSiz

Error message

Only supporting WAVE with 22 extra bytes, but got ${extraSize} bytes extra size

What it means

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.

Source

Thrown at packages/media-parser/src/containers/wav/parse-fmt.ts:93

	if (format === null) {
		throw new Error(`Unsupported bits per sample: ${bitsPerSample}`);
	}

	const wavHeader: WavFmt = {
		bitsPerSample,
		blockAlign,
		byteRate,
		numberOfChannels,
		sampleRate,
		type: 'wav-fmt',
	};

	state.structure.getWavStructure().boxes.push(wavHeader);

	if (audioFormat === 65534) {
		const extraSize = iterator.getUint16Le();
		if (extraSize !== 22) {
			throw new Error(
				`Only supporting WAVE with 22 extra bytes, but got ${extraSize} bytes extra size`,
			);
		}

		iterator.getUint16Le(); // valid bits per sample
		const channelMask = iterator.getUint32Le();
		const subFormat = iterator.getSlice(16);
		// check if same as [ 1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 ]
		if (subFormat.length !== 16) {
			throw new Error(
				`Only supporting WAVE with PCM audio format, but got ${subFormat.length}`,
			);
		}

		if (subformatIsPcm(subFormat)) {
			// is pcm
		} else if (subformatIsIeeeFloat(subFormat)) {
			// is ieee float

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Inspect the fmt chunk layout in a hex editor or ffprobe.
  2. Re-export as plain PCM: ffmpeg -i in.wav -c:a pcm_s16le out.wav.
  3. Use Mediabunny; wrap parseMedia() in try/catch.

Example fix

# collapse EXTENSIBLE -> plain PCM
ffmpeg -i in.wav -c:a pcm_s16le out.wav

await parseMedia({ src: 'out.wav' });
Defensive patterns

Strategy: try-catch

Validate before calling

// ffprobe will reject or warn on a malformed EXTENSIBLE fmt chunk
// ffprobe -v warning in.wav

Try / catch

try {
  await parseMedia({ src: 'in.wav' });
} catch (err) {
  if (err instanceof Error && /22 extra bytes/i.test(err.message)) {
    // re-encode to plain PCM
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: Buggy encoders; files truncated mid-fmt; uncommon EXTENSIBLE variants; partially-overwritten headers.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/41d998835fabd68f. Report an issue: GitHub.