MP4Demuxer
Static Method Summary
Static Public Methods | ||
public static |
bin2str(buffer: *): * |
|
public static |
findBox(data: *, path: *): * |
|
public static |
getStartDTS(timescale: *): number Determine the base media decode start time, in seconds, for an MP4 fragment. |
|
public static |
offsetStartDTS(initData: *, fragment: *, timeOffset: *) |
|
public static |
parseInitSegment(init: *): object Parses an MP4 initialization segment and extracts stream type and timescale values for any declared tracks. |
|
public static |
parseSegmentIndex(initSegment: *): {"earliestPresentationTime": *, "timescale": *, "version": *, "referencesCount": *, "references": *, "moovEndOffset": *} |
|
public static |
probe(data: *): * |
|
public static |
readUint16(buffer: *, offset: *): * |
|
public static |
readUint32(buffer: *, offset: *): * |
|
public static |
writeUint32(buffer: *, offset: *, value: *) |
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
audioCodec: * |
|
public |
initPTS: * |
|
public |
observer: * |
|
public |
remuxer: * |
|
public |
videoCodec: * |
Method Summary
Public Methods | ||
public |
append(data: *, timeOffset: *, contiguous: *, accurateTimeOffset: *) |
|
public |
destroy() |
|
public |
resetInitSegment(initSegment: *, audioCodec: *, videoCodec: *, duration: *) |
|
public |
resetTimeStamp(initPTS: *) |
Static Public Methods
public static findBox(data: *, path: *): * source
Params:
Name | Type | Attribute | Description |
data | * | ||
path | * |
Return:
* |
public static getStartDTS(timescale: *): number source
Determine the base media decode start time, in seconds, for an MP4 fragment. If multiple fragments are specified, the earliest time is returned.
The base media decode time can be parsed from track fragment metadata:
moof > traf > tfdt.baseMediaDecodeTime
It requires the timescale value from the mdhd to interpret.
Params:
Name | Type | Attribute | Description |
timescale | * | {object} a hash of track ids to timescale values. |
public static offsetStartDTS(initData: *, fragment: *, timeOffset: *) source
Params:
Name | Type | Attribute | Description |
initData | * | ||
fragment | * | ||
timeOffset | * |
public static parseInitSegment(init: *): object source
Parses an MP4 initialization segment and extracts stream type and timescale values for any declared tracks. Timescale values indicate the number of clock ticks per second to assume for time-based values elsewhere in the MP4.
To determine the start time of an MP4, you need two pieces of information: the timescale unit and the earliest base media decode time. Multiple timescales can be specified within an MP4 but the base media decode time is always expressed in the timescale from the media header box for the track:
moov > trak > mdia > mdhd.timescale
moov > trak > mdia > hdlr
Params:
Name | Type | Attribute | Description |
init | * | {Uint8Array} the bytes of the init segment |
public static parseSegmentIndex(initSegment: *): {"earliestPresentationTime": *, "timescale": *, "version": *, "referencesCount": *, "references": *, "moovEndOffset": *} source
Params:
Name | Type | Attribute | Description |
initSegment | * |
Return:
{"earliestPresentationTime": *, "timescale": *, "version": *, "referencesCount": *, "references": *, "moovEndOffset": *} |
public static readUint16(buffer: *, offset: *): * source
Params:
Name | Type | Attribute | Description |
buffer | * | ||
offset | * |
Return:
* |
public static readUint32(buffer: *, offset: *): * source
Params:
Name | Type | Attribute | Description |
buffer | * | ||
offset | * |
Return:
* |
public static writeUint32(buffer: *, offset: *, value: *) source
Params:
Name | Type | Attribute | Description |
buffer | * | ||
offset | * | ||
value | * |
Public Constructors
public constructor() source
Public Members
public audioCodec: * source
public initPTS: * source
public observer: * source
public remuxer: * source
public videoCodec: * source
Public Methods
public append(data: *, timeOffset: *, contiguous: *, accurateTimeOffset: *) source
Params:
Name | Type | Attribute | Description |
data | * | ||
timeOffset | * | ||
contiguous | * | ||
accurateTimeOffset | * |
public destroy() source
public resetInitSegment(initSegment: *, audioCodec: *, videoCodec: *, duration: *) source
Params:
Name | Type | Attribute | Description |
initSegment | * | ||
audioCodec | * | ||
videoCodec | * | ||
duration | * |
public resetTimeStamp(initPTS: *) source
Params:
Name | Type | Attribute | Description |
initPTS | * |