Skip to content

Function: readStsc() ​

ts
function readStsc(cursor): SampleToChunkBox;

Defined in: readers/readStsc.ts:23

Read the stsc box (SampleToChunkBox).

ISO/IEC 14496-12:2015 - 8.7.4

Parameters ​

cursor ​

IsoBoxReadCursor<IsoInt64>

The read cursor at the first byte after the box header

Returns ​

SampleToChunkBox

A parsed SampleToChunkBox

Example ​

ts
const isoFile = await readFile(new URL('../fixtures/captions.mp4', import.meta.url))
const boxes = readIsoBoxes(isoFile, {
	readers: {
		stsc: readStsc,
	},
})

const stsc = findIsoBox(boxes, box => isIsoBoxType('stsc', box))

assert.ok(stsc)
assert.ok(isIsoBoxType('stsc', stsc))
assert.strictEqual(stsc.entries.length, 3)
assert.deepStrictEqual(stsc.entries[0], {
	firstChunk: 1,
	samplesPerChunk: 2,
	sampleDescriptionIndex: 1,
})

A Streaming Video Technology Alliance project.