Common media style illustrations
A typical ISO file
The ISO media file is composed of several data objects called boxes. The first of each box is the four bytes of data length (large order) and four bytes of type identification, the Data Length and type flag can be expanded. Some boxes have the container function, and their data fields are composed of several other boxes to implement structured data, which is similar to the riff format.
AVI file structure
Real file structure
MKV file structure
Header |
Meta seek information |
Segment information |
Track |
Chapters |
Clusters |
Cueing data |
Attachment |
Tagging |
|
Figure 1
MP3 file structure
FLV file structure
FLV is the Encapsulation Format of streaming media. We can regard its data as a binary byte stream. In general, FLV includes the file header and file body. The file body consists of a series of tag and tag size pairs. Therefore, a FLV file looks like the following structure:
ASF file structure
The ASF file is logically composed of three high-level objects: header object, data object, and index object )..
The header object is required and must be placed at the beginning of each ASF file. The data object is also required and is generally followed by the header object.
Index objects are optional, but are generally recommended.
High-level ASF file structure
ASF header object
Amr File Format
Amr frame format:
Amr has two types of frames: AMR if1 and Amr if2.
1. AMR if1:
Shows the frame format of if1:
2. AMR if2:
Shows the frame format of if2:
Compared with if1, if2 eliminates frame quality indicator, mode indication, mode request, and CRC verification. However, bit filling is added. Because the data length in an AMR frame is not an integer multiple of 8 bits, bit filling is required at the end of some frames to make the length of the entire frame an integer multiple of the bytes.
Storage Format of AMR files (RFC 3267 ):
Amr if1 and if2 define the AMR frame format for wireless transmission. RFC 3267 defines the file format for saving AMR data into a file.
The file format of AMR is shown in 1:
It contains a file header, and then a frame-by-frame AMR data.
1. File Header Format:
The AMR file supports single-channel and multi-channel. The file headers of a single channel and a multi-channel are different.
Single Channel:
AMR-NB file header :"#! Amr \ n "(or 0x2321414d520a in hexadecimal) (enclosed in quotation marks)
AMR-WB file header :"#! AMR-WB \ n "(or 0x2321414d522d57420a in hexadecimal). (enclosed in quotation marks)
Multi-channel:
The multi-channel file header contains a magic number and 32bit channle description domain.
Magic number of AMR-NB :"#! Amr_mc1.0 \ n "(or 0x2321414d525f4d43312e300a in hexadecimal ).
Magic number of AMR-WB :"#! AMR-WB_MC1.0 \ n "(or 0x2321414d522d571_f4d43312e300a in hexadecimal ).
The 32bit channel description domain is defined as follows:
The value of reserved bits must be 0. Chan: indicates the number of audio channels in the current file.
Frame Header Format:
The format of the frame header is 2. It occupies 1 byte (8 bits)
P is set to 0 for filling
FT is the encoding mode, that is, the encoding mode in 16 mentioned above.
Q is the frame quality indicator. If it is 0, the frame is damaged.
Figure 3 lists a frame format of AMR-NB 5.9kbit,
For a frame of 5.9kbit with 118bit data, 15*8 = 120 = 118 + 2, so there are two fill bits at the end.