remotion-dev/remotion · error · Error
Unsupported STSD version ${version}
Error message
Unsupported STSD version ${version} What it means
The STCO (32-bit Chunk Offset) box parser only supports version 0; any other version byte throws. Note the message text says 'STSD version' but the box is actually STCO — this is a copy-paste bug in the error message. A non-zero version almost always indicates cursor desync from a malformed earlier box.
Source
Thrown at packages/media-parser/src/containers/iso-base-media/stsd/stco.ts:25
flags: number[];
entryCount: number;
entries: (number | bigint)[];
}
export const parseStco = ({
iterator,
offset,
size,
mode64Bit,
}: {
iterator: BufferIterator;
offset: number;
size: number;
mode64Bit: boolean;
}): StcoBox => {
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: (number | bigint)[] = [];
for (let i = 0; i < entryCount; i++) {
const bytesRemaining = size - (iterator.counter.getOffset() - offset);
if (bytesRemaining < 4) {
break;
}
entries.push(mode64Bit ? iterator.getUint64() : iterator.getUint32());
}
iterator.discard(size - (iterator.counter.getOffset() - offset));
return {View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Validate with `mp4box -info input.mp4` to confirm whether the stco box is genuinely malformed.
- Re-mux with ffmpeg: `ffmpeg -i input.mp4 -c copy -movflags +faststart remuxed.mp4`.
- Check for earlier thrown size-mismatch errors in the same parse session — fix those first as they are the likely root cause.
- If the file is a fragment from a DASH/HLS stream, ensure the segment is complete.
Example fix
// before: cursor desync makes stco version read as 0x01 ffmpeg -i corrupt.mp4 -c copy -movflags +faststart remuxed.mp4 // after: stco box reads version 0 correctly
Defensive patterns
Strategy: try-catch
Validate before calling
// Check the STCO version byte (always 0 per spec) before parsing
function isValidStcoVersion(v: number): boolean {
return v === 0;
} Type guard
function isStcoVersionZero(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') && /* context is stco */) {
// likely corrupt stco or upstream cursor desync; re-mux
} else throw err;
} Prevention
- Re-mux suspicious files with ffmpeg before parsing.
- Treat version errors as symptoms of upstream desync; inspect earlier boxes first.
- Pre-validate with mp4box -info.
When it happens
Trigger: parseStco reads a version byte other than 0 at the start of an stco box. Real STCO boxes are always version 0 in the spec, so this throw fires on corrupt input or cursor misalignment.
Common situations: Truncated/corrupt MP4 files, files with malformed moov tables, or when an earlier box parser consumed the wrong number of bytes and shifted the cursor into the middle of stco data.
Related errors
- Unsupported STSD version ${version}
- Unsupported STSD version ${version}
- Expected stsz box in trak box
- Expected stco box in trak box
- Expected stsc box in trak box
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/ef34431a240e3209.
Report an issue: GitHub.