Currently I would like to continually play movies in a loop from different filepaths using python 3.6, psychopy 1.90.2. The filepaths are listed in a csv file and each filepath has common ancestors but has a different parent directory and filename. e.g. '/media/michael/shared_network_drive/dataset/training/jumping/man_jumps_through_hoop3342.mp4' and '/media/michael/shared_network_drive/dataset/training/shouting/h555502.mp4'.
Currently there is a very large delay when creating the visual.MovieStim3 object which results in a large delay before every video. Here is the code so far:
def play_videos(csv_file, vid_location='/media/michael/shared_network_drive/dataset/training/'):
# Open a window
win = visual.Window([400,400])
#open csv file and cycle through each video
for vid, label, val1, val2 in csv.reader(open(csv_file, 'r')):
glob_vid_path = vid_location + vid
# Define a MovieStim3 object
mov = visual.MovieStim3(win, glob_vid_path, flipVert=False, flipHoriz=False)
# Loop through each frame of the video
while mov.status != visual.FINISHED:
mov.draw()
win.flip()
win.close()
Why is the delay so long and how can I overcome this?
For those with similar problems; the delay is caused by the location of the videos in a shared drive. Placing the videos on the home drive, or even an external hard-drive solved the problem.