0

I'm using the H264 encoder from Media Foundation (MFT).
I extracted the SPS and PPS from it, because I need it for smooth streaming.
The MSDN says that the number of bytes used for the length field that appears before each NALU can be 1, 2, or 4. This is all in network byte order. As you can see, the first 4 bytes in the buffer are 0, 0, 0, 1. If we apply any of the possible lengths, we will get nothing. If the number of bytes used for length is 1, then the length is zero, if it is 2, the length is zero again. If it is 4, the length of first NALU is 1?! And, that's not correct.
Does anybody know how should I interpret this SPS and PPS concatenated together??

extracted SPS + PPS

1 Answer 1

5

The answer here is simple: the data is valid and formatted according to Annex B, prefixed by start codes 00 00 00 01 and not run length encoding.

H.264 extradata (partially) explained - for dummies

Annex B format

in this format, each NAL is preceeded by a four byte start code: 0x00 0x00 0x00 0x01 thus in order to know where a NAL start and where it stops, you would need to read each byte of the bitstream, looking for these start codes, which can be a pain if you need to convert between this format and the other format.

More details on H.264 spec - freely available for download. Page 326 starts with "Annex B - Byte stream format".

1
  • I know, I would need the h.264 specification, which I don't have :-( Aug 2, 2013 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.