Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

the answer is in your code:

ret, frame = cap.read()

if ret is False or frame == None, you reached the end of the video file, so all you need is:

ret, frame = cap.read()
if not  ret:
    break