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, falls in 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 did a search, and indicated that I should copy the file "opencv_ffmpeg{Versaodoopencvsempontos}. dll" for the Python root folder, 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 Python Lib/site-Packages folder
But none of it worked ...
I kept searching, and one 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 working.
So I downloaded the VLC media player, to ensure that I have the codecs installed, but keeps giving that video does not open. (The video runs on my players, both in mp4 and avi, without any problem)
I’m not finding a solution to this, someone has faced this kind of problem and knows how to solve it?
Could you translate your question?
– Gustavo Fragoso
Done! When I posted, I was in the English version, nor did I realize that I had been redirected to the en ... my fault!
– Bruno Felipe
The only apparent problems with your code are: (1) you use two different variables (
capture
andcap
) and (2) you do not use thecv2.waitKey(1)
, for example, to wait some time after the display of each frame of the video. About him printing error like there was a glitch in the video, I really couldn’t play it. If you installed Opencv with Pip, it should not even be necessary to copy any DLL.– Luiz Vieira