【发布时间】:2016-05-23 21:40:51
【问题描述】:
我想知道如何在 ASP.NET 中上传视频时捕获缩略图?
【问题讨论】:
-
请详细说明您要完成的工作。你只是想做this吗?
标签: c# asp.net video-thumbnails
我想知道如何在 ASP.NET 中上传视频时捕获缩略图?
【问题讨论】:
标签: c# asp.net video-thumbnails
首先,您还需要将其转换为 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 应用程序的路径更改路径。
【讨论】: