Click here to Skip to main content
15,945,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,
I have to read AVI file in Binary form, and extract frames from it in BMP. i am using c++ and must extract data from file by reading it in binary only. I have been able to understand the header but just cant figure out how to join various data to form an BMP file. In mp3 tag there was a whole jpeg file and was easy to extract. How to Extract an image from an avi is my real question w/o using libraries, i.e, doing it by reading the file in binary and finding/joining/arranging and then writing to a file to create an BMP file.

Thanks,
Your help is greatly appreciated.
Posted

Don't do it unless you have excellent reasons to.

AVI is not a single format, it can contain as many different encodings as there are "fourcc" codes. http://www.fourcc.org/codecs.php[^]

And none of these format can be decoded from scratch. For instance, writing a simple MPEG decoder is a matter of several weeks of work.

You'd better find an open source solution.

Another less costly option is to use the old "Video for Windows" API. It allows you to open any AVI file for display or image extraction. http://msdn.microsoft.com/en-us/library/dd757708(v=VS.85).aspx[^].

Among others, you should have a look at the function AVIStreamGetFrame.
 
Share this answer
 
v3
Comments
VinayChoudhary99 10-Aug-11 0:13am    
Thank you YvesDaoust,

The information was helpful.

But the AVIStreamGetFrame function is returning NULL and hence i cant extract image!
VinayChoudhary99 10-Aug-11 0:56am    
After installing Divx codec i am able to extract images from AVI file that are compressed by DIVX, but susprsingly MPEG-4 fails while it should be supplied along with windows media player!
If you really want to do that, you can use the GraphBuider to build a media render graph from the input file. To render the images to a bitmap you have to create a render pin and connect you as output to the render graph. so you can catch the media samples and render them to a bitmap. (sorry i havent a link at this time)
Regards.
 
Share this answer
 
Comments
YvesDaoust 10-Aug-11 2:42am    
I confirm that building a DirectShow graph is the alternative to VfW (now obsolete). There seems to be no easy way to learn DirectShow, though. Try this for an introduction: http://www.codeproject.com/KB/audio-video/DS_Player.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900