Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在ASP.NET中上载视频时捕获缩略图?_C#_Asp.net_Video Thumbnails - Fatal编程技术网

C# 如何在ASP.NET中上载视频时捕获缩略图?

C# 如何在ASP.NET中上载视频时捕获缩略图?,c#,asp.net,video-thumbnails,C#,Asp.net,Video Thumbnails,我想知道如何在ASP.NET中上传视频时捕获缩略图?首先,您还需要将其转换为MP4,它可以在任何地方工作。为此,您可以使用ffmpeg工具 要创建缩略图 //Create Thumbs string thumbpath, thumbname; string thumbargs; string thumbre; thumbpath = AppDomain.CurrentDomain.BaseDirectory + "Video\\Thumb\\"; thumbname = thumbpath +

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

首先,您还需要将其转换为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();
但是,有关代码的更多详细信息,请参阅此链接


您还需要根据web应用程序的路径更改路径。

请详细说明您要实现的目标。你只是想这么做吗?这个答案真的救了我一命:)