AVIIndexGenerator ================= Usage ----- AVIIndexGenerator [movie.avi] [index.txt] [movie.avi] = file to parse [index.txt] = file to save the output Output ------ fr_nr fr_idx fr_type1 fr_type2 fr_addr fr_size 00000000 00136C2E 62773130 00000010 0000280C 00002ECE 00000000 00136C3E 63643030 00000010 000056E2 000005BE 00000001 00136C4E 62773130 00000010 00005CA8 000003E7 00000001 00136C5E 63643030 00000000 00006098 00000000 ... fr_nr = frame number fr_idx = byte offset of frame in index fr_type1 = 62643x3y -> video 63643x3y -> video 62773x3y -> audio yx indicates the stream number fr_type2 = 00 -> delta frame 10 -> key frame (all audio frames are 10) fr_addr = byte offset of frame (absolute address) fr_size = frame size in bytes ------------------------------------------------------------------------ AVI File ======== AVI Data -------- structure at fr_addr offset consists of (2*4 + fr_size) bytes DWORD fr_type1 DWORD fr_size BYTE fr_data[fr_size] = actual frame data AVI Index --------- structure at fr_idx offset consists of (4*4) bytes DWORD fr_type1 DWORD fr_type2 DWORD fr_addr (usually relative address) DWORD fr_size <- patch this ------------------------------------------------------------------------ Pseudo Patch ============ To create a pseudo patch you only have to set fr_size of the corrupt frame in the AVI Index to 0. You should not alter fr_size in the AVI Data since this would create an invalid AVI structure (e.g. VirtualDub will no longer read the entire file). When fr_type1 and fr_size in the AVI Data are corrupt you should even restore them. The correct values can be extracted from the AVI Index. If you want, you can replace the corrupt fr_data with zeroes. ------------------------------------------------------------------------ Notes ===== 1) When looking at a corrupt movie in VirtualDub, all delta frames after a bad frame are reported corrupt until a new key frame is encountered. This does not mean all these frames are actually corrupt. They cannot be decoded because they are based on the bad frame. However, when you patch the first corrupt frame they will use the last displayed frame as reference and can be decoded if they are not corrupt themselves. So if you patch the first corrupt frame, try to play the movie again. If it still freezes, patch the next one. And so on... If the level of distortion is high and the next key frame is not far away, you may prefer to patch all frames anyway (introducing a skip instead of distortion). 2) DivFix will recreate the original index if you use it on a patched movie making it freeze again. ------------------------------------------------------------------------ About ===== E-mail: divx_repair@hotmail.com Site : DivX ;-) Repair Guide URL : http://www.geocities.com/divx_repair