After endless Googling on this problem I noticed that other people had had similar issues with processor overload with YouTube videos. It appears to be relatively rare. But not unknown. I <think> I’ve found a fix. Or more like – A work-round. So if this helps you then great! But this is strictly WYSIWYG.
Let me start off by saying that this is an unsatisfactory fix. I hate it. It appears to work, but I am unhappy with it as it “gets round” the problem rather than solving it. But beggars can’t be choosers…
Streaming Video and Processor run-away.
Let me explain what the problem is, or rather what my problem is. Yours may be different.
I have found that on my Ubuntu 18.04 laptop that when I stream videos from YouTube (or elsewhere) everything starts off perfectly. Then after about 10-12 minutes there appears to be some form of step change run-away where the processor (quad core) load rapidly increases and eventually gets maxxed out. The system slows to a crawl. I end up either killing the firefox process in a terminal (or in top) or if I’m lucky I get in quickly enough to either shut down Firefox or pause the video. If I leave the machine to run on, it does not recover. It eventually overheats and shuts down inelegantly.
Pause and Delay
If after pausing the video due to a run-away, I then immediately restart the video the processor load immediately ramps back up. Bizarrely, if I leave it for (say) half an hour or so it works again! That’s until either the processors eventually ramp up again or the video ends.
A discontinuity within the video like one of the irritating embedded YouTube adverts seem to either trigger the problem or at least make it worse.
But Not on 20.04
This never used to happen on this machine with 16.04 or earlier versions of 18.04. I have another machine that runs Ubuntu 20.04 with only two cores and half the memory. It works without issue.
The only difference I can see in the 20.04 machines favour is that it is running a single crappy 14 inch display rather than two displays like this laptop is. But even so…..
So what’s the Fix?
I installed a Firefox plug-in called “YouTube High Definition”. This plug-in, although primarily designed to maximise YouTube display resolution, also allows you to degrade it. So I crippled the YouTube maximum resolution to be 720p.
I also installed another plug-in (NoScript) to suppress script loops but I don’t think this helped as much as dropping the resolution.
Frankly with my crap eyesight I don’t really notice the resolution drop. (So far) the processor load when streaming at 720p barely ever gets above 20%. So I hope this fixes it. But the problem remains with other higher resolution streaming sites.
Although this appears to work, and both of these plugins are awesome, it is not (imho) a satisfactory long-term fix. I should not be getting processor overload with YouTube videos on this machine. If I (ever) figure it out before I go through the grief and suffering of upgrading to 20.04 – I’ll let you know.