Improve Firefox HTML5 video playback performance

Main reason why Firefox performs so horrendously bad with H.264 encoded HTML5 video services (Youtube etc) is the integration of Cisco’s OpenH264. Sure it’s free, but apparently it’s also worth as much as it costs. It apparently lacks any kind of hardware acceleration and makes my AMD E-450 APU laptop literally scream and sweat in pain when it tries to play Youtube videos, because it tries to decode everything on weak CPU. The GPU part was just doing nothing and it has a DirectX 11 grade core within the APU. It’s so bad it makes 1080p30 or 720p60 entirely unplayable. Mozilla first bundled this codec with Firefox 33, but I’ve only noticed it when they hit Firefox 37. It’s when Youtube also switched to full HTML5 mode. And that’s when shit started…

I just don’t get it why is it used as primary decoder and not as a fallback if nothing else is found. Stupid logic from Mozilla…

Solution?

Disable this dumb software OpenH264 decoder so that something native from Windows kicks in instead. In my case AMD Video Decoder (most likely), providing me with a proper hardware accelerated decoder which is more efficient and also super fast since it’s using GPU instead of slow CPU.

How to disable integrated Firefox OpenH264 software decoder?

Type about:config into the Firefox URL bar and hit ENTER.

In the Search field above, enter (just copy & paste it there):
media.gmp-provider.enabled

Double click the found entry and it’ll switch itself to FALSE (which means disabled OpenH264 decoder).

Restart the Firefox and try Youtube again. It should play super smoothly now…

Special thanks to JayhawksRock from Mozillazine forums for telling me this secret.

23 thoughts on “Improve Firefox HTML5 video playback performance

  1. *sigh*
    Hope you haven’t been sharing this misinformation with people.
    Who told you this?

    Anyway, OpenH264 is used for one thing only and that is WebRTC.
    If you observed that general video playback improved by disabling OpenH264 this can be soundly attributed to the placebo effect.

    There are other things you can do to help, one of the most effective things is to ensure you have the most recent graphics drivers by checking on your graphics card manufacturer’s website. (Microsoft’s driver checking functionality is not always up to date.)

    Like

    1. Clearly it’s not misinformation if Youtube was entirely running on CPU and was unplayable even at 360p. As soon as I’ve disabled this crap, CPU usage dropped to pretty much 0% and GPU started doing the video decoding.

      Like

      1. I’m sorry to tell you that you are mistaken.

        You’ve obviously been flipping random prefs and come to the wrong conclusion somehow. media.gmp-provider.enabled has no effect on hardware decoding.

        Firefox prefers hardware decoders if they are available but there are a few cases where they don’t end up being used. Some drivers are blacklisted, there is a limited number of hardware decoders and there is a mechanism that detects faulty video cards (especially AMD cards) that disables them. When they get disabled they do not re-enable until restart. This mechanism has been tweaked in more recent versions of Firefox (43 IIRC).

        Like

      2. Besides talking with Mozilla developers in the past about this and just now confirming it with them, here is a post from another Mozilla developer about it.

        OpenH264 Now in Firefox


        The last paragraph notes that OpenH264 is only being used for WebRTC. The technical reason for that – lack of high profile support – is still true.

        Perhaps you changed something else around the same time. Old graphics drivers are a common cause of opting out of hardware acceleration (running it on the GPU) and running it on the CPU (Firefox relies on the underlying platform for the decoder). Try reenabling the setting and seeing if things change.

        Like

      3. Well, I talked with ppl at Mozillazine and no one said anything about that really.

        Also, it wasn’t any other setting involved. I know how to test stuff and this particular entry changed Youtube from unplayable to playable. Same drivers were involved. I think I’ve also tested others with same outcome. Inclusing WHQL ones.

        I can update the article with extra info to tweak it only if you’re experiencing problems. But this was what I’ve observed back then.

        Like

  2. RejZoR, I’m a developer working on Firefox’s video playing code, and in particular integration with plugins like OpenH264, so trust me when I say, Firefox does not (yet) use OpenH264 for decoding on YouTube. OpenH264 is *only* used for WebRTC.

    You *can* enable OpenH264 decoding, but if you had you’d see that YouTube fails to play most H.264 videos because OpenH264 cannot decode the H.264 Profiles used by YouTube. So YouTube would not work at all, rather than go slow.

    There must be something else interfering with your video playback.

    Like

    1. Well, then maybe you can explain to me why changing the entry in question made unplayable Youtube playable again. I may not be a programmer, but I do have quite some experoence with testing and how you need problems to be repeatable. This one was repeatable on every switch of the particular control.

      Like

      1. Did you also set media.fragmented-mp4.gmp.enabled=true? That would cause OpenH264 to be used, which would cause video to not work.

        The default out of the box experience does not use OpenH264, I expect Anthony Jones was close to the truth above about your graphics card being blacklisted. AMD cards are particularly prone to buggy drivers.

        Like

      2. Nope, that setting is in another tweak tutorial on my blog which forces Firefox to use Flash instead of HTML5 video. IIRC. So that shouldn’t be the case. It’s easily testable if you right click on video so I don’t think I’ve made that mistake.

        Like

      3. I would put it down to the AMD fallback and experimental error. My guess would be that you hit the fallback, flipped the pref, restarted and then found accelerated video working again. The falback was written for AMD cards which are especially problematic but it also triggers on Intel and nVidia cards.

        Like

  3. I have the same same problem. When I tried h264ify addon to disable vp8 and vp9, just to run on h264 codec, youtube 60fps videos are stuttering and dropping frames like hell. Yet on IE or Edge (both use h264), 60fps youtube videos run smoothly and cpu usage is way smaller. So are they using different h264 codecs than firefox?

    Sadly setting media.gmp-provider.enabled to false and restarting Firefox did NOT fix the problem.

    Also – when I tried vp9 on Firefox (media.mediasource.webm.enabled – true), the same videos runs a bit better than on h264, yet nowhere near as smooth as on IE or Edge with h264.

    So who do I force Firefox to use the same h264 codec as IE & Edge?

    Like

  4. Up until dec 2015/jan 2016 i could play both flash and html5 youtube video cleanly and smoothly in firefox. Now I have to use Opera. What ever some smart little fucker did around those dates fucked it. Video always played better in firefox than chrome (cleaner higher res) when expanded on a data projector and now ironically video plays better in opera. If I dont expand the html5 firefox video to full screen it still plays smoothly. But that useless.

    Like

    1. Try upgrading your graphics drivers. The issue is most likely due to having a blacklisted GPU (see about:support for detials). The h264ify addon will only make performance worse because Firefox only makes VP9 available to YouTube when hardware H.264 isn’t available.

      Like

  5. Thanks!!! I noticed this tweak DOES work, for me at least. I use a spare eMachines XP system with Sempron 3100+ 1.8Ghz(overclocked to 1928Mhz) CPU and GeForce 9300(overclocked slightly) card and 2GB RAM and SATA hard drive as a media PC for the TV/theater system and had nothing but problems with HTML5 on youtube, even with 480p, so was resorting to Youtube Flash Player addon to have flash by default instead, however, the addon caused very slow FF load times. Viewing in 1080p is still a bit jittery, but 720p is definitely better, whereas before I wouldn’t even attempt.
    Using FF 45.2.0 Extended Service Release

    Like

  6. 3 years later on version 61.0.1 (64 bit) of Firefox and I just found that this solution worked, as I just started experiencing this issue recently! Running on Windows 10 64bit OS. Both windows and Firefox had updates recently, so not sure which is responsible for the issue. Hardware as follows:

    Intel Core i7 860, 2.80GHz CPU
    8 GB RAM
    Nvidia GeForce GTX 760 SC with 2.0 GB display memory

    Very first thing I attempted to resolve was to update graphics drivers, clear browser cache, and restart PC (didn’t work), and then I tried disabling hardware acceleration (made the problem worse). As soon as I applied the fix stated in OP: boom, issue resolved. Clearly something is at play here, even if the plugin is only used for WebRTC or whatever, it is obviously still interfering with smooth playback somehow and bugged.

    Like

  7. Using duckduckgo found this blogg and go figure, it worked! Watching 1080P 60 was looking horrendously choppy before applying this workaround. I’m using version 61.0.1 (64 bit) of firefox in Win 10 PRO build 1803 with a Ryzen 5 1600 and a AMD R7 260X gpu.

    Like

  8. This comes up quite recently in searches. I just had this issue with Youtube. Exactly as bad as Rejzor describes. I had basically no video and 100% CPU utilization!

    My fix was deactivating hardware acceleration.
    I also found that using h264ify was DETRIMENTAL to performance! This was weird to me since it worked great in Chrome. But it seems that Firefox handles VP9 codecs better and H.264 codecs worse.
    So, stay away from the h264ify Add-On and deactivate hardware acceleration. 🙂

    Like

Leave a comment