remotion-dev/remotion · error · Error

Only supporting WAVE with PCM audio format, but got ${subFor

Error message

Only supporting WAVE with PCM audio format, but got ${subFormat.length}

What it means

Inside the EXTENSIBLE branch the parser slices 16 bytes for the subFormat GUID and re-checks its length; if the underlying buffer had fewer than 16 bytes left (truncated fmt chunk) the slice is short and this throws. NOTE: the message is misleading — it says 'PCM audio format' but the real condition is subFormat.length !== 16. Treat it as a truncated-corrupt-header error, not a codec-compatibility error.

Source

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

		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
		} else {
			throw new Error(`Unsupported subformat: ${subFormat}`);
		}

		const channels = getChannelsFromMask(channelMask);
		wavHeader.numberOfChannels = channels.length;
	}

	await registerAudioTrack({
		track: {

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Confirm the fmt chunk is intact (ffprobe loads the file cleanly).
  2. Re-download or re-export the WAV.
  3. Re-encode with ffmpeg to a clean PCM WAV.
  4. Use Mediabunny; try/catch parseMedia().

Example fix

# verify integrity, then re-encode
ffprobe -v error in.wav && ffmpeg -i in.wav -c:a pcm_s16le out.wav

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

Strategy: try-catch

Validate before calling

// verify the fmt chunk is intact (file loads cleanly in ffprobe)
// ffprobe -v error in.wav

Try / catch

try {
  await parseMedia({ src: 'in.wav' });
} catch (err) {
  // NOTE: misleading message — this is really a truncated subFormat GUID
  if (err instanceof Error && /PCM audio format, but got/.test(err.message)) {
    // treat as corrupt header — re-download / re-encode
  } else throw err;
}

Prevention

When it happens

Trigger: A WAVE_FORMAT_EXTENSIBLE fmt chunk where fewer than 16 bytes remain after cbSize/valid-bps/channel-mask, so iterator.getSlice(16) returns a short slice.

Common situations: Truncated/partial download; stream cut off mid-fmt; corrupted fmt chunk bytes.

Related errors


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