[libav-api] Filling AVFrame with RGB24 sample data?

ashika umanga umanga.forums at gmail.com
Thu May 31 04:33:47 CEST 2012


sorry,this is the code snippet



AVFrame *targetFrame=.....
int height=imageHeight();
int width=imageWidth();


  for(y=0;y<encoder.getVideoParams().height ;y++){
       for(x=0;x< encoder.getVideoParams().width;x++){


   targetFrame->data[0][index][(y* width)+x]=(x%255); //R
   targetFrame->data[0][index][(y* width)+x+1]=0;     //G
   targetFrame->data[0][index][(y* width)+x+2]=0;     //B


  }
   }



On Thu, May 31, 2012 at 11:30 AM, ashika umanga <umanga.forums at gmail.com>wrote:

> Greetings all,
>
> I am trying to fill sample data for a AVFrame initialized with RGB24
> format.
> I use following code snippet to populate RGB data.
> But in the encoded video,I can only see grayscale strip covering only 1/3
> of the videoframe.
> This code snippet suppose to fill only Red color.
> Any tips what Im doing wrong here ?
>
>
>
>
> AVFrame *targetFrame=.....
> int height=imageHeight();
> int width=imageWidth();
>
>
>   for(y=0;y<encoder.getVideoParams().height ;y++){
>        for(x=0;x< encoder.getVideoParams().width;x++){
>
>
>    targetFrame->data0[index][(y* width)+x]=(x%255); //R
>    targetFrame->data0[index][(y* width)+x+1]=0;     //G
>    targetFrame->data0[index][(y* width)+x+2]=0;     //B
>
>
>   }
>    }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libav.org/pipermail/libav-api/attachments/20120531/1f4bb59c/attachment.html>


More information about the libav-api mailing list