降低帧率时ffmpeg得到哪一帧

发布于 2024-08-07 06:40:02 字数 248 浏览 4 评论 0原文

我有一些视频,我想将其转换为每 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小ぇ时光︴ 2024-08-14 06:40:02

第一张图像将来自第一帧。

请注意,您很可能会得到您期望的一两个以上的图像。我相信这是因为舍入和/或 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?

奢望 2024-08-14 06:40:02

我最终做了以下很大程度上借用自 ffmpeg 教程的操作:

ffmpeg -v 3 -vsync 0 -sameq -i movie.mpr  -f image2 "images-%03d.jpeg"

这为我提供了电影的每一帧作为 JPEG 的编号,到电影的末尾编号为 1。然后,我使用脚本语言过滤这些文件,知道帧速率为 30fps,以抓取每 60 帧。

I ended up doing the following largely borrowed from the ffmpeg tutorial:

ffmpeg -v 3 -vsync 0 -sameq -i movie.mpr  -f image2 "images-%03d.jpeg"

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文