Re: Matroska file decoding - Question on seekhead

Dave Rice <[email protected]> Sun, 03 Sep 2017 11:55:45 -0400
Newsgroups gmane.comp.multimedia.matroska.user
Message-ID <[email protected]>
--===============6599720218870760519==
Content-type: multipart/alternative;
 boundary="Apple-Mail=_B38B91E0-DEF9-463C-B148-6AEFF38999C4"


--Apple-Mail=_B38B91E0-DEF9-463C-B148-6AEFF38999C4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hi Austin,

> On Sep 3, 2017, at 9:08 AM, Austin Einter <[email protected]> =
wrote:
>=20
> First of all a BIG THANKS to Matroska, for providing a open source =
media file container.=20
>=20
> I have a requirement, where I need to parse a matroska file. Initial =
few bytes of file is given as below.
>=20
> 0x1a 0x45 0xdf 0xa3 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x23 0x42 0x86 =
0x81 0x01
> 0x42 0xf7 0x81 0x01 0x42 0xf2 0x81 0x04 0x42 0xf3 0x81 0x08 0x42 0x82 =
0x88 0x6d
> 0x61 0x74 0x72 0x6f 0x73 0x6b 0x61 0x42 0x87 0x81 0x04 0x42 0x85 0x81 =
0x02 0x18
> 0x53 0x80 0x67 0x01 0x00 0x00 0x00 0x00 0x33 0xdb 0x10 0x11 0x4d 0x9b =
0x74 0x40
> 0x42 0xbf 0x84 0x11 0xac 0x83 0x8a 0x4d 0xbb 0x8b 0x53 0xab 0x84 0x15 =
0x49 0xa9
> 0x66 0x53 0xac 0x81 0xe5 0x4d 0xbb 0x8c 0x53 0xab 0x84 0x16 0x54 0xae =
0x6b 0x53
> 0xac 0x82 0x01 0x56 0x4d 0xbb 0x8c 0x53 0xab 0x84 0x12 0x54 0xc3 0x67 =
0x53 0xac
> 0x82 0x11 0x5c 0x4d 0xbb 0x8d 0x53 0xab 0x84 0x1c 0x53 0xbb 0x6b 0x53 =
0xac 0x83
> 0x33 0xd9 0x1c 0xec 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x94 0x00 0x00 =
0x00 0x00
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 =
0x00 0x00
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 =
0x00 0x00
>=20
> I am trying to parse this file. I have parsed first 59 bytes =
successfully. Now I am at 60th byte. =46rom 6th byte bytes are 0x11 0x4d =
0x9b 0x74, so it means seekhead is starting.=20
>=20
> I used mkvinfo to view parsed data. As per mkvinfo as shown below, =
seekhead starts at 59 which is fine. =20
>=20
>  <image.png>
>=20
>=20
> Looks the first seek entry starts at 71. Now from 59th to 71st =
position what is there. This part I am not able to understand.
>=20
> Can somebody please help me to understand this part.


As noted the SeekHead element starts at position 59. The first Child =
Element of SeekHead is then a CRC-32 element, which is:
> 0xbf 0x84 0x11 0xac 0x83 0x8a

Element ID: 0xbf
Element Data Size: 0x84
Element Value: 0x11 0xac 0x83 0x8a

After the CRC-32 Element is the first Seek Element.

More info about the CRC-32 element is in the EBML specification, see =
https://tools.ietf.org/html/draft-ietf-cellar-ebml =
<https://tools.ietf.org/html/draft-ietf-cellar-ebml>.
Dave Rice=

--Apple-Mail=_B38B91E0-DEF9-463C-B148-6AEFF38999C4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
class=3D"">Hi Austin,<div class=3D""><br class=3D""><div><blockquote =
type=3D"cite" class=3D""><div class=3D"">On Sep 3, 2017, at 9:08 AM, =
Austin Einter &lt;<a href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><div dir=3D"ltr" =
class=3D"">First of all a BIG THANKS to Matroska, for providing a open =
source media file container.&nbsp;<div class=3D""><br =
class=3D""></div><div class=3D"">I have a requirement, where I need to =
parse a matroska file. Initial few bytes of file is given as =
below.</div><div class=3D""><br class=3D""></div><div class=3D""><div =
class=3D"">0x1a 0x45 0xdf 0xa3 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x23 =
0x42 0x86 0x81 0x01</div><div class=3D"">0x42 0xf7 0x81 0x01 0x42 0xf2 =
0x81 0x04 0x42 0xf3 0x81 0x08 0x42 0x82 0x88 0x6d</div><div =
class=3D"">0x61 0x74 0x72 0x6f 0x73 0x6b 0x61 0x42 0x87 0x81 0x04 0x42 =
0x85 0x81 0x02 0x18</div><div class=3D"">0x53 0x80 0x67 0x01 0x00 0x00 =
0x00 0x00 0x33 0xdb 0x10 <b class=3D"">0x11 0x4d 0x9b 0x74</b> =
0x40</div><div class=3D"">0x42 0xbf 0x84 0x11 0xac 0x83 0x8a 0x4d 0xbb =
0x8b 0x53 0xab 0x84 0x15 0x49 0xa9</div><div class=3D"">0x66 0x53 0xac =
0x81 0xe5 0x4d 0xbb 0x8c 0x53 0xab 0x84 0x16 0x54 0xae 0x6b =
0x53</div><div class=3D"">0xac 0x82 0x01 0x56 0x4d 0xbb 0x8c 0x53 0xab =
0x84 0x12 0x54 0xc3 0x67 0x53 0xac</div><div class=3D"">0x82 0x11 0x5c =
0x4d 0xbb 0x8d 0x53 0xab 0x84 0x1c 0x53 0xbb 0x6b 0x53 0xac =
0x83</div><div class=3D"">0x33 0xd9 0x1c 0xec 0x01 0x00 0x00 0x00 0x00 =
0x00 0x00 0x94 0x00 0x00 0x00 0x00</div><div class=3D"">0x00 0x00 0x00 =
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 =
0x00</div><div class=3D"">0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 =
0x00 0x00 0x00 0x00 0x00 0x00 0x00</div></div><div class=3D""><br =
class=3D""></div><div class=3D"">I am trying to parse this file. I have =
parsed first 59 bytes successfully. Now I am at 60th byte. =46rom 6th =
byte bytes are 0x11 0x4d 0x9b 0x74, so it means&nbsp;seekhead is =
starting.&nbsp;</div><div class=3D""><br class=3D""></div><div =
class=3D"">I used mkvinfo to view parsed data. As per mkvinfo as shown =
below, seekhead starts at 59 which is fine. &nbsp;</div><div =
class=3D""><br class=3D""></div><div class=3D"">&nbsp;<span =
id=3D"cid:ii_15e47d9c56acaf21">&lt;image.png&gt;</span></div><div =
class=3D""><br class=3D""></div><div class=3D""><br class=3D""></div><div =
class=3D"">Looks the first seek entry starts at 71. Now from 59th to =
71st position what is there. This part I am not able to =
understand.</div><div class=3D""><br class=3D""></div><div class=3D"">Can =
somebody please help me to understand this =
part.</div></div></div></blockquote></div><div class=3D""><br =
class=3D""></div>As noted the SeekHead element starts at position 59. =
The first Child Element of SeekHead is then a CRC-32 element, which =
is:<br class=3D""></div><div class=3D""><blockquote type=3D"cite" =
class=3D""><div dir=3D"ltr" class=3D""><div class=3D""><div =
class=3D"">0xbf 0x84 0x11 0xac 0x83 =
0x8a</div></div></div></blockquote><br class=3D""></div><div =
class=3D"">Element ID: 0xbf</div><div class=3D"">Element Data Size: =
0x84</div><div class=3D"">Element Value: 0x11 0xac 0x83 0x8a</div><div =
class=3D""><br class=3D""></div><div class=3D"">After the CRC-32 Element =
is the first Seek Element.</div><div class=3D""><br class=3D""></div><div =
class=3D"">More info about the CRC-32 element is in the EBML =
specification, see&nbsp;<a =
href=3D"https://tools.ietf.org/html/draft-ietf-cellar-ebml" =
class=3D"">https://tools.ietf.org/html/draft-ietf-cellar-ebml</a>.</div><d=
iv class=3D"">Dave Rice</div></body></html>=

--Apple-Mail=_B38B91E0-DEF9-463C-B148-6AEFF38999C4--

--===============6599720218870760519==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Matroska-users mailing list
[email protected]
https://lists.matroska.org/cgi-bin/mailman/listinfo/matroska-users
Read Matroska-Users on GMane: http://dir.gmane.org/gmane.comp.multimedia.matroska.user

--===============6599720218870760519==--