How YouTube "stats for nerds" work. Or how to get the codec information of a video being played from JavaScript

Viewed 689

YouTube stats for nerds will show the codec of the video being played.

How to get the same data from JavaScript. Is there a generic API in mediasource or html video element to get the data.

1 Answers

HTML video tag standard do not have codec information, YouTube stats for nerds is implemented by themselves and get these video information from their back end server. You can find what you can get by looking Properties in HTMLMediaElement and HTMLVideoElement

BTW, Youtube is using DASH and MSE nowadays, you may get the codec by parsing DASH mpd file if these data was presented there.

Related