How can I solve audio and video out of sync in psychopy code?

26 views Asked by At

I am creating an experiment in which participants watch a video while they perform a task. In the last few days, the videos stopped being in sync with their audio (it never happened before, both the audio and video come from the same Mp4 file). And it even happens in the simplest code:

from psychopy import visual, core, event

# Create a window
win = visual.Window(size=(800, 600), fullscr=False, screen=0)

# Load a video
video = visual.MovieStim3(
    win,
    r"C:\Users\Enbal\Dropbox\LabDropbox\Inbal\New exp\sano.mp4",
    size=(720, 480),
    flipVert=False,
    flipHoriz=False,
    loop=False,
)

# Play the video
while video.status != visual.FINISHED:
    video.draw()
    win.flip()

    # Break the loop if a key is pressed
    if len(event.getKeys()) > 0:
        break

# Close the window
win.close()

# Cleanup
core.quit()

How can I solve this issue?

I tried changing the kind of files I'm using with no luck and checked for the problem in a simple code. It still persists.

0

There are 0 answers