降低帧率时ffmpeg得到哪一帧
我有一些视频,我想将其转换为每 2 秒帧的图像。
例如,如果视频长 7 秒,帧率为 15 fps,我想获取帧 1、31、61、91。
命令:
ffmpeg -i foo.mp4 -r 0.5 -f image2 -vcodec mjpeg foo%d.jpg
似乎可以执行我想要的操作,但它会获取哪一帧? 1、31、61、91 或 30、60、90 或 13、43、73、103?
I have some video that I would like to convert to images of frames every 2 sec.
E.g. If the video is 7 seconds long at 15 fps I would like to get frames 1, 31, 61, 91.
The command:
ffmpeg -i foo.mp4 -r 0.5 -f image2 -vcodec mjpeg foo%d.jpg
appears to do what I want, but which frame does it get? 1, 31, 61, 91 or 30, 60, 90 or 13, 43, 73, 103?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
第一张图像将来自第一帧。
请注意,您很可能会得到您期望的一两个以上的图像。我相信这是因为舍入和/或 ffmpeg 创建了最终图像。例如:你的视频真的有7秒长吗?或者是7.63s长?
The first image will be from the very first frame.
Note that you very well may get an image or two more that you expect. I believe this is because of rounding and/or that ffmpeg creates a final images. E.g.: Is your video really 7s long? Or is it 7.63s long?
我最终做了以下很大程度上借用自 ffmpeg 教程的操作:
这为我提供了电影的每一帧作为 JPEG 的编号,到电影的末尾编号为 1。然后,我使用脚本语言过滤这些文件,知道帧速率为 30fps,以抓取每 60 帧。
I ended up doing the following largely borrowed from the ffmpeg tutorial:
This gives me each frame of the movie as a JPEG numbered 1 to the end of the movie. I then filtered these files using a scripting language, knowing the frame rate was 30fps, to grab every 60th frame.