[FFmpeg-user] Get frame info into an ALIGNED DATA ARRAY. :D

Stefano Sabatini stefano.sabatini-lala at poste.it
Wed Aug 10 00:46:37 CEST 2011


On date Tuesday 2011-08-09 14:53:48 -0700, ja0335 encoded:
> hii
> 
> My question is simple, how can i get the aligned data from an AvFrame?
> 
> the format needed is :
> 
> char* img_data = new char[pFrame->width*pFrame->height*4] = {
> RED, GREEN, BLUE, ALPHA,
> RED, GREEN, BLUE, ALPHA,
> RED, GREEN, BLUE, ALPHA, ......};
> 
> 
> I dont know how to extract the data in this format, please help me

You need to read from AVFrame.data[4] and .linesize[4], *the layout
depends on the pixel format used*.

Check libavutil/pixfmt.h, libavutil/pixdesc.h, and
libavutil/imgutils.h for more information about each pixel format
layout (and you can use libswscale for converting to the wanted
format).


More information about the ffmpeg-user mailing list