You are on page 1of 3

1

H264 Profiles in CTS 1.7(4)


Posted by gogasca Sep 1, 2011

H.264 Profiles are discussed in depth in the web, but I will focus in the profile-level-id as we can get information for resolution which is the most common request for most of the users. http://en.wikipedia.org/wiki/H.264#Levels Profile level ID string is divided into 3 substrings, each 2 characters long: [PROFILE IDC][PROFILE IOP][LEVEL IDC] Each substring represents one byte in base16! So, if Profile IDC is 28, that means it is actually 40 in base10. Later you will use base10 values to construct AVC Decoder Configuration Record RFC 3984 defines this (page 38). http://tools.ietf.org/html/rfc3984 "If the profile-level-id parameter is used for capability exchange or session setup procedure, it indicates the profile that the codec supports and the highest level supported for the signaled profile. The profile-iop byte indicates whether the codec has additional limitations whereby only the common subset of the algorithmic features and limitations of the profiles signaled with the profile-iop byte and of the profile indicated by profile_idc is supported by the codec. Profile-iop byte is composed of the values of constraint_set0_flag, constraint_set1_flag, constraint_set2_flag, constraint_set3_flag, and reserved_zero_4bits in bit-significance order, starting from the most significant bit. A level to which the bitstream conforms shall be indicated by the syntax elements level_idc and constraint_set3_flag as follows: If level_idc is equal to 11 and constraint_set3_flag is equal to 1, the indicated level is level 1b. Otherwise (level_idc is not equal to 11 or constraint_set3_flag is not equal to 1), level_idc shall be set equal to a value of ten times the level number specified in Table A-1 and constraint_set3_flag shall be set equal to 0. For example, if a codec supports only the common subset of the coding tools of the Baseline profile and the Main profile at level 2.1 and below, the profile-level-id becomes 42E015, in which 42 stands for the Baseline profile, E0 indicates that only the common subset for all profiles is supported, and 15 indicates level 2.1." How does the 15 convert to level 2.1? Page 298 of the ITU spec for H.264 documents how to convert this hex value into a level. This means to covert the last byte you convert the hex to decimal and divide it by 10. 0x15 = decimal 21 = level 2.1 Level limits for each are documented at table A-1 of the H.264 ITU spec linked below. http://www.itu.int/rec/T-REC-H.264/en Real life example: In our Cisco CTS system 1.7.4 we support interoperability with other Cisco endpoints or devices. Please check URL below for further information about which devices are tested. http://www.cisco.com/en/US/docs/telepresence/interop/interop_1_7_4.html#wp108777 In this example we are experiencing a problem calling from Cisco CTS system to a third party Video solution. In this case there is no Video display in Cisco CTS system. We collected packet captures and SIP logs from Cisco CTS and this is what we found:

From packet capture: Call from Cisco CTS 1.7.4 to BJN Call flow: Cisco CTS --> CUCM -- SIP --> VCS -- H323 --> VCS-E --H323 --> BJN Problem: No Video in CTS From CTS to Remote end: By analyzing SIP SDP message: Media Attribute (a): fmtp:97 profile-level-id=42001F;packetization-mode=0;max-mbps=108000;max-fs=3600;max-br=4000 Media Attribute (a): imageattr:97 send [x=1280,y=720,q=0.6] [x=640,y=368] [x=352,y=288] recv [x=1280,y=720,q=0.6] [x=768,y=488] [x=640,y=368] [x=352,y=288] [x=352,y=240]

From Remote end to CTS: Media Attribute (a): fmtp:96 profile-level-id=428016;max-mbps=108500;max-fs=3840;max-smbps=108500 From CTS: profile-level-id=42 00 1F From BJN: profile-level-id=42 80 16 [PROFILE IDC] CTS: 42 = 66 BJN: 42 = 66 Each substring represents one byte in base16! So, if Profile IDC is 42, that means it is actually 66 in base10. (66=baseline, 77=main, 100=high) [PROFILE IOP] CTS: 0000 0000 = 00 BJN: 1000 0000 = 80 If bit 7 (the most significant bit), bit 6, or bit 5 of profile-iop is equal to 1, all constraints of the Baseline profile, the Main profile, or the Extended profile, respectively, are obeyed in the NAL unit stream. [LEVEL IDC] CTS: 1F = 31 = 3.1 = 720480@80.0 (13) 720576@66.7 (11) 1280720@30.0 (5) BJN: 16 = 22 = 2.2 = 352480@30.7(10) 352576@25.6 (7) 720480@15.0 (6) 720576@12.5 (5) As seen before, resolution coming from remote end does not match what CTS is expecting, no video displayed.

Background
When dialing between Endpoints, video quality may vary if SIP Proxy server or CallAgent removes fmtp parameters (For example Asterisk 1.8 chan_sip.c does not include fmtp support) this can affect video quality. Per RFC. "If no profile-level-id is present, the Baseline Profile without additional constraints at Level 1 MUST be implied" RFC 3984 defines this (page 38). "If the profile-level-id parameter is used for capability exchange or session setup procedure, it indicates the profile that the codec supports and the highest level supported for the signaled profile. The profile-iop byte indicates whether the codec has additional limitations whereby only the common subset of the algorithmic features and limitations of the profiles signaled with the profile-iop byte and of the profile indicated by profile_idc is supported by the codec. profile-iop byte is composed of the values of constraint_set0_flag, constraint_set1_flag, constraint_set2_flag, constraint_set3_flag, and reserved_zero_4bits in bit-significance order, starting from the most significant bit. For example, if a codec supports only the common subset of the coding tools of the Baseline profile and the Main profile at level 2.1 and below, the profile-level-id becomes 42E015, in which 42 stands for the Baseline profile, E0 indicates that only the common subset for all profiles is supported, and 15 indicates level 2.1." The question is how does the 15 convert to level 2.1? Page 298 of the ITU spec for H.264 documents how to convert this hex value into a level. A level to which the bitstream conforms shall be indicated by the syntax elements level_idc and constraint_set3_flag as follows. If level_idc is equal to 11 and constraint_set3_flag is equal to 1, the indicated level is level 1b. Otherwise (level_idc is not equal to 11 or constraint_set3_flag is not equal to 1), level_idc shall be set equal to a value of ten times the level number specified in Table A-1 and constraint_set3_flag shall be set equal to 0. This means to covert the last byte you convert the hex to decimal and divide it by 10. 0x15 = decimal 21 = level 2.1 Level limits for each are documented at http://rob.opendot.cl/index.php/useful-stuff/h264-profiles-and-levels/. You can also look at table A-1 of the H.264 ITU spec linked below. http://www.itu.int/rec/T-REC-H.264/en

Internally CUCM converts these to H.241 levels. This mapping is in the ITU-T H.241 table 8-4. http://www.itu.int/rec/T-REC-H.241/en (thanks to Ryan to document this section)

Example
From packet capture above for CTS: 4d0028 H.264 Profiles are discussed in depth in the web, but we will focus in the profile-level-id as we can get information for resolution which is the most common request for most of the users http://en.wikipedia.org/wiki/H.264#Levels Profile level ID string is divided into 3 substrings, each 2 characters long: [PROFILE IDC][PROFILE IOP][LEVEL IDC] [PROFILE IDC] Each substring represents one byte in base16! So, if Profile IDC is 4d, that means it is actually 77 in base10. (66=baseline, 77=main, 100=high), this case we are using main profile. [PROFILE IOP] 00 [LEVEL IDC] 40 This substring matches profile 4.0 as explained above 1,280720@68.3 (9) 1,9201,080@30.1 (4) 2,0481,024@30.0 (4) This can help troubleshooting bad video quality or no video when multiple devices are in the middle (B2B call)

You might also like