如何使用JavaScript测量视频的实际帧速率?
假设使用< video>
标签在HTML5页面上播放视频。我该如何测量实际的帧率?我不仅想阅读视频文件的帧速率( eg 。
我希望可能有一个更直接的指标。
Assume a video is playing in an HTML5 page using the <video>
tag. How can I measure the actual framerate? I do not just want to read the framerate of the video file (e.g., but what the browser is able to manage in practice.
(I’m guessing it will be possible to hack something together involving requestAnimationFrame
, but I vaguely worry that on some systems, video playback will be decoupled from the rest of the page, leading to an incorrect result; additionally I hope there might be a more direct metric.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试尝试探索 videoplaybackquality ,也许它给出了它的指标。对您有用。
更具体地说, a href =“ https://developer.mozilla.org/en-us/docs/web/api/videoplaybackquality/totalvideoframes“ rel =“ nofollow noreferrer”>呈现的总框架值。
也许涉及这些结果以及
requestAnimationFrame
之类的其他选项?我不确定您对项目的确切目标是什么。例如“我如何测量实际的帧速率?” 我个人可以将其解释为:
(1)视频解码器的速度每个帧(对于给定的视频类型)。
例如,每个帧的解码速度 @ 720p vs也许是4K分辨率。
(2)每秒删除的帧数。
在哪里减去FPS数字的掉落框架,以了解介绍了多少。
这是 videoplaybackquality :
You could try exploring VideoPlaybackQuality, maybe the metrics it gives out can be useful to you.
More specifically the dropped frames or total frames presented values.
Maybe involving those results along with other options like
requestAnimationFrame
?I'm not sure what your exact end-goal of your project is. For example "How can I measure the actual framerate?" I personally can interpret that as either:
(1) Speed of the video decoder per frame (for given video type).
For example the decoding speed of each single frame @ 720p vs maybe 4K resolution.
(2) Number of frames dropped per second.
Where you minus the FPS number against the dropped frames to know how many were presented.
Here is a quick/basic example usage of VideoPlaybackQuality: