Timestamp of movies

I’m new to psychopy and have a problem using MovieStim.seek(timestamp). Is there a way to extract the timestamp of the video at a certain point(i.e. after pressing a key, and get the timestamp of the video when the key is pressed)? Thanks.

Hi @guckmalmensch, you could achieve this by giving a keytboard and moviestim the same onset time, and whenever a key is pressed, you can collect the response time, and use that as your timestamp. Do you want to store multiple timestamps, or the time of the first key response, or something else?

1 Like

I have a similar problem. I am using the builder and I need to pause videos at their last frame, however, they have different lengths and their onset time depends on other factors. How can we make movies freeze at their ending frame? @dvbridges any ideas? I will very much appreciate some.

By freezing the last frame, you mean have the movie scene continued to be paused indefinitely on the screen on the last frame?

Using coder, this can be achieved easily. If you have some python background, you can insert a mov.pause() function once the movie is at the last frame of the play (for) loop; where mov is your MovieStim item.

Otherwise, can you post the part of your builder code that plays the movie here?

I have this code, but it is not working as I thought it would. At the ending of the video it disappears instead of pausing on the final frame.

if myVideo.status == FINISHED:
    myVideo.pause()

I logged the time stamps of the global clock at the beginning and at the ending of the video but it seems that it is playing at a slower frame rate than it should. The difference between the timestamps at the beginning and at the end is 7.5 seconds, but its real length of it is 6 seconds. No idea why it is playing slowly. It does not really matter in my experiment but in other experiments that may be a problem.

I need to pause the video at its the ending so that people can see it onscreen. Any ideas?

Thanks,
Miguel

I just found out that I can pause movies at their ending by using this code in each frame:

if myVideo.getCurrentFrameTime() >= (myVideo.duration - 0.05):
    myVideo.pause()

I’m not exactly sure what entails the variable ‘FINISHED’, but if ‘FINISHED’ meant that the video has entirely finished playing, then you cannot possibly pause the video when the video is already past the last available second. It is a bit like playing a video on your media player and wanting to pause the video after the video has reached the end.

Your following code would make more sense as it ends 0.05s before the end of the video.