Conversion of QTCaptureDecompressedVideoOutput frame to YUV420p
Conversion of QTCaptureDecompressedVideoOutput frame to YUV420p
- Subject: Conversion of QTCaptureDecompressedVideoOutput frame to YUV420p
- From: "Brad O'Hearne" <email@hidden>
- Date: Tue, 05 Feb 2013 18:01:52 -0700
Hello,
I am trying to take a CVImageBufferRef received from the following video capture callback:
- (void)outputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection
...and feed to to an FFmpeg codec for further encoding. We can ignore the FFmpeg side of this except to say that the FFmpeg codec in use requires YUV420p, which for anyone familiar with FFmpeg is the pixel format AV_PIX_FMT_YUV420P,described as follows:
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
I am pretty sure that I have to set attributes on the QTCaptureDecompressedVideoOutput instance to use KCVPixelFormatType_420YpCbCr8Planar pixel format type, given the definition below seems closest to the desired YUV 4:2:0 format, and that I need to be Snow Leopard compatible.
kCVPixelFormatType_420YpCbCr8Planar
Planar Component Y'CbCr 8-bit 4:2:0. baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrPlanar struct.
Available in OS X v10.5 and later.
The problem is that once this attribute is set, the capture is failing with the following in the console:
2013-02-05 17:48:21.050 Sentinel[998:13503] *** QTCaptureDecompressedVideoOutput warning: Output received the following error while decompressing video: Error Domain=NSOSStatusErrorDomain Code=-12906 "The operation couldn’t be completed. (OSStatus error -12906.)". Make sure that the pixel buffer attributes of all outputs are valid.
Question #1: why am I receiving this message, and how to I get past it.
Question #2 (and if you can answer this, forget #1): How can I get a decompressed frame formatted properly to the following format:
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Thanks in advance for your help.
Regards,
Brad
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden