如何转换上传的视频,并从该文件的截图? [英] How to convert uploaded video and get a screenshot from this file?
问题描述
我建立一个CMS和我希望用户能够上传视频,但我不熟悉的视频上传和放大器;转换。有一个例子,或有任何codeD这样的解决方案?
我听说过的ffmpeg,但我不知道如何将它与asp.net结合起来。
I'm building a cms and I want users to be able to upload videos but I'm not familiar with video upload & conversion. Is there an example or has anybody coded a solution like this? I heard about ffmpeg but I don't know how to integrate it with asp.net.
由于简单的解决方案,我可以让我的客户上传flv文件,但后来我仍然需要得到从FVL截图。
As simple solution I can make my clients upload flv files but then I would still need to get a screenshot from that fvl.
感谢
推荐答案
在回答笔者的问题:
ffmpeg的是否需要安装
服务器端或者只是EXE够吗?
Does ffmpeg requires to be installed server side or just exe is enough?
ffmpeg.exe就足够了,无需安装。
ffmpeg.exe will be enough, no installation is required.
在code以下获得通过 videoFilename
指定的视频变量上 captureTime
截图,并将其保存在映像文件名称
路径。
The code below gets a screenshot on captureTime
on video specified by videoFilename
variable, and saves it to the imageFilename
path.
Process ffmpeg = new Process();
ffmpeg.EnableRaisingEvents = true;
ffmpeg.StartInfo = new ProcessStartInfo
{
FileName = this.ffmpegPath,
Arguments = string.Format(
"-i \"{0}\" -an -y -s 320x240 -ss {1} -vframes 1 -f image2 \"{2}\"",
this.videoFilename,
DateTime.MinValue.Add(this.captureTime).ToString("HH:mm:ss:ff", CultureInfo.InvariantCulture),
this.imageFilename
),
WorkingDirectory = this.workingDirectory,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
WindowStyle = ProcessWindowStyle.Hidden
};
ffmpeg.Start();
ffmpeg.WaitForExit(this.timeout);
这篇关于如何转换上传的视频,并从该文件的截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!