| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Hi, I'm trying to create a Movie via ICMCompressionSession. The input comes from an QTCaptureSession via the QTCaptureDecompressedVideoOutput. I started to feed the frame over the didOutputVideiFrame is works fine: - (void)captureOutput:(QTCaptureOutput *)captureOutput didOutputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer: (QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection { err = ICMCompressionSessionEncodeFrame( mCompressionSession, videoFrame , timeStamp, [sampleBuffer duration].timeValue, kICMValidTime_DisplayTimeStampIsValid, NULL, NULL, NULL ); timeStamp = timeStamp + timescale; } so now I tried to modify the a CIImage that i get from videoFrame and write it into the ICMCompressionSession using an CVPixelBuffer. The pixelBuffer came from a ICMCompression-Pixelbufferpool. Now I have memory problems the app does alloc more and more memory, even if only pass an PixelBuffer directly from the pool like this: CVImageBufferRef buffer; theError = CVPixelBufferPoolCreatePixelBuffer(NULL, mBufferPool, &buffer); if(theError).... else{ CVPixelBufferRetain(buffer); err = ICMCompressionSessionEncodeFrame( mCompressionSession, buffer , timeStamp, [sampleBuffer duration].timeValue, kICMValidTime_DisplayTimeStampIsValid, NULL, NULL, NULL ); timeStamp = timeStamp + timescale; CVPixelBufferRelease(buffer); } Someday it should look like this: CVImageBufferRef buffer; theError = CVPixelBufferPoolCreatePixelBuffer(NULL, mBufferPool, &buffer); if(theError)... CVPixelBufferRetain(buffer); theError = CVPixelBufferLockBaseAddress(buffer, 0); if(theError).... CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); void * rasterData = CVPixelBufferGetBaseAddress(buffer); CGContextRef cgContextRef = CGBitmapContextCreate( rasterData, CVPixelBufferGetWidth(buffer), CVPixelBufferGetHeight(buffer), 8, CVPixelBufferGetBytesPerRow(buffer), colorSpace, kCGImageAlphaPremultipliedLast); if(cgContextRef == nil)... CIContext * cicontext = [CIContext contextWithCGContext:cgContextRef options:nil]; CIImage* inputImage1 = [CIImage imageWithCVImageBuffer:videoFrame]; //do CIFilter stuff ..... CGImageRef cgImage = [cicontext createCGImage:inputImage1 fromRect:[inputImage1 extent]]; CGContextDrawImage(cgContextRef, [inputImage1 extent], cgImage); err = ICMCompressionSessionEncodeFrame( mCompressionSession, buffer , timeStamp, [sampleBuffer duration].timeValue, kICMValidTime_DisplayTimeStampIsValid, NULL, NULL, NULL ); timeStamp = timeStamp +timescale; if(err)... CGColorSpaceRelease(colorSpace); CGImageRelease(cgImage); [cicontext release]; CGContextRelease(cgContextRef); CVPixelBufferRelease(buffer); So i must do something wrong: - did I forget to register a Callback for clean up the buffer? - do I have to copy the CVBufferAttachments from the videoframe to the buffer? - do I have to call something for clean up? - Not enough Performance? Is does no look like. i am working on an 8-Core MacPro and all CPU's are working between 50-60%. Datails about the ICMCompressionSession: - Codec: Appel Prores 422 HQ - Format is Full HD 1920x1080 - Input via AJA Card Thanks for help Hannes Osius |
_______________________________________________ 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
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.