Constructor
new TsTransmuxer(mimeType)
Parameters:
| Name | Type | Description |
|---|---|---|
mimeType |
string |
- Implements:
- Extends:
- Source:
Extends
Members
SUPPORTED_AUDIO_CODECS_ :Array<string>
Supported audio codecs.
Type:
- Array<string>
- Source:
SUPPORTED_VIDEO_CODECS_ :Array<string>
Supported audio codecs.
Type:
- Array<string>
- Source:
av1Info_ :shaka.codec.AV1.Info
The AV1 sequence header only rides in key frames, so cache what it says
and let the inter frames that follow reuse it.
Type:
- Source:
frameIndex :number
Type:
- number
- Overrides:
- Source:
initSegments :Map<string, !Uint8Array>
Type:
- Map<string, !Uint8Array>
- Overrides:
- Source:
lastInitSegment_ :Uint8Array
Type:
- Uint8Array
- Overrides:
- Source:
originalMimeType_ :string
Type:
- string
videoParameters_ :Map<number, shaka.transmuxer.TsTransmuxer.VideoParameters>
H.264 and H.265 parameter sets only have to precede the key frame that
starts a GOP, and GOPs are free to span segments, so a segment may start
without them. Keep the last ones seen for each stream, as one
transmuxer serves every stream of a content type that shares a codec.
Type:
- Map<number, shaka.transmuxer.TsTransmuxer.VideoParameters>
- Source:
Methods
convertCodecs(contentType, mimeType) → {string}
For any stream, convert its codecs to MP4 codecs.
Parameters:
| Name | Type | Description |
|---|---|---|
contentType |
string | |
mimeType |
string |
- Implements:
- Source:
Returns:
- Type
- string
destroy()
Destroy
- Overrides:
- Implements:
- Source:
getAacStreamInfo_(tsParser, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tsParser |
shaka.util.TsParser | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getAc3StreamInfo_(tsParser, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tsParser |
shaka.util.TsParser | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getAv1StreamInfo_(tsParser, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Builds the StreamInfo for an AV1 stream.
Unlike AVC/HEVC there are no frames to reassemble: a PES carries one, and
only one, AV1 access unit, which is what an `av01` sample holds. All that
the payload needs is to be converted back from the start code based format
MPEG-2 TS wraps it in, and the OBUs are only walked afterwards to find the
sequence header and the frame type.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tsParser |
shaka.util.TsParser | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getAvcStreamInfo_(tsParser, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tsParser |
shaka.util.TsParser | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getEc3StreamInfo_(tsParser, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tsParser |
shaka.util.TsParser | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getHvcStreamInfo_(tsParser, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tsParser |
shaka.util.TsParser | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getId3Timestamp(id3Datanon-null, defaultTimestamp) → {number}
Reads the transport-stream timestamp carried in the given ID3 data (the
'com.apple.streaming.transportStreamTimestamp' frame), if present, falling
back to the provided default otherwise.
Parameters:
| Name | Type | Description |
|---|---|---|
id3Data |
Uint8Array | |
defaultTimestamp |
number |
- Overrides:
- Source:
Returns:
- Type
- number
getMp3StreamInfo_(tsParser, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tsParser |
shaka.util.TsParser | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getOpusStreamInfo_(tsParser, stream, duration, referencenullable) → {shaka.util.Mp4Generator.StreamInfo}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
tsParser |
shaka.util.TsParser | ||
stream |
shaka.extern.Stream | ||
duration |
number | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
getOriginalMimeType() → {string}
- Overrides:
- Implements:
- Source:
Returns:
- Type
- string
getVideoInfo_(parsedInfonullable, hasKeyframe, stream, referencenullable) → {shaka.transmuxer.TsTransmuxer.VideoInfo}
Picks what describes the frames of an H.264 or H.265 segment: the
parameter sets it carries, or else those last seen for the same stream.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
parsedInfo |
shaka.transmuxer.TsTransmuxer.VideoInfo |
<nullable> |
|
hasKeyframe |
boolean | ||
stream |
shaka.extern.Stream | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Source:
Returns:
isSupported(mimeType, contentTypeopt) → {boolean}
Check if the mime type and the content type is supported.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
mimeType |
string | ||
contentType |
string |
<optional> |
- Implements:
- Source:
Returns:
- Type
- boolean
isTsContainer_(mimeType) → {boolean}
Check if the mimetype is 'video/mp2t' or 'audio/mp2t'.
Parameters:
| Name | Type | Description |
|---|---|---|
mimeType |
string |
- Source:
Returns:
- Type
- boolean
packageSegment(generatornon-null, stream, referencenullable) → {shaka.extern.TransmuxerOutput}
Packages the init and media segments produced by the given generator
implementing shaka.util.SegmentGenerator. The init segment is cached per
discontinuity and the running frame index is advanced. The init segment is
only (re)appended when it differs from the last one used.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
generator |
shaka.util.SegmentGenerator | ||
stream |
shaka.extern.Stream | ||
reference |
shaka.media.SegmentReference |
<nullable> |
- Overrides:
- Source:
Returns:
transmux(data, stream, referencenullable, duration, contentType) → {Promise<(!Uint8Array|!shaka.extern.TransmuxerOutput)>}
Transmux a input data to MP4.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
data |
BufferSource | ||
stream |
shaka.extern.Stream | ||
reference |
shaka.media.SegmentReference |
<nullable> |
The segment reference, or null for init segments |
duration |
number | ||
contentType |
string |
- Implements:
- Source:
Returns:
If you
only want to return the result, use Uint8Array, if you want to separate
the initialization segment and the data segment, you have to use
shaka.extern.TransmuxerOutput
- Type
- Promise<(!Uint8Array|!shaka.extern.TransmuxerOutput)>
Type Definitions
VideoInfo
What the parameter sets of an H.264 or H.265 stream say.
Type:
- {height: number, width: number, videoConfig: !Uint8Array, hSpacing: number, vSpacing: number}
Properties:
| Name | Type | Description |
|---|---|---|
height |
number | |
width |
number | |
videoConfig |
Uint8Array | The avcC or hvcC box payload. |
hSpacing |
number | |
vSpacing |
number |
- Source:
VideoParameters
The parameter sets last seen for a stream.
Type:
- {info: shaka.transmuxer.TsTransmuxer.VideoInfo, discontinuitySequence: number}
Properties:
| Name | Type | Description |
|---|---|---|
info |
shaka.transmuxer.TsTransmuxer.VideoInfo | What the parameter sets last seen for a stream say. |
discontinuitySequence |
number | The discontinuity sequence of the segment they were seen in. |
- Source: