cv2.VideoCapture: Cannot read from file
Hi!
I try to process videos using the Python interface. I downloaded OpenCV 2.4.2 and copied the cv2.py file to the Python27\Lib\site-packages folder on Windows 7.
Using the following code, I'm not able to read video files. capture.isOpened() always returns false. Reading images from Webcam using cv2.VideoCapture(0) works fine, but not from files.
Did I miss to copy some importtant files to the Python directory?
import cv2
if __name__ == '__main__':
capture = cv2.VideoCapture("test.mpg")
if capture.isOpened():
print("Device Opened\n")
else:
print("Failed to open Device\n")
(ret, imageMat) = capture.read()
Cheers, Sly
How you run your app? Try absolute path for test.
is your test.mpg in the same folder of your code?
I'm having the same issue: VideoCapture works well with webcam, but no success with files - absolute path and otherwise.
I tried the solutions from here: http://stackoverflow.com/questions/11699298/opencv-2-4-videocapture-not-working-on-windows, but it still doesn't work. I added the folder to the PATH, and copied the dlls around.
Did you ever find a solution to this?
There might be a problem with the ffmpeg dll that is being used. Which build are you following? x86 or x86_64?
DId anyone get the solution of this problem? I am facing the same problem for so many days and still couldn't fix it
Did anyone solved it? I am having the same problem. After added path and copied dll still not working. I am on win 8; 64x.
This post is too old you should ask a new question