在asp.net中从视频创建缩略图

时间:2011-05-27 11:04:49

标签: asp.net video thumbnails

我想在我的应用程序中创建已上传的视频文件的缩略图,我使用了ffmpeg。代码如下:

 string thumbpath, thumbname;
        string thumbargs;
        string thumbre;
        thumbpath = Server.MapPath("~/thumbnails/");
        thumbname = thumbpath + "Test" + ".png";
        string f = Server.MapPath("~/testvideo.wmv");
        thumbargs = "-i " + f + " -vcodec png -vframes 1 -ss 00:00:07 -s 150x150 " + thumbname;
        Process thumbproc = new Process();
        thumbproc = new Process();
        thumbproc.StartInfo.FileName = Server.MapPath("~\\ffmpeg\\ffmpeg.exe");
        thumbproc.StartInfo.Arguments = thumbargs;
        thumbproc.StartInfo.UseShellExecute = false;
        thumbproc.StartInfo.CreateNoWindow = false;
        thumbproc.StartInfo.RedirectStandardOutput = false;
        try
        {
            thumbproc.Start();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        thumbproc.WaitForExit();
        thumbproc.Close();

但它正在抛出异常:

MainModule = 'thumbproc.MainModule'
threw an exception of type 'System.ComponentModel.Win32Exception'

如果某人有想法,请告诉我们。

0 个答案:

没有答案