1、Configure會報一些紅色的警告信息,好比:git
1 CMake Warning at cmake/OpenCVDownload.cmake:193 (message): 2 FFMPEG: Download failed: 7;"Couldn't connect to server" 3 4 For details please refer to the download log file: 5 6 D:/study/opencv_with_contrib_test_sln/CMakeDownloadLog.txt 7 8 Call Stack (most recent call first): 9 3rdparty/ffmpeg/ffmpeg.cmake:20 (ocv_download) 10 cmake/OpenCVFindLibsVideo.cmake:200 (download_win_ffmpeg) 11 CMakeLists.txt:636 (include)
提示FFMPEG下載失敗,由於沒法鏈接到服務器,打開 CMakeDownloadLog.txt 查看詳細信息。github
2、打開CMakeDownloadLog.txt服務器
#use_cache "D:/study/opencv-4.0.0/.cache" #do_copy "opencv_ffmpeg.dll" "849286ccc527c99e5a218b67f13c6e8c" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/759a23e24ab787a0979f8a93103dcc3105ec10c1/ffmpeg/opencv_ffmpeg.dll" "D:/study/opencv_with_contrib_test_sln/3rdparty/ffmpeg" 這兩句的意思是說將 opencv_ffmpeg.dll(它的md5簽名是 849286ccc527c99e5a218b67f13c6e8c,下載地址是 "https://raw.githubusercontent.com/opencv/opencv_3rdparty/759a23e24ab787a0979f8a93103dcc3105ec10c1/ffmpeg/opencv_ffmpeg.dll" ) 從 "D:/study/opencv-4.0.0/.cache" 拷貝到 "D:/study/opencv_with_contrib_test_sln/3rdparty/ffmpeg"目錄下。 #missing "D:/study/opencv_with_contrib_test_sln/3rdparty/ffmpeg/opencv_ffmpeg.dll" 目標目錄下沒有此文件 #cmake_download "D:/study/opencv-4.0.0/.cache/ffmpeg/849286ccc527c99e5a218b67f13c6e8c-opencv_ffmpeg.dll" "https://raw.githubusercontent.com/opencv/opencv_3rdparty/759a23e24ab787a0979f8a93103dcc3105ec10c1/ffmpeg/opencv_ffmpeg.dll" 下載此文件到源代碼路徑 /.cache/ffmpeg/,並命名爲"md5-文件名" # timeout on name lookup is not supported # Trying 151.101.108.133... # TCP_NODELAY set # connect to 151.101.108.133 port 443 failed: Connection refused # Failed to connect to raw.githubusercontent.com port 443: Connection refused # Closing connection 0 # 鏈接到服務器失敗
3、分析ide
公司工做機沒法訪問外網,天然就沒法鏈接到下載服務器。那就直接經過外網下載好須要的文件,而後重命名爲"md5-文件名",放在 /.cache/ffmpeg/ 文件夾下面,或者直接放到目標路徑 /3rdparty/ffmpeg/opencv_ffmpeg.dll(不用重命名)。spa
注意:3d
一、 https://raw.githubusercontent.com/opencv/opencv_3rdparty/759a23e24ab787a0979f8a93103dcc3105ec10c1/ffmpeg/ffmpeg_version.cmake" 沒法直接下載,code
而是直接打開了ffmpeg_version.cmake,能夠右鍵網頁選擇另存爲 ffmpeg_version.cmake.txt,而後再改成ffmpeg_version.cmake。這裏若是本身新建一個txt,而後直接將網頁上的內容拷進去,而後再該後綴爲.cmake是不行的,會提示md5不匹配。server
二、不一樣版本的OpenCV對應的 opencv_ffmpeg.dll 等缺失文件的 md5 簽名是不同的blog
4、總結md5
一、問題不難,一步一步的去求解;
二、沉下心來看英文,比六級簡單得多;
三、ffmpeg_version.cmake 這個直接經過鏈接是不能直接下載的,本身新建一個.cmake不行的時候就去看下爲何不行,而不是不停的重複相同的操做以指望奇蹟的出現。
四、當發現百度到的解決辦法基本雷同時,就沒必要花大量時間去檢索和本身的問題如出一轍的博文了,這樣只會浪費時間,心情也會變得焦躁,此時應該冷靜的去思考。