[Libav-user] Audio encoding: more samples than frame size (avcodec_encode_audio2)

Carl Eugen Hoyos ceffmpeg at gmail.com
Tue Sep 20 18:28:04 EEST 2016

2016-09-20 10:02 GMT+02:00 Yu Ang Tan <yuang86 at gmail.com>:
> I am trying to read an RTP audio stream, and encode it into a FLAC file.
> However, when I am reading the stream, I get this error:
>     [libvorbis @ 028b1520] more samples than frame size
> (avcodec_encode_audio2)

Are you sure that you are encoding to flac?

> During debug mode, it seems the frame_size of my input and output codec
> context are mismatched:
>     inCodecCtx->frame_size = 1152;
>     outCodecCtx->frame_size = 64;
> I tried to write 1152 to outCodecCtx->frame_size, but it gets overwritten
> with 64 at `avcodec_open2()`. Why can't I set the frame_size to match the
> input frame_size?

My guess is that you are using a different codec for output than for input.

Carl Eugen

More information about the Libav-user mailing list