EncodedFrame

The EncodedFrame message is an output of the VideoEncoder node. This message is used to represent a frame that has been encoded by the VideoEncoder. It provides various properties and methods for interacting with the encoded frame data.

Structure

The EncodedFrame class inherits from Buffer and includes several nested classes and methods for accessing and modifying frame properties. Here are the primary components of the EncodedFrame class:

  • FrameType: Enumerates the types of frames that can be encoded (I, P, B, Unknown).

  • Profile: Indicates the encoding profile used (AVC, HEVC, JPEG).

FrameType

The FrameType class identifies the type of the encoded frame. The available types are:

  • B: Represents a bi-directional predicted frame.

  • I: Represents an intra-coded frame.

  • P: Represents a predicted frame.

  • Unknown: Used when the frame type cannot be determined.

Profile

The Profile class specifies the encoding profile used for the frame. The supported profiles are:

  • AVC: H.264/AVC encoding profile.

  • HEVC: H.265/HEVC encoding profile.

  • JPEG: JPEG encoding profile.

Reference

class depthai.EncodedFrame
class FrameType

Members:

I

P

B

Unknown

property name
class Profile

Members:

JPEG

AVC

HEVC

property name
getBitrate(self: depthai.EncodedFrame)int
getColorTemperature(self: depthai.EncodedFrame)int
getData(self: object) → numpy.ndarray[numpy.uint8]
getExposureTime(self: depthai.EncodedFrame)datetime.timedelta
getFrameType(self: depthai.EncodedFrame)depthai.RawEncodedFrame.FrameType
getInstanceNum(self: depthai.EncodedFrame)int
getLensPosition(self: depthai.EncodedFrame)int
getLensPositionRaw(self: depthai.EncodedFrame)float
getLossless(self: depthai.EncodedFrame)bool
getProfile(self: depthai.EncodedFrame)depthai.RawEncodedFrame.Profile
getQuality(self: depthai.EncodedFrame)int
getRaw(self: depthai.ADatatype)depthai.RawBuffer
getSensitivity(self: depthai.EncodedFrame)int
getSequenceNum(self: depthai.EncodedFrame)int
getTimestamp(self: depthai.EncodedFrame)datetime.timedelta
getTimestampDevice(self: depthai.EncodedFrame)datetime.timedelta
setBitrate(self: depthai.EncodedFrame, arg0: int)depthai.EncodedFrame
setData(*args, **kwargs)

Overloaded function.

  1. setData(self: depthai.Buffer, arg0: list[int]) -> None

  2. setData(self: depthai.Buffer, arg0: numpy.ndarray[numpy.uint8]) -> None

setFrameType(self: depthai.EncodedFrame, arg0: depthai.RawEncodedFrame.FrameType)depthai.EncodedFrame
setLossless(self: depthai.EncodedFrame, arg0: bool)depthai.EncodedFrame
setProfile(self: depthai.EncodedFrame, arg0: depthai.RawEncodedFrame.Profile)depthai.EncodedFrame
setQuality(self: depthai.EncodedFrame, arg0: int)depthai.EncodedFrame
setSequenceNum(self: depthai.EncodedFrame, arg0: int)depthai.EncodedFrame
setTimestamp(self: depthai.EncodedFrame, arg0: datetime.timedelta)depthai.EncodedFrame
setTimestampDevice(self: depthai.EncodedFrame, arg0: datetime.timedelta)depthai.EncodedFrame
class dai::EncodedFrame : public dai::Buffer

Public Types

using Profile = RawEncodedFrame::Profile
using FrameType = RawEncodedFrame::FrameType

Public Functions

EncodedFrame()

Construct EncodedFrame message. Timestamp is set to now

EncodedFrame(std::shared_ptr<RawEncodedFrame> ptr)
~EncodedFrame() = default
unsigned int getInstanceNum() const

Retrieves instance number

std::chrono::microseconds getExposureTime() const

Retrieves exposure time

int getSensitivity() const

Retrieves sensitivity, as an ISO value

int getColorTemperature() const

Retrieves white-balance color temperature of the light source, in kelvins

int getLensPosition() const

Retrieves lens position, range 0..255. Returns -1 if not available

float getLensPositionRaw() const

Retrieves lens position, range 0.0f..1.0f. Returns -1 if not available

unsigned int getQuality() const

Retrieves the encoding quality

unsigned int getBitrate() const

Retrieves the encoding bitrate

bool getLossless() const

Returns true if encoding is lossless (JPEG only)

FrameType getFrameType() const

Retrieves frame type (H26x only)

Profile getProfile() const

Retrieves the encoding profile (JPEG, AVC or HEVC)

EncodedFrame &setTimestamp(std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> tp)

Retrieves image timestamp related to dai::Clock::now()

EncodedFrame &setTimestampDevice(std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> tp)

Sets image timestamp related to dai::Clock::now()

EncodedFrame &setSequenceNum(int64_t seq)

Specifies sequence number

Parameters
  • seq: Sequence number

EncodedFrame &setInstanceNum(unsigned int instance)

Instance number relates to the origin of the frame (which camera)

Parameters
  • instance: Instance number

EncodedFrame &setQuality(unsigned int quality)

Specifies the encoding quality

Parameters
  • quality: Encoding quality

EncodedFrame &setBitrate(unsigned int bitrate)

Specifies the encoding quality

Parameters
  • quality: Encoding quality

EncodedFrame &setLossless(bool lossless)

Specifies if encoding is lossless (JPEG only)

Parameters
  • lossless: True if lossless

EncodedFrame &setFrameType(FrameType type)

Specifies the frame type (H26x only)

Parameters
  • type: Type of h26x frame (I, P, B)

EncodedFrame &setProfile(Profile profile)

Specifies the encoding profile

Parameters
  • profile: Encoding profile

Private Functions

std::shared_ptr<RawBuffer> serialize() const override

Private Members

RawEncodedFrame &frame

Got questions?

Head over to Discussion Forum for technical support or any other questions you might have.