I intend to make this a thread for discussing the parts of the AVI files that are understood & what is still to research / code / test.
I've been going over the internals of the AVI file wrt the video channel. I've taken 05D as example video to analyse the video codec.
The video has a palette at around 0xD0 to about 0x4D0. The colors don't match in my test bitmap so I'm not exactly sure. Each color has 4 bytes; the 4th of each is a 0-byte.
At 0x27D8 there's the first movie chunk, called 00db. It's length field (the next 4 bytes, little endian) indicate how long the video chunk will be, in this case 0xA910 bytes total. Then follow 5 4-byte indices that say where the chunk starts for a given 1/5th of the video frame. At the address indicated here is a small struct that contains the following. This is identical for all 5 of these blocks.
DWORD 4
DWORD 0xC02105
< 8652 bytes of image data, raw >
DWORD 0
Each block contains 36 lines of 240 pixels. You can copy/paste these to a paletted BMP file, apply the right bitmap and you'll see the plain image. I've tried this, it works.
The next frame is of type 00dc. This one is "compressed", which means at the very least it isn't just another raw image. The header is similar, it also contains 5 pointers to data. At the location indicated there's another thing though; instead of the 4... 0 struct outlined above there's a struct that contains modification data:
DWORD N
<N rounded up to the nearest multiple of 4 bytes>
These may also contain raw data afterward; haven't checked yet. In the example movie, the last block always seems to be very short; this might be because those 36 lines don't change or barely change.
<addendum>
You can also extract audio; it's 22050Hz mono 8-bit PCM data. Create a blank audio sample in the sound recorder and save it as such. Put each bit of audio chunk (01bw chunks) after the header and then add the bytecount you added to the values at addresses 0x4 and 0x36.
Anybody else want to venture a potshot at parts?
Kind regards,
Candy
I've been going over the internals of the AVI file wrt the video channel. I've taken 05D as example video to analyse the video codec.
The video has a palette at around 0xD0 to about 0x4D0. The colors don't match in my test bitmap so I'm not exactly sure. Each color has 4 bytes; the 4th of each is a 0-byte.
At 0x27D8 there's the first movie chunk, called 00db. It's length field (the next 4 bytes, little endian) indicate how long the video chunk will be, in this case 0xA910 bytes total. Then follow 5 4-byte indices that say where the chunk starts for a given 1/5th of the video frame. At the address indicated here is a small struct that contains the following. This is identical for all 5 of these blocks.
DWORD 4
DWORD 0xC02105
< 8652 bytes of image data, raw >
DWORD 0
Each block contains 36 lines of 240 pixels. You can copy/paste these to a paletted BMP file, apply the right bitmap and you'll see the plain image. I've tried this, it works.
The next frame is of type 00dc. This one is "compressed", which means at the very least it isn't just another raw image. The header is similar, it also contains 5 pointers to data. At the location indicated there's another thing though; instead of the 4... 0 struct outlined above there's a struct that contains modification data:
DWORD N
<N rounded up to the nearest multiple of 4 bytes>
These may also contain raw data afterward; haven't checked yet. In the example movie, the last block always seems to be very short; this might be because those 36 lines don't change or barely change.
<addendum>
You can also extract audio; it's 22050Hz mono 8-bit PCM data. Create a blank audio sample in the sound recorder and save it as such. Put each bit of audio chunk (01bw chunks) after the header and then add the bytecount you added to the values at addresses 0x4 and 0x36.
Anybody else want to venture a potshot at parts?
Kind regards,
Candy