WMV specification


Information
In this document I will use endnotes to show up the correspondending pages and objects in the manual. Notes are marked by [number]

According to the asf file specification we are doing the following:

Checking header
First we check the header line[1] to be the right GUID[2] so that it's proofed that the file is actually an asf-file (wmv is mostly asf).

Searching Objects
After this the properties have no order... we need to find the GUIDs by ourselves...
We search for all GUIDs at the same time so that we only have to search the entry points once.
First the FileProperties Object GUID[3] which we search with no other conditions than the GUID.

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].

At last we look out for the ExtendedStreamProperty Object GUID[7] where nothing is needed to check.
For each GUID we save the stream position after the GUID.

Handling data
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].

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 "Type-Specific Data". The structure is declared under the Video Media Type[8].

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.

Known Bugs
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't know how to find out which ExtendedStream belongs to which Stream. So testing goes on...

[1] page 13, 3.1
[2] page 96, 10.1, ASF_Header_Object
[3] page 97, 10.2, ASF_File_Properties_Object
[4] page 97, 10.2, ASF_Stream_Properties_Object
[5] page 16, 3.3
[6] page 98, 10.4, ASF_Video_Media
[7] page 97, 10.3, ASF_Extended_Stream_Properties_Object
[8] page 90, 9.2
[9] page 33, 4.1

Last edited Feb 15, 2012 at 7:17 PM by VisibleBasix, version 4

Comments

No comments yet.