2011-01-19 14:44
浏览 501


Using ffmpeg, how can i get a random frame of an FLV video and save it as png or jpg ?

图片转代码服务由CSDN问答提供 功能建议


  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douyi2798 2011-01-19 14:49

    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.

    打赏 评论

相关推荐 更多相似问题