2011-07-15 55 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

这个答案真的救了我的屁股:) –