Some historic background: I'm currently working with Wowza and attempting to decode the AMFPackets that come from the IMediaStream. The video packets will have a 5-byte header and the first packet is the codec configuration.
So far in my inspecting the codec configuration matches the ISO/IEC 14496-15 AVCDecoderConfigurationRecord layout. However, I'm having trouble decoding the SPS and PPS units.
The codec config packet including the 5-byte header:
17 00 00 00 00 01 4D 00 15 03 01 00 2F 67 4D 40 15 96 52 02 83 F6 02 A1 00 00 03 00 01 00 00 03 00 28 E0 60 03 0D 40 00 49 3E 7F 18 E3 03 00 18 6A 00 02 49 F3 F8 C7 0E D0 B1 68 90 01 00 04 68 EB 73 52
Flash/Wowza-specific first is the header:
17 00 00 00 00
- 17 = 10111 = H.264 K frame
- 00 = 0 = codec config packet
- 000000 = 0 = start time 0
Next is the AVCDecoderConfigurationRecord (hex = decimal):
- configurationVersion: 01 = 1
- AVCProfileIndication: 4D = 77 (Main)
- profile_compatibility: 00 = 0
- AVCLevelIndication: 15 = 21 (2.1)
- 6 bits reserved + lengthSizeMinusOne: 03 = 00000011 = 3 (4 bytes)
- 3 bits reserved + numOfSequenceParameterSets: 01 = 0001 = 1
- sequenceParameterSetLength: 002F = (47 bytes)
- (SPS record 47 bytes long)
- numOfPictureParameterSets: 01 = 1
- pictureParameterSetLength: 0004 = (4 bytes)
- (PPS record 4 bytes long)
- (end)
SPS record (47 bytes):
67 4D 40 15 96 52 02 83 F6 02 A1 00 00 03 00 01 00 00 03 00 28 E0 60 03 0D 40 00 49 3E 7F 18 E3 03 00 18 6A 00 02 49 F3 F8 C7 0E D0 B1 68 90
Assuming this is a NAL unit containing SPS type: (Using ITU-T H.264 06/2011 7.3.1 NAL unit syntax)
- First byte: 67 = 1100111
- forbidden_zero_bit: 1 (Oops, forbidden 0 bit set to 1?)
- nal_ref_idc: 2
- nal_unit_type: 0111 = 7 (SPS)
Assuming the SPS payload follow: (Using ITU-T H.264 06/2011 7.3.2.1.1 Sequence parameter set data syntax)
- profile_idc: 4D = 77 (Main, matches)
- constraints + 2 bits reserved (equal to 0): 40 = 1000000 (Looks fine)
- level_idc: 15 (2.1, matches)
Assuming this is only a SPS: (Using ITU-T H.264 06/2011 7.3.2.1.1 Sequence parameter set data syntax)
- profile_idc: 67 = 103 (I think this should be 77 like AVCProfileIndication?)
- constraints + 2 bits reserved (equal to 0): 4D = 1001101 (Uh oh, reserved bit set?)
- level_idc: 77 (Shouldn't this be 21 like AVCLevelIndication?)
It looks like it's the former NAL unit header + SPS record, and I doubt it's bad data because every captured config packet is the same, but what throws me off is why is the forbidden 0 bit set to 1?
Thanks