26

我正在寻找实现从输入视频中检索单个帧的功能,因此我可以将其用作缩略图。

这些方面的东西应该起作用:

// filename examples: "test.avi", "test.dvr-ms"
// position is from 0 to 100 percent (0.0 to 1.0)
// returns a bitmap
byte[] GetVideoThumbnail(string filename, float position)
{
}

有谁知道如何在.Net 3.0 中做到这一点?

正确的解决方案将是此功能的“最佳”实现。避免选择空白帧的奖励积分。

4

5 回答 5

10

我最终推出了自己的独立类(使用我描述的单一方法),可以在此处查看源代码。媒体浏览器是GPL,但我很高兴我为该文件编写的代码成为公共领域。请记住,它使用来自directshow.net项目的互操作,因此您必须使用它们清除那部分代码。

此类不适用于 DVR-MS 文件,您需要为这些文件注入直接显示过滤器。

于 2009-01-07T02:14:09.763 回答
7

这个项目将为 AVI 解决问题:http: //www.codeproject.com/KB/audio-video/avifilewrapper.aspx

任何其他格式,您都可以查看 directshow。有一些项目可能会有所帮助:http:
//sourceforge.net/projects/directshownet/
http://code.google.com/p/slimdx/

于 2008-09-30T22:08:37.773 回答
4

1- 从http://ffmpeg.arrozcru.org/builds/获取最新版本的 ffmpeg.exe

2- 提取文件并将 ffmpeg.exe 复制到您的网站

3-使用此代码:

Process ffmpeg;

string video;
string thumb;

video = Server.MapPath("first.avi");
thumb = Server.MapPath("frame.jpg");

ffmpeg = new Process();

ffmpeg.StartInfo.Arguments = " -i "+video+" -ss 00:00:07 -vframes 1 -f image2 -vcodec mjpeg "+thumb;
ffmpeg.StartInfo.FileName = Server.MapPath("ffmpeg.exe");
ffmpeg.Start();
于 2011-07-27T22:44:25.193 回答
0

www.mitov.com上有一些图书馆可能会有所帮助。它是 Directshow 功能的通用包装器,我认为其中一个演示展示了如何从视频文件中获取帧。

于 2008-10-20T17:05:05.930 回答
0

这也值得一看:

http://www.codeproject.com/Articles/13237/Extract-Frames-from-Video-Files

于 2012-07-29T02:11:24.493 回答