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: QTMovie currentFrameImage is slow




On Sep 12, 2006, at 10:31 AM, James Weatherley wrote:

How do I get a movie frame without everything grinding to a halt?
Here's what I'm trying to do:


long long pos = 0; long long end = [movie duration].timeValue; NSImage* image; while(pos < length) {

   // Add an autorelease pool so we don't end up with loads of
unreleased NSImage*s in the loop.
   NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

   // This line causes the trouble.
   image = [movie currentFrameImage];

   [movie stepForward];
   pos = [movie currentTime].timeValue;

   [pool release];
}

Without the line 'image = [movie currentFrameImage];' the loop
finishes in about two seconds for a sixteen second movie. With the
line it takes nearly 350 seconds. Why so slow? How can I get movie
frames at a reasonable rate?

This is a known problem with currentFrameImage and frameImageAtTime. There is unfortunately no easy workaround. We hope to provide a significant speed-up in Leopard.


If you can't wait 'til then, I can imagine several workarounds, all of which involve you drawing the movie into a buffer (GWorld or visual context) and creating an NSImage from that buffer.


Tim Monroe
QuickTime Engineering _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden


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 © 2007 Apple Inc. All rights reserved.