{"record":{"id":"ef34431a240e3209","repo":"remotion-dev/remotion","slug":"unsupported-stsd-version-version","errorCode":null,"errorMessage":"Unsupported STSD version ${version}","messagePattern":"Unsupported STSD version (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/iso-base-media/stsd/stco.ts","lineNumber":25,"sourceCode":"\tflags: number[];\n\tentryCount: number;\n\tentries: (number | bigint)[];\n}\n\nexport const parseStco = ({\n\titerator,\n\toffset,\n\tsize,\n\tmode64Bit,\n}: {\n\titerator: BufferIterator;\n\toffset: number;\n\tsize: number;\n\tmode64Bit: boolean;\n}): StcoBox => {\n\tconst version = iterator.getUint8();\n\tif (version !== 0) {\n\t\tthrow new Error(`Unsupported STSD version ${version}`);\n\t}\n\n\tconst flags = iterator.getSlice(3);\n\tconst entryCount = iterator.getUint32();\n\n\tconst entries: (number | bigint)[] = [];\n\tfor (let i = 0; i < entryCount; i++) {\n\t\tconst bytesRemaining = size - (iterator.counter.getOffset() - offset);\n\t\tif (bytesRemaining < 4) {\n\t\t\tbreak;\n\t\t}\n\n\t\tentries.push(mode64Bit ? iterator.getUint64() : iterator.getUint32());\n\t}\n\n\titerator.discard(size - (iterator.counter.getOffset() - offset));\n\n\treturn {","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/iso-base-media/stsd/stco.ts#L7-L43","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: cursor desync makes stco version read as 0x01\nffmpeg -i corrupt.mp4 -c copy -movflags +faststart remuxed.mp4\n// after: stco box reads version 0 correctly","handlingStrategy":"try-catch","validationCode":"// Check the STCO version byte (always 0 per spec) before parsing\nfunction isValidStcoVersion(v: number): boolean {\n  return v === 0;\n}","typeGuard":"function isStcoVersionZero(v: number): v is 0 {\n  return v === 0;\n}","tryCatchPattern":"try {\n  await parseMedia({src, fields: {dimensions: true}});\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Unsupported STSD version') && /* context is stco */) {\n    // likely corrupt stco or upstream cursor desync; re-mux\n  } else throw err;\n}","preventionTips":["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."],"tags":["media-parser","isobmff","stco-box","corrupt-file","wrong-message","mp4"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}