<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hello,</div><div><br></div>Quick summary of my use case: I am capturing video on Mac OS X using QTKit, and then using FFmpeg to stream FLV video. I am presently successfully capturing from my internal MacBook Pro camera, using FFmpeg to encode, using FFmpeg to stream (publish) to a server (Wowza), and then am able to successfully play this video in a client from the server. So in other words, the capture / publish / play pipeline is in tact and video is moving across it as expected. <div><br></div><div>The problem is that the video quality (specifically color and artifacts) isn't what I'm capturing. The color is off -- desaturated with a slightly green hue, with colored lines consistently across the the video image. In addition, the left border of the image appears cut off/repeated. </div><div><br></div><div>I suspect that the problem is due to a mismatch between pixel formats of the captured video frames, vs. the expected pixel format in the filled frame. Because my AVCodec is outputting FLV, it only supports one pixel format: <span style="color: rgb(0, 132, 0); font-family: Menlo; font-size: 11px; ">PIX_FMT_YUV420P. </span>Choosing any other pixel format results in an error, and that would seem to be supported in the source code I read in flvenc.c. So the codec is set to that pixel format. </div><div><br></div><div>The data coming in from the QTCapture on the OSX / Cocoa side is set as <span style="color: rgb(61, 29, 129); font-family: Menlo; font-size: 11px; ">kCVPixelFormatType_420YpCbCr8BiPlanarFullRange,</span>one of only two pixel formats that work in this case. The doc for this format reads as follows: </div><div><br></div><div>"<span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range (luma=[0,255] chroma=[1,255]). </span><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: rgb(102, 102, 102); background-color: rgb(255, 255, 255); ">baseAddr</code><span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); "> points to a big-endian </span><code style="font-size: 13px; font-family: Courier, Consolas, monospace; color: rgb(102, 102, 102); background-color: rgb(255, 255, 255); ">CVPlanarPixelBufferInfo_YCbCrBiPlanar</code><span style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); "> struct.</span>"</div><div><br></div><div>My code (heavily abridged for brevity) hits these high points: </div><div><br></div><div>NOTE: frameBufferAddress is a CVImageBufferRef received from the QT capture callback: </div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">    <span style="color: rgb(187, 44, 162); ">int</span> returnVal = <span style="color: rgb(61, 29, 129); ">avpicture_fill</span>((<span style="color: rgb(112, 61, 170); ">AVPicture</span>*)avFrame, frameBufferBaseAddress, <span style="color: rgb(61, 29, 129); ">PIX_FMT_YUV420P</span>, width, height);</div></div><div>...</div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">    returnVal = <span style="color: rgb(61, 29, 129); ">avcodec_encode_video2</span>(<span style="color: rgb(79, 129, 135); ">_videoStream</span>-><span style="color: rgb(112, 61, 170); ">codec</span>, &avPacket, avFrame, &gotPacket);</div></div><div>...</div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">    returnVal = <span style="color: rgb(61, 29, 129); ">av_interleaved_write_frame</span>(<span style="color: rgb(79, 129, 135); ">_avOutputFormatContext</span>, &avPacket);</div></div><div><br></div><div>My suspicion is that kCVPPixelFormatType_420YpCBCrBBiPlanarFullRange isn't matching properly to PIX_FMT_YUV420P, and so the avpicture_fill call isn't properly filling the frame with data. I've spent the day poring over the pixel format descriptions in pixfmt.h, and doing trial and error in that first line of code with a number of other formats that have come close in description, to no avail. In fact, most of them crash the app with no log message at all. </div><div><br></div><div>If anyone has any idea on how to fix this video quality, I would greatly appreciate your help. Any ideas are welcome. Thanks so much in advance.</div><div><br></div><div>Regards, </div><div><br></div><div>Brad</div><div><br></div></body></html>