问题
And save it as an image.
Is this kind of job possible in PHP?
回答1:
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.
回答2:
See this question.
All the solutions seem to rely on FFMPEG (so it's unlikely this would work on shared web hosting, for example).
来源:https://stackoverflow.com/questions/4415069/how-to-get-a-snapshot-of-the-first-frame-of-a-flv-in-php