0

I am trying to use cv2.VideoCapture() on a MacBook in Python to read an *.avi video. but it is not working.

vid = cv2.VideoCapture('filename.avi')
vid.grab() # This gives me false.

also when I try to count the number of frames I usually get 0.0. However, when I use vid = cv2.VideoCapture(0) then vid.grab() I get True, I tried to figure out why I am getting this issue but with no luck.

On the other hand I tried using the Imageio module and used vid =imageio.get-reader('filename.avi') then counted the number of frames and I got 32 the correct results. However, I can't use Imageio because I want to the OpenCV Adaptive_Thresholding function and this function requires 8-bits 1-Channel and the output when using imageio is not, so, I get an error.

Does anyone know how to solve/work around this issue? Thanks

motaha
  • 363
  • 2
  • 5
  • 19

0 Answers0