“Undefined reference to `avcodec_alloc_frame” Error when compile and install Opencv on linux

asked 2016-04-06 18:47:34 -0600

KathyLee gravatar image

updated 2016-04-07 11:48:09 -0600

I am compiling and installing OpenCV using the steps in http://docs.opencv.org/2.4/doc/tutori...

But during "making" it, it has error when it reaches 45%. The error message is

...
[ 43%] Built target pch_Generate_opencv_video
[ 44%] Built target opencv_video
[ 44%] Built target opencv_p erf_video_pch_dephelp
[ 45%] Built target pch_Generate_opencv_perf_video  
Linking CXX executable ../../bin/opencv_perf_video
../../lib/libopencv_videoio.so.3.1.0: undefined reference to `avcodec_alloc_frame'
../../lib/libopencv_videoio.so.3.1.0: undefined reference to `avcodec_encode_video'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_perf_video] Error 1
make[1]: *** [modules/video/CMakeFiles/opencv_perf_video.dir/all] Error 2
make: *** [all] Error 2

I downloaded and installed the latest version of ffmpeg from https://www.ffmpeg.org/. And I installed ffmpeg following the steps on the compilation guide page https://trac.ffmpeg.org/wiki/Compilat.... I followed the steps and installed all the dependencies and libraries mentioned in the guide.

Anyone knows how can I fix the errors?

Thank you.

edit retag flag offensive close merge delete

Comments

Why not use the default libav libraries retrieved with sudo apt-get install libav? Instead of manually building ffmpeg?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-04-08 03:32:22 -0600 )edit