My operating system is 'Mac OS Big Sur 11.4' and Python3 version is 3.9.6 and OpencV version is 4.5.3. The project is running on virtual environment. It still can read from images and webcam. It shows an error when I try to read a stream from a video file.
vid = cv.VideoCapture(FLAGS.video_path)
When I printed the 'FLAGS.video_path', it showed:
/documents/projects/YOLOv3-Object-Detection-with-OpenCV-arunava/road-traffic.mp4
So, then I tried to read the stream.
if not vid.isOpened():
print("Error opening video")
else:
print("Video capture was success")
And it printed out "Error opening video".
I tried these solutions from stackoverflow.
- Issue opening video file with OpenCV VideoCapture
- Can not Read or Play a Video in OpenCV+Python using VideoCapture
- cv2.videocapture.read() does not return a numpy array
I've read official documentation too.
Can you please help me?