I have a problem about video reading in Python OpenCV. Although I searched it, I could not find the reason.
I have a bunch of videos that I need to get the frames to process them. It worked for almost all videos. However, I got errors in only four videos. When I tried to run my code with OpenCV 3.4.2 the VideoCapture.read() returned False (ret in the below code), although video_stream.get(cv2.CAP_PROP_FPS) line returned the FPS without problem. However, when I tried the same code with the same four videos using OpenCV 4.2.0, it returned True and was able to read the frames. Here is my code which is a simple video reading code:
video_stream = cv2.VideoCapture(video_path)
fps = video_stream.get(cv2.CAP_PROP_FPS)
ret, frame = video_stream.read()
The videos were recorded by the same device. The video codec is H.264 for all of them and the resolutions are also the same; 1920 x 1080.