How to check H264 / AVC ISO / IEC 14496-15 AVCDecoderConfigurationRecord?

Some historical past: I am currently working with Wowza and trying to decode AMFPackets that come from IMediaStream. Video packets will have a 5-byte header, and the first packet is the codec configuration.

Until now, when checking the configuration of the codec, the ISO / IEC 14496-15 AVCDecoderConfigurationRecord layout corresponded . However, I am having problems decoding SPS and PPS blocks.

Codec configuration package, including a 5-byte header:

17 00 00 00 00 01 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 is the title:

17 00 00 00 00

  • 17 = 10111 = H.264 K frame
  • 00 = 0 = codec configuration package
  • 000000 = 0 = start time 0

Next will be AVCDecoderConfigurationRecord (hex = decimal):

  • configurationVersion: 01 = 1
  • AVCProfileIndication: 4D = 77 (Main)
  • profile_compatibility: 00 = 0
  • AVCLevelIndication: 15 = 21 (2.1)
  • 6 bits reserved + length SizeMinusOne: 03 = 00000011 = 3 (4 bytes)
  • 3 bits reserved + numOfSequenceParameterSets: 01 = 0001 = 1
  • sequenceParameterSetLength: 002F = (47 bytes)
  • (47 bytes SPS record)
  • numOfPictureParameterSets: 01 = 1
  • pictureParameterSetLength: 0004 = (4 bytes)
  • (4-byte PPS record)
  • (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 the SPS type: (Using ITU-T H.264 06/2011 7.3.1 NAL Block Syntax )

  • First byte: 67 = 1100111
  • forbidden_zero_bit: 1 (Unfortunately, it is forbidden 0 bits are set to 1?)
  • nal_ref_idc: 2
  • nal_unit_type: 0111 = 7 (SPS)

Assume that the SPS payload is as follows: (Using ITU-T H.264 06/2011 7.3.2.1.1 Data Syntax of a Sequence Parameter Set )

  • profile_idc: 4D = 77 (Main, matches)
  • restrictions + 2 bits are reserved (equal to 0): 40 = 1,000,000 (looks great)
  • level_idc: 15 (2.1, consistent)

Assuming this is only SPS: (Using ITU-T H.264 06/2011 7.3.2.1.1 Data Syntax of a Sequence Parameter Set )

  • profile_idc: 67 = 103 (I think it should be 77, like AVCProfileIndication?)
  • restrictions + 2 bits are reserved (equal to 0): 4D = 1001101 (Uh oh, is the reserved bit set?)
  • level_idc: 77 (Shouldn't it be 21, like AVCLevelIndication?)

It looks like this is the old NAL block header + SPS record, and I doubt it is bad data, because each captured configuration packet is the same, but it discards me, why is the forbidden bit 0 set to 1?

thanks

+8
flash codec wowza
source share
1 answer

I found a problem ... looked too much at 1 and 0, and you miss one (pun intended).

67 4D 40 15 ...

Assuming this is a NAL block containing the SPS type: (Using ITU-T H.264 06/2011 7.3.1 NAL Block Syntax)

First byte: 67 = 1100111

This is wrong because 1100111 is only 7 bits. I did the conversion using MS Calculator, and it divided the number 0. The correct binary is 01100111 , and there is a forbidden zero bit.

Thanks to those who tried to resolve this issue.

+4
source share

All Articles