9
votes

I am building a simple decoding application using FFMPEG API. I know there are solutions available in OpenCV but for specific reason I am refraining myself from using that. Since I am very new to FFMPEG (and to this community as well), I would like to know if there is any mistake that I might have done while building FFMPEG.

Compiler: I am using gcc 5.3.0 for compilation and building.

Following are the steps that I followed:

  1. I have build FFMPEG library using following configuration:

    ./configure --prefix=/home/dep/ffmpeg/install/ --pkg-config-flags=--static --enable-gpl --disable-yasm

  2. My compiling command is for the application:

    g++ -std=c++11 -I/home/dep/ffmpeg/install/include/ Queue.cpp Image.cpp CaptureFFMPEGFrame.cpp Object.cpp main.cpp -o main -L/home/dep/ffmpeg/install/lib -lavutil -lavcodec -lavformat -lavdevice -lavfilter -lswscale -lswresample -lpostproc -lpthread -lz -lrt -llzma -lbz2

The error I am facing is :

CaptureFFMPEGFrame.cpp:203:169: error: ‘PIX_FMT_BGR24’ was not declared in this scope
     mpFrameSwsContext = sws_getContext(mpAVCodecContext->width, mpAVCodecContext->height, mpAVCodecContext->pix_fmt, mpAVCodecContext->width, mpAVCodecContext->height, PIX_FMT_BGR24, SWS_BICUBIC, NULL, NULL, NULL)

My effort and understanding:

  1. From my understanding, libavutil/pixfmt.h contains pixel formats which I included along with other includes and the error persists. You can also see libraries I have included along with my application.

  2. Since my program is cpp code, therefore my headers are already included using extern "C", i.e. #include "libavcodec/avcodec.h"

Anything I might have missed?

Many thanks.

1
At some point it was renamed to AV_PIX_FMT_BGR24, perhaps it's the problem.Roman R.
Oh perfect! That works great, seems like I was following the old documentation (ffmpeg.org/doxygen/0.5/pixfmt_8h.html)msz
Many thanks Roman, new documentation is here for other readers : ffmpeg.org/doxygen/2.5/pixfmt_8h.htmlmsz
Newest doxygen documentation is always at "trunk", as in: ffmpeg.org/doxygen/trunk/pixfmt_8h.html You're linking to the 0.5 and 2.5 release branch documentation. If you're using code from the git master branch (the development branch) then use trunk; otherwise use the same release version number as you are using.llogan

1 Answers

14
votes

As of commit 78071a14, pixel formats have been prefixed with AV_, and the PIX_FMT_* defines were moves to libavutil/old_pix_fmts.h (which was included by the original pixfmt.h). This file was then removed in the next major version.

The fix (as described in the comments) was just to add this prefix to any PIX_FMT_* statements which haven't been updated yet.