Unable to open video file in OpenCV python

766 views Asked by At

I'm trying to use the basic example code from OpenCv's Website to open a video file. I have tried everything I could find online but no matter what I get this error

VIDEOIO(cvCreateFileCapture_AVFoundation (filename)): raised unknown C++ exception!

I have no clue what is going on. My example code is below

    import numpy as np
    import cv2
    print('running');
    cap = cv2.VideoCapture('t1low.avi')
    print('running')
    while(cap.isOpened()):
      ret, frame = cap.read()
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

      cv2.imshow('frame',gray)
      if cv2.waitKey(1) & 0xFF == ord('q'):
          break
    cap.release()
    cv2.destroyAllWindows()
1

There are 1 answers

0
user2156711 On

I got the same exception.

In my case, the format is destroyed.