Python - Playing infinite video with audio openCV, stuck at audio

Python - Playing infinite video with audio openCV, stuck at audio
0

#1

I’m stuck at audio…
Infinite video working but i don’t have sound…
How i can sync them both, using ffmpeg?

My code:

import cv2
import numpy as np


file_name = "path to video"
window_name = "window"
interframe_wait_ms = 30

cap = cv2.VideoCapture(file_name)
if not cap.isOpened():
    exit()

cv2.namedWindow(window_name, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(window_name, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)

while (True):
    ret, frame = cap.read()
    if ret:
        cv2.imshow(window_name, frame)
    else:
        cap.set(cv2.CAP_PROP_POS_FRAMES, 0)

    if cv2.waitKey(interframe_wait_ms) & 0x7F == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()

#2

Nevermind, i resolved this using ffpyplayer, but i still have problems when video reloads, music is bugged