28

According the the release notes for Firefox 26, h.264 video should now be working in Linux. It does also say the appropriate gstreamer plug-ins need to be installed. Does anyone know what these are?

I used this test site and the YouTube HTML5 page to verify that h.264 support works in Google Chrome on my Ubuntu 12.04 64-bit, but does not work on Firefox 26.

  • I have gstreamer0.10-plugins-good already installed. I am going to try installing gstreamer0.10-plugins-bad and gstreamer0.10-plugins-ugly – HarlemSquirrel Dec 11 '13 at 20:54
  • Note that this feature is present in Firefox since version 24. The only thing what is changed in 26 that it is now activated by default, previously you had to set media.gstreamer.enabled to true in about:config. – falconer Dec 11 '13 at 21:04
  • I don't have that in about:config @falconer - and I have Firefox 25 AND anything beginning with gstreamer :-( – Wilf Dec 11 '13 at 21:56
  • 1
    @wilf That's interesting. For me it works with no problem. But as I read on google it had to be enabled at compile time, and e.g. Fedora didn't allow it in their builds. Are you using FF builds from the official ubuntu repo? – falconer Dec 11 '13 at 22:16
  • While this is definitely not an answer to the question originally asked, I still think it's worth mentioning: HTML5 video, while ideologically better, may result in utterly terrible performance. When using youtube with the HTML5 player, I consistently see the CPU hit 100% no matter which machine I use, and stuttering is frequent. This indicates that there's a whole lot of software-decoding going on. When using the Adobe Flash Player w/HW accelleration[1], I'm getting the expected 10-20% CPU consumption while playing video. If a Core i7 with 12GBs of RAM cannot reliably play back HTML5 vide – Jostein Kjønigsen May 3 '14 at 11:23
31

For 12.04 / 14.04 / 18.10

Just visited the HTML5 Youtube test and I have H.264 checked; you probably will need to install Ubuntu restricted extras to get the gstreamer codecs.

sudo apt-get install ubuntu-restricted-extras

You may need to restart.

enter image description here

| improve this answer | |
  • 2
    That did the trick! So simple! I thought I already installed that...silly me. The ubuntu-restricted-extras package installed the following packages flashplugin-installer gstreamer0.10-ffmpeg gstreamer0.10-fluendo-mp3 gstreamer0.10-plugins-bad-multiverse libfaac0 libmjpegtools-1.9 libnspr4-0d libnss3-1d liboil0.3 ubuntu-restricted-addons – HarlemSquirrel Dec 11 '13 at 21:00
  • Same is true for 14.04 – Rael Gugelmin Cunha Nov 27 '15 at 23:26
  • 1
    Worked on 16.04 too! – Rael Gugelmin Cunha Mar 25 '16 at 13:45
  • Confirmed this works for 16.04 as well. Note that if you have installed the 32-bit Firefox (unusual) you MUST install the i386 version of the gstreamer library as well (32-bit Firefox can't use the 64-bit library): sudo apt-get install libavformat-ffmpeg56:i386 libavfilter-ffmpeg5:i386 gstreamer1.0-libav:i386 – Nate Lampton Jun 11 '16 at 0:33
  • How to get it without installing flash? – Gringo Suave Oct 19 '16 at 3:12
14

For 14.04

The solutions above are not working anymore with Trusty Tahr 14.04. The reason for this is the package gstreamer0.10-ffmpeg has been replaced by gstreamer1.0-libav but Firefox is planning to support gstreamer 1.0 only with version 30.

So in the meantime you can install the gstreamer0.10-ffmpeg from saucy for your appropriate architecture here :

| improve this answer | |
  • 4
    The link now leads to a 404 – Delapouite Apr 23 '14 at 17:54
  • Geoffrey: Can you add sources to back up your claim that "Firefox is planning to support gstreamer 1.0 only with version 30." Not that I doubt you, but pointing to an authorative source will be helpful for those of us who want to understand this problem. – Stefan Lasiewski Apr 27 '14 at 20:01
  • @Delapouite Hello, try using this ppa: launchpad.net/~jon-severinsson/+archive/ffmpeg to download ffmpeg for 14.04 – Akronix May 3 '14 at 22:30
  • 2
    Firefox 30 is now in uptopic -proposed & supports .h264 thru gstreamer1.0-libav package. At some point it should show up in 14.04 though currently I use the utopic -proposed package in 14.04 with no issues. The 0.10-ffmpeg plugin will remain in ppa for apps that haven't yet ported to gst-1.0 – doug Jun 1 '14 at 18:05
  • 1
    Firefox > 35 works with h264 without any extra ppa in ubuntu 14.04 For Video install gstreamer1.0-libav For Audio install gstreamer1.0-fluendo-mp3 – Mariuz Jan 16 '15 at 12:43
9

Firefox 33 and beyond

Mozilla added support for OpenH264 as a plugin in Firefox 33. To enable this plugin Firefox will now automatically download a binary from the OpenH264 website the first time you start the program.

That sounds great, doesn't it? Wait… that was a pun.

While this is indeed a very convenient solution it should also raise privacy and security concerns when software automatically downloads binaries from sites affiliated with Cisco Systems or other companies, no matter how transparent the process and license agreement is.

Not directly related but if you prefer to automatically delete cookies when Firefox gets closed and can't find the right cookie to keep for persistent HTML5 playback then I suggest to install YouTube ALL HTML5.

Tests with 14.04.2 and 15.04 VMs

My guess was that only installing an H.264 decoder binary wouldn't be enough, so I set up 2 new virtual machines:

  • Ubuntu 14.04.2 with restricted addons installed during installation
  • Ubuntu 15.04 without restricted addons installed during installation

After the installation of both VMs was completed I booted the systems, updated them again, installed VM guest additions, started Firefox for the first time and rebooted for the actual testing.

Since YouTube also offers their open sourced WebM formats and I wanted to avoid going into to much detail about test methods I needed to use another HTML5 capable site to test proprietary H.264 playback support. I chose Vimeo, because they say they default to HTML5 and they don't seem to support WebM, which I consider not to be a good thing.

Whenever I made some changes in the test, like installing a package or enabling/disabling something in Firefox I closed and launched Firefox again.

14.04.2 with restricted addons

enter image description here

As you can see in this screenshot only the OpenH264 plugin is enabled in Firefox, all the necessary GStreamer packages in different versions are preinstalled and the video plays as expected.

15.04 without restricted addons

enter image description here

As you can see in this screenshot the OpenH264 plugin is enabled, there is no Flash plugin, a few GStreamer packages in different versions are preinstalled but the video does not play! Instead the site immediately tells us that the video can't be played. Why is that?

enter image description here

  • AAC is missing! – To put an explanation simple, there is a file on the server that is fed into our browser. If you look for it using the inspector from the context menu in Firefox, you will find an MP4 with AAC-encoded audio. The error message could be more clear but it makes sense since we don't have a decoder for AAC currently installed.
  • Update: Looking again into this issue with Firefox 41, I found that OpenH264 seems to be disabled in about:config through:

    media.fragmented-mp4.exposed;false
    media.fragmented-mp4.gmp.enabled;false
    

    Setting these to true had no effect. Further settings I tried:

    • media.audio_data.enabled;true no effect.
    • media.mediasource.enabled;true Vimeo didn't use MSE before, enabling these and related settings had no effect.
    • media.fragmented-mp4.use-blank-decoder;true result: a solid green canvas and a constant sine wave audio signal.

15.04 with restricted addons

A smart approach would have been to install gstreamer1.0-plugins-bad-faad, but this doesn't make the particular error message on Vimeo go way, so let's install all the restricted addons.

enter image description here

As expected, everything works if you install the restricted addons package afterwards, but you may want to set the Flash plugin to something else than enabled in Firefox to be sure to use HTML5 video.

Analysis or just make it break

enter image description here

Apparently gstreamer1.0-libav is the only package you need to remove to get the error message back. So it was using libav's AAC decoder? I didn't dig deeper to find proof for that nor did I look for which decoder will be preferred (e.g. if OpenH264 is of any use currently on Linux) or if Vimeo throws this error message due to some other dependency not being met despite H.264 and AAC decoders being installed.

Summary and outlook

To sum it up, playback of current mainstream content does not only require an H.264 decoder but also an AAC decoder and H.265 is already preparing to replace the older one. Also I don't see the corresponding specification for MP4s with H.264 to be changed towards recommending a more open source friendly audio codec in the foreseeable future.

Seriously, push for WebM! You get VP8 + Vorbis as the H.264/AVC contender and VP9 + Opus as the H.265/HEVC contender.

| improve this answer | |
  • On 15.04, do you actually have the html5 youtube player working? For me, the video plays, but no sound. I have all of the mentioned packages installed. Using FF 38. – naught101 Jun 17 '15 at 14:38
  • Very interesting. Could you tell us if installing the audio codec has an effect on the H264 decoding available value on about:support? – Martin Hansen Nov 2 '15 at 11:39
2

Firefox currently uses OpenH264 only for WebRTC and not for the video tag, because OpenH264 does not yet support the high profile format frequently used for streaming video.

Source: http://andreasgal.com/2014/10/14/openh264-now-in-firefox/

gstreamer1.0-libav is probably the only option to add support for the H264 HTML5 video tag in Firefox for Linux.

| improve this answer | |
  • It's alone sufficient for Firefox on Ubuntu 18.04 LTS. – kubanczyk May 2 '19 at 13:46
0

With Firefox30 you have to install gstreamer 1.0. You should also install most of the plugins : bad,ugly,...

Don't get confuse by the package name, you should install : gstreamer1, not gstreamer (the one/1 number is as part of the package and not a "version"). The same rules apply for all plugins : "gstreamer1-plugins-..."

Here's a more complete url to test your browser html5 capabilities and codec support : http://html5test.com/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.