Opencv-python video capture set method not working as expected

im using opencv-python package, and got a wierd issue when using videocapture.set(cv2.CAP_PROP_POS_MSEC, value).
After using the set method, and then the get method, the returned value is completely different.
This is a project that works as expected in a mac laptop (including when using the same video file), but when i try running it on PopOs it dosent work as expected.
The video file is of length of 90+ minutes, so the new time im trying to set is definitely a valid one.

OS: Pop!_OS 22.04 LTS
CPU: 12th Gen Intel® Core™ i7-12650H
GPU: GeForce RTX 3070 Mobile
Python: 3.10.6
ffmpeg: 4.4.2-0ubuntu0.22.04.1

Code (just the relevant part):
current_millis = cap.get(cv2.CAP_PROP_POS_MSEC)
# current_millis=211631.6666666667
# skip_seconds=24
skip_to_millis=cap.get(cv2.CAP_PROP_POS_MSEC) + (
skip_seconds* 1000)
# skip_to_millis =235631.6666666667
current_millis = cap.get(cv2.CAP_PROP_POS_MSEC)
# current_millis=2618.1222222222223

Any help will be appreciated!

I don’t know if they ignore me automatically or manually, or they’re that backlogged, but they haven’t even triaged the issue yet (slapped appropriate labels on it)

1 Like

Thanks for the comment.
I opened another issue, hopefully someone will pick it up.
You think its something we can fix on our own?

looks fairly easy to do, from what I remember of my investigation of the code. all the ffmpeg stuff is in that file.

just search and highlight a few of the variables relating to picture_pts

there are multiple issues in there, separate but related. it’s not going to be a single-line fix.

@crackwitz got a response from one of the moderators, and provided additional information they requested.
This is the issue: video capture .set() method not working as expected · Issue #23472 · opencv/opencv · GitHub