[Matroska-devel] H264 Codec Private Data in header

Moritz Bunkus moritz at bunkus.org
Thu Apr 26 11:00:54 CEST 2012


Hey,

On Thu, Apr 26, 2012 at 10:19, Wilson Ko <W.K.H.Ko at student.tudelft.nl> wrote:

> I am from the Technical University of Delft. Currently I am working on a project which requires me to understand the MKV header of a H264 encoded file. In particular, I would like to know how this is encoded in the header file and where the packet size of the codec is specified, could you give me more information about this? It is really important for my project, so I hope to hear from you soon.

It's the same format also used in MP4 files: a six-byte header
followed by all SPS NALUs followed by all PPS NALUs. The header is
roughly this:

  buffer[0] = 1;
  buffer[1] = sps.profile_idc;
  buffer[2] = sps.profile_compat;
  buffer[3] = sps.level_idc;
  buffer[4] = 0xfc | (m_nalu_size_length - 1);
  buffer[5] = 0xe0 | m_sps_list.size();

What do you mean by "packet size"? The length of the size field for
each packet? If so that is stored in the fifth byte as mentioned
above.

Kind regards,
mo


More information about the Matroska-devel mailing list