[Libav-user] Reading packed BGR format

Lyndon Hill emptystate at yahoo.co.uk
Fri Aug 22 00:53:57 CEST 2014

Hi, I'm trying to read a simple AVI file with raw BGR. This codec is the default and sometimes referred to as "DIB".

I can open the file and decode frames of format AV_PIX_FMT_BGR24 but the problem is that I'm getting AVFrame.linesize[0] = -2160. I know this file is 720x480. Why the negative ?

AVFrame.data[0] certainly does not point to a frame of 2160 bytes.

If I use swscale() to convert to AV_PIX_FMT_RGB24 then it seems to handle the conversion fine.

None of this makes sense to me.

More information about the Libav-user mailing list