我正在使用FFMPEG API构建一个简单的解码应用程序.我知道OpenCV中有解决方案,但出于特殊原因我不会使用它.由于我对FFMPEG(以及这个社区)都很新,我想知道在构建FFMPEG时我是否有任何错误.
编译器:我正在使用gcc 5.3.0进行编译和构建.
以下是我遵循的步骤:
我使用以下配置构建了FFMPEG库:
./configure --prefix =/home/dep/ffmpeg/install/--pkg-config-flags = - static --enable-gpl --disable-yasm
我的编译命令是针对应用程序的:
克++ -std = C++ 11 -I /家/沉积/ FFMPEG /安装/包含/ Queue.cpp Image.cpp CaptureFFMPEGFrame.cpp Object.cpp的main.cpp -o主-L /家/沉积/ FFMPEG /安装/ LIB -lavutil -lavcodec -lavformat -lavdevice -lavfilter -lswscale -lswresample -lpostproc -lpthread -lz -lrt -llzma -lbz2
我面临的错误是:
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)
Run Code Online (Sandbox Code Playgroud)
我的努力和理解:
根据我的理解,libavutil/pixfmt.h包含我包含的像素格式以及其他包含,并且错误仍然存在.您还可以查看我的应用程序中包含的库.
由于我的程序是cpp代码,因此我的标题已经包含在extern"C"中,即 #include "libavcodec/avcodec.h"
我可能错过了什么?
非常感谢.