# Shorten MovieStim by dropping frames - how?

Hi everybody,

I am working on a fMRI block design in which MovieStim are presented.

The experiment design is such that in each block 3 movies are presented in a random order. One experiment run includes a fixation cross (16s), 3 movie blocks (with 3 movies each), a fixation cross (16s), 3 movie blocks (with 3 movies each) and a fixation cross for (16s).

The problem is that, each movie block should also be 16s long (so in total 9x16s blocks are presented) but the movies them selves are of different lengths. So in one block the movie durations sum up to 18s in another to 17s and another 16s. (they are always at least 16s long, so I would only need to cut some movies off but not extend their duration…)

My QUESTION1 is does someone have an idea how to achieve this design, i.e. reduce the movie length such that the each block duration sums up to 16s?
(I used the builder so more people can use the script, but I am used to coding in python so code solutions welcome!!)
Currently the movie_block is a loop around two Routines. The loop runs 3 times (so each movie is played) in one routine based on a randomised order_matrix the movie path is selected (Code component in the Routine1) in the other routine the movie is presented (MovieStim component in Routine2).

My current approach is to find a work around by just stopping (i.e. dropping frames of) the last movie that is playing, if the total duration of the block reaches the threshold of 16s. For this I have another QUESTION2, I don’t fully understand how the movie stimulus is presented in psychopy. Can I interrupt the movie presentation at any time? I know there is the MovieStim.stop() function/attribute but when is this executed in terms of code (before the movie stimulus is drawn, during, after…)?

I started out by using the builder, but now nearly each Routine has a code component anyway, I am currently thinking about using a single Code Segment and write the movieStim and presentation myself… We will see how that goes!

I am happy about every thought!

Can’t you just set the duration of each movie component explicitly to a fixed duration of 16 seconds? Builder should terminate it automatically at that time, even if the movie file itself is longer than that.