2016-03-02 222 views
0

我試圖用CMake編譯器使用CMake安裝OpenCV 3.1.0。我得到一個錯誤,說文件哈希與預期的哈希不同。我無法在需要安裝的PC上訪問互聯網。我厭倦了將它成功安裝在帶有互聯網的PC上,以查看是否可以在沒有互聯網的情況下將這些文件複製到PC。但是,當CMake刪除這些文件並且嘗試以它自己的方式執行時,這並不起作用。我也試過this解決方案,但它沒有奏效。在Windows 7上使用CMake安裝OpenCV 3.1.0,opencv_ffmpeg.dll無效哈希

以下是錯誤消息:

CMake Warning at cmake/OpenCVUtils.cmake:872 (message): 
    Download: Local copy of opencv_ffmpeg.dll has invalid MD5 hash: 
    d41d8cd98f00b204e9800998ecf8427e (expected: 
    89c783eee1c47bfc733f08334ec2e31c) 
Call Stack (most recent call first): 
    3rdparty/ffmpeg/ffmpeg.cmake:10 (ocv_download) 
    cmake/OpenCVFindLibsVideo.cmake:206 (include) 
    CMakeLists.txt:536 (include) 

Downloading opencv_ffmpeg.dll... 
CMake Error at cmake/OpenCVUtils.cmake:895 (file): 
    file DOWNLOAD HASH mismatch 

    for file: [C:/OpenCV/opencv/sources/3rdparty/ffmpeg/downloads/89c783eee1c47bfc733f08334ec2e31c/opencv_ffmpeg.dll] 
     expected hash: [89c783eee1c47bfc733f08334ec2e31c] 
     actual hash: [d41d8cd98f00b204e9800998ecf8427e] 
      status: [6;"Couldn't resolve host name"] 

Call Stack (most recent call first): 
    3rdparty/ffmpeg/ffmpeg.cmake:10 (ocv_download) 
    cmake/OpenCVFindLibsVideo.cmake:206 (include) 
    CMakeLists.txt:536 (include) 


CMake Error at cmake/OpenCVUtils.cmake:899 (message): 
    Failed to download opencv_ffmpeg.dll. Status=6;"Couldn't resolve host 
    name" 
Call Stack (most recent call first): 
    3rdparty/ffmpeg/ffmpeg.cmake:10 (ocv_download) 
    cmake/OpenCVFindLibsVideo.cmake:206 (include) 
    CMakeLists.txt:536 (include) 

我希望能夠在不上網安裝此,但它證明非常diffucult。有沒有人有任何解決方案?

在此先感謝。

+0

有一個比較完整和好的教程[這裏](https://www.youtube.com/watch?v=akAAAvGyLn0) – Nacho

回答

-1
  1. 我發現子串ffmpeg.dllopencv\sources\3dparty\ffmpeg\ffmpeg.cmake

    set(FFMPEG_BINARIES_COMMIT "8aeefc4efe3215de89d8c7e114ae6f7a6091b8eb") 
    set(FFMPEG_FILE_HASH_BIN32 "89c783eee1c47bfc733f08334ec2e31c") 
    set(FFMPEG_FILE_HASH_BIN64 "35fe6ccdda6d7a04e9056b0d73b98e76") 
    set(FFMPEG_FILE_HASH_CMAKE "8606f947a780071f8fcce8cbf39ceef5") 
    set(FFMPEG_DOWNLOAD_URL https://raw.githubusercontent.com/Itseez/opencv_3rdparty/${FFMPEG_BINARIES_COMMIT}/ffmpeg/) 
    
    ocv_download(PACKAGE ...) 
    
  2. 下載文件: https://raw.githubusercontent.com/Itseez/opencv_3rdparty/8aeefc4efe3215de89d8c7e114ae6f7a6091b8eb/ffmpeg/ {opencv_ffmpeg.dll,opencv_ffmpeg_64.dll,ffmpeg_version.cmake}

    ,並把它複製到:

    opencv\sources\3rdparty\ffmpeg\downloads\%HASH%\ 
    
  3. 然後cmake.exe -G "CodeBlocks - MinGW Makefiles" .mingw32-make.exe

+0

GitHub的鏈接不起作用。你能解決它嗎? –

+1

@MartinGottweis,你可以從opencv倉庫下載這些二進制文件:https://github.com/opencv/opencv_3rdparty/tree/ffmpeg/master_20170418 – NiMirage