Mailing Lists: Apple Mailing Lists

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

Offline video processing using visual contexts



I am trying to wrap my head around the new additions to QT 7 (actually I am somewhat of a QT newbie) I am attempting to write a simple application to does some offline (offscreen / command-line) processing on each frame in a mov and write the results out to file. However, I am having "issues" getting my CVPixelBuffer converted to an image correctly. Here is the recipe I am using:

 -  create a CV pixel buffer
 -  create new movie using NewMovieFromProperties passing the pixel buffer in the attributes
 -  set the context callback : QTVisualContextSetImageAvailableCallback(newPixelBufferContext,
                                             &myContextCallback,
                                             NULL);
 - get next interesting time, task movie, tasking the movie kicks off a visual context callback
 - callback extracts image : QTVisualContextCopyImageForTime(visualContext, kCFAllocatorDefault, timeStamp, 
                                        // 3
                                        &currentFrame);

- Convert the CVImageBuffer to a CGImageRef by using a data provider from the pixel buffer. 

- Then write the CGImageRef to file using CFImageDestination

So what happens is that when tasking the movie my callback does indeed get called but the CVTimeStamp value contains "garbage" or bogus / unset values. Never the less I call the context to get an image and write the image to file. The image on file looks like this : http://www.bluebearstudio.com/byron/test2.jpg. I'm surprised I was even able to extract an image with a bogus timestamp. Clearly I don't know what the heck I am doing and have a number of questions :

- Is setting a callback the only way to extract images / pixels from a QT visual context? 
- Is using a QT pixel buffer a good approach to offline processing?  
- The offline opengl sample code using OCRenderer does not seem to work on my system (powerbook 17") and always fails when allocating and initializing the OCRenderer but doesn't seem logical to write to vid mem then exact from vid mem if I am doing everything offline.

I would love to attach some source but the mailing list software keeps whining about a 12kb limit.

- Byron
 _______________________________________________
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.