We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Slightly rewritten video.Movie library (Read 2006 times)
Slightly rewritten video.Movie library
Mar 16th, 2007, 1:32pm
 
I have rewritten the video library. This fixes a 'problem' and adds two new methods.

The 'problem' is that the video library class name for  processing.Movie clashes with the class name for quicktime.std.movies.Movie. This means that you may have to explicitly state which Movie object you are referring to if you have written code that accesses fields and methods from both classes/instances.

Anyway, I changed the class from Movie to PMovie, so now for example when passing these types as method arguments you would use PMovie for the processing movie object type, and Movie for the Quicktime movie object type.

The two new methods allow PMovie objects to calculate and return the number of frames in the instance, and to get the average frames-per-second (FPS) of the movie. The average should be the actual FPS but apparently some movies have a variable frame rate which would make this value wrong.

The method declarations are:

public int calcTotalFrames()

public float getAverageFPS()

so they simply return an int and float value respectively when called e.g:

float fps = myMovie.getAverageFPS();

To support these new methods, a quicktime.std.movies.media.Media object is now created by the constructor of the PMovie class. It is declared as:

 public Media media;

"in case anyone wants to play with it" just like the quicktime movie object that is contained inside the original processing.video.Movie class.

Anyway, I will post a zip archive of the library to my website. Go here to get it: http://members.webone.com.au/~fox/video.zip

Because the package name is identical, I recommend that you keep a copy of the original video library somewhere just in case this doesn't work for you.

If anybody wants the xCode project I could email it to them (~1.8 MB when zipped).
Page Index Toggle Pages: 1