[Libav-user] avcodec_open2() sets frame_size to zero
jpboard2 at yahoo.com
Tue Nov 3 19:52:15 CET 2015
I'm writing a simple C program to read an AVI file as input (it contains an uncompressed video and audio stream) and produces an AVI file as output. In both input and output files, the audio is not compressed and the codec is AV_CODEC_ID_PCM_S16LE.
In my simple program, I call avcodec_open2() to open the output context for the codex. The problem is that this sets the frame_size member of the AVCodecContext to zero. The comments for AVCodecContext in file avcodec.h specifically state that frame_size should be set by avcodec_open2(), and they should not be initialized by the user.
So, why is it being set to zero? Is it because I'm using an uncompressed or 'raw' format for the audio samples? How should I handle this? Should I set it manually?
Also, in general, when I use a specific audio codec, how do I know how to properly initialized the various libAV data structures (AVCodecContext, AVCodex, AVFrame, etc)? It seems to be different for each codec.
More information about the Libav-user