# Movie loop psychopy error 3221225477

**URL:** <https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006>\
**Category:** Builder\
**Tags:** randomization, movies\
**Created:** [September 29, 2026, 11:21am UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006 "2026-09-29T11:21:02Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![lele](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@lele](https://discourse.psychopy.org/u/lele)\
**Post date:** [September 29, 2026, 11:21am UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/1 "2026-09-29T11:21:02Z")

</div>

Hi everyone,

I’m having an issue with a PsychoPy experiment using **Movie components inside a loop**.

I’m using **PsychoPy Standalone 2026.1.0 on Windows**.

The experiment starts normally and **some videos play correctly** , but after a certain number of videos, PsychoPy suddenly crashes. It does not display a Python error or traceback. The Runner only shows:

```plaintext
Generating PsychoPy script...

## Running: C:\Users\7robe\OneDrive - unine.ch\...\PsychoPy2\Experiment_01_lastrun.py ##
3025.6960 INFO Loaded monitor calibration from ['2026_09_17 18:28']
3025.7832 INFO Loaded monitor calibration from ['2026_09_17 18:28']
#### Experiment ended with exit code 3221225477 [pid:19152] ####

```

The same crash happens repeatedly, with a different PID each time:

```plaintext
Experiment ended with exit code 3221225477

```

The important point is that **the videos are not all failing immediately**. Some videos play successfully, and then the experiment crashes when it reaches another video in the loop.

The videos are being selected through an **Excel conditions file** , and the Movie component is inside a loop.

The experiment files are currently stored in a **OneDrive folder**.

Has anyone experienced this type of crash (`3221225477` / `0xC0000005`) when playing multiple videos sequentially in a PsychoPy loop?

I’m wondering whether this could be related to:

- the Movie component/video backend,

- specific video files or codecs,

- loading/unloading multiple videos during the loop,

- memory usage,

- or another PsychoPy/Windows issue.

Any advice on how to identify what is causing the crash would be greatly appreciated.Absolutely — here is a cleaner version focused only on the current problem.

Hi everyone,

I’m having an issue with a PsychoPy experiment using **Movie components inside a loop**.

I’m using **PsychoPy Standalone 2026.1.0 on Windows**.

The experiment starts normally and **some videos play correctly** , but after a certain number of videos, PsychoPy suddenly crashes. It does not display a Python error or traceback. The Runner only shows:

```plaintext
Generating PsychoPy script...

## Running: C:\Users\7robe\OneDrive - unine.ch\...\PsychoPy2\Experiment_01_lastrun.py ##
3025.6960 INFO Loaded monitor calibration from ['2026_09_17 18:28']
3025.7832 INFO Loaded monitor calibration from ['2026_09_17 18:28']
#### Experiment ended with exit code 3221225477 [pid:19152] ####

```

The same crash happens repeatedly, with a different PID each time:

```plaintext
Experiment ended with exit code 3221225477

```

The important point is that **the videos are not all failing immediately**. Some videos play successfully, and then the experiment crashes when it reaches another video in the loop.

The videos are being selected through an **Excel conditions file** , and the Movie component is inside a loop.

The experiment files are currently stored in a **OneDrive folder**.

Has anyone experienced this type of crash (`3221225477` / `0xC0000005`) when playing multiple videos sequentially in a PsychoPy loop?

I’m wondering whether this could be related to:

- the Movie component/video backend,

- specific video files or codecs,

- loading/unloading multiple videos during the loop,

- memory usage,

- or another PsychoPy/Windows issue.

Any advice on how to identify what is causing the crash would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![olilo](https://avatars.discourse-cdn.com/v4/letter/o/4bbf92/32.png) [@olilo](https://discourse.psychopy.org/u/olilo)\
**Post date:** [September 30, 2026, 8:25am UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/2 "2026-09-30T08:25:46Z")

</div>

Hi lele,

Honestly, I would just get rid of the loop. You’re making this way more complicated than it needs to be.

Loops are obviously the problem here because PsychoPy has to keep loading and unloading different videos. Just create a separate Routine for **every single video** and put them one after another in the Flow. If you have 16 videos, make 16 Routines. Don’t use an Excel conditions file at all.

There’s really no reason to dynamically select videos when you already know which videos you want to show. Manually adding them is much more reliable and eliminates all the potential problems caused by the loop.

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [September 30, 2026, 9:37am UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/3 "2026-09-30T09:37:38Z")

</div>

Hello

> [@olilo](#):
>
> Honestly, I would just get rid of the loop. You’re making this way more complicated than it needs to be.

Honestly, this suggestion makes the structure of the result file much more complicated. It also makes changes to your experiment more complicated.

Are all the movies in the same format, with the same codec, frame rate and audio sampling rate? Despite the fact that you are using a OneDrive folder for your experiment, which is not recommended, are you sure that all videos are available locally? It would be better to move everything to a local folder. Finally, change the audio backend.

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![lele](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@lele](https://discourse.psychopy.org/u/lele)\
**Post date:** [September 30, 2026, 11:25am UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/4 "2026-09-30T11:25:10Z")

</div>

Hi Jens, thank you for your reply. I agree with you, and I need the loop for the randomization of the videos.

Yes, all movies are the same format and even the same length. And there is no audio.

I tried putting everything in a local file but it didn’t change anything.

What do you think the problem could be ?

Thanks

Best wishes Lele

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [September 30, 2026, 11:45am UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/5 "2026-09-30T11:45:26Z")

</div>

Hello @lele

Did you try a different video backend?

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [September 30, 2026, 12:48pm UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/6 "2026-09-30T12:48:30Z")

</div>

Do you have duplication of a routine name?

> [@Experiment ended with exit code 3221225477](https://discourse.psychopy.org/t/experiment-ended-with-exit-code-3221225477/37789):
>
> Hi, I have a psychopy code including 3 taks first audio stimuli then only video stimuli and then audiovisual stimuli, all followed by 2 second fixation cross, which run fine after each other in the first loop but at the second loop where i change the stimuli for each, it just exits with Experiment ended with exit code 3221225477 after running audio and in the beginning of video only. I also tried in pairs and audio+only video works, audio+audivisual works , video+audiovisual works , only with a…

> [@Movie loop crash after a few trials](https://discourse.psychopy.org/t/movie-loop-crash-after-a-few-trials/43293):
>
> Hi! I want to add a video component to a routine, where multiple trials are loaded in a loop, with each trial loading a different video. The issue is that when the loop reaches the 4th trial, the program crashes and outputs exit code ‘3221225477’. Does anyone know what might be causing this?

---

<div class="post-metadata">

**Author:** ![lele](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@lele](https://discourse.psychopy.org/u/lele)\
**Post date:** [October 1, 2026, 8:36am UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/7 "2026-10-01T08:36:31Z")

</div>

Hi

Yes, I tried all of them and only ffpyplayer works

Best wishes Lele

---

<div class="post-metadata">

**Author:** ![lele](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@lele](https://discourse.psychopy.org/u/lele)\
**Post date:** [October 1, 2026, 8:38am UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/8 "2026-10-01T08:38:40Z")

</div>

I’m not sure I understand what you mean by “duplication of a routine name”.

Here’s a photo of my experiment structure if it can help

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/7/2/724168d0177603f5c05102f208cf74c858a81fce.jpeg)

Thank you

Lele

---

<div class="post-metadata">

**Author:** ![lele](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@lele](https://discourse.psychopy.org/u/lele)\
**Post date:** [October 1, 2026, 8:41am UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/9 "2026-10-01T08:41:51Z")

</div>

My issue seems to be similar to fei’s, but the program crashes after a random number of videos shown. I wondered if the error was due to one corrupted video, but I tried multiple times and they all worked at least once. I have a total of 32 videos, and the loop should show 16 random to the participant.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [October 1, 2026, 9:00am UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/10 "2026-10-01T09:00:24Z")

</div>

Try removing the randomisation to see if it always crashes at the same place.

---

<div class="post-metadata">

**Author:** ![lele](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@lele](https://discourse.psychopy.org/u/lele)\
**Post date:** [October 1, 2026, 12:08pm UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/11 "2026-10-01T12:08:22Z")

</div>

Good idea, I tried and it still crashes random

---

<div class="post-metadata">

**Author:** ![lele](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@lele](https://discourse.psychopy.org/u/lele)\
**Post date:** [October 1, 2026, 1:03pm UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/12 "2026-10-01T13:03:54Z")

</div>

Hi all,

The problem was with the audio on the videos. Chat GPT created a long code that solved this problem.

Thank you for your answers!

Here’s the code if someone hase the same problem

Before exp:

```auto
# Experimental workaround: silent movies only, PsychoPy 2026.1.0.
# Applied only to this Python process; no installed files are changed.
import psychopy as silent_psychopy
from psychopy.visual import movies as silent_movie_module

if silent_psychopy. __version__!= '2026.1.0':
    raise RuntimeError('Ce contournement est reserve a PsychoPy 2026.1.0.')

SilentOriginalReader = getattr(silent_movie_module, 'MovieFileReader', None)
if SilentOriginalReader is None or not hasattr(SilentOriginalReader, '_setVolumeFFPyPlayer'):
    raise RuntimeError('Lecteur video incompatible avec le contournement audio.')

class SilentExperimentReader(SilentOriginalReader):
    def __init__ (self, filename, decoderLib='ffpyplayer', decoderOpts=None):
        opts = dict(decoderOpts or {})
        if decoderLib == 'ffpyplayer':
            opts.update({'an': True, 'volume': 0.0, 'sync': 'video'})
        super(). __init__ (filename, decoderLib=decoderLib, decoderOpts=opts)

    def _setVolumeFFPyPlayer(self, volume):
        # Audio is disabled at decoder creation. Do not call native set_volume.
        return None

    def _getVolumeFFPyPlayer(self):
        return 0.0

silent_movie_module.MovieFileReader = SilentExperimentReader
print('SILENT VIDEO PATCH | audio decoding off | native volume calls off', flush=True)

```

Begin exp:

```auto
import random as pyrandom
from pathlib import Path as VideoPath
import faulthandler
faulthandler.enable()

```

Begin routine:

```auto
side = pyrandom.choice(['left', 'right'])
video_file = video_left if side == 'left' else video_right
print(f"VIDEO LOAD | essai {trials.thisN + 1} | {video_file}", flush=True)
if not VideoPath(video_file).is_file():
    raise FileNotFoundError(f"Video introuvable : {VideoPath(video_file).resolve()}")
thisExp.addData('side_shown', side)
thisExp.addData('video_shown', video_file)

```

End routine:

```auto
print(f"VIDEO END | {video_file}", flush=True)

```

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [October 1, 2026, 3:07pm UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/13 "2026-10-01T15:07:23Z")

</div>

Hello

One way to code all videos in the same manner is to use ffpmeg.

```auto
ffmpeg -i input.mp4 -c:v libx264 -r 30 -pix_fmt yuv420p -c:a aac output.mp4

```

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [October 1, 2026, 3:51pm UTC](https://discourse.psychopy.org/t/movie-loop-psychopy-error-3221225477/48006/14 "2026-10-01T15:51:50Z")

</div>

Thank you. I’ve checked in with our developers and this issue should be fixed in 2027.1.0 (i.e. it is already fixed in the dev branch)
