我想在我的應用程序中創建已上傳的視頻文件的縮略圖,因爲我已使用ffmpeg
。代碼如下:從asp.net中的視頻創建縮略圖
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'
如果有人有一個想法,那麼請讓知道。
你能解釋一下什麼是'lsServerPath','lsFBitmapName'和'lsFJpegName'你怎麼定義的URL和路徑? – 2015-01-30 18:13:44