比如分辨率: 1920*1080, 参考帧率: 60的h264码流是哪个level呢
H.264的宏块大小为16×16 in H.264,每帧宏块的个数为分辨率除以16
max-fs = ceil( width / 16.0 ) * ceil( height / 16.0 )
计算得:8100
每秒宏块数量为每帧宏块数乘以帧率.
max-mbps =max-fs*参考帧率
计算得:486000
参考ITU. p. 324. "Recommendation ITU-T H.264"表格:
Level | Max. decoding speed | Max. frame size | Max. video bit rate for video coding layer (VCL) kbit/s (Baseline, Extended and Main Profiles) | Examples for high resolution @ highest frame rate Toggle additional details | ||
---|---|---|---|---|---|---|
Luma samples/s | Macroblocks/s | Luma samples | Macroblocks | |||
1 | 380,160 | 1,485 | 25,344 | 99 | 64 | 128×96@30 176×144@15 |
1b | 380,160 | 1,485 | 25,344 | 99 | 128 | 128×96@30 176×144@15 |
1.1 | 768,000 | 3,000 | 101,376 | 396 | 192 | 128x96@60 |
1.2 | 1,536,000 | 6,000 | 101,376 | 396 | 384 | 128x96@120 |
1.3 | 3,041,280 | 11,880 | 101,376 | 396 | 768 | 128x96@172 |
2 | 3,041,280 | 11,880 | 101,376 | 396 | 2,000 | 128x96@172 |
2.1 | 5,068,800 | 19,800 | 202,752 | 792 | 4,000 | 176x144@172 |
2.2 | 5,184,000 | 20,250 | 414,720 | 1,620 | 4,000 | 176×144@172 |
3 | 10,368,000 | 40,500 | 414,720 | 1,620 | 10,000 | 176×144@172 |
3.1 | 27,648,000 | 108,000 | 921,600 | 3,600 | 14,000 | 352x288@172 |
3.2 | 55,296,000 | 216,000 | 1,310,720 | 5,120 | 20,000 | 640x480@172 |
4 | 62,914,560 | 245,760 | 2,097,152 | 8,192 | 20,000 | 720x480@172 |
4.1 | 62,914,560 | 245,760 | 2,097,152 | 8,192 | 50,000 | 720x480@172 |
4.2 | 133,693,440 | 522,240 | 2,228,224 | 8,704 | 50,000 | 720x576@172 |
5 | 150,994,944 | 589,824 | 5,652,480 | 22,080 | 135,000 | 1,024×768@172 |
5.1 | 251,658,240 | 983,040 | 9,437,184 | 36,864 | 240,000 | 1,280×720@172 |
5.2 | 530,841,600 | 2,073,600 | 9,437,184 | 36,864 | 240,000 | 1,920×1,080@172 |
6 | 1,069,547,520 | 4,177,920 | 35,651,584 | 139,264 | 240,000 | 2,048×1,536@300 |
6.1 | 2,139,095,040 | 8,355,840 | 35,651,584 | 139,264 | 480,000 | 2,048×1,536@300 |
6.2 | 4,278,190,080 | 16,711,680 | 36,651,584 | 139,264 | 800,000 | 4,096*2,304@300 8,192×4,320@120 |
根据每秒宏块数,来查对应表格.
Level 4.1
VBV maximum bit rate [1000bits/s] 50Mbit/s
Macroblocks/s 245760
Resolution and frame rate 1920×1088@30 or 2Kx1K@30
Level 4.2
VBV maximum bit rate [1000bits/s] 50Mbit/s
Macroblocks/s 522240
Resolution and frame rate 1920×1088@60 or or 2Kx1K@60
可见486000在Level 4.1和Level 4.2之间,所以Level是4.2, Level的确定原则是找<=的关系.