I want to extract frames from a compressed AVI video file. I have used WIN32 Apis such as "AVIStreamGetFrameOpen" to extract frames from a uncompressed AVI video file.But for a compressed AVI video file the API "AVIStreamGetFrameOpen" returns NULL.Are there APIs to extract frames from a compressed AVI as well as uncompressed AVI file.
Hi, Ashwath. If you are allowed to use ffmpeg in your project then the solution code becomes trivial. Else you will need to check the documentation for the ICDecompress function. You are using the win32 apis to load your avi file, they are very slow and require you to use COM interfaces to decompress your files - these rely on installed codecs on your machine. Using ffmpeg gives you a solution which comes with its codecs built right into the library. Hope this helps.
Hi, it is possible to do this using both methods:, but it is easier using ffmpeg. I would recommend you Google ffmpeg and check their examples, you could accomplish your task in about 60 lines of code. Happy coding
Thanks for ur suggestion.I have two AVI files.One is compressed and the other is uncompressed.I want to extract the frames from both the AVI files.Will the FFMPEG library work for both compressed and uncompressed AVI files?
Hi Ashwath, the FFMPEG library will work for both files. As a side note, the library comes with pre built executables which you could use to immediately extract the frames you need, there are tons of articles online about how to do this - just download the library an programs from here and check their online documentation for the parameters you need to extract the frames.
Actually what i am doing is that i have created a MFC dialog based GUI.And i want to extract the frame buffer from the compressed AVI file by decompressing it first and then copying the buffer values to unsigned char array and display on a picture control as a bitmap image.And i want to extract all the files in the compressed AVI file in this way and display one by one on the picture control on the MFC GUI.
You can get an image from the avi stream using ffmpeg, into an av_picture structure, then use the libswscale functions to scale and convert the image into different resolutions or formats, and finally draw the buffer to a control on your mfc gui. You should really Google for code samples.