{"record":{"id":"019999cd64e48b16","repo":"remotion-dev/remotion","slug":"unsupported-stsd-version-version-019999","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/stsc.ts","lineNumber":24,"sourceCode":"\tversion: number;\n\tflags: number[];\n\tentryCount: number;\n\t// firstChunk -> samplesPerChunk\n\tentries: Map<number, number>;\n}\n\nexport const parseStsc = ({\n\titerator,\n\toffset,\n\tsize,\n}: {\n\titerator: BufferIterator;\n\toffset: number;\n\tsize: number;\n}): StscBox => {\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: Map<number, number> = new Map();\n\n\tfor (let i = 0; i < entryCount; i++) {\n\t\tconst firstChunk = iterator.getUint32();\n\t\tconst samplesPerChunk = iterator.getUint32();\n\t\tconst sampleDescriptionIndex = iterator.getUint32();\n\t\tif (sampleDescriptionIndex !== 1) {\n\t\t\tthrow new Error(\n\t\t\t\t`Expected sampleDescriptionIndex to be 1, but got ${sampleDescriptionIndex}`,\n\t\t\t);\n\t\t}\n\n\t\tentries.set(firstChunk, samplesPerChunk);","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/iso-base-media/stsd/stsc.ts#L6-L42","documentation":"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.","triggerScenarios":"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.","commonSituations":"Corrupt MP4/MOV files, partial downloads, or files with moov tables damaged by a crash during encoding.","solutions":["Run `ffprobe -v error input.mp4` to detect moov corruption.","Re-mux: `ffmpeg -i input.mp4 -c copy remuxed.mp4`.","If parsing fragments, confirm the moof/mdat chain is intact.","Investigate earlier box parse errors first; version-byte errors are usually downstream of a size miscalculation."],"exampleFix":"// before: damaged moov causes stsc version 0x02\nffmpeg -i corrupt.mp4 -c copy fixed.mp4\n// after: stsc parses with version 0","handlingStrategy":"try-catch","validationCode":"function isValidStscVersion(v: number): boolean {\n  return v === 0;\n}","typeGuard":"function isStscVersionZero(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')) {\n    // ambiguous message (also used by stco/stsz); inspect box context to disambiguate\n  } else throw err;\n}","preventionTips":["Re-mux with ffmpeg to rebuild stsc cleanly.","Investigate the first thrown error in a parse session; later version errors are downstream.","Use mp4box -info to confirm structural integrity."],"tags":["media-parser","isobmff","stsc-box","corrupt-file","wrong-message","mp4"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}