How to fix video corrupted by IDM?

patton

Member
Dec 31, 2011
80
1
I have a video downloaded from filesonic before the holocaust came. at that time filesonic seemed having trouble that i had to resume over and over through IDM. last night when i watchwd this movie there were some corrupt scenes. seeing from the hexdump i saw there's somekind of HTTP info, just like IDM's log..

this is the screenshot of first corrupt scene:
View attachment 557463

this is the screenshot of hex dump from first corrupt scene:
View attachment 557462


do you think this can be fixed?
 

Rollyco

Team Tomoe
Oct 4, 2007
3,556
34
Try creating an MKV with mkvmerge (part of MKVToolnix.) That should discard the bad parts of the video and leave you with a clean (albeit incomplete) video file.

Getting a 100% complete video file would probably require re-downloading the whole thing.
 

patton

Member
Dec 31, 2011
80
1
i have tried MKVToolnix before. it simply replace the corrupted part with 1 good frame before the corrupted part, resulting static frames. since the bandwidth is stil a "deluxe" thing for me, redownloading would be my last choice..
 

javhoarder

Consumer of Hard Disks
Sep 20, 2011
140
13
i have tried MKVToolnix before. it simply replace the corrupted part with 1 good frame before the corrupted part, resulting static frames

Unfortunately there isn't too much you can do in that situation.

A big part of modern video compression is discarding redundant data, where most frames reference data from the previous. This means that damage to one frame will usually damage subsequent frames until the next I-Frame.

What you could normally do is clip out a small part of the video along key frames with a tool like VirtualDub in "direct stream copy mode", but since your clip is only 26 seconds long, this won't be of too much help.
 

patton

Member
Dec 31, 2011
80
1
A big part of modern video compression is discarding redundant data, where most frames reference data from the previous. This means that damage to one frame will usually damage subsequent frames until the next I-Frame.

i was thinking like this (when making this thread):
every file format, including movie, has a header info which (maybe) describes a total bytes. let's say my movie has 1000 Bytes in total. because of those http headers (accidentally appended by IDM on every resuming), then the total bytes of my movie became 1100 Bytes. so, if this was the case, then maybe there's a way or video repair software which can detect those 100 bytes that are not the actual part of the movie, and it then can remove them while modifying the header back to 1000 bytes. does it make sense? or is it just a nonsense?

What you could normally do is clip out a small part of the video along key frames with a tool like VirtualDub in "direct stream copy mode", but since your clip is only 26 seconds long, this won't be of too much help.

so what could be the result if the corrupted part is long enough?
i'm not an expert in this field, but i also have tried VirtualDub (direct stream copy) and the result is no different..

****

please note that this movie is playable til the end..
 

javhoarder

Consumer of Hard Disks
Sep 20, 2011
140
13
let's say my movie has 1000 Bytes in total. because of those http headers (accidentally appended by IDM on every resuming), then the total bytes of my movie became 1100 Bytes. so, if this was the case,

I hadn't actually considered that the HTTP response may be additional data rather than having overwritten previous data. Try removing it with your hex editor and seeing if it improves.

so what could be the result if the corrupted part is long enough?
i'm not an expert in this field, but i also have tried VirtualDub (direct stream copy) and the result is no different..

What you need to do is hit the icons with the keys to seek along keyframes. Hit your "Insert" key on your keyboard at the keyframe before or at the beginning of the corruption. Hit the "end" key at the frame after or at the end of the corruption, then hit "Delete". This will remove the corrupted frames, so the output file is intact except for the removed parts.

then maybe there's a way or video repair software which can detect those 100 bytes that are not the actual part of the movie, and it then can remove them while modifying the header back to 1000 bytes. does it make sense? or is it just a nonsense?

Well, it looks like each chunk in an AVI contains the FourCC and length of the chunk (page 5).

This would be enough to manually go through it with a hex editor and, with some trial and error, remove arbitrarily inserted strings, but not enough for the process to be automated. That's also assuming that the data was inserted rather than overwriting the video stream.
 

patton

Member
Dec 31, 2011
80
1
What you need to do is hit the icons with the keys to seek along keyframes. Hit your "Insert" key on your keyboard at the keyframe before or at the beginning of the corruption. Hit the "end" key at the frame after or at the end of the corruption, then hit "Delete". This will remove the corrupted frames, so the output file is intact except for the removed parts.

so basicaly this way is to remove the corrupted parts completely out of the video.. this is definitely i don't want to be happened. but thanks anyway (for my future reference on how to remove unwanted part from avi using virtualdub..)

I hadn't actually considered that the HTTP response may be additional data rather than having overwritten previous data. Try removing it with your hex editor and seeing if it improves.

yes i also already tried it, but the result is worse. the first corrupted frames occured on 00:11:18 - 00:11:35. after i remove those HTTP Response then the movie only playable until 00:11:17

Well, it looks like each chunk in an AVI contains the FourCC and length of the chunk (page 5).

This would be enough to manually go through it with a hex editor and, with some trial and error, remove arbitrarily inserted strings, but not enough for the process to be automated.

thanks for the reference. it looks like C language in that pdf. although i don't understand C, perhaps there's something lead to "modifying header info" i was talking earlier..

That's also assuming that the data was inserted rather than overwriting the video stream.

i think i agree with this, and i'm afraid this is the case..
 

patton

Member
Dec 31, 2011
80
1
After more than 2 hours trying to understand the RIFF Tree from VirtualDub, trial and error of modifying the invalid chunks from hex editor..:study: .....................i gave up! :exhausted:

i choose to redownload the video, but not the whole one. i just redownloaded the first 200 MB and then replace the first 200 MB of the corrupted video with the new one, and the result is the full good video. the old trick i used to use :perfectplan:

*****

for anyone who wants to know how i've done it:
[hide]
  1. the whole video duration is 00:31:34 and the file size is 301 MB
  2. the last corrupted frames occured in 00:19:50 - 00:20:15
  3. i splitted the video to 00:20:20 using VirtualDub just to get the resulted file size. the splitted video has 197 MB file size, so i knew i had to get at least 200 MB of the good new one
  4. i redownloaded the video and when it reached 200 MB i stopped the download

now comes to the combining part:
  1. i splitted the old (corrupted) video to 200 MB using FFSJ, resulting 2 files: Ran Asakawa 2JX2a.avi.001 and Ran Asakawa 2JX2a.avi.002
  2. i did the same for the new downloaded file
  3. i moved the Ran Asakawa 2JX2a.avi.001 from the new downloaded file and the Ran Asakawa 2JX2a.avi.002 from the old file onto new folder and joined them using FFSJ
  4. the result is a new full good video
[/hide]

*****

this confirmed that the video stream indeed overwritten by the HTTP Response. the only question left in my head is how could this happen? the file is rar archive. IDM surely downloaded it as rar, but how then it could overwritten the file inside the archive? i don't think IDM extract it and overwritten the file intentionally every each resuming..:puzzled:

thank you for anyone reading and helping..