从FLV视频中获取随机帧并将其存储为png或jpg

Using ffmpeg, how can i get a random frame 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.