I installed ffmpeg according to this article. ffmpeg installation was ok. Now I build opencv with ffmpeg support and I have some errors. The errors are

/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp::: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp::: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if (oc->oformat->flags & AVFMT_RAWPICTURE) {
^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘void CvVideoWriter_FFMPEG::close()’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp::: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if( (oc->oformat->flags & AVFMT_RAWPICTURE) == )
^
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp::: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope
if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
^
In file included from /home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg.cpp:::
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp: In static member function ‘static AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext*, AVCodecID, int, int, int, double, AVPixelFormat)’:
/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp::: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
^
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o' failed
make[]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o] Error
CMakeFiles/Makefile2:: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed

What could be wrong?

My solution is to grep the missing defines (2 in total) from FFmpeg by using grep -r which leads to the following code found in libavcodec/avcodec.h:

#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
#define AVFMT_RAWPICTURE 0x0020

Copy and paste it to the top of:

opencv-3.3./modules/videoio/src/cap_ffmpeg_impl.hpp

Compile and everything works even with the latest sources.

Error in building opencv with ffmpeg的更多相关文章

  1. Patch to solve sqlite3_int64 error when building Python 2.7.3 on RHEL/CentOS

    Patch to solve sqlite3_int64 error when building Python 2.7.3 on RHEL/CentOS Patch to solve sqlite3_ ...

  2. 使用Qt报错error while building deploying project

    方法一:点击左侧的“项目”栏,看“构建目录”栏的路径,一定要注意,在路径中一定不要出现汉字,否则一定会报“error while building deploying project”的错误. 方法二 ...

  3. Error when Building GPU docker image for caffe: Unsupported gpu architecture 'compute_60'

    issue: Error when Building GPU docker image for caffe: Unsupported gpu architecture 'compute_60' rea ...

  4. error MSB8031: Building an MFC project for a non-Unicode character set is deprecated

    vs2013编译VC++源码,错误: error MSB8031: Building an MFC project for a non-Unicode character set is depreca ...

  5. error MSB8031: Building an MFC project for a non-Unicode character set is deprecated. You must change the project property to Unicode or download an additional library. See http://go.microsoft.co

    Win10,也重新装了免费版的Visual Studio 2013 y,写MFC程序时候发现这样的提示: error MSB8031: Building an MFC project for a no ...

  6. OpenCV和ffmpeg编码资料分享

    本博也是在进行视频转码的学习道路上,也只是菜鸟一枚,收集了大量的资料,想在这和同路人分享一下 在博园里我发表一个JavaCV的随笔,里面介绍了JavaCV这个框架,它整合了OpenCV和ffmpeg等 ...

  7. Qt新安装之后出现Error while building/deploying (kit: Desktop Qt 5.7.0 GCC 64bit) When executing step "Make”

      Ubuntu14.04初次安装Qt之后可能出现Error while building/deploying project *** (kit: Desktop Qt 5.7.0 GCC 64bit ...

  8. jupyter notebook使用时路径问题和kernel error,安装opencv

    修改路径: 在C:\Users\Administrator\ .jupyter 目录下面只有一个“migrated”文件. 打开命令窗口(运行->cmd),进入python的Script目录下输 ...

  9. Qt.Qt新安装之后出现Error while building/deploying (kit: Desktop Qt 5.7.0 GCC 64bit) When executing step "Make”

    出问题的环境: 操作系统: Ubuntu18.04 安装包: qt-opensource-linux-x64-5.8.0.run 现象: 新建一个Hello World项目, 试着运行, 出现以下提示 ...

随机推荐

  1. ndoejs处理编码的爬虫

    var express=require('express');var http=require('http');var cheerio=require('cheerio');var fs=requir ...

  2. Windows关闭开机自启项

    https://zhidao.baidu.com/question/562559980.html

  3. [bcc32 Error] ws2def.h(231): E2238 Multiple declaration for 'sockaddr'

    [bcc32 Error] ws2def.h(231): E2238 Multiple declaration for 'sockaddr'  Full parser context    ksrGe ...

  4. mysql Lock wait timeout exceeded; try restarting transaction解决

    前面已经了解了InnoDB关于在出现锁等待的时候,会根据参数innodb_lock_wait_timeout的配置,判断是否需要进行timeout的操作,本文档介绍在出现锁等待时候的查看及分析处理: ...

  5. Unable to locate Spring NamespaceHandler for XML schema namespace

    1. 问题 本文将讨论Spring中最常见的配置问题 —— Spring的一个命名空间的名称空间处理程序没有找到. 大多数情况下,是由于一个特定的Spring的jar没有配置在classpath下,让 ...

  6. 【363】python 相关小技巧

    1. 对列表进行乱序 通过 random.shuffle() 方法实现,直接对列表进行操作 >>> import random >>> a = list(range ...

  7. [Linux]实际操作中命令 su 与 sudo 的区别

    ------------------------------------------------------------------------------------------------ 首先我 ...

  8. gitbash上使用tree

    gitbash上使用tree vscode从cmd设置gitbash之后,想在使用windows下的tree命令发现运行不了,有两种解决方案. 1,在gitbash上cmd //c tree,就等同c ...

  9. editable : false与 readonly 的区别

    editable : false 不能输入 readonly:不可操作,只能看

  10. JQuery/JS插件 zTree树,点击当前节点展开,其他节点关闭

    好像没找到现成的,就自己写了一个demo. 效果如下: 代码: <!DOCTYPE html> <html> <head> <meta http-equiv= ...