Similiar to OpenCV 2.4 VideoCapture not working on Windows
The result is a window with a grey image for about 2 seconds before closing and displaying "End of video
import cv2
import imutils
vidPath = "filename.mp4"
video = cv2.VideoCapture(vidPath)
index = 0;
while True:
print (index)
index += 1
ret, frame = video.read()
if ret == False:
print("End of video")
break
frame = imutils.resize(frame, width = 500)
cv2.imshow("Video", frame)
video.release()
cv2.destroyAllWindows()
'ret' always returns false after the index print gets to about 900, with nothing useful displaying on the window at all. The video in question is roughly 2 minutes long.
Windows 10, Python version 3.5, OpenCV version 3.4.3 (contrib) installed via
pip install opencv-contrib-python
I have checked cv2.getBuildInformation(), FFMpeg is YES (prebuilt Binaries)
I have copied opencv_ffmpeg313.dll to the path for python (user/AppData/Local/Programs/Python/Python35-32/Scripts) and (user/AppData/Local/Programs/Python/Python35-32)
I also made copies of them called opencv_ffmpeg313_64.dll just in case
I have also tried several different videos, multiple .mp4's, .avi's etc. I have exhausted every fix I have found for this problem and still come up sort.