Skip to content

Function: readStsz() ​

ts
function readStsz(cursor): SampleSizeBox;

Defined in: readers/readStsz.ts:24

Read the stsz box (SampleSizeBox).

When sampleSize is not 0, entrySize is undefined.

ISO/IEC 14496-12:2015 - 8.7.3

Parameters ​

cursor ​

IsoBoxReadCursor<IsoInt64>

The read cursor at the first byte after the box header

Returns ​

SampleSizeBox

A parsed SampleSizeBox

Example ​

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

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

assert.ok(stsz)
assert.ok(isIsoBoxType('stsz', stsz))
assert.strictEqual(stsz.sampleSize, 0)
assert.strictEqual(stsz.entrySize?.length, 31)
assert.strictEqual(stsz.entrySize?.[0], 687)

A Streaming Video Technology Alliance project.