Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Vanilagy/mediabunny/llms.txt
Use this file to discover all available pages before exploring further.
EncodedPacket
Represents an encoded chunk of media. Used as an expressive wrapper around WebCodecs API’sEncodedVideoChunk and EncodedAudioChunk, but can also be used standalone.
Constructor
The encoded data of this packet. For any given codec, this data must adhere to the format specified in the Mediabunny Codec Registry.
The type of this packet:
'key' or 'delta'.The presentation timestamp of this packet in seconds. May be negative. Samples with negative end timestamps should not be presented.
The duration of this packet in seconds.
The sequence number indicates the decode order of the packets. Packet A must be decoded before packet B if A has a lower sequence number than B. If two packets have the same sequence number, they are the same packet. Negative sequence numbers mean the sequence number is undefined.
The actual byte length of the data in this packet. This field is useful for metadata-only packets where the
data field contains no bytes.Additional data carried with this packet.
Properties
The encoded data of this packet.
The type of this packet:
'key' or 'delta'.The presentation timestamp in seconds.
The duration in seconds.
The sequence number for decode order.
The actual byte length of the data.
Additional data carried with this packet.
Methods
toEncodedVideoChunk()
Converts this packet to anEncodedVideoChunk.
toEncodedAudioChunk()
Converts this packet to anEncodedAudioChunk.
toEncodedChunk()
Converts this packet to either anEncodedVideoChunk or EncodedAudioChunk.
PacketType
The type of a packet. Key packets can be decoded without previous packets, while delta packets depend on previous packets.Key (keyframe) packets can be decoded independently without previous packets.
Delta packets depend on previous packets for decoding.
EncodedPacketSideData
Holds additional data accompanying anEncodedPacket.
An encoded alpha frame, encoded with the same codec as the packet. Typically used for transparent videos, where the alpha information is stored separately from the color information.
The actual byte length of the alpha data. This field is useful for metadata-only packets where the
alpha field contains no bytes.Example
See also
- Samples - Raw unencoded media data
- EncodedPacketSource - Add pre-encoded packets to output
- EncodedPacketSink - Extract encoded packets from input