AV module

VideoEncoder

Encodes raw video frames into a compressed format.

VideoEncoder

#include <icy/av/videoencoder.h>

Inherits: VideoContext Subclassed by: VideoPacketEncoder

Encodes raw video frames into a compressed format.

Public Attributes

ReturnNameDescription
AVFormatContext *format

format

AVFormatContext * format

Public Methods

ReturnNameDescription
VideoEncoderConstruct an encoder, optionally tied to an existing muxer context.
voidcreate virtualInitialise the AVCodecContext using oparams. Adds a video stream to format if one was provided at construction.
voidclose virtualClose and free the AVCodecContext and associated resources.
boolencode virtualEncode a single video frame. This method is for interleaved video formats.
boolencode virtualEncode a single video frame. This method is for planar video formats.
boolencode virtualEncode a single AVFrame (typically from a decoder or converter).
voidflush virtualFlush remaining packets to be encoded. This method should be called once before stream closure.

VideoEncoder

VideoEncoder(AVFormatContext * format)

Construct an encoder, optionally tied to an existing muxer context.

Parameters

  • format The AVFormatContext that will receive encoded packets, or nullptr for standalone use.

create

virtual

virtual void create()

Initialise the AVCodecContext using oparams. Adds a video stream to format if one was provided at construction.


close

virtual

virtual void close()

Close and free the AVCodecContext and associated resources.


encode

virtual

virtual bool encode(uint8_t * data, int size, int64_t pts)

Encode a single video frame. This method is for interleaved video formats.

Parameters

  • data The raw video frame buffer.

  • size The buffer size in bytes.

  • pts The presentation timestamp in stream time base units.


encode

virtual

virtual bool encode(uint8_t * data, int linesize, int64_t pts)

Encode a single video frame. This method is for planar video formats.

Parameters

  • data Array of per-plane data pointers (up to 4 planes).

  • linesize Array of per-plane byte strides.

  • pts The presentation timestamp in stream time base units.


encode

virtual

virtual bool encode(AVFrame * iframe)

Encode a single AVFrame (typically from a decoder or converter).

Parameters

  • iframe The source video frame with all fields set.

Returns

True if an encoded packet was produced and emitted.


flush

virtual

virtual void flush()

Flush remaining packets to be encoded. This method should be called once before stream closure.