FFMPEG: 'PIX_FMT_BGR24 has not been declared in this area

I am creating a simple decoding application using the FFMPEG API. I know there are solutions in OpenCV, but for some reason I refrain from doing this. Since I am very new to FFMPEG (and in this community), I would like to know if there is any mistake that I could make when creating FFMPEG.

Compiler I am using gcc 5.3.0 to compile and build.

Below are the steps that I followed:

  • I have an FFMPEG library using the following configuration:

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

  • My compilation 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

I ran into a problem:

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:

  • In my opinion, libavutil / pixfmt.h contains the pixel formats that I included along with the others included, and the error persists. You can also see the libraries that I included with my application.

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

Anything I could miss?

Thank you very much.

+5
source share
1 answer

At the time of fixing 78071a14 , the pixel formats were prefix with AV_ , and PIX_FMT_* is a move to libavutil/old_pix_fmts.h (which was included by the original pixfmt.h ). This file was then deleted in the next major version.

The fix (as described in the comments) was to simply add this prefix to any PIX_FMT_* statements that have not yet been updated.

+7
source

All Articles