Ask Your Question

Compiling errors (3.0.0-alpha / Master Head) on Linux

asked 2014-10-02 08:13:06 -0600

ilyad gravatar image

I tried to compile opencv from sources:

1) first from the HEAD of master branch on github and then

2) from the zip file

In both cases I got the same error message:

Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o In file included from /home/ilya/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:65:0, from /home/ilya/opencv/modules/videoio/src/cap_ffmpeg.cpp:45: /home/ilya/opencv/modules/videoio/src/ffmpeg_codecs.hpp:98:7: error: ‘CODEC_ID_H264’ was not declared in this scope { CODEC_ID_H264, MKTAG('H', '2', '6', '4') },

I'm running Debian Testing distro, amd64 architecture.

Any idea what's wrong?

edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted

answered 2014-10-02 08:28:36 -0600

wezside gravatar image

When compiling for 64bit you need to make sure that FFMpeg, libx264 and libav is configured with 'configure --enable-pic'. But from the error it would appear that FFMpeg does not include the x264 codec. So maybe try to install libx264 first.

edit flag offensive delete link more


I did it: installed the package libx264-dev, cleaned the working directory and run "cmake . && make" again. Alas, same error message...

ilyad gravatar imageilyad ( 2014-10-02 14:48:29 -0600 )edit

answered 2014-11-03 09:56:45 -0600

I had the same problem (Debian jessie 64bit + opencv 3.0.0-alpha)! It seems to be a FFMPEG / LIBAV compatibility problem :/ (link text)

Here is the solution: link text

This solution worked for me.

Best regards,

edit flag offensive delete link more

answered 2014-10-10 04:14:04 -0600

ilyad gravatar image

A valid workaround is to disable "FFMPEG support" in CMakeLists.txt:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5301f82..d5649b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -125,7 +125,7 @@ OCV_OPTION(WITH_CUBLAS         "Include NVidia Cuda Basic Linear Algebra Subprog
 OCV_OPTION(WITH_NVCUVID        "Include NVidia Video Decoding library support"                                OFF IF (NOT IOS AND NOT APPLE) )
 OCV_OPTION(WITH_EIGEN          "Include Eigen2/Eigen3 support"               ON)
 OCV_OPTION(WITH_VFW            "Include Video for Windows support"           ON   IF WIN32 )
-OCV_OPTION(WITH_FFMPEG         "Include FFMPEG support"                      ON   IF (NOT ANDROID AND NOT IOS))
+OCV_OPTION(WITH_FFMPEG         "Include FFMPEG support"                      OFF  IF (NOT ANDROID AND NOT IOS))
 OCV_OPTION(WITH_GSTREAMER      "Include Gstreamer support"                   ON   IF (UNIX AND NOT APPLE AND NOT ANDROID) )
 OCV_OPTION(WITH_GSTREAMER_0_10 "Enable Gstreamer 0.10 support (instead of 1.x)"                              OFF )
 OCV_OPTION(WITH_GTK            "Include GTK support"                         ON   IF (UNIX AND NOT APPLE AND NOT ANDROID) )
edit flag offensive delete link more



you can also pass this to cmake with -DWITH_FFMPEG=0 so you don't have to hack into files to disable/enable a certain option

boaz001 gravatar imageboaz001 ( 2014-10-10 04:19:24 -0600 )edit

Question Tools

1 follower


Asked: 2014-10-02 08:13:06 -0600

Seen: 2,209 times

Last updated: Nov 03 '14