Although codecid2 in FLV and most 3GP files use h263-based encoding, the two are still very different, so pay attention to it. There are three main differences. When decoding, you must note that the Video Encoding Based on h263 in the 3GP file is implemented according to the Public h263 technical White Paper, however, the h263 encoding in FLV has made some minor changes on the standard.
(1) different identification codes
H263 (3GP) is a 22-bit value, followed by 0x0020 is an 8-bit (temporal reference) Value
H263 (FLV) is a 17-bit value, followed by 0x0001 is a 5-bit format information value.
(2) Different Image Information Headers
H263 (3GP) refer to standard image Headers
The h263 (FLV) image information header includes the following information:
Picture type: 5 (image format information, mainly used to determine the escape coefficient processing method)
Picture number: 8 (image number)
Picture Code Type: 3 (image encoding information)
Obtain the image width and height based on different picture code types from the following table.
Value Image Width Image Height
0 width: 8 Height: 8
1 width: 16 Height: 16
2352288
3176144
412896
5320240
6160120
Frame Type: 2 (I frame or P frame)
Skip bit: 1 (not clear)
Quant: 5 (quantified value)
Pei: 1 (refer to the standard documentation)
(3) handling different escape codes in coefficient decoding Codes
The escape code processing method in h263 (3GP) is as follows:
Last: 1 (least is the last non-zero coefficient)
Run: 6 (number of the first 0 values)
Level: 8 (the amplitude of the coefficient. The highest bit is the symbol bit. If it is 0, level = level. If it is 1, level =-(256-level ))
H263 (FLV)
If the picture type is greater than 0
In this case, one more person must be judged.
Longescape: 1 (do not use long esacpe encoding)
Longesapce = 0
Last: 1 (least is the last non-zero coefficient)
Run: 6 (number of the first 0 values)
Level: 7 (magnitude of the coefficient. The highest bit is the symbol bit. If it is 0, level = level. If it is 1, level =-(128-level ))
Longesapce = 1
Last: 1 (least is the last non-zero coefficient)
Run: 6 (number of the first 0 values)
Level: 11 (magnitude of the coefficient. The highest bit is the symbol bit. If it is 0, level = level. If it is 1, level =-(2048-level ))
After this problem is handled, codec can be processed normally.
This article comes from the podcast http://xinsync.xju.edu.cn on the iceberg, the original address: http://xinsync.xju.edu.cn/index.php/archives/1168