如何在C#中解析WMV文件的信息

问题描述:

我想获取ASF文件的信息,如比特率,元数据,语言...我已阅读ASF规范,并且知道ASF文件包含以下部分:标题对象,数据对象,索引对象.首先,我认为ASF文件的二进制文件,我尝试通过C#中的CLASS和FUNCTION来解决:FileStream,BinaryReader:

I want to get information of ASF file as bitrate, metadata, language...I have read ASF Specification and know a ASF file has parts : Header Object, Data Object, Index Object. At frist, I think ASF file''s binary file and i try to solve by CLASS and FUNCTION in C# as : FileStream, BinaryReader :

String path = @"E:\KhoaLuanTN\Streaming video server\video\encoder_ad.wmv";
            FileStream filer = File.OpenRead(path);
            BinaryReader br = new BinaryReader(filer);         
            byte [] file = br.ReadBytes(100);


然后,我尝试转换为String:


Then, I try to convert into String :

<pre lang="midl">textBox1.Text = Encoding.ASCII.GetString ( file );



但是它没有显示出我所期望的.它显示了一个荒谬的字符串:0 amp;?u?f? ??.
因此,请向我展示如何将ASF文件中的信息转换为String.



But it doesn''t display as I expect. It displays a nonsensical string: 0&?u?f? ??.
So please show me how to convert information in a ASF file into String.



这根本不起作用.

我认为这些链接会有所帮助

http://johndyer.name/post/Retreiving-the-duration- WMV-in-C.aspx的 [ ^ ]

http://groups.google.com/group/microsoft.public.windowsmedia.sdk/browse_thread/thread/888aa90cf4bdd23d/627924eacd07cab1?q=wmv+duration+c%23&rnum=6#627924eacd07cab1 [
Hi,

This will not work at all.

I think these link will help

http://johndyer.name/post/Retreiving-the-duration-of-a-WMV-in-C.aspx[^]

http://groups.google.com/group/microsoft.public.windowsmedia.sdk/browse_thread/thread/888aa90cf4bdd23d/627924eacd07cab1?q=wmv+duration+c%23&rnum=6#627924eacd07cab1[^]