Class: shaka.mkv.MatroskaCodecs

Constructor

new MatroskaCodecs()

Source:

Members

ASS_CODEC :string

The codec string of SSA and ASS text, which has no codec registered either.
Type:
  • string
Source:

AV1C_MIN_SIZE_ :number

Size of the fixed part of av1C.
Type:
  • number
Source:

AVCC_MIN_SIZE_ :number

Minimum size of avcC: version, profile, compatibility, level, and the NAL length size; the codec string is made of bytes 1 to 3.
Type:
  • number
Source:

DOLBY_VISION_HLG_COMPATIBILITY_ :number

The value of bl_signal_compatibility_id of a Dolby Vision stream whose base layer is HLG.
Type:
  • number
Source:

FRAME_RATE_TOLERANCE_ :number

How far a frame rate can be, as a fraction of it, from a rate of a frame duration that has been rounded to a nanosecond and still be taken for it. The rounding is at most 0.5 ns of durations of tens of milliseconds, so this (0.001%) is far more than it needs and far less than the difference between two rates that exist.
Type:
  • number
Source:

HVCC_MIN_SIZE_ :number

Minimum size of hvcC up to (and including) general_level_idc, which is where the codec string stops reading.
Type:
  • number
Source:

OPUS_HEAD_MIN_SIZE_ :number

The size of an OpusHead without a channel mapping table.
Type:
  • number
Source:

SRT_CODEC :string

The codec string of SRT text, which has no codec registered in RFC 6381.
Type:
  • string
Source:

TRANSFER_HLG_ :number

@const
Type:
  • number
Source:

TRANSFER_PQ_ :number

H.273 code points of the transfer characteristics: SMPTE ST 2084 (PQ) and ARIB STD-B67 (HLG).
Type:
  • number
Source:

VP9_FEATURE_BIT_DEPTH_ :number

@const
Type:
  • number
Source:

VP9_FEATURE_CHROMA_ :number

@const
Type:
  • number
Source:

VP9_FEATURE_PROFILE_ :number

Feature ids of the CodecPrivate of a VP9 track.
Type:
  • number
Source:

Methods

getCodecs(tracknon-null) → {string}

Gets the RFC 6381 codec string of a track.
Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
Source:
Returns:
The codec string, or null when the codec is not supported: either the browsers cannot play it (DTS...) or the track is compressed or encrypted.
Type
string

getContentType(tracknon-null) → {string}

Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
Source:
Returns:
The content type of the track, or null when the track is not one the Player can use.
Type
string

getDolbyVision_(tracknon-null) → {?{codecs: string, hasCompatibleBase: boolean}}

Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
Source:
Returns:
Type
?{codecs: string, hasCompatibleBase: boolean}

getFrameRate(tracknon-null) → {number|undefined}

Gets the frame rate of a video track from its DefaultDuration, which is a whole number of nanoseconds and so gives a rate that is not quite the one that was meant (a duration of 41666666 ns is 24.00000038 fps). A rate that is within rounding of a whole number, or of a whole number times 1000/1001 (23.976, 29.97, 59.94), is taken as it.
Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
Source:
Returns:
Type
number | undefined

getHdr(tracknon-null) → {string|undefined}

Gets the HDR transfer function of a video track, in the vocabulary of shaka.extern.Stream.
Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
Source:
Returns:
Type
string | undefined

getMp3Mp4Codec() → {string}

Gets the codec string that the platform takes for MP3 in MP4: "mp3", or the objectTypeIndication that others (e.g. Chromecast) need instead.
Source:
Returns:
null if the platform has none.
Type
string

getMp4VideoCodec(codecId) → {string}

The name of the sample entry (and of the codec, in the codec string) that MP4 uses for a Matroska video codec.
Parameters:
Name Type Description
codecId string
Source:
Returns:
Type
string

getOpusConfig(tracknon-null) → {Uint8Array}

Gets the dOps box payload of an Opus track.
Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
Source:
Returns:
Type
Uint8Array

getPixelAspectRatio(tracknon-null) → {?{horizontal: number, vertical: number}}

Gets the pixel aspect ratio of a video track.
Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
Source:
Returns:
The ratio reduced to its lowest terms, or null when the pixels are square (or unknown).
Type
?{horizontal: number, vertical: number}

getSupplementalCodecs(tracknon-null) → {string}

Gets the codec string of the Dolby Vision version of a track, when it should be offered next to the codec of the track: the base layer plays on its own as HDR10, SDR or HLG (profiles 8 and 10), so the platforms that do not decode Dolby Vision keep the plain stream. This is what HLS calls SUPPLEMENTAL-CODECS.
Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
Source:
Returns:
The codec string, or an empty string if the track has no such version.
Type
string

getTrackNumber(streamId) → {number}

Gets the number of the track a stream is made from. The second stream of a track has an identifier that is made from the number; see MatroskaConstants.ALTERNATE_STREAM_ID_OFFSET.
Parameters:
Name Type Description
streamId number
Source:
Returns:
Type
number

getVideoConfig(tracknon-null, codecs) → {Uint8Array}

Gets the payload of the codec configuration box (avcC, hvcC, av1C or vpcC) of a video track.
Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
codecs string The codec string of the stream.
Source:
Returns:
Type
Uint8Array

getVp9Codecs_(tracknon-null) → {string}

Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
Source:
Returns:
Type
string

orDolbyVision_(tracknon-null, baseCodecs) → {string}

The codec of a track, or its Dolby Vision version when the plain codec is of no use without it (profile 5).
Parameters:
Name Type Description
track shaka.mkv.MatroskaIndexParser.Track
baseCodecs string
Source:
Returns:
Type
string

usesRawMpegAudio(codecId) → {boolean}

MP3 is accepted in MP4 on some platforms, and only as raw MPEG audio on others.
Parameters:
Name Type Description
codecId string
Source:
Returns:
Type
boolean

usesWebm(codecId) → {boolean}

Tells whether the browsers take a codec in WebM, and not in MP4. VP8 and Vorbis exist in MP4 in theory, but no browser plays them from there.
Parameters:
Name Type Description
codecId string
Source:
Returns:
Type
boolean