Play AVI with sound

Does WindowsAPI support play AVI (frame bitmaps and sound)? If yes, which code that is used to play a AVI file (with sound)?

Help please...
No answer?
I tried that, but I couldn't find any code which is used to play a AVI file (with sound).

Currently I only can render AVI frame bitmaps by Windows API functions.

And sound? Nobody?
There is code there - but you need to be on Windows7 os.

(the code is the simpleplay sample which you can download or use from the Windows SDK).
You can play a wav file with PlaySound() API.
The Media Foundation SimplePlay sample guestgulkan mentions is one of a number of ways.

SimplePlay Sample (Windows)

But note that while the MFPlay API it uses only came in with Windows 7, it's already marked as deprecated. SimplePlay is, however, easier to follow that the latest, preferred (by Microsoft) approach which can be found here:

Media Session Playback Example

Another Media Foundation player, which works on Windows Vista and newer is this:

MFPlayer Sample (Windows)

But an alternative approach is to embed (or just launch) a player. e.g. the Window Media Player control or possibly VLC Player (I've only played with the latter.)

Your opening post doesn't specify how you want to play the AVI file?


PS The same set of documentation also explains the older DirectShow approach (about since the mid-90s, but which is still used by apps that need to support older versions of Windows) and, much deeper down, the ancient Video for Windows approach (which started off life in the Win16 days).
Last edited on
try this in visual studio 2010 express edition(free)
This plays only .wav files For all other types like .mp3 etc convert them to wav type
Use correct path to load the file.
Regards and blessings
And finally, there isn't any available code which can play an AVI file completely (sound???), right?
Or maybe IMO I have to divide an AVI file into two parts first : The first one is frame bitmaps (Keep the AVI extension) and the second one is sound data (mp3 is a good choice), then I'll use two different machines to play them?...
Currently I'm using Windows XP. But which is better? XP? Seven? Should I upgrade my old operating system version or not?...
Windows XP cannot play .avi files by default (well, I know AVI is just a container). You either use DirectShow API if you already have neccesary codecs installed (this is what Windows Media Player uses) or parse AVI files by yourself, using your own codecs.

Note that AVI container can contain mp3, ac3 or other sound formats, you need codecs for all of them.
Newer versions of Windows Media Player use Media Foundation as well as DirectShow. Which is used depends on which format you are playing and what codecs are available. (for Windows Vista and newer...)
Last edited on
Topic archived. No new replies allowed.