|
.
Copyright 2000, 2009 Alexander Milukov, All rights reserved
Unauthorized publishing, translation or reproduction in any form is prohibited.
Need a permission ?
contact the author
Using AVIedit to Repair DivX avi files
Currently the avi files compressed with DivX codec are very
popular due to extremely high compression ratio provided by
it. Also, the Internet becomes the main distribution channel
for these files after the writable CD-ROMs. Unfortunately, both these
media do not guarantee you the error-free deliver of the content.
With ideal conditions, you never got the failure playing
the DivX files. But often you could see a "frozen"
player applications at the middle of the movie.
Why did it stop ?
Most likely it detects a frame that can not be decoded due
to errors in its "body". This can be a result of write
error while the CD was created, or the same effect could have a
single lost or damaged data packet when you downloaded a movie
using a browser.
In general, my repair technique can be used with a success
not only with the DivX compressed movies, rather any other avi's.
I will not discuss here how to repair partially downloaded movies.
In short, you need to cut off the piece of video where the freeze
occurs, compress it again using DivX (more precise, using the same video
codec as the source file) and paste it back to movie.
Experienced PC users can stop reading here because I just said what
you should do with your broken movie. If you can't figure out how
to perform all the things, read the rest of article... Before we continue,
I must explain you some technical terms. Look at the pictures below.
Assume we have such a movie (the bug
moves on the grass). It is important for us, the frames contain a
constant area, that remains unchanged, and the small area that is updated
frame-by-frame. Literally we must separate the movie to the background
and the bug to
see how a video codec works.
![Use context menu to see the full image](scheme1.gif)
All the video codecs can be divided by two families. First group of codecs
does not use matching adjacent frames and compresses full each frame
separately. For example any MJPEG (Motion-JPEG) codec,
ELSA Quick Codec, WaveMotion codec and some others belong to this group.
Second group (at least, all MPEG codecs) compares the frames and saves
only the difference between them. Obviously the difference of two
frames is smaller than an entire frame, so this way DivX and other
similar codecs achieve the high compression ratio.
At the picture above you see the full frames (topmost line) and the
compressed frames (bottom line). Sometimes you see the frames that
are compressed as "full" ones. Any video codec needs to
insert these from time to time because the error of frames match tends
to grow (accumulate) over the time.
The fully compressed frames are often called key frames, while the
differences between frames called deltas. For example, the
1, 5, 9, 13 are keyframes, but 2, 3, 4, 6, 7, 8 etc. are deltas.
Key frames are much bigger than "difference" frames,
so DivX or MS MPEG4 codec places only one key frame per each 4..10 seconds
of video, or about
1:150 rate. Some old codecs like Indeo or Cinepak do not like such a high
interval between key frames and use 1:4 to 1:25 ratio instead.
In other words, avi file is stored not as the set of entire compressed frames,
instead only the difference from a previous frame is stored for each frame.
This is why the compression ratio is so good.
But, when you cut off some frames of broken video, there is no chance
for the codec to re-build dependent frames that ran before and
after that edit point. This causes the "no recompression" save
option to disappear and you will be unable to preserve the original
video quality. So, you will need to learn deleting the piece of video without
offending the codec.
There is a trick. You could try to cut off only the "difference"
frames, or so-called delta frames. Start AVIedit, load the file and
hit K (key)
button. The small K or D appears under the frames.
When you find such a
sequence KDDD...DDDK you need to cut off all D's but leave KK. The saving
without recompression should be possible. For DivX or MPEG4 it is not
easy to find next key frame :(
When you press K key, frames that are "keyed" are highlighted
with blue. This makes it much easier to find keys when you zoom out the movie,
to get many frames on-screen at the same time. To jump from and to keyframes
you can use SHIFT-arrow keys (left moves you to previous keyframe, right
moves you to next one).
So, assume you have found the frame that "freezes" the player
and also you know where are two key frames before and after the broken frame.
We will split the movie into three parts, one before the fault, one including
the fault, and one past the fault. Each time you need just to delete
the parts you do not need, and save the result using "no recompression"
option. With the second piece of video, containing the broken frame itself, you
should use DivX to compress it, not the "no recompression".
Now you have three avi files and need to join these back to a single
movie. Start AVIedit, load 3rd movie and select all streams. Open an explorer
window, drag second movie from it and drop to the AVIedit window. Select all streams
again and drag-n-drop the first part. Use Save As option to write the
result to a new [fixed] file. Use "no recompression" here.
If you still can not see how it works, look at this graph:
Now you see it, don't you ? If still not, are you sure you have a computer ? :-)
|
Copyright 2000, 2009 AM Software
|