AVI length

The application we’re working on right now loads the sound and video from an AVI file, synchs the video with the sound and sets the sound to loop. This works mostly fine, but we started to notice that the video loops prematurely, and truncates the last few seconds of the video. We retrieved the duration of the AudioSound with its length() method, and compared this with the duration of the video while running it in a media player. We found a discrepancy of up to 6(!) seconds, depending on the video we’d play. Looking around the references, we thought that this might be our problem (from MovieVideoCursor/MovieAudioCursor):

“Some AVI files have incorrect length values encoded into them - usually, they’re a second or two long or short. When playing such an AVI using the Movie class, you may see a slightly truncated video, or a slightly elongated video (padded with black frames). There are utilities out there to fix the length values in AVI files.”

So, can anyone offer us some advice on what to do? Is this why we’re losing the last few seconds of our video? Has anyone encountered this problem before? What are these utilities that have been used to fix AVI length values?

Thanks.

Could you send me a link to one of the bad AVI files? I’d like to analyze it.

Also - do you know what encoder was used to make the bad AVI file?

Finally - as for a utility to fix the length… all I know is that if you search the web for “avi fixer” or the like, there are literally dozens of them. Apparently, there are a lot of tools out there that make broken AVIs, and a lot of people who try to solve this problem.

As much as I would like to, I don’t believe I can (company policy). The video was encoded in MPEG-1. Thanks for the advice, I’ll go look up these AVI fixers.