如何在.Net中获得video缩略图?

我正在寻找一个从输入video中检索单个帧的函数,所以我可以将它用作缩略图。

这些方面的东西应该有效:

// 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中这样做?

正确的解决方案将是此function的“最佳”实现。 用于避免选择空白帧的奖励点。

我最后滚动了自己的独立课程(使用我描述的单一方法),可以在这里查看源代码。 媒体浏览器是 GPL,但我很高兴我为该文件编写的代码是Public Domain。 请记住,它使用directshow.net项目中的interop,因此您必须使用它们清除该部分代码。

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

该项目将为AVI提供​​技巧: http : //www.codeproject.com/KB/audio-video/avifilewrapper.aspx

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

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(); 

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