[Libav-user] Filling AVFrame with RGB24 sample data?

Bruce Wheaton bruce at spearmorgan.com
Thu May 31 07:13:43 CEST 2012


On May 30, 2012, at 8:02 PM, ashika umanga wrote:

> 
>   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
>    
>    
>   }
>    }
> 
You're drawing a greyscale image, that's why. I think you mean to be doing X =  X + 3, so you jump pixels. You're actually setting every single byte, then setting the next two bytes, then overwriting them.

I don't know about the pixel/byte layout of RGB24, by the way. But that mistake seems clear.

BRuce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120530/063a4263/attachment.html>


More information about the Libav-user mailing list