I am using OpenCV in Python in order to-
- Put a piece of text on my real time video
- Play an audio file
in that order when a certain condition is met for n or more consecutive frames. My code looks something like this-
if(curr < max_amt):
count+=1
if count >= consecutive_frames:
cv2.putText(frame, 'Message Here', (200,200), cv2.FONT_HERSHEY_SIMPLEX, 1, (0,0,255), 1)
some_variable = 'this is a value'
playsound('audio.mp3')
count = 0
However the audio plays before my text appears, and it too disappears within a few seconds. How can I resolve this issue?