# Extracting number of frames in .mov with Showtime

**URL:** <https://psychtoolbox.discourse.group/t/extracting-number-of-frames-in-mov-with-showtime/665>\
**Category:** Uncategorized\
**Created:** [November 25, 2004, 9:37pm UTC](https://psychtoolbox.discourse.group/t/extracting-number-of-frames-in-mov-with-showtime/665 "2004-11-25T21:37:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjmacken](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@kjmacken](https://psychtoolbox.discourse.group/u/kjmacken)\
**Post date:** [November 25, 2004, 9:37pm UTC](https://psychtoolbox.discourse.group/t/extracting-number-of-frames-in-mov-with-showtime/665/1 "2004-11-25T21:37:05Z")

</div>

Hi everyone,  
  
I'm having some difficulty extracting some information from stimuli   
generated using the ShowTime.mex function.  
  
I'm currently using Showtime to generate a series of quicktime movies.   
When I want to display them, I am reading the movies into memory, and   
want to use the Psychtoolbox's WaitBlanking ability to control the   
timing (as illustrated in the ShowTime documentation.  
  
ie.  
  
for frame = 1:1:nFrames  
 ShowTime('MovieFrameDisplay',movie,frame);  
 framesSinceLastWait = SCREEN(window,'WaitBlanking');  
end  
  
  
My issue arises because movie files have a differing number of frames   
depending on certain conditions, condition levels etc., so I wish to   
extract nFrames after each movie is loaded into the workspace.  
  
I've tried:  
  
nFrames = ShowtimeMovieFrameCount(movie); % as listed in the ShowTime   
documentation  
  
However, I get an error that this function is undefined.  
  
I have a hacked up calculation which calculates the nFrames per movie   
using the same routine that generated the stimuli files, but I would   
love to be able to extract the number of frames upon load time so the   
display routine is a bit more generalized.  
  
Thanks for any assistance.  
  
Cheers,  
  
Kevin MacKenzie  
  
------------------------------------------------------------------------  
Kevin MacKenzie  
mailto: [kjmacken@...](mailto:kjmacken@...)  
  
Centre for Vision Research  
York University, Toronto  
------------------------------------------------------------------------

---

<div class="post-metadata">

**Author:** ![denispelli](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@denispelli](https://psychtoolbox.discourse.group/u/denispelli)\
**Post date:** [November 25, 2004, 10:04pm UTC](https://psychtoolbox.discourse.group/t/extracting-number-of-frames-in-mov-with-showtime/665/2 "2004-11-25T22:04:06Z")

</div>

dear kevin  
  
the most likely explanation is that there's a bug in our code, in the   
showtime mex file. it is quite possible that the frame counting feature   
was never tested. there isn't anyone here who can work on it right now,   
but the sources of showtime.mex are available on our download page and   
you may be able to debug it. don't assume that this feature ever worked   
correctly as i don't recall ever testing it. if you do find the bug,   
we'll be happy to fold the fixed version into our standard   
distribution.  
  
i realize that "fix it yourself?" is probably not the answer you were   
looking for, but i'm trying to be helpful and realistic.  
  
best  
  
denis  
  

> On Nov 25, 2004, at 4:37 PM, Kevin MacKenzie wrote:  
>    
> \>  
> \> Hi everyone,  
> \>  
> \> I'm having some difficulty extracting some information from stimuli  
> \> generated using the ShowTime.mex function.  
> \>  
> \> I'm currently using Showtime to generate a series of quicktime movies.  
> \> When I want to display them, I am reading the movies into memory, and  
> \> want to use the Psychtoolbox's WaitBlanking ability to control the  
> \> timing (as illustrated in the ShowTime documentation.  
> \>  
> \> ie.  
> \>  
> \> for frame = 1:1:nFrames  
> \> ShowTime('MovieFrameDisplay',movie,frame);  
> \> framesSinceLastWait = SCREEN(window,'WaitBlanking');  
> \> end  
> \>  
> \>  
> \> My issue arises because movie files have a differing number of frames  
> \> depending on certain conditions, condition levels etc., so I wish to  
> \> extract nFrames after each movie is loaded into the workspace.  
> \>  
> \> I've tried:  
> \>  
> \> nFrames = ShowtimeMovieFrameCount(movie); % as listed in the ShowTime  
> \> documentation  
> \>  
> \> However, I get an error that this function is undefined.  
> \>  
> \> I have a hacked up calculation which calculates the nFrames per movie  
> \> using the same routine that generated the stimuli files, but I would  
> \> love to be able to extract the number of frames upon load time so the  
> \> display routine is a bit more generalized.  
> \>  
> \> Thanks for any assistance.  
> \>  
> \> Cheers,  
> \>  
> \> Kevin MacKenzie  
> \>  
> \> -----------------------------------------------------------------------   
> \> -  
> \> Kevin MacKenzie  
> \> mailto: [kjmacken@...](mailto:kjmacken@...)  
> \>  
> \> Centre for Vision Research  
> \> York University, Toronto  
> \> -----------------------------------------------------------------------   
> \> -  
> \>  
> \>  
> \>  
> \>  
> \>  
> \> Post your message to: [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com)  
> \> Please indicate OS9, OSX, or WIN version, and include your full name.  
> \> Denis Pelli, David Brainard, and Allen Ingling.  
> \> [http://psychtoolbox.org](http://psychtoolbox.org)  
> \>  
> \> Yahoo! Groups Links  
> \>  
> \>  
> \>  
> \>  
> \>  
> \>  
> \>
