PDA

View Full Version : all-around avi repair utility?


pdx
14th January 2003, 15:22
hiya all,

i think i'm not alone in the need for a rock-solid, all-around AVI repair utility. alas, i can't code one (i'm a php programmer), but i do certainly know what [i]i[/] would need in one. :D


parse for stream errors (unreadable audio/video frames)
reindex file
perform frame decimation if requested
perform FPS-setting-based sync correction (a la virtualdub, calculating a correct FPS to match the audio stream length) if requested


now i know that there are utilities that, separately, could provide this functionality, but most of them are fixed only to divx3-4 codecs. this utility should be configurable and extendable (i'm thinking of .dll-based modules for each codec it would support).

how i think this would work?

configurable

.dlls for divx3, divx4/5, xvid video codecs initially (xvid repair support is sorely missing these days), mp3 (lame), ac3 audio codecs.

stream error detection and correction

the utility should go through the whole stream, trying to decompress each and every audio and video chunks, frame by frame. when it encounters an illegal frame in either au or vdo, it would insert a "blank" or a "mute" frame into the stream (a P frame with no macroblock changes, or a mute audio frame). thus reindexing is needed, but the utility would build an index fresh and new, anyway.

frame decimation

when requested, the utility could change the number of frames by decimation. the most useful application of this would be performing a semi-ivtc (the 29.97 fps videos which are obviously 24 fps movies (and as such, should be using 23.97) play rather crippled (jittery)), based on the algorithm:

if the drop-frame is a keyframe then the next/previous frame is dropped instead (therefore a buffer is needed)
you could set a percentage-based decision algorithm so that if a drop-frame would have too much change when compared with the previous frame (P frames, that is), then the previous frame is dropped, and the drop-frame is kept instead.
if the next to the one that would be dropped-frame has a stream error, then the drop-frame is kept and the bad frame is dropped.


now, anybody feeling good vibes about this? ;) is there someone who would code it?

alexnoe
16th January 2003, 06:20
Re-index an AVI file is an ugly job :(

pdx
16th January 2003, 16:58
yes, it is, but there are programs out there that already do it (namely, divfix, for one). there are programs that try to correct stream errors in avi files (avifix or what is its name). the point would be to join these separate utilities into one.

one huge problem with them being separated is: you need to reindex a file which has stream errors -- reindexing is likely to fail. you need to fix stream errors in a file that has a corrupt index -- fixation will (probably) fail. now, if a program could do these two, equally important fixation steps in one pass, this would simplify some cases, and solve others (which could not be solved separately). the framerate decimation would only be the icing on the cake -- virtualdub can do it, but only on files which do not have stream errors, and ivtc without reencoding (which is a mess, reencoding, that is) is impossible.

but correct me if i'm wrong. ;)

alexnoe
16th January 2003, 19:17
=> fixing a stream if the index is OK is easy. Rebuilding the index if the stream is OK is not too hard either, except for rekeying (this would be the ugly part).

But fixing both if both index and stream are broken, that's something completely different and can never be reliable. It would always be based upon (slow) guessing at the broken points.

I'm trying to cope with as many different kinds of broken data as possible in AVI-Mux GUI, but a broken index is not yet among them.
A broken stream, if the index information is accurate, should be read.

esby
28th January 2003, 00:28
Honestly i don't think this kind of tool could be really useful.

If you got a broken avi,
that means there was an error somewhere...

If you just want to fix the avi to watch, it's ok.
But if you think in terms of distro, conservation of original data,
it's bad.
Cause there is no way you can rebuilt the file at his original state
in most of the time.
All you can is fixing the avi not repairing it completely.

If you got to download one broken avi, try to have a zidrav patch for it... it will repair the avi(and any type of data btw).

Thus, this may be a good idea.

esby

PS: Something interresting should be to adapte zidrav to avi structure, to allow patching frames (including corrupted one),
and repairing avi structure with an original file.

redeemer-dk
1st February 2003, 23:12
Virtual dub can both rebuild the index chunk and re-key the stream... Just run it, and in the "Open video file..." dialog, check the "Popup extended open options". and when you open it, check "Re-derive keyframe flags". that should do it.

Belgabor
3rd February 2003, 01:12
Yep, but iirc that will fail if the videostream has errors.