CAP_PROP_POS_FRAMES is abnormal slow

I have made some further investigations.

The code first reads 600 frames to check general read performance. Then it should make jumps of 600 frames. I see that the times for the jumps take longer and longer.

Here I will post now several different combinations of Python and OpenCV versions:

Python-Version 3.10.8 + OpenCV-Version 4.6.0:
Read 600 frames ==> 12.02s
5x600 jumps ==>67.5 s

Python-Version 3.9.15 + OpenCV-Version 4.6.0:
Read 600 frames ==> 11.7s
5x600 jumps ==>65.5 s

Python-Version 3.9.15 + OpenCV-Version 4.5.5:
Read 600 frames ==> 11.5 s
5x600 jumps ==>64.6 s

Python-Version 3.8.15 + OpenCV-Version 4.5.4:
Read 600 frames ==> 11.97s
5x600 jumps ==>6.24 s

Python-Version 3.8.15 + OpenCV-Version 4.0.1:
Read 600 frames ==> 10.391s
5x600 jumps ==>2.078 s

Python-Version 3.6.13 + OpenCV-Version 3.4.2:
Read 600 frames ==> 9.1s
5x600 jumps ==>2.019 s

I have found my sort tearm solution…
it is Python-Version 3.8.15 + OpenCV-Version 4.0.1, AND I also dont get this GSTreamer warning message.

But I am curious how everybody is doing these jumps. Especially if the footage is long??

import cv2
import time
import platform

print('Python-Version '+platform.sys.version)
print('OpenCV-Version '+cv2.__version__)

filename = "20230115_2157.mkv"
vs = cv2.VideoCapture(filename)

############################################################
print('Task: read 600 frames')
framei = 0
tic = time.time()
while framei< 600:
    framei = framei + 1
    ret, frame = vs.read()
    #cv2.imshow("Frame", frame)
    #key = cv2.waitKey(1) & 0xFF
 
toc = time.time()    
print(str(round(toc-tic,3))+'s - '+str(round(600/(toc-tic+0.001),3))+'fps')


############################################################
print(' ')
tic0 = time.time()
framei = 0
reps = 0
while reps < 5:
    tic = time.time()
    vs.set(cv2.CAP_PROP_POS_FRAMES, framei)
    framei = framei + 600
    reps = reps + 1
    toc = time.time()
    print('Jump to frame '+str(framei)+': '+str(round(toc-tic,3))+'s - '+str(round(600/(toc-tic+0.001),3))+'fps')

print('total time 5x600 frames jump: '+str(round(toc-tic0,3))+'s')


Python-Version 3.9.15 (main, Nov 24 2022, 14:39:17) [MSC v.1916 64 bit (AMD64)]
OpenCV-Version 4.5.5
Task: read 600 frames

[ WARN:0@1047.406] global C:\Windows\Temp\abs_0aavye6esb\croots\recipe\opencv-suite_1659973594283\work\modules\videoio\src\cap_gstreamer.cpp (2386) cv::handleMessage OpenCV | GStreamer warning: your GStreamer installation is missing a required plugin
[ WARN:0@1047.406] global C:\Windows\Temp\abs_0aavye6esb\croots\recipe\opencv-suite_1659973594283\work\modules\videoio\src\cap_gstreamer.cpp (2402) cv::handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module uridecodebin3 reported: Your GStreamer installation is missing a plug-in.
[ WARN:0@1047.406] global C:\Windows\Temp\abs_0aavye6esb\croots\recipe\opencv-suite_1659973594283\work\modules\videoio\src\cap_gstreamer.cpp (1356) cv::GStreamerCapture::open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0@1047.406] global C:\Windows\Temp\abs_0aavye6esb\croots\recipe\opencv-suite_1659973594283\work\modules\videoio\src\cap_gstreamer.cpp (862) cv::GStreamerCapture::isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
11.512s - 52.115fps

Jump to frame 600: 0.025s - 23070.915fps
Jump to frame 1200: 6.437s - 93.196fps
Jump to frame 1800: 12.925s - 46.419fps
Jump to frame 2400: 19.554s - 30.682fps
Jump to frame 3000: 25.651s - 23.39fps
total time 5x600 frames jump: 64.594s