Error in building opencv with ffmpeg

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.0/modules/videoio/src/cap_ffmpeg_impl.hpp

Compile and everything works even with the latest sources


Easiest change for the CODEC_FLAG_GLOBAL_HEADER is to change it to AV_CODEC_FLAG_GLOBAL_HEADER, it was redefined in a newer version.

Note the "AV_" in front

Tags:

C++

Ffmpeg

Opencv