[Ffmpeg-devel] [PATCH] Fix for AVI files with odd sized 'movi' list

David Conrad davedc_
Wed Aug 30 21:12:35 CEST 2006


I've come across some old AVI files that have an odd size written for  
the movi list. This is arguably invalid since the list should be  
guaranteed to be even since it contains chunks padded to an even size  
(the files in question do have chunks padded to an even size, but the  
padding byte of the last chunk doesn't seem to be counted towards the  
movi size.) The only problem ffmpeg has with these files is that the  
index isn't found, but I think that the following fix is trivial and  
won't affect correctly muxed files.


Index: libavformat/avidec.c
--- libavformat/avidec.c        (revision 6132)
+++ libavformat/avidec.c        (working copy)
@@ -243,7 +243,7 @@
              if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
                  avi->movi_list = url_ftell(pb) - 4;
-                if(size) avi->movi_end = avi->movi_list + size;
+                if(size) avi->movi_end = avi->movi_list + size +  
(size & 1);
                  else     avi->movi_end = url_fsize(pb);
#ifdef DEBUG
                  printf("movi end=%Lx\n", avi->movi_end);

More information about the ffmpeg-devel mailing list