Packets

class av.packet.Packet(input=None)

Bases: av.buffer.Buffer

A packet of encoded data within a Stream.

This may, or may not include a complete object within a stream. decode() must be called to extract encoded data.

decode()

Send the packet’s data to the decoder and return a list of AudioFrame, VideoFrame or SubtitleSet.

decode_one()

Send the packet’s data to the decoder and return the first decoded frame.

Returns None if there is no frame.

Warning

This method is deprecated, as it silently discards any other frames which were decoded.

dts

The decoding timestamp in time_base units for this packet.

Type

int

duration

The duration in time_base units for this packet.

Returns None if it is not known.

Type

int

is_corrupt
is_keyframe
pos

The byte position of this packet within the Stream.

Returns None if it is not known.

Type

int

pts

The presentation timestamp in time_base units for this packet.

This is the time at which the packet should be shown to the user.

Type

int

size

The size in bytes of this packet’s data.

Type

int

stream

The Stream this packet was demuxed from.

stream_index
time_base

The unit of time (in fractional seconds) in which timestamps are expressed.

Type

fractions.Fraction