Unknown problem playing movies with Gstreamer on Ubuntu Linux

Hello,

I’m having problems getting movies to play with Psychtoolbox on my Ubuntu stimulus laptop. The same movie-playing script works fine on a different laptop running a mac operating system.

My script is supposed to play multiple 3-second movies in a row, without any gap between them.

On my Ubuntu laptop, the first tiny fraction of the first movie begins to play, but then it freezes for a few seconds, and the script crashes. When the script crashes, the PTB window closes, and it gives the error message:

PTB-ERROR: In Screen(‘GetMovieImage’) for movie 0: Timed out while waiting for new frame after 5 seconds!

Troubleshooting efforts so far

Running SimpleMovieDemo works fine.

Setting current directory to folder with movie files in it and running PlayMoviesWithoutGapDemo1 works, but there is a lag that occurs when the first frame of each movie starts. Basically, for each new movie that the script loops through, the first frame seems to load and then there is a pause of a couple of seconds before the rest of the movie plays. I’m not sure if this is expected behavior for this demo script or not.

Setting current directory to folder with movie files in it and running PlayMoviesWithoutGapDemo2 does not work. It plays the first movie in the directory just fine and then cuts to a black window and never plays the next movie. The script does not exit by itself so after killing the script and closing the screen I see that in the command window there were multiple PTB error messages saying the same thing:

PTB-ERROR: In Screen(‘GetMovieImage’) for movie 0: Timed out while waiting for new frame after 5 seconds!

Gstreamer is installed from the Ubuntu software manager.

I’m not sure what I should try next. I would really appreciate help troubleshooting this issue!

Thanks,
Sean

Version Information:

Operating system:
Ubuntu 22.04.1 LTS, codename jammy

Matlab version:
R2022b

Psychtoolbox Version:
3.0.18 - Flavor: Debian package - psychtoolbox-3 (3.0.18.12.dfsg1-1~nd22.04+1)

I solved the issue by forcing OpenMovie to load the movie files without sound, using the specialFlags1 option in Screen(‘OpenMovie’) set to 2.

I think everything is working properly now!

That’s a valid way to deal with it if you don’t need or have sound from your movies. Probably even a good idea if you know you don’t need movie sound playback, as it will require less processing resources inside GStreamer if all the audio infra is disabled.

Movie playback will block if sound output is blocked. Sound output can be blocked iff:

  • You use PsychPortAudio in parallel and it takes exclusive control of the same soundcard that is used by GStreamer to play movie sound. Can happen on Linux or MS-windows. Won’t happen on macOS, instead audio timing will be silently corrupted by the operating system and you just get wrong timing.

  • Whatever default soundcard used by GStreamer does not actually output sound. E.g., something like everything is set up to output via Headphones, but no headphones are plugged in. Or sound goes to the HDMI or Displayport sound output of your graphics card, but the connected HDMI/Displayport monitor does not actually have speakers etc.
    Seen on Linux and Windows, don’t know what macOS does in that case.

-mario

1 Like