[FFmpeg-devel] AVFrame linesize and OpenGL GL_UNPACK_ROW_LENGTH

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

I've added a couple of clarifications below.

On 05/06/2013 09:45 PM, 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.

Here are the docs on GL_UNPACK_ROW_LENGTH

> AVFrame linesize is byte aligned on 32-byte boundary.  This means that for 
> bgr24 and similar pixel formats rows are usually not pixel aligned and AVFrame 
> data can not be used directly as an OpenGL texture.

If AVFrame data rows are not pixel aligned then data has to be copied row-by-row 
into an intermediate frame with compatible alignment.  It's wasteful and I would 
like to avoid this because it noticably hurts playback performance in my player.


More information about the ffmpeg-devel mailing list