[Libav-user] Converting mpg file to ARGB frames

Drabner drabner at zoobe.com
Thu Oct 13 09:11:48 CEST 2011

It seems I have found the reason for the weird behaviour.
It is this line:		

Instead of using ->data of the AVFrame*, you have to use ->data[0], at least
when using PIX_FMT_ARGB. data itself is only a pointer to four streams or
layers or whatever of picture data. And the linesize of AVFrame tells you
where to look for the data, it also points to four streams/layers.

Of course, you have to find this out on your own and waste a day with it.
Gotta love the clarity of the library if you've not studied video codecs ;)

However, I still have a problem of some sort...
The video is blue. As if the B value is always too high. It works well when
I fill every pixel of the picture like this:		
int videoSrc[640*360] = {0};
for (int i = 0; i < (640*360); i++)
   uint8_t* pixel =
   videoSrc[i] = D3DCOLOR_ARGB(pixel[0],
memcpy(   textureDest, videoSrc, 4*640*360);
Yeah I know, you could skip that last memcpy and fill textureDest directly
within the loop.
But anyway... Obviously, this goes kinda heavy on the performance compared
to just one simple memcpy.

If anyone has an idea what's going on there, I'd be grateful :)

View this message in context: http://libav-users.943685.n4.nabble.com/Converting-mpg-file-to-ARGB-frames-tp3894271p3900749.html
Sent from the libav-users mailing list archive at Nabble.com.

More information about the Libav-user mailing list