Packet
A demuxed packet the caller owns.
A player queues packets independently of its decoders, so a packet must outlive the read that produced it. The compressed payload remains reference counted; taking or copying ownership is an O(1) reference operation, not a copy of the compressed bytes.
Close every packet exactly once. Reading any property, copying it or sending it after close throws rather than resolving memory or a token that the allocator is free to reuse.
A demuxed packet the caller owns.
A player queues packets independently of its decoders, so a packet must outlive the read that produced it. The compressed payload remains reference counted; taking or copying ownership is an O(1) reference operation, not a copy of the compressed bytes.
Close every packet exactly once. Reading any property, copying it or sending it after close throws rather than resolving memory or a token that the allocator is free to reuse.
A demuxed packet the caller owns.
A player has to queue packets: it reads ahead of its decoders so a slow disk or a network stall does not stop playback. So a packet must outlive the read that produced it, which the batch API's packets deliberately do not.
Taking ownership costs nothing. The payload is reference counted inside FFmpeg and moved rather than copied, so this is a pointer swap and not a memcpy of the compressed data.
Close it exactly once. An unclosed packet leaks its buffer, and reading anything off it after that throws rather than dereferencing memory the allocator has taken back.
A demuxed packet the caller owns.
A player queues packets independently of its decoders, so a packet must outlive the read that produced it. The compressed payload remains reference counted; taking or copying ownership is an O(1) reference operation, not a copy of the compressed bytes.
Close every packet exactly once. Reading any property, copying it or sending it after close throws rather than resolving memory or a token that the allocator is free to reuse.
A demuxed packet the caller owns.
A player queues packets independently of its decoders, so a packet must outlive the read that produced it. The compressed payload remains reference counted; taking or copying ownership is an O(1) reference operation, not a copy of the compressed bytes.
Close every packet exactly once. Reading any property, copying it or sending it after close throws rather than resolving memory or a token that the allocator is free to reuse.
Properties
Byte offset in the container, or -1 when unknown.
Byte offset in the container, or -1 when unknown.
Byte offset in the container, or -1. Useful for progress when timestamps are broken.
Byte offset in the container, or -1 when unknown.
Byte offset in the container, or -1 when unknown.
Decode timestamp in timeBase units, or FrameInfo.NOPTS when absent.
Decode timestamp in timeBase units, or FrameInfo.NOPTS when absent.
Decode timestamp in timeBase units, or FrameInfo.NOPTS when absent.
Decode timestamp in timeBase units, or FrameInfo.NOPTS when absent.
Decode timestamp in timeBase units, or FrameInfo.NOPTS when absent.
dts converted to microseconds on the stream's own timeline, or null when absent.
dts converted to microseconds on the stream's own timeline, or null when absent.
dts converted to microseconds on the stream's own timeline. Null when there is no dts.
dts converted to microseconds on the stream's own timeline, or null when absent.
Duration in timeBase units. 0 when unknown, which is common and not an error.
duration converted to microseconds, or null when the container supplied none.
duration converted to microseconds, or null when the container supplied none.
duration converted to microseconds. Null when the container gave none.
duration converted to microseconds, or null when the container supplied none.
duration converted to microseconds, or null when the container supplied none.
Presentation timestamp in timeBase units, or FrameInfo.NOPTS when absent.
Presentation timestamp in timeBase units, or FrameInfo.NOPTS when absent.
Presentation timestamp in timeBase units, or FrameInfo.NOPTS when the container gave none.
Presentation timestamp in timeBase units, or FrameInfo.NOPTS when absent.
Presentation timestamp in timeBase units, or FrameInfo.NOPTS when absent.
pts converted to microseconds on the stream's own timeline, or null when absent.
pts converted to microseconds on the stream's own timeline, or null when absent.
pts converted to microseconds on the stream's own timeline. Null when there is no pts.
pts converted to microseconds on the stream's own timeline, or null when absent.
The stream's time base, so the caller can convert pts without looking the stream up.
Functions
Returns a separately owned O(1) reference to this packet's compressed payload and metadata. The two packets may be closed independently, in either order.
Returns a separately owned O(1) reference to this packet's compressed payload and metadata. The two packets may be closed independently, in either order.
Returns a separately owned O(1) reference to this packet's compressed payload and metadata. The two packets may be closed independently, in either order.
Returns a separately owned O(1) reference to this packet's compressed payload and metadata. The two packets may be closed independently, in either order.
The packet's compressed payload, copied (S4.c). For TEXT subtitle streams this is the cue body itself, which is why a subtitle decoder can be pure Kotlin. A copy per call: subtitle packets are tiny and rare; never call this per video packet.
The packet's compressed payload, copied (S4.c). For TEXT subtitle streams this is the cue body itself, which is why a subtitle decoder can be pure Kotlin. A copy per call: subtitle packets are tiny and rare; never call this per video packet.
The packet's compressed payload, copied (S4.c). For TEXT subtitle streams this is the cue body itself, which is why a subtitle decoder can be pure Kotlin. A copy per call: subtitle packets are tiny and rare; never call this per video packet.
The packet's compressed payload, copied (S4.c). For TEXT subtitle streams this is the cue body itself, which is why a subtitle decoder can be pure Kotlin. A copy per call: subtitle packets are tiny and rare; never call this per video packet.