FFMPEG:在此范围内未声明“PIX_FMT_BGR24” [英] FFMPEG: ‘PIX_FMT_BGR24’ was not declared in this scope
问题描述
编译器:我正在使用gcc 5.3.0进行编译和构建。
以下是我遵循的步骤:
-
我已经使用以下配置构建了FFMPEG库:
./ configure --prefix = / home / dep / ffmpeg / install / --pkg-config-flags = - static --enable-gpl --disable -yasm
-
我的编译命令是针对应用程序:
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
我遇到的错误是:
CaptureFFMPEGFrame.cpp:203:169:错误:'PIX_FMT_BGR24'未在此范围内声明
mpFra meSwsContext = sws_getContext(mpAVCodecContext-> width,mpAVCodecContext-> height,mpAVCodecContext-> pix_fmt,mpAVCodecContext-> width,mpAVCodecContext-> height,PIX_FMT_BGR24,SWS_BICUBIC,NULL,NULL,NULL)
我的努力和理解:
-
从我的理解,libavutil / pixfmt.h包含像其他包含的像素格式,错误仍然存在。您还可以看到我的应用程序包含的库。
-
由于我的程序是cpp代码,因此我的头文件已经包含使用externC,即
#includelibavcodec / avcodec .h
我可能错过了什么?
非常感谢。
关于提交 78071a14 ,像素格式前缀为 AV _
,而$ code > PIX_FMT _ * 定义是移动到 libavutil / old_pix_fmts.h
(由原始 pixfmt.h
)。该文件在下一个主要版本中被删除。
修正(如评论中所述)只是将此前缀添加到任何 PIX_FMT _ *
语句中没有更新。
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:
I have build FFMPEG library using following configuration:
./configure --prefix=/home/dep/ffmpeg/install/ --pkg-config-flags=--static --enable-gpl --disable-yasm
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:
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.
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.
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.
这篇关于FFMPEG:在此范围内未声明“PIX_FMT_BGR24”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!