remotion-dev/remotion · error · Error

Unsupported STSD version ${version}

Error message

Unsupported STSD version ${version}

What it means

The STSC (Sample-to-Chunk) box parser only supports version 0; any other version byte throws. Like the stco case, the message says 'STSD version' due to a copy-paste bug, but the box is STSC. A non-zero version byte is a strong signal of cursor desync or file corruption since the spec defines only version 0.

Source

Thrown at packages/media-parser/src/containers/iso-base-media/stsd/stsc.ts:24

	version: number;
	flags: number[];
	entryCount: number;
	// firstChunk -> samplesPerChunk
	entries: Map<number, number>;
}

export const parseStsc = ({
	iterator,
	offset,
	size,
}: {
	iterator: BufferIterator;
	offset: number;
	size: number;
}): StscBox => {
	const version = iterator.getUint8();
	if (version !== 0) {
		throw new Error(`Unsupported STSD version ${version}`);
	}

	const flags = iterator.getSlice(3);
	const entryCount = iterator.getUint32();

	const entries: Map<number, number> = new Map();

	for (let i = 0; i < entryCount; i++) {
		const firstChunk = iterator.getUint32();
		const samplesPerChunk = iterator.getUint32();
		const sampleDescriptionIndex = iterator.getUint32();
		if (sampleDescriptionIndex !== 1) {
			throw new Error(
				`Expected sampleDescriptionIndex to be 1, but got ${sampleDescriptionIndex}`,
			);
		}

		entries.set(firstChunk, samplesPerChunk);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Run `ffprobe -v error input.mp4` to detect moov corruption.
  2. Re-mux: `ffmpeg -i input.mp4 -c copy remuxed.mp4`.
  3. If parsing fragments, confirm the moof/mdat chain is intact.
  4. Investigate earlier box parse errors first; version-byte errors are usually downstream of a size miscalculation.

Example fix

// before: damaged moov causes stsc version 0x02
ffmpeg -i corrupt.mp4 -c copy fixed.mp4
// after: stsc parses with version 0
Defensive patterns

Strategy: try-catch

Validate before calling

function isValidStscVersion(v: number): boolean {
  return v === 0;
}

Type guard

function isStscVersionZero(v: number): v is 0 {
  return v === 0;
}

Try / catch

try {
  await parseMedia({src, fields: {dimensions: true}});
} catch (err) {
  if (err instanceof Error && err.message.startsWith('Unsupported STSD version')) {
    // ambiguous message (also used by stco/stsz); inspect box context to disambiguate
  } else throw err;
}

Prevention

When it happens

Trigger: parseStsc reads a version byte != 0 at the start of an stsc box. Typically caused by a preceding box leaving the iterator cursor at the wrong offset.

Common situations: Corrupt MP4/MOV files, partial downloads, or files with moov tables damaged by a crash during encoding.

Related errors


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