I'm using opencv-python and when I execute the following code:
index = 0
cap = cv2.VideoCapture(video_path)
while True:
offset = cap.get(cv2.CAP_PROP_POS_MSEC)
print(cv2.__version__, index, offset)
ok, frame = cap.read()
if not ok:
break
index += 1
I get the following output:
3.4.7 0 0.0
3.4.7 1 33.36666666666667
3.4.7 2 66.73333333333333
3.4.7 3 100.10000000000001
3.4.7 4 133.46666666666667
If I execute this code on version 3.4.8.29, I get the following output:
3.4.8 0 0.0
3.4.8 1 0.0
3.4.8 2 33.36666666666667
3.4.8 3 66.73333333333333
3.4.8 4 100.10000000000001
And if I execute it on version 4.5.2.52 I get:
4.5.2 0 0.0
4.5.2 1 0.0
4.5.2 2 0.0
4.5.2 3 0.0
4.5.2 4 0.0
The question is first of all, which one is the correct one? It seems like 3.4.7 is correct, but it also seems to be changing randomly between versions.
And also how can I modify the other versions to get the proper result, same as 3.4.7
from OpenCV VideoCapture returns strange frame offset for different versions
No comments:
Post a Comment