0

I want to play an MP4 file showing a reaching task for an experiment. I am not sure how to formulate the syntax. So far I have:

moviefile = 'GOPR0056.MP4';
screenNum = 0;
[window, rect] = Screen('OpenWindow', screenNum, 1);
moviePtr = Screen('OpenMovie', window, moviefile);
Screen('PlayMovie', moviePtr, 1); 

But I'm getting an issue:

PTB-ERROR: Could not open movie file [GOPR0056.MP4] for playback! No such moviefile with the given path and filename. PTB-ERROR: The specific file URI of the missing movie was: file:///GOPR0056.MP4.

The file is located in the directory. May I be getting a video drivers error because this is a MP4 file. Thanks.

theAngryPhysicist
  • 129
  • 1
  • 5
  • 12

1 Answers1

2

When playing videos with Psychtoolbox, always provide the full path, even if the video is in the current directory. Try this:

moviefile = [pwd filesep 'GOPR0056.MP4'];
Rafael Monteiro
  • 4,509
  • 1
  • 16
  • 28
  • Ah ok, I ran it with that. Psychtoolbox started but the screen just want black and continues indefinitely until I cancel it manually. I am getting a vertical synchronization error, but I don't that has anything to do with it going black. – theAngryPhysicist Apr 01 '14 at 19:29
  • 1
    I'm not sure how familiar you are with Psychtoolbox, but when playing videos you must render each frame yourself, in a loop, or else it will display nothing. Take a look at [SimpleMovieDemo.m](https://github.com/Psychtoolbox-3/Psychtoolbox-3/blob/master/Psychtoolbox/PsychDemos/MovieDemos/SimpleMovieDemo.m) source code for more details. You should implement your code in a similar way. – Rafael Monteiro Apr 01 '14 at 22:59
  • Hello, this is a late response. Yes, so I took the source code and played around with it to make it work. – theAngryPhysicist Apr 08 '14 at 12:42
  • Minor tip: Matlab has a built-in function to build paths, `fullfile()`. So a slightly easier way to do this would be: `moviefile = fullfile(pwd, 'GOPR0056.MP4');` Doesn't save that much time in this example but it's convenient with sub-directories because you can do things like `fullfile(pwd, 'movie_files', 'GOPR0056.MP4');` and not have to use multiple `filesep`s. – Matt Dec 13 '17 at 19:40