2011-07-15 111 views

回答

3

首先,您還需要將其轉換爲可在任何地方工作的MP4。對於可以使用的ffmpeg工具,

生成縮略圖,

//Create Thumbs 
string thumbpath, thumbname; 
string thumbargs; 
string thumbre; 
thumbpath = AppDomain.CurrentDomain.BaseDirectory + "Video\\Thumb\\"; 
thumbname = thumbpath + withoutext + "%d" + ".jpg"; 
thumbargs = "-i " + inputfile + " -vframes 1 -ss 00:00:07 -s 150x150 " + thumbname; 
Process thumbproc = new Process(); 
thumbproc = new Process(); 
thumbproc.StartInfo.FileName = spath + "\\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(); 

然而,有關代碼的更多詳情,請參閱此鏈接。

http://ramcrishna.blogspot.com/2008/09/playing-videos-like-youtube-and.html

而且你需要根據你的web應用程序的路徑改變的路徑。

+0

這個答案真的救了我的屁股:) –