Problem with running video files in Pavlovia

URL of the experiment: https://run.pavlovia.org/m.hamzeloo/visual-search-demo-with-video1/html/

Description of the problem:
I created a demo for my experiment to see whether I can run it online. I have a loop sequence start with a word for 2s and a blank page for 0.5s then a sound for 600s and a video clip for 2s with background noise. Everything is fine on the computer, but when I run it for piloting everything is fine except for videos I have the background noise (the sound) of videos but not the video. My video file format is mp4 and you can see the other setting for videos in the following picture.


I do not get any error but I cannot see the videos.

Not entirely sure what’s going on, but here’s a couple things to try and see what happens:

  1. Try changing the units to “pix”
  2. If I’m seeing this correctly, the movie itself doesn’t have sound, it just plays while a sound element plays in the background? Try disabling the sound temporarily (in the “testing” tab you can turn a component off for testing purposes, very handy for things like this).

This is mostly trying to narrow down what the problem is rather than fix it outright. Also, if that doesn’t work, you can link your gitlab repository (view code, then go to settings->general->permissions) so we can have a closer look at the experiment.

Thank you, Jonathan, for your response. I changed the units to “pix” and I opened the view code for the public. I also disabled the sound stimuli but still, I don’t have the videos when I run it online.
In my experiment, there is a sound stimulus related to an object (e.g.,the sound of a violin) that run 100ms before the video clip onset and they play for 600ms. I changed the sound of videos with background noise and then I saved them with mp4 format. So, each video has a sound look like the noise in our environment. Now, when I run my experiment online I just hear the two sounds (sound stimuli and sound of the video) but I can’t see the videos.
I am wondering if the problem related to:

  1. the problem with the screen setting
  2. the problem with video stimuli setting
  3. the format of the video clips
    or any other possible problem.
    Thanks
    The experiment URL: https://pavlovia.org/m.hamzeloo/visual-search-demo-2
    The piloting URL (AVALBE JUST FOR 1H): https://run.pavlovia.org/m.hamzeloo/visual-search-demo-with-videos-2/html/?__pilotToken=aab3238922bcc25a6f606eb525ffdc56&__oauthToken=73f96fe271aceeb7cc7c25497a3b35febe1d29f2eeb61e63e694bea13198298b

After copying your experiment and doing some careful process of elimination, it appears to be an issue with the video files themselves. I can get other mp4 files to play, even in your experiment with all the settings as you have them, but not your videos.

The issue may be the encoding. They are currently MPEG-4 encoded, whereas the videos I can get to work are h.264 encoded (and saved as .mp4 files). If you are able to re-encode your videos with h.264, that might be your best bet.

Thank you Jonathan so much. I encoded the video files to h.264 an now the videos of my experiment run online without any problem, but there is a little problem, when I press the “y” or “n” as response key before finishing the video (because the response keys are available as the video clip become on), the sound of the videos still remain playing to the end of the video frame (2s) while the next trial is present.

Cheers,
Mohammad

Hi everyone and thanks for the suggestions made so far. I have problems showing videos in my experiment; I tried to convert them into h.264.mp4 files, but I still get some errors. Not sure what the problem is, can anyone please help?


Thanks.
Elena

Have you checked that the files are in html/resources/images on Gitlab?

Thank you, wakecarter. Yes, they are in html/resources/images.
Any other suggestion?

I solved the problem in the meanwhile!

Hello all,
I also have a problem with running video files in Pavlovia (an experiment in a pilot mode now).
The files are in html/resources/images on Gitlab, I have tried different formats (mov, mp4, h.264.mp4, currently working with h.264.mp4 files), but the same problems persist.

  • I have two video routines: one with the constant movie file (the example), the other with movie file set every repeat from the loop file. (the trial video). Both work just fine on my computer, but different problems occur with the two routines online.

  • The first example video (constant) is played, but after it ends, it does not disappear and therefore overlaps with the text that should follow the video.

  • The trial video (set every repeat from file) can’t be seen on the screen. If you exit the full-screen mode while the video is playing, you can catch the end of it, but if you proceed to the next video, it does not play as well. I do not get the error messages.

What should I do?

The piloting URL: https://run.pavlovia.org/feygele/cl_acceptability_judgement/?__pilotToken=70efdf2ec9b086079795c442636b55fb&__oauthToken=8a7883d94eddcfaef85feb4d3b5c1c63ba5cf7d311d721015c53c5476f4a4885
Experiment URL: https://pavlovia.org/feygele/cl_acceptability_judgement

Thank you in advance!

P.S. Also tried different browsers, same effect.

I have the same problem; I have a loop that’s supposed to display different video every repeat, but the video file is nowhere to be seen and once you exit the full-screen mode the video is playing albeit it stops after one go whereas it should loop. I tried different formats and settings (with size and no size, pix, height etc.) and nothing seems to fix this. Does anyone have any ideas?
Thank you in advance!!!

Try adding a start time of 1s to the video rather than having it start at the beginning of the routine.

Wakecarter, thanks for your reply. Currently, I have a loop with several repeats of which some have the video playing, and some not. The way I achieve this is by having a video component start when my video_swicth is True. Do you think this is causing the problem? I could, of course, make it so that each repeat is, in fact, separate routine although having one loop seemed like an elegant solution at the time.
Thanks.

Hi,

Definitely don’t switch to separate routines for each repeat. However, there’s more than one way to selectively start a video.

One option would be to have an empty video for the repeats where you don’t want anything playing. Alternatively you could set the video up in a prior routine and then start it in code in the trial.

I’ve had issues with videos not playing a second time if they are allowed to finish, so that’s something to watch for.

Best wishes,

Wakefield

Hi Pavle, @sotiri managed to help me with the videos here: Video does not play on Pavlovia, but no error messages, but I am not sure if we have the same problem: in my experiment, all trials included videos.

Thanks @wakecarter and @feygele!
I managed to do it. As suggested, I added videos on every repeat and I change opacity to 0 when I don’t want any videos playing. That plus some size adjustments to my videos and a 0.5 start delay and voilà!
Thanks again!
Regards.

Hi all,

I am having a similar issue. I can’t see my videos on Pavlovia but can hear the audio, though they work perfectly in PsychoPy. I made a separate experiment just with one movie component to see whether the videos were the problem or some other code of my bigger experiment, but the videos still don’t work! So I am thinking it’s a problem with the videos, but cannot figure out what.

I have coded the videos from .mov files to h264 mp4 files with AAC 44100 Hz audio, as I have seen recommended and still nothing. You can see the details of the videos here:

Here is the experiment test - it would be really great if someone has a little time to have a look!
movie_test.psyexp (4.1 KB)

Thanks, all.

Hey @milsandhills,

My compliments for checking the codecs and testing via a dedicated experiment! Could you share the repo of that test-experiment with me (tpronk), so I can take a look? Searching for experiments on Pavlovia — PsychoPy v2021.1

Also, which operating system and browser did you use when running your tests?

Best, Thomas

Hi @thomas_pronk,

Thanks so much for your reply! I have added you now. Apologies that there is quite a lot in that folder, as it’s the same one I used for my larger experiment too, not just the test. The psych file you want is called ‘movie_test.psyexp’.

I have tried to run the experiment in both Chrome and Edge and both have the same issue. I’m using Windows 10.

Hope this helps, let me know if there’s anything else you need!

Many thanks.

Hey again!

I managed to solve half of the problem: your experiment uses height units, in which case 1 is the full height of the screen. You specified [700, 400], so the video got blown up immensely. This can be fixed by specifying, for example [0.7,0.4].

There was some other issue though: in VLC player and in my web-browser, the first couple of seconds the video didn’t play, but after that it did. Didn’t have that problem using Windows 10’s equivalent of Window Media Player though.

Perhaps re-converting from the original videos could help? Also, to reduce their size a bit, I recommend this tutorial: Media formats suitable for online studies — PsychoPy v2021.1

Best, Thomas