cv2.Videocapture() works fine while using the camera,but while reading the local video, there is a WARNING: Couldn't read movie file
Here is my test code:
# -*- coding: utf-8 -*-
import numpy as np
import cv2
cap = cv2.VideoCapture('test2.avi')
print cap.isOpened()
while(cap.isOpened()):
ret, frame = cap.read()
cv2.imshow('frame', frame)
if (cv2.waitKey(1) & 0xFF == ord('q')):
break
cap.release()
cv2.destroyAllWindows()
The error occurred:
WARNING: Couldn't read movie file test2.avi
False
I found that on Windows, there is a solution about it.I copied all the files in /Users/xxx/opencv/3rdparty/ffmpeg to my python path, and renamed 'opencv_ffmpeg_64.dll' to 'opencv_ffmpeg300_64.dll', but it still didn't work.
Besides, I found that I couldn't open test2.avi by QuickTime Player. Is that a possible factor that caused the error?