| Reference | Downloads | Github

Freezes in running video clips

URL of the experiment: Pavlovia

Description of the problem: freezes in videos and continue playing the sound of video while the video stoped by the keypress!
Hi. My experiment includes 144 videos and 144 characteristic sounds. In each trial, of the experiment, a word will be shown for 2s and after a 200ms interval page, a characteristic sound plays for 600ms. After 100ms from the characteristic sound onset, the video clip will be started and continues for 2s while a key response is available to the participant from video onset. It means that there is a 500ms overlap between characteristic sound and the video (as shown in my builder view). I got two problems:

  1. There are freezes during video play. The format of videos is mp4 with an h.264 codec.
  2. When the key responses are pressed, the sound of videos still remains to play to the end while everything has stopped and the next trial comes out!

    I would be pleased if anyone could help!

One solution for making your movies play more smoothly is to display them at their original size of 1280 by 1024 pixels. If you need them display at 1023 by 768 pixels, then you can resize all of the movie files to that size, also speeding the online experiment load times (the free HandBrake or another tool can be used to do this). The Size field for the movie component can then be left blank, because the original size is the default. The Position field should also be left blank, centring the movie on the screen (unless you need it offset by a couple of pixels, as it was).

The solution to the problem of the movie’s sound continuing after the response is to add add a single code component below the movie, with an End Routine value of movietrain_trials.stop(), for the training trials (change to match the corresponding movie names in the main experimental blocks).

I have created minimal example based on your original experiment, demonstrating most of these fixes,

Thank you dear @d.govan. I did all the corrections and I think everithing is fine for me!
Best wishes,

Hi @d.govan,

I sent the URL of my piloting to my friends and some of them (not all) said that they saw videos freezing or like an image while all of the videos have the same size and duration.


If a movie is displayed more than once within an experiment, then this freezing as an image can happen. If that is the case, then it would be necessary to either make multiple copies of the movie using different names, or restructuring the trial to play the movie in its own routine (because the movie will then start at the beginning of the routine), adding to the Begin Routine and to the End Routine of the movie’s code code component.

If the movie,instead, does not play smoothly, then it could be due to the combination of software and hardware used one the participants computer, and might improved if run on a different combination.

Hi @d.govan,

In my experiment, each video displays once. As you can see in the picture below, I have an object sound that starts 100 ms before the video clip and prolonged for 600ms. The duration of each video clip is 2s. So there is a 500ms coincidence between an object sound and a video clip.

The problem is that videos display in some devices but not in others or display like an image. I do not know what is the problem. Do I need to add some code for playing videos?

Best regards,