2016-08-05 62 views

回答

2

VP8有一個RFC,它解釋瞭如何檢測幀是否是關鍵幀。見第19.1節。

| Frame Tag           | Type | 
| ------------------------------------------------- | ----- | 
| frame_tag           | f(24) | 
| if (key_frame) {         |  | 
|  start_code         | f(24) | 
|  horizontal_size_code       | f(16) | 
|  vertical_size_code       | f(16) | 
| }             |  | 

The 3-byte frame tag can be parsed as follows: 

---- Begin code block -------------------------------------- 

unsigned char *c = pbi->source; 
unsigned int tmp; 

tmp = (c[2] << 16) | (c[1] << 8) | c[0]; 

key_frame = tmp & 0x1; 
version = (tmp >> 1) & 0x7; 
show_frame = (tmp >> 4) & 0x1; 
first_part_size = (tmp >> 5) & 0x7FFFF; 

---- End code block ----------------------------------------