Wowza Community

AMFPacket Structure for AVC Keyframe

Hi,

I am currently trying to understand the Datastructure of AMFPacket for H264 Keyframes (i-Frame). The Stream is a livestream using the baseline profile. I used .getLastKeyFrame() to get a KeyFrame AMFPacket.

When I extract bytes using .getDataBuffer() I receive the following Bytes (in Hex):

17 01 00 00 00 00 00 00 02 09 
10 00 00 00 0F 06 00 01 C0 01
07 09 08 05 84 00 00 03 00 80 
00 00 19 5F 65 88 80 0C 00 15 
B0 A6 02 63 C0 04 0C 07 FA 2B 
FC 0E DE 41 17 82 AF F6 4C 3B 
F7 87 5E 31 04 C6 2F 7A 46 EC

Based on http://www.adobe.com/devnet/f4v.html (FLV and F4V File Format Specification) the first 5 Bytes tell me:

17 01 00 00 00

This is a Videodata packet with Frame Type 1 (Keyframe) and CodecID 7 (AVC).

The AVCPacketType is 1 (AVC NALU)

The CompositionTime is 0 (no offset)

According to spec these information are then followed by one or more AVC NALUs (with full frames). So they are not encoded as stated by ANNEX B (no 00 00 00 01 starting sequence) but following avcc. I know that I need the extradata for decoding an avc nalu (as it states the number of bytes used for encoding nalu length (I will extract this information and add it lateron)

By looking at the data, the length field has to be 4 (if smaller than the next NALU would be of length 0). So I would assume the first nalu is of length 2 Byte and contains:

09 10 which would be an AUD (Access Unit Delimiter) but I cant explain the 0x10.

Is this so far correct? I am still not sure where to find the keyframe itself.

Also the first 23 Bytes do not seem to change between keyframes which implies some kind of additional data.

17 01 00 00 00 00 00 00 02 09 
10 00 00 00 0F 06 00 01 C0 01 
07 09 08 

It would be very helpful if someone with a deeper understanding of the used container formats could shed some light on this topis.

Best Regards

Konni

NaluSizeLength = 4 Byte was correct (extracted from VideoCodecConfigPacket)

I think I got it now. There were 3 different NALUs inside the Keyframe Packet:

1st NALU:

Access unit delimiter

2nd NALU:

Supplemental enhancement information (SEI)

3rd NALU:

Coded slice of an IDR picture

Will try to decode the IDR picture now =)

Konni