当前位置: 动力学知识库 > 问答 > 编程问答 >

Python: Displaying video in slow motion

问题描述:

I'm currently working on an experiment that requires participants to respond, as fast as possible, to a number which gradually appears on the screen (the opacity rate changes over time) by pressing the corresponding button on the keyboard. For each of the presented numbers, a video was created (e.g., 0 that gradually appears on screen). On my own laptop, I managed to play these movies in slowmotion by specifying the bitsMode when creating the Python window. However, on the experimental computers in our lab (Python version 1.82.00), I get a warning that 'bitsMode' is deprecated.

I'm still relatively new to Python, so I haven't been able to figure out a different (and probably more sophisticated) way of doings this. Does any of you know a way to play these videos in slowmotion (e.g., speed * 0.75)?

Kind regards,

Roel van Dooren

event.Mouse(visible = False)

preTrialPause = [0.1, 0.5, 1, 1.5, 2, 2.5, 3]

blocks = 3

trialnum = 0

countDown(3)

win.update()

for block in range(blocks):

for eachmovie in movies:

trialPause = choice(preTrialPause)

sleep(trialPause)

mov = visual.MovieStim(win, movieFolder + eachmovie['Movie'],

flipVert=False, flipHoriz=False, loop=False)

# Clear keyboard buffer.

event.clearEvents(eventType = None)

starttime = time()

while mov.status != visual.FINISHED:

mov.draw()

win.flip(clearBuffer = True)

for key in event.getKeys():

responseTime = str(time() - starttime).replace(".",",")

trialPause = str(trialPause).replace(".", ",")

if key in ['0','1','2','3','4','5','6','7','8','9']:

win.update()

trialnum+= 1

if key == eachmovie['Movie'][3]:

response = 'Correct'

else:

response = 'Incorrect'

mov.status = visual.FINISHED

if trialnum == 10 and block == 0 or trialnum == 10 and block == 1:

trialnum = 0

presentText(win, "\n\nVerplaats je nu weer naar de andere computer. We gaan door met het volgende geheugen-geur blok.")

response = waitText(win, "")

presentText(win, "\n\nEr zullen opnieuw langzaam cijfers op het scherm verschijnen. Zo gauw je het cijfer waarneemt, moet je zo snel mogelijk op hetzelfde cijfer op het toetsenbord drukken. Gebruik hiervoor alleen de cijfers rechts op het toetsenbord (het numpad). \n\n\nNogmaals, het gaat bij deze taak om snelheid, dus druk zo snel mogelijk het overeenstemmende cijfer in.\n\n\nDruk op enter om te beginnen!")

countDown(3)

win.update()

break

elif trialnum == 10 and block == 2:

presentText(win, "\n\nVerplaats je nu weer naar de andere computer.")

response = waitText(win, "")

break

core.quit()

分享给朋友:
您可能感兴趣的文章:
随机阅读: