Table of Contents

avcodec_encode_audio

Overview

Defined in avcodec.h

Encodes an audio frame from samples into buf.
The avcodec_encode_audio() function encodes an audio frame from the input buffer samples. To encode it, it makes use of the audio codec which was coupled with avctx using avcodec_open(). The resulting encoded frame is stored in output buffer buf.

Note: The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large.

int avcodec_encode_audio(AVCodecContext *avctx,
                         uint8_t *buf,
                         int buf_size,
                         const short *samples);

Parameters

avctx

AVCodecContext *avctx

avctx the AVCodecContext codec context.

buf

uint8_t *buf

The output buffer.

buf_size

int buf_size

The output buffer size.

samples

const short *samples

The input buffer containing the samples.

Return value

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

See also

avcodec_encode_video(), avcodec_encode_subtitle()


Back to ffmpeg