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.
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).
"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.
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.
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
Cisco CTS --> CUCM -- SIP --> VCS -- H323 --> VCS-E --H323 --> BJN
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
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)
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.
CTS: 1F = 31 = 3.1 = 720×email@example.com (13) 720×firstname.lastname@example.org (11) 1280×email@example.com (5)
BJN: 16 = 22 = 2.2 = 352×firstname.lastname@example.org(10) 352×email@example.com (7) 720×firstname.lastname@example.org (6) 720×email@example.com (5)
As seen before, resolution coming from remote end does not match what CTS is expecting, no video displayed.