Ask Your Question

Revision history [back]

click to hide/show revision 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.

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