You will need to install a user script manager extension to install this script.
This script tells YouTube that your browser only supports 30FPS or less, which means that you will see regular 30FPS versions of all HD videos.
For my six year old laptop, switching from 1080p60 to 1080p30 reduces the CPU usage by 2-4x, and removes all CPU overloads that used to make my browser and video playback freeze! This means longer battery life, and a much happier video watching experience!
(Furthermore, most older graphics cards only support hardware acceleration of 1080p30 or lower, which means that using this script may allow your graphics card to perform the video decoding for great battery savings!)
Install the Tampermonkey (https://tampermonkey.net) extension for your specific browser, and then install this script into Tampermonkey.
This script has been tested and confirmed working in Safari 9/10+ for Mac and Google Chrome for Mac. But it should work in all browsers and OS's that support the Tampermonkey extension - on Windows, Mac and Linux!
However, I only officially guarantee that it works in Chrome and Safari!
(This script does NOT work via Chrome's own basic built-in script support!)
We DO NOT affect embedded YouTube videos, because embedded players only check for high-FPS support, so blocking those queries would mean completely losing all HD resolutions for embedded videos!
I suggest clicking the "Watch on YouTube" button to play embedded high-FPS videos directly on YouTube in 30FPS instead!
Totally optional. ;-)
Now limits the maximum amount of injection (high-FPS blocking) retries to just two page reloads, and then displays a message bar which lets the user decide what to do if they've all failed. This is just for severely bugged web browsers, since most browsers always succeed on their first attempt!
Minor change to the address bar history handling.
Rewrote the "injection success?" detection method. Previously, we checked for the existence of YouTube's "window.ytplayer" object as a sign of too-late injection. But in Sept of 2017, they rewrote their site so that the object almost always exists by the time our userscript runs. Therefore, the method has instead been changed to now wait for a fraction of a second and then check if our code has actually blocked any formats. If so, we're sure that we've successfully injected the format blocker and disabled high-FPS!
As I've said above, I only officially support Chrome and Safari (because it's a lot of work to test different browsers). However, this new release improves the script's behavior in other browsers, at least for now. The script has been improved and verified to now also work in Firefox with Tampermonkey. But please be aware that Chrome and Safari remain the only officially supported browsers that I will test each release in. Feel free to report any problems you may discover in non-supported browsers, but please don't leave negative reviews regarding those other browsers since I only guarantee Chrome and Safari to work!
After some careful research, I've come up with an even more reliable and faster method for detecting injection success. It now uses a hybrid method, which first does a brand new, instant check that sees if YouTube's video player code has been loaded. If their player has already been loaded, then we treat that as an instant failure and perform a retry. But if there is no player yet, then we can be almost certain that we've successfully been injected into the page early enough. Then, we simply wait a while and perform a final verification (same as in v1.5+ but with a much longer delay) to confirm that we've actually blocked all high-FPS formats. This new method greatly enhances the chances of early success in all browsers. Enjoy!
Enhanced processing speed for the injection-counter in your browser's address bar.
Just a little bit of autumn cleaning (after all these recent changes), to improve the source code readability.