开发者

Get random frame from FLV video and store it as png or jpg

开发者 https://www.devze.com 2023-02-05 18:20 出处:网络
Using ffmpeg, how can i get a random fr开发者_Python百科ame of an FLV video and save it as png or jpg ?Generate your random time value in PHP, and then execute something like this in ffmpeg:

Using ffmpeg, how can i get a random fr开发者_Python百科ame of an FLV video and save it as png or jpg ?


Generate your random time value in PHP, and then execute something like this in ffmpeg:

ffmpeg -vframes 1 -ss 5.5 -i yourvideo.flv yourframe.jpg

This will get a frame on or about 5.5 seconds in the video. I suggest you use ffmpeg ahead of time to determine the length of the video, then generate a random number between the start and end.

Also, leave plenty of padding at the end of the video, as it isn't always possible to determine its exact length ahead of time. If your video is 1 hour, you might get a frame somewhere between 0 and 57 minutes, for example.

0

精彩评论

暂无评论...
验证码 换一张
取 消