Discussion:
AVI file format
(too old to reply)
lallous
2006-10-02 14:30:16 UTC
Permalink
Hello

I am reading about the AVI file format and have some question, if someone
can help please.

The AVI header shows two streams, and the 'movi' indeed has a set of
"cktypeDIBcompressed" and "cktypeWAVEbytes" chunks.

What I don't understand is how the audio and pictures are related and
synchronized.

In the sample AVI I have, in the "movi" there is one "cktypeWAVEbytes" every
35 or 36 "cktypeDIBcompressed" chunks.

What's the relationship?

Here's the AVI main header dump:

struct LISTHEADER list[0]
char id[4] LIST Ch 4h
uint32 datalen 8850 10h
char type[4] hdrl 14h 4h
struct avihHEADER avhi
char id[4] avih 18h 4h
uint32 datalen 56 1Ch
struct MainAVIHeader data
DWORD dwMicroSecPerFrame 40000
DWORD dwMaxBytesPerSec 0
DWORD dwReserved1 0 28h
DWORD dwFlags 272 2Ch
DWORD dwTotalFrames 6014
DWORD dwInitialFrames 0
DWORD dwStreams 2 38h
DWORD dwSuggestedBufferSize
DWORD dwWidth 720 40h
DWORD dwHeight 576 44h
DWORD dwScale 0 48h
DWORD dwRate 0 4Ch
DWORD dwStart 0 50h
DWORD dwLength 0 54h


The first stream dump (video):
struct LISTHEADER list[1]
char id[4] LIST 58h 4h
uint32 datalen 4244 5Ch
char type[4] strl 60h 4h
struct strhHEADER strh
char id[4] strh 64h 4h
uint32 datalen 56 68h
struct AVIStreamHeader data
char fccType[4] vids 6Ch
char fccHandler[4] XVID
DWORD dwFlags 0 74h
DWORD dwReserved1 0 78h
DWORD dwInitialFrames 0
DWORD dwScale 1 80h
DWORD dwRate 25 84h
DWORD dwStart 0 88h
DWORD dwLength 6014 8Ch
DWORD dwSuggestedBufferSize
DWORD dwQuality 4294967295
DWORD dwSampleSize 0
DWORD xdwQuality 0 9Ch
DWORD xdwSampleSize 37749456
struct strfHEADER_BIH strf
char id[4] strf A4h 4h
uint32 datalen 40 A8h
struct BITMAPINFOHEADER bmiHeader
uint32 biSize 40 ACh
uint32 biWidth 720 B0h
uint32 biHeight 576 B4h
uint16 biPlanes 1 B8h
uint16 biBitCount 12 BAh
uint32 biCompression 11456569
uint32 biSizeImage 2488320
uint32 biXPelsPerMeter 0
uint32 biYPelsPerMeter 0
uint32 biClrUsed 0 CCh
uint32 biClrImportant 0

And the second stream dump (audio):

struct LISTHEADER list[2] 10F4h
char id[4] LIST 10F4h 4h Fg:
uint32 datalen 4254 10F8h 4h
char type[4] strl 10FCh 4h Fg:
struct strhHEADER strh 1100h
char id[4] strh 1100h 4h Fg:
uint32 datalen 56 1104h 4h
struct AVIStreamHeader data 1108h
char fccType[4] auds 1108h 4h
char fccHandler[4] 110Ch
DWORD dwFlags 0 1110h 4h
DWORD dwReserved1 0 1114h 4h
DWORD dwInitialFrames 0 1118h
DWORD dwScale 3121 111Ch 4h
DWORD dwRate 16001 1120h 4h
DWORD dwStart 0 1124h 4h
DWORD dwLength 1232 1128h 4h
DWORD dwSuggestedBufferSize 21847
DWORD dwQuality 0 1130h 4h
DWORD dwSampleSize 3121 1134h
DWORD xdwQuality 0 1138h 4h
DWORD xdwSampleSize 0 113Ch
struct strfHEADER_WAVE strf 1140h
char id[4] strf 1140h 4h Fg:
uint32 datalen 50 1144h 4h
struct WAVEFORMATEX wave 1148h
WORD wFormatTag 353 1148h 2h
WORD nChannels 2 114Ah 2h
DWORD nSamplesPerSec 48000 114Ch
DWORD nAvgBytesPerSec 16001 1150h
WORD nBlockAlign 3121 1154h 2h
WORD wBitsPerSample 16 1156h
WORD cbSize 10 1158h 2h
char exData[32] 115Ah 20h

Please Advise.

--
Elias
The March Hare [MVP]
2006-10-02 14:53:38 UTC
Permalink
Post by lallous
I am reading about the AVI file format and have some question, if someone
can help please...
Why didn't you read a few posts in the newsgroups you posted to before
posting?

If you did, you would have found the posts in
microsoft.public.multimedia.directx.dshow.programming stating that the
newsgroup is no longer active. And in those posts, you would have found
the correct group for your post (which is not among the groups you
crossposted to).

Please do not crosspost.

See: http://tmhare.mvps.org/help.htm#cp

F'up set to: microsoft.public.multimedia.directx.dshow.programming

BTW, the basic AVI structure is documented in the dshow documentation.
Information about dshow can be found in the link below.
--
Please read this before replying:
1. Dshow & posting help: http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution
aaron gonzalez
2006-12-20 00:22:08 UTC
Permalink
mi nombre es aaron y me encanto su pelicula
Post by lallous
Hello
I am reading about the AVI file format and have some question, if someone
can help please.
The AVI header shows two streams, and the 'movi' indeed has a set of
"cktypeDIBcompressed" and "cktypeWAVEbytes" chunks.
What I don't understand is how the audio and pictures are related and
synchronized.
In the sample AVI I have, in the "movi" there is one "cktypeWAVEbytes" every
35 or 36 "cktypeDIBcompressed" chunks.
What's the relationship?
struct LISTHEADER list[0]
char id[4] LIST Ch 4h
uint32 datalen 8850 10h
char type[4] hdrl 14h 4h
struct avihHEADER avhi
char id[4] avih 18h 4h
uint32 datalen 56 1Ch
struct MainAVIHeader data
DWORD dwMicroSecPerFrame 40000
DWORD dwMaxBytesPerSec 0
DWORD dwReserved1 0 28h
DWORD dwFlags 272 2Ch
DWORD dwTotalFrames 6014
DWORD dwInitialFrames 0
DWORD dwStreams 2 38h
DWORD dwSuggestedBufferSize
DWORD dwWidth 720 40h
DWORD dwHeight 576 44h
DWORD dwScale 0 48h
DWORD dwRate 0 4Ch
DWORD dwStart 0 50h
DWORD dwLength 0 54h
struct LISTHEADER list[1]
char id[4] LIST 58h 4h
uint32 datalen 4244 5Ch
char type[4] strl 60h 4h
struct strhHEADER strh
char id[4] strh 64h 4h
uint32 datalen 56 68h
struct AVIStreamHeader data
char fccType[4] vids 6Ch
char fccHandler[4] XVID
DWORD dwFlags 0 74h
DWORD dwReserved1 0 78h
DWORD dwInitialFrames 0
DWORD dwScale 1 80h
DWORD dwRate 25 84h
DWORD dwStart 0 88h
DWORD dwLength 6014 8Ch
DWORD dwSuggestedBufferSize
DWORD dwQuality 4294967295
DWORD dwSampleSize 0
DWORD xdwQuality 0 9Ch
DWORD xdwSampleSize 37749456
struct strfHEADER_BIH strf
char id[4] strf A4h 4h
uint32 datalen 40 A8h
struct BITMAPINFOHEADER bmiHeader
uint32 biSize 40 ACh
uint32 biWidth 720 B0h
uint32 biHeight 576 B4h
uint16 biPlanes 1 B8h
uint16 biBitCount 12 BAh
uint32 biCompression 11456569
uint32 biSizeImage 2488320
uint32 biXPelsPerMeter 0
uint32 biYPelsPerMeter 0
uint32 biClrUsed 0 CCh
uint32 biClrImportant 0
struct LISTHEADER list[2] 10F4h
uint32 datalen 4254 10F8h 4h
struct strhHEADER strh 1100h
uint32 datalen 56 1104h 4h
struct AVIStreamHeader data 1108h
char fccType[4] auds 1108h 4h
char fccHandler[4] 110Ch
DWORD dwFlags 0 1110h 4h
DWORD dwReserved1 0 1114h 4h
DWORD dwInitialFrames 0 1118h
DWORD dwScale 3121 111Ch 4h
DWORD dwRate 16001 1120h 4h
DWORD dwStart 0 1124h 4h
DWORD dwLength 1232 1128h 4h
DWORD dwSuggestedBufferSize 21847
DWORD dwQuality 0 1130h 4h
DWORD dwSampleSize 3121 1134h
DWORD xdwQuality 0 1138h 4h
DWORD xdwSampleSize 0 113Ch
struct strfHEADER_WAVE strf 1140h
uint32 datalen 50 1144h 4h
struct WAVEFORMATEX wave 1148h
WORD wFormatTag 353 1148h 2h
WORD nChannels 2 114Ah 2h
DWORD nSamplesPerSec 48000 114Ch
DWORD nAvgBytesPerSec 16001 1150h
WORD nBlockAlign 3121 1154h 2h
WORD wBitsPerSample 16 1156h
WORD cbSize 10 1158h 2h
char exData[32] 115Ah 20h
Please Advise.
--
Elias
Loading...