Python2.7 with OpenCV 3.3.0 - VideoCapture problem

0

I'm running OpenCV 3.3.0. with Python 2.7 on a Windows 7 Professional x64 machine, and when I run the code below, it falls on the prints "Something went wrong" and "Finished ..."

import cv2

capture = cv2.VideoCapture("video.mp4") #The video is in the same folder

if(not capture.isOpened()):
    print "Something went wrong"

while(cap.isOpened()):
     ret, frame = cap.read()

     cv2.imshow('Frame', frame)

print "Finished ..."

capture.release()
cv2.destroyAllWindows()

I gave a searched, and indicated that I should copy the file "opencv_ffmpeg {Version ofOpenCvSemPontos} .dll" to the root folder of Python, and so I did.

I copied the file "opencv_ffmpeg330_64.dll" (and also copied renamed as "opencv_ffmpeg330.dll") to:

  • The Python root folder
  • The Python DLLs folder
  • The Python Lib folder
  • The Lib / Python site-packages folder

But none of this worked ...

I kept searching, and a topic suggested that it was codec problems, so I downloaded FFMPEG, added it to my PATH environment variable, converted my "video.mp4" to "video.avi" with ffmpeg, but nothing to work.

So I downloaded the VLC media player, to make sure I have the codecs installed, but still giving the video does not open. (The video runs on my players, both in mp4 and avi, with no problem)

I'm not finding a solution to this, has anyone ever faced this type of problem and know how to solve it?

    
asked by anonymous 08.09.2017 / 20:15

1 answer

0

I decided to downgrade OpenCV to OpenCV 3.0.0.

I copied cv.pyd to the Lib / site-packages folder of Python, and the file opencv_ffmpeg300.dll to the root folder of Python, and it worked!

    
15.09.2017 / 19:47