I'm no expert in ffmpeg but one in broadcast video and normally YCrCb 422 is not full range that is Y ranges from16 to 235 and Cr/Cb are signed and range from 16 to 240 (128 being 0). The Full range term may use the full 0-255 range and that could cause problems but not sure...<br>
<br><div class="gmail_quote">On Mon, Feb 4, 2013 at 7:31 PM, Brad O'Hearne <span dir="ltr"><<a href="mailto:brado@bighillsoftware.com" target="_blank">brado@bighillsoftware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Carl, <div><br></div><div>Thanks for the reply. I've tried both PIX_FMT_NV12 and PIX_FMT_NV21 (in fact, those were the ones I originally thought would work based on description). However, when I use either of those formats in place of <span style="color:rgb(61,29,129);font-family:Menlo;font-size:11px">PIX_FMT_YUV420P </span>in the following line of code: </div>
<div class="im"><div><br></div><div><span style="font-family:Menlo;font-size:11px;color:rgb(187,44,162)">int</span><span style="font-family:Menlo;font-size:11px"> returnVal = </span><span style="font-family:Menlo;font-size:11px;color:rgb(61,29,129)">avpicture_fill</span><span style="font-family:Menlo;font-size:11px">((</span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">AVPicture</span><span style="font-family:Menlo;font-size:11px">*)avFrame, frameBufferBaseAddress, </span><span style="font-family:Menlo;font-size:11px;color:rgb(61,29,129)">PIX_FMT_YUV420P</span><span style="font-family:Menlo;font-size:11px">, width, height);</span></div>
<div><font face="Menlo"><span style="font-size:11px"><br></span></font></div></div><div>then while it executes the avpicture_fill line successfully, the subsequent line of code </div><div class="im"><div><br></div><div><span style="font-family:Menlo;font-size:11px">returnVal = </span><span style="font-family:Menlo;font-size:11px;color:rgb(61,29,129)">avcodec_encode_video2</span><span style="font-family:Menlo;font-size:11px">(</span><span style="font-family:Menlo;font-size:11px;color:rgb(79,129,135)">_videoStream</span><span style="font-family:Menlo;font-size:11px">-></span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">codec</span><span style="font-family:Menlo;font-size:11px">, &avPacket, avFrame, &gotPacket);</span></div>
<div><br></div></div><div>crashes the whole app with an EXC_BAD_ACCESS error -- and there's no message of any kind written to the console. I have no idea what is causing the crash. Here's the complete block of the code between those two lines: </div>
<div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo">... </div><div style="margin:0px;font-size:11px;font-family:Menlo"> <span style="color:#bb2ca2">int</span> returnVal = <span style="color:#3d1d81">avpicture_fill</span>((<span style="color:#703daa">AVPicture</span>*)avFrame, frameBufferBaseAddress, <span style="color:#3d1d81">PIX_FMT_NV21</span>, width, height);</div>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> <br></p><div style="margin:0px;font-size:11px;font-family:Menlo"> <span style="color:#bb2ca2">if</span> (returnVal < <span style="color:#272ad8">0</span>)</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> {</div><div style="margin:0px;font-size:11px;font-family:Menlo"> <span style="color:#bb2ca2">if</span> (error)</div><div style="margin:0px;font-size:11px;font-family:Menlo">
{</div><div style="margin:0px;font-size:11px;font-family:Menlo"><div style="margin:0px;color:rgb(209,47,27)"><span style="color:#000000"> <span style="white-space:pre-wrap"> </span></span><span style="color:#31595d">NSLOG</span><span style="color:#000000">(</span>@"Frame fill failed."<span style="color:#000000">);</span></div>
</div><div style="margin:0px;font-size:11px;font-family:Menlo"><span style="color:rgb(209,47,27)"> </span><span style="color:rgb(209,47,27)">}</span></div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br></p><div style="margin:0px;font-size:11px;font-family:Menlo"> <span style="color:#bb2ca2">return</span> <span style="color:#bb2ca2">NO</span>;</div><div style="margin:0px;font-size:11px;font-family:Menlo">
}</div><div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"> <span style="color:rgb(112,61,170)">AVPacket</span> avPacket;</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> <span style="color:#3d1d81">av_init_packet</span>(&avPacket);</div><div style="margin:0px;font-size:11px;font-family:Menlo"> avPacket.<span style="color:#703daa">data</span> = <span style="color:#bb2ca2">NULL</span>;</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> avPacket.<span style="color:#703daa">size</span> = <span style="color:#272ad8">0</span>;</div><div style="margin:0px;font-size:11px;font-family:Menlo"> <span style="color:#bb2ca2">int</span> gotPacket;</div>
<div class="im"><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> <br></p><div style="margin:0px;font-size:11px;font-family:Menlo"> returnVal = <span style="color:#3d1d81">avcodec_encode_video2</span>(<span style="color:#4f8187">_videoStream</span>-><span style="color:#703daa">codec</span>, &avPacket, avFrame, &gotPacket);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">...</div></div></div><div><br></div><div>That's been pretty standard for most of the other pixel formats I've tried. There have been one or two that didn't crash the app, but had very wacky distortions (like half the image being neon green), but most of them just crash the app outright. </div>
<div><br></div><div>Ideas? </div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Brad</div></font></span><div><div class="h5"><div><br></div><div><div><div>On Feb 4, 2013, at 4:55 PM, Carl Eugen Hoyos <<a href="mailto:cehoyos@ag.or.at" target="_blank">cehoyos@ag.or.at</a>> wrote:</div>
<br><blockquote type="cite">Brad O'Hearne <brado@...> writes:<br><br><blockquote type="cite">"Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range <br>(luma=[0,255] chroma=[1,255]). baseAddr points to a <br>
big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct."<br><br>My code (heavily abridged for brevity) hits these high points: <br><br>NOTE: frameBufferAddress is a CVImageBufferRef received <br>from the QT capture callback: <br>
<br> int returnVal = avpicture_fill((AVPicture*)avFrame, <br>frameBufferBaseAddress, PIX_FMT_YUV420P, width, height);<br></blockquote><br>Could "biplanar" point to AV_PIX_FMT_NV12?<br>(Or something else that is not AV_PIX_FMT_YUV420P)<br>
<br>Carl Eugen<br><br>_______________________________________________<br>Libav-user mailing list<br><a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br><a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br>