psychopy.org | Reference | Downloads | Github

Imprecise duration of avi videos


#1

OS: Win7
PsychoPy version: v3.0.2
Standard Standalone?: yes

Hello everybody :).
What are you trying to achieve? In a procedure I need avi video clips to appear in random order. I created a loop and the videos appear just fine but the problem is, I need to cut some videos’ duration and the desired duration is not the same for all the videos.
What did you try to make it work? To achive this, I created another column in the condition excel “dur” and put the number of seconds next to each file’s name (e.g. “3.0” meaning 3 seconds). Then I put “$dur” and set the unit as “duration(s)” in the video’s duration field.

What specifically went wrong when you tried that? The videos are presented too short, off by circa 0.2-0.4s compared to what I requested in the conditions file, which is bad. When I tried doing the same but without the looping - put just one video with set duration (“3.0”) in the duration field, it worked out fine (the video’s presented duration was off by max 0.004). But as I need 90 videos in random order, I can’t do this one by one.
Does anybody know why does it happen and how can I fix this?

There’s no error message. All setting are set as default. I’m using the builder view for this. Ah, and as for how do I check for how long were the videos presented, I compare the “movie: autoDraw = True” and “movie: autoDraw = False” time values in the output log. It should be accurate, right?

I hope I managed to explain the situation well, if not - sorry, I’ll answer any questions the best I can. Thanks a lot for your attention :).

~Weronika


#2

Could you post your .psyexp Builder file here to inspect?


#3

Sure, here it is (just the problematic part), along with the conditions excel file:

proba1.psyexp (10.0 KB)
zb all.xlsx (9.2 KB)

Update: I’ve also tried setting the time in frames rather than miliseconds (following the PsychoPy3 website guide) but it didn’t help much - instead of videos being 300ms too short, they were 300ms+ too long…
Is it possible that the whole fault lies in my proccesor and graphic card? I’m using Intel® Core™ i5 vPro and Intel® HD graphic card.

EDIT: Nobody knows what might be the problem? :slight_smile:


#4

[Sorry, I must have missed your response.]

Intel graphics aren’t recommended (especially on Windows) but I suspect that isn’t likely the problem here.

Without having looked at your files yet, I suspect the issue is with how long it takes to open a video file from disk before it can actually start playing (this is true to a lesser extent with regular still images as well). i.e. these operations all take time, which is reduced by having a fast CPU and a fast (ideally solid state) disk. But regardless, it will always take some finite time (this isn’t unique to PsychoPy).

So our usual recommendation is to try to load images and videos at some point before the moment they need to actually start being displayed. i.e. an ideal situation is when you have a fixation point or text prompt at the beginning of a trial. Because nothing is happening on screen, this gives some downtime to open the file from disk in the background.

Do you have an opportunity for that? If so, insert a “Static period” component during that time (e.g. during a fixation stimulus). Then in your video stimulus, switch from it being loaded “every repeat” to during the name of the static period you just created. That period could even be in an earlier routine than the one in which the video is played.

Why might this cause your issue? Because instead of playing immediately at the scheduled time, your video might currently start a little late. But if you schedule it to end at a particular time, that time is still accurate, with the effect that the video plays for less time than intended. e.g. if it is supposed to play from 0 to 3 seconds, and you schedule it to terminate at 2.5 s, but it actually started playing at 0.2 seconds, then the played duration would be 2.3 seconds.

Counting in frames works differently than when using time, which might explain the discrepancy, and so that information was useful in helping speculate on the diagnosis.

I could be barking up the wrong tree, but give it a go if it fits with the structure of your trials.