Skip to content

Function: writeTkhd() ​

ts
function writeTkhd(cursor, box): void;

Defined in: writers/writeTkhd.ts:31

Write the tkhd box (TrackHeaderBox).

ISO/IEC 14496-12:2015 - 8.3.2

Each 64-bit integer field of the box is a number or a bigint. The writer throws a RangeError for a bigint that does not fit the field.

Parameters ​

cursor ​

IsoBoxWriteCursor

The write cursor

box ​

TrackHeaderBox<IsoInt64>

The TrackHeaderBox fields to write

Returns ​

void

Throws ​

RangeError if a value of the box does not fit its field.

Example ​

ts
const writer = writeIsoBox(
	{
		type: 'tkhd',
		version: 0,
		flags: 3,
		creationTime: 0,
		modificationTime: 0,
		trackId: 1,
		duration: 0,
		layer: 0,
		alternateGroup: 0,
		volume: 0,
		matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
		width: 1920,
		height: 1080,
	},
	{ writers: { tkhd: writeTkhd } },
)

A Streaming Video Technology Alliance project.