Class VideoEncoder
Defined in File VideoEncoder.hpp
Inheritance Relationships
Base Type
public dai::DeviceNodeCRTP< DeviceNode, VideoEncoder, VideoEncoderProperties >(Template Class DeviceNodeCRTP)
Class Documentation
-
class VideoEncoder : public dai::DeviceNodeCRTP<DeviceNode, VideoEncoder, VideoEncoderProperties>
VideoEncoder node. Encodes frames into MJPEG, H264 or H265.
Public Functions
-
std::shared_ptr<VideoEncoder> build(Node::Output &input)
-
void setDefaultProfilePreset(float fps, Properties::Profile profile)
Sets a default preset based on specified frame rate and profile
- Parameters:
fps – Frame rate in frames per second
profile – Encoding profile
-
void setNumFramesPool(int frames)
Set number of frames in pool
- Parameters:
frames – Number of pool frames
-
int getNumFramesPool() const
Get number of frames in pool
- Returns:
Number of pool frames
-
void setRateControlMode(Properties::RateControlMode mode)
Set rate control mode.
-
void setProfile(Properties::Profile profile)
Set encoding profile.
-
void setBitrate(int bitrate)
Set output bitrate in bps, for CBR rate control mode. 0 for auto (based on frame size and FPS)
-
void setBitrateKbps(int bitrateKbps)
Set output bitrate in kbps, for CBR rate control mode. 0 for auto (based on frame size and FPS)
-
void setKeyframeFrequency(int freq)
Set keyframe frequency. Every Nth frame a keyframe is inserted.
Applicable only to H264 and H265 profiles
Examples:
30 FPS video, keyframe frequency: 30. Every 1s a keyframe will be inserted
60 FPS video, keyframe frequency: 180. Every 3s a keyframe will be inserted
-
void setNumBFrames(int numBFrames)
Set number of B frames to be inserted.
-
void setQuality(int quality)
Set quality
- Parameters:
quality – Value between 0-100%. Approximates quality
-
void setLossless(bool lossless)
Set lossless mode. Applies only to [M]JPEG profile
- Parameters:
lossless – True to enable lossless jpeg encoding, false otherwise
-
void setFrameRate(float frameRate)
Sets expected frame rate
- Parameters:
frameRate – Frame rate in frames per second
-
void setMaxOutputFrameSize(int maxFrameSize)
Specifies maximum output encoded frame size
-
Properties::RateControlMode getRateControlMode() const
Get rate control mode.
-
Properties::Profile getProfile() const
Get profile.
-
int getBitrate() const
Get bitrate in bps.
-
int getBitrateKbps() const
Get bitrate in kbps.
-
int getKeyframeFrequency() const
Get keyframe frequency.
-
int getNumBFrames() const
Get number of B frames.
-
int getQuality() const
Get quality.
-
float getFrameRate() const
Get frame rate.
-
bool getLossless() const
Get lossless mode. Applies only when using [M]JPEG profile.
-
int getMaxOutputFrameSize() const
-
inline DeviceNodeCRTP()
-
inline DeviceNodeCRTP(std::unique_ptr<Properties> props)
-
inline DeviceNodeCRTP(std::unique_ptr<Properties> props, bool confMode)
Public Members
-
Input input = {*this, {"in", DEFAULT_GROUP, DEFAULT_BLOCKING, DEFAULT_QUEUE_SIZE, {{{DatatypeEnum::ImgFrame, true}}}, DEFAULT_WAIT_FOR_MESSAGE}}
Input for NV12 ImgFrame to be encoded
-
Output bitstream = {*this, {"bitstream", DEFAULT_GROUP, {{{DatatypeEnum::ImgFrame, false}}}}}
Outputs ImgFrame message that carries BITSTREAM encoded (MJPEG, H264 or H265) frame data. Mutually exclusive with out.
-
Output out = {*this, {"out", DEFAULT_GROUP, {{{DatatypeEnum::EncodedFrame, false}}}}}
Outputs EncodedFrame message that carries encoded (MJPEG, H264 or H265) frame data. Mutually exclusive with bitstream.
Public Static Attributes
-
static constexpr const char *NAME = "VideoEncoder"
-
std::shared_ptr<VideoEncoder> build(Node::Output &input)