Thank you for your help but It still doesn't work, It cannot pass the sws_scale function.

buffer = (uint8_t *)av_malloc(sizeBuffer);
avpicture_fill((AVPicture*)&pFrameRGB,buffer, PIX_FMT_RGB24,pCodecCtx->width,
                                   pCodecCtx->height);



On 8/2/2010 8:14 AM, avcoder wrote:
On Mon, Aug 2, 2010 at 2:38 AM, Hoang Ong<[email protected]>  wrote:
  Hi Experts,

I'm try to extract frames from mp4 video. I got the frame that I want to do
the output, but I get stuck when I convert frame to PIX_FMT_RGB24 image
type. My code is :

//store formated frame
AVFrame *pFrameRGB;
                    pFrameRGB=avcodec_alloc_frame();


                    SwsContext* convert_ctx;
                    convert_ctx = sws_getContext( pCodecCtx->width,
                                                  pCodecCtx->height,
                                                  pCodecCtx->pix_fmt,
                                                  pCodecCtx->width,
                                                  pCodecCtx->height,
                                                  PIX_FMT_RGB24,
                                                  SWS_BILINEAR, NULL, NULL,
NULL);
                    if (convert_ctx == NULL)
                    {
                        cout<<  "Cannot init scale context!\n";
                        return;
                    }

                    uint8_t *buffer;
                    int sizeBuffer =
avpicture_get_size(PIX_FMT_RGB24,pCodecCtx->width,
                                                        pCodecCtx->height);
                    buffer = new uint8_t[sizeBuffer];
memory alignment is required!
try use av_malloc()/av_free()




_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to