PHP函数/库从电影创建截图 [英] PHP function/library to create screenshot from movie
问题描述
我有一个用户上传电影的网站(MP4,FLV,OGV)。
I have a site where users upload movies (MP4, FLV, OGV).
我需要一个PHP函数来自动生成JPG中的海报/截图上传的电影。屏幕截图应该是电影的开场场景。
I need a PHP function to generate a poster/screenshot in JPG automatically from an uploaded movie. The screenshot should be for the opening scene of the movie.
如果它是一个javascript实用程序(而不是PHP),那也没关系。
If it is a javascript utility (rather than PHP), that will be fine too.
我找不到任何东西。我应该在哪里看看?
I can't find anything. Where should I look?
推荐答案
看看 FFmpeg 。它是一个非常强大的视频处理工具,可以通过 exec()
从PHP运行。例如,要从视频文件中提取第一帧,您可以使用:
Take a look at FFmpeg. It's a very capable video manipulation tool that can be run from PHP with exec()
. For example, to extract the first frame from a video file, you could use:
ffmpeg -i video.flv -ss 0 -vframes 1 shot.png
这篇关于PHP函数/库从电影创建截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!