0

I would like to measure the performance of a YouTube video, for example the frame rate. There is an option on YouTube called "Stats for nerds", which displays the connection speed as well as buffer health and dropped frames besides some other interesting stuff – but not the current frames per second.

Is there any way to measure the current frames per second? By fps I don't mean the fps of the video itself, but the fps which the video player manages to display.

Also the measurement of the latency would be nice to know.

3
  • Isn't that just video FPS minus "dropped frames"?
    – grawity
    Commented Jan 11, 2019 at 8:08
  • @grawity You don't even have to know the video FPS, since both decoded and dropped frames are exposed by WebKit.
    – slhck
    Commented Jan 11, 2019 at 8:18
  • @slhck: I was referring to the counter already shown in "Stats for nerds".
    – grawity
    Commented Jan 11, 2019 at 8:22

1 Answer 1

0

For WebKit, there are two video element attributes that you can query regularly:

  • webkitDecodedFrames
  • webkitDroppedFrames

More explanation here.

Using these, you can, for example, run a timer every second to get the values and calculate the real framerate. The two values should sum up to the total frames available in the video per played out second. Bear in mind that:

  • You have to pause counting if the video is not playing
  • Javascript timers are not very accurate
  • These attributes are vendor-specific and may be removed at some point

You could have a look at some example code that implements these metrics and calculates a mean played FPS — all you'd have to do is slightly rewrite that for pasting into the Chrome devtools console on YouTube.

2
  • Hi slhck,thanks for your answer. Unfortunately the example code doesn't work for me. The video won't start playing.
    – solid
    Commented Jan 11, 2019 at 11:01
  • The video doesn't exist anymore at this URL. It's just an example which has to be adapted to run on YouTube itself.
    – slhck
    Commented Jan 11, 2019 at 11:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .