EN: Improved movie playback performance for MovieStim#7264
EN: Improved movie playback performance for MovieStim#7264mdcutone merged 27 commits intopsychopy:devfrom
MovieStim#7264Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #7264 +/- ##
==========================================
+ Coverage 12.21% 12.24% +0.03%
==========================================
Files 353 350 -3
Lines 64680 64505 -175
==========================================
+ Hits 7899 7900 +1
+ Misses 56781 56605 -176
🚀 New features to boost your workflow:
|
|
FYI @mdcutone after a thorough claude-assited debugging of why are our videos not displaying with the PsychoPy MovieStim regressionSummaryPsychoPy PR #7264 ("EN: Improved movie playback performance for MovieStim"), merged on 2025-06-11 (commit Affected versions
What changedPR #7264 replaced the old threaded Old code (2025.1.1 — working)The threaded player's # psychopy/visual/movies/players/ffpyplayer_player.py — seekTo()
n = 0
while n < maxAttempts: # up to 16 attempts
frameData_, val_ = player.get_frame(show=True)
if frameData_ is None:
time.sleep(0.0025) # wait 2.5ms and retry
n += 1
continue
# ... check PTS convergence ...New code (2025.2.0+ — broken)The new # psychopy/visual/movies/__init__.py — _openFFPyPlayer()
# warmup — this works fine
while time.time() - startTime < defaultTimeout:
frame, _ = self._player.get_frame()
if frame != None:
break
# go back to first frame — this is where the problem starts
self._player.set_pause(True)
self._player.seek(0.0, relative=False)After the seek, the decoder needs ~10ms to produce the first frame. But # psychopy/visual/movies/__init__.py — _getFrameFFPyPlayer()
while 1:
frame, status = self._player.get_frame()
# ...
if frame is None:
break # <-- gives up immediately, no retry, no waitBecause no frame is ever stored, How to reproduceThe bug manifests when using
Observed behavior
Diagnostic dataWith psychopy 2025.2.1, monkey-patching Fix suggestionThe
WorkaroundPin psychopy to This version uses the old threaded |
PR which improves movie playback performance when using the
MovieStimclass and movie component in Builder. Playback will be more responsive and efficient with new frame acquisition and memory management algorithmsAdditional features are in development which will permit: high-precision audio-visual synchronization and onset timing, improved memory efficiency for long movies, caching for instant seeking, on-screen playback controls, and visual indicators for seeking and frame drops
The old movie player backend classes have been removed