Carl, 

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  PIX_FMT_YUV420P in the 
following line of code: 

int returnVal = avpicture_fill((AVPicture*)avFrame, frameBufferBaseAddress, 
PIX_FMT_YUV420P, width, height);

then while it executes the avpicture_fill line successfully, the subsequent 
line of code 

returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, avFrame, 
&gotPacket);

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: 

...   
 int returnVal = avpicture_fill((AVPicture*)avFrame, frameBufferBaseAddress, 
PIX_FMT_NV21, width, height);
    
    if (returnVal < 0)
    {
        if (error)
        {
                NSLOG(@"Frame fill failed.");
        }
        
        return NO;
    }

    AVPacket avPacket;
    av_init_packet(&avPacket);
    avPacket.data = NULL;
    avPacket.size = 0;
    int gotPacket;
    
    returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, avFrame, 
&gotPacket);
...

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. 

Ideas? 

Brad

On Feb 4, 2013, at 4:55 PM, Carl Eugen Hoyos <[email protected]> wrote:

> Brad O'Hearne <brado@...> writes:
> 
>> "Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range 
>> (luma=[0,255] chroma=[1,255]). baseAddr points to a 
>> big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct."
>> 
>> My code (heavily abridged for brevity) hits these high points: 
>> 
>> NOTE: frameBufferAddress is a CVImageBufferRef received 
>> from the QT capture callback: 
>> 
>>     int returnVal = avpicture_fill((AVPicture*)avFrame, 
>> frameBufferBaseAddress, PIX_FMT_YUV420P, width, height);
> 
> Could "biplanar" point to AV_PIX_FMT_NV12?
> (Or something else that is not AV_PIX_FMT_YUV420P)
> 
> Carl Eugen
> 
> _______________________________________________
> Libav-user mailing list
> [email protected]
> http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to