Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv2.VideoCapture : can not read saved videos

My problem is the same as mentioned in

http://answers.opencv.org/question/1965/cv2videocapture-cannot-read-from-file/

and

https://stackoverflow.com/questions/11699298/opencv-2-4-videocapture-not-working-on-windows

Im using OpenCV 3.4.0 on Windows 10, able to capture live videos from Webcam using cv2.VideoCapture(0) but can not read my pre-existing .mp4/.avi/.3gp videos.

Yes, I have given the entire path correctly, even changed to '/' , copied the 'opencv_ffmpeg340_64.dll' file into C:\Python27 and yet no results.

I read a suggestion to use the OpenCV binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv , but do not know exactly how to proceed.

The same question was asked in 2012 (http://answers.opencv.org/question/1965/cv2videocapture-cannot-read-from-file/) and no body seems to have benefitted from any solution, hence beginning a new thread.

cv2.VideoCapture : can not read saved videos

My problem is the same as mentioned in

http://answers.opencv.org/question/1965/cv2videocapture-cannot-read-from-file/

and

https://stackoverflow.com/questions/11699298/opencv-2-4-videocapture-not-working-on-windows

Im using OpenCV 3.4.0 on Windows 10, able to capture live videos from Webcam using cv2.VideoCapture(0) but can not read my pre-existing .mp4/.avi/.3gp videos.

Yes, I have given the entire path correctly, even changed to '/' , copied the 'opencv_ffmpeg340_64.dll' file into C:\Python27 and yet no results.

I read a suggestion to use the OpenCV binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv , but do not know exactly how to proceed.

The same question was asked in 2012 (http://answers.opencv.org/question/1965/cv2videocapture-cannot-read-from-file/) and no body seems to have benefitted from any solution, hence beginning a new thread.

edit

heres my code:

import cv2

import numpy as np

cap = cv2.VideoCapture('C:\Users\DELL PC\Desktop\IMG_PROC\python\VID-20140623-WA0000.avi') # cap = cv2.VideoCapture('C:/Users/DELL PC/Desktop/IMG_PROC/python/VID-20140623-WA0000.avi')

Check if camera opened successfully

if (cap.isOpened()== False):

print("Error opening video stream or file")

while(cap.isOpened()):

ret, frame = cap.read()

if ret == True:

cv2.imshow('Frame',frame)

if cv2.waitKey(25) & 0xFF == ord('q'):

 break

else:

break

cap.release()

cv2.destroyAllWindows()