MovieStim2 flickers with concurrent rating scale

Hi all,
I am trying to present a movie with a concurrent rating scale. The code is working, but it flickers terrribly. I am using MovieStim2 and a standard rating scale.
The critical thing happens here (see below for full code):
mov.draw()
ratingScale.draw()
win.flip()
I don’t fully understand the techincal details of movies & python. When I change the code to present only the movie, not the ratingscale, it runs smooth - so it seems the two displays interact to cause trouble. Similarly, when I use the old movieStim in combination with ratingscale, the movie display is smoother, but then ‘stutters’ (i.e. is smooth for a while, but jumps abruptly).
Any help would be greatly appreciated.
Best, Ralf.

from psychopy import visual, core, event
from psychopy import visual, os, core, gui, event, logging, microphone, data, sound
import numpy as np

useFullScreen = False
videoPath= ‘01.mov’

globalClock = core.Clock()
localClock = core.Clock()
secondClock = core.Clock()

################
win = visual.Window([800,600], #1080,762], #[800,600], ###1920,1080],
monitor=“testMonitor”,
fullscr=useFullScreen,
units=“deg”,
waitBlanking=False)#,
#rgb=(-0.8,-08,-0.8))

mov = visual.MovieStim2(win, videoPath,
size = (800, 600) , #800,600), #size=(960,540),
pos=[0, 0],
flipVert=False,
flipHoriz=False,
loop=False)

ratingScale = visual.RatingScale(
win,
low=1, high=7,
markerStart=4,
leftKeys=‘z’, rightKeys = ‘m’,
singleClick=False,
showAccept=False,
noMouse=True,
pos = (0.0, -0.7) )

############################
def play_movie(fileName, movieLength):
vals =

#mov._reset()
mov.loadMovie(fileName)
mov._createAudioStream()
localClock.reset()
mov_length = mov.duration
  
start_time = localClock.getTime()
mov.play() 

while localClock.getTime() < movieLength: 
    
    secondvals = []
    
    while secondClock.getTime() < 1:
    
        mov.draw()
        ratingScale.draw()
        win.flip()
        rating = ratingScale.getRating()
        secondvals.append(rating)
        
        if event.getKeys(['escape']):  # this is to be able to interrupt
           win.close()  
           core.quit()
           
    vals.append(np.mean(secondvals))
    secondClock.reset()
  
mov.stop()   
#logging.flush()
return vals

RUN

vals = play_movie(‘01.mov’, 30)
print(vals)
core.quit()

Possibly your machine just isn’t quite keeping up? What resolution is the movie?

HI Jon,
thanks. It happens with all movies - e.g. the jwpIntro.mov is just 320*240. I am working ‘only’ on a MacBookPro, 2.8Ghz i7, 16GBRam with an AMD Radeon R9 2048 MR graphics. I would have assumed that this should be enough to do the job. I also tried updating psychopy and VLC.

The overall goal is to collect continuous ratings during the movie - if that can be achieved via different code, I am happy to try that as well.

One thing I tried is to have a secondWin: E.g. like this
mov.draw()
win.flip()
ratingScale.draw()
secondWin.flip()

This solves the flickering. Of note, even if I flip the movie’s window after the ratingscale operations, the movie still runs smooth…
mov.draw()
ratingScale.draw()
secondWin.flip()
win.flip()

This leads me to conclude that it is sth. about interactions between the layers for the movie and the ratingScale that are being drawn. However, that is just a guess as I am not familiar how it works under the hood.

Anyway - thanks to everyone willing to comment.

Best, ralf.