net后台对视频进行截图

来源:互联网 发布:心事谁人知 黄乙玲 编辑:程序博客网 时间:2024/05/29 03:17

 

http://www.codeproject.com/Articles/9676/Extracting-still-pictures-from-movie-files-with-C//英文的,有例子下载

能载图的视频格式*.avi, *.mpeg, *.mov (QuickTime), and*.dat (DivX).。其他不行。

using System

;using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using Microsoft.DirectX.AudioVideoPlayback;//安装DirectX

using System.Drawing.Imaging;

using System.Runtime.InteropServices;

using DexterLib;//这个在系统中有Interop.DexterLib.dll

using System.Threading;

 

 

方法

 

    MediaDetClass md = new MediaDetClass();//生成MediaDetClass。在DexterLib.dll

    md.Filename = "D:\\ ..\\Video\\gg.avi";//要截取视频的路径,网页后台路径也是绝对路径
 md.CurrentStream = 0;
 string fBitmapName = "D:\\..\\Video\\sample" + ".bmp";//图片生成路径
 md.WriteBitmapBits(3, 320, 240, fBitmapName);//http://msdn.microsoft.com/zh-cn/library/ms785896(v=VS.85).aspx 方法说明,参数一是视频时间点,

原创粉丝点击