There are two things you can try in case you AVI/XVid is corrupted or truncated.
1) Run VirtualDub, tick
open under file tab, check
Pop up extended open options box before opening AVI. Then another dialog appears.
Enable
Re-Derive keyframe flags.
Click
open. Under video tab enable
Direct stream copy.
Hit F7 to save AVI again (different name).
Voil?•.
2) There's another tool to repair corrupted AVI files (mostly reindexing):
Link is this one:
http://divfix.maxeline.com/.