如何计算重复小数的帧持续时间?

发布于 2024-09-06 01:46:50 字数 224 浏览 3 评论 0原文

如果我有一个以 30fps 播放的视频,则每帧的持续时间为 1/30 秒或 33.333333... 毫秒。

假设您正在实现一个视频播放器,您将如何处理每帧的持续时间由重复小数表示的事实?

例如,如果将第一个 29 帧的持续时间截断为 33.33 毫秒,则第 30 帧的持续时间必须稍长一些,即 33.43 毫秒,才能保持 30fps 的速率。

视频播放软件有处理这个问题的标准方法吗?

If I have a video that plays at 30fps, then the duration of each frame is 1/30th of a second or 33.333333... milliseconds.

Assume you were implementing a video player, how would you handle the fact that the duration of each frame is represented by a repeating decimal?

For example, if you truncate the duration of the 1st 29 frames to 33.33 milliseconds, then the duration of the 30th frame would have to be slightly longer, 33.43 milliseconds, in order to maintain a 30fps rate.

Is there a standard way that video playback software handles this?

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

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

发布评论

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

评论(1

笔芯 2024-09-13 01:46:50

如果你使用双精度,我怀疑你应该有任何问题:)不严重的是,你将永远无法准确地控制时间,那轮时间错误会导致任何问题。实现视频播放器的问题比这要大得多。

If you use a double i doubt you should have any problems :) No seriously you will never be able to control the timing as accurately that round of errors in your timing will cause any problems. There are much greater problems in implementing a video player than that.

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