【问题标题】:How to capture thumbnail for video while uploading it in ASP.NET?如何在 ASP.NET 中上传视频时捕获缩略图?
【发布时间】:2016-05-23 21:40:51
【问题描述】:

我想知道如何在 ASP.NET 中上传视频时捕获缩略图?

【问题讨论】:

  • 请详细说明您要完成的工作。你只是想做this吗?

标签: c# asp.net video-thumbnails


【解决方案1】:

首先,您还需要将其转换为 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 应用程序的路径更改路径。

【讨论】:

  • 这个答案真的救了我的命:)
猜你喜欢
  • 2011-08-11
  • 2016-03-26
  • 2012-01-08
  • 2016-09-14
  • 2016-09-06
  • 2011-10-22
  • 2011-01-16
  • 2011-05-12
  • 2013-10-12
相关资源
最近更新 更多