In opencv-python cap.read() returns false after 1 second
Question:
I’m trying to label a video with opencv version 4.2.0.32, python 3.7.4 and win10. I installed opencv with pip. After I select a video from QFileDialog at first cap.read return with frame but after 15-16 frames cap.read return false and output video is only first 1 second of the main video. Help pls.
while cap.isOpened():
ret,frame = cap.read()
""some codes here""
out.write(frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Answers:
I actually solve the problem. It was code independent. It looks like opencv dlls were missing from the python path. I pasted the dlls and problem solved.
I’m trying to label a video with opencv version 4.2.0.32, python 3.7.4 and win10. I installed opencv with pip. After I select a video from QFileDialog at first cap.read return with frame but after 15-16 frames cap.read return false and output video is only first 1 second of the main video. Help pls.
while cap.isOpened():
ret,frame = cap.read()
""some codes here""
out.write(frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
I actually solve the problem. It was code independent. It looks like opencv dlls were missing from the python path. I pasted the dlls and problem solved.