How to debug failures with cv2.VideoCapture(<video_file>)

I am trying to call:

cap = cv2.VideoCapture(video.mp4)

on a local video file and the result of

cap.isOpened() is False

My question is if it’s possible to get a more detailed error message of what went wrong? Probably it is something to do with my setup, maybe some missing drivers, but it’s hard to tell just from this message.

I have tried this on my local machine cv2 setup and it works for the same video, but I think on my remote server there must be something different with the setup and I’m trying to figure out what it is.

Thanks in advance for any help!

Figure it out, I need to run my program with

OPENCV_VIDEOIO_DEBUG=1

1 Like