[FFmpeg-devel] AVFrame linesize and OpenGL GL_UNPACK_ROW_LENGTH

Pavel Koshevoy pkoshevoy at gmail.com
Tue May 7 06:40:35 CEST 2013

On 05/06/2013 10:24 PM, Reimar Döffinger wrote:
> On Mon, May 06, 2013 at 09:45:57PM -0600, Pavel Koshevoy wrote:
>> Hi,
>> OpenGL requires that texture row stride must be pixel aligned,
>> because GL_UNPACK_ROW_LENGTH parameter is expressed in pixels, not
>> bytes.
> You need to re-read the specs.

The spec says that row length is the number of pixels.  It is really confusing 
when 1984/3=661.3333 -- is not a "whole" number of pixels.

> That does specify the number of pixels indeed, but there is an alignment
> step afterwards, which is specified via GL_UNPACK_ALIGNMENT (and
> defaults to 32 bit alignment btw., so it really should have worked
> for your "magically" unless you changed it in the first place).

Yes, I've set GL_UNPACK_ALIGNMENT to 1, don't remember why anymore. I've just 
removed my changes from  image_get_linesize and commented out 
GL_UNPACK_ALIGNMENT calls and it appears to be magically working.

Thank you,

More information about the ffmpeg-devel mailing list