Ask Your Question

Revision history [back]

(python) VideoCapture() returns zero for all CV cap props

Hello everybody,

I am trying to create a plot as overlay in my video (uisng openCV and matplotlib). The first thing would be to detect the frames of the video. This is what I am trying to do:

cap = cv2.VideoCapture('C:/PyDev/workspace/MyProject/src/files/video.mp4')
pos_frame = cap.get(cv2.cv.CV_CAP_PROP_POS_FRAMES)

Using the debugger, the variable cap hold the value

 VideoCapture: <VideoCapture 000000000425D310>

but the value of pos_frame is 0.0.

I already tried other videos and other formats. Also I installed the K-Lite Codec Pack. Unfortunately it didn't help. I don't really understand if the video is loaded successfully (I think yes, as cap is not empty). Also calling

cap.grab()

retuns False.

Does anyone know how to solve this problem?