Syncing video speed with audio speed in Python3

I am trying to play a video with a circle superimposed on top of it. For it, I am using cv2.VideoCapture to play the video while I am using ffpyplayer's MediaPlayer to play the audio.
The video being played by OpenCv is much slower than the original video (and the audio). I was wondering how to sync the audio and video? (maybe slow down the video to match the max. possible fps of cv.VideoCapture? Below is the link to the code code

please do stuff like that using ffmpeg or gstreamer.
DO NOT try to abuse opencv, a computer-vision library for this
(it wasn’t made for what you want)

oh man you’re having problems far larger than you admit here

reconsider the whole design. be clear, what data you need where (client/server)
what kind of problem should your program solve ?

play a video with a circle superimposed

that’s not “a purpose”. please give the “larger picture”

maybe you only need to send the circle coords, and that’s it ?

and forget about the audio …

@berak thing is I need to show the circle and the audio-video of the file. If you could provide a workaround, where I can continue using while playing video via 3rd party library, it will be a great help.
Purpose of the thing is to test the user’s response when subjected to the conversation of 2 people (shown in the video).

well, you can’t, using opencv. it’s not meant to happen. full-stop.

@berak I know that I can’t do both on OpenCv. is there any other way that I can get my game going without

the whole idea of sending audio/video to a server and back for this looks terrible from here.

again, you probably do not need any of this if you only need to detect a users responsability

@berak even foregoing the sending data to a server still makes cv.VideoCapture lag behind the audio.

you seem to need a video file’s audio and video? VideoCapture doesn’t do that. use ffmpeg (PyAV) to decode the video and audio.

if you need to draw anything, you can use opencv for the drawing. it’s okay for that.

when you have audio and video data, you absolutely must learn how to play that back in sync. if you haven’t discovered and understood “presentation time stamps”, you certainly haven’t reached the goal.

look at game libraries. you’re making a “game”, so use the right tools. nobody builds games with OpenCV.

I’ve heard of pygame.

@crackwitz cheers for the reply. I realise I am being kind of an idiot. Let’s say I am playing video by VLC, can I simply “draw” over it via opencv’s if yes, what would I pass into img parameter?

there are too many misconceptions here to give a reasonable answer to such a simple question. it is clear that you don’t understand many aspects of what you are doing. you need to do the work to understand what you are doing. that will take time and effort but it can’t be avoided.

@crackwitz I know I deserve the harsh words and I will go back to basics. It’s just that am just a bit short on time so, if you could just guide me it will be a life saving moment.

again, unless the clients need to see each others videostream,
it’s probably far easier to write some data protocol with circle coords / user events, than to upload your video/audio
client programs (opencv, browser) can easily overlay circles over your image

Basically, I have 4 videos that I have to show the users. For them, it’s live stream, but actually its pre-recorded. I am now thinking simply playing the vids via VLC or sth, and playing opencv on one end to overlay circle and get the co-ordinates and chroma-key them.