ffmpeg 的总帧数

发布于 2024-10-02 07:40:11 字数 29 浏览 0 评论 0原文

如何使用 ffmpeg 查找视频中的总帧数?

How do I find the total number of frames in a video with ffmpeg?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

甜味拾荒者 2024-10-09 07:40:11

看看 这个答案。问题在于,确切的帧数通常不会存储在元数据中,只能通过解码文件并弄清楚有多少帧来真正找到(而不是估计)。如果您只需要估计,则可以使用 ffmpeg -i提供的帧率和持续时间来估计。

Take a look at this answer. The problem is that the exact number of frames is often not stored in metadata and can only be truly found (not estimated) by decoding the file and figuring out how many there are. If you only need an estimate, you can just use the framerate and duration provided by ffmpeg -i <filename> to estimate.

少女净妖师 2024-10-09 07:40:11

如果您以编程方式调用 ffmpeg,则 OpenCV 库提供了一个方便的 python/c++ 接口来访问视频属性 -

http://opencv.willowgarage.com/documentation/python/reading_and_writing_images_and_video.html#getcaptureproperty

或者,您可以尝试解析与 ffmpeg 捆绑在一起的 ffprobe 的输出,并根据持续时间和 FPS 计算总帧。

If you are invoking ffmpeg programmatically then the OpenCV library provides a convenient python/c++ interface for accessing video properties -

http://opencv.willowgarage.com/documentation/python/reading_and_writing_images_and_video.html#getcaptureproperty

Alternatively you could try to parse the output from ffprobe which comes bundled with ffmpeg and calculate total frame based on duration and FPS.

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