¶Sparse AVIs and AVI failure diagnosis
A couple of days ago I got an email asking what "sparse AVIs" were and how to fix one that wasn't playing properly. The person had converted his AVI to a .sparse file using the "Create Sparse AVI" option in VirtualDub's Tool menu, deleted the original AVI, then discovered that the new file did not open properly in any player or in VirtualDub itself, even after being converted back through the "expand sparse AVI" command. The answer, unfortunately, is that you cannot recover the original AVI from the .sparse file -- it cannot be played in any player. So what are they?
A .sparse file is an AVI file that has had its audio and video chunks emptied and the remaining data swizzled for better compression. The file only contains the header, index, and structure of the AVI file, but none of its payload. Expanding the .sparse file results in a .AVI file that is the same as the original except that all 00dc and 01wb chunks are zeroed. The result looks like an AVI file and can be parsed by any AVI parser, but it cannot be played back as there is no data to decode.
So what are .sparse files good for?
.sparse files are used to diagnose AVI compatibility issues. As an example, I recently exchanged emails with a fellow who was having trouble creating AVI files from scratch -- he thought his AVI file was correct, but VirtualDub threw errors during decoding and DirectShow refused to even open the file. The file he was working with was about 500MB, but the .sparse version was less than 20K compressed, and in addition, because the data chunks were deleted the result was free of proprietary data. That means he was able to send it to me via email so I could look at the AVI structure on my side. I was then easily able to determine that a couple of header values had garbage and the index had frame offsets pointing past the end of the file.
To reiterate, this means that .sparse files are utterly and totally useless for data transfer, and you should not try to use one to store video.
I should note that the vast majority of AVI compatibility problems do not need a .sparse file to diagnose. The most common issues are unfinished files due to program failure, missing or buggy codecs, corrupted files (usually by network transport), and non-AVIs named with the .AVI file extension. The resultant error messages are usually enough to figure out what is going on.