Get Video frame number

Hello,

I am trying to present videos and would like to know the frame number that I am drawing so that I can later correlate frame content with behavior. How can I get the frame number from Screen(‘GetMovieImage’)?

Thanks!

You can’t get a frame number, but you can get a timeIndex / presentation timestamp in movie time as 2nd return argument. Ie. essentially the same purpose, but in seconds since start of movie instead of frames since start of movie.

1 Like

Thank you. I guess then my question is: Can the timeindex take any other values than multiples of (1/fps)?

The general answer to that would be that it depends on your video file, and whether its constant framerate or variable frame rate. Constant framerate should be 1/sample rate yes

1 Like

Thanks. So what would be the solution in case I have a variable framework but I still want to know which frame was on the screen?

The returned timeindex timestamps, defining the “position” of the frame within the movie, starting at 0 seconds at the beginning of the movie, should be unique for each frame, so they are a unique identifier for each frame. DetectionRTInVideoDemo.m demo may contain some useful bits wrt. this topic. Hasn’t been in ages though.

The time method works for me, thank you!