Playing videos produces no offset, also video plays less than the anticipated time

I am playing a video (using opencv backend) for 3 seconds which ends on its own automatically, therefore in the data sheet there is no offset, I added the offset manually using this under end routine:


However, then I noticed that the difference between the .started and .stopped components did not correspond to the actual time (3s).


So instead of using the manually added offset, I checked the onset of the next component (in the subsequent routine) and subtracted this number from the onset of the video, and ended up getting these values:


Which seem more correct. However, these are also not exactly 3 seconds.

So why are they so different? Why is it not exactly 3 seconds? And also what is the proper way to add the offset of the video?

What is the bit rate for the video? If it’s 44kHz but is playing at 48kHz that could account for the discrepancy.

Also, it might be worth trying the ffpyplayer backend