Jump to content
  • Advertisement
Sign in to follow this  
Koobazaur

AVI files...

This topic is 5413 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I started working on something and I would really like to know how to read/play/write pure AVI files manually. What I mean by pure AVI, is one without any codecs just BMPs for each frame. And what I mean by manually, basically using an fstream variable to access the avi file and read/write to load/save it (in other words, I don't want to use MCI). I've found a tutorial about it here: http://www.wotsit.org/search.asp?s=animated But the description is... weird. What I mean is, I've never heard of LISTs or CHUNKS as the author often refers to in the article... Could someone guide me on a right track? Thanks...

Share this post


Link to post
Share on other sites
Advertisement
The AVI format conforms to the RIFF specifiction, you'll wont to look/search that up.

Also nehe has a tutorial on reading in and playing an AVI file to a textured quad in opengl here but they use C file I/O (shouldn't be diffcult to change to fstreams).

I'm guessing that an AVI file has a hierarchical structure in a form of a tree, conceptually you can imagine chunks representing the nodes of the tree and chunks can be composed of sub-chunks which are chunks in there own wright, you'll have a recursive function that will recursivally traverse the "conceptual tree" while reading in.

Share this post


Link to post
Share on other sites
I am just alittle curious why you would want to use uncompressed bitmap AVIs? Is it for video playing or some kind of container for multiple textures you are trying to do?

Cause I would imagine a ten second clip to be just horribly huge - 320x240 * 30 * 10 = 23MB+

Share this post


Link to post
Share on other sites
Quote:
Original post by pjcast
I am just alittle curious why you would want to use uncompressed bitmap AVIs? Is it for video playing or some kind of container for multiple textures you are trying to do?

Cause I would imagine a ten second clip to be just horribly huge - 320x240 * 30 * 10 = 23MB+


I just want to start small if you know what I mean.

Basically I want to be able to edit the AVI and to do that I need it in an uncompressed form. Once I figure out how to do all that, I'll look into decompressing different codecs...

Share this post


Link to post
Share on other sites
To edit easily you just need a compression format that is lossless (or very light lossy) that doesn't employ temporal compression (that is compression using the difference between frames). This is what DV is.

AVI is an old and archaic format that does not stream nor scale well (if at all). MPEG/DV program and transport streams (and similar designs, e.g. asf) are the modern formats primarily used today.

If you really want to work with avi, try writing some code using the Win32 API first. Look at the Windows Multimedia API, the mmioAscend, mmioCreateChunk, et. al. functions.

Share this post


Link to post
Share on other sites
If you are just going to make some sort of simple editor for videos. What you could do is, and I think premier works in a similiar mannor, allow a numbered series of image files (ie pic0.bmp, pic1.bmp, pic2.bmp, ect) and compose that into a small preview avi (low res/compression) - for quick previewing/playing.

And when you render the final piece, again use the image files to perform the edit action on and to make a more high res movie.

I think that reading from an avi, and doing the edit on that will give bad results because it is a) probably already compressed, and b) will have to be re-compressed to save back to the video file. That will result in some loss of quality.

Off course, it can be done, and is indeed done when your only source happens to be a movie file.

Anyway, I would suggest not even using AVI's. Instead, use Ogg Theora, an open source, completely free, and Linux/Win32 buildable codec. http://www.theora.org

If you become interested in Theora, visit my site http://www.wreckedgames.com, or the OGRE forums (www.ogre3d.org) for info/downloads for my Opensource Theora player plugin.

Share this post


Link to post
Share on other sites
Oh, and if you think you might want to use theora, you can also create directplay graphs for encoding, just check out there site (though I had some problems going that route).

Your choice might be even easier if you use ffmpeg, which allows encoding, decoding of many different formats (mpeg, divx, avi, mp3, ogg, etc). Something to think about when you get farther along though. You can even just use theora lib by itself, but you have to have yuv color space (RGB can be converted into that relatively easy).

Share this post


Link to post
Share on other sites
PJCaST, yeah I could just work on BMPs, but I want to be able to load movie files and end up with a movie file, not 10523 bmps...

thanks for the links though, I'll check them out.

Share this post


Link to post
Share on other sites
What I was trying to say was, bitmaps would be an intermediate file for creating a movie, along with whatever else you add to make a movie clip (video files, transistions, audio layers, etc)

Just a good way to maximize picture quality. Most movie creation software has the option to import a numbered series, and ost modeling software has the option to created a numbered series.

But, you could also just use a very low compression codec and work with that. But, I was just suggesting a combination.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!