[Ffmpeg-devel] YUV420 frames to windows bitmaps

François Revol revol
Wed May 3 22:16:44 CEST 2006

> Hello all:
> I'm trying to display H.264 video in win xp. For now i'd like to get 
> started
> by converting the frames into bitmaps and displaying the images. Does 
> anyone
> have some example code demonstrating this? Using the output_example 
> program
> and modifying it i was able to display images from a saved webcam 
> file. With
> the webcam stream i'm able to use the img_convert() api to get from
> PIX_FMT_BGR24(video stream format) to PIX_FMT_RGB24. From there i 
> create a
> BITMAPHEADERINFO structure and then display the image using vfw 
> (video for
> windows). This works however the image displays upside down? The 
> bitmap
> structure is below

Windows bitmaps are by default upside down (last row first).
There is a trick to tell it it's the other way (like negative height 
just ask google.

> One of the differences between the webcam file and the H.264 file is 
> that
> the frames of the H.264 file come in as PIX_FMT_YUV420P. I don't know 
> how to
> create a YUV420 bitmap that I can display in windows. What I do is 
> try to
> convert the image to RGB24 and then display the same way as the 
> webcam file,
> however this doesn't work. Can anyone point me in the right 
> direction? I

The P means Planar, that is Y, U and V data are in 3 different 
As in opposite to chunky.


And please fix your mail user agent, it's sending text in an different 
encoding than advertised.


More information about the ffmpeg-devel mailing list