0
votes

I had a sample code running on my machine which doesn't run on another.
In particular, that code just does :

from cv2 import cv
try: capture = cv.CaptureFromFile('clip.avi')    
except: print 'error loading the video' 
nFrames = int( cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_COUNT))
print nFrames

On the machine which fails, the result is that nFrames = 0 (as well as the width, height, fps, fourcc etc.), but no exception is raised. I tried using an uncompressed video to make sure there is no codec issues. It also doesn't work with an MPEG1 video, nor any other videos I tried.
So :

  • Is-there a way to know what's going on, since there is no error handling here (no exception raised, no error message, and I didn't find a "GetLastError" function in pyOpenCV) ?
  • Any idea what could be the issue ?

Thanks!

1

1 Answers

0
votes

Try using the full path in the call to CaptureFromFile():

capture = cv.CaptureFromFile('/Users/user_name/Videos/clip.avi')