How to get a snapshot of the first frame of a .flv in PHP?
And save it as an image.
Is this kind of job p开发者_C百科ossible in PHP?
PHP has an ffmpeg
library which you can use for this. Utilizing ffmpeg_movie
you can return a video file as an object:
$movie = new ffmpeg_movie('/path/to/.flv');
You can then go on and use the getFrame()
method, which returns the frame as an ffmpeg_frame
object, which has the method toGDImage()
which returns a GD
image of the frame. Obviously the GD
library needs to be enabled.
See this question.
All the solutions seem to rely on FFMPEG (so it's unlikely this would work on shared web hosting, for example).
精彩评论