1 | initial version |
you must check the ret value from cap.read().
every movie has an end, when it gets to the last frame, it will return empty (None) frames, then you'll have to break out of the loop.
2 | No.2 Revision |
you must check the ret value from cap.read().
every movie has an end, when it gets to the last frame, it will return empty (None) frames, then you'll have to break out of the loop.loop, like:
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break