Extracting movie frames quickly in a 64-bit Cocoa

2019-05-05 19:31发布

问题:

I wrote a 64-bit Cocoa app on Snow Leopard that extracts individual frames from a movie using the QuickTime API. It uses [QTMovie currentFrameImage], which unfortunately is very slow, as was pointed out here:

https://stackoverflow.com/questions/5843702/export-every-frame-from-a-movie-using-quicktime-api

Apple's developer site describes the following alternative method using QTPixelBufferContextCreate with NewMovieFromProperties:

http://developer.apple.com/library/mac/#qa/qa1443/_index.html

Using this approach, I wrote a 32-bit app that was able to extract the frames at a much faster rate, but it appears that the API (e.g. QTVisualContextRef) is not available to 64-bit apps, as was pointed out here:

http://www.mailinglistarchive.com/html/quicktime-api@lists.apple.com/2009-01/msg00014.html

and here:

Error: expected specifier-qualifier-list before 'QTVisualContextRef'

My app needs to be 64-bit, so I am seeking another alternative for extracting frames quickly. Has anyone accomplished this using the frameworks currently available on Snow Leopard?

Edit:

I did not find a way to extract frames quickly on Snow Leopard, but I did find a way to do it using AV Foundation on Lion. AV Foundation has been available for iOS, but it is new for Mac OS starting with Lion. A good description of how to extract frames quickly using AV Foundation can be found at 7twenty7com.