无法跨试验播放 MP4 视频序列 [英] Fail to play sequence of MP4 videos across trials
问题描述
我有 10 次试验和两个条件(在试验中随机),包括播放光流 mp4 电影或随机流 mp4 电影.为了加载和播放 mp4,我使用了 visual.MovieStim3
I have 10 trials and two conditions (randomized across the trials) that consist of playing either an optic flow mp4 movie or a random flow mp4 movie. To load and play the mp4 I used visual.MovieStim3
nBlocks = 4
nTrials = 10
nb_conditions = np.arange(1,3) # We have two conditions : condition 1 is Optic flow and condition 2 is Random flow
conditions = nb_conditions.repeat(nTrials/2) # 5 times condition1 and 5 times condition2
conditions_rand = np.random.permutation(nb_conditions) # Randomize the order of the conditions
# --- Load optic flow and random flow movies ---
optic_flow_movie = visual.MovieStim3(win, ‘optic_flow.mp4’)
random_flow_movie = visual.MovieStim3(win, ‘random_flow.mp4’)
# --- iterate through trials and play movies---
for trialcount in range(nTrials):
for Nframes in range(700):
if conditions_rand[trialcount] == 1:
optic_flow_movie.draw()
elif conditions_rand[trialcount] == 2:
random_flow_movie.draw()
win.flip()
win.close()
它开始播放 conditions_rand 数组上的第一个视频,然后以随机的时间间隔播放第二个视频,然后屏幕在冻结时再次长时间黑屏.因为它不会抛出任何错误,所以我不知道它为什么会这样.非常感谢您的帮助!
It starts playing the first video on the conditions_rand array, then at a random interval of time, it shows a second video and then the screen is black again for a long time as it freezes. Because it doesn’t throw any error, I have no idea why it is behaving this way. Your help would be highly appreciated thanks !!
推荐答案
尝试插入:
optic_flow_movie.seek(0)
random_flow_movie.seek(0)
在两个 for 循环之间,因此每部电影在再次播放之前都会重置为其开始帧.
in between the two for loops, so each movie gets reset to its start frame before getting played again.
这篇关于无法跨试验播放 MP4 视频序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!