# Revision history [back]

your VideoCapture either did not open, or you reached the end of the movie

• check cap.isOpened()

• and the ret value in: ret,frame = cap.read()

if any of it returns False, you have to handle that condition. (i.e. break out of the loop)

your VideoCapture either did not open, or you reached the end of the moviemovie. anyway, your image is invalid

• check cap.isOpened()
• and the ret value in: ret,frame = cap.read()