title: "Undefined reference to `avcodec_alloc_frame" Error when compile and install Opencv on linux
body: <p>I am compiling and installing OpenCV using the steps in <a href="http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html" rel="nofollow">http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html</a></p>
  
  <p>But during "making" it, it has error when it reaches 45%. The error message is </p>
  
  <pre><code>...
  [ 43%] Built target pch_Generate_opencv_video
  [ 44%] Built target opencv_video
  [ 44%] Built target opencv_perf_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
  </code></pre>
  
  <p>I downloaded and installed the latest version of ffmpeg from <a href="https://www.ffmpeg.org/" rel="nofollow">https://www.ffmpeg.org/</a>. </p>
  
  <p>Anyone knows how can I fix the errors?</p>
  
  <p>Thank you. </p>