10 second delay with with GST_STATE_CHANGE_ASYNC


PTB: 3.0.16 - Flavor: - Corresponds to SVN Revision
Matlab: (R2019b) Update 5
System Details:

Memory 5.7 GiB
Processor: AMD Ryzen 7 3700u with radeon vega mobile gfx x 8
Graphics: AMD Radeon™ vega 10 graphics
Disk Capacity: 256.1 GB
OS Name: Ubuntu 20.04.1 LTS
OS Type: 64-bit
GNOME Version: 3.36.3
Windowing System: X11

We have been running an fMRI experiment in which we show people videos and then have them make ratings. The experiment has run perfectly fine for 23 of 25 participants so far. Recently (with no changes to our code at all), we noticed that for 2 participants the experiment was running 10 seconds too long. When looking at the matlab output, we found:

INFO: Statechange in progress with GST_STATE_CHANGE_ASYNC

Immediately following this in our experiment log, no videos were played for 10 seconds. Then the experiment resumed as expected (ending 10 seconds later than expected).

Based on this .c file, It seems to me like this statechange is causing a set delay of 10 seconds while waiting for the previous state to finish. But I am not sure how to prevent such an overlap in the first place.

Any help on how to prevent/mitigate this issue in the future would be much appreciated.


Unless you used the optional async flag 4 in Screen('OpenMovie', win, moviename [, async]), in which case there can be other reasons, the most likely cause for a 10 second delay would be a ten second pause of GStreamer in stopping the playback pipeline in the stop call.

Why that would happen, or if it is reliably preventable (could also have been a temporary glitch of your system, e.g., due to some overload like running low on memory, some compute intense process starting in the background like software updates etc.), i don’t know without deeper investigation. If you need further assistance, help PsychPaidSupportAndServices will tell you how to get an hour of my work time for that.

Btw. PTB 3.0.16 is no longer supported. You’d need to upgrade to the latest 3.0.17 beta before trying any further diagnostic.


Hello! I am experiencing a similar error to this after having just updated my Psychtoolbox version from to the latest release of All of our videos were running perfectly fine prior to this update (I’m working on a Dell laptop with Ubuntu 24.04 LTS) but now whenever I run the command to stop video playback (and record the number of dropped frames): Screen('PlayMovie',video_name,0) there is a very long, multi-seconds delay with the last movie frame remaining on the screen. I can fix this by not running that command and simply closing the current movie on the screen, but ideally I would like a record of the number of dropped frames.

Does it happen with our demo movies and demos SimpleMovieDemo.m PlayMoviesDemo.m?
Sample movie and script for download and testing?
Does it also happen with PTB
There’s been a fix in for Ubuntu 24.04-LTS to fix delays at the beginning of movie playback in some scenarios (Lag in second frame of movie on Linux system · Issue #814 · Psychtoolbox-3/Psychtoolbox-3 · GitHub). Would be sad if that fix breaks what you have.

Hi Mario,

Thank you for your quick reply! Unfortunately, I can confirm that this freezing issue persists in the demo scripts SimpleMovieDemo and PlayMoviesDemo with

I reverted the Psychtoolbox version to (git reset 7d79e5366) and the error was gone.

I can’t reproduce the freezing with our demos and our demo movie on the only Ubuntu 24.04 LTS test machine I have temporary available so far.

There are some delays with playing the streaming demo movies over the network in PlayMoviesDemo.m, which presumably do use different audio encoding than the MPEG-4/AAC encoding of our DualDiscs.mov demo movie, which don’t happen with the older Screen from PTB

Where’s a demo movie from yours to show the problem with our demos?

I guess something related to the direct use of the pipewire audio plugin since, compared to the pulseaudio plugin in earlier versions.

Unfortunately, due to the continued lack of financial support by the vast majority of our users over the last 10 years, I was only able to invest less than 24 hours of time so far into the testing of Ubuntu 24.04-LTS, and can’t spend much or any time right now.

Here is a Google Drive link to an example of one of the videos that was freezing: Fear_Block_1.mp4 - Google Drive (Although this was happening with several different videos that we tried out).

That’s alright, thank you for the help that you were able to provide! For now, I will just revert to the older version of Psychtoolbox for our setup.

What a delightful movie, such a catchy tune!

I can’t reproduce the problem though on my Laptop, works just fine. However, starting or stopping or speeding up or slowing down movies is definitely more fragile and can cause problems with the new pipewiresink plugin. The default pulsesink plugin chosen by PTB and earlier works fine for such playback modes.

So now we have a bug fix in for some bug affecting a minority of edge use cases, causing new bugs in possibly more common use cases :frowning: - Not sure what to do about it in future releases. A proper upstream fix can easily take years, given this situation, possibly until the next big LTS release. This is one of those problems that could have been easily avoided if we had had enough funding from our users for proper testing and fixing six month before the Ubuntu release, as I did in the past, instead of weeks after the release.