[Matroska-devel] libmatroska and H.264

Moritz Bunkus moritz at bunkus.org
Mon Jul 15 21:44:38 CEST 2013


H.264 in Matroska is stored the same way it's stored in MP4. Meaning
CodecPrivate contains what ISO/IEC 14496-15:2004 describes as the "AVC
decoder configuration record" in section

aligned(8) class AVCDecoderConfigurationRecord {
  unsigned int(8) configurationVersion = 1;
  unsigned int(8) AVCProfileIndication;
  unsigned int(8) profile_compatibility;
  unsigned int(8) AVCLevelIndication;
  bit(6) reserved = ‘111111’b;
  unsigned int(2) lengthSizeMinusOne;
  bit(3) reserved = ‘111’b;
  unsigned int(5) numOfSequenceParameterSets;
  for (i=0; i< numOfSequenceParameterSets; i++) {
    unsigned int(16) sequenceParameterSetLength ;
    bit(8*sequenceParameterSetLength) sequenceParameterSetNALUnit;
  unsigned int(8) numOfPictureParameterSets;
  for (i=0; i< numOfPictureParameterSets; i++) {
    unsigned int(16) pictureParameterSetLength;
    bit(8*pictureParameterSetLength) pictureParameterSetNALUnit;

> Can there be several frames in each SimpleBlock, and if so, is there
> spacing byte(s) between each frame?

Yes, if they're laced. In that case the SimpleBlock's structure tells
you how long each frame is. There's no stuffing between. However, this
is highly unusual for video tracks -- normally only audio frames are
laced due to the frame sizes. But it's not forbidden either.

Kind regards,

More information about the Matroska-devel mailing list