FredThompson
29th May 2003, 11:29
This is a note I've sent to the author of the Linux package dv_utils. You'll understand the ideas after reading it. I'll start with DV then move into other lossless codecs after the concept has been proven to work.
-- woohoo --
I am writing to ask for help with the AVI file format containing DV. I found your page by poking through links at the Linux DV site. It's obvious to me you understand the DV file formats. I'm writing to ask some very specific questions about it.
First off, please understand that I've programmed for around 15 years but the last time was 10 years ago. I use the Windoze platform and, when I must write something, one of the free BASIC compilers. That makes me sound like a simpleton. Not so, I've written critical-mission control software in Ada...
By way of background:
People generally think it is impossible to restore the proper frame information for a film which was formatted as 29.97 NTSC then deinterlaced and processed, either by some form of cleaning or compression. There are 3 "good" frames and 2 "bad" frames. The 2 "bad" frames contain elements of the proper single frame which would replace them in the film original.
You probably know that but I'm setting up the idea.
Dynapel (http://www.dynapel.com) makes a product called MotionPerfect. It has the ability to regenerate bad or corrupt frames by interpolating motion analysis of the surrounding frames.
My idea is this, process the "damaged" video file such that one of the "bad" frames of each block of 5 is removed. For windows users, this is very easily done with an AviSynth (http://www.avisynth.org) script. The resultant file is then saved.
At this point, we have an AVI file which consists of a sequence of 3 proper frames and 1 corrupt, repeating until the EOF. We need a way to signal MotionPerfect that the "bad" frame is corrupt. This is the part for which I'm asking help.
I assume there is a checksum associated with each frame of DV stored in an AVI file. (There must be something like this, MotionPerfect scans every frame and will report about the damaged ones.) So, a standalone program is used to move through this stored file and save intentionally corrupt checksums for the "bad" frames. (It should also force the film frame rate just as a precaution, too.)
When this intentionally-corrupted file is run through MotionPerfect, it will decide the "bad" frames are corrupt leaving a continual sequence of 3 original frames and a corrupt frame. MotionPerfect is then used to rebuild the corrupt frames using motion analysis of the remaining original film frames.
This is not a perfect solution, but it's pretty darn good.
This also does not address the audio portion which should be extracted from the original stream and re-sampled to fit the new frame rate.
This concept can be expanded. Extra frames could be inserted then intentionally corrupted to create gaps of varying width. When MotionPerfect is used to rebuild the "corrupt" frames, the effect would be controllable-rate slow motion. Intentional frame deletion and corruption with processing by MotionPerfect would create controllable-rate acceleration and fast motion. Individual frames could be specifically targeted for corruption/extrapolation. It's possible some form of temporal noise test with scene change detection could generate a list of candidates for replacement based on a threshold.
I have the Microsoft DV in AVI specification and your source code. I'm requesting some guidance on the structure of the contents of the AVI files. My assumption is there is some header information followed by frames with their support data. All I really care about is:
1) Location and length of the frame rate which is in the file header, somewhere. This will always be over-written with a proper 23.976 (or whatever it is, I don't remember right now.)
2) Location of the checksum for the first video frame
3) Offset to the checksum for the second video frame
I assume #2 and #3 could be used to step to the checksum of each successive frame, yes?
4) A known impossible checksum, if such a thing exists, and it's format. Restated, when I know the checksum location, what bytes need to be written to corrupt the frame?
I can create all the programs to do these operations in Windoze and will share the logic with you if you wish. What I don't know is how to find the information in your source code. I also don't know if you have an equivalent of MotionPerfect in the Linux community. If so, the capability I describe could be quite useful.
Will you help me with the information I need?
-- woohoo --
I am writing to ask for help with the AVI file format containing DV. I found your page by poking through links at the Linux DV site. It's obvious to me you understand the DV file formats. I'm writing to ask some very specific questions about it.
First off, please understand that I've programmed for around 15 years but the last time was 10 years ago. I use the Windoze platform and, when I must write something, one of the free BASIC compilers. That makes me sound like a simpleton. Not so, I've written critical-mission control software in Ada...
By way of background:
People generally think it is impossible to restore the proper frame information for a film which was formatted as 29.97 NTSC then deinterlaced and processed, either by some form of cleaning or compression. There are 3 "good" frames and 2 "bad" frames. The 2 "bad" frames contain elements of the proper single frame which would replace them in the film original.
You probably know that but I'm setting up the idea.
Dynapel (http://www.dynapel.com) makes a product called MotionPerfect. It has the ability to regenerate bad or corrupt frames by interpolating motion analysis of the surrounding frames.
My idea is this, process the "damaged" video file such that one of the "bad" frames of each block of 5 is removed. For windows users, this is very easily done with an AviSynth (http://www.avisynth.org) script. The resultant file is then saved.
At this point, we have an AVI file which consists of a sequence of 3 proper frames and 1 corrupt, repeating until the EOF. We need a way to signal MotionPerfect that the "bad" frame is corrupt. This is the part for which I'm asking help.
I assume there is a checksum associated with each frame of DV stored in an AVI file. (There must be something like this, MotionPerfect scans every frame and will report about the damaged ones.) So, a standalone program is used to move through this stored file and save intentionally corrupt checksums for the "bad" frames. (It should also force the film frame rate just as a precaution, too.)
When this intentionally-corrupted file is run through MotionPerfect, it will decide the "bad" frames are corrupt leaving a continual sequence of 3 original frames and a corrupt frame. MotionPerfect is then used to rebuild the corrupt frames using motion analysis of the remaining original film frames.
This is not a perfect solution, but it's pretty darn good.
This also does not address the audio portion which should be extracted from the original stream and re-sampled to fit the new frame rate.
This concept can be expanded. Extra frames could be inserted then intentionally corrupted to create gaps of varying width. When MotionPerfect is used to rebuild the "corrupt" frames, the effect would be controllable-rate slow motion. Intentional frame deletion and corruption with processing by MotionPerfect would create controllable-rate acceleration and fast motion. Individual frames could be specifically targeted for corruption/extrapolation. It's possible some form of temporal noise test with scene change detection could generate a list of candidates for replacement based on a threshold.
I have the Microsoft DV in AVI specification and your source code. I'm requesting some guidance on the structure of the contents of the AVI files. My assumption is there is some header information followed by frames with their support data. All I really care about is:
1) Location and length of the frame rate which is in the file header, somewhere. This will always be over-written with a proper 23.976 (or whatever it is, I don't remember right now.)
2) Location of the checksum for the first video frame
3) Offset to the checksum for the second video frame
I assume #2 and #3 could be used to step to the checksum of each successive frame, yes?
4) A known impossible checksum, if such a thing exists, and it's format. Restated, when I know the checksum location, what bytes need to be written to corrupt the frame?
I can create all the programs to do these operations in Windoze and will share the logic with you if you wish. What I don't know is how to find the information in your source code. I also don't know if you have an equivalent of MotionPerfect in the Linux community. If so, the capability I describe could be quite useful.
Will you help me with the information I need?