I have an issue where I try to save a video into a sequence of images but it is only able to save 28 frames. I have 31830 frames to save but ret becomes a false on the 28th frame. I have checked the video and it is not corrupt.
import numpy as np
import matplotlib.pyplot as plt
import cv2
import sys
import time
from tqdm import tqdm
inp = sys.argv[1]
out = sys.argv[2]
cap = cv2.VideoCapture(inp)
i = 0
pbar = tqdm(total=int(cap.get(cv2.CAP_PROP_FRAME_COUNT)))
while(cap.isOpened()):
ret, im = cap.read()
#print(ret)
#break
if(ret == True):
cv2.imwrite(out + str(i).zfill(10) + ".png", im, [int(cv2.IMWRITE_PNG_COMPRESSION), 0])
pbar.update(1)
print(i)
i=i+1
else:
break