Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Fw: Frames per second
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fw: Frames per second



> From: "Pieter Laeremans"
> Sent: Saturday, June 11, 2005 11:58 PM
> Subject: Re: Frames per second
>
> > >> How can I determine the frames per second rate of a movie, or more
> > >> specifically the video track within a movie? I've figured out how
> > >> to get the time scale and the duration, but the rate eludes.
> > >> getRate() and getPreferredRate() seem to be relative numbers
> > >> rather than absolute numbers; i.e. they can speed up or slow down
> > >> a movie but they don't tell me how fast it normally plays.
> > >>
> > >>
> > >
> > > I think it's related to the TimeBase (combined with the Rate)
> > >
> >
> >
> > What works with the movie files I tried is in the code below:
> >
> >
> > the timeScale is obtianed by mov.getTimeScale(), but is initialized
> > prior
> >
> > Applying this to the videotrack didn't yield good results for every
> > movie type.
> >
> > notice that the myFlags changes. I don't know why I did it.  But part
> > of this is inspired by looking at some piece of code in Chris
> > Adamsons book (which is great by the way).
> > Notice that I store each time
> >
> >
> > /**
> >       * Calculates the frameRate and assigns it to the instance
> > variable frameRate
> >       * also stores the duration of a frame to the instance variable
> > timeForOneFrame
> >       * expressed in the timebase of the movie.
> >         Requires: timeScale set to the timeScale of the movie
> >       * @throws StdQTException
> >       */
> >      private void getFrameRate() throws StdQTException {
> >          int myFlags = StdQTConstants.nextTimeEdgeOK
> >                  + StdQTConstants.nextTimeMediaSample;
> >          TimeInfo myTime = new TimeInfo(0, 0);
> >
> >          try {
> >              Track theTrack = mov.getIndTrackType(1,
> >                      StdQTConstants.visualMediaCharacteristic,
> >                      StdQTConstants.movieTrackCharacteristic);
> >              for (int i = 0; i < 3; i++) {
> >                  myTime = theTrack.getNextInterestingTime(myFlags,
> > myTime.time,
> >                          1f);
> >                  myFlags = StdQTConstants.nextTimeStep;
> >                  if (i == 2) {
> >                      timeForOneFrame = myTime.duration;
> >                      frameRate = timeScale / myTime.duration;
> >                  }
> >              }
> >
> >          } catch (Exception e) {
> >
> >          }
> >      }
> >
> >
> >
> >
> > >
> > > -----
> > > George Birbilis (email@hidden)
> > > Microsoft Most Valuable Professional
> > > MVP J# for 2004 & 2005
> > > http://www.kagi.com/birbilis
> > > QuickTime, Delphi, ActiveX, .NET, IPC
> > > --------------
> >
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-java mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.