wmv2xnb Wiki Rss Feedhttp://wmv2xnb.codeplex.com/wmv2xnb Wiki Rss DescriptionUpdated Wiki: Homehttp://wmv2xnb.codeplex.com/wikipage?version=3<div class="wikidoc"><b>Project Description</b><br />WMV2XNB offers xna game programmers to compile wmv videos ingame out of a crypted database or video file. So it protects your XNA Videos from just beeing modified. It also has a tool to compile video content outside. No use of any XNA stuff.<br /><br />This project was created during while dealing with databases and XNA and thought about storing videos in the database. So I got the XNB Format specification and the asf format specification and begun to write a little routine which allows me to create XNB Video files out of a wmv stream.</div><div class="ClearBoth"></div>VisibleBasixSun, 01 Jul 2012 19:14:51 GMTUpdated Wiki: Home 20120701071451PUpdated Wiki: Video XNB specificationshttp://wmv2xnb.codeplex.com/wikipage?title=Video XNB specifications&version=2<div class="wikidoc"><h1>Video XNB specifications</h1>
<hr />
Reffering to this <a href="http://create.msdn.com/en-US/sample/xnb_format">XNB specification</a> I worked out how a video file is build up. The Informations are written to the xnb file using a binary stream.<br /><br /><b>header</b><br />At the beginning we write the header of the file<br />&#39;X&#39;, &#39;N&#39;, &#39;B&#39;, &#39;w&#39;|&#39;m&#39;|&#39;x&#39;, 0x01|0x00,<i>size</i><br />this header contains the XNB identifier (3 bytes), the target platform (&#39;w&#39;-&gt;Windows, &#39;x&#39;-&gt;XBox and &#39;m&#39;-&gt;Windows Phone 7), the profile (01-&gt;HiDef, 00-&gt;Reach) and the number of bytes stored in the XNB.<br /><br /><b>Type readers</b><br />This part is hardcoded because for videos it is everytime the same.<br /><br /><b>Video</b><br />Now every datatype has it&#39;s own prefix.<br />string-&gt;02<br />int32-&gt;03<br />single-&gt;04<br /><br /><u>Filename</u><br />The filename to the reference file, stored as binary string<br /><u>Duration</u><br />The duration of the video in ms, stored as int32<br /><u>Width, Height</u><br />The width, height of the video in pixels stored as int32<br /><u>framerate</u><br />fps of the video stored as single<br /><u>mediatype</u><br />The type of the audio. 0-&gt;Music, 1-&gt;Diaolg, 2-&gt;both; stored as Int32<br /></div><div class="ClearBoth"></div>VisibleBasixSun, 01 Jul 2012 17:14:05 GMTUpdated Wiki: Video XNB specifications 20120701051405PUpdated Wiki: WMV specificationhttp://wmv2xnb.codeplex.com/wikipage?title=WMV specification&version=4<div class="wikidoc"><h1>WMV specification</h1>
<hr />
<b>Information</b><br />In this document I will use endnotes to show up the correspondending pages and objects in the manual. Notes are marked by [<i>number</i>]<br /><br />According to the <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=14995" class="externalLink">asf file specification<span class="externalLinkIcon"></span></a> we are doing the following:<br /><br /><b>Checking header</b><br />First we check the header line[1] to be the right GUID[2] so that it&#39;s proofed that the file is actually an asf-file (wmv is mostly asf).<br /><br /><b>Searching Objects</b><br />After this the properties have no order... we need to find the GUIDs by ourselves...<br />We search for all GUIDs at the same time so that we only have to search the entry points once.<br />First the FileProperties Object GUID[3] which we search with no other conditions than the GUID.<br /><br />Afterwards the StreamProperties Object GUID[4]. This Object is not only once there so we have some problems identifying the right one. Depending on the StreamProperties Object[5] we first check the minimum object size and then if we have the right stream object whoose Type GUID should be set to Video Stream[6].<br /><br />At last we look out for the ExtendedStreamProperty Object GUID[7] where nothing is needed to check.<br />For each GUID we save the stream position after the GUID.<br /><br /><b>Handling data</b><br />First we extract the duration. Naturaly the duration is given in 100ns, so that we have to divide by 10000 to get up to 1ms. Where the duration is given, is declared in the FileProperties Object[1].<br /><br />Afterwards we get the resolution of the video. Those are stored directly as int32 so no calculation is needed. To get to them, we have to jump over mostly all properties given in the StreamProperties Object[5] until we come to the point &quot;Type-Specific Data&quot;. The structure is declared under the Video Media Type[8].<br /><br />At last we have to get the framerate. This is saved under the ExtendedStreamProperties Object[9]. And now we try to get the framerate over the time per frame, so we do 1/(tpf*10000000) to get the framerate in seconds.<br /><br /><b>Known Bugs</b><br />Yes, there is already one bug. If there are more than one ExtendedStreamProperties Object we cannot find the right one yet. Currently we take the first we can get but I don&#39;t know how to find out which ExtendedStream belongs to which Stream. So testing goes on...<br /><br /><i>[1]</i> page 13, 3.1<br /><i>[2]</i> page 96, 10.1, ASF_Header_Object<br /><i>[3]</i> page 97, 10.2, ASF_File_Properties_Object<br /><i>[4]</i> page 97, 10.2, ASF_Stream_Properties_Object<br /><i>[5]</i> page 16, 3.3<br /><i>[6]</i> page 98, 10.4, ASF_Video_Media<br /><i>[7]</i> page 97, 10.3, ASF_Extended_Stream_Properties_Object<br /><i>[8]</i> page 90, 9.2<br /><i>[9]</i> page 33, 4.1</div><div class="ClearBoth"></div>VisibleBasixWed, 15 Feb 2012 20:17:19 GMTUpdated Wiki: WMV specification 20120215081719P