THIS DOCUMENT IS IN THE PUBLIC DOMAIN, YOU ARE FREE TO COPY AND MODIFY IT AS YOU SEE FIT BETA DOCUMENTATNION OF RIFF-AVI FILE FORMAT -- DO NOT TRUST FOR ACCURACY -- DOESN'T COVER OPENDML EXTENTIONS YOU HAVE BEEN WARNED Tree view of RIFF data chunks(ie. map of subchunks). LIST chunk will be added in next revision(the documentation I based this on didn't cover LIST chunks, oddly enough): RIFF RIFF HEADER |-AVI AVI CHUNK |-hdrl MAIN AVI HEADER | |-avih AVI HEADER | |-strl STREAM LIST[One per stream] | | |-strh STREAM HEADER[Requiered after above] | | |-strf STREAM FORAMT | | |-strd OPTIONAL -- STREAM DATA | | |-strn OPTIONAL -- STREAM NAME |-movi MOVIE DATA | |-rec RECORD DATA[SEE BELOW] | |-[data subchunks] RAW DATA[SEE BELOW] |-idx1 AVI INDEX |-[index data] DATA DATA Map(ie sequential listing of all the data contained in the various chunks): "RIFF" dwChunkSize; - Chunk Size in Bytes "AVI " dwAVIChunkSize; - AVI chunk size "LIST" dwLIST1ChunkSize; - LIST chunk size "hdrl" "avih" dwMicroSecPerFrame; - Specifies the number of microseconds between frames. This value indicates the overall timing for the file. dwMaxBytesPerSec; - Specifies the approximate maximum data rate of the file. This value indicates the number of bytes per second the system must handle to present an AVI sequence as specified by the other parameters contained in the main header and stream header chunks. dwReserved1; - set to 0, reserved dwFlags; - [Bit 4 - Has index(idx1), Bit 5 - Use index to determine how to read the AVI data, rather than the physical order of the chunks with the RIFF file, Bit 8 - AVI file is interleaved, Bit 16 - AVI file is optimized for live video capture, Bit 17 - AVI file contains copyrighted data] dwTotalFrames; - Total number of frames dwInitialFrames; - Specifies the initial frame for interleaved files. Noninterleaved files should specify zero. If you are creating interleaved files, specify the number of frames in the file prior to the initial frame of the AVI sequence in this member. For more information about the contents of this member, see "Special Information for Interleaved Files" in the Video for Windows Programmer's Guide. dwStreams; - Specifies the number of streams in the file. For example, a file with audio and video has two streams. dwSuggestedBufferSize; - Specifies the suggested buffer size for reading the file. Generally, this size should be large enough to contain the largest chunk in the file. If set to zero, or if it is too small, the playback software will have to reallocate memory during playback, which will reduce performance. For an interleaved file, the buffer size should be large enough to read an entire record, and not just a chunk. dwWidth; - Specifies the width of the AVI file in pixels. dwHeight; - Specifies the height of the AVI file in pixels. dwReserved[4]; - Reserved, set this array to 0 "LIST" dwLISTChunkSize; - size of second LIST chunk "strl" "strh" dwstrhSize; - size of strh fccType; - FourCC code for type of data contained in this stream - 'auds' = audio stream, 'mids' = MIDI stream, 'txts' = Text stream, 'vids' = Video sterm fccHandler; - FourCC of codec to use, for PVDTools this should be "DIB " or "Y8 " or "Y800" or "GREY" and eventually "Y4 " dwFlags; - Ignore, too little documentation wPriority; - Ignore wLanguage; - Ignore dwInitialFrames; - "How far audio data is skewed ahead of video frames in interleaved file." dwScale; - "Used with dwRate(see below) to specify the time scale that this stream will use." Divide dwRate by dwScale to get frame rate/sample rate dwRate; - See dwScale dwStart; - "Specifies starting time for this stream." Usually 0. dwLength; - Length of stream in units specified by dwRate and dwScale dwSuggestedBufferSize; - Ignore dwQualty; - Ignore dwSampleSize; - Sample size, zero if varies - same a nBlockAlign in WAVEFORAMTEX rcFrame; - RECT structure(struct of 4 shorts), ignore "strf" - same format as BITMAPINFO [strf stuff] "LIST dwLISTSize3; - Size of 3rd List chunk "strl" "strh" size of strh "auds" above strh format [typically a "JUNK" chunk goes here wehn using VirtualDub 1.5.xx or higher] "LIST" size of 4th LIST chunk(DWORD) "01xx" -- ignore the xx, it's useless[the 01 stands for second stream identified in header] [audio data] "00xx" -- ignore the xx, it's useless[the 00 stands for first stream identified in header] [video data] [rinse, repeat the 01xx and 00xx chunks as needed] "idx1" size of idx1 chunk chunkId flags offset of chunk size of chunk [rinse, repeat for each chunk of data] "JUNK" [blank info]
转载于:https://www.cnblogs.com/ManMonth/archive/2010/02/26/1674013.html