Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to open video file in OpenCV python

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()
like image 667
babbitt Avatar asked Nov 09 '22 04:11

babbitt


1 Answers

I got the same exception.

In my case, the format is destroyed.

like image 50
user2156711 Avatar answered Nov 15 '22 09:11

user2156711