Access each Pixel of AVFrame

2019-07-17 04:26发布

问题:

I need to access each pixel informations of an AVFrame object of FFMPEG ( If it's in RGB then each color, R and G and B of each Pixel )

How can I achieve that?

回答1:

If you have already advanced to the correct frame - something like:

img_convert_ctx = ffmpeg::sws_getCachedContext(img_convert_ctx,w, h, pCodecCtx->pix_fmt, w, h, ffmpeg::PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);

 ffmpeg::sws_scale(img_convert_ctx, pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);

 //Data is in pFrameRGB->data


标签: c++ ffmpeg