Advertisement

AVI's

Started by October 27, 1999 08:00 AM
5 comments, last by GameDev.net 25 years, 2 months ago
You want the best way? This is what commerical games like
like Starcraft use. You asked for it:

Smacker.

http://www.radgametools.com/smkmain.htm


But, if you searched the web, you have a couple of options:
(sorry I don't have any links available)

A file called avidd95.exe from microsoft that only works
with 8-bit DD images. Description: "Direct Draw Example
for 320x240 and smaller AVI".

Get the multimedia win32sdk (the ones with the audio and
video directories) from microsoft and convert the AVI examples
to DirectX.

Look for the files called ClassAVIPlayer.zip and avisurface.zip.
These are programs written by individuals for AVI and DirectX
on the web. Used to be on this site I think.

This is one way to do it for any 16-bit screen:

1. Store your AVI as 16-bit *uncompressed* frames. This way
you don't need to use any codec to decode the frames, and you
can directly blit the image to the screen. The price you pay
is large files. If the images are bitmap, save them as upside-
up instead of upside-down so you don't have to do any additional
flipping while blitting your frames.

2. Q: How do you save your AVIs as uncompressed 16-bit, upside-up
bitmaps?
A: Either write out the AVIs yourself or find a program to do
it for you.

3. Save your AVI with small dimensions, and then blit stretch each
frame to the screen, if you want to reduce the size of your files.

Q: How do you blt stretch DD surfaces?
A: If it is not supported, you need to write it yourself.

If you have problems getting the example AVI programs (mentioned above)
to work, is probably because they call a codec decompressor to handle
the frames, and your computer doesn't know how to handle it. That's why
I say forget codecs and save your AVI with uncompressed frames.

4. Do you even need AVIs for animation? No, you don't. Just create
a single bitmap with animation cells, load them into DD surfaces,
and blit them to the screen one at a time.

Advertisement
What you want is DirectShow, it's part of the DirectMedia 6.0 SDK

You can check out the documentation at: http://www.microsoft.com/directx/dxm/

More specific to your question: http://www.microsoft.com/directx/dxm/help/ds/AppDev/Play_Movie_from_C++.htm

It can play mpg,avi and even mp3 files. Best of all its a no brainer to add to any program.


"You know you're obsessed with computer graphics when you're outside and you look up at the trees and think, "Wow! That's spectacular resolution!""

WELL. I HAVE AN ARTICLE THAT THEY HAVEN'T POSTED HERE YET, called "Working With AVI Files". It's on my website:

Dream Design

Now this article was written with Microsoft's original AVIFile interface in mind. That's the easiest and fastest interface to decompress video and audio sequences. I have two sample codes showing the rendering into DirectDraw, and a complete royalty-free wrapper class.

I would recommend DirectShow if you intend to synchronize game animation over video (although one of my samples does that anyway), or if you have high quality movies and require the fastest frame rates. The AVIFile interface is an excellent alternative to use while you're learning DirectShow (which has a higher learning curve).

Email darrennix@msn.com anytime.

I just want to add that the whole point of using AVIs is to take
advantage of compressed animation. The reason why I recommended
using uncompressed images is that it will guarantee you it will
work on any machine. I don't really like the idea of using
uncompressed AVI images, but I feel like I am forced to use them.

So, my question is, how would you handle this if you wanted to use
*compressed* AVI images? I understand that codec decompressors are
stored as DLL files in your window's system directory. Is it
legal to redistribute these DLLs with your game and install them
yourself to insure compatibility? If not, it sounds like the only
way to have compressed AVI images and insure compatibility is to
come up with your very own codec decompressor. And I don't like
using DirectShow either.

Reaver

What's the best way to play AVI's.. I've
seen this question been asked before, but
with no answer.. I want to show a logo
before I go into the game.. It needs to
be full screen though.. The logo right now
is 640x480, which is fine for going into
DirectX.. What's the best way to do this?
Advertisement
If you want to garentee handling a specific AVI compression format supply the codec filter.

How to know what file supports what filter, and how to register it? I know how to hand files with the exstension .ax but the standard ones are handled differently.

But what I do know is if you use an Intel Indeo compression format then just supply the Intel Indeo installation which I beleave to be freely distrabutable. Where to get it is a different matter.

As for the the easyest way to code the video into an application especially to a Direct Draw surface and Direct Sound buffer use Direct Show's multimedia streaming archtecture. If you don't beleave me take a look at the tiny examples at: http://www.microsoft.com/directx/dxm/help/ds/mms/Sample_Code_mms.htm

82 lines for a complete application that plays a video to the primary surface!

Phill

This topic is closed to new replies.

Advertisement