Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bunch of questions about Apple Java



On Sun, 27 Jul 2003 17:26:16 -0500, Kenneth McDonald <email@hidden> wrote:

5) Finally, any example code for pulling out frames from video files?
(I assume this
would need to use the OS X-Java interface, and I know nothing about OS
X APIs.)

As Robert Ross noted earlier, this could be done with QuickTime for Java (http://developer.apple.com/quicktime/qtjava/ ). QTJ can be difficult to get the hang of (it is as large as all of java 1.1, and has some C-ish legacies), but has lots of power and works on MacOS, Mac OS X, and Windows.

Just off the top of my head, an approach to this might be (this assumes you just want to write the frames to disk):
1. open a movie (Movie.fromFile())
2. find the video track (iterate over Movie.getTrack(int), take one whose getMedia() returns an instanceof VideoMedia)
3. for every frame (ie, every sample) as indicated by Track.getNextInterestingTime():
4a. simpler: get a Pict at that time with Movie.getPict() and dump with Pict.writeToFile() OR
4b. harder: get a GraphicExporter, go to frame time, use Movie's GWorld (aka QDGraphics) as source for exporter, write to format of your choice

getNextInterestingTime() involves some peril (esp. with MPEG-1 files, where this won't work at all). But I think the above should work for typical .mov's.

Lots of QTJ help on the quicktime-java list: http://www.lists.apple.com/mailman/listinfo/quicktime-java

--Chris
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.