OpenCV VideoCapture cannot read video in Python, but in VS11

As a title, I cannot read the video using VideoCapture in python with the following code:

v = 'C:\\test.mp4' import cv2 cap = cv2.VideoCapture(v) if cap.isOpened(): print "Finally" else: print "BOOM" 

Paper is always printed. Sigh

While in VS11 the following code works:

 #include "stdafx.h" #include <opencv2\highgui\highgui.hpp> #include <iostream> using namespace cv; using namespace std; int main(int argc, char* argv[]) { string v = "C:\\test.mp4"; VideoCapture cap; cap.open(v); if (cap.isOpened()) { cout << "Yes!" << endl; } else { cout << "BOOM" << endl; } return 0; } 

I understand that there is some solution in SO, but nothing works for me. I have the following dlls in C: \ Python27 and C: \ Python27 \ DLL, as well as in PATH

  • opencv_ffmpeg.dll
  • opencv_ffmpeg_64.dll
  • opencv_ffmpeg_245_64.dll
  • opencv_ffmpeg_245.dll

I no longer know what has not yet been done.

Please help me. Thank you very much.

+4
source share
1 answer

I solved the problem by installing the binaries from this download link provided by this answer.

Copied all opencv dlls to C: \ Python27 (or possibly other files). But I do not understand why this did not work before, since I already included these DLLs in my PATH

+6
source

Source: https://habr.com/ru/post/1479133/


All Articles