AVI媒体封装格式

本文介绍了AVI文件采用的RIFF格式,包括RIFF格式简介、文件结构以及AVI文件格式分析。AVI文件结构以"RIFF"节点为根,包含"LIST"节点和音视频帧数据。"movi"列表中的Leaf节点分别代表视频和音频帧,而"idx1"Leaf则存储帧索引。
摘要由CSDN通过智能技术生成

AVI文件采用标准的RIFF格式进行封装,在分析AVI文件格式之前我们先简单介绍RIFF格式。

1. RIFF格式简介

资源文件交换格式,Resource Interchange FileFormat(简称RIFF)。是一种按照标记区块存储数据(tagged chunks)的的通用文件存储格式,多用于存储音视频等多媒体数据。Microsoft在Windows下的AVI、ANI、WAV等都是基于RIFF格式的文件封装。

2. RIFF文件结构

RIFF文件结构是标准的树形结构,RIFF结构中包含两种节点:
(1) Leaf节点,该节点为叶子节点,不能包含子节点。
(2) Container节点,该节点可以包含Leaf节点。
Leaf节点的数据结构为:

typedef struct {
DWORD ID;           // 4字节,4个可打印ASCII字符,标识类型
DWORD Size;         // 4字节,数据块长度
BYTE  Data[Size];   // 数据块
}Leaf

Container节点的数据结构为:


                
Easiest way to install: Load the program group AviDemo.bpg, install the package AviPack.dpk(bpl), try the demos. Read the source of AviWriter_2.pas (in AviPack) to get help on what the procedures and properties do. **Current version: AviWriter_2 ver 1.0.0.4 Changes: Finally got On-the-fly compression working with still being able to add an audio-stream. Use property OnTheFlyCompression (default is true) Also, now more than one audio file can be added. For each wav-file a delay (ms) can be specified, which says when it'll start playing. Use method AddWaveFile. In 1.0.0.3 the delay got too short. Now it seems to work, due to really adding "silence" from the end of the previous audio file. Note: Some Codecs don't support On-the-fly compression. If OnTheFlyCompression is false, only one wave file can be added. **A list of codec-gotchas: (still unclear about the exact range of occurrance) IV50 Indeo Video 5: Both frame dimensions must be a factor of 4. DIVX DivX codec: Both frame dimensions must be a factor of 4. Gives a floating point error under certain circumstances. More and more likely that this occurs if the frames are too "different". If this happens, then there's an AV in Avifil32.dll, don't know how to prevent this. The codec compresses real movies nicely at frametimes <=60 ms, when changing the settings in its dialog box as follows: Bitrate (1st page): to >=1300 Max Keyframe interval (2nd page): to <=20. MRLE MS-RLE Use that one if you want to make avis which play transparently in a TAnimate. (Thanks Eddie Shipman) But it does not support on-the-fly compression. Whenever a codec fails to work, there's this dreaded error "A call to an operating system function failed" while writing a compressed file, or an unhandled exception. The only way to prevent it, that I see, is, to collect more peculiarities about the codecs and stop execution in case of certain combinations of settings. When queried about their capabilities, some of these guys seem to lie. Renate Schaaf renates@xmission.com
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值