如何转换上传的视频并从此文件获取屏幕截图?
我正在构建一个 cms,我希望用户能够上传视频,但我不熟悉视频上传和视频上传。转换。有没有例子或者有人编写了这样的解决方案? 我听说过 ffmpeg 但我不知道如何将它与 asp.net 集成。
作为简单的解决方案,我可以让我的客户上传 flv 文件,但我仍然需要从该 fvl 获取屏幕截图。
谢谢
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.
As simple solution I can make my clients upload flv files but then I would still need to get a screenshot from that fvl.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
回答作者的问题:
ffmpeg.exe 就足够了,不需要安装。
下面的代码在
videoFilename
变量指定的视频的captureTime
上获取屏幕截图,并将其保存到imageFilename
路径。Answering author's question:
ffmpeg.exe will be enough, no installation is required.
The code below gets a screenshot on
captureTime
on video specified byvideoFilename
variable, and saves it to theimageFilename
path.我使用过 ffmpeg,但我发现使用预编译的 .exe 版本更容易。因此,在后端,我只需使用所需的命令行参数启动 ffmpeg.exe 来进行转换,让它运行,完成后,完成的文件就准备好了。
I've used ffmpeg, but I found it easier to just use the pre-compiled .exe version. So in the backend, I would just launch ffmpeg.exe with the required command-line arguments to do the conversion, let it run and when it was finished the completed file was all ready to go.
很久很久以前,在我的 PHP4 时代,我使用了以下方法,在 shell 上调用 ffmpeg 并创建屏幕截图。
它将支持的视频文件作为 $sourcefile。屏幕截图所需的文件位置可以通过 $destfile 参数给出。当然,请确保给定位置对于执行用户是可写的。
希望这对于正在寻找正确语法的其他人也有用。
A long, long time ago in my PHP4 days I used the following method, calling ffmpeg on the shell and creating a screenshot.
It takes a supported video file as $sourcefile. The desired file location for the screenshot can be given by the $destfile parameter. Off course make sure that the given location is writeable for the executing user.
Hopefully this is also usable for anyone else who's looking for the right syntax.