如何从MP4,WMV,FLV,MOV视频录像时长 [英] How to get video duration from mp4, wmv, flv, mov videos
问题描述
好吧。其实我需要多为mp4格式。但是,如果有可能获得其他类型,以及这将是很好的。我只需要读取文件的时间。我怎样才能做到这一点与C#4.0?
Alright. Actually i need mostly the mp4 format. But if it is possible to get for other types as well that would be nice. I just need to read the duration of the file. How can i do that with C# 4.0 ?
所以我需要的东西是这样的视频是这样的:13分钟12秒
So the thing i need is like this video is like : 13 minutes 12 seconds
我可以使用3第三方前男友了。就像他们保存有关文件到一个文本文件中的信息。我可以分析文本文件。
I can use 3 third party exes too. Like they save the information about the file to a text file. I can parse that text file.
感谢你。
推荐答案
您可以使用DirectShow的API MediaDet
对象,通过DirectShow.NET包装库。请参见获取的视频长度为code样品,<一个href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd406887%28v=vs.85%29.aspx"><$c$c>get_StreamLength$c$c>让你在秒的持续时间。这是假定Windows有MPEG-4多路分解器安装(前7需要第三方组件与Windows,我相信cezor同样适用于另一个答案,也可以自由地重新分配,虽然组件)。
You can use DirectShow API MediaDet
object, through DirectShow.NET wrapper library. See Getting length of video for code sample, get_StreamLength
gets you the duration in seconds. This assumes Windows has MPEG-4 demultiplexer installed (requires third party components with Windows prior to 7, I believe the same applies to another answer by cezor, there are free to redistribute components though).
这篇关于如何从MP4,WMV,FLV,MOV视频录像时长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!