DivFix++ is FREE AVI Video Fix & Preview program.      



    For submit/view bug reports, feature requests, patch files and support requests, please follow this link.
   
   You can also create and update Translations. Please look at WiKi pages.



    DivFix++ initially checks for "AVI LIST" identifier. Because it couldn't convert a zip file to avi file of course :)
Than copy all headers to target file (to the "movi" chunk) and scan 00dc, 01wb and 00db chunks in avi file. It counts them and copies correct frames to target file sequentially. It also generates "index" table by this process. After reaching "idx1" chunk or end of file, it merges index table with target file. After this it adjust headers some variables and some chunks "size"s. If there are missing frames (of course there are missing frames if you use this program :) ) avi, stream and OpenDML headers frame counts will be corrupt (different than actual frame counts.) It makes errors/bugs at scanning avi file. They must be corrected. Movie size will shrink if you want to cut out bad parts from AVI. Because of this AVI size, "movi" chunk size and index part's location will be change. A program has to be adjust all of this variables...




        RIFF means "Resource Interchange File Format".
It has a basic structure. "ID,Size,Chunk"
This "chunk" could be recursive, means chunk could be a RIFF structure too.
This makes things little complex...

A standard AVI file is close to this format:

RIFF "size" AVI
    LIST "size"
        hdrl avih "size=56" ...
    LIST "size"
        strl strh "size" ...
             strf "size" ...
             JUNK "size" ...
    LIST "size"
        strl strh "size" ...
             strf "size" ...
             JUNK "size" ...
    LIST "size"
        odml dmlh "size" ...
    LIST "size" ...
        INFO ISFT "size" ...
        JUNK "size" ...
    LIST "size" movi
        01wb "size" ...
        00dc "size" ...
        00db "size" ...
        ....
        ....
        ....
    idx1 "size"
        01wb "key" "location" "size"
        00dc "key" "location" "size"
        00db "key" "location" "size"
    JUNK "size" ...

    avih means avi header, strh means stream header, dmlh means OpenDML header. This headers also keeps total frame numbers of it's data.
avih keeps total visual frame count, strh for video data keeps same number, OpenDML header too. But strh for audio keeps audio frame count...

... denotes there is data
"size" fields are 4 byte integer. Corresponds chunks size.
"key"  fields are to indicate that frame is key frame or not..
"location" fields are 4 byte relative location number. It's relative to "movi" chunk start.

    JUNK chunks are for give information about movie. They all ignored from avi players...
Last JUNK chunk is standing for complete avi file to "2048" byte and it's powers. This because for CD ROM can easily access file. (I don't know why engineers make it like this. It's totally crap but world is full of them... If you remove last chunk, your file has no injuries AFAIK...)

For fixing an avi file, you have to convert current source file to this structure.




This resources are useful for understand RIFF format

http://www.nomadelectronics.com/VidCap/capture%20using%20vfw/ODMLFF2.DOC
http://www.opennet.ru/docs/formats/avi.txt
http://tinyurl.com/8p7nm
http://www.wischik.com/lu/programmer/avi_utils.html
http://www.cs.cornell.edu/dali/api/avi-c.html
http://www.virtualdub.org/blog/pivot/entry.php?id=25
http://www.oreilly.com/www/centers/gff/formats/micriff/
http://www.saettler.com/RIFFMCI/riffmci.html
http://www.warpspeed.com.au/cgi-bin/inf2html.cmd?..%5Chtml%5Cbook%5CToolkt40%5CMMREF3.INF+2241
http://www.virtualsciencefair.org/2004/chia4a0/public_html/aviresearch.htm



Open Source Licensed The wxWidgets Cross-Compile API The Code::Blocks IDE Support This Project Get DivFix++ at SourceForge.net. Fast, secure and Free Open Source software downloads