Kurosu
15th January 2004, 12:51
aka Un120: mostly harmless
Link for information:
http://forum.doom9.org/showthread.php?threadid=68562
To illustrate the example from another post (http://forum.doom9.org/showthread.php?threadid=68562#post428565) in a not so far away thread, here (http://kurosu.inforezo.org/avs/Un120.zip) is an avisynth filter that will parse AVI filestream to determine dropped frames and output the other as a video clip.
Nota: it is almost unusable as is
However, I'm sure people will be as interested as I, if not more, to fix them <g>. Here's the list of the problems:
- last group of frames might not have a proper frame number (ie "360, 360" may be emitted while "360, 361" was expected)
- if the avi file has audio, it will fail
- only the debug part really is likely to work
- maybe others, but I haven't tested this filter for that
Drawbacks:
- will parse on every pass (haven't tested with long files, so it might not be overkill)
- very, very, very incompatable: I guess it will only read AVI 1.0 files
How it works:
1) On load
- read at offset 140 number of frames, and verify it has the right number
- search for string "movi00dc", which should mark the start of the first frame, then rewind a bit
- verify if string 00dc is there (=a frame)
- skip beyong 00dc, read int32 size, skip 'size rounded up to nearest even number' bytes
- repeat until end of file or sufficient frames were read
It produces with that a list of dropped frames and a proper lookup table. It can also write the timecode file for mkvmerge.
2) Outputting frames
The lookup table make it returns immediately the right frame
What now?
Proof of concept: source code is provided under the LGPL license, it needs fixing. I have only checked quickly the patterns, so it might be much more buggy than HeadlessCow method. For the adventurous user, a quick readme is included.
Anyway, I'm waiting for any reply to see if it is worth supporting, fixing and releasing new versions of it. <g>
In addition, a tool like VirtualDub_Mod could have an option to parse the AVI file it's fed. In case the output file is detected as matroska:
- if direct streamcopy is used, only outputs to the mkv the non-dropped frames, and appropriately set the timestamps.
- otherwise, feed the coder with only the non-dropped frames, and act as described above
- for display, a request to a dropped frame would result in fact in displaying the previous non-dropped frame, bypassing any processing if the video is played by increments of 1 frame at a time.
Various corrections and ideas if anyone cares
Link for information:
http://forum.doom9.org/showthread.php?threadid=68562
To illustrate the example from another post (http://forum.doom9.org/showthread.php?threadid=68562#post428565) in a not so far away thread, here (http://kurosu.inforezo.org/avs/Un120.zip) is an avisynth filter that will parse AVI filestream to determine dropped frames and output the other as a video clip.
Nota: it is almost unusable as is
However, I'm sure people will be as interested as I, if not more, to fix them <g>. Here's the list of the problems:
- last group of frames might not have a proper frame number (ie "360, 360" may be emitted while "360, 361" was expected)
- if the avi file has audio, it will fail
- only the debug part really is likely to work
- maybe others, but I haven't tested this filter for that
Drawbacks:
- will parse on every pass (haven't tested with long files, so it might not be overkill)
- very, very, very incompatable: I guess it will only read AVI 1.0 files
How it works:
1) On load
- read at offset 140 number of frames, and verify it has the right number
- search for string "movi00dc", which should mark the start of the first frame, then rewind a bit
- verify if string 00dc is there (=a frame)
- skip beyong 00dc, read int32 size, skip 'size rounded up to nearest even number' bytes
- repeat until end of file or sufficient frames were read
It produces with that a list of dropped frames and a proper lookup table. It can also write the timecode file for mkvmerge.
2) Outputting frames
The lookup table make it returns immediately the right frame
What now?
Proof of concept: source code is provided under the LGPL license, it needs fixing. I have only checked quickly the patterns, so it might be much more buggy than HeadlessCow method. For the adventurous user, a quick readme is included.
Anyway, I'm waiting for any reply to see if it is worth supporting, fixing and releasing new versions of it. <g>
In addition, a tool like VirtualDub_Mod could have an option to parse the AVI file it's fed. In case the output file is detected as matroska:
- if direct streamcopy is used, only outputs to the mkv the non-dropped frames, and appropriately set the timestamps.
- otherwise, feed the coder with only the non-dropped frames, and act as described above
- for display, a request to a dropped frame would result in fact in displaying the previous non-dropped frame, bypassing any processing if the video is played by increments of 1 frame at a time.
Various corrections and ideas if anyone cares