What does the header struct for a webm (vp9) video stream look like?

In comparison to the IVF stream which contains 32 byte codec header and 12 byte frame header, what does a webm (vp9) stream header look like?

Is there a header struct definition that I can use in my code to parse the stream?

Please correct me - but based on readings online, I guess VP9 has no codec header and has both an uncompressed and a compressed frame header. Also the uncomp header would have the size of comp header and frame data?

But I'm not sure how to fetch this.

Basically what I'm trying to achieve is

  • Loop through the webm vp9 stream one frame at a time
  • Find the size of the header and send the compressed data to the decoder
  • Advance the pointer by the current frame size

In order to do this I'll need to know what is the size of the header and the compressed frame.


  • WebM is the same as Matroska, just with a more narrow list of codecs that are allowed to be used.

    Matroska is a schema specification for an EBML file.

    That is, if you want to parse WebM, you need to parse EBML. Then, you need to locate the elements you want for Matroska. Fortunately this is very well documented.

    You'll first want to inspect the Tracks element (0x1654AE6B) for information about codec, which you'll need to relay to your decoder.

    The Cluster element (0x1F43B675) is what will repeat over and over again in your WebM/Matroska stream, with chunks of data.

    I highly recommend checking out EBML Viewer. It's an ancient Java app but gets the job done for studying WebM and Matroska files. Just note that it doesn't work on streamed files because they have an indefinite Segment element size.

    And, of course, get cozy with your hex editor. It's not too bad once you start to recognize the element types!

    EBML Viewer