No audio when movies are played in Windows


I have used PTB for many years on Macs to play audiovisual movies; here is some sample code:

Here is a link to an archive containing the two movies referenced in the sample code:

In porting this same code to a Windows laptop (Dell Precision 7760, Xeon W-11955M CPU @ 2.60 GHz, 64 GB RAM, Intel UHD Graphics, 3840 x 2160 display resolution) the movies will play but there is no sound output. The same movies play with sound on Macs or on the Windows laptop using other players (e.g. VLC media player) and Matlab is able to generate sound [e.g. load handel, sound(y,Fs) ].

PST gives the usual timing errors seen when running on Windows, but it is not clear if this is the cause of the lack of audio playback (the video plays back fine). Audio playback also does not work for purely auditory files (as shown in the example movies, one is audiovisual and one is auditory-only; there is no audio playback for either).

Have you tried an audio demo? Does any of those output sound?

Yes, BasicSoundOutputDemo() works fine.

Here is the Matlab output on Windows from the play_movie.m code above:

PTB-INFO: This is Psychtoolbox-3 for Microsoft Windows, under Matlab 64-Bit (Version 3.0.18 - Build date: Feb 2 2022).
PTB-INFO: OS support status: Windows 11 (Version 11.0) is not supported.
PTB-INFO: Type ‘PsychtoolboxVersion’ for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file ‘License.txt’ in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: For information about paid priority support, community membership and commercial services, please type
PTB-INFO: ‘PsychPaidSupportAndServices’.

PTB-INFO: The detected endline of the vertical blank interval is equal or lower than the startline. This indicates
PTB-INFO: that i couldn’t detect the duration of the vertical blank interval and won’t be able to correct timestamps
PTB-INFO: for it. This will introduce a very small and constant offset (typically << 1 msec). Read ‘help BeampositionQueries’
PTB-INFO: for how to correct this, should you really require that last few microseconds of precision.
PTB-INFO: Btw. this can also mean that your systems beamposition queries are slightly broken. It may help timing precision to
PTB-INFO: enable the beamposition workaround, as explained in ‘help ConserveVRAMSettings’, section ‘kPsychUseBeampositionQueryWorkaround’.

PTB-INFO: OpenGL-Renderer is NVIDIA Corporation :: NVIDIA GeForce RTX 3080 Laptop GPU/PCIe/SSE2 :: 4.6.0 NVIDIA 472.88
PTB-INFO: VBL startline = 2160 , VBL Endline = 2159
PTB-INFO: Measured monitor refresh interval from beamposition = 502.942388 ms [1.988299 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.697138 ms [59.890502 Hz]. (39 valid samples taken, stddev=0.471611 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 16.666667 ms [60.000000 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: ==============================================================================================================================
PTB-INFO: WINDOWS DWM DESKTOP COMPOSITOR IS ACTIVE. On this Windows-10 or later system, Psychtoolbox can no longer reliably detect if
PTB-INFO: this will cause trouble for timing and integrity of visual stimuli or not. You might be just fine, or you could be in trouble.
PTB-INFO: Use external measurement equipment and independent procedures to verify reliability of timing if you care about proper timing.
PTB-INFO: ==============================================================================================================================

WARNING: Couldn’t compute a reliable estimate of monitor refresh interval! Trouble with VBL syncing?!?


One or more internal checks (see Warnings above) indicate that synchronization
of Psychtoolbox to the vertical retrace (VBL) is not working on your setup.

This will seriously impair proper stimulus presentation and stimulus presentation timing!
Please read ‘help SyncTrouble’ for information about how to solve or work-around the problem.
You can force Psychtoolbox to continue, despite the severe problems, by adding the command
Screen(‘Preference’, ‘SkipSyncTests’, 1); at the top of your script, if you really know what you are doing.

PTB-WARNING: Mismatch between measured monitor refresh intervals! This indicates problems with rasterbeam position queries.


One or more internal checks (see Warnings above) indicate that
queries of rasterbeam position are not properly working for your setup.

Psychtoolbox will work around this by using a different timing algorithm,
but it will cause Screen(‘Flip’) to report less accurate/robust timestamps
for stimulus timing.
Read ‘help BeampositionQueries’ for more info and troubleshooting tips.

PTB-INFO: There are still 2 movies open. Screen(‘CloseAll’) will auto-close them.
PTB-INFO: This may be fine for studies where you only use a single movie, but a large number of open
PTB-INFO: movies can be an indication that you forgot to dispose no longer needed movie objects
PTB-INFO: via a proper call to Screen(‘CloseMovie’, moviePtr); , e.g., at the end of each trial. These
PTB-INFO: stale movies linger around and can consume significant memory and cpu ressources, causing
PTB-INFO: degraded performance, timing trouble and ultimately out of memory or out of ressource
PTB-INFO: conditions or even crashes of Matlab/Octave (in rare cases). Please check your code.

WARNING: This session of your experiment was run by you with the setting Screen(‘Preference’, ‘SkipSyncTests’, 1).
WARNING: This means that some internal self-tests and calibrations were skipped. Your stimulus presentation timing
WARNING: may have been wrong. This is fine for development and debugging of your experiment, but for running the real
WARNING: study, please make sure to set Screen(‘Preference’, ‘SkipSyncTests’, 0) for maximum accuracy and reliability.

I can’t reproduce the problem with current PTB 3.0.18 and your script and movies under either Ubuntu Linux 20.04-LTS or Windows-11. Both play fine. So it must be something specific to your laptop + Windows 11 setup.

A few things:

  1. Your script is missing calls to stop movie playback and close movie calls after the end of the while-loop, ie. Screen('PlayMovie', movie, 0); Screen('CloseMovie', movie);. PTB warns you about this causing out of memory or other resource exhaustion errors, as seen in the output above. This may not cause immediate problems, but for a longer running script with more trials it could. PlayMoviesWithoutGapDemo1(’*.mp4’) would be a way to test if proper use of async playback helps. Running PlayMoviesDemo on your movies would also be a good first test.

  2. For reference: I tested with GStreamer version 1.18.

  3. Do our movie demos like PlayMoviesDemo or SimpleMovieDemo work with proper sound? If not, maybe a required GStreamer audio codec is missing, ifyou didn’t select a “Full” installation of GStreamer when the installer asked for the type of install? Other install types might miss some proprietary codecs, like the one for MPEG4-AAC.

Unrelated to your movie sound problem, but the sync failure that your output shows looks like if the laptop might have NVidia G-Sync enabled? This would not work for proper timing on Windows atm. Output says a NVidia gpu is in use, but you stated it has Intel UHD graphics, so if this is a NVidia Optimus laptop, that would be another reason for severe timing problems.


[Work time used so far 1 hour 40 minutes → Priority support exhausted.]

Thank you for the helpful suggestions. After installing more CODECs, the movies now play correctly. (the full movie player program does contain the “stop” and “close” movie commands, I had deleted them when making the simplified code that I uploaded to demonstrate the problem).
Re: N-Vidia GSync: On our Dell/Windows 11 machine, neither the NVidia control panel nor any Windows setting that I could find has a switch to turn off G-Sync.
Re: Text. All Psychtoolbox text displayed on the Dell laptop (e.g. with DrawFormattedTextDemo) has a kerning problem where subsequent lines of text overlap each other (each line starts about half-a-line height below the line above it). Can you suggest anything to try? DrawFormattedText2Demo does not run at all. [[Text displays fine on the Mac]]

What is the error message you get with DrawFormattedText2Demo?

Have you installed the exact right GStreamer? (see help GStreamer for a direct link. Make sure to choose complete during install. and reboot after).

You need GStreamer 1.18 on Windows atm., as multiple new GStreamer 1.20 bugs on Windows broke compatibility wrt. our text renderer plugin, iow. GStreamer 1.20 → High quality text renderer will not work, which matches your symptoms.

The other reason for sync failures could be NVidia Optimus. That’s generally not resolvable on most MS-Windows Optimus laptops. Some laptops may have a way in the firmware to disable the NVidia, but then one is confronted with Intel graphics and its buggy graphics drivers on Windows - just yet another way to get broken visual timing…

The solution to avoiding or minimizing all these problems is upgrading to Linux.

Downgrading to gstreamer 1.18 fixed the text problem, thanks!