Thursday, May 27, 2010

CTS System - TelePresence SIP H264 profile-level-id

In a SIP SDP an H.264 video capability can sometimes appear such as this:

CTMS:

a=rtpmap:96 mpeg4-generic/48000
a=fmtp:96 profile-level-id=16;streamtype=5;mode=AAC-hbr;config=11B0;sizeLength=13;indexLength=3;indexDeltaLength=3;constantDuration=480
a=rtpmap:0 PCMU/8000
a=rtpmap:99 L16/48000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
m=video 16390 RTP/AVP 112
b=TIAS:4000000
a=rtpmap:112 H264/90000
a=fmtp:112 profile-level-id=ABCDEF;packetization-mode=1


CTS:

a=rtpmap:96 mpeg4-generic/48000
a=fmtp:96
profile-level-id=16;streamtype=5;mode=AAC-hbr;config=B98C00;sizeLength=1
3;indexLength=3;indexDeltaLength=3;constantDuration=480
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
m=video 28242 RTP/AVP 112
b=TIAS:4000000
a=rtpmap:112 H264/90000
a=fmtp:112
profile-level-id=4d0028;sprop-parameter-sets=R00AKAmWUgDwBDyA,SGE7iJyA;p
acketization-mode=1


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 codecsupports and the highest levelsupported 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. 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.

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 Ratliff for compiling information above

No comments:

Post a Comment