Skip to content

Function: writeMvhd() ​

ts
function writeMvhd(cursor, box): void;

Defined in: writers/writeMvhd.ts:31

Write the mvhd box (MovieHeaderBox).

ISO/IEC 14496-12:2015 - 8.2.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 ​

MovieHeaderBox<IsoInt64>

The MovieHeaderBox fields to write

Returns ​

void

Throws ​

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

Example ​

ts
const writer = writeIsoBox(
	{
		type: 'mvhd',
		version: 0,
		flags: 0,
		creationTime: 0,
		modificationTime: 0,
		timescale: 1000,
		duration: 0,
		rate: 1,
		volume: 1,
		matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
		preDefined: [0, 0, 0, 0, 0, 0],
		nextTrackId: 2,
	},
	{ writers: { mvhd: writeMvhd } },
)

A Streaming Video Technology Alliance project.