Search code examples
matlabgstreamerpsychtoolbox

GStreamer "SimpleMovieDemo" bug on win x64


Movies aren't played. Matlab crushed even when I tried to run "SimpleMovieDemo".

I've done all recommendations suggested when running on Windows in this post: https://github.com/Psychtoolbox-3/Psychtoolbox-3/issues/234. I use "matlab.exe -nojvm", and tried many combinations of java, GStreamer and Matlab versions.

I still get this error when simply running "SimpleMovieDemo":

PTB-ERROR: Due to failed GStreamer initialization, the movie playback engine is disabled for this session.

Error in function OpenMovie:    Usage error
GStreamer initialization failed due to library loading problems. Aborted.
Error using Screen
Usage:

[ moviePtr [duration] [fps] [width] [height] [count] [aspectRatio]]=Screen('OpenMovie', windowPtr, moviefile [, async=0] [, preloadSecs=1] [, specialFlags1=0][, pixelFormat=4][,
maxNumberThreads=-1][, movieOptions]);

Error in SimpleMovieDemo (line 49)
    movie = Screen('OpenMovie', win, moviename);

Please help me display movies via Matlab PTB.


Solution

  • tl;dr: Reinstall GStreamer, but pick "Custom installation" (Don't use "complete" or "regular" options!) on installation, then pick all the components options manually. After that, "SimpleMovieDemo" will work as expected via "Matlab.exe -nojvm".

    It took some time until I found this little hiding solution under "help gstreamer", but under the header "Apple OSX", but it works like a charm on Windows 10 x64:

    When the installer asks you to select the components it should install, select a "Custom installation" (instead of a "Basic installation" or such). Then, if you chose a "Custom installation" in the displayed check list of packages to install, select all components manually, if you want support for all video formats and all functionality. Without this, many popular video formats like H264 video will not play at all, or video recording / video capture and similar functions may not work. In fact, even our own demos, e.g., SimpleMovieDemo will fail if you don't have all codecs installed! -> If SimpleMovieDemo doesn't work, then the most likely cause is that you didn't select all GStreamer packages for installation, so restart the installer and repeat installation with the full set of packages.