Martin Samuelsson wrote:
> On Sun, 18 Mar 2007 08:38:08 +0100
> Andrea Giuliano <[EMAIL PROTECTED]> wrote:
> 
> 
> AVI files are files containing data contained in the RIFF container format 
> (which in turn is a ripoff of IFF, just with different endianness and chunk 
> naming authority).
> 
> Lavrec, or rather avilib, create a file with an empty RIFF header, which is 
> filled in when the file is closed. Why, I do not know, but that's the way 
> it's done. Thus, if lavrec crashes, there'll be a file without RIFF header, a 
> lot of RIFF data and no index chunk, as the index is written last, too.
> 
> http://en.wikipedia.org/wiki/RIFF gives some background, and 
> http://en.wikipedia.org/wiki/Audio_Video_Interleave gives a little more 
> in-depth information. 
> 
> http://msdn2.microsoft.com/en-us/library/ms779636.aspx (linked to fromn the 
> latter) explains the really gory parts of RIFF, and with this information, in 
> combination with head, cat, a good text editor and a certain amount of 
> creativity, you should be able to transplant a header from one of the working 
> files. With any luck, you should be able to feed this file to mencoder, using 
> -oac copy -ovc copy, and recreating the index with -forceindex, giving you a 
> working file.
> 
> I've done it once, but I'm not sure it was worth the effort.
> 
> /Sam

Many thanks for your hint! It was not easy, but at least I got to fix my 
last, corrupted AVI file. Completely!

Here is what I did:

a) dd bs=2048 count=1 if=good.avi of=good-header (to get a good RIFF 
header from another AVI output by lavrec)

b) dd bs=2048 skip=1 if=bad.avi of=bad-noheader.avi (to get a copy of 
the bad AVI file without the empty header)

c) cat good-header bad-noheader.avi > fixed.avi (to get a correct AVI 
file, still without index)

d) aviindex -i fixed.avi -o idx (to create an index file for fixed.avi)

e) avimerge -i fixed.avi -o perfect.avi -x idx (to create a copy of 
fixed.avi with the index from the idx file)

It took some time to tune the receipt, but it worked. I hope it works in 
general, but it should indeed, because the RIFF header really seems to 
be the same for every file produced by lavrec.

Best regards.

> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Mjpeg-users mailing list
> Mjpeg-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mjpeg-users


-- 
Andrea

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users

Reply via email to