Improve YouTube's performance with h264ify for Firefox
YouTube works well most of the time if you use a relatively new device to access the site even if you push the available video resolution to the maximum.
The same cannot be said for low power devices, for instance the majority of computers that are five or even ten years old.
While YouTube works when you access the site, you may experience full load on the cpu, your laptop becoming hot like crazy, video stutter, battery drain, or other issues.
While you may be able to reduce some by lowering the video resolution on YouTube, some issues might not go away even if you set the resolution to 320p or even 144p.
Besides, while it may reduce the impact that the playing of videos has on the hardware, it may reduce the viewing experience at the same time.
We talked about H264ify before here on Ghacks, when we reviewed the browser extension for Google Chrome. The Firefox add-on is developed by the same author using the same technology.
Basically, what h264ify does to improve the YouTube experience is to switch the YouTube video stream from using VP8/VP9 to H.264 instead.
The change is instant and not visible or noticeable to the user's eye. One of the main reasons why h.264 streams may be better is that the format is commonly accelerated by the graphics processing unit (gpu) whereas the VP8 or VP9 formats are not usually.
Hardware acceleration using the gpu reduces the load on the cpu which in term is beneficial to the viewing experience.
You can check which format YouTube uses to stream videos by right-clicking on the video and selecting the "stats for nerds" option.
This displays various information about the video stream including the mime type. This mime type should read video/mp4 when the extension is used, or video/webm when VP8 or VP9 are used.
As far as options are concerned, there are only two. The first enables or disables the switching to h.264 which you may find useful at times. You can disable the extension as well for the same effect. The second setting blocks 60fps videos.
If you are experiencing issues when playing videos on YouTube, you may want to try h264ify for Firefox or Google Chrome to see if it resolves or at the very least reduces the issue.
While there is no guarantee that the extension will resolve it, it is one of the better options in this regard.
It may also help users who try to play high resolution video on YouTube, say 1080p video, and notice dropped frames or jerkey playback.
Now You: How is the performance for you on YouTube?
FOR LINUX USERS ONLY:
The best way to view Youtube is view an external player, such as SMplayer (with the mpv engine linked to youtube-dl- see Preferences- General tab, and Network tab).
Video links can be dragged into the SMplayer screen to play immediately.
RECOMMENDED PREFERENCES FOR YOUTUBE_DL (in the youtube-dl.conf file)
60fps videos can be avoided by setting -f “[fps <=? 59]" in the youtube-dl.conf file or any other figure below 60.
Buffer size can also be altered with –buffer-size 16K or whatever figure suits the user.
Preference –prefer-ffmpeg is also needed to view the maximum resolution, because the updated avconv is not usually available in Linux distros. Whereas, ffmpeg can be updated easily.
Preferences –youtube-skip-dash-manifest and –no-check-certificate can also speed things up in my opinion.
I use “Open With” add-on and play YT videos on SMplayer/VLC or any other media player or browser which IMO is much quicker method than dragging links on youtube-dl
Can anyone confirm that the Firefox addon will or will not work on an older CPU (say AMD Socket A) without SSE2 instruction support? The authors website does mention this issue.
Thx for the script info. I prefer a script rather than an addon.
I’m a bit cluless when it comes to using scripts….
How do I know its safe\reliable [in general, not comparing to an ad-on which is worse of crs]
The source code shown is the only code used?
Would there be way to disable the script’s action [with a click or so, or only ‘complicated long way’]? ‘cuz if it will fail to improve performance \worse – that wpuld be needed…
Thanks in advance!!!
You need a “script runner” (or whatever it’s called) for your browser. One of the very few is the GreaseMonkey add-on.
You are right, be careful with scripts, even if those found on the Greasyfork site (same boss as UserStyles) are verified, as far as I know.
GreaseMonkey add-on has a toolbar button where you can enable/disable all scripts or each individually (if running on the page) OR you have GreaseMonkey’s Options where all scripts appear and can be disabled/enabled/removed.
anyway, it does not allow to ignore 60fps videos, which someone may need.
i modified the script to do so, but for a less ‘power-user’ the addon is preferable.
What script are you referring to, chuck- ? The one I mentioned, at GreasyFork, developed by wazz up, is dated (updated) 2015-03-09.
Apparently not useful on my old machine, even with NVidia graphics acceleration (Firefox Advanced options set to use hardware acceleration if available). More dropped frames, greater lag of video to audio.
Does this require ‘use hardware acceleration when available’ be checked in Firefox options to get the benefit from?
Fair and useful point. I also used to use that “open with” extension for about a year. It worked, but later I got into the habit of dragging things about the screen, and after that it seemed easier for me to drag the video link. That way I do not have to right click and open the menu. It is a personal choice, I suppose. It also meant that I had one less extension in Firefox.
FU_EU, that is a fair and useful comment for those who did not know about that particular extension. I also used to use that “open with”extension for about a year. Then, I got into the habit of dragging other things about the screen and then felt that I preferred dragging video links. It saved me the trouble of right clicking. It also meant one less extension in Firefox. It is a personal choice, I suppose. Some people like to right click; others prefer dragging.
Sorry, FU_EU, I forgot to add something for other people’s benefit.
Incidentally, I meant dragging links into the screen of SMplayer; not into the terminal. I am not sure that works for everybody.
He did not say “dragging links on youtube-dl”.
He said “dragged into the SMplayer screen”. That is different.
SMplayer still has its own internal Youtube code, but recently it has begun not be as good as SMplayer with the linked MPV – youtube-dl part. I think the intention is to replace SMplayer with the MPV/youtube-dl part only.
Users can also improve firefox speed by optimizing RAM when it is minimize and reduce page rendering duration!