如何使用asp.net获取视频时长
using Microsoft.DirectX.AudioVideoPlayback;
Video vvideo = new Video(FileUpload.FileName.ToString());
StringBuilder sb = new StringBuilder();
sb.Append(duration.toString());
error message;
“已安装对应用程序域进行访问尝试。”
“vvideo”实例创建错误 msj://
但是向下找到了 cods 我在 C# 中找到了一个工作代码。但 asp.net 不起作用
string file1 = "c://ds.mpeg"
IMediaPosition m_objMediaPosition = null;
FilgraphManager m_objFilterGraph = new FilgraphManager();
m_objFilterGraph.RenderFile(filename);
m_objMediaPosition = m_objFilterGraph as IMediaPosition;
int s = (int)m_objMediaPosition.Duration;
int h = s / 3600;
int m = (s - (h * 3600)) / 60;
s = s - (h * 3600 + m * 60);
我不接受视频持续时间男孩:/
using Microsoft.DirectX.AudioVideoPlayback;
Video vvideo = new Video(FileUpload.FileName.ToString());
StringBuilder sb = new StringBuilder();
sb.Append(duration.toString());
error message;
“Installed an access attempt was made to the application domain.”
“vvideo” instance is created error msj ://
But down found cods I found a working code in c #. but asp.net does not work
string file1 = "c://ds.mpeg"
IMediaPosition m_objMediaPosition = null;
FilgraphManager m_objFilterGraph = new FilgraphManager();
m_objFilterGraph.RenderFile(filename);
m_objMediaPosition = m_objFilterGraph as IMediaPosition;
int s = (int)m_objMediaPosition.Duration;
int h = s / 3600;
int m = (s - (h * 3600)) / 60;
s = s - (h * 3600 + m * 60);
I DON'T TAKE VIDEO DURATION BOYS :/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在任何使用 Function 的地方都创建了 Function ;)
I make Function everywhere it uses ;)
首先,我尝试了 FFMPEG Wrapper,但在找到一个简单的解决方案后出现错误。
您可以使用此块包:
在您的项目中添加两个命名空间
这里我将秒存储在 TimeSpan 中,因此它直接给出小时:分钟:秒。
First, I try FFMPEG Wrapper but it gets an error after found an easy solution.
You can use this nugget package:
In your project add two namespaces
Here i store seconds in TimeSpan so its directly give hours:minutes:seconds.
您可以使用我们的 ffprobe 包装器 Alturos.VideoInfo。
您只需安装
nuget
包即可使用它。此外,还需要 ffprobe 二进制文件。示例
You can use our wrapper for ffprobe Alturos.VideoInfo.
You can use it simply by installing the
nuget
package. Also the ffprobe binary is required.Example