Table of Contents

avcodec_encode_video

Overview

Defined in avcodec.h

Encodes a video frame from pict into buf.
The avcodec_encode_video() function encodes a video frame from the input pict. To encode it, it makes use of the video codec which was coupled with avctx using avcodec_open(). The resulting encoded bytes representing the frame are stored in the output buffer buf. The input picture should be stored using a specific format, namely avctx.pix_fmt.

int avcodec_encode_video(AVCodecContext *avctx,
                         uint8_t *buf,
                         int buf_size,
                         const AVFrame *pict);

Parameters

avctx

AVCodecContext *avctx

avctx the AVCodecContext codec context.

buf

uint8_t *buf

The output buffer for the bitstream of encoded frame.

buf_size

int buf_size

The size of the output buffer in bytes.

pict

const AVFrame *pict

The input picture to encode in an AVFrame.

Return value

On error a negative value is returned, on success zero or the number of bytes used from the input buffer.

See also

avcodec_encode_audio(), avcodec_encode_subtitle()


Back to ffmpeg