ffmpeglibavcodeclibavlibavformat

FFMPEG: Is it possible to get coded_width in new API?


Consider following code (without initialization for brevity).

AVFormatContext *formatCtx;
int coded_width = formatCtx->streams[videoStreamIndex]->codec->coded_width;

In old API it was possible to get coded_width and coded_height this way. Currently it is deprecated. There is AVCodecParametersstruct but it provides only:

int width
int height

which may be different from

int coded_width
int coded_height

So, is it possible to get coded_width without using deprecated streams[videoStreamIndex]->codec?


Solution

  • My apologies for the late response. According to the response of @the kamilz FFMPEG: Is it possible to get coded_width in new API? the best solution seems to just suppress this warning in the header file. (I' m using gcc compiler).

    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"