以编程方式获取视频时长 [英] Programmatically get video duration

查看:170
本文介绍了以编程方式获取视频时长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取mp4视频(视频格式AVC)的视频时长

I'd need to get the video duration of a mp4 video (video format AVC)

我正在使用DirectShowLib 2.1

I'm using DirectShowLib 2.1

我下载了一些编解码器,但是我仍在执行代码-2147220891(错误代码,我不知道这是什么意思)

I downloaded a couple of codecs but I'm still getting code -2147220891 (an error code that I don't know what it means) doing

 graphBuilder.RenderFile(filePath, null);

有人知道如何获得这种视频的时长吗?

Any idea how to get the duration of this kind of video?

推荐答案

-2147220891是十六进制的0x80040265。搜索该错误代码后发现此线程

-2147220891 is 0x80040265 in hex. A search for that error code revealed this thread


0x80040265并不是真正的未知。严格来说,它是VFW_E_UNSUPPORTED_STREAM,这意味着您的AVI文件包含至少一个您没有正确编解码器的流(例如,视频)。

0x80040265 isn't really "unknown". Strictly, it is VFW_E_UNSUPPORTED_STREAM, which means that your AVI files contain at least one stream (e.g., the video) that you do not have the right codec for.

所以看来您仍然找不到合适的编解码器。

So it looks like you still haven't found the right codec.

文件是否在Windows Media Player或VLC中播放?

Does the file play in Windows Media Player or VLC (for example)?

这篇关于以编程方式获取视频时长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆