How to enable MSE & H.264 support on YouTube for Firefox right now

Martin Brinkmann
Updated •
Firefox

Update: Firefox supports all HTML5 media features that YouTube requires. When you open the HTML5 test page you will notice that all options are checked indicating that they are all supported. Note that some Linux distributions may lack support for some features. End

When you open YouTube's HTML5 page in the most recent stable version of Firefox right now, you will notice that support is not available for all technologies listed on the page.

Support may be available for HTMLVideoElement, H.264 and WebM VP8, but not for Media Source Extensions, MSE & H.264 or MSE & WebM VP9.

A configuration option is available to enable Media Source Extensions and MSE & WebM VP9 right now in the Firefox browser.

To do so, load about:config in the browser's address bar and search for the term media.mediasource.enabled there. Double-click the preference to set it to true if it is not set to true already.

Then, search for media.mediasource.webm.enabled afterwards and make sure it is set to true as well. If it is not, double-click on it to switch its value to true.

When you go back to YouTube's HMTL5 page afterwards, you will notice that only MSE & H.264 is listed as unsupported while all remaining options are supported.

firefox mse support

If you do not do that, you will only receive select resolutions for videos on YouTube when using the HTML5 video player. This is quite problematic as Google will force Firefox users to use the HTML5 video player from Firefox 33 on.

Mozilla has not enabled the feature by default yet, not even in the most recent Nightly version of Firefox. This is an indicator that the feature is not yet ready for prime time and that it may take a couple of release cycles before it will be enabled by default.

Most video resolutions become available after you enable Media Source Extensions in Firefox. What is still not supported afterwards however is MSE & H.264 which means that some videos may not play in all resolutions yet on the site.

Enable MSE & H.264

A new preference in Firefox Nightly 34 changes that however, so that support for all requested technologies is provided afterwards on YouTube.

Note: While the article concentrates on Google's video hosting platform, enabling support for MSE & H.264 will benefit users of the browser on other websites as well.

You need to create a new preference to do so:

  1. Type about:config and hit enter.
  2. Confirm you will be careful.
  3. Right-click and select New > Boolean.
  4. Name the preference media.mediasource.ignore_codecs.
  5. Set its value to True.

Update: Linux userrs may change the following preferences as well:

  1. media.mediasource.mp4.enabled to true
  2. media.fragmented-mp4.* to true
  3. media.fragmented-mp4.use-blank-decoder to false

If you go back to YouTube's HTML page, you should see all six technologies listed as supported (in green).

firefox mse h264 support

Several bugs need to be resolved before the feature will be enabled directly by Mozilla for all users of the browser. You can check out the mediasource progress here.

This means that you may get hangs or experience other issues after enabling mp4 container support for Media Source Extensions in the browser.

Still, it is great to see that Mozilla is working on support for the feature in Firefox. It is unclear if it will manage to resolve all issues before Firefox 33 gets released, as it may result in an increase in support requests when Firefox users notice that YouTube is serving them only some resolutions.

Comments

  1. Akira Phoenix said on
    Reply

    Well, now i can’t watch any videos.
    Thanks for fucking my YouTube experience up.

  2. vastymedoisa said on
    Reply

    Hi, on my OS I am able to watch 4k up to 120Mbps. What to do the see a simply 240p on Facebook without hang in Firefox? thanks. On Firefox I can watch videos only via Flash Player.

  3. pd said on
    Reply

    Excellent news. Maybe those boys in Kiwi land who AFAIK did significant video work are at it again. Excellent.

  4. Thomas said on
    Reply

    i have to uncheck (set to false)

    media.mediasource.webm.enabled

    on my core i5 notebook, otherwise youtube seems to use webm always and then there is no hw accel.

    something like

    https://www.youtube.com/watch?v=K4YDMmWBac4

    i can play @2160p with only ~10% CPU, with mediasource.webm enabled it’s going at 80% and stuttering all the time.

    1. pd said on
      Reply
      1. Thomas said on
        Reply

        thanks, yes, in the meantime i did, that works too.

        btw, upcoming firefox releases do perform a lot better on webm changelog for v51

        Improved video performance for users without GPU acceleration:

        – Less CPU Usage
        – Better full screen experience

        on my system there really is a big difference.

  5. pd said on
    Reply

    Using Firefox 49.0.1 now on Windows 10 and I have the first two columns ticked, but not “WebM VP8” or “MSE and WebM VP9”. I’d like to see all 6 boxes ticked though I’m not sure I can explain why :)

    Martin, this article is very cool but probably dated now. Recent articles like the h264ify article were good. Perhaps it would be helpful to update this article though?

    Keep up the great work. Ghacks is one of the most useful sites on the net from my PoV.

    1. Martin Brinkmann said on
      Reply

      I just checked Fx49 on two Windows machines and they have all boxed ticked on YouTube without me modifying preferences at all. Which version and OS are you running? Can you check and see what is listed under plugins?

      1. pd said on
        Reply

        My comment says Windows 10 :) Strictly “Windows 10 Enterprise 2015 LTSB”. Unsure if there’s a way to get a more exact version string in Windows 10?

        As for Firefox, it’s 49.0.1, x64, Build 20160922113459, release channel.

        Only plugin installed is:

        OpenH264 Video Codec provided by Cisco Systems, Inc.
        File: 1.6

        which is exactly how I like it :)

        NPAPI plugins BLOW! :)

        about:config prefs that may be related:

        media.mediasource.enabled;true
        media.mediasource.mp4.enabled;true
        media.mediasource.webm.audio.enabled;true
        media.mediasource.webm.enabled;true
        media.webm.intel_decoder.enabled;false

        Also, I’ve unticked “Play DRM content” under Tools > Options > Content

      2. Martin Brinkmann said on
        Reply

        This is rather strange. I have the same configuration and all boxes are ticked on YouTube in the same browser on the same OS. Do you have any add-on installed that might interfere with this? Could you try and check the page with Firefox’s Safe Mode enabled? Hold down Shift-key while you start Firefox.

  6. Anonymous said on
    Reply

    I will never understand why Mozilla blacklisted a GTX650, sicnce I am able to watch 4k 100Mbps with 5% CPU in full screen, instead in Firefox I am unable to watch a simply html5 240p.

  7. XP Forever said on
    Reply
  8. mben42 said on
    Reply

    This worked on Debian until an update that morning, every variables are still true but the second line of functionalities on https://www.youtube.com/html5 are red now. I have upgraded all packages, nothing changed. I can watch videos with HTML5 player but not in Full HD and 30FPS only.

  9. Anonymous said on
    Reply
  10. Anonymous said on
    Reply

    media.fragmented-mp4.gmp.enabled
    doesnt not exist.

  11. Anonymous said on
    Reply
  12. Chris said on
    Reply

    You SHOULD NOT set the “media.fragmented-mp4.gmp.enabled” pref to true. This pref is for developer testing only. With this pref enabled, Firefox will try to decode YouTube video using the Cisco OpenH264 codec. YouTube serves H.264 High Profile video, but OpenH264 can only decode H.264 Baseline Profile. OpenH264 is only intended for use with WebRTC video chat, for now.

    1. Thank You said on
      Reply

      Thank You Very Much. After following this post, html5 on youtube worked fine for a while. Around firefox 42 it stopped and would revert to using flash. Finally thought to check this post for anything new. Luckily found this comment. After changing back ‘media.fragmented-mp4.gmp.enabled’ to false. And html5 on youtube works again. Also made sure to set ‘media.fragmented-mp4.* to use firefox 43 defaults.

      While was in ‘about:config’, also made sure the rest that was suggested in this post was not causing any other issues. Looks that they are not as what is suggested here is default in firefox 43. Oh, this on Linux BTW.

      Chris, Thank You Very Much. Youtube works with html5 again :)

  13. MJS said on
    Reply

    Thanks for this!

  14. datruche said on
    Reply

    Firefox 40.0.3 on Win XP SP3: All is red on Youtube html5 test page, ie does not work.

    Intel Graphics GMA500 “Poulsbo”: Hardware acceleration on.
    CCCP installed and configured with both filters (MPEG4 Video (H264) 720×576 plays fine in mpc)
    Firefox: media.directshow.enabled;true && media.hardware-video-decoding.enabled;true && media.mediasource.mp4.enabled;true && media.fragmented-mp4.enabled;true && media.mediasource.webm.enabled

    Looks like there’s no H264 support in Windows XP. That’s what is said in these places:
    http://codecs.forumotion.net/t1710-html5-h-264-in-windows-xp-possible
    http://forums.mozillazine.org/viewtopic.php?f=38&t=2867807
    https://support.mozilla.org/fr/questions/1053509

  15. Set Elrich said on
    Reply

    I followed the instructions, and nothing changed. :/

    1. Taladas said on
      Reply

      Me too, I am on Linux and I followed the instructions but absolutely nothing has changed.

  16. Kurt said on
    Reply

    This doesn’t work anymore. media.mediasource.enabled is already true in 37.0.2, and adding ignore_codecs does nothing.

    Youtube only offers 360p as an option.

    1. Jay said on
      Reply

      Sounds like there is something wrong with MSE MP4 support for you then. Are you running Mac or Linux? That could be part of the reason.

      1. Kurt said on
        Reply

        EDIT: I just fixed it by setting “media.fragmented-mp4.enabled” to true. I’m using Windows 7, but this was in your Linux only users section.

        Now everything on the youtube HTML5 page is ticked.

    2. Jay said on
      Reply

      MSE is enabled by default in FF37. Youtube videos should play with DASH support now. If they aren’t for you try making sure “media.mediasource.mp4.enabled” and “media.mediasource.webm.enabled” are both set to true. Also make sure “media.mediasource.whitelist” is set to false if you want to use non-Youtube sites with MSE, though it should already be disabled in FF37.

      If you are still having issues, what OS are you running? Are all of the boxes checked on http://youtube.com/html5 ?

      1. Einar Ólafsson said on
        Reply

        Excellent addition to the tutorial, this fixed my last issue on getting “MSE & WebM VP9” checked of the list of supported features. I’m running a stable build (40.0.3) on Fedora 22.

      2. Kurt said on
        Reply

        Setting “media.mediasource.webm.enabled” to true fixed it. Thank you!

        MSE & H.264 and H.264 are red, but I can choose the quality now.

  17. Claymore said on
    Reply

    I thought, I’ll post my frankenstein-solution for smooth 1080p videos @60FPS at Youtube here:

    Firefox: 37.0
    Clean Profile: Yes
    Used OpenH264 Version: 1.3

    System specs:
    Q6600 @3.0Ghz
    8GB DDR2 RAM
    Club3D 7870 JokerCard

    Following settings are changed for it:
    media.fragmented-mp4.ffmpeg.enabled: true
    media.fragmented-mp4.gmp.enabled: true
    media.peerconnection.video.h264_enabled: true

    Tested video: https://www.youtube.com/watch?v=mii5yODkVa

    Yes, “MMSE & WebM VP9” won’t get enabled, but doesn’t really matter in this case.

  18. hugh said on
    Reply

    Hi Martin,

    I’m missing something here about the youtube html page.

    https://www.dropbox.com/s/p2dmdzl4et97wcf/not_enabled.jpg?dl=0

    I’ve managed since taking the screenshot to to enable the MSE & WebM VP9 after finding an older post of yours.

    However The remaining two H.264 and MSE & H.264 still have the red exclamation marks.

    Any advice appreciated,

    Hugh

    1. Martin Brinkmann said on
      Reply

      Which operating system are you using?

      1. hugh said on
        Reply

        Sorry for the delay

        Current OS = Windows 10 Pro.
        I think when I first posted it was Windows 8.1 Pro – but the youtube html page still shows the same information as in the originally posted screenshot.

        Cheers,

        Hugh

  19. Marc Aurel said on
    Reply

    Running FF 35.01 in Windows 7 and MSE still doesn’t work properly. Sound is sometimes lost and seeking back does not work, so no change from earlier, although Mozilla claims most of the bugs fixed now. Perhaps the nightly builds would work.

    Enabling MSE also causes Youtube to offer VP9 streams to FF by default, which means that you will lose hardware acceleration with most GPUs. That happens even with “ignore_codecs” enabled. With a modern CPU that is not a problem, but it certainly is on my secondary system with an older processor. 720p is choppy and 1080p is a slide show.

    1. Jay said on
      Reply

      Seems the plan is to have MSE enabled in FF36, but limited to Youtube and only Windows 7+(maybe Mac as well). It seems they are still having issues with MSE+MP4 on Linux, and MSE+WEBM still isn’t completely ready. Seems full MSE support will hit in FF37, but EME doesn’t seem ready yet so support for services like Netflix will likely still be awhile.

      NOTE: This is what I’ve gathered by reading the Bug Tracker, but there are hundreds of different bugs and issues being tracked related to MSE and EME making it hard to be sure, so things could always be delayed.

    2. Jay said on
      Reply

      MSE is working near flawlessly in FF37, so it’ll trickle down soon. I have none of the issues you mention in the latest DE build.

      PS: You can disable WebM support by disabling the following flag: “media.mediasource.webm.enabled”

      1. Marc Aurel said on
        Reply

        Thanks for your answer. Good to know that it’s improving. Do you know if they are going to enable MSE by default in FF37?

  20. Remi said on
    Reply

    Do not add the value to ignore codecs in “about:config”. You’ll lose sound in Youtube-Videos !

  21. Hisham said on
    Reply

    Thank you :)

  22. Jay said on
    Reply

    MSE works fine as far as I can tell. But I can see why they hid “ignore_codecs” from the config page. 1080p playback just stops playing randomly, and 720p keeps glitching, freezing, and occasionally the audio stops working. Hope Mozilla can sort this out soon as I really want to play 60fps in Firefox. For now I have to use ‘youtube-dl -g’ to grab the URLs for 60fps streams so I can watch them in VLC, or open Chrome.

    Firefox Developer Edition 35.0a2 (2014-11-14)

    EDIT: Slight correction. With MSE enabled, some 60fps videos do work with FF as they have WEBM 60fps streams, but playback is sporadic/laggy and not very watchable. Chrome plays the same videos fine at 60fps so it’s not my PC’s fault.

  23. pd said on
    Reply

    Ah nuts. Flipping Mozilla sure know how to make life hard on their users!

    1. Rick said on
      Reply

      Worked 1 time before something disabled it again. F it back to Opera 36

  24. pd said on
    Reply

    The CISCO h.264 codec is in my plugin list now.

    I’ve added the media.mediasource.ignore_codecs true boolean

    On this page: https://www.youtube.com/html5

    only HTMLVideoElement and WebM VP8 are available.

    So I’ve got a CISCO h.264 codec, the Flash plugin would have h.264 support, but YouTube thinks I can’t play h.264 videos. WTF? :)

    I’m keen to get rid of the crappy Flash plugin if I can finally use the HTML video tag with the CISCO h.264 codec.

    1. Martin Brinkmann said on
      Reply

      The Cisco plugin is currently only being used for WebRTC as far as I know.

  25. bedsitter said on
    Reply

    I’ve done this under Firefox 32.02, but MSE & H.264 is still signed red.
    Don’t know why this works for the author…

    1. Petre said on
      Reply

      It’s the same for me under Ubuntu

  26. Aramir said on
    Reply

    I did that and lost sound on youtube videos …. No thanks

    1. vita said on
      Reply

      i lost sound too. how to fix it?

  27. marius t said on
    Reply

    No thanks I’ll still use flash untill it really dies,my motto if it works don’t mess with it!I’ll force flash player with Youtube Center if I have to!

  28. geeknik said on
    Reply

    MSE on YouTube still doesn’t work properly. Seeking sometimes takes a lot of time, seeking back doesn’t work at all and repeat also doesn’t work. Just because you can flip the switch doesn’t mean you’re going to get MSE & H.264 support because according to a Mozilla developer, MP4 (H.264, etc.) aren’t supported in MSE yet. They are concentrating on Webm on YouTube right now.

    Relevant bugs: https://bugzilla.mozilla.org/show_bug.cgi?id=881512, https://bugzilla.mozilla.org/show_bug.cgi?id=1024858

    My advice, don’t force enable MSE for now unless you want a lot of YouTube headaches. ;)

  29. pd said on
    Reply

    Running Aurora on Windows XP, I still don’t have the Cisco h.264 codec. Any way to enable that?

    1. Martin Brinkmann said on
      Reply

      Not yet, it appears to be only available in Nightly right now.

  30. EuroScept1C said on
    Reply

    Right now best way to see videos on Youtube: IE11 and go to Safety-> ActiveX Filtering and enable it. It will play ALL videos on mp.4 format with DASH enabled, 1080p support and all. The most efficient way.

    1. RandomGuy said on
      Reply

      Thank you man, you really helped me out with that hint.
      Actually in my case it’s a problem with playing videos on YouPorn (and it’s partner sites) I have trouble with for the last couple of months (I don’t remember when this first came up). lol…

      The video starts playing fine, but this lasts only for a couple of minutes. Then the video just stops (sometimes just the video track, while the audio proceeds playing), also the minute counter keeps it’s value.
      At some point, a couple of minutes before video ends, it starts playing fine again. It’s a strange behaviour, in addition seeking does not work.

      I’m running Firefox ESR 38.7.1 on Windows 7. No Flash installed, so just HTML5 is used.
      And there was a time in the past where the videos played flawlessly on that system.

      So I tried enabling the media.mediasource.webm.enabled flag, explained above, but this didn’t change anything.
      For me it never came to mind trying Internet Explorer 11. … Just did this –> no issue there.

      So as a workaround I decided to (temporarily) change my user agent in Firefox to that one that IE11 uses.
      Works like a charm!

    2. lofr said on
      Reply

      install user agent switcher and set it to IE 11

    3. Rofl said on
      Reply

      IE, are you crazy?

      1. Lofty said on
        Reply

        Software has no opinion. Only people do. Such as yours.

Leave a Reply

By commenting, you accept our privacy policy and keep the discussion respectful and on topic.