Opencv python does not open any video file [closed]
I have open cv 3.2.0 in python 2.7.13 on windows 10. Eventually I would like to run a background substractor, but I`m stuck in the very first step. I am not being able to make make to show a frame from a video in a file. Here is the code I have tried to far
import cv2
cam = cv2.VideoCapture("C:\\Users\\Public\\Videos\\Sample Videos\\wildlife.avi")
worked,f = cam.read()
cv2.imshow('f',f)
k=cv2.waitKey(1)
cv2.imshow() gives the following error:
"error: (-215) size.width>0 && size.height>0 in function cv::imshow"
worked is always returning FALSE, which according to what I could google it implies cam.read() is not reading the frame correctly
I google for solutions but so far none worked. Tried to use , different movies, formats (mp4,avi,wmv), internal codecs (h264, msmpeg4v2). I saw some suggestion of recompiling the library to better interact with 3rd party codecs, but I got opencv from the website, and numpy and matplotlib through pip. It seems drastic to redo it.
Does anyone knows what might be going on?
cam.isOpened()
andworked
before going onFirst guess, this is due to your windows backend not supporting your codec of the video you are trying to read. I just tried it on Ubuntu with a random *.mp4 video and it works out of the box.
Thank you, once i put opencv_ffmpeg(_64).dll it worked. Wish I could upvote but I do not have enough points
your "thank you" is entirely enough ;)